Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:33

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 
0145  protected:
0146   int Getpeaktime(TH1* h);
0147   std::string detector;
0148   std::string outfilename;
0149 
0150   bool reqTrig = true;
0151   std::vector<int> triggerList;
0152   bool reqVertex = false;
0153   std::string m_fieldname = "CEMC_calib_ADC_to_ETower";
0154 
0155   bool doVtxCut{true};
0156   float vtx_z_cut{20};
0157   bool m_use_vertextype{false};
0158   GlobalVertex::VTXTYPE m_vertex_type{GlobalVertex::UNDEFINED};
0159 
0160   float pt1BaseClusCut{1.3};
0161   float pt2BaseClusCut{0.7};
0162   float NclusDeptFac{1.4};
0163 
0164   std::vector<float> m_energy;
0165   std::vector<int> m_etabin;
0166   std::vector<int> m_phibin;
0167   std::vector<int> m_time;
0168 
0169   std::vector<float> m_hcalin_energy;
0170   std::vector<int> m_hcalin_etabin;
0171   std::vector<int> m_hcalin_phibin;
0172   std::vector<int> m_hcalin_time;
0173 
0174   std::vector<float> m_hcalout_energy;
0175   std::vector<int> m_hcalout_etabin;
0176   std::vector<int> m_hcalout_phibin;
0177   std::vector<int> m_hcalout_time;
0178 
0179   std::vector<float> m_zdc_energy;
0180   std::vector<int> m_zdc_index;
0181   std::vector<int> m_zdc_side;
0182 
0183   std::vector<float> m_bbc_energy;
0184   std::vector<int> m_bbc_type;
0185   std::vector<int> m_bbc_side;
0186 
0187   std::array<TH1*, 96> h_mass_eta_lt{};
0188   std::array<std::array<TH1*, 256>, 96> h_mass_tbt_lt{};
0189 
0190   int _eventcounter{0};
0191   int _range{1};
0192 
0193   float _vz{0.};
0194   float target_pi0_mass{0.146};
0195 
0196   bool dynMaskClus{false};
0197   bool doMix{false};
0198   bool use_pdc{false};
0199   bool runTowByTow{true};        // default set not to run tbt
0200   bool runTBTCompactMode{true};  // default set to run in compact mode
0201 
0202   std::vector<std::vector<std::vector<CLHEP::Hep3Vector>>>* clusMix;
0203   const int NBinsClus{10};
0204   TH1* h_vtx_bin{nullptr};
0205   int NBinsVtx{30};
0206   TH1* h_event{nullptr};
0207 
0208   TFile* outfile{nullptr};
0209   Fun4AllHistoManager* hm{nullptr};
0210 
0211   TH2* h_emcal_mbd_correlation{nullptr};
0212   TH2* h_ohcal_mbd_correlation{nullptr};
0213   TH2* h_ihcal_mbd_correlation{nullptr};
0214   TH2* h_emcal_hcal_correlation{nullptr};
0215   TH2* h_emcal_zdc_correlation{nullptr};
0216 
0217   TH1* h_InvMass{nullptr};
0218   TH1* h_InvMassMix{nullptr};
0219 
0220   TH1* h_target_mass{nullptr};
0221   bool use_h_target_mass{false};
0222 
0223   TH2* h_cemc_etaphi{nullptr};
0224   TH2* h_hcalin_etaphi{nullptr};
0225   TH2* h_hcalout_etaphi{nullptr};
0226   TH2* h_cemc_etaphi_wQA{nullptr};
0227   TH2* h_hcalin_etaphi_wQA{nullptr};
0228   TH2* h_hcalout_etaphi_wQA{nullptr};
0229   TH1* h_totalzdc_e{nullptr};
0230   TH3* h_ieta_iphi_invmass{nullptr};
0231 
0232   bool useVertexTruth = false;
0233 
0234   TProfile2D* h_cemc_etaphi_time{nullptr};
0235   TProfile2D* h_hcalin_etaphi_time{nullptr};
0236   TProfile2D* h_hcalout_etaphi_time{nullptr};
0237 
0238   TProfile2D* h_cemc_etaphi_badChi2{nullptr};
0239   TProfile2D* h_hcalin_etaphi_badChi2{nullptr};
0240   TProfile2D* h_hcalout_etaphi_badChi2{nullptr};
0241 
0242   TH1* hzdctime{nullptr};
0243   TH1* hmbdtime{nullptr};
0244   TH1* hemcaltime{nullptr};
0245   TH1* hihcaltime{nullptr};
0246   TH1* hohcaltime{nullptr};
0247 
0248   TH1* hzdctime_cut{nullptr};
0249   TH1* hmbdtime_cut{nullptr};
0250   TH1* hemcaltime_cut{nullptr};
0251   TH1* hihcaltime_cut{nullptr};
0252   TH1* hohcaltime_cut{nullptr};
0253 
0254   TH1* hvtx_z_raw{nullptr};
0255   TH1* hvtx_z_cut{nullptr};
0256 
0257   TH1* hzdcSouthraw{nullptr};
0258   TH1* hzdcNorthraw{nullptr};
0259   TH1* hzdcSouthcalib{nullptr};
0260   TH1* hzdcNorthcalib{nullptr};
0261 
0262   TH1* h_clus_pt{nullptr};
0263   TH2* h_etaphi_clus{nullptr};
0264 
0265   TNtuple* g4hitntuple{nullptr};
0266   TNtuple* g4cellntuple{nullptr};
0267   TTree* towerntuple{nullptr};
0268   TNtuple* clusterntuple{nullptr};
0269   TH1* h_cemc_etaphi_noCalib{nullptr};
0270 
0271   TH1* h_pt1{nullptr};
0272   TH1* h_pt2{nullptr};
0273   TH1* h_nclusters{nullptr};
0274   TH1* h_emcal_e_eta{nullptr};
0275 
0276   TriggerAnalyzer* trigAna{nullptr};
0277 
0278   float convLev = {0.005};
0279 };
0280 
0281 #endif