00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SlowControl2002v0_h
00010 #define SlowControl2002v0_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 SlowControl2002v0 {
00030 public :
00031 TTree *fChain;
00032 Int_t fCurrent;
00033
00034
00035 SlowControl2002v0(TTree *tree=0,string fileName=0);
00036 ~SlowControl2002v0();
00037 Int_t Cut(Int_t entry);
00038 Int_t GetEntry(Int_t entry);
00039 Int_t LoadTree(Int_t entry);
00040 void Init(TTree *tree);
00041 void Loop();
00042 Bool_t Notify();
00043 void Show(Int_t entry = -1);
00044
00045
00046 int getTime(){ return time;};
00047
00048
00049 int getAdcUsed(){ return adc_used;};
00050
00051
00052 float getPress(){return press;};
00053
00054 private:
00055
00056
00057 UInt_t time;
00058 Int_t adc_used;
00059 Float_t lartemp[8];
00060 Float_t press;
00061 Float_t hvcor[1152];
00062
00063
00064 TBranch *b_time;
00065 TBranch *b_adc_used;
00066 TBranch *b_lartemp;
00067 TBranch *b_press;
00068 TBranch *b_hvcor;
00069
00070 };
00071
00072 #endif
00073
00074 #ifdef SlowControl2002v0_cxx
00075 SlowControl2002v0::SlowControl2002v0(TTree *tree,string fileName)
00076 {
00077
00078
00079 TFile *f ;
00080 if (tree == 0) {
00081 f = new TFile(fileName.c_str());
00082
00083 tree = (TTree*)f->Get("h102");
00084
00085 }
00086 Init(tree);
00087 }
00088
00089
00090 SlowControl2002v0::~SlowControl2002v0()
00091 {
00092 if (!fChain) return;
00093 delete fChain->GetCurrentFile();
00094 }
00095
00096 Int_t SlowControl2002v0::GetEntry(Int_t entry)
00097 {
00098
00099 if (!fChain) return 0;
00100 return fChain->GetEntry(entry);
00101 }
00102 Int_t SlowControl2002v0::LoadTree(Int_t entry)
00103 {
00104
00105 if (!fChain) return -5;
00106 Int_t centry = fChain->LoadTree(entry);
00107 if (centry < 0) return centry;
00108 if (fChain->IsA() != TChain::Class()) return centry;
00109 TChain *chain = (TChain*)fChain;
00110 if (chain->GetTreeNumber() != fCurrent) {
00111 fCurrent = chain->GetTreeNumber();
00112 Notify();
00113 }
00114 return centry;
00115 }
00116
00117 void SlowControl2002v0::Init(TTree *tree)
00118 {
00119
00120 if (tree == 0) return;
00121 fChain = tree;
00122 fCurrent = -1;
00123 fChain->SetMakeClass(1);
00124
00125 fChain->SetBranchAddress("time",&time);
00126 fChain->SetBranchAddress("adc_used",&adc_used);
00127 fChain->SetBranchAddress("lartemp",lartemp);
00128 fChain->SetBranchAddress("press",&press);
00129 fChain->SetBranchAddress("hvcor",hvcor);
00130 Notify();
00131 }
00132
00133 Bool_t SlowControl2002v0::Notify()
00134 {
00135
00136
00137 b_time = fChain->GetBranch("time");
00138 b_adc_used = fChain->GetBranch("adc_used");
00139 b_lartemp = fChain->GetBranch("lartemp");
00140 b_press = fChain->GetBranch("press");
00141 b_hvcor = fChain->GetBranch("hvcor");
00142 return kTRUE;
00143 }
00144
00145 void SlowControl2002v0::Show(Int_t entry)
00146 {
00147
00148
00149 if (!fChain) return;
00150 fChain->Show(entry);
00151 }
00152 Int_t SlowControl2002v0::Cut(Int_t entry)
00153 {
00154
00155
00156
00157 return 1;
00158 }
00159 #endif // #ifdef SlowControl2002v0_cxx
00160