Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:51

0001 #ifndef G4CALO_HCALRAWTOWERBUILDER_H
0002 #define G4CALO_HCALRAWTOWERBUILDER_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <phparameter/PHParameterInterface.h>
0007 
0008 #include <cmath>
0009 #include <map>  // for map
0010 #include <string>
0011 #include <utility>  // for pair
0012 #include <vector>
0013 
0014 class PHCompositeNode;
0015 class RawTowerContainer;
0016 class RawTowerGeomContainer;
0017 
0018 class HcalRawTowerBuilder : public SubsysReco, public PHParameterInterface
0019 {
0020  public:
0021   HcalRawTowerBuilder(const std::string &name = "HcalRawTowerBuilder");
0022   ~HcalRawTowerBuilder() override = default;
0023 
0024   int InitRun(PHCompositeNode *topNode) override;
0025   int process_event(PHCompositeNode *topNode) override;
0026   void Detector(const std::string &d)
0027   {
0028     m_InputDetector = d;
0029     m_OutputDetector = d;
0030   }
0031   void InDetector(const std::string &d) { m_InputDetector = d; }
0032   void OutDetector(const std::string &d) { m_OutputDetector = d; }
0033   void EminCut(const double e) { m_Emin = e; }
0034   void checkenergy(const int i = 1) { m_ChkEnergyConservationFlag = i; }
0035 
0036   enum enu_tower_energy_src
0037   {
0038     //! save Geant4 energy deposition as the weight of the cells
0039     kEnergyDeposition,
0040 
0041     //! save light yield as the weight of the cells
0042     kLightYield,
0043 
0044     //! save ionization energy
0045     kIonizationEnergy,
0046 
0047     //! save raw light yield (before Mephi map) as the weight of the cells
0048     kRawLightYield,
0049 
0050     //! initialization value
0051     unknown = -1
0052   };
0053   enum ProcessTowerType
0054   {
0055     kRawTowerOnly = 0,
0056     kTowerInfoOnly = 1,
0057     kBothTowers = 2
0058   };
0059 
0060   int get_tower_energy_src() const
0061   {
0062     return m_TowerEnergySrc;
0063   }
0064 
0065   const std::string
0066   &get_sim_tower_node_prefix() const
0067   {
0068     return m_SimTowerNodePrefix;
0069   }
0070 
0071   void
0072   set_sim_tower_node_prefix(const std::string &simTowerNodePrefix)
0073   {
0074     m_SimTowerNodePrefix = simTowerNodePrefix;
0075   }
0076 
0077   short get_tower_row(const short cellrow) const;
0078 
0079   void set_decal_filename(const std::string &fname) { m_DeCalibrationFileName = fname; }
0080 
0081   void SetDefaultParameters() override;
0082 
0083   void set_cell_decal_factor(const int etabin, const int phibin, const double d);
0084   void set_tower_decal_factor(const int etabin, const int phibin, const double d);
0085   void Print(const std::string &what = "ALL") const override;
0086 
0087   void set_towerinfo(HcalRawTowerBuilder::ProcessTowerType UseTowerInfo)
0088   {
0089     m_UseTowerInfo = UseTowerInfo;
0090   }
0091 
0092  private:
0093   void CreateNodes(PHCompositeNode *topNode);
0094   void ReadParamsFromNodeTree(PHCompositeNode *topNode);
0095   void SetTowerDecalFactors();
0096   void set_tower_decal_factor_real(const int etabin, const int phibin, const double d);
0097 
0098   RawTowerContainer *m_Towers {nullptr};
0099   RawTowerGeomContainer *m_RawTowerGeom {nullptr};
0100 
0101   double m_Emin {std::numeric_limits<double>::quiet_NaN()};
0102   int m_ChkEnergyConservationFlag {0};
0103   int m_TowerEnergySrc {enu_tower_energy_src::unknown};
0104   int m_NcellToTower {-1};
0105   HcalRawTowerBuilder::ProcessTowerType m_UseTowerInfo {HcalRawTowerBuilder::ProcessTowerType::kBothTowers};  // 0 just produce RawTowers, 1 just produce TowerInfo objects, and 2 produce both
0106 
0107   std::string m_OutputDetector;
0108   std::string m_InputDetector;
0109   std::string m_TowerNodeName;
0110   std::string m_TowerInfoNodeName;
0111   std::string m_TowerGeomNodeName;
0112   std::string m_SimTowerNodePrefix;
0113   std::string m_DeCalibrationFileName;
0114   std::vector<std::vector<double> > m_DecalArray;
0115   std::map<std::pair<int, int>, double> m_TowerDecalFactors;
0116 };
0117 
0118 #endif /* G4CALO_HCALRAWTOWERBUILDER_H */