Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:25

0001 //////////////////////////////////////////////////////////
0002 // This class has been automatically generated on
0003 // Thu May  2 09:00:27 2024 by ROOT version 6.26/06
0004 // from TTree tree/INTT clu
0005 // found on file: merged_file.root
0006 //////////////////////////////////////////////////////////
0007 
0008 #ifndef MCSelfGenReader_h
0009 #define MCSelfGenReader_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 #include "vector"
0018 #include "vector"
0019 
0020 class MCSelfGenReader {
0021 public :
0022    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
0023    Int_t           fCurrent; //!current Tree number in a TChain
0024 
0025 // Fixed size dimensions of array or collections stored in the TTree if any.
0026 
0027    // Declaration of leaf types
0028    Int_t           NClus;
0029    vector<int>     *system;
0030    vector<int>     *layer;
0031    vector<int>     *adc;
0032    vector<double>  *X;
0033    vector<double>  *Y;
0034    vector<double>  *Z;
0035    vector<int>     *size;
0036    vector<int>     *phi_size;
0037    vector<int>     *Z_size;
0038    Double_t        TruthPV_x;
0039    Double_t        TruthPV_y;
0040    Double_t        TruthPV_z;
0041    Int_t           NPrimaryG4P;
0042    vector<float>   *PrimaryG4P_Pt;
0043    vector<float>   *PrimaryG4P_Eta;
0044    vector<float>   *PrimaryG4P_Phi;
0045    vector<float>   *PrimaryG4P_E;
0046    vector<int>     *PrimaryG4P_PID;
0047 
0048    // List of branches
0049    TBranch        *b_NClus;   //!
0050    TBranch        *b_system;   //!
0051    TBranch        *b_layer;   //!
0052    TBranch        *b_adc;   //!
0053    TBranch        *b_X;   //!
0054    TBranch        *b_Y;   //!
0055    TBranch        *b_Z;   //!
0056    TBranch        *b_size;   //!
0057    TBranch        *b_phi_size;   //!
0058    TBranch        *b_Z_size;   //!
0059    TBranch        *b_TruthPV_x;   //!
0060    TBranch        *b_TruthPV_y;   //!
0061    TBranch        *b_TruthPV_z;   //!
0062    TBranch        *b_NPrimaryG4P;   //!
0063    TBranch        *b_PrimaryG4P_Pt;   //!
0064    TBranch        *b_PrimaryG4P_Eta;   //!
0065    TBranch        *b_PrimaryG4P_Phi;   //!
0066    TBranch        *b_PrimaryG4P_E;   //!
0067    TBranch        *b_PrimaryG4P_PID;   //!
0068 
0069    MCSelfGenReader(TTree *tree=0);
0070    virtual ~MCSelfGenReader();
0071    virtual Int_t    Cut(Long64_t entry);
0072    virtual Int_t    GetEntry(Long64_t entry);
0073    virtual Long64_t LoadTree(Long64_t entry);
0074    virtual void     Init(TTree *tree);
0075    virtual void     Loop();
0076    virtual Bool_t   Notify();
0077    virtual void     Show(Long64_t entry = -1);
0078 };
0079 
0080 #endif
0081 
0082 #ifdef MCSelfGenReader_cxx
0083 MCSelfGenReader::MCSelfGenReader(TTree *tree) : fChain(0) 
0084 {
0085 // if parameter tree is not specified (or zero), connect the file
0086 // used to generate this class and read the Tree.
0087    if (tree == 0) {
0088       TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("merged_file.root");
0089       if (!f || !f->IsOpen()) {
0090          f = new TFile("merged_file.root");
0091       }
0092       f->GetObject("tree",tree);
0093 
0094    }
0095    Init(tree);
0096 }
0097 
0098 MCSelfGenReader::~MCSelfGenReader()
0099 {
0100    if (!fChain) return;
0101    delete fChain->GetCurrentFile();
0102 }
0103 
0104 Int_t MCSelfGenReader::GetEntry(Long64_t entry)
0105 {
0106 // Read contents of entry.
0107    if (!fChain) return 0;
0108    return fChain->GetEntry(entry);
0109 }
0110 Long64_t MCSelfGenReader::LoadTree(Long64_t entry)
0111 {
0112 // Set the environment to read one entry
0113    if (!fChain) return -5;
0114    Long64_t centry = fChain->LoadTree(entry);
0115    if (centry < 0) return centry;
0116    if (fChain->GetTreeNumber() != fCurrent) {
0117       fCurrent = fChain->GetTreeNumber();
0118       Notify();
0119    }
0120    return centry;
0121 }
0122 
0123 void MCSelfGenReader::Init(TTree *tree)
0124 {
0125    // The Init() function is called when the selector needs to initialize
0126    // a new tree or chain. Typically here the branch addresses and branch
0127    // pointers of the tree will be set.
0128    // It is normally not necessary to make changes to the generated
0129    // code, but the routine can be extended by the user if needed.
0130    // Init() will be called many times when running on PROOF
0131    // (once per file to be processed).
0132 
0133    // Set object pointer
0134    system = 0;
0135    layer = 0;
0136    adc = 0;
0137    X = 0;
0138    Y = 0;
0139    Z = 0;
0140    size = 0;
0141    phi_size = 0;
0142    Z_size = 0;
0143    PrimaryG4P_Pt = 0;
0144    PrimaryG4P_Eta = 0;
0145    PrimaryG4P_Phi = 0;
0146    PrimaryG4P_E = 0;
0147    PrimaryG4P_PID = 0;
0148    // Set branch addresses and branch pointers
0149    if (!tree) return;
0150    fChain = tree;
0151    fCurrent = -1;
0152    fChain->SetMakeClass(1);
0153 
0154    fChain->SetBranchAddress("NClus", &NClus, &b_NClus);
0155    fChain->SetBranchAddress("system", &system, &b_system);
0156    fChain->SetBranchAddress("layer", &layer, &b_layer);
0157    fChain->SetBranchAddress("adc", &adc, &b_adc);
0158    fChain->SetBranchAddress("X", &X, &b_X);
0159    fChain->SetBranchAddress("Y", &Y, &b_Y);
0160    fChain->SetBranchAddress("Z", &Z, &b_Z);
0161    fChain->SetBranchAddress("size", &size, &b_size);
0162    fChain->SetBranchAddress("phi_size", &phi_size, &b_phi_size);
0163    fChain->SetBranchAddress("Z_size", &Z_size, &b_Z_size);
0164    fChain->SetBranchAddress("TruthPV_x", &TruthPV_x, &b_TruthPV_x);
0165    fChain->SetBranchAddress("TruthPV_y", &TruthPV_y, &b_TruthPV_y);
0166    fChain->SetBranchAddress("TruthPV_z", &TruthPV_z, &b_TruthPV_z);
0167    fChain->SetBranchAddress("NPrimaryG4P", &NPrimaryG4P, &b_NPrimaryG4P);
0168    fChain->SetBranchAddress("PrimaryG4P_Pt", &PrimaryG4P_Pt, &b_PrimaryG4P_Pt);
0169    fChain->SetBranchAddress("PrimaryG4P_Eta", &PrimaryG4P_Eta, &b_PrimaryG4P_Eta);
0170    fChain->SetBranchAddress("PrimaryG4P_Phi", &PrimaryG4P_Phi, &b_PrimaryG4P_Phi);
0171    fChain->SetBranchAddress("PrimaryG4P_E", &PrimaryG4P_E, &b_PrimaryG4P_E);
0172    fChain->SetBranchAddress("PrimaryG4P_PID", &PrimaryG4P_PID, &b_PrimaryG4P_PID);
0173    Notify();
0174 }
0175 
0176 Bool_t MCSelfGenReader::Notify()
0177 {
0178    // The Notify() function is called when a new file is opened. This
0179    // can be either for a new TTree in a TChain or when when a new TTree
0180    // is started when using PROOF. It is normally not necessary to make changes
0181    // to the generated code, but the routine can be extended by the
0182    // user if needed. The return value is currently not used.
0183 
0184    return kTRUE;
0185 }
0186 
0187 void MCSelfGenReader::Show(Long64_t entry)
0188 {
0189 // Print contents of entry.
0190 // If entry is not specified, print current entry
0191    if (!fChain) return;
0192    fChain->Show(entry);
0193 }
0194 Int_t MCSelfGenReader::Cut(Long64_t entry)
0195 {
0196 // This function may be called from Loop.
0197 // returns  1 if entry is accepted.
0198 // returns -1 otherwise.
0199    return 1;
0200 }
0201 #endif // #ifdef MCSelfGenReader_cxx