|
|
Go to the documentation of this file. 1 #define MELaserPrim_cxx
9 "APD",
"APDoPN",
"APDoPNA",
"APDoPNB",
"APDoAPD",
"APDoAPDA",
"APDoAPDB",
"Time"};
13 {{
" (ADC Counts)",
" (ADC Counts)",
" (ADC Counts)",
"",
" (ADC Counts)",
" (ADC Counts)"},
14 {
"",
"",
"",
"",
"",
""},
15 {
"",
"",
"",
"",
"",
""},
16 {
"",
"",
"",
"",
"",
""},
17 {
"",
"",
"",
"",
"",
""},
18 {
"",
"",
"",
"",
"",
""},
19 {
" (25 ns)",
" (25 ns)",
" (25 ns)",
"",
" (25 ns)",
" (25 ns)"}};
24 "peak",
"sigma",
"fit",
"ampl",
"trise",
"fwhm",
"fw20",
"fw80",
"sliding"};
103 return "EB_crystal_number";
109 return "EE_crystal_number";
122 return 1000000 * channelView + 10000 *
id1 +
id2;
127 int channelView_ = logic_id / 1000000;
128 if (channelView != 0 && channelView_ != channelView)
130 channelView = channelView_;
131 id1 = (logic_id % 1000000) / 10000;
132 id2 = logic_id % 10000;
137 bool verbose_ =
false;
141 std::cout <<
"no input file" << std::endl;
147 if (!cur.EndsWith(
"/"))
151 TString _APDPN_fname = cur;
152 _APDPN_fname +=
"APDPN_LASER.root";
153 TString _AB_fname = cur;
154 _AB_fname +=
"AB.root";
155 TString _MTQ_fname = cur;
156 _MTQ_fname +=
"MATACQ.root";
158 bool apdpn_ok, ab_ok, pn_ok, mtq_ok;
165 test = fopen(_APDPN_fname,
"r");
171 test = fopen(_AB_fname,
"r");
176 test = fopen(_MTQ_fname,
"r");
185 ab_file = TFile::Open(_AB_fname);
190 std::cout << _APDPN_fname <<
" ok=" << apdpn_ok << std::endl;
191 std::cout << _AB_fname <<
" ok=" << ab_ok << std::endl;
192 std::cout << _MTQ_fname <<
" ok=" << mtq_ok << std::endl;
194 if (!apdpn_ok || !pn_ok)
197 TString apdpn_tree_name;
198 TString ab_tree_name;
199 TString pn_tree_name;
200 TString mtq_tree_name;
202 apdpn_tree_name =
"APDCol";
203 ab_tree_name =
"ABCol";
204 pn_tree_name =
"PNCol";
205 mtq_tree_name =
"MatacqCol";
207 apdpn_tree_name +=
_color;
213 TTree* ckeckMtq = (TTree*)
mtq_file->Get(mtq_tree_name);
214 if (ckeckMtq ==
nullptr)
219 std::cout <<
"MELaserPrim::init() -- Fatal Error -- Wrong Laser Color : " <<
_color <<
" ---- Abort "
281 TString _TPAPD_fname = cur;
282 _TPAPD_fname +=
"APDPN_TESTPULSE.root";
288 test = fopen(_TPAPD_fname,
"r");
298 std::cout << _TPAPD_fname <<
" ok=" << tpapd_ok << std::endl;
303 TString tpapd_tree_name;
304 TString tppn_tree_name;
306 tpapd_tree_name =
"TPAPD";
307 tppn_tree_name =
"TPPN";
340 TString i_name, d_name;
374 t_name =
"LMF_RUN_DAT";
382 t_name =
"LMF_RUN_IOV";
470 t_name =
"RUN_LASERRUN_CONFIG_DAT";
513 Long64_t nentries = 0;
517 int id1_(0), id2_(0);
522 for (Long64_t jentry = 0; jentry < nentries; jentry++) {
528 ientry =
ab_tree->LoadTree(jentry);
562 logic_id_ =
logicId(channelView_, id1_, id2_);
566 setInt(
"LOGIC_ID", ix, iy, logic_id_);
596 setVal(
"ALPHA", ix, iy, 0.);
597 setVal(
"BETA", ix, iy, 0.);
611 nentries =
pn_tree->GetEntriesFast();
612 assert(nentries % 2 == 0);
619 while (jentry < nentries) {
620 for (
int jj = 0;
jj < 2;
jj++) {
624 int zentry = jentry +
jj;
625 assert(zentry < nentries);
627 ientry =
pn_tree->LoadTree(zentry);
644 id2_ = memPn_.second;
670 id2_ = (
jj + 1) * 100 + memPn_.second;
678 logic_id_ =
logicId(channelView_, id1_, id2_);
708 nentries =
mtq_tree->GetEntriesFast();
710 for (Long64_t jentry = 0; jentry < nentries; jentry++) {
711 ientry =
mtq_tree->LoadTree(jentry);
902 t_name =
"LMF_RUN_IOV";
912 c_t[t_name +
separator +
"SUB_RUN_TYPE"] =
"LASER TEST CRUZET";
923 std::map<TString, TH2*>::iterator it;
925 for (it =
i_h.begin(); it !=
i_h.end(); ++it) {
930 for (it =
f_h.begin(); it !=
f_h.end(); ++it) {
935 std::map<TString, TTree*>::iterator it_t;
936 for (it_t =
t_t.begin(); it_t !=
t_t.end(); ++it_t) {
937 it_t->second->Write();
982 <<
_run <<
"/" <<
_ts << std::endl;
998 TString
str(
"LMF_ERROR");
1046 str =
"LMF_TEST_PULSE";
1069 TString slashI(
"/i");
1070 TString t_name(t_name_);
1071 TString v_name(v_name_);
1072 if (
t_t.count(t_name) == 0)
1073 t_t[t_name] =
new TTree(t_name, t_name);
1074 t_t[t_name]->Branch(v_name, &
i_t[t_name +
separator + v_name], v_name + slashI);
1078 TString slashF(
"/F");
1079 TString t_name(t_name_);
1080 TString v_name(v_name_);
1081 if (
t_t.count(t_name) == 0)
1082 t_t[t_name] =
new TTree(t_name, t_name);
1083 t_t[t_name]->Branch(v_name, &
f_t[t_name +
separator + v_name], v_name + slashF);
1087 TString slashC(
"/C");
1088 TString t_name(t_name_);
1089 TString v_name(v_name_);
1090 if (
t_t.count(t_name) == 0)
1091 t_t[t_name] =
new TTree(t_name, t_name);
1092 t_t[t_name]->Branch(v_name, &
c_t[t_name +
separator + v_name], v_name + slashC);
1096 TString i_name = TString(h_name_) + TString(v_name_);
1103 TString d_name = TString(h_name_) + TString(v_name_);
1116 int _ival =
getInt(name_, ix, iy);
1121 TH2I* h_ = (TH2I*)
i_h[name_];
1123 h_->Fill(ix + 0.5, iy + 0.5, ival);
1135 float _val =
getVal(name_, ix, iy);
1140 TH2F* h_ = (TH2F*)
f_h[name_];
1143 h_->Fill(ix + 0.5, iy + 0.5,
val);
1153 int binx = h_->GetXaxis()->FindBin(ix + 0.5);
1154 int biny = h_->GetYaxis()->FindBin(iy + 0.5);
1155 ival = (Int_t)h_->GetCellContent(binx, biny);
1165 int binx = h_->GetXaxis()->FindBin(ix + 0.5);
1166 int biny = h_->GetYaxis()->FindBin(iy + 0.5);
1167 val = h_->GetCellContent(binx, biny);
1173 TString key_(
tname);
1182 TString key_(
tname);
1187 if (
f_t.count(key_) != 1) {
1196 TString key_(
tname);
1210 h->SetFillColor(38);
1212 axis[0] =
h->GetXaxis();
1213 axis[1] =
h->GetYaxis();
1214 axis[2] =
h->GetZaxis();
1215 for (
int ii = 0;
ii < 3;
ii++) {
1216 TAxis*
a = axis[
ii];
1219 a->SetLabelFont(132);
1220 a->SetLabelOffset(_scale * 0.005);
1221 a->SetLabelSize(_scale * 0.04);
1222 a->SetTitleFont(132);
1223 a->SetTitleOffset(_scale * 1);
1224 a->SetTitleSize(_scale * 0.04);
1230 std::map<TString, TH2*>::iterator it;
1232 for (it =
i_h.begin(); it !=
i_h.end(); ++it) {
1234 it->second =
nullptr;
1238 for (it =
f_h.begin(); it !=
f_h.end(); ++it) {
1240 it->second =
nullptr;
1244 std::map<TString, TTree*>::iterator it_t;
1245 for (it_t =
t_t.begin(); it_t !=
t_t.end(); ++it_t) {
1246 delete it_t->second;
1247 it->second =
nullptr;
TBranch * b_tpapd_channelID
void addBranchF(const char *t_name, const char *v_name)
static const char module_[]
Int_t getInt(const char *, int ix, int iy)
void setHistoStyle(TH1 *)
void bookHistoI(const char *t_name, const char *v_name)
Double_t apdpn_apdpn[iSizeArray_apdpn][iSize_apdpn]
std::map< TString, TTree * > t_t
TBranch * b_apdpn_moduleID
static Time time_low(TimeStamp t)
static TString channelViewName(int)
MELaserPrim(ME::Header header, ME::Settings settings, const char *inpath, const char *outfile)
static bool getViewIds(int logicId, int &channelView, int &id1, int &id2)
void addBranchC(const char *t_name, const char *v_name)
Double_t pn_PNoPNB[iSize_apdpn]
TBranch * b_apdpn_apdpn[iSizeArray_apdpn]
static TString lmfLaserName(int table, int type, int color=ME::iBlue)
bool setInt(const char *, int ix, int iy, int ival)
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
static TString apdpn_arrayName[iSizeArray_apdpn]
Double_t mtq_mtq[iSize_mtq]
TBranch * b_mtq_mtq[iSize_mtq]
static int logicId(int channelView, int id1, int id2=0)
TBranch * b_ab_ab[iSize_ab]
std::map< TString, float > f_t
Double_t pn_PNoPNA[iSize_apdpn]
std::map< TString, const char * > c_t
static TString apdpn_varName[iSize_apdpn]
bool setVal(const char *, int ix, int iy, float val)
std::map< TString, int > i_t
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
std::map< TString, TH2 * > i_h
static TString apdpn_extraVarName[iSizeExtra_apdpn]
TBranch * b_tpapd_moduleID
bool fill(const char *tname)
static std::pair< ME::DCCid, ME::PNid > pn(ME::LMRid ilmr, ME::LMMid ilmmod, ME::PN ipn)
TBranch * b_apdpn_towerID
static TString mtq_varName[iSize_mtq]
Float_t getVal(const char *, int ix, int iy)
void print(std::ostream &o)
static TString smName(int ilmr)
Double_t tppn_PN[iSize_apdpn]
std::string tname(const std::string &tableName, const std::string &schemaVersion)
static TString apdpn_extraVarUnit[iSizeExtra_apdpn]
TBranch * b_apdpn_ShapeCor
static TString ab_varName[iSize_ab]
static XYCoord localCoord(int icr)
void bookHistoF(const char *t_name, const char *v_name)
TBranch * b_tpapd_towerID
Double_t tpapd_APD[iSize_apdpn]
TBranch * b_tppn_moduleID
Double_t pn_PN[iSize_apdpn]
void addBranchI(const char *t_name, const char *v_name)
static Time time_high(TimeStamp t)
static TString apdpn_varUnit[iSizeArray_apdpn][iSize_apdpn]
std::map< TString, TH2 * > f_h
static TString mtq_varUnit[iSize_mtq]
static int crystal_channel(EBLocalCoord ix, EBLocalCoord iy)
Double_t pn_PNoPN[iSize_apdpn]
static void regionAndSector(int ilmr, int &ireg, int &isect, int &idcc, int &iside)
TBranch * b_apdpn_channelID
static int lmr(int idcc, int iside)