Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /estarlight/utils/AnalyzeTree.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //////////////////////////////////////////////////////////
0002 // This class has been automatically generated on
0003 // Tue Jun 17 14:39:53 2014 by ROOT version 5.34/14
0004 // from TTree starlightTree/starlightTree
0005 // found on file: starlight.root
0006 //////////////////////////////////////////////////////////
0007 
0008 #ifndef AnalyzeTree_h
0009 #define AnalyzeTree_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 <TLorentzVector.h>
0017 #include <TClonesArray.h>
0018 
0019 // Fixed size dimensions of array or collections stored in the TTree if any.
0020 
0021 class AnalyzeTree {
0022 public :
0023    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
0024    Int_t           fCurrent; //!current Tree number in a TChain
0025 
0026    // Declaration of leaf types
0027    TLorentzVector  *parent;
0028    TClonesArray    *daughters;
0029 
0030    // List of branches
0031    TBranch        *b_parent;   //!
0032    TBranch        *b_daughters;   //!
0033 
0034    AnalyzeTree(TString fileName,TString treeName = "esNT");
0035    virtual ~AnalyzeTree();
0036    virtual Int_t    Cut(Long64_t entry);
0037    virtual Int_t    GetEntry(Long64_t entry);
0038    virtual Long64_t LoadTree(Long64_t entry);
0039    virtual void     Init(TTree *tree);
0040    virtual void     Loop();
0041    virtual Bool_t   Notify();
0042    virtual void     Show(Long64_t entry = -1);
0043 
0044    //Data members to be filled
0045    float fspt_, fspz_, fsrap_, fsmass_, p1pt_, p1z_, p1prap_, p2pt_, p2z_, p2prap_, kg_, qsq_, xbj_;
0046    
0047 };
0048 
0049 #endif
0050 
0051 #ifdef AnalyzeTree_cxx
0052 AnalyzeTree::AnalyzeTree(TString fileName,TString treeName) : fChain(0) 
0053 {
0054 // if parameter tree is not specified (or zero), connect the file
0055 // used to generate this class and read the Tree.
0056   TFile * infile = new TFile(fileName,"read");
0057   TTree * tree = (TTree*) infile->Get( treeName );
0058   Init(tree);
0059 }
0060 
0061 AnalyzeTree::~AnalyzeTree()
0062 {
0063    if (!fChain) return;
0064    delete fChain->GetCurrentFile();
0065 }
0066 
0067 Int_t AnalyzeTree::GetEntry(Long64_t entry)
0068 {
0069 // Read contents of entry.
0070    if (!fChain) return 0;
0071    return fChain->GetEntry(entry);
0072 }
0073 Long64_t AnalyzeTree::LoadTree(Long64_t entry)
0074 {
0075 // Set the environment to read one entry
0076    if (!fChain) return -5;
0077    Long64_t centry = fChain->LoadTree(entry);
0078    if (centry < 0) return centry;
0079    if (fChain->GetTreeNumber() != fCurrent) {
0080       fCurrent = fChain->GetTreeNumber();
0081       Notify();
0082    }
0083    return centry;
0084 }
0085 
0086 void AnalyzeTree::Init(TTree *tree)
0087 {
0088    // The Init() function is called when the selector needs to initialize
0089    // a new tree or chain. Typically here the branch addresses and branch
0090    // pointers of the tree will be set.
0091    // It is normally not necessary to make changes to the generated
0092    // code, but the routine can be extended by the user if needed.
0093    // Init() will be called many times when running on PROOF
0094    // (once per file to be processed).
0095 
0096    // Set object pointer
0097    parent = 0;
0098    daughters = 0;
0099    // Set branch addresses and branch pointers
0100    if (!tree) return;
0101    fChain = tree;
0102    fCurrent = -1;
0103    fChain->SetMakeClass(1);
0104 
0105    fChain->SetBranchAddress("fspt",&fspt_);
0106    fChain->SetBranchAddress("fsrap",&fsrap_);
0107    fChain->SetBranchAddress("fspz",&fspz_);
0108    fChain->SetBranchAddress("fsmass",&fsmass_);
0109    fChain->SetBranchAddress("p1pt",&p1pt_);
0110    fChain->SetBranchAddress("p1z",&p1z_);
0111    fChain->SetBranchAddress("p1prap",&p1prap_);
0112    fChain->SetBranchAddress("p2pt",&p2pt_);
0113    fChain->SetBranchAddress("p2z",&p2z_);
0114    fChain->SetBranchAddress("p2prap",&p2prap_);
0115    fChain->SetBranchAddress("kg",&kg_);
0116    fChain->SetBranchAddress("qsq",&qsq_);
0117    fChain->SetBranchAddress("xbj",&xbj_);
0118       
0119    Notify();
0120 }
0121 
0122 Bool_t AnalyzeTree::Notify()
0123 {
0124    // The Notify() function is called when a new file is opened. This
0125    // can be either for a new TTree in a TChain or when when a new TTree
0126    // is started when using PROOF. It is normally not necessary to make changes
0127    // to the generated code, but the routine can be extended by the
0128    // user if needed. The return value is currently not used.
0129 
0130    return kTRUE;
0131 }
0132 
0133 void AnalyzeTree::Show(Long64_t entry)
0134 {
0135 // Print contents of entry.
0136 // If entry is not specified, print current entry
0137    if (!fChain) return;
0138    fChain->Show(entry);
0139 }
0140 Int_t AnalyzeTree::Cut(Long64_t entry)
0141 {
0142 // This function may be called from Loop.
0143 // returns  1 if entry is accepted.
0144 // returns -1 otherwise.
0145    return 1;
0146 }
0147 #endif // #ifdef AnalyzeTree_cxx