Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 //////////////////////////////////////////////////////////
0002 // This class has been automatically generated on
0003 // Fri Mar  1 14:53:33 2024 by ROOT version 6.26/06
0004 // from TTree EventTree/EventTree
0005 // found on file: /gpfs/mnt/gpfs02/sphenix/user/cdean/software/analysis/dNdEta_Run2023/macros/centrality_run20869.root
0006 //////////////////////////////////////////////////////////
0007 
0008 #ifndef MBDReaderV1_h
0009 #define MBDReaderV1_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 
0017 class MBDReaderV1 {
0018 public :
0019    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
0020    Int_t           fCurrent; //!current Tree number in a TChain
0021 
0022 // Fixed size dimensions of array or collections stored in the TTree if any.
0023 
0024    // Declaration of leaf types
0025    UShort_t        femclk;
0026    Bool_t          is_min_bias;
0027    Float_t         MBD_centrality;
0028    Float_t         MBD_z_vtx;
0029    Float_t         MBD_south_charge_sum;
0030    Float_t         MBD_north_charge_sum;
0031    Float_t         MBD_charge_sum;
0032    Float_t         MBD_charge_asymm;
0033 
0034    // List of branches
0035    TBranch        *b_femclk;   //!
0036    TBranch        *b_is_min_bias;   //!
0037    TBranch        *b_MBD_centrality;   //!
0038    TBranch        *b_MBD_z_vtx;   //!
0039    TBranch        *b_MBD_south_charge_sum;   //!
0040    TBranch        *b_MBD_north_charge_sum;   //!
0041    TBranch        *b_MBD_charge_sum;   //!
0042    TBranch        *b_MBD_charge_asymm;   //!
0043 
0044    MBDReaderV1(TTree *tree=0);
0045    virtual ~MBDReaderV1();
0046    virtual Int_t    Cut(Long64_t entry);
0047    virtual Int_t    GetEntry(Long64_t entry);
0048    virtual Long64_t LoadTree(Long64_t entry);
0049    virtual void     Init(TTree *tree);
0050    virtual void     Loop();
0051    virtual Bool_t   Notify();
0052    virtual void     Show(Long64_t entry = -1);
0053 };
0054 
0055 #endif
0056 
0057 #ifdef MBDReaderV1_cxx
0058 MBDReaderV1::MBDReaderV1(TTree *tree) : fChain(0) 
0059 {
0060 // if parameter tree is not specified (or zero), connect the file
0061 // used to generate this class and read the Tree.
0062    if (tree == 0) {
0063       TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("/gpfs/mnt/gpfs02/sphenix/user/cdean/software/analysis/dNdEta_Run2023/macros/centrality_run20869.root");
0064       if (!f || !f->IsOpen()) {
0065          f = new TFile("/gpfs/mnt/gpfs02/sphenix/user/cdean/software/analysis/dNdEta_Run2023/macros/centrality_run20869.root");
0066       }
0067       f->GetObject("EventTree",tree);
0068 
0069    }
0070    Init(tree);
0071 }
0072 
0073 MBDReaderV1::~MBDReaderV1()
0074 {
0075    if (!fChain) return;
0076    delete fChain->GetCurrentFile();
0077 }
0078 
0079 Int_t MBDReaderV1::GetEntry(Long64_t entry)
0080 {
0081 // Read contents of entry.
0082    if (!fChain) return 0;
0083    return fChain->GetEntry(entry);
0084 }
0085 Long64_t MBDReaderV1::LoadTree(Long64_t entry)
0086 {
0087 // Set the environment to read one entry
0088    if (!fChain) return -5;
0089    Long64_t centry = fChain->LoadTree(entry);
0090    if (centry < 0) return centry;
0091    if (fChain->GetTreeNumber() != fCurrent) {
0092       fCurrent = fChain->GetTreeNumber();
0093       Notify();
0094    }
0095    return centry;
0096 }
0097 
0098 void MBDReaderV1::Init(TTree *tree)
0099 {
0100    // The Init() function is called when the selector needs to initialize
0101    // a new tree or chain. Typically here the branch addresses and branch
0102    // pointers of the tree will be set.
0103    // It is normally not necessary to make changes to the generated
0104    // code, but the routine can be extended by the user if needed.
0105    // Init() will be called many times when running on PROOF
0106    // (once per file to be processed).
0107 
0108    // Set branch addresses and branch pointers
0109    if (!tree) return;
0110    fChain = tree;
0111    fCurrent = -1;
0112    fChain->SetMakeClass(1);
0113 
0114    fChain->SetBranchAddress("femclk", &femclk, &b_femclk);
0115    fChain->SetBranchAddress("is_min_bias", &is_min_bias, &b_is_min_bias);
0116    fChain->SetBranchAddress("MBD_centrality", &MBD_centrality, &b_MBD_centrality);
0117    fChain->SetBranchAddress("MBD_z_vtx", &MBD_z_vtx, &b_MBD_z_vtx);
0118    fChain->SetBranchAddress("MBD_south_charge_sum", &MBD_south_charge_sum, &b_MBD_south_charge_sum);
0119    fChain->SetBranchAddress("MBD_north_charge_sum", &MBD_north_charge_sum, &b_MBD_north_charge_sum);
0120    fChain->SetBranchAddress("MBD_charge_sum", &MBD_charge_sum, &b_MBD_charge_sum);
0121    fChain->SetBranchAddress("MBD_charge_asymm", &MBD_charge_asymm, &b_MBD_charge_asymm);
0122    Notify();
0123 }
0124 
0125 Bool_t MBDReaderV1::Notify()
0126 {
0127    // The Notify() function is called when a new file is opened. This
0128    // can be either for a new TTree in a TChain or when when a new TTree
0129    // is started when using PROOF. It is normally not necessary to make changes
0130    // to the generated code, but the routine can be extended by the
0131    // user if needed. The return value is currently not used.
0132 
0133    return kTRUE;
0134 }
0135 
0136 void MBDReaderV1::Show(Long64_t entry)
0137 {
0138 // Print contents of entry.
0139 // If entry is not specified, print current entry
0140    if (!fChain) return;
0141    fChain->Show(entry);
0142 }
0143 Int_t MBDReaderV1::Cut(Long64_t entry)
0144 {
0145 // This function may be called from Loop.
0146 // returns  1 if entry is accepted.
0147 // returns -1 otherwise.
0148    return 1;
0149 }
0150 #endif // #ifdef MBDReaderV1_cxx