00001 #ifndef MELaserPrim_hh
00002 #define MELaserPrim_hh
00003
00004 #include <iostream>
00005 #include <fstream>
00006 #include <vector>
00007 #include <map>
00008
00009 #include <TROOT.h>
00010 #include <TChain.h>
00011 #include <TH2I.h>
00012 #include <TH2F.h>
00013 #include <TFile.h>
00014 #include <TString.h>
00015
00016 #include "ME.h"
00017
00018 class MELaserPrim
00019 {
00020
00021 public:
00022
00023
00024 enum { iAPD, iAPDoPN, iAPDoPNA, iAPDoPNB, iAPDoAPD, iAPDoAPDA, iAPDoAPDB, iTime, iSizeArray_apdpn };
00025 enum { iMean, iRMS, iM3, iNevt, iMin, iMax, iSize_apdpn };
00026 enum { iShapeCor, iSizeExtra_apdpn };
00027 enum { iAlpha, iBeta, iWidth, iChi2, iSize_ab };
00028 enum { iPeak, iSigma, iFit, iAmpl, iTrise, iFwhm, iFw20, iFw80, iSlide, iSize_mtq };
00029
00030 enum { iGain0, iGain1, iGain2, iGain3, iSize_gain };
00031
00032
00033 enum { iECAL, iECAL_LMR,
00034 iEB_crystal_number, iEB_LM_LMM, iEB_LM_PN,
00035 iEE_crystal_number, iEE_LM_LMM, iEE_LM_PN, iSize_cv };
00036 static TString channelViewName( int );
00037 static int logicId( int channelView, int id1, int id2=0 );
00038 static bool getViewIds( int logicId, int& channelView, int& id1, int& id2 );
00039
00040
00041 MELaserPrim( ME::Header header, ME::Settings settings,
00042 const char* inpath, const char* outfile );
00043
00044
00045 virtual ~MELaserPrim();
00046
00047
00048 bool init_ok;
00049 void init();
00050 void bookHistograms();
00051 void fillHistograms();
00052 void writeHistograms();
00053 void print(std::ostream& o );
00054
00055
00056 static TString lmfLaserName( int table, int type,
00057 int color=ME::iBlue );
00058
00059
00060 bool setInt( const char*, int ix, int iy, int ival );
00061 bool setVal( const char*, int ix, int iy, float val );
00062
00063
00064 bool setInt( const char* tname, const char* vname, int ival );
00065 bool setVal( const char* tname, const char* vname, float val );
00066
00067 bool fill( const char* tname );
00068
00069
00070 Int_t getInt( const char*, int ix, int iy );
00071 Float_t getVal( const char*, int ix, int iy );
00072
00073 static TString separator;
00074
00075 private:
00076
00077
00078 int _reg;
00079 bool _isBarrel;
00080 int _lmr;
00081 int _dcc;
00082 int _side;
00083 int _run;
00084 int _lb;
00085 int _events;
00086
00087 int _type;
00088 int _color;
00089 int _power;
00090 int _filter;
00091 int _delay;
00092
00093
00094 ME::TimeStamp _ts;
00095 ME::TimeStamp _ts_beg;
00096 ME::TimeStamp _ts_end;
00097
00098 int _mgpagain;
00099 int _memgain;
00100
00101
00102 int _ecal_region;
00103 int _sm;
00104
00105
00106 TString _sectorStr;
00107 TString _regionStr;
00108 TString _primStr;
00109 TString _pnPrimStr;
00110 TString _pulseStr;
00111 TString _tpPrimStr;
00112 TString _tpPnPrimStr;
00113
00114
00115 TFile* apdpn_file;
00116 TFile* ab_file;
00117 TFile* pn_file;
00118 TFile* mtq_file;
00119 TFile* tpapd_file;
00120 TFile* out_file;
00121
00122
00123 TTree* apdpn_tree;
00124 TTree* ab_tree;
00125 TTree* pn_tree;
00126 TTree* mtq_tree;
00127 TTree* tpapd_tree;
00128 TTree* tppn_tree;
00129
00130
00131 TString _inpath;
00132
00133
00134 TString _outfile;
00135
00136
00137 int nx;
00138 int ixmin;
00139 int ixmax;
00140 int ny;
00141 int iymin;
00142 int iymax;
00143
00144
00145 std::map< TString, TH2* > i_h;
00146 std::map< TString, TH2* > f_h;
00147
00148
00149 std::map< TString, TTree* > t_t;
00150 std::map< TString, int > i_t;
00151 std::map< TString, float > f_t;
00152 std::map< TString, const char* > c_t;
00153
00154
00155 Int_t apdpn_dccID;
00156 Int_t apdpn_towerID;
00157 Int_t apdpn_channelID;
00158 Int_t apdpn_moduleID;
00159
00160 Int_t apdpn_side;
00161 Int_t apdpn_ieta;
00162 Int_t apdpn_iphi;
00163 Int_t apdpn_flag;
00164 Double_t apdpn_ShapeCor;
00165 Double_t apdpn_apdpn[iSizeArray_apdpn][iSize_apdpn];
00166
00167
00168 Int_t ab_dccID;
00169 Int_t ab_towerID;
00170 Int_t ab_channelID;
00171 Int_t ab_ieta;
00172 Int_t ab_iphi;
00173 Int_t ab_flag;
00174 Double_t ab_ab[iSize_ab];
00175
00176
00177 Int_t pn_side;
00178 Int_t pn_pnID;
00179 Int_t pn_moduleID;
00180 Double_t pn_PN[iSize_apdpn];
00181 Double_t pn_PNoPN[iSize_apdpn];
00182 Double_t pn_PNoPNA[iSize_apdpn];
00183 Double_t pn_PNoPNB[iSize_apdpn];
00184
00185
00186 Int_t mtq_side;
00187 Int_t mtq_color;
00188 Double_t mtq_mtq[iSize_mtq];
00189
00190
00191 Int_t tpapd_iphi;
00192 Int_t tpapd_ieta;
00193 Int_t tpapd_dccID;
00194 Int_t tpapd_side;
00195 Int_t tpapd_towerID;
00196 Int_t tpapd_channelID;
00197 Int_t tpapd_moduleID;
00198 Int_t tpapd_flag;
00199 Int_t tpapd_gain;
00200 Double_t tpapd_APD[iSize_apdpn];
00201
00202
00203 Int_t tppn_side;
00204 Int_t tppn_pnID;
00205 Int_t tppn_moduleID;
00206 Int_t tppn_gain;
00207 Double_t tppn_PN[iSize_apdpn];
00208
00209
00210 TBranch *b_apdpn_dccID;
00211 TBranch *b_apdpn_towerID;
00212 TBranch *b_apdpn_channelID;
00213 TBranch *b_apdpn_moduleID;
00214
00215 TBranch *b_apdpn_side;
00216 TBranch *b_apdpn_ieta;
00217 TBranch *b_apdpn_iphi;
00218 TBranch *b_apdpn_flag;
00219 TBranch *b_apdpn_ShapeCor;
00220 TBranch *b_apdpn_apdpn[iSizeArray_apdpn];
00221
00222
00223 TBranch *b_ab_dccID;
00224 TBranch *b_ab_towerID;
00225 TBranch *b_ab_channelID;
00226 TBranch *b_ab_ieta;
00227 TBranch *b_ab_iphi;
00228 TBranch *b_ab_flag;
00229 TBranch *b_ab_ab[iSize_ab];
00230
00231
00232 TBranch *b_pn_side;
00233 TBranch *b_pn_pnID;
00234 TBranch *b_pn_moduleID;
00235 TBranch *b_pn_PN;
00236 TBranch *b_pn_PNoPN;
00237 TBranch *b_pn_PNoPNA;
00238 TBranch *b_pn_PNoPNB;
00239
00240
00241 TBranch *b_mtq_side;
00242 TBranch *b_mtq_color;
00243 TBranch *b_mtq_mtq[iSize_mtq];
00244
00245
00246 TBranch *b_tpapd_iphi;
00247 TBranch *b_tpapd_ieta;
00248 TBranch *b_tpapd_dccID;
00249 TBranch *b_tpapd_side;
00250 TBranch *b_tpapd_towerID;
00251 TBranch *b_tpapd_channelID;
00252 TBranch *b_tpapd_moduleID;
00253 TBranch *b_tpapd_flag;
00254 TBranch *b_tpapd_gain;
00255 TBranch *b_tpapd_APD;
00256
00257
00258 TBranch *b_tppn_side;
00259 TBranch *b_tppn_pnID;
00260 TBranch *b_tppn_moduleID;
00261 TBranch *b_tppn_gain;
00262 TBranch *b_tppn_PN;
00263
00264 static TString apdpn_arrayName[iSizeArray_apdpn];
00265 static TString apdpn_varName[iSize_apdpn];
00266 static TString apdpn_varUnit[iSizeArray_apdpn][iSize_apdpn];
00267 static TString apdpn_extraVarName[iSizeExtra_apdpn];
00268 static TString apdpn_extraVarUnit[iSizeExtra_apdpn];
00269 static TString ab_varName[iSize_ab];
00270 static TString mtq_varName[iSize_mtq];
00271 static TString mtq_varUnit[iSize_mtq];
00272
00273 void setHistoStyle( TH1* );
00274 void refresh();
00275 void addBranchI( const char* t_name, const char* v_name );
00276 void addBranchF( const char* t_name, const char* v_name );
00277 void addBranchC( const char* t_name, const char* v_name );
00278 void bookHistoI( const char* t_name, const char* v_name );
00279 void bookHistoF( const char* t_name, const char* v_name );
00280
00281
00282
00283 };
00284
00285 #endif