File indexing completed on 2025-08-05 08:12:21
0001 #ifndef CALOANA_H__
0002 #define CALOANA_H__
0003
0004 #include <fun4all/SubsysReco.h>
0005 #include <vector>
0006
0007 class Fun4AllHistoManager;
0008 class PHCompositeNode;
0009 class TFile;
0010 class TNtuple;
0011 class TTree;
0012 class TH2F;
0013 class TH1F;
0014 class TH1;
0015 class TF1;
0016 class TProfile2D;
0017 class TLorentzVector;
0018 class TRandom3;
0019
0020 class CaloAna : public SubsysReco
0021 {
0022 public:
0023
0024 CaloAna(const std::string &name = "CaloAna", const std::string &fname = "MyNtuple.root");
0025
0026
0027 virtual ~CaloAna();
0028
0029
0030 int Init(PHCompositeNode *);
0031
0032
0033 int process_event(PHCompositeNode *);
0034
0035
0036 int End(PHCompositeNode *);
0037
0038 int process_g4hits(PHCompositeNode *);
0039 int process_g4cells(PHCompositeNode *);
0040 int process_towers(PHCompositeNode *);
0041 int process_clusters(PHCompositeNode *);
0042
0043 void Detector(const std::string &name) { detector = name; }
0044 void set_timing_cut_width(const int &t) { _range = t;}
0045 void set_vertex_cut(const float &v) { _vz = v;}
0046 void apply_vertex_cut(bool Vtx_cut) { m_vtxCut = Vtx_cut; }
0047
0048 float getWeight(int ieta, float pt);
0049
0050 TF1* fitHistogram(TH1* h);
0051 void fitEtaSlices(const std::string& infile, const std::string& fitOutFile, const std::string& cdbFile);
0052
0053 protected:
0054 std::string detector;
0055 std::string outfilename;
0056 int Getpeaktime(TH1 *h);
0057 Fun4AllHistoManager *hm = nullptr;
0058 TFile *outfile = nullptr;
0059 TH2F* h_emcal_mbd_correlation = nullptr;
0060 TH2F* h_ohcal_mbd_correlation = nullptr;
0061 TH2F* h_ihcal_mbd_correlation = nullptr;
0062 TH2F* h_emcal_hcal_correlation = nullptr;
0063 TH2F* h_emcal_zdc_correlation = nullptr;
0064
0065 TH1F* h_InvMass = nullptr;
0066 TH1F* h_InvMass_w = nullptr;
0067 TH1F* h_InvMassMix = nullptr;
0068
0069 TH2F* h_cemc_etaphi = nullptr;
0070 TH2F* h_hcalin_etaphi = nullptr;
0071 TH2F* h_hcalout_etaphi = nullptr;
0072 TH2F* h_cemc_etaphi_wQA = nullptr;
0073 TH2F* h_hcalin_etaphi_wQA = nullptr;
0074 TH2F* h_hcalout_etaphi_wQA = nullptr;
0075 TH1* h_totalzdc_e;
0076 TH1* h_delR_recTrth = nullptr;
0077
0078 TProfile2D* h_cemc_etaphi_time = nullptr;
0079 TProfile2D* h_hcalin_etaphi_time = nullptr;
0080 TProfile2D* h_hcalout_etaphi_time = nullptr;
0081
0082 TProfile2D* h_cemc_etaphi_badChi2 = nullptr;
0083 TProfile2D* h_hcalin_etaphi_badChi2 = nullptr;
0084 TProfile2D* h_hcalout_etaphi_badChi2 = nullptr;
0085
0086 TH1* hzdctime;
0087 TH1* hmbdtime;
0088 TH1* hemcaltime;
0089 TH1* hihcaltime;
0090 TH1* hohcaltime;
0091
0092 TH1* hzdctime_cut;
0093 TH1* hmbdtime_cut;
0094 TH1* hemcaltime_cut;
0095 TH1* hihcaltime_cut;
0096 TH1* hohcaltime_cut;
0097
0098 TH1* hvtx_z_raw;
0099 TH1* hvtx_z_cut;
0100
0101 TH1* hzdcSouthraw;
0102 TH1* hzdcNorthraw;
0103 TH1* hzdcSouthcalib;
0104 TH1* hzdcNorthcalib;
0105
0106 TH1F* h_clusE;
0107 TH2F* h_etaphi_clus;
0108
0109 TNtuple *g4hitntuple = nullptr;
0110 TNtuple *g4cellntuple = nullptr;
0111 TTree *towerntuple = nullptr;
0112 TNtuple *clusterntuple = nullptr;
0113 std::vector<float> m_energy;
0114 std::vector<int> m_etabin;
0115 std::vector<int> m_phibin;
0116 std::vector<int> m_time;
0117
0118 std::vector<float> m_hcalin_energy;
0119 std::vector<int> m_hcalin_etabin;
0120 std::vector<int> m_hcalin_phibin;
0121 std::vector<int> m_hcalin_time;
0122
0123 std::vector<float> m_hcalout_energy;
0124 std::vector<int> m_hcalout_etabin;
0125 std::vector<int> m_hcalout_phibin;
0126 std::vector<int> m_hcalout_time;
0127
0128
0129 std::vector<float> m_zdc_energy;
0130 std::vector<int> m_zdc_index;
0131 std::vector<int> m_zdc_side;
0132
0133 std::vector<float> m_bbc_energy;
0134 std::vector<int> m_bbc_type;
0135 std::vector<int> m_bbc_side;
0136 int _eventcounter;
0137 int _range = 1;
0138 float _vz = 0.;
0139 bool m_vtxCut = false;
0140 bool dynMaskClus = false;
0141 bool getVtx = false;
0142 bool debug = false;
0143
0144 TH1F* h_pt1;
0145 TH1F* h_pt2;
0146 TH1F* h_nclusters;
0147 TH1F* h_mass_eta_lt[96];
0148 TH1F* h_mass_eta_lt_rw[96];
0149 TH1F* h_pt_eta[96];
0150 TH1F* h_pt_eta_rw[96];
0151 TH1F* h_emcal_e_eta;
0152 TH1F* h_truth_eta;
0153 TH1F* h_truth_e;
0154 TH1F* h_truth_pt;
0155 TH1F* h_pt_rw[96];
0156 TFile* frw;
0157 TH1* h_matched_res;
0158
0159 float target_pi0_mass = 0.145;
0160 TRandom3* rnd;
0161 };
0162
0163 #endif