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