00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef EmecRunHeader2002v0_h
00010 #define EmecRunHeader2002v0_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 class EmecRunHeader2002v0 {
00030 public :
00031 TTree *fChain;
00032 Int_t fCurrent;
00033
00034
00035
00036
00037 UInt_t getFirstCh(){ return first_ch;};
00038
00039
00040 UInt_t getLastCh(){ return last_ch;};
00041
00042
00043 Int_t peakMethod() {return peakf; };
00044
00045
00046 UInt_t calVersion(){return cal_version;};
00047
00048
00049 UInt_t digVersion(){return dig_version;};
00050
00051
00052 UInt_t getShower(){return shower;};
00053
00054
00055 UInt_t getEUnit(){return eunit;};
00056
00057
00058 Int_t getCellsUsed(){return cells_used;};
00059
00060 Float_t getPedRms(int febno){
00061 if(febno >= getFirstCh() && febno <= getLastCh() ){
00062 return ped_rms[febno];
00063 } else {
00064 cout << "Ped RMS accessed out of bounds at: " << febno <<endl;
00065 exit(1);
00066 }
00067 }
00068
00069
00070 UInt_t getTimingType() { return timing_type;};
00071
00072
00073 string getDataFileName(){ return m_fileName;};
00074
00075 void setDataFileName(string fileName){ m_fileName =fileName;};
00076
00077
00078
00079
00080 string m_fileName;
00081 UInt_t first_ch;
00082 UInt_t last_ch;
00083 Int_t peakf;
00084 UInt_t cal_version;
00085 UInt_t dig_version;
00086 UInt_t shower;
00087 UInt_t eunit;
00088 Int_t cells_used;
00089 Float_t ped_rms[1152];
00090 Int_t ieta[1152];
00091 Int_t iphi[1152];
00092 Int_t iz[1152];
00093 Int_t ieta_atlas[1152];
00094 Int_t iphi_atlas[1152];
00095 Int_t iz_atlas[1152];
00096 Float_t Signalovernoise_cut;
00097 Float_t Resolutioncoeffa;
00098 Float_t Resolutioncoeffb;
00099 Int_t Timehec_sample_low;
00100 Float_t Timehec_low_signal_cut;
00101 Float_t Timehec_int_signal_scale;
00102 Float_t Timehec_int_signal_dt;
00103 Int_t Timeemec_sample_low;
00104 Float_t Timeemec_low_signal_cut;
00105 Float_t Timeemec_int_signal_scale;
00106 Float_t Timeemec_int_signal_dt;
00107 UInt_t timing_type;
00108 Float_t t0_dig;
00109 Float_t t0_cub_c;
00110 Float_t t0_cub_epi;
00111 Float_t t0_cub_mu;
00112 Int_t t0_cub_trig;
00113 Int_t tdc_wac_c;
00114 Int_t tdc_wac_epi;
00115 Int_t tdc_wac_mu;
00116 Int_t tdc_wac_reference;
00117 UInt_t tdc_guard_region;
00118 Int_t tdc_force_wac;
00119 Int_t sample_low;
00120 Float_t low_signal_cut;
00121 Float_t int_signal_scale;
00122 Float_t int_signal_dt;
00123
00124
00125 TBranch *b_first_ch;
00126 TBranch *b_last_ch;
00127 TBranch *b_peakf;
00128 TBranch *b_cal_version;
00129 TBranch *b_dig_version;
00130 TBranch *b_shower;
00131 TBranch *b_eunit;
00132 TBranch *b_cells_used;
00133 TBranch *b_ped_rms;
00134 TBranch *b_ieta;
00135 TBranch *b_iphi;
00136 TBranch *b_iz;
00137 TBranch *b_ieta_atlas;
00138 TBranch *b_iphi_atlas;
00139 TBranch *b_iz_atlas;
00140 TBranch *b_Signalovernoise_cut;
00141 TBranch *b_Resolutioncoeffa;
00142 TBranch *b_Resolutioncoeffb;
00143 TBranch *b_Timehec_sample_low;
00144 TBranch *b_Timehec_low_signal_cut;
00145 TBranch *b_Timehec_int_signal_scale;
00146 TBranch *b_Timehec_int_signal_dt;
00147 TBranch *b_Timeemec_sample_low;
00148 TBranch *b_Timeemec_low_signal_cut;
00149 TBranch *b_Timeemec_int_signal_scale;
00150 TBranch *b_Timeemec_int_signal_dt;
00151 TBranch *b_timing_type;
00152 TBranch *b_t0_dig;
00153 TBranch *b_t0_cub_c;
00154 TBranch *b_t0_cub_epi;
00155 TBranch *b_t0_cub_mu;
00156 TBranch *b_t0_cub_trig;
00157 TBranch *b_tdc_wac_c;
00158 TBranch *b_tdc_wac_epi;
00159 TBranch *b_tdc_wac_mu;
00160 TBranch *b_tdc_wac_reference;
00161 TBranch *b_tdc_guard_region;
00162 TBranch *b_tdc_force_wac;
00163 TBranch *b_sample_low;
00164 TBranch *b_low_signal_cut;
00165 TBranch *b_int_signal_scale;
00166 TBranch *b_int_signal_dt;
00167
00168 EmecRunHeader2002v0(TTree *tree=0,string fileName=0);
00169 ~EmecRunHeader2002v0();
00170 Int_t Cut(Int_t entry);
00171 Int_t GetEntry(Int_t entry);
00172 Int_t LoadTree(Int_t entry);
00173 void Init(TTree *tree);
00174 void Loop();
00175 Bool_t Notify();
00176 void Show(Int_t entry = -1);
00177 };
00178
00179 #endif
00180
00181 #ifdef EmecRunHeader2002v0_cxx
00182 EmecRunHeader2002v0::EmecRunHeader2002v0(TTree *tree,string fileName)
00183 {
00184
00185
00186 TFile *f ;
00187 if (tree == 0) {
00188 f = new TFile(fileName.c_str());
00189
00190 tree = (TTree*)f->Get("h2000");
00191
00192 }
00193 Init(tree);
00194 }
00195
00196 EmecRunHeader2002v0::~EmecRunHeader2002v0()
00197 {
00198 if (!fChain) return;
00199 delete fChain->GetCurrentFile();
00200 }
00201
00202 Int_t EmecRunHeader2002v0::GetEntry(Int_t entry)
00203 {
00204
00205 if (!fChain) return 0;
00206 return fChain->GetEntry(entry);
00207 }
00208 Int_t EmecRunHeader2002v0::LoadTree(Int_t entry)
00209 {
00210
00211 if (!fChain) return -5;
00212 Int_t centry = fChain->LoadTree(entry);
00213 if (centry < 0) return centry;
00214 if (fChain->IsA() != TChain::Class()) return centry;
00215 TChain *chain = (TChain*)fChain;
00216 if (chain->GetTreeNumber() != fCurrent) {
00217 fCurrent = chain->GetTreeNumber();
00218 Notify();
00219 }
00220 return centry;
00221 }
00222
00223 void EmecRunHeader2002v0::Init(TTree *tree)
00224 {
00225
00226 if (tree == 0) return;
00227 fChain = tree;
00228 fCurrent = -1;
00229 fChain->SetMakeClass(1);
00230
00231 fChain->SetBranchAddress("first_ch",&first_ch);
00232 fChain->SetBranchAddress("last_ch",&last_ch);
00233 fChain->SetBranchAddress("peakf",&peakf);
00234 fChain->SetBranchAddress("cal_version",&cal_version);
00235 fChain->SetBranchAddress("dig_version",&dig_version);
00236 fChain->SetBranchAddress("shower",&shower);
00237 fChain->SetBranchAddress("eunit",&eunit);
00238 fChain->SetBranchAddress("cells_used",&cells_used);
00239 fChain->SetBranchAddress("ped_rms",ped_rms);
00240 fChain->SetBranchAddress("ieta",ieta);
00241 fChain->SetBranchAddress("iphi",iphi);
00242 fChain->SetBranchAddress("iz",iz);
00243 fChain->SetBranchAddress("ieta_atlas",ieta_atlas);
00244 fChain->SetBranchAddress("iphi_atlas",iphi_atlas);
00245 fChain->SetBranchAddress("iz_atlas",iz_atlas);
00246 fChain->SetBranchAddress("Signalovernoise_cut",&Signalovernoise_cut);
00247 fChain->SetBranchAddress("Resolutioncoeffa",&Resolutioncoeffa);
00248 fChain->SetBranchAddress("Resolutioncoeffb",&Resolutioncoeffb);
00249 fChain->SetBranchAddress("Timehec_sample_low",&Timehec_sample_low);
00250 fChain->SetBranchAddress("Timehec_low_signal_cut",&Timehec_low_signal_cut);
00251 fChain->SetBranchAddress("Timehec_int_signal_scale",&Timehec_int_signal_scale);
00252 fChain->SetBranchAddress("Timehec_int_signal_dt",&Timehec_int_signal_dt);
00253 fChain->SetBranchAddress("Timeemec_sample_low",&Timeemec_sample_low);
00254 fChain->SetBranchAddress("Timeemec_low_signal_cut",&Timeemec_low_signal_cut);
00255 fChain->SetBranchAddress("Timeemec_int_signal_scale",&Timeemec_int_signal_scale);
00256 fChain->SetBranchAddress("Timeemec_int_signal_dt",&Timeemec_int_signal_dt);
00257 fChain->SetBranchAddress("timing_type",&timing_type);
00258 fChain->SetBranchAddress("t0_dig",&t0_dig);
00259 fChain->SetBranchAddress("t0_cub_c",&t0_cub_c);
00260 fChain->SetBranchAddress("t0_cub_epi",&t0_cub_epi);
00261 fChain->SetBranchAddress("t0_cub_mu",&t0_cub_mu);
00262 fChain->SetBranchAddress("t0_cub_trig",&t0_cub_trig);
00263 fChain->SetBranchAddress("tdc_wac_c",&tdc_wac_c);
00264 fChain->SetBranchAddress("tdc_wac_epi",&tdc_wac_epi);
00265 fChain->SetBranchAddress("tdc_wac_mu",&tdc_wac_mu);
00266 fChain->SetBranchAddress("tdc_wac_reference",&tdc_wac_reference);
00267 fChain->SetBranchAddress("tdc_guard_region",&tdc_guard_region);
00268 fChain->SetBranchAddress("tdc_force_wac",&tdc_force_wac);
00269 fChain->SetBranchAddress("sample_low",&sample_low);
00270 fChain->SetBranchAddress("low_signal_cut",&low_signal_cut);
00271 fChain->SetBranchAddress("int_signal_scale",&int_signal_scale);
00272 fChain->SetBranchAddress("int_signal_dt",&int_signal_dt);
00273 Notify();
00274 }
00275
00276 Bool_t EmecRunHeader2002v0::Notify()
00277 {
00278
00279
00280 b_first_ch = fChain->GetBranch("first_ch");
00281 b_last_ch = fChain->GetBranch("last_ch");
00282 b_peakf = fChain->GetBranch("peakf");
00283 b_cal_version = fChain->GetBranch("cal_version");
00284 b_dig_version = fChain->GetBranch("dig_version");
00285 b_shower = fChain->GetBranch("shower");
00286 b_eunit = fChain->GetBranch("eunit");
00287 b_cells_used = fChain->GetBranch("cells_used");
00288 b_ped_rms = fChain->GetBranch("ped_rms");
00289 b_ieta = fChain->GetBranch("ieta");
00290 b_iphi = fChain->GetBranch("iphi");
00291 b_iz = fChain->GetBranch("iz");
00292 b_ieta_atlas = fChain->GetBranch("ieta_atlas");
00293 b_iphi_atlas = fChain->GetBranch("iphi_atlas");
00294 b_iz_atlas = fChain->GetBranch("iz_atlas");
00295 b_Signalovernoise_cut = fChain->GetBranch("Signalovernoise_cut");
00296 b_Resolutioncoeffa = fChain->GetBranch("Resolutioncoeffa");
00297 b_Resolutioncoeffb = fChain->GetBranch("Resolutioncoeffb");
00298 b_Timehec_sample_low = fChain->GetBranch("Timehec_sample_low");
00299 b_Timehec_low_signal_cut = fChain->GetBranch("Timehec_low_signal_cut");
00300 b_Timehec_int_signal_scale = fChain->GetBranch("Timehec_int_signal_scale");
00301 b_Timehec_int_signal_dt = fChain->GetBranch("Timehec_int_signal_dt");
00302 b_Timeemec_sample_low = fChain->GetBranch("Timeemec_sample_low");
00303 b_Timeemec_low_signal_cut = fChain->GetBranch("Timeemec_low_signal_cut");
00304 b_Timeemec_int_signal_scale = fChain->GetBranch("Timeemec_int_signal_scale");
00305 b_Timeemec_int_signal_dt = fChain->GetBranch("Timeemec_int_signal_dt");
00306 b_timing_type = fChain->GetBranch("timing_type");
00307 b_t0_dig = fChain->GetBranch("t0_dig");
00308 b_t0_cub_c = fChain->GetBranch("t0_cub_c");
00309 b_t0_cub_epi = fChain->GetBranch("t0_cub_epi");
00310 b_t0_cub_mu = fChain->GetBranch("t0_cub_mu");
00311 b_t0_cub_trig = fChain->GetBranch("t0_cub_trig");
00312 b_tdc_wac_c = fChain->GetBranch("tdc_wac_c");
00313 b_tdc_wac_epi = fChain->GetBranch("tdc_wac_epi");
00314 b_tdc_wac_mu = fChain->GetBranch("tdc_wac_mu");
00315 b_tdc_wac_reference = fChain->GetBranch("tdc_wac_reference");
00316 b_tdc_guard_region = fChain->GetBranch("tdc_guard_region");
00317 b_tdc_force_wac = fChain->GetBranch("tdc_force_wac");
00318 b_sample_low = fChain->GetBranch("sample_low");
00319 b_low_signal_cut = fChain->GetBranch("low_signal_cut");
00320 b_int_signal_scale = fChain->GetBranch("int_signal_scale");
00321 b_int_signal_dt = fChain->GetBranch("int_signal_dt");
00322 return kTRUE;
00323 }
00324
00325 void EmecRunHeader2002v0::Show(Int_t entry)
00326 {
00327
00328
00329 if (!fChain) return;
00330 fChain->Show(entry);
00331 }
00332 Int_t EmecRunHeader2002v0::Cut(Int_t entry)
00333 {
00334
00335
00336
00337 return 1;
00338 }
00339 #endif // #ifdef EmecRunHeader2002v0_cxx
00340