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

HecRunHeader2002v0.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////
00002 //   This class has been automatically generated 
00003 //     (Tue May 13 16:50:43 2003 by ROOT version3.05/05)
00004 //   from TTree h1000/run
00005 //   found on file: hec_12369.root
00006 //////////////////////////////////////////////////////////
00007 
00008 
00009 #ifndef HecRunHeader2002v0_h
00010 #define HecRunHeader2002v0_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 HecRunHeader2002v0
00023   * - Author: Ian Gable (igable@uvic.ca)
00024   * - Date:  05/27/2003
00025   * - Description: This class was created by root 3.05/05. Use it to access the information
00026   *      contained in the Hec Run Header.
00027   */
00028 
00029 class HecRunHeader2002v0 {
00030    public :
00031    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
00032    Int_t           fCurrent; //!current Tree number in a TChain
00033 
00034 
00035 
00036 
00037    //! first FEB channel number
00038    UInt_t getFirstCh(){ return first_ch;};
00039 
00040    //! last FEB channel number
00041    UInt_t getLastCh(){ return last_ch;};
00042 
00043    //! peak finding method (polynomial=1, digital filtering=2)
00044    Int_t peakMethod() { return peakf; };
00045 
00046    //! cal Version number of calibration file (if digital filtering is used)
00047    UInt_t calVersion(){return  cal_version;};
00048 
00049    //! Version number of weight parameters files (if digital filtering is used)
00050    UInt_t digVersion(){return dig_version;};
00051 
00052    //! Shower model type ("0" for real data)
00053    UInt_t getShower(){return shower;};
00054 
00055    //! Unit of energy (ADC=1, nA=2)
00056    UInt_t getEUnit(){return eunit;};
00057 
00058    //! The number of adc channels
00059    Int_t getCellsUsed(){return cells_used;};
00060 
00061    Float_t getPedRms(int adcNumber){
00062     if(adcNumber >= getFirstCh() && adcNumber <= getLastCh() ){
00063       return ped_rms[adcNumber];
00064     } else {
00065       cout << "Ped RMS accessed out of bounds at: " << adcNumber <<endl;
00066       exit(1);
00067     }
00068   }
00069 
00070 //private:
00071 
00072 //Declaration of leaves types
00073    UInt_t          first_ch;
00074    UInt_t          last_ch;
00075    Int_t           peakf;
00076    UInt_t          cal_version;
00077    UInt_t          dig_version;
00078    UInt_t          shower;
00079    UInt_t          eunit;
00080    Int_t           cells_used;
00081    Float_t         ped_rms[1152];   //[cells_used]
00082    Int_t           ieta[1152];   //[cells_used]
00083    Int_t           iphi[1152];   //[cells_used]
00084    Int_t           iz[1152];   //[cells_used]
00085 
00086 //List of branches
00087    TBranch        *b_first_ch;   //!
00088    TBranch        *b_last_ch;   //!
00089    TBranch        *b_peakf;   //!
00090    TBranch        *b_cal_version;   //!
00091    TBranch        *b_dig_version;   //!
00092    TBranch        *b_shower;   //!
00093    TBranch        *b_eunit;   //!
00094    TBranch        *b_cells_used;   //!
00095    TBranch        *b_ped_rms;   //!
00096    TBranch        *b_ieta;   //!
00097    TBranch        *b_iphi;   //!
00098    TBranch        *b_iz;   //!
00099 
00100 
00101    HecRunHeader2002v0(TTree *tree=0,string fileName=0);
00102    ~HecRunHeader2002v0();
00103    Int_t  Cut(Int_t entry);
00104    Int_t  GetEntry(Int_t entry);
00105    Int_t  LoadTree(Int_t entry);
00106    void   Init(TTree *tree);
00107    void   Loop();
00108    Bool_t Notify();
00109    void   Show(Int_t entry = -1);
00110 
00111 };
00112 
00113 
00114 
00115 #endif
00116 
00117 #ifdef HecRunHeader2002v0_cxx
00118 HecRunHeader2002v0::HecRunHeader2002v0(TTree *tree,string fileName)
00119 {
00120 // if parameter tree is not specified (or zero), connect the file
00121 // used to generate this class and read the Tree.
00122    TFile *f ;
00123    if (tree == 0) {
00124          f = new TFile(fileName.c_str());
00125 
00126       tree = (TTree*)f->Get("h1000");
00127 
00128    }
00129    Init(tree);
00130 }
00131 
00132 HecRunHeader2002v0::~HecRunHeader2002v0()
00133 {
00134    if (!fChain) return;
00135    delete fChain->GetCurrentFile();
00136 }
00137 
00138 Int_t HecRunHeader2002v0::GetEntry(Int_t entry)
00139 {
00140 // Read contents of entry.
00141    if (!fChain) return 0;
00142    return fChain->GetEntry(entry);
00143 }
00144 Int_t HecRunHeader2002v0::LoadTree(Int_t entry)
00145 {
00146 // Set the environment to read one entry
00147    if (!fChain) return -5;
00148    Int_t centry = fChain->LoadTree(entry);
00149    if (centry < 0) return centry;
00150    if (fChain->IsA() != TChain::Class()) return centry;
00151    TChain *chain = (TChain*)fChain;
00152    if (chain->GetTreeNumber() != fCurrent) {
00153       fCurrent = chain->GetTreeNumber();
00154       Notify();
00155    }
00156    return centry;
00157 }
00158 
00159 void HecRunHeader2002v0::Init(TTree *tree)
00160 {
00161 //   Set branch addresses
00162    if (tree == 0) return;
00163    fChain    = tree;
00164    fCurrent = -1;
00165    fChain->SetMakeClass(1);
00166 
00167    fChain->SetBranchAddress("first_ch",&first_ch);
00168    fChain->SetBranchAddress("last_ch",&last_ch);
00169    fChain->SetBranchAddress("peakf",&peakf);
00170    fChain->SetBranchAddress("cal_version",&cal_version);
00171    fChain->SetBranchAddress("dig_version",&dig_version);
00172    fChain->SetBranchAddress("shower",&shower);
00173    fChain->SetBranchAddress("eunit",&eunit);
00174    fChain->SetBranchAddress("cells_used",&cells_used);
00175    fChain->SetBranchAddress("ped_rms",ped_rms);
00176    fChain->SetBranchAddress("ieta",ieta);
00177    fChain->SetBranchAddress("iphi",iphi);
00178    fChain->SetBranchAddress("iz",iz);
00179    Notify();
00180 }
00181 
00182 Bool_t HecRunHeader2002v0::Notify()
00183 {
00184    // Called when loading a new file.
00185    // Get branch pointers.
00186    b_first_ch = fChain->GetBranch("first_ch");
00187    b_last_ch = fChain->GetBranch("last_ch");
00188    b_peakf = fChain->GetBranch("peakf");
00189    b_cal_version = fChain->GetBranch("cal_version");
00190    b_dig_version = fChain->GetBranch("dig_version");
00191    b_shower = fChain->GetBranch("shower");
00192    b_eunit = fChain->GetBranch("eunit");
00193    b_cells_used = fChain->GetBranch("cells_used");
00194    b_ped_rms = fChain->GetBranch("ped_rms");
00195    b_ieta = fChain->GetBranch("ieta");
00196    b_iphi = fChain->GetBranch("iphi");
00197    b_iz = fChain->GetBranch("iz");
00198    return kTRUE;
00199 }
00200 
00201 void HecRunHeader2002v0::Show(Int_t entry)
00202 {
00203 // Print contents of entry.
00204 // If entry is not specified, print current entry
00205    if (!fChain) return;
00206    fChain->Show(entry);
00207 }
00208 Int_t HecRunHeader2002v0::Cut(Int_t entry)
00209 {
00210 // This function may be called from Loop.
00211 // returns  1 if entry is accepted.
00212 // returns -1 otherwise.
00213    return 1;
00214 }
00215 #endif // #ifdef HecRunHeader2002v0_cxx
00216 

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