Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:34

0001 #ifndef QA_QAG4SIMULATIONCALORIMETERSUM_H
0002 #define QA_QAG4SIMULATIONCALORIMETERSUM_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <cstdint>
0007 #include <memory>
0008 #include <string>
0009 
0010 class PHCompositeNode;
0011 class PHG4TruthInfoContainer;
0012 class PHG4Particle;
0013 class CaloEvalStack;
0014 class SvtxEvalStack;
0015 class SvtxTrack;
0016 
0017 /// \class QAG4SimulationCalorimeterSum
0018 class QAG4SimulationCalorimeterSum : public SubsysReco
0019 {
0020  public:
0021   enum enu_flags
0022   {
0023     //    kProcessTower = 1 << 1,
0024     kProcessCluster = 1 << 2,    // histograms of best cluster matched to truth particle
0025     kProcessTrackProj = 1 << 3,  // histograms of tower/tower sums VS track projections
0026 
0027     kDefaultFlag = kProcessCluster | kProcessTrackProj
0028   };
0029 
0030   QAG4SimulationCalorimeterSum(enu_flags flags = kDefaultFlag);
0031 
0032   ~QAG4SimulationCalorimeterSum() override = default;
0033 
0034   int Init(PHCompositeNode *topNode) override;
0035   int InitRun(PHCompositeNode *topNode) override;
0036   int process_event(PHCompositeNode *topNode) override;
0037 
0038   uint32_t
0039   get_flags() const
0040   {
0041     return _flags;
0042   }
0043 
0044   void
0045   set_flags(enu_flags flags)
0046   {
0047     _flags = (uint32_t) flags;
0048   }
0049 
0050   void
0051   set_flag(enu_flags flag)
0052   {
0053     _flags |= (uint32_t) flag;
0054   }
0055 
0056   bool
0057   flag(enu_flags flag)
0058   {
0059     return _flags & flag;
0060   }
0061 
0062   void
0063   reset_flag(enu_flags flag)
0064   {
0065     _flags &= ~(uint32_t) flag;
0066   }
0067 
0068   //! common prefix for QA histograms
0069   std::string
0070   get_histo_prefix();
0071 
0072   const std::string &get_calo_name_cemc() const
0073   {
0074     return _calo_name_cemc;
0075   }
0076 
0077   void
0078   set_calo_name_cemc(const std::string &caloNameCemc)
0079   {
0080     _calo_name_cemc = caloNameCemc;
0081   }
0082 
0083   const std::string &get_calo_name_hcalin() const
0084   {
0085     return _calo_name_hcalin;
0086   }
0087 
0088   void
0089   set_calo_name_hcalin(const std::string &caloNameHcalin)
0090   {
0091     _calo_name_hcalin = caloNameHcalin;
0092   }
0093 
0094   const std::string &get_calo_name_hcalout() const
0095   {
0096     return _calo_name_hcalout;
0097   }
0098 
0099   void
0100   set_calo_name_hcalout(const std::string &caloNameHcalout)
0101   {
0102     _calo_name_hcalout = caloNameHcalout;
0103   }
0104 
0105   float get_mag_field() const { return _magField; }
0106   void set_mag_field(float magField) { _magField = magField; }
0107 
0108  private:
0109   //  int
0110   //  Init_Tower(PHCompositeNode *topNode);
0111   //  int
0112   //  process_event_Tower(PHCompositeNode *topNode);
0113 
0114   int Init_Cluster(PHCompositeNode *topNode);
0115   int process_event_Cluster(PHCompositeNode *topNode);
0116 
0117   int Init_TrackProj(PHCompositeNode *topNode);
0118   int process_event_TrackProj(PHCompositeNode *topNode);
0119 
0120   std::shared_ptr<CaloEvalStack> _caloevalstack_cemc;
0121   std::shared_ptr<CaloEvalStack> _caloevalstack_hcalin;
0122   std::shared_ptr<CaloEvalStack> _caloevalstack_hcalout;
0123   std::shared_ptr<SvtxEvalStack> _svtxevalstack;
0124 
0125   uint32_t _flags;
0126 
0127   std::string _calo_name_cemc;
0128   std::string _calo_name_hcalin;
0129   std::string _calo_name_hcalout;
0130 
0131   PHG4TruthInfoContainer *_truth_container;
0132 
0133   //! fetch the truth particle to be analyzed. By default it is the last primary particle in truth container (therefore works in single particle embedding)
0134   PHG4Particle *
0135   get_truth_particle();
0136 
0137   //! fetch tower around track and histogram energy distributions
0138   bool
0139   eval_trk_proj(const std::string &detector, SvtxTrack *track,
0140                 PHCompositeNode *topNode);
0141 
0142   //! central magnetic field strength in T
0143   float _magField;
0144 
0145   enum
0146   {
0147     //! max number of tower row/column to process around a track projection
0148     Max_N_Tower = 11
0149   };
0150 };
0151 
0152 #endif  // QA_QAG4SIMULATIONCALORIMETERSUM_H