Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-08-31 08:22:29

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4DETECTORS_PHG4GEANTINOIONIZATION_H
0004 #define G4DETECTORS_PHG4GEANTINOIONIZATION_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <array>
0009 #include <string>
0010 
0011 class PHCompositeNode;
0012 class PHG4HitContainer;
0013 class PHG4TruthInfoContainer;
0014 
0015 /**
0016  * Replaces the negative energy-deposition sentinel stored for charged
0017  * geantinos with a detector-dependent mean MIP ionization.
0018  *
0019  * This module must run after G4HIT_* nodes are loaded and before detector hit
0020  * reconstruction. It intentionally models only the mean energy deposition;
0021  * downstream detector modules retain their existing fluctuations.
0022  */
0023 class PHG4GeantinoIonization : public SubsysReco
0024 {
0025  public:
0026   explicit PHG4GeantinoIonization(const std::string& name = "PHG4GeantinoIonization");
0027   ~PHG4GeantinoIonization() override = default;
0028 
0029   int InitRun(PHCompositeNode* topNode) override;
0030   int process_event(PHCompositeNode* topNode) override;
0031 
0032   void set_particle_name(const std::string& name) { m_particleName = name; }
0033 
0034   void set_mvtx_enabled(bool value) { m_detectorConfigs[0].enabled = value; }
0035   void set_intt_enabled(bool value) { m_detectorConfigs[1].enabled = value; }
0036   void set_tpc_enabled(bool value) { m_detectorConfigs[2].enabled = value; }
0037   void set_micromegas_enabled(bool value) { m_detectorConfigs[3].enabled = value; }
0038   void set_tpot_enabled(bool value) { set_micromegas_enabled(value); }
0039 
0040   void set_mvtx_mip_dedx(double value);
0041   void set_intt_mip_dedx(double value);
0042 
0043  private:
0044   enum class DetectorId
0045   {
0046     mvtx,
0047     intt,
0048     tpc,
0049     tpot
0050   };
0051 
0052   struct DetectorConfig
0053   {
0054     DetectorId detector;
0055     std::string name;
0056     std::string hitNodeName;
0057     bool enabled = true;
0058   };
0059 
0060   void process_detector(
0061       PHG4HitContainer* hits,
0062       const PHG4TruthInfoContainer* truthInfo,
0063       const DetectorConfig& config) const;
0064 
0065   double mip_dedx(DetectorId detector) const;
0066 
0067   std::array<DetectorConfig, 4> m_detectorConfigs;
0068   std::string m_particleName = "chargedgeantino";
0069   double m_tpcMipDedx = 0;
0070 };
0071 
0072 #endif  // G4DETECTORS_PHG4GEANTINOIONIZATION_H