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";
511 Long64_t nentries = 0;
515 int id1_(0), id2_(0);
522 for( Long64_t jentry=0; jentry<nentries; jentry++ )
529 ientry =
ab_tree->LoadTree( jentry );
531 nb =
ab_tree->GetEntry( jentry );
565 logic_id_ =
logicId( channelView_, id1_, id2_ );
569 setInt(
"LOGIC_ID", ix, iy, logic_id_ );
570 setInt(
"FLAG", ix, iy, flag );
599 setVal(
"ALPHA", ix, iy, 0. );
600 setVal(
"BETA", ix, iy, 0. );
616 nentries =
pn_tree->GetEntriesFast();
617 assert( nentries%2==0 );
623 while( jentry<nentries )
625 for(
int jj=0; jj<2; jj++ )
630 int zentry = jentry+jj;
631 assert( zentry<nentries );
633 ientry =
pn_tree->LoadTree( zentry );
635 nb =
pn_tree->GetEntry( zentry );
649 id2_ = memPn_.second;
677 id2_ = (jj+1)*100+memPn_.second;
688 logic_id_ =
logicId( channelView_, id1_, id2_ );
720 nentries =
mtq_tree->GetEntriesFast();
721 assert( nentries==2 );
722 for( Long64_t jentry=0; jentry<nentries; jentry++ )
724 ientry =
mtq_tree->LoadTree( jentry );
917 t_name =
"LMF_RUN_IOV";
927 c_t[t_name+
separator+
"SUB_RUN_TYPE"] =
"LASER TEST CRUZET";
940 std::map< TString, TH2* >::iterator it;
942 for( it=
i_h.begin(); it!=
i_h.end(); it++ )
948 for( it=
f_h.begin(); it!=
f_h.end(); it++ )
954 std::map< TString, TTree* >::iterator it_t;
955 for( it_t=
t_t.begin(); it_t!=
t_t.end(); it_t++ )
957 it_t->second->Write();
1008 o <<
"DCC/SM/side/type/color/run/ts " <<
_dcc <<
"/" <<
_sm <<
"/" <<
_side <<
"/"
1027 TString str(
"LMF_ERROR");
1029 if( color<0 || color>=
ME::iSizeC )
return str;
1036 case ME::iBlue: colstr =
"_BLUE";
break;
1038 case ME::iRed: colstr =
"_RED";
break;
1039 case ME::iIRed: colstr =
"_IRED";
break;
1055 str =
"LMF_TEST_PULSE";
1072 TString slashI(
"/i");
1073 TString t_name(t_name_);
1074 TString v_name(v_name_);
1075 if(
t_t.count(t_name)==0 )
t_t[t_name] =
new TTree(t_name, t_name);
1076 t_t[t_name]->Branch(v_name, &
i_t[t_name+
separator+v_name],v_name+slashI);
1082 TString slashF(
"/F");
1083 TString t_name(t_name_);
1084 TString v_name(v_name_);
1085 if(
t_t.count(t_name)==0 )
t_t[t_name] =
new TTree(t_name, t_name);
1086 t_t[t_name]->Branch(v_name, &
f_t[t_name+
separator+v_name],v_name+slashF);
1092 TString slashC(
"/C");
1093 TString t_name(t_name_);
1094 TString v_name(v_name_);
1095 if(
t_t.count(t_name)==0 )
t_t[t_name] =
new TTree(t_name, t_name);
1096 t_t[t_name]->Branch(v_name, &
c_t[t_name+
separator+v_name],v_name+slashC);
1102 TString i_name = TString(h_name_)+TString(v_name_);
1111 TString d_name = TString(h_name_)+TString(v_name_);
1125 int _ival =
getInt( name_, ix, iy );
1126 assert( _ival!=-99 );
1127 if( _ival!=0 )
return false;
1129 TH2I* h_ = (TH2I*)
i_h[name_];
1131 h_->Fill( ix+0.5, iy+0.5, ival );
1143 float _val =
getVal( name_, ix, iy );
1144 assert( _val!=-99 );
1145 if( _val!=0 )
return false;
1147 TH2F* h_ = (TH2F*)
f_h[name_];
1150 h_->Fill( ix+0.5, iy+0.5, val );
1159 if(
i_h.count(name)==1 )
1161 TH2I* h_ = (TH2I*)
i_h[name];
1163 int binx = h_->GetXaxis()->FindBin( ix+0.5 );
1164 int biny = h_->GetYaxis()->FindBin( iy+0.5 );
1165 ival = (Int_t) h_->GetCellContent( binx, biny );
1174 if(
f_h.count(name)==1 )
1176 TH2F* h_ = (TH2F*)
f_h[name];
1178 int binx = h_->GetXaxis()->FindBin( ix+0.5 );
1179 int biny = h_->GetYaxis()->FindBin( iy+0.5 );
1180 val = h_->GetCellContent( binx, biny );
1188 TString key_(tname); key_ +=
separator; key_ += vname;
1189 assert(
i_t.count(key_)==1 );
1197 TString key_(tname); key_ +=
separator; key_ += vname;
1200 if(
f_t.count(key_)!=1 )
1204 assert(
f_t.count(key_)==1 );
1212 TString key_( tname );
1213 assert(
t_t.count(key_)==1 );
1227 h->SetFillColor(38);
1229 axis[0] = h->GetXaxis();
1230 axis[1] = h->GetYaxis();
1231 axis[2] = h->GetZaxis();
1232 for(
int ii=0; ii<3; ii++ )
1234 TAxis*
a = axis[ii];
1236 a->SetLabelFont(132);
1237 a->SetLabelOffset(_scale*0.005);
1238 a->SetLabelSize(_scale*0.04);
1239 a->SetTitleFont(132);
1240 a->SetTitleOffset(_scale*1);
1241 a->SetTitleSize(_scale*0.04);
1243 h->SetStats( kTRUE );
1249 std::map< TString, TH2* >::iterator it;
1251 for( it=
i_h.begin(); it!=
i_h.end(); it++ )
1258 for( it=
f_h.begin(); it!=
f_h.end(); it++ )
1265 std::map< TString, TTree* >::iterator it_t;
1266 for( it_t=
t_t.begin(); it_t!=
t_t.end(); it_t++ )
1268 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]
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)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)