Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-09 08:13:29

0001 //////////////////////////////////////////////////////////
0002 // This class has been automatically generated on
0003 // Fri Jan 26 00:22:22 2024 by ROOT version 6.26/06
0004 // from TTree truth_tree/truth_tree
0005 // found on file: tracking_1K_reverse_3sigma_cut.root
0006 //////////////////////////////////////////////////////////
0007 
0008 #ifndef truthtree_h
0009 #define truthtree_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 
0019 class truthtree
0020 {
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 evt_truth;
0029    vector<double> *truthpx;
0030    vector<double> *truthpy;
0031    vector<double> *truthpz;
0032    vector<double> *truthpt;
0033    vector<double> *trutheta;
0034    vector<double> *truththeta;
0035    vector<double> *truthphi;
0036    vector<int> *truthpid;
0037    vector<int> *status;
0038    vector<double> *truthxvtx;
0039    vector<double> *truthyvtx;
0040    vector<double> *truthzvtx;
0041    vector<double> *truthzout;
0042 
0043    // List of branches
0044    TBranch *b_truthpx;    //!
0045    TBranch *b_truthpy;    //!
0046    TBranch *b_truthpz;    //!
0047    TBranch *b_truthpt;    //!
0048    TBranch *b_trutheta;   //!
0049    TBranch *b_truththeta; //!
0050    TBranch *b_truthphi;   //!
0051    TBranch *b_truthpid;   //!
0052    TBranch *b_status;     //!
0053    TBranch *b_evt_truth;  //!
0054    TBranch *b_truthxvtx;  //!
0055    TBranch *b_truthyvtx;  //!
0056    TBranch *b_truthzvtx;  //!
0057    TBranch *b_truthzout;  //!
0058 
0059    truthtree(TTree *tree = 0);
0060    virtual ~truthtree();
0061    virtual Int_t Cut(Long64_t entry);
0062    virtual Int_t GetEntry(Long64_t entry);
0063    virtual Long64_t LoadTree(Long64_t entry);
0064    virtual void Init(TTree *tree);
0065    virtual void Loop();
0066    virtual Bool_t Notify();
0067    virtual void Show(Long64_t entry = -1);
0068 };
0069 
0070 #endif
0071 
0072 #ifdef truthtree_cxx
0073 truthtree::truthtree(TTree *tree) : fChain(0)
0074 {
0075    // if parameter tree is not specified (or zero), connect the file
0076    // used to generate this class and read the Tree.
0077    if (tree == 0)
0078    {
0079       TFile *f = (TFile *)gROOT->GetListOfFiles()->FindObject("tracking_1K_reverse_3sigma_cut.root");
0080       if (!f || !f->IsOpen())
0081       {
0082          f = new TFile("tracking_1K_reverse_3sigma_cut.root");
0083       }
0084       f->GetObject("truth_tree", tree);
0085    }
0086    Init(tree);
0087 }
0088 
0089 truthtree::~truthtree()
0090 {
0091    if (!fChain)
0092       return;
0093    delete fChain->GetCurrentFile();
0094 }
0095 
0096 Int_t truthtree::GetEntry(Long64_t entry)
0097 {
0098    // Read contents of entry.
0099    if (!fChain)
0100       return 0;
0101    return fChain->GetEntry(entry);
0102 }
0103 Long64_t truthtree::LoadTree(Long64_t entry)
0104 {
0105    // Set the environment to read one entry
0106    if (!fChain)
0107       return -5;
0108    Long64_t centry = fChain->LoadTree(entry);
0109    if (centry < 0)
0110       return centry;
0111    if (fChain->GetTreeNumber() != fCurrent)
0112    {
0113       fCurrent = fChain->GetTreeNumber();
0114       Notify();
0115    }
0116    return centry;
0117 }
0118 
0119 void truthtree::Init(TTree *tree)
0120 {
0121    // The Init() function is called when the selector needs to initialize
0122    // a new tree or chain. Typically here the branch addresses and branch
0123    // pointers of the tree will be set.
0124    // It is normally not necessary to make changes to the generated
0125    // code, but the routine can be extended by the user if needed.
0126    // Init() will be called many times when running on PROOF
0127    // (once per file to be processed).
0128 
0129    // Set object pointer
0130    truthpx = 0;
0131    truthpy = 0;
0132    truthpz = 0;
0133    truthpt = 0;
0134    trutheta = 0;
0135    truththeta = 0;
0136    truthphi = 0;
0137    truthpid = 0;
0138    status = 0;
0139    truthxvtx = 0;
0140    truthyvtx = 0;
0141    truthzvtx = 0;
0142    truthzout = 0;
0143    // Set branch addresses and branch pointers
0144    if (!tree)
0145       return;
0146    fChain = tree;
0147    fCurrent = -1;
0148    fChain->SetMakeClass(1);
0149 
0150    fChain->SetBranchAddress("truthpx", &truthpx, &b_truthpx);
0151    fChain->SetBranchAddress("truthpy", &truthpy, &b_truthpy);
0152    fChain->SetBranchAddress("truthpz", &truthpz, &b_truthpz);
0153    fChain->SetBranchAddress("truthpt", &truthpt, &b_truthpt);
0154    fChain->SetBranchAddress("trutheta", &trutheta, &b_trutheta);
0155    fChain->SetBranchAddress("truththeta", &truththeta, &b_truththeta);
0156    fChain->SetBranchAddress("truthphi", &truthphi, &b_truthphi);
0157    fChain->SetBranchAddress("truthpid", &truthpid, &b_truthpid);
0158    fChain->SetBranchAddress("status", &status, &b_status);
0159    fChain->SetBranchAddress("evt_truth", &evt_truth, &b_evt_truth);
0160    fChain->SetBranchAddress("truthxvtx", &truthxvtx, &b_truthxvtx);
0161    fChain->SetBranchAddress("truthyvtx", &truthyvtx, &b_truthyvtx);
0162    fChain->SetBranchAddress("truthzvtx", &truthzvtx, &b_truthzvtx);
0163    fChain->SetBranchAddress("truthzout", &truthzout, &b_truthzout);
0164    Notify();
0165 }
0166 
0167 Bool_t truthtree::Notify()
0168 {
0169    // The Notify() function is called when a new file is opened. This
0170    // can be either for a new TTree in a TChain or when when a new TTree
0171    // is started when using PROOF. It is normally not necessary to make changes
0172    // to the generated code, but the routine can be extended by the
0173    // user if needed. The return value is currently not used.
0174 
0175    return kTRUE;
0176 }
0177 
0178 void truthtree::Show(Long64_t entry)
0179 {
0180    // Print contents of entry.
0181    // If entry is not specified, print current entry
0182    if (!fChain)
0183       return;
0184    fChain->Show(entry);
0185 }
0186 Int_t truthtree::Cut(Long64_t entry)
0187 {
0188    // This function may be called from Loop.
0189    // returns  1 if entry is accepted.
0190    // returns -1 otherwise.
0191    return 1;
0192 }
0193 #endif // #ifdef truthtree_cxx