Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:11:57

0001 //////////////////////////////////////////////////////////
0002 // This class has been automatically generated on
0003 // Sat Oct 21 04:13:40 2023 by ROOT version 6.26/06
0004 // from TTree EventTree/EventTree
0005 // found on file: INTTRecoClusters_test_400_0.root
0006 //////////////////////////////////////////////////////////
0007 
0008 #ifndef INTTDSTchain_h
0009 #define INTTDSTchain_h
0010 
0011 #include <TROOT.h>
0012 #include <TChain.h>
0013 #include <TFile.h>
0014 
0015 // Header file for the classes stored in the TTree if any.
0016 #include "vector"
0017 
0018 class INTTDSTchain {
0019 public :
0020    TChain          *fChain;   //!pointer to the analyzed TTree or TChain
0021    Int_t           fCurrent; //!current Tree number in a TChain
0022 
0023    // Declaration of leaf types
0024    Int_t           event;
0025    Int_t           NTruthVtx;
0026    vector<float>   *TruthPV_x;
0027    vector<float>   *TruthPV_y;
0028    vector<float>   *TruthPV_z;
0029    vector<int>     *TruthPV_Npart;
0030    vector<int>     *TruthPV_Nhits;
0031    vector<int>     *TruthPV_NClus;
0032    vector<float>   *TruthPV_t;
0033    vector<float>   *TruthPV_embed;
0034    Float_t         TruthPV_trig_x;
0035    Float_t         TruthPV_trig_y;
0036    Float_t         TruthPV_trig_z;
0037    Int_t           TruthPV_trig_Npart;
0038 
0039    Float_t centrality_bimp;
0040    Float_t centrality_mbd;  
0041    Float_t centrality_mbdquantity;
0042 
0043    // vector<float>   *UniqueAncG4P_Px;
0044    // vector<float>   *UniqueAncG4P_Py;
0045    // vector<float>   *UniqueAncG4P_Pz;
0046    // vector<float>   *UniqueAncG4P_Pt;
0047    vector<float>   *UniqueAncG4P_Eta;
0048    vector<float>   *UniqueAncG4P_Phi;
0049    // vector<float>   *UniqueAncG4P_E;
0050    vector<int>     *UniqueAncG4P_PID;
0051    // vector<int>     *UniqueAncG4P_TrackPID;
0052    // vector<int>     *UniqueAncG4P_VtxPID;
0053    // vector<int>     *UniqueAncG4P_ParentPID;
0054    // vector<int>     *UniqueAncG4P_PrimaryPID;
0055    // vector<double>  *UniqueAncG4P_IonCharge;
0056    vector<int>     *UniqueAncG4P_TrackID;
0057    // vector<int>     *UniqueAncG4P_NClus;
0058    Int_t           Layer1_occupancy;
0059    Int_t           NClus;
0060    Int_t           NTrkrhits;
0061    vector<int>     *ClusLayer;
0062    vector<float>   *ClusX;
0063    vector<float>   *ClusY;
0064    vector<float>   *ClusZ;
0065    vector<float>   *ClusR;
0066    vector<float>   *ClusPhi;
0067    vector<float>   *ClusEta;
0068    vector<unsigned int> *ClusAdc;
0069    vector<float>   *ClusPhiSize;
0070    vector<float>   *ClusZSize;
0071    vector<unsigned char> *ClusLadderZId;
0072    vector<unsigned char> *ClusLadderPhiId;
0073 
0074    // List of branches
0075    TBranch        *b_event;   //!
0076    TBranch        *b_NTruthVtx;   //!
0077    TBranch        *b_TruthPV_x;   //!
0078    TBranch        *b_TruthPV_y;   //!
0079    TBranch        *b_TruthPV_z;   //!
0080    TBranch        *b_TruthPV_Npart;   //!
0081    TBranch        *b_TruthPV_Nhits;   //!
0082    TBranch        *b_TruthPV_NClus;   //!
0083    TBranch        *b_TruthPV_t;   //!
0084    TBranch        *b_TruthPV_embed;   //!
0085    TBranch        *b_TruthPV_trig_x;   //!
0086    TBranch        *b_TruthPV_trig_y;   //!
0087    TBranch        *b_TruthPV_trig_z;   //!
0088    TBranch        *b_TruthPV_trig_Npart;   //!
0089    // TBranch        *b_UniqueAncG4P_Px;   //!
0090    // TBranch        *b_UniqueAncG4P_Py;   //!
0091    // TBranch        *b_UniqueAncG4P_Pz;   //!
0092    // TBranch        *b_UniqueAncG4P_Pt;   //!
0093    TBranch        *b_UniqueAncG4P_Eta;   //!
0094    TBranch        *b_UniqueAncG4P_Phi;   //!
0095    // TBranch        *b_UniqueAncG4P_E;   //!
0096    TBranch        *b_UniqueAncG4P_PID;   //!
0097    // TBranch        *b_UniqueAncG4P_TrackPID;   //!
0098    // TBranch        *b_UniqueAncG4P_VtxPID;   //!
0099    // TBranch        *b_UniqueAncG4P_ParentPID;   //!
0100    // TBranch        *b_UniqueAncG4P_PrimaryPID;   //!
0101    // TBranch        *b_UniqueAncG4P_IonCharge;   //!
0102    TBranch        *b_UniqueAncG4P_TrackID;   //!
0103    // TBranch        *b_UniqueAncG4P_NClus;   //!
0104    TBranch        *b_Layer1_occupancy;   //!
0105    TBranch        *b_NClus;   //!
0106    TBranch        *b_NTrkrhits;   //!
0107    TBranch        *b_ClusLayer;   //!
0108    TBranch        *b_ClusX;   //!
0109    TBranch        *b_ClusY;   //!
0110    TBranch        *b_ClusZ;   //!
0111    TBranch        *b_ClusR;   //!
0112    TBranch        *b_ClusPhi;   //!
0113    TBranch        *b_ClusEta;   //!
0114    TBranch        *b_ClusAdc;   //!
0115    TBranch        *b_ClusPhiSize;   //!
0116    TBranch        *b_ClusZSize;   //!
0117    TBranch        *b_ClusLadderZId;   //!
0118    TBranch        *b_ClusLadderPhiId;   //!
0119 
0120    TBranch        *b_centrality_bimp;
0121    TBranch        *b_centrality_mbd;
0122    TBranch        *b_centrality_mbdquantity;
0123 
0124    INTTDSTchain(TChain *chain_in = 0, string folder_direction = "", vector<string> file_list = {});
0125    INTTDSTchain(TChain *chain_in = 0, string folder_direction = "", string MC_list_name = "");
0126    virtual ~INTTDSTchain();
0127    virtual Int_t    Cut(Long64_t entry);
0128    virtual Int_t    GetEntry(Long64_t entry);
0129    virtual Long64_t LoadTree(Long64_t entry);
0130    virtual void     Init(TChain *chain_in);
0131    virtual void     Loop();
0132    virtual Bool_t   Notify();
0133    virtual void     Show(Long64_t entry = -1);
0134 private : 
0135    string folder_direction;
0136    string MC_list_name;
0137    vector<string> file_list;
0138    void read_list();
0139 };
0140 
0141 #endif
0142 
0143 #ifdef INTTDSTchain_cxx
0144 INTTDSTchain::INTTDSTchain(TChain *chain_in, string folder_direction, vector<string> file_list) : 
0145 fChain(0), 
0146 folder_direction(folder_direction), 
0147 file_list(file_list) 
0148 {
0149    // if parameter tree is not specified (or zero), connect the file
0150    // used to generate this class and read the Tree.
0151    if (chain_in == 0) {
0152       // TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("INTTRecoClusters_test_400_0.root");
0153       // if (!f || !f->IsOpen()) {
0154       //    f = new TFile("INTTRecoClusters_test_400_0.root");
0155       // }
0156       // f->GetObject("EventTree",chain_in);
0157       std::cout<<"There is no TChain input ?, run exit"<<std::endl;
0158       std::exit(1);
0159    }
0160    if (folder_direction.size() == 0) {std::cout<<"There is no folder_direction input ?, run exit"<<std::endl; std::exit(1);}
0161    if (file_list.size() == 0) {std::cout<<"There is no file_list input ?, run exit"<<std::endl; std::exit(1);}
0162 
0163    // std::cout<<"correct input format"<<std::endl; // note : was used
0164    // std::cout<<"file_list size : "<<file_list.size()<<std::endl; // note : was used
0165 
0166    Init(chain_in);
0167 }
0168 
0169 INTTDSTchain::INTTDSTchain(TChain *chain_in, string folder_direction, string MC_list_name) : 
0170 fChain(0), 
0171 folder_direction(folder_direction), 
0172 MC_list_name(MC_list_name) 
0173 {
0174    // if parameter tree is not specified (or zero), connect the file
0175    // used to generate this class and read the Tree.
0176    if (chain_in == 0) {
0177       // TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("INTTRecoClusters_test_400_0.root");
0178       // if (!f || !f->IsOpen()) {
0179       //    f = new TFile("INTTRecoClusters_test_400_0.root");
0180       // }
0181       // f->GetObject("EventTree",chain_in);
0182       std::cout<<"There is no TChain input ?, run exit"<<std::endl;
0183       std::exit(1);
0184    }
0185    if (folder_direction.size() == 0) {std::cout<<"There is no folder_direction input ?, run exit"<<std::endl; std::exit(1);}
0186    if (MC_list_name.size() == 0) {std::cout<<"There is no MC_list_name input ?, run exit"<<std::endl; std::exit(1);}
0187 
0188    // cout<<"the input list : "<<MC_list_name<<endl;
0189 
0190    read_list(); // note : read the list
0191 
0192    // std::cout<<"correct input format"<<std::endl; // note : was used 
0193    // std::cout<<"Read the list by class"<<std::endl; // note : was used 
0194    // std::cout<<"file_list size : "<<file_list.size()<<std::endl; // note : was used 
0195 
0196    Init(chain_in);
0197 }
0198 
0199 void INTTDSTchain::read_list()
0200 {
0201     string list_buffer;
0202     ifstream data_list;
0203     data_list.open((folder_direction + "/" + MC_list_name).c_str());
0204 
0205    file_list.clear();
0206 
0207     while (1)
0208     {
0209         data_list >> list_buffer;
0210         if (!data_list.good())
0211         {
0212             break;
0213         }
0214         file_list.push_back(list_buffer);
0215     }
0216     // cout<<"size : "<<file_list.size()<<endl; // note : was used 
0217 }
0218 
0219 INTTDSTchain::~INTTDSTchain()
0220 {
0221    if (!fChain) return;
0222    delete fChain->GetCurrentFile();
0223 }
0224 
0225 Int_t INTTDSTchain::GetEntry(Long64_t entry)
0226 {
0227 // Read contents of entry.
0228    if (!fChain) return 0;
0229    return fChain->GetEntry(entry);
0230 }
0231 Long64_t INTTDSTchain::LoadTree(Long64_t entry)
0232 {
0233 // Set the environment to read one entry
0234    if (!fChain) return -5;
0235    Long64_t centry = fChain->LoadTree(entry);
0236    if (centry < 0) return centry;
0237    if (fChain->GetTreeNumber() != fCurrent) {
0238       fCurrent = fChain->GetTreeNumber();
0239       Notify();
0240    }
0241    return centry;
0242 }
0243 
0244 void INTTDSTchain::Init(TChain *chain_in)
0245 {
0246    // The Init() function is called when the selector needs to initialize
0247    // a new tree or chain. Typically here the branch addresses and branch
0248    // pointers of the tree will be set.
0249    // It is normally not necessary to make changes to the generated
0250    // code, but the routine can be extended by the user if needed.
0251    // Init() will be called many times when running on PROOF
0252    // (once per file to be processed).
0253 
0254    // Set object pointer
0255    TruthPV_x = 0;
0256    TruthPV_y = 0;
0257    TruthPV_z = 0;
0258    TruthPV_Npart = 0;
0259    TruthPV_Nhits = 0;
0260    TruthPV_NClus = 0;
0261    TruthPV_t = 0;
0262    TruthPV_embed = 0;
0263    // UniqueAncG4P_Px = 0;
0264    // UniqueAncG4P_Py = 0;
0265    // UniqueAncG4P_Pz = 0;
0266    // UniqueAncG4P_Pt = 0;
0267    UniqueAncG4P_Eta = 0;
0268    UniqueAncG4P_Phi = 0;
0269    // UniqueAncG4P_E = 0;
0270    UniqueAncG4P_PID = 0;
0271    // UniqueAncG4P_TrackPID = 0;
0272    // UniqueAncG4P_VtxPID = 0;
0273    // UniqueAncG4P_ParentPID = 0;
0274    // UniqueAncG4P_PrimaryPID = 0;
0275    // UniqueAncG4P_IonCharge = 0;
0276    UniqueAncG4P_TrackID = 0;
0277    // UniqueAncG4P_NClus = 0;
0278    ClusLayer = 0;
0279    ClusX = 0;
0280    ClusY = 0;
0281    ClusZ = 0;
0282    ClusR = 0;
0283    ClusPhi = 0;
0284    ClusEta = 0;
0285    ClusAdc = 0;
0286    ClusPhiSize = 0;
0287    ClusZSize = 0;
0288    ClusLadderZId = 0;
0289    ClusLadderPhiId = 0;
0290 
0291    centrality_bimp = 0;
0292    centrality_mbd = 0;
0293    centrality_mbdquantity = 0;
0294 
0295    // Set branch addresses and branch pointers
0296    if (!chain_in) return;
0297    fChain = chain_in;
0298    fCurrent = -1;
0299    fChain->SetMakeClass(1);
0300 
0301    // note : fill the root files
0302    for (auto each_file : file_list){ fChain -> Add((folder_direction + "/" + each_file).c_str()); }
0303 
0304    fChain -> SetBranchStatus("*",0);
0305    fChain -> SetBranchStatus("event",1);
0306    fChain -> SetBranchStatus("NTruthVtx",1);
0307    // fChain -> SetBranchStatus("TruthPV_x",1);
0308    // fChain -> SetBranchStatus("TruthPV_y",1);
0309    // fChain -> SetBranchStatus("TruthPV_z",1);
0310    // fChain -> SetBranchStatus("TruthPV_Npart",1);
0311    // fChain -> SetBranchStatus("TruthPV_Nhits",1);
0312    // fChain -> SetBranchStatus("TruthPV_NClus",1);
0313    // fChain -> SetBranchStatus("TruthPV_t",1);
0314    // fChain -> SetBranchStatus("TruthPV_embed",1);
0315    fChain -> SetBranchStatus("TruthPV_trig_x",1);  
0316    fChain -> SetBranchStatus("TruthPV_trig_y",1);  
0317    fChain -> SetBranchStatus("TruthPV_trig_z",1);  
0318    // fChain -> SetBranchStatus("TruthPV_trig_Npart",1); 
0319    fChain -> SetBranchStatus("ClusLayer",1);
0320    fChain -> SetBranchStatus("ClusX",1);
0321    fChain -> SetBranchStatus("ClusY",1);
0322    fChain -> SetBranchStatus("ClusZ",1);
0323    fChain -> SetBranchStatus("ClusR",1);
0324    fChain -> SetBranchStatus("ClusPhi",1);
0325    fChain -> SetBranchStatus("ClusEta",1);
0326    fChain -> SetBranchStatus("ClusAdc",1);
0327    fChain -> SetBranchStatus("ClusPhiSize",1);
0328    fChain -> SetBranchStatus("ClusZSize",1);
0329    fChain -> SetBranchStatus("ClusLadderZId",1);
0330    fChain -> SetBranchStatus("ClusLadderPhiId",1);
0331    // fChain -> SetBranchStatus("Layer1_occupancy",1); 
0332    fChain -> SetBranchStatus("NClus",1);           
0333    fChain -> SetBranchStatus("NTrkrhits",1);
0334 
0335    // fChain -> SetBranchStatus("UniqueAncG4P_TrackID", 1);
0336    fChain -> SetBranchStatus("UniqueAncG4P_Eta", 1);
0337    fChain -> SetBranchStatus("UniqueAncG4P_Phi", 1);
0338    fChain -> SetBranchStatus("centrality_bimp",1);
0339    fChain -> SetBranchStatus("centrality_mbd",1);
0340    fChain -> SetBranchStatus("centrality_mbdquantity",1);
0341 
0342    fChain->SetBranchAddress("event", &event, &b_event);
0343    fChain->SetBranchAddress("NTruthVtx", &NTruthVtx, &b_NTruthVtx);
0344    // fChain->SetBranchAddress("TruthPV_x", &TruthPV_x, &b_TruthPV_x);
0345    // fChain->SetBranchAddress("TruthPV_y", &TruthPV_y, &b_TruthPV_y);
0346    // fChain->SetBranchAddress("TruthPV_z", &TruthPV_z, &b_TruthPV_z);
0347    // fChain->SetBranchAddress("TruthPV_Npart", &TruthPV_Npart, &b_TruthPV_Npart);
0348    // fChain->SetBranchAddress("TruthPV_Nhits", &TruthPV_Nhits, &b_TruthPV_Nhits);
0349    // fChain->SetBranchAddress("TruthPV_NClus", &TruthPV_NClus, &b_TruthPV_NClus);
0350    // fChain->SetBranchAddress("TruthPV_t", &TruthPV_t, &b_TruthPV_t);
0351    // fChain->SetBranchAddress("TruthPV_embed", &TruthPV_embed, &b_TruthPV_embed);
0352    fChain->SetBranchAddress("TruthPV_trig_x", &TruthPV_trig_x, &b_TruthPV_trig_x);
0353    fChain->SetBranchAddress("TruthPV_trig_y", &TruthPV_trig_y, &b_TruthPV_trig_y);
0354    fChain->SetBranchAddress("TruthPV_trig_z", &TruthPV_trig_z, &b_TruthPV_trig_z);
0355    // fChain->SetBranchAddress("TruthPV_trig_Npart", &TruthPV_trig_Npart, &b_TruthPV_trig_Npart);
0356    // fChain->SetBranchAddress("UniqueAncG4P_Px", &UniqueAncG4P_Px, &b_UniqueAncG4P_Px);
0357    // fChain->SetBranchAddress("UniqueAncG4P_Py", &UniqueAncG4P_Py, &b_UniqueAncG4P_Py);
0358    // fChain->SetBranchAddress("UniqueAncG4P_Pz", &UniqueAncG4P_Pz, &b_UniqueAncG4P_Pz);
0359    // fChain->SetBranchAddress("UniqueAncG4P_Pt", &UniqueAncG4P_Pt, &b_UniqueAncG4P_Pt);
0360    fChain->SetBranchAddress("UniqueAncG4P_Eta", &UniqueAncG4P_Eta, &b_UniqueAncG4P_Eta);
0361    fChain->SetBranchAddress("UniqueAncG4P_Phi", &UniqueAncG4P_Phi, &b_UniqueAncG4P_Phi);
0362    // fChain->SetBranchAddress("UniqueAncG4P_E", &UniqueAncG4P_E, &b_UniqueAncG4P_E);
0363    fChain->SetBranchAddress("UniqueAncG4P_PID", &UniqueAncG4P_PID, &b_UniqueAncG4P_PID);
0364    // fChain->SetBranchAddress("UniqueAncG4P_TrackPID", &UniqueAncG4P_TrackPID, &b_UniqueAncG4P_TrackPID);
0365    // fChain->SetBranchAddress("UniqueAncG4P_VtxPID", &UniqueAncG4P_VtxPID, &b_UniqueAncG4P_VtxPID);
0366    // fChain->SetBranchAddress("UniqueAncG4P_ParentPID", &UniqueAncG4P_ParentPID, &b_UniqueAncG4P_ParentPID);
0367    // fChain->SetBranchAddress("UniqueAncG4P_PrimaryPID", &UniqueAncG4P_PrimaryPID, &b_UniqueAncG4P_PrimaryPID);
0368    // fChain->SetBranchAddress("UniqueAncG4P_IonCharge", &UniqueAncG4P_IonCharge, &b_UniqueAncG4P_IonCharge);
0369    // fChain->SetBranchAddress("UniqueAncG4P_TrackID", &UniqueAncG4P_TrackID, &b_UniqueAncG4P_TrackID);
0370    // fChain->SetBranchAddress("UniqueAncG4P_NClus", &UniqueAncG4P_NClus, &b_UniqueAncG4P_NClus);
0371    // fChain->SetBranchAddress("Layer1_occupancy", &Layer1_occupancy, &b_Layer1_occupancy);
0372    fChain->SetBranchAddress("NClus", &NClus, &b_NClus);
0373    fChain->SetBranchAddress("NTrkrhits", &NTrkrhits, &b_NTrkrhits);
0374    fChain->SetBranchAddress("ClusLayer", &ClusLayer, &b_ClusLayer);
0375    fChain->SetBranchAddress("ClusX", &ClusX, &b_ClusX);
0376    fChain->SetBranchAddress("ClusY", &ClusY, &b_ClusY);
0377    fChain->SetBranchAddress("ClusZ", &ClusZ, &b_ClusZ);
0378    fChain->SetBranchAddress("ClusR", &ClusR, &b_ClusR);
0379    fChain->SetBranchAddress("ClusPhi", &ClusPhi, &b_ClusPhi);
0380    fChain->SetBranchAddress("ClusEta", &ClusEta, &b_ClusEta);
0381    fChain->SetBranchAddress("ClusAdc", &ClusAdc, &b_ClusAdc);
0382    fChain->SetBranchAddress("ClusPhiSize", &ClusPhiSize, &b_ClusPhiSize);
0383    fChain->SetBranchAddress("ClusZSize", &ClusZSize, &b_ClusZSize);
0384    fChain->SetBranchAddress("ClusLadderZId", &ClusLadderZId, &b_ClusLadderZId);
0385    fChain->SetBranchAddress("ClusLadderPhiId", &ClusLadderPhiId, &b_ClusLadderPhiId);
0386 
0387    fChain->SetBranchAddress("centrality_bimp", &centrality_bimp, &b_centrality_bimp);
0388    fChain->SetBranchAddress("centrality_mbd", &centrality_mbd, &b_centrality_mbd);
0389    fChain->SetBranchAddress("centrality_mbdquantity", &centrality_mbdquantity, &b_centrality_mbdquantity);
0390 
0391    Notify();
0392 }
0393 
0394 Bool_t INTTDSTchain::Notify()
0395 {
0396    // The Notify() function is called when a new file is opened. This
0397    // can be either for a new TTree in a TChain or when when a new TTree
0398    // is started when using PROOF. It is normally not necessary to make changes
0399    // to the generated code, but the routine can be extended by the
0400    // user if needed. The return value is currently not used.
0401 
0402    return kTRUE;
0403 }
0404 
0405 void INTTDSTchain::Show(Long64_t entry)
0406 {
0407 // Print contents of entry.
0408 // If entry is not specified, print current entry
0409    if (!fChain) return;
0410    fChain->Show(entry);
0411 }
0412 Int_t INTTDSTchain::Cut(Long64_t entry)
0413 {
0414 // This function may be called from Loop.
0415 // returns  1 if entry is accepted.
0416 // returns -1 otherwise.
0417    return 1;
0418 }
0419 #endif // #ifdef INTTDSTchain_cxx