Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-18 09:17:45

0001 #ifndef CALOEMCPI0TBT_PI0ETABYETA_H
0002 #define CALOEMCPI0TBT_PI0ETABYETA_H
0003 
0004 #include <globalvertex/GlobalVertex.h>
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 // #include <CLHEP/Vector/ThreeVector.h>  // for Hep3Vector
0009 #include <array>
0010 #include <string>  // for string
0011 #include <vector>
0012 
0013 // Forward declarations
0014 class Fun4AllHistoManager;
0015 class PHCompositeNode;
0016 class TFile;
0017 class TNtuple;
0018 class TTree;
0019 class TH2;
0020 class TH1;
0021 class TF1;
0022 class TProfile2D;
0023 class TH3;
0024 class TriggerAnalyzer;
0025 
0026 namespace CLHEP
0027 {
0028   class Hep3Vector;
0029 }
0030 
0031 class pi0EtaByEta : public SubsysReco
0032 {
0033  public:
0034   //! constructor
0035   pi0EtaByEta(const std::string& name = "pi0EtaByEta", const std::string& filename = "MyNtuple.root");
0036 
0037   //! destructor
0038   virtual ~pi0EtaByEta();
0039 
0040   //! full initialization
0041   int Init(PHCompositeNode*);
0042 
0043   //! event processing method
0044   int process_event(PHCompositeNode*);
0045 
0046   //! end of run method
0047   int End(PHCompositeNode*);
0048 
0049   int process_g4hits(PHCompositeNode*);
0050   int process_g4cells(PHCompositeNode*);
0051   int process_towers(PHCompositeNode*);
0052   int process_clusters(PHCompositeNode*);
0053 
0054   void Detector(const std::string& name) { detector = name; }
0055   void set_timing_cut_width(const int t) { _range = t; }
0056   void set_vertex_cut(const float v) { _vz = v; }
0057   void apply_vertex_cut(bool Vtx_cut) { doVtxCut = Vtx_cut; }
0058 
0059   static TF1* fitHistogram(TH1* h);
0060   void fitEtaSlices(const std::string& infile, const std::string& outfile, const std::string& cdbFile);
0061 
0062   void fitEtaPhiTowers(const std::string& infile, const std::string& fitOutFile, const std::string& cdbFile);  // for tbt pi0 fit
0063 
0064   void Split3DHist(const std::string& infile, const std::string& out_file);
0065 
0066   void set_use_pdc(bool state)
0067   {
0068     use_pdc = state;
0069     return;
0070   }
0071   void set_pt1BaseClusCut(float fac)
0072   {
0073     pt1BaseClusCut = fac;
0074     return;
0075   }
0076   void set_pt2BaseClusCut(float fac)
0077   {
0078     pt2BaseClusCut = fac;
0079     return;
0080   }
0081   void set_NclusDeptFac(float fac)
0082   {
0083     NclusDeptFac = fac;
0084     return;
0085   }
0086   void set_doMix(bool state)
0087   {
0088     doMix = state;
0089     return;
0090   }
0091   void set_calibConvLev(float val)
0092   {
0093     convLev = val;
0094     return;
0095   }
0096   void set_RunTowByTow(bool state)  // to decide if we want to run tbt (default is true)
0097   {
0098     runTowByTow = state;
0099     return;
0100   }
0101   void SetTargetMass(float mass)
0102   {
0103     target_pi0_mass = mass;
0104   }
0105 
0106   void set_RunTBTCompactMode(bool state)  // to decide if we want to run in TBT in compact mode (default is true)
0107   {
0108     runTBTCompactMode = state;
0109     return;
0110   }
0111 
0112   void set_massTargetHistFile(const std::string& file);
0113   bool checkOutput(const std::string& file);
0114   void set_reqTrig(bool status, const std::vector<int>& list)
0115   {
0116     reqTrig = status;
0117     triggerList = list;
0118   }
0119   void set_reqTrig(bool status)
0120   {
0121     reqTrig = status;
0122   }
0123 
0124   void set_GlobalVertexType(GlobalVertex::VTXTYPE type)
0125   {
0126     m_use_vertextype = true;
0127     m_vertex_type = type;
0128   }
0129 
0130   void set_requireVertex(bool state)
0131   {
0132     reqVertex = state;
0133     return;
0134   }
0135 
0136   void set_useVertexTruth(bool state)
0137   {
0138     useVertexTruth = state;
0139   }
0140   void set_calib_fieldname(std::string &name)
0141   {
0142     m_fieldname = name;
0143   } 
0144   void set_ptClusMax(float val)
0145   {
0146     ptClusMax = val;
0147   }
0148 
0149  protected:
0150   int Getpeaktime(TH1* h);
0151   std::string detector;
0152   std::string outfilename;
0153 
0154   bool reqTrig = true;
0155   std::vector<int> triggerList;
0156   bool reqVertex = false;
0157   std::string m_fieldname = "CEMC_calib_ADC_to_ETower";
0158 
0159   bool doVtxCut{true};
0160   float vtx_z_cut{20};
0161   bool m_use_vertextype{false};
0162   GlobalVertex::VTXTYPE m_vertex_type{GlobalVertex::UNDEFINED};
0163 
0164   float pt1BaseClusCut{1.3};
0165   float pt2BaseClusCut{0.7};
0166   float NclusDeptFac{1.4};
0167 
0168   std::vector<float> m_energy;
0169   std::vector<int> m_etabin;
0170   std::vector<int> m_phibin;
0171   std::vector<int> m_time;
0172 
0173   std::vector<float> m_hcalin_energy;
0174   std::vector<int> m_hcalin_etabin;
0175   std::vector<int> m_hcalin_phibin;
0176   std::vector<int> m_hcalin_time;
0177 
0178   std::vector<float> m_hcalout_energy;
0179   std::vector<int> m_hcalout_etabin;
0180   std::vector<int> m_hcalout_phibin;
0181   std::vector<int> m_hcalout_time;
0182 
0183   std::vector<float> m_zdc_energy;
0184   std::vector<int> m_zdc_index;
0185   std::vector<int> m_zdc_side;
0186 
0187   std::vector<float> m_bbc_energy;
0188   std::vector<int> m_bbc_type;
0189   std::vector<int> m_bbc_side;
0190 
0191   std::array<TH1*, 96> h_mass_eta_lt{};
0192   std::array<std::array<TH1*, 256>, 96> h_mass_tbt_lt{};
0193 
0194   int _eventcounter{0};
0195   int _range{1};
0196 
0197   float _vz{0.};
0198   float target_pi0_mass{0.146};
0199   float ptClusMax{4};
0200 
0201   bool dynMaskClus{false};
0202   bool doMix{false};
0203   bool use_pdc{false};
0204   bool runTowByTow{true};        // default set not to run tbt
0205   bool runTBTCompactMode{true};  // default set to run in compact mode
0206 
0207   std::vector<std::vector<std::vector<CLHEP::Hep3Vector>>>* clusMix;
0208   const int NBinsClus{10};
0209   TH1* h_vtx_bin{nullptr};
0210   int NBinsVtx{30};
0211   TH1* h_event{nullptr};
0212   TH2* h_m_IB{nullptr};
0213 
0214   TFile* outfile{nullptr};
0215   Fun4AllHistoManager* hm{nullptr};
0216 
0217   TH2* h_emcal_mbd_correlation{nullptr};
0218   TH2* h_ohcal_mbd_correlation{nullptr};
0219   TH2* h_ihcal_mbd_correlation{nullptr};
0220   TH2* h_emcal_hcal_correlation{nullptr};
0221   TH2* h_emcal_zdc_correlation{nullptr};
0222 
0223   TH1* h_InvMass{nullptr};
0224   TH1* h_InvMassMix{nullptr};
0225 
0226   TH1* h_target_mass{nullptr};
0227   bool use_h_target_mass{false};
0228 
0229   TH2* h_cemc_etaphi{nullptr};
0230   TH2* h_hcalin_etaphi{nullptr};
0231   TH2* h_hcalout_etaphi{nullptr};
0232   TH2* h_cemc_etaphi_wQA{nullptr};
0233   TH2* h_hcalin_etaphi_wQA{nullptr};
0234   TH2* h_hcalout_etaphi_wQA{nullptr};
0235   TH1* h_totalzdc_e{nullptr};
0236   TH3* h_ieta_iphi_invmass{nullptr};
0237 
0238   bool useVertexTruth = false;
0239 
0240   TProfile2D* h_cemc_etaphi_time{nullptr};
0241   TProfile2D* h_hcalin_etaphi_time{nullptr};
0242   TProfile2D* h_hcalout_etaphi_time{nullptr};
0243 
0244   TProfile2D* h_cemc_etaphi_badChi2{nullptr};
0245   TProfile2D* h_hcalin_etaphi_badChi2{nullptr};
0246   TProfile2D* h_hcalout_etaphi_badChi2{nullptr};
0247 
0248   TH1* hzdctime{nullptr};
0249   TH1* hmbdtime{nullptr};
0250   TH1* hemcaltime{nullptr};
0251   TH1* hihcaltime{nullptr};
0252   TH1* hohcaltime{nullptr};
0253 
0254   TH1* hzdctime_cut{nullptr};
0255   TH1* hmbdtime_cut{nullptr};
0256   TH1* hemcaltime_cut{nullptr};
0257   TH1* hihcaltime_cut{nullptr};
0258   TH1* hohcaltime_cut{nullptr};
0259 
0260   TH1* hvtx_z_raw{nullptr};
0261   TH1* hvtx_z_cut{nullptr};
0262 
0263   TH1* hzdcSouthraw{nullptr};
0264   TH1* hzdcNorthraw{nullptr};
0265   TH1* hzdcSouthcalib{nullptr};
0266   TH1* hzdcNorthcalib{nullptr};
0267 
0268   TH1* h_clus_pt{nullptr};
0269   TH2* h_etaphi_clus{nullptr};
0270 
0271   TNtuple* g4hitntuple{nullptr};
0272   TNtuple* g4cellntuple{nullptr};
0273   TTree* towerntuple{nullptr};
0274   TNtuple* clusterntuple{nullptr};
0275   TH1* h_cemc_etaphi_noCalib{nullptr};
0276 
0277   TH1* h_pt1{nullptr};
0278   TH1* h_pt2{nullptr};
0279   TH1* h_nclusters{nullptr};
0280   TH1* h_emcal_e_eta{nullptr};
0281   TH2* h_m_pt{nullptr};
0282   TH1* h_tower_e{nullptr};
0283 
0284   TriggerAnalyzer* trigAna{nullptr};
0285 
0286   float convLev = {0.005};
0287 };
0288 
0289 #endif