48 std::vector< std::pair< std::string, float > > NoisyChambers;
49 std::vector< std::pair< std::string, float > > DeadChambers;
51 std::vector< std::pair< std::string, float > > NoisyChannels;
53 std::vector< std::pair< std::string, float > > LowEfficiencyChambers;
55 std::vector< std::pair< std::string, float > > ReadoutTimingChambers;
56 std::vector< std::pair< std::string, float > > TriggerTimingChambers;
83 std::vector< std::pair< std::string, float > >& noisychambers,
84 std::vector< std::pair< std::string, float > >& deadchambers) {
92 if (mf.GetSize() < 1000.) {
106 TIter next_run(mf.GetListOfKeys());
108 static const std::string sac[2] = {
111 static const std::string side[2] = {
114 static const std::string sws[2] = {
117 static const std::string
type[17] = {
118 "_F_T1",
"_E4_T3",
"_E3_T6",
"_E2_T7",
"_E1_T8",
119 "_F_T2",
"_E5_T4",
"_E4_T6",
"_E3_T7",
"_E2_T8",
"_E1_T9",
120 "_F_T2",
"_E5_T5",
"_E4_T6",
"_E3_T7",
"_E2_T8",
"_E1_T9"
122 while ((key_run =
dynamic_cast<TKey*
> (next_run())) != 0) {
123 if (!key_run->IsFolder())
continue;
124 std::string run_dir = key_run->GetName();
125 if (run_dir.find(
"run") == std::string::npos)
continue;
127 std::string run_dir2 = run_dir;
131 std::string tgc_dir = run_dir +
"/Muon/MuonRawDataMonitoring/TGC/";
133 std::string tgc_global_dir = tgc_dir +
"Global/";
135 std::string tgc_sub_dir[2] = {
136 tgc_dir +
"TGCEA/", tgc_dir +
"TGCEC/"
141 std::stringstream
ss;
144 std::string schambertypesummary[2][4][6];
145 TH1F* chambertypesummary[2][4][6];
147 std::string schambersummary[2][2];
148 TH1F* chambersummary[2][2];
153 for (
int ws = 0; ws < 2; ws++) {
155 for (
int station = 0; station < 3; station++) {
157 if (
eta == 5 && station == 0)
continue;
158 if (
eta < 2 && station == 3)
continue;
161 ss <<
"Station" << station + 1 <<
type[ntype];
162 schambertypesummary[ws][station][
eta] = tgc_dir +
"Global/Summary/"
163 +
"Summary_Of_Log10_" + sws[ws] +
"Occupancy_Per_Chamber_Type_" +
165 if (
tgc_debug) std::cout << schambertypesummary[ws][station][
eta] << std::endl;
167 chambertypesummary[ws][station][
eta] = 0;
168 mf.get(schambertypesummary[ws][station][
eta].c_str(), chambertypesummary[ws][station][
eta]);
169 if (!chambertypesummary[ws][station][
eta]) {
180 for (
int ac = 0; ac < 2; ac++) {
181 schambersummary[ac][ws] = tgc_sub_dir[ac] +
"Summary/"
182 +
"Summary_Of_Log10_" + sws[ws] +
"Occupancy_Per_GasGap" + sac[ac];
183 if (
tgc_debug) std::cout << schambersummary[ac][ws] << std::endl;
185 chambersummary[ac][ws] = 0;
186 mf.get(schambersummary[ac][ws].c_str(), chambersummary[ac][ws]);
187 if (!chambersummary[ac][ws]) {
196 std::string sentries = tgc_global_dir +
"Event_Counter";
199 mf.get(sentries.c_str(), hentries);
205 double nentries = hentries->GetEntries();
208 for (
int ac = 0; ac < 2; ac++) {
209 for (
int ws = 0; ws < 2; ws++) {
213 std::string sprof = tgc_sub_dir[ac] +
"Profile/" + sws[ws] +
"Profile_Map" + sac[ac];
214 std::string soccu = tgc_sub_dir[ac] +
"Occupancy/" + sws[ws] +
"Occupancy_Map" + sac[ac];
217 mf.get(sprof.c_str(), hprof);
224 mf.get(soccu.c_str(), hoccu);
231 int nbinx = hprof->GetXaxis()->GetNbins();
232 int nbiny = hprof->GetYaxis()->GetNbins();
234 for (
int binx = 1; binx <= nbinx; binx++) {
235 for (
int biny = 1; biny <= nbiny; biny++) {
236 if (ws == 1 && (binx == 2 || binx == 9 || binx == 16 || binx == 23 || binx == 34))
continue;
238 if ((binx >= 33 && binx <= 43) &&
239 biny % 2 == 0)
continue;
240 if ((binx == 40 || binx == 41) &&
241 (biny == 19 || biny == 35 || biny == 43))
continue;
243 double num = hprof->GetBinContent(binx, biny);
247 if (num > 0 && nentries > 0) {
248 occu = (double) num / den;
249 eoccu = sqrt(occu * (1. - occu) / den);
251 hoccu->SetBinContent(binx, biny, occu);
252 hoccu->SetBinError(binx, biny, eoccu);
255 if (occu < min && occu > 1e-8)
min = occu;
256 if (occu >
max)
max = occu;
262 if (chambersummary[ac][ws]) chambersummary[ac][ws]->Fill(log10(occu));
268 eta = (binx - 1) % 5;
269 }
else if (binx < 28) {
271 eta = (binx - 16) % 6;
272 }
else if (binx < 40) {
274 eta = (binx - 28) % 6;
277 eta = (binx - 40) % 2;
279 if (station < 3 && eta >= 0)
280 if (chambertypesummary[ws][station][
eta]) chambertypesummary[ws][station][
eta]->Fill(log10(occu));
285 std::string schamber = hprof->GetXaxis()->GetBinLabel(binx);
286 int sector = (biny - 1) / 4 + 1;
287 int phi = (biny - 1) % 4;
289 if (sector < 10)
ss <<
"0";
290 ss << sector <<
"phi" <<
phi;
291 if (
tgc_debug) std::cout <<
"TGC noisy channel : " <<
ss.str() <<
" " << occu << std::endl;
293 std::pair<std::string, float> p(
ss.str(), occu);
294 noisychambers.push_back(std::move(p));
297 std::string schamber = hprof->GetXaxis()->GetBinLabel(binx);
298 int sector = (biny - 1) / 4 + 1;
299 int phi = (biny - 1) % 4;
301 if (sector < 10)
ss <<
"0";
302 ss << sector <<
"phi" <<
phi;
303 if (
tgc_debug) std::cout <<
"TGC low occupancy chamber : " <<
ss.str() <<
" " << occu << std::endl;
305 std::pair<std::string, float> p(
ss.str(), occu);
306 deadchambers.push_back(std::move(p));
311 hoccu->SetMinimum(
min * 0.95);
312 hoccu->SetMaximum(
max * 1.05);
314 std::string occu_dir = tgc_sub_dir[ac] +
"Occupancy/";
315 TDirectory* dir = mf.GetDirectory(occu_dir.c_str());
319 hoccu->Write(
"", TObject::kOverwrite);
328 std::string sum_dir = tgc_dir +
"Global/Summary";
329 TDirectory* dir = mf.GetDirectory(sum_dir.c_str());
333 for (
int ws = 0; ws < 2; ws++) {
334 for (
int station = 0; station < 3; station++) {
336 if (
eta == 5 && station == 0)
continue;
337 if (
eta < 2 && station == 3)
continue;
338 if (chambertypesummary[ws][station][
eta]) chambertypesummary[ws][station][
eta]->Write(
"",
339 TObject::kOverwrite);
349 for (
int ac = 0; ac < 2; ac++) {
351 sum_dir = tgc_sub_dir[ac] +
"Summary/";
352 dir = mf.GetDirectory(sum_dir.c_str());
355 for (
int ws = 0; ws < 2; ws++) {
356 if (chambersummary[ac][ws]) chambersummary[ac][ws]->Write(
"", TObject::kOverwrite);
370 std::vector< std::pair< std::string,
371 float > >& loweffchambers) {
379 if (mf.GetSize() < 1000.) {
393 TIter next_run(mf.GetListOfKeys());
395 static const std::string
type[17] = {
396 "_F_T1",
"_E4_T3",
"_E3_T6",
"_E2_T7",
"_E1_T8",
397 "_F_T2",
"_E5_T4",
"_E4_T6",
"_E3_T7",
"_E2_T8",
"_E1_T9",
398 "_F_T2",
"_E5_T5",
"_E4_T6",
"_E3_T7",
"_E2_T8",
"_E1_T9"
400 while ((key_run =
dynamic_cast<TKey*
> (next_run())) != 0) {
401 if (!key_run->IsFolder())
continue;
402 std::string run_dir = key_run->GetName();
403 if (run_dir.find(
"run") == std::string::npos)
continue;
405 std::string run_dir2 = run_dir;
409 std::string tgc_dir = run_dir +
"/Muon/MuonRawDataMonitoring/TGC/";
411 std::string tgc_sub_dir[2] = {
412 tgc_dir +
"TGCEA/", tgc_dir +
"TGCEC/"
415 static const std::string sac[2] = {
418 static const std::string sws[2] = {
422 std::stringstream
ss;
425 std::string schambertypesummary[2][3][6];
426 TH1F* chambertypesummary[2][3][6];
428 std::string schambersummary[2][2];
429 TH1F* chambersummary[2][2];
434 for (
int ws = 0; ws < 2; ws++) {
436 for (
int station = 0; station < 3; station++) {
438 if (
eta == 5 && station == 0)
continue;
439 if (
eta < 2 && station == 3)
continue;
442 ss <<
"Station" << station + 1 <<
type[ntype];
443 schambertypesummary[ws][station][
eta] = tgc_dir +
"Global/Summary/"
444 +
"Summary_Of_" + sws[ws] +
"Efficiency_Per_Chamber_Type_" +
446 if (
tgc_debug) std::cout << schambertypesummary[ws][station][
eta] << std::endl;
448 chambertypesummary[ws][station][
eta] = 0;
449 mf.get(schambertypesummary[ws][station][
eta].c_str(), chambertypesummary[ws][station][
eta]);
450 if (!chambertypesummary[ws][station][
eta]) {
461 for (
int ac = 0; ac < 2; ac++) {
462 schambersummary[ac][ws] = tgc_sub_dir[ac] +
"Summary/"
463 +
"Summary_Of_" + sws[ws] +
"Efficiency_Per_GasGap" + sac[ac];
464 if (
tgc_debug) std::cout << schambersummary[ac][ws] << std::endl;
466 chambersummary[ac][ws] = 0;
467 mf.get(schambersummary[ac][ws].c_str(), chambersummary[ac][ws]);
468 if (!chambersummary[ac][ws]) {
476 for (
int ac = 0; ac < 2; ac++) {
477 for (
int ws = 0; ws < 2; ws++) {
478 std::string seff = tgc_sub_dir[ac] +
"Efficiency/" + sws[ws] +
"Efficiency_Map" + sac[ac];
479 std::string sden = tgc_sub_dir[ac] +
"Efficiency/NumDenom/" + sws[ws] +
"Efficiency_Map" + sac[ac] +
483 mf.get(seff.c_str(), heff);
490 mf.get(sden.c_str(), hden);
495 int nbinx = heff->GetXaxis()->GetNbins();
496 int nbiny = heff->GetYaxis()->GetNbins();
498 for (
int binx = 1; binx <= nbinx; binx++) {
499 for (
int biny = 1; biny <= nbiny; biny++) {
505 if ((binx >= 33 && binx <= 43) &&
506 biny % 2 == 0)
continue;
507 if ((binx == 40 || binx == 41) &&
508 (biny == 19 || biny == 35 || biny == 43))
continue;
511 double eff = heff->GetBinContent(binx, biny);
514 denom = hden->GetBinContent(binx, biny);
517 if (chambersummary[ac][ws])
518 if (denom > 0) chambersummary[ac][ws]->Fill(eff);
524 eta = (binx - 1) % 5;
525 }
else if (binx < 28) {
527 eta = (binx - 16) % 6;
528 }
else if (binx < 40) {
530 eta = (binx - 28) % 6;
533 eta = (binx - 40) % 2;
535 if (station < 3 && eta >= 0)
536 if (chambertypesummary[ws][station][
eta])
537 if (denom > 0) chambertypesummary[ws][station][
eta]->Fill(eff);
542 std::string schamber = heff->GetXaxis()->GetBinLabel(binx);
543 int sector = (biny - 1) / 4 + 1;
544 int phi = (biny - 1) % 4;
546 if (sector < 10)
ss <<
"0";
547 ss << sector <<
"phi" <<
phi;
549 if (
tgc_debug) std::cout <<
"TGC low efficiency chamber : " <<
ss.str() <<
" " << eff << std::endl;
551 std::pair<std::string, float> p(
ss.str(), eff);
552 loweffchambers.push_back(std::move(p));
557 std::string eff_dir = tgc_sub_dir[ac] +
"Efficiency/";
558 TDirectory* dir = mf.GetDirectory(eff_dir.c_str());
562 heff->Write(
"", TObject::kOverwrite);
571 std::string sum_dir = tgc_dir +
"Global/Summary";
572 TDirectory* dir = mf.GetDirectory(sum_dir.c_str());
577 for (
int ws = 0; ws < 2; ws++) {
578 for (
int station = 0; station < 3; station++) {
580 if (
eta == 5 && station == 0)
continue;
581 if (
eta < 2 && station == 3)
continue;
582 if (chambertypesummary[ws][station][
eta]) chambertypesummary[ws][station][
eta]->Write(
"",
583 TObject::kOverwrite);
593 for (
int ac = 0; ac < 2; ac++) {
595 sum_dir = tgc_sub_dir[ac] +
"Summary/";
596 dir = mf.GetDirectory(sum_dir.c_str());
599 for (
int ws = 0; ws < 2; ws++) {
600 if (chambersummary[ac][ws]) chambersummary[ac][ws]->Write(
"", TObject::kOverwrite);
613 std::vector< std::pair< std::string, float > >& badrotimingchambers,
614 std::vector< std::pair< std::string, float > >& badtrgtimingchambers) {
622 if (mf.GetSize() < 1000.) {
636 TIter next_run(mf.GetListOfKeys());
638 static const std::string
type[6] = {
639 "_F_T2",
"_E5_T5",
"_E4_T6",
"_E3_T7",
"_E2_T8",
"_E1_T9"
641 static const std::string sac[2] = {
645 static const std::string ssllpt[2] = {
646 "SL_Timing",
"Low_Pt_Timing"
648 while ((key_run =
dynamic_cast<TKey*
> (next_run())) != 0) {
649 if (!key_run->IsFolder())
continue;
650 std::string run_dir = key_run->GetName();
651 if (run_dir.find(
"run") == std::string::npos)
continue;
653 std::string run_dir2 = run_dir;
657 std::string tgc_dir = run_dir +
"/Muon/MuonRawDataMonitoring/TGCLV1/";
659 std::string tgc_sub_dir[2] = {
660 tgc_dir +
"TGCEA/", tgc_dir +
"TGCEC/"
665 std::stringstream
ss;
667 std::string schambertypesummary[6];
668 TH1F* chambertypesummary[6];
672 for (
int sllpt = 0; sllpt < 2; sllpt++) {
677 schambertypesummary[
eta] = tgc_dir +
"Global/Summary/"
678 +
"Summary_Of_" + ssllpt[sllpt] +
"_Per_Chamber_Type" +
ss.str();
680 chambertypesummary[
eta] = 0;
681 mf.get(schambertypesummary[
eta].c_str(), chambertypesummary[
eta]);
682 if (!chambertypesummary[
eta]) {
689 for (
int ac = 0; ac < 2; ac++) {
691 std::string ssum = tgc_sub_dir[ac] +
"Summary/Summary_Of_" + ssllpt[sllpt] + sac[ac];
692 std::string stmap = tgc_sub_dir[ac] + ssllpt[sllpt] +
"_Map" + sac[ac];
693 std::string stfrac = tgc_sub_dir[ac] + ssllpt[sllpt] +
"_Fraction_Map" + sac[ac];
696 mf.get(ssum.c_str(),
hsum);
703 mf.get(stmap.c_str(), htmap);
710 mf.get(stfrac.c_str(), htfrac);
719 int nbinx = htmap->GetXaxis()->GetNbins();
720 int nbiny = htmap->GetYaxis()->GetNbins();
722 if (nbinx != 18 || nbiny != 48)
continue;
725 for (
int phi48 = 0; phi48 < 48; phi48++) {
726 if (
eta == 5 && phi48 % 2 == 1)
continue;
728 float p = htmap->GetBinContent(
eta + 1, phi48 + 1);
729 float c = htmap->GetBinContent(
eta + 7, phi48 + 1);
730 float n = htmap->GetBinContent(
eta + 13, phi48 + 1);
731 float tot = p + n + c;
743 efp = sqrt(fp * (1. - fp) / tot);
745 efc = sqrt(fc * (1. - fc) / tot);
747 efn = sqrt(fn * (1. - fn) / tot);
750 htfrac->SetBinContent(
eta + 1, phi48 + 1, fp);
751 htfrac->SetBinContent(
eta + 7, phi48 + 1, fc);
752 htfrac->SetBinContent(
eta + 13, phi48 + 1, fn);
753 htfrac->SetBinError(
eta + 1, phi48 + 1, efp);
754 htfrac->SetBinError(
eta + 7, phi48 + 1, efc);
755 htfrac->SetBinError(
eta + 13, phi48 + 1, efn);
757 if (chambertypesummary[
eta]) chambertypesummary[
eta]->Fill(fc);
764 ss << sac[ac] <<
"phi" << phi48 + 1 <<
"Eta" <<
eta;
766 if (
tgc_debug) std::cout <<
"TGC " << ssllpt[sllpt] <<
" low current BCID fraction chamber : " <<
767 ss.str() <<
" " << fc << std::endl;
769 std::pair<std::string, float> p(
ss.str(), fc);
771 badtrgtimingchambers.push_back(std::move(p));
773 badrotimingchambers.push_back(std::move(p));
780 std::string timing_dir = tgc_sub_dir[ac];
781 TDirectory* dir = mf.GetDirectory(timing_dir.c_str());
785 htfrac->Write(
"", TObject::kOverwrite);
791 std::string sum_dir = tgc_sub_dir[ac] +
"Summary/";
792 dir = mf.GetDirectory(sum_dir.c_str());
796 hsum->Write(
"", TObject::kOverwrite);
804 std::string sum_dir = tgc_dir +
"Global/Summary/";
805 TDirectory* dir = mf.GetDirectory(sum_dir.c_str());
810 if (chambertypesummary[
eta]) chambertypesummary[
eta]->Write(
"", TObject::kOverwrite);
823 std::vector< std::pair< std::string,
824 float > >& noisychannels) {
832 if (mf.GetSize() < 1000.) {
846 TIter next_run(mf.GetListOfKeys());
848 static const std::string sac[2] = {
851 static const std::string sws[2] = {
854 static const std::string slay[7] = {
855 "1",
"2",
"3",
"4",
"5",
"6",
"7"
857 while ((key_run =
dynamic_cast<TKey*
> (next_run())) != 0) {
858 if (!key_run->IsFolder())
continue;
859 std::string run_dir = key_run->GetName();
860 if (run_dir.find(
"run") == std::string::npos)
continue;
862 std::string run_dir2 = run_dir;
866 std::string tgc_dir = run_dir +
"/Muon/MuonRawDataMonitoring/TGC/";
868 std::string tgc_global_dir = tgc_dir +
"Global/";
869 std::string tgc_sub_dir[2] = {
870 tgc_dir +
"TGCEA/", tgc_dir +
"TGCEC/"
874 std::stringstream
ss;
877 std::string sentries = tgc_global_dir +
"Event_Counter";
880 mf.get(sentries.c_str(), hentries);
886 double nentries = hentries->GetEntries();
888 for (
int ac = 0; ac < 2; ac++) {
889 for (
int ws = 0; ws < 2; ws++) {
890 for (
int lay = 0; lay < 7; lay++) {
891 if (ws == 1 && lay == 1)
continue;
892 for (
int subsect = 1; subsect <= 48; subsect++) {
898 if (sector < 10)
ss <<
"0";
899 ss << sector <<
"_Layer" << slay[lay] <<
"_Phi" << phi4;
900 std::string sprof = tgc_sub_dir[ac] +
"Profile/" + sws[ws] +
"Hit_Profile" + sac[ac] +
ss.str();
903 mf.get(sprof.c_str(), hprof);
909 int nbin = hprof->GetXaxis()->GetNbins();
912 double num = hprof->GetBinContent(
bin);
914 if (nentries > 0) occu = (float) num / nentries;
917 ss << hprof->GetName() <<
" " <<
bin;
918 if (
tgc_debug) std::cout <<
"TGC noisy channel : " <<
ss.str() <<
" " << occu << std::endl;
919 noisychannels.emplace_back(
ss.str(), occu);