1 #define MELaserPrim_cxx
12 { {
" (ADC Counts)",
" (ADC Counts)",
" (ADC Counts)" ,
"",
" (ADC Counts)",
" (ADC Counts)"},
13 {
"",
"",
"",
"",
"",
""},
14 {
"",
"",
"",
"",
"",
""},
15 {
"",
"",
"",
"",
"",
""},
16 {
"",
"",
"",
"",
"",
""},
17 {
"",
"",
"",
"",
"",
""},
18 {
" (25 ns)",
" (25 ns)",
" (25 ns)",
"",
" (25 ns)",
" (25 ns)"} };
24 {
"(nanoseconds)",
"(nanoseconds)",
"(nanoseconds)",
25 "(ADC counts)",
"(nanoseconds)",
26 "(nanoseconds)",
"(nanoseconds)",
"(nanoseconds)",
"(ADC counts)"};
33 const char* inpath,
const char*
outfile )
34 : init_ok(
false), _isBarrel(
true), _inpath(inpath), _outfile(outfile)
98 case iECAL:
return "ECAL";
116 return 1000000*channelView + 10000*id1 + id2;
123 int channelView_ = logic_id/1000000;
124 if( channelView!=0 && channelView_!=channelView ) out=
false;
125 channelView = channelView_;
126 id1 = (logic_id%1000000)/10000;
127 id2 = logic_id%10000;
134 bool verbose_ =
false;
138 if( verbose_ )
std::cout <<
"no input file" << std::endl;
144 if( !cur.EndsWith(
"/") ) cur+=
"/";
148 TString _APDPN_fname =cur; _APDPN_fname +=
"APDPN_LASER.root";
149 TString _AB_fname =cur; _AB_fname +=
"AB.root";
150 TString _MTQ_fname =cur; _MTQ_fname +=
"MATACQ.root";
152 bool apdpn_ok, ab_ok, pn_ok, mtq_ok;
153 apdpn_ok=
false; ab_ok=
false; pn_ok=
false; mtq_ok=
false;
156 test = fopen( _APDPN_fname,
"r");
162 test = fopen( _AB_fname,
"r");
168 test = fopen( _MTQ_fname,
"r");
175 if(apdpn_ok)
apdpn_file = TFile::Open( _APDPN_fname );
176 if(ab_ok)
ab_file = TFile::Open( _AB_fname );
177 if(mtq_ok)
mtq_file = TFile::Open( _MTQ_fname );
181 std::cout << _APDPN_fname <<
" ok=" << apdpn_ok << std::endl;
182 std::cout << _AB_fname <<
" ok=" << ab_ok << std::endl;
183 std::cout << _MTQ_fname <<
" ok=" << mtq_ok << std::endl;
185 if (!apdpn_ok || !pn_ok )
return;
187 TString apdpn_tree_name;
188 TString ab_tree_name;
189 TString pn_tree_name;
190 TString mtq_tree_name;
192 apdpn_tree_name =
"APDCol";
193 ab_tree_name =
"ABCol";
194 pn_tree_name =
"PNCol";
195 mtq_tree_name =
"MatacqCol";
197 apdpn_tree_name +=
_color;
203 TTree *ckeckMtq = (TTree*)
mtq_file->Get(mtq_tree_name);
204 if( ckeckMtq ==0 ) mtq_ok =
false;
208 std::cout <<
"MELaserPrim::init() -- Fatal Error -- Wrong Laser Color : " <<
_color <<
" ---- Abort " << std::endl;
273 TString _TPAPD_fname =cur; _TPAPD_fname +=
"APDPN_TESTPULSE.root";
279 test = fopen( _TPAPD_fname,
"r");
285 if(tpapd_ok)
tpapd_file = TFile::Open( _TPAPD_fname );
289 std::cout << _TPAPD_fname <<
" ok=" << tpapd_ok << std::endl;
291 if (!tpapd_ok )
return;
293 TString tpapd_tree_name;
294 TString tppn_tree_name;
296 tpapd_tree_name =
"TPAPD";
297 tppn_tree_name =
"TPPN";
331 TString i_name, d_name;
367 t_name =
"LMF_RUN_DAT";
375 t_name =
"LMF_RUN_IOV";
464 t_name =
"RUN_LASERRUN_CONFIG_DAT";
510 Long64_t nentries = 0;
514 int id1_(0), id2_(0);
521 for( Long64_t jentry=0; jentry<nentries; jentry++ )
528 ientry =
ab_tree->LoadTree( jentry );
564 logic_id_ =
logicId( channelView_, id1_, id2_ );
568 setInt(
"LOGIC_ID", ix, iy, logic_id_ );
569 setInt(
"FLAG", ix, iy, flag );
598 setVal(
"ALPHA", ix, iy, 0. );
599 setVal(
"BETA", ix, iy, 0. );
615 nentries =
pn_tree->GetEntriesFast();
616 assert( nentries%2==0 );
622 while( jentry<nentries )
624 for(
int jj=0;
jj<2;
jj++ )
629 int zentry = jentry+
jj;
630 assert( zentry<nentries );
632 ientry =
pn_tree->LoadTree( zentry );
648 id2_ = memPn_.second;
676 id2_ = (jj+1)*100+memPn_.second;
687 logic_id_ =
logicId( channelView_, id1_, id2_ );
719 nentries =
mtq_tree->GetEntriesFast();
720 assert( nentries==2 );
721 for( Long64_t jentry=0; jentry<nentries; jentry++ )
723 ientry =
mtq_tree->LoadTree( jentry );
916 t_name =
"LMF_RUN_IOV";
926 c_t[t_name+
separator+
"SUB_RUN_TYPE"] =
"LASER TEST CRUZET";
939 std::map< TString, TH2* >::iterator it;
941 for( it=
i_h.begin(); it!=
i_h.end(); it++ )
947 for( it=
f_h.begin(); it!=
f_h.end(); it++ )
953 std::map< TString, TTree* >::iterator it_t;
954 for( it_t=
t_t.begin(); it_t!=
t_t.end(); it_t++ )
956 it_t->second->Write();
1007 o <<
"DCC/SM/side/type/color/run/ts " <<
_dcc <<
"/" <<
_sm <<
"/" <<
_side <<
"/"
1026 TString str(
"LMF_ERROR");
1028 if( color<0 || color>=
ME::iSizeC )
return str;
1035 case ME::iBlue: colstr =
"_BLUE";
break;
1037 case ME::iRed: colstr =
"_RED";
break;
1038 case ME::iIRed: colstr =
"_IRED";
break;
1054 str =
"LMF_TEST_PULSE";
1071 TString slashI(
"/i");
1072 TString t_name(t_name_);
1073 TString v_name(v_name_);
1074 if(
t_t.count(t_name)==0 )
t_t[t_name] =
new TTree(t_name, t_name);
1075 t_t[t_name]->Branch(v_name, &
i_t[t_name+
separator+v_name],v_name+slashI);
1081 TString slashF(
"/F");
1082 TString t_name(t_name_);
1083 TString v_name(v_name_);
1084 if(
t_t.count(t_name)==0 )
t_t[t_name] =
new TTree(t_name, t_name);
1085 t_t[t_name]->Branch(v_name, &
f_t[t_name+
separator+v_name],v_name+slashF);
1091 TString slashC(
"/C");
1092 TString t_name(t_name_);
1093 TString v_name(v_name_);
1094 if(
t_t.count(t_name)==0 )
t_t[t_name] =
new TTree(t_name, t_name);
1095 t_t[t_name]->Branch(v_name, &
c_t[t_name+
separator+v_name],v_name+slashC);
1101 TString i_name = TString(h_name_)+TString(v_name_);
1110 TString d_name = TString(h_name_)+TString(v_name_);
1124 int _ival =
getInt( name_, ix, iy );
1125 assert( _ival!=-99 );
1126 if( _ival!=0 )
return false;
1128 TH2I* h_ = (TH2I*)
i_h[name_];
1130 h_->Fill( ix+0.5, iy+0.5, ival );
1142 float _val =
getVal( name_, ix, iy );
1143 assert( _val!=-99 );
1144 if( _val!=0 )
return false;
1146 TH2F* h_ = (TH2F*)
f_h[name_];
1149 h_->Fill( ix+0.5, iy+0.5, val );
1158 if(
i_h.count(name)==1 )
1160 TH2I* h_ = (TH2I*)
i_h[name];
1162 int binx = h_->GetXaxis()->FindBin( ix+0.5 );
1163 int biny = h_->GetYaxis()->FindBin( iy+0.5 );
1164 ival = (Int_t) h_->GetCellContent( binx, biny );
1173 if(
f_h.count(name)==1 )
1175 TH2F* h_ = (TH2F*)
f_h[name];
1177 int binx = h_->GetXaxis()->FindBin( ix+0.5 );
1178 int biny = h_->GetYaxis()->FindBin( iy+0.5 );
1179 val = h_->GetCellContent( binx, biny );
1187 TString key_(tname); key_ +=
separator; key_ += vname;
1188 assert(
i_t.count(key_)==1 );
1196 TString key_(tname); key_ +=
separator; key_ += vname;
1199 if(
f_t.count(key_)!=1 )
1203 assert(
f_t.count(key_)==1 );
1211 TString key_( tname );
1212 assert(
t_t.count(key_)==1 );
1226 h->SetFillColor(38);
1228 axis[0] = h->GetXaxis();
1229 axis[1] = h->GetYaxis();
1230 axis[2] = h->GetZaxis();
1231 for(
int ii=0; ii<3; ii++ )
1233 TAxis*
a = axis[ii];
1235 a->SetLabelFont(132);
1236 a->SetLabelOffset(_scale*0.005);
1237 a->SetLabelSize(_scale*0.04);
1238 a->SetTitleFont(132);
1239 a->SetTitleOffset(_scale*1);
1240 a->SetTitleSize(_scale*0.04);
1242 h->SetStats( kTRUE );
1248 std::map< TString, TH2* >::iterator it;
1250 for( it=
i_h.begin(); it!=
i_h.end(); it++ )
1257 for( it=
f_h.begin(); it!=
f_h.end(); it++ )
1264 std::map< TString, TTree* >::iterator it_t;
1265 for( it_t=
t_t.begin(); it_t!=
t_t.end(); it_t++ )
1267 delete it_t->second;
std::map< TString, float > f_t
static void regionAndSector(int ilmr, int &ireg, int &isect, int &idcc, int &iside)
Double_t tpapd_APD[iSize_apdpn]
static const char module_[]
static XYCoord localCoord(int icr)
TBranch * b_tppn_moduleID
TBranch * b_apdpn_apdpn[iSizeArray_apdpn]
static bool getViewIds(int logicId, int &channelView, int &id1, int &id2)
static TString mtq_varUnit[iSize_mtq]
TBranch * b_apdpn_channelID
Double_t pn_PN[iSize_apdpn]
Double_t pn_PNoPNB[iSize_apdpn]
static int crystal_channel(EBLocalCoord ix, EBLocalCoord iy)
TBranch * b_ab_ab[iSize_ab]
Double_t pn_PNoPN[iSize_apdpn]
Int_t getInt(const char *, int ix, int iy)
static TString apdpn_varName[iSize_apdpn]
bool setVal(const char *, int ix, int iy, float val)
static TString apdpn_arrayName[iSizeArray_apdpn]
Double_t mtq_mtq[iSize_mtq]
static std::pair< ME::DCCid, ME::PNid > pn(ME::LMRid ilmr, ME::LMMid ilmmod, ME::PN ipn)
std::map< TString, TTree * > t_t
static Time time_low(TimeStamp t)
static TString channelViewName(int)
static TString apdpn_extraVarUnit[iSizeExtra_apdpn]
bool fill(const char *tname)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MELaserPrim(ME::Header header, ME::Settings settings, const char *inpath, const char *outfile)
static TString mtq_varName[iSize_mtq]
Float_t getVal(const char *, int ix, int iy)
void addBranchC(const char *t_name, const char *v_name)
void print(std::ostream &o)
TBranch * b_apdpn_ShapeCor
bool setInt(const char *, int ix, int iy, int ival)
std::map< TString, TH2 * > i_h
static int logicId(int channelView, int id1, int id2=0)
TBranch * b_tpapd_towerID
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
static TString lmfLaserName(int table, int type, int color=ME::iBlue)
std::map< TString, const char * > c_t
void addBranchI(const char *t_name, const char *v_name)
static TString ab_varName[iSize_ab]
static TString apdpn_varUnit[iSizeArray_apdpn][iSize_apdpn]
TBranch * b_mtq_mtq[iSize_mtq]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Double_t pn_PNoPNA[iSize_apdpn]
static int lmr(int idcc, int iside)
TBranch * b_tpapd_channelID
static TString apdpn_extraVarName[iSizeExtra_apdpn]
static Time time_high(TimeStamp t)
TBranch * b_tpapd_moduleID
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
TBranch * b_apdpn_towerID
void addBranchF(const char *t_name, const char *v_name)
void setHistoStyle(TH1 *)
Double_t apdpn_apdpn[iSizeArray_apdpn][iSize_apdpn]
static TString smName(int ilmr)
void bookHistoI(const char *t_name, const char *v_name)
Double_t tppn_PN[iSize_apdpn]
std::map< TString, int > i_t
std::map< TString, TH2 * > f_h
TBranch * b_apdpn_moduleID
void bookHistoF(const char *t_name, const char *v_name)