File indexing completed on 2025-08-06 08:12:25
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef ReadF4ANtupleMC_h
0009 #define ReadF4ANtupleMC_h
0010
0011 #include <TROOT.h>
0012 #include <TChain.h>
0013 #include <TFile.h>
0014
0015
0016 #include "vector"
0017 #include "vector"
0018 #include "vector"
0019 #include "vector"
0020 #include "vector"
0021
0022 class ReadF4ANtupleMC {
0023 public :
0024 TTree *fChain;
0025 Int_t fCurrent;
0026
0027
0028
0029
0030 Int_t event;
0031 Int_t ncoll;
0032 Int_t npart;
0033 Float_t centrality_bimp;
0034 Float_t centrality_impactparam;
0035 UShort_t clk;
0036 UShort_t femclk;
0037 Bool_t is_min_bias;
0038 Bool_t is_min_bias_wozdc;
0039 Float_t MBD_centrality;
0040 Float_t MBD_z_vtx;
0041 Short_t MBD_south_npmt;
0042 Short_t MBD_north_npmt;
0043 Float_t MBD_south_charge_sum;
0044 Float_t MBD_north_charge_sum;
0045 Float_t MBD_charge_sum;
0046 Float_t MBD_charge_asymm;
0047 ULong_t INTT_BCO;
0048 Int_t NTruthVtx;
0049 Float_t TruthPV_trig_x;
0050 Float_t TruthPV_trig_y;
0051 Float_t TruthPV_trig_z;
0052 Int_t NHepMCFSPart;
0053 Int_t signal_process_id;
0054 vector<float> *HepMCFSPrtl_Pt;
0055 vector<float> *HepMCFSPrtl_Eta;
0056 vector<float> *HepMCFSPrtl_Phi;
0057 vector<float> *HepMCFSPrtl_E;
0058 vector<int> *HepMCFSPrtl_PID;
0059 vector<float> *HepMCFSPrtl_prodx;
0060 vector<float> *HepMCFSPrtl_prody;
0061 vector<float> *HepMCFSPrtl_prodz;
0062 Int_t NPrimaryG4P;
0063 vector<float> *PrimaryG4P_Pt;
0064 vector<float> *PrimaryG4P_Eta;
0065 vector<float> *PrimaryG4P_Phi;
0066 vector<float> *PrimaryG4P_E;
0067 vector<int> *PrimaryG4P_PID;
0068 Int_t NTruthLayers;
0069 vector<int> *ClusTruthCKeys;
0070 vector<int> *ClusNG4Particles;
0071 vector<int> *ClusNPrimaryG4Particles;
0072 vector<int> *TruthClusPhiSize;
0073 vector<int> *TruthClusZSize;
0074 vector<int> *TruthClusNRecoClus;
0075 vector<int> *PrimaryTruthClusPhiSize;
0076 vector<int> *PrimaryTruthClusZSize;
0077 vector<int> *PrimaryTruthClusNRecoClus;
0078 Int_t NTrkrhits;
0079 vector<unsigned short> *TrkrHitRow;
0080 vector<unsigned short> *TrkrHitColumn;
0081 vector<unsigned char> *TrkrHitLadderZId;
0082 vector<unsigned char> *TrkrHitLadderPhiId;
0083 vector<unsigned char> *TrkrHitLayer;
0084 vector<unsigned short> *TrkrHitADC;
0085 Int_t NClus_Layer1;
0086 Int_t NClus;
0087 vector<int> *ClusLayer;
0088 vector<float> *ClusX;
0089 vector<float> *ClusY;
0090 vector<float> *ClusZ;
0091 vector<float> *ClusR;
0092 vector<float> *ClusPhi;
0093 vector<float> *ClusEta;
0094 vector<unsigned int> *ClusAdc;
0095 vector<float> *ClusPhiSize;
0096 vector<float> *ClusZSize;
0097 vector<unsigned char> *ClusLadderZId;
0098 vector<unsigned char> *ClusLadderPhiId;
0099 vector<unsigned int> *ClusTrkrHitSetKey;
0100 vector<int> *ClusTimeBucketId;
0101
0102
0103 TBranch *b_event;
0104 TBranch *b_ncoll;
0105 TBranch *b_npart;
0106 TBranch *b_centrality_bimp;
0107 TBranch *b_centrality_impactparam;
0108 TBranch *b_clk;
0109 TBranch *b_femclk;
0110 TBranch *b_is_min_bias;
0111 TBranch *b_is_min_bias_wozdc;
0112 TBranch *b_MBD_centrality;
0113 TBranch *b_MBD_z_vtx;
0114 TBranch *b_MBD_south_npmt;
0115 TBranch *b_MBD_north_npmt;
0116 TBranch *b_MBD_south_charge_sum;
0117 TBranch *b_MBD_north_charge_sum;
0118 TBranch *b_MBD_charge_sum;
0119 TBranch *b_MBD_charge_asymm;
0120 TBranch *b_INTT_BCO;
0121 TBranch *b_NTruthVtx;
0122 TBranch *b_TruthPV_trig_x;
0123 TBranch *b_TruthPV_trig_y;
0124 TBranch *b_TruthPV_trig_z;
0125 TBranch *b_NHepMCFSPart;
0126 TBranch *b_signal_process_id;
0127 TBranch *b_HepMCFSPrtl_Pt;
0128 TBranch *b_HepMCFSPrtl_Eta;
0129 TBranch *b_HepMCFSPrtl_Phi;
0130 TBranch *b_HepMCFSPrtl_E;
0131 TBranch *b_HepMCFSPrtl_PID;
0132 TBranch *b_HepMCFSPrtl_prodx;
0133 TBranch *b_HepMCFSPrtl_prody;
0134 TBranch *b_HepMCFSPrtl_prodz;
0135 TBranch *b_NPrimaryG4P;
0136 TBranch *b_PrimaryG4P_Pt;
0137 TBranch *b_PrimaryG4P_Eta;
0138 TBranch *b_PrimaryG4P_Phi;
0139 TBranch *b_PrimaryG4P_E;
0140 TBranch *b_PrimaryG4P_PID;
0141 TBranch *b_NTruthLayers;
0142 TBranch *b_ClusTruthCKeys;
0143 TBranch *b_ClusNG4Particles;
0144 TBranch *b_ClusNPrimaryG4Particles;
0145 TBranch *b_TruthClusPhiSize;
0146 TBranch *b_TruthClusZSize;
0147 TBranch *b_TruthClusNRecoClus;
0148 TBranch *b_PrimaryTruthClusPhiSize;
0149 TBranch *b_PrimaryTruthClusZSize;
0150 TBranch *b_PrimaryTruthClusNRecoClus;
0151 TBranch *b_NTrkrhits;
0152 TBranch *b_TrkrHitRow;
0153 TBranch *b_TrkrHitColumn;
0154 TBranch *b_TrkrHitLadderZId;
0155 TBranch *b_TrkrHitLadderPhiId;
0156 TBranch *b_TrkrHitLayer;
0157 TBranch *b_TrkrHitADC;
0158 TBranch *b_NClus_Layer1;
0159 TBranch *b_NClus;
0160 TBranch *b_ClusLayer;
0161 TBranch *b_ClusX;
0162 TBranch *b_ClusY;
0163 TBranch *b_ClusZ;
0164 TBranch *b_ClusR;
0165 TBranch *b_ClusPhi;
0166 TBranch *b_ClusEta;
0167 TBranch *b_ClusAdc;
0168 TBranch *b_ClusPhiSize;
0169 TBranch *b_ClusZSize;
0170 TBranch *b_ClusLadderZId;
0171 TBranch *b_ClusLadderPhiId;
0172 TBranch *b_ClusTrkrHitSetKey;
0173 TBranch *b_ClusTimeBucketId;
0174
0175 ReadF4ANtupleMC(TTree *tree=0);
0176 virtual ~ReadF4ANtupleMC();
0177 virtual Int_t Cut(Long64_t entry);
0178 virtual Int_t GetEntry(Long64_t entry);
0179 virtual Long64_t LoadTree(Long64_t entry);
0180 virtual void Init(TTree *tree);
0181 virtual void Loop();
0182 virtual Bool_t Notify();
0183 virtual void Show(Long64_t entry = -1);
0184 };
0185
0186 #endif
0187
0188 #ifdef ReadF4ANtupleMC_cxx
0189 ReadF4ANtupleMC::ReadF4ANtupleMC(TTree *tree) : fChain(0)
0190 {
0191
0192
0193 if (tree == 0) {
0194 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("ntuple_merged.root");
0195 if (!f || !f->IsOpen()) {
0196 f = new TFile("ntuple_merged.root");
0197 }
0198 f->GetObject("EventTree",tree);
0199
0200 }
0201 Init(tree);
0202 }
0203
0204 ReadF4ANtupleMC::~ReadF4ANtupleMC()
0205 {
0206 if (!fChain) return;
0207 delete fChain->GetCurrentFile();
0208 }
0209
0210 Int_t ReadF4ANtupleMC::GetEntry(Long64_t entry)
0211 {
0212
0213 if (!fChain) return 0;
0214 return fChain->GetEntry(entry);
0215 }
0216 Long64_t ReadF4ANtupleMC::LoadTree(Long64_t entry)
0217 {
0218
0219 if (!fChain) return -5;
0220 Long64_t centry = fChain->LoadTree(entry);
0221 if (centry < 0) return centry;
0222 if (fChain->GetTreeNumber() != fCurrent) {
0223 fCurrent = fChain->GetTreeNumber();
0224 Notify();
0225 }
0226 return centry;
0227 }
0228
0229 void ReadF4ANtupleMC::Init(TTree *tree)
0230 {
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240 HepMCFSPrtl_Pt = 0;
0241 HepMCFSPrtl_Eta = 0;
0242 HepMCFSPrtl_Phi = 0;
0243 HepMCFSPrtl_E = 0;
0244 HepMCFSPrtl_PID = 0;
0245 HepMCFSPrtl_prodx = 0;
0246 HepMCFSPrtl_prody = 0;
0247 HepMCFSPrtl_prodz = 0;
0248 PrimaryG4P_Pt = 0;
0249 PrimaryG4P_Eta = 0;
0250 PrimaryG4P_Phi = 0;
0251 PrimaryG4P_E = 0;
0252 PrimaryG4P_PID = 0;
0253 ClusTruthCKeys = 0;
0254 ClusNG4Particles = 0;
0255 ClusNPrimaryG4Particles = 0;
0256 TruthClusPhiSize = 0;
0257 TruthClusZSize = 0;
0258 TruthClusNRecoClus = 0;
0259 PrimaryTruthClusPhiSize = 0;
0260 PrimaryTruthClusZSize = 0;
0261 PrimaryTruthClusNRecoClus = 0;
0262 TrkrHitRow = 0;
0263 TrkrHitColumn = 0;
0264 TrkrHitLadderZId = 0;
0265 TrkrHitLadderPhiId = 0;
0266 TrkrHitLayer = 0;
0267 TrkrHitADC = 0;
0268 ClusLayer = 0;
0269 ClusX = 0;
0270 ClusY = 0;
0271 ClusZ = 0;
0272 ClusR = 0;
0273 ClusPhi = 0;
0274 ClusEta = 0;
0275 ClusAdc = 0;
0276 ClusPhiSize = 0;
0277 ClusZSize = 0;
0278 ClusLadderZId = 0;
0279 ClusLadderPhiId = 0;
0280 ClusTrkrHitSetKey = 0;
0281 ClusTimeBucketId = 0;
0282
0283 if (!tree) return;
0284 fChain = tree;
0285 fCurrent = -1;
0286 fChain->SetMakeClass(1);
0287
0288 fChain->SetBranchAddress("event", &event, &b_event);
0289 fChain->SetBranchAddress("ncoll", &ncoll, &b_ncoll);
0290 fChain->SetBranchAddress("npart", &npart, &b_npart);
0291 fChain->SetBranchAddress("centrality_bimp", ¢rality_bimp, &b_centrality_bimp);
0292 fChain->SetBranchAddress("centrality_impactparam", ¢rality_impactparam, &b_centrality_impactparam);
0293 fChain->SetBranchAddress("clk", &clk, &b_clk);
0294 fChain->SetBranchAddress("femclk", &femclk, &b_femclk);
0295 fChain->SetBranchAddress("is_min_bias", &is_min_bias, &b_is_min_bias);
0296 fChain->SetBranchAddress("is_min_bias_wozdc", &is_min_bias_wozdc, &b_is_min_bias_wozdc);
0297 fChain->SetBranchAddress("MBD_centrality", &MBD_centrality, &b_MBD_centrality);
0298 fChain->SetBranchAddress("MBD_z_vtx", &MBD_z_vtx, &b_MBD_z_vtx);
0299 fChain->SetBranchAddress("MBD_south_npmt", &MBD_south_npmt, &b_MBD_south_npmt);
0300 fChain->SetBranchAddress("MBD_north_npmt", &MBD_north_npmt, &b_MBD_north_npmt);
0301 fChain->SetBranchAddress("MBD_south_charge_sum", &MBD_south_charge_sum, &b_MBD_south_charge_sum);
0302 fChain->SetBranchAddress("MBD_north_charge_sum", &MBD_north_charge_sum, &b_MBD_north_charge_sum);
0303 fChain->SetBranchAddress("MBD_charge_sum", &MBD_charge_sum, &b_MBD_charge_sum);
0304 fChain->SetBranchAddress("MBD_charge_asymm", &MBD_charge_asymm, &b_MBD_charge_asymm);
0305 fChain->SetBranchAddress("INTT_BCO", &INTT_BCO, &b_INTT_BCO);
0306 fChain->SetBranchAddress("NTruthVtx", &NTruthVtx, &b_NTruthVtx);
0307 fChain->SetBranchAddress("TruthPV_trig_x", &TruthPV_trig_x, &b_TruthPV_trig_x);
0308 fChain->SetBranchAddress("TruthPV_trig_y", &TruthPV_trig_y, &b_TruthPV_trig_y);
0309 fChain->SetBranchAddress("TruthPV_trig_z", &TruthPV_trig_z, &b_TruthPV_trig_z);
0310 fChain->SetBranchAddress("NHepMCFSPart", &NHepMCFSPart, &b_NHepMCFSPart);
0311 fChain->SetBranchAddress("signal_process_id", &signal_process_id, &b_signal_process_id);
0312 fChain->SetBranchAddress("HepMCFSPrtl_Pt", &HepMCFSPrtl_Pt, &b_HepMCFSPrtl_Pt);
0313 fChain->SetBranchAddress("HepMCFSPrtl_Eta", &HepMCFSPrtl_Eta, &b_HepMCFSPrtl_Eta);
0314 fChain->SetBranchAddress("HepMCFSPrtl_Phi", &HepMCFSPrtl_Phi, &b_HepMCFSPrtl_Phi);
0315 fChain->SetBranchAddress("HepMCFSPrtl_E", &HepMCFSPrtl_E, &b_HepMCFSPrtl_E);
0316 fChain->SetBranchAddress("HepMCFSPrtl_PID", &HepMCFSPrtl_PID, &b_HepMCFSPrtl_PID);
0317 fChain->SetBranchAddress("HepMCFSPrtl_prodx", &HepMCFSPrtl_prodx, &b_HepMCFSPrtl_prodx);
0318 fChain->SetBranchAddress("HepMCFSPrtl_prody", &HepMCFSPrtl_prody, &b_HepMCFSPrtl_prody);
0319 fChain->SetBranchAddress("HepMCFSPrtl_prodz", &HepMCFSPrtl_prodz, &b_HepMCFSPrtl_prodz);
0320 fChain->SetBranchAddress("NPrimaryG4P", &NPrimaryG4P, &b_NPrimaryG4P);
0321 fChain->SetBranchAddress("PrimaryG4P_Pt", &PrimaryG4P_Pt, &b_PrimaryG4P_Pt);
0322 fChain->SetBranchAddress("PrimaryG4P_Eta", &PrimaryG4P_Eta, &b_PrimaryG4P_Eta);
0323 fChain->SetBranchAddress("PrimaryG4P_Phi", &PrimaryG4P_Phi, &b_PrimaryG4P_Phi);
0324 fChain->SetBranchAddress("PrimaryG4P_E", &PrimaryG4P_E, &b_PrimaryG4P_E);
0325 fChain->SetBranchAddress("PrimaryG4P_PID", &PrimaryG4P_PID, &b_PrimaryG4P_PID);
0326 fChain->SetBranchAddress("NTruthLayers", &NTruthLayers, &b_NTruthLayers);
0327 fChain->SetBranchAddress("ClusTruthCKeys", &ClusTruthCKeys, &b_ClusTruthCKeys);
0328 fChain->SetBranchAddress("ClusNG4Particles", &ClusNG4Particles, &b_ClusNG4Particles);
0329 fChain->SetBranchAddress("ClusNPrimaryG4Particles", &ClusNPrimaryG4Particles, &b_ClusNPrimaryG4Particles);
0330 fChain->SetBranchAddress("TruthClusPhiSize", &TruthClusPhiSize, &b_TruthClusPhiSize);
0331 fChain->SetBranchAddress("TruthClusZSize", &TruthClusZSize, &b_TruthClusZSize);
0332 fChain->SetBranchAddress("TruthClusNRecoClus", &TruthClusNRecoClus, &b_TruthClusNRecoClus);
0333 fChain->SetBranchAddress("PrimaryTruthClusPhiSize", &PrimaryTruthClusPhiSize, &b_PrimaryTruthClusPhiSize);
0334 fChain->SetBranchAddress("PrimaryTruthClusZSize", &PrimaryTruthClusZSize, &b_PrimaryTruthClusZSize);
0335 fChain->SetBranchAddress("PrimaryTruthClusNRecoClus", &PrimaryTruthClusNRecoClus, &b_PrimaryTruthClusNRecoClus);
0336 fChain->SetBranchAddress("NTrkrhits", &NTrkrhits, &b_NTrkrhits);
0337 fChain->SetBranchAddress("TrkrHitRow", &TrkrHitRow, &b_TrkrHitRow);
0338 fChain->SetBranchAddress("TrkrHitColumn", &TrkrHitColumn, &b_TrkrHitColumn);
0339 fChain->SetBranchAddress("TrkrHitLadderZId", &TrkrHitLadderZId, &b_TrkrHitLadderZId);
0340 fChain->SetBranchAddress("TrkrHitLadderPhiId", &TrkrHitLadderPhiId, &b_TrkrHitLadderPhiId);
0341 fChain->SetBranchAddress("TrkrHitLayer", &TrkrHitLayer, &b_TrkrHitLayer);
0342 fChain->SetBranchAddress("TrkrHitADC", &TrkrHitADC, &b_TrkrHitADC);
0343 fChain->SetBranchAddress("NClus_Layer1", &NClus_Layer1, &b_NClus_Layer1);
0344 fChain->SetBranchAddress("NClus", &NClus, &b_NClus);
0345 fChain->SetBranchAddress("ClusLayer", &ClusLayer, &b_ClusLayer);
0346 fChain->SetBranchAddress("ClusX", &ClusX, &b_ClusX);
0347 fChain->SetBranchAddress("ClusY", &ClusY, &b_ClusY);
0348 fChain->SetBranchAddress("ClusZ", &ClusZ, &b_ClusZ);
0349 fChain->SetBranchAddress("ClusR", &ClusR, &b_ClusR);
0350 fChain->SetBranchAddress("ClusPhi", &ClusPhi, &b_ClusPhi);
0351 fChain->SetBranchAddress("ClusEta", &ClusEta, &b_ClusEta);
0352 fChain->SetBranchAddress("ClusAdc", &ClusAdc, &b_ClusAdc);
0353 fChain->SetBranchAddress("ClusPhiSize", &ClusPhiSize, &b_ClusPhiSize);
0354 fChain->SetBranchAddress("ClusZSize", &ClusZSize, &b_ClusZSize);
0355 fChain->SetBranchAddress("ClusLadderZId", &ClusLadderZId, &b_ClusLadderZId);
0356 fChain->SetBranchAddress("ClusLadderPhiId", &ClusLadderPhiId, &b_ClusLadderPhiId);
0357 fChain->SetBranchAddress("ClusTrkrHitSetKey", &ClusTrkrHitSetKey, &b_ClusTrkrHitSetKey);
0358 fChain->SetBranchAddress("ClusTimeBucketId", &ClusTimeBucketId, &b_ClusTimeBucketId);
0359 Notify();
0360 }
0361
0362 Bool_t ReadF4ANtupleMC::Notify()
0363 {
0364
0365
0366
0367
0368
0369
0370 return kTRUE;
0371 }
0372
0373 void ReadF4ANtupleMC::Show(Long64_t entry)
0374 {
0375
0376
0377 if (!fChain) return;
0378 fChain->Show(entry);
0379 }
0380 Int_t ReadF4ANtupleMC::Cut(Long64_t entry)
0381 {
0382
0383
0384
0385 return 1;
0386 }
0387 #endif