00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef EmecEventNTup2002v1_h
00010 #define EmecEventNTup2002v1_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
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class EmecEventNTup2002v1 {
00034 public :
00035 TTree *fChain;
00036 Int_t fCurrent;
00037
00038 UInt_t evtno;
00039 UInt_t trig[5];
00040 Int_t nchan;
00041 Float_t signal[1152];
00042 Float_t slop[2];
00043 Float_t pos0[2];
00044 Float_t xcov[3];
00045 Float_t ycov[3];
00046 Float_t tdc_ns;
00047 Float_t Globalcubictime;
00048 Float_t Globalcubictimesigma;
00049
00050
00051 TBranch *b_evtno;
00052 TBranch *b_trig;
00053 TBranch *b_nchan;
00054 TBranch *b_signal;
00055 TBranch *b_slop;
00056 TBranch *b_pos0;
00057 TBranch *b_xcov;
00058 TBranch *b_ycov;
00059 TBranch *b_tdc_ns;
00060 TBranch *b_Globalcubictime;
00061 TBranch *b_Globalcubictimesigma;
00062
00063 EmecEventNTup2002v1(TTree *tree=0,string fileName=0);
00064 ~EmecEventNTup2002v1();
00065 Int_t Cut(Int_t entry);
00066 Int_t GetEntry(Int_t entry);
00067 Int_t LoadTree(Int_t entry);
00068 void Init(TTree *tree);
00069 void Loop();
00070 Bool_t Notify();
00071 void Show(Int_t entry = -1);
00072 int numEvents();
00073 };
00074
00075 #endif
00076
00077 #ifdef EmecEventNTup2002v1_cxx
00078 EmecEventNTup2002v1::EmecEventNTup2002v1(TTree *tree,string fileName)
00079 {
00080
00081
00082 TFile *f ;
00083 if (tree == 0) {
00084 f = new TFile(fileName.c_str());
00085
00086 tree = (TTree*)f->Get("h201");
00087
00088 }
00089 Init(tree);
00090 }
00091
00092 EmecEventNTup2002v1::~EmecEventNTup2002v1()
00093 {
00094 if (!fChain) return;
00095 delete fChain->GetCurrentFile();
00096 }
00097
00098 Int_t EmecEventNTup2002v1::GetEntry(Int_t entry)
00099 {
00100
00101 if (!fChain) return 0;
00102 return fChain->GetEntry(entry);
00103 }
00104 Int_t EmecEventNTup2002v1::LoadTree(Int_t entry)
00105 {
00106
00107 if (!fChain) return -5;
00108 Int_t centry = fChain->LoadTree(entry);
00109 if (centry < 0) return centry;
00110 if (fChain->IsA() != TChain::Class()) return centry;
00111 TChain *chain = (TChain*)fChain;
00112 if (chain->GetTreeNumber() != fCurrent) {
00113 fCurrent = chain->GetTreeNumber();
00114 Notify();
00115 }
00116 return centry;
00117 }
00118
00119 void EmecEventNTup2002v1::Init(TTree *tree)
00120 {
00121
00122 if (tree == 0) return;
00123 fChain = tree;
00124 fCurrent = -1;
00125 fChain->SetMakeClass(1);
00126
00127 fChain->SetBranchAddress("evtno",&evtno);
00128 fChain->SetBranchAddress("trig",trig);
00129 fChain->SetBranchAddress("nchan",&nchan);
00130 fChain->SetBranchAddress("signal",signal);
00131 fChain->SetBranchAddress("slop",slop);
00132 fChain->SetBranchAddress("pos0",pos0);
00133 fChain->SetBranchAddress("xcov",xcov);
00134 fChain->SetBranchAddress("ycov",ycov);
00135 fChain->SetBranchAddress("tdc_ns",&tdc_ns);
00136 fChain->SetBranchAddress("Globalcubictime",&Globalcubictime);
00137 fChain->SetBranchAddress("Globalcubictimesigma",&Globalcubictimesigma);
00138 Notify();
00139 }
00140
00141 Bool_t EmecEventNTup2002v1::Notify()
00142 {
00143
00144
00145 b_evtno = fChain->GetBranch("evtno");
00146 b_trig = fChain->GetBranch("trig");
00147 b_nchan = fChain->GetBranch("nchan");
00148 b_signal = fChain->GetBranch("signal");
00149 b_slop = fChain->GetBranch("slop");
00150 b_pos0 = fChain->GetBranch("pos0");
00151 b_xcov = fChain->GetBranch("xcov");
00152 b_ycov = fChain->GetBranch("ycov");
00153 b_tdc_ns = fChain->GetBranch("tdc_ns");
00154 b_Globalcubictime = fChain->GetBranch("Globalcubictime");
00155 b_Globalcubictimesigma = fChain->GetBranch("Globalcubictimesigma");
00156 return kTRUE;
00157 }
00158
00159 void EmecEventNTup2002v1::Show(Int_t entry)
00160 {
00161
00162
00163 if (!fChain) return;
00164 fChain->Show(entry);
00165 }
00166 Int_t EmecEventNTup2002v1::Cut(Int_t entry)
00167 {
00168
00169
00170
00171 return 1;
00172 }
00173
00174 int EmecEventNTup2002v1::numEvents(){
00175 return int(fChain->GetEntries());
00176 }
00177 #endif // #ifdef EmecEventNTup2002v1_cxx
00178