Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

HecEventNTup2002v0.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////
00002 //   This class has been automatically generated 
00003 //     (Tue May 13 16:51:33 2003 by ROOT version3.05/05)
00004 //   from TTree h101/event
00005 //   found on file: hec_12369.root
00006 //////////////////////////////////////////////////////////
00007 
00008 
00009 #ifndef HecEventNTup2002v0_h
00010 #define HecEventNTup2002v0_h
00011 
00012 #include <TROOT.h>
00013 #include <TChain.h>
00014 #include <TFile.h>
00015 #include <string>
00016 #include <iostream>
00017 
00018 using std::string;
00019 using std::cout;
00020 using std::endl;
00021 
00022 /*! - Class HecEventNTup2002v0
00023   * - Author: Ian Gable (igable@uvic.ca)
00024   * - Date:  05/27/2003
00025   * - Description: This class should not be used to acess the information contained in the event.
00026   *      Use the Event class instead.
00027   */
00028 
00029 class HecEventNTup2002v0 {
00030    public :
00031    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
00032    Int_t           fCurrent; //!current Tree number in a TChain
00033 //Declaration of leaves types
00034    UInt_t          evtno;
00035    UInt_t          trig[5];
00036    Int_t           nchan;
00037    Float_t         signal[1152];   //[nchan]
00038    Float_t         xbeam[5];
00039    Float_t         ybeam[5];
00040 
00041 //List of branches
00042    TBranch        *b_evtno;   //!
00043    TBranch        *b_trig;   //!
00044    TBranch        *b_nchan;   //!
00045    TBranch        *b_signal;   //!
00046    TBranch        *b_xbeam;   //!
00047    TBranch        *b_ybeam;   //!
00048 
00049    HecEventNTup2002v0(TTree *tree=0,string fileName=0);
00050    ~HecEventNTup2002v0();
00051    Int_t  Cut(Int_t entry);
00052    Int_t  GetEntry(Int_t entry);
00053    Int_t  LoadTree(Int_t entry);
00054    void   Init(TTree *tree);
00055    void   Loop();
00056    Bool_t Notify();
00057    void   Show(Int_t entry = -1);
00058    int numEvents();
00059 };
00060 
00061 #endif
00062 
00063 #ifdef HecEventNTup2002v0_cxx
00064 HecEventNTup2002v0::HecEventNTup2002v0(TTree *tree,string fileName)
00065 {
00066 // if parameter tree is not specified (or zero), connect the file
00067 // used to generate this class and read the Tree.
00068    if (tree == 0) {
00069       TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(fileName.c_str());
00070       if (!f) {
00071          f = new TFile(fileName.c_str());
00072       }
00073       tree = (TTree*)gDirectory->Get("h101");
00074 
00075    }
00076    Init(tree);
00077 }
00078 
00079 HecEventNTup2002v0::~HecEventNTup2002v0()
00080 {
00081    if (!fChain) return;
00082    delete fChain->GetCurrentFile();
00083 }
00084 
00085 Int_t HecEventNTup2002v0::GetEntry(Int_t entry)
00086 {
00087 // Read contents of entry.
00088    if (!fChain) return 0;
00089    return fChain->GetEntry(entry);
00090 }
00091 Int_t HecEventNTup2002v0::LoadTree(Int_t entry)
00092 {
00093 // Set the environment to read one entry
00094    if (!fChain) return -5;
00095    Int_t centry = fChain->LoadTree(entry);
00096    if (centry < 0) return centry;
00097    if (fChain->IsA() != TChain::Class()) return centry;
00098    TChain *chain = (TChain*)fChain;
00099    if (chain->GetTreeNumber() != fCurrent) {
00100       fCurrent = chain->GetTreeNumber();
00101       Notify();
00102    }
00103    return centry;
00104 }
00105 
00106 void HecEventNTup2002v0::Init(TTree *tree)
00107 {
00108 //   Set branch addresses
00109    if (tree == 0) return;
00110    fChain    = tree;
00111    fCurrent = -1;
00112    fChain->SetMakeClass(1);
00113 
00114    fChain->SetBranchAddress("evtno",&evtno);
00115    fChain->SetBranchAddress("trig",trig);
00116    fChain->SetBranchAddress("nchan",&nchan);
00117    fChain->SetBranchAddress("signal",signal);
00118    fChain->SetBranchAddress("xbeam",xbeam);
00119    fChain->SetBranchAddress("ybeam",ybeam);
00120    Notify();
00121 }
00122 
00123 Bool_t HecEventNTup2002v0::Notify()
00124 {
00125    // Called when loading a new file.
00126    // Get branch pointers.
00127    b_evtno = fChain->GetBranch("evtno");
00128    b_trig = fChain->GetBranch("trig");
00129    b_nchan = fChain->GetBranch("nchan");
00130    b_signal = fChain->GetBranch("signal");
00131    b_xbeam = fChain->GetBranch("xbeam");
00132    b_ybeam = fChain->GetBranch("ybeam");
00133    return kTRUE;
00134 }
00135 
00136 void HecEventNTup2002v0::Show(Int_t entry)
00137 {
00138 // Print contents of entry.
00139 // If entry is not specified, print current entry
00140    if (!fChain) return;
00141    fChain->Show(entry);
00142 }
00143 Int_t HecEventNTup2002v0::Cut(Int_t entry)
00144 {
00145 // This function may be called from Loop.
00146 // returns  1 if entry is accepted.
00147 // returns -1 otherwise.
00148    return 1;
00149 }
00150 
00151 int HecEventNTup2002v0::numEvents(){
00152   return  int(fChain->GetEntries());
00153 }
00154 #endif // #ifdef HecEventNTup2002v0_cxx
00155 

Generated on Fri Aug 15 10:52:04 2003 for TBRootAna by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002