9 #include <dqm_core/AlgorithmConfig.h>
19 #include <string_view>
21 #include <initializer_list>
31 #include <dqm_core/AlgorithmManager.h>
38 listContains(
const std::initializer_list<int>&
a,
int i) {
39 return std::any_of(
a.begin(),
a.end(), [
i](
int x) {
62 const TObject&
object,
63 const dqm_core::AlgorithmConfig&
config) {
64 const TH2*
histo =
dynamic_cast<const TH2*
> (&
object);
67 throw dqm_core::BadConfig(ERS_HERE,
name,
"Input object is not a TH2");
70 std::vector<std::string> dead_rpc_panel {};
71 std::vector<int> coun_rpc_panel {};
75 if (
histo->GetEntries() < minstat) {
77 result->tags_[
"InsufficientEntries"] =
histo->GetEntries();
85 double bin_threshold {};
91 catch (dqm_core::Exception& ex) {
92 throw dqm_core::BadConfig(ERS_HERE,
name, ex.what(), ex);
95 dead_rpc_panel.clear( );
96 coun_rpc_panel.clear( );
97 using namespace std::string_view_literals;
98 for (
int ibinx = 1; ibinx !=
histo->GetNbinsX() + 1; ++ibinx) {
99 for (
int ibiny = 1; ibiny !=
histo->GetNbinsY() + 1; ++ibiny) {
104 if (
Title.find(
"HighPt0_BA") != std::string::npos ||
Title.find(
"HighPt1_BA") != std::string::npos) {
105 if (listContains({1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
106 constexpr
int maxPossible {12};
107 if (ibinx > maxPossible)
continue;
109 constexpr std::array<std::string_view, maxPossible> chamberNames {
124 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
125 constexpr
int maxPossible {12};
126 if (ibinx > maxPossible)
continue;
127 constexpr std::array<std::string_view, maxPossible> chamberNames {
142 }
else if (ibiny == 25 || ibiny == 26) {
143 constexpr
int maxPossible {13};
144 constexpr std::array<std::string_view, maxPossible> chamberNames {
160 if (ibinx <= maxPossible)
chamber_name = chamberNames[ibinx - 1];
163 constexpr
int maxPossible {12};
164 if (ibinx > maxPossible)
continue;
165 constexpr std::array<std::string_view, maxPossible> chamberNames {
181 }
else if (
Title.find(
"LowPt0_BA") != std::string::npos ||
Title.find(
"LowPt1_BA") != std::string::npos) {
182 if (listContains({1, 2, 5, 6, 9, 10}, ibiny)) {
183 constexpr
int maxPossible {10};
184 if (ibinx > maxPossible)
continue;
185 constexpr std::array<std::string_view, maxPossible> chamberNames {
198 }
else if (listContains({13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
199 constexpr
int maxPossible {9};
200 if (ibinx > maxPossible)
continue;
201 constexpr std::array<std::string_view, maxPossible> chamberNames {
213 }
else if (ibiny == 25 || ibiny == 26) {
214 constexpr
int maxPossible {10};
215 if (ibinx > maxPossible)
continue;
216 constexpr std::array<std::string_view, maxPossible> chamberNames {
229 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
230 constexpr
int maxPossible {12};
231 if (ibinx > maxPossible)
continue;
232 constexpr std::array<std::string_view, maxPossible> chamberNames {
248 constexpr
int maxPossible {5};
249 if (ibinx > maxPossible)
continue;
250 constexpr std::array<std::string_view, maxPossible> chamberNames {
259 }
else if (
Title.find(
"Pivot0_BA") != std::string::npos ||
Title.find(
"Pivot1_BA") != std::string::npos ||
260 Title.find(
"LowPt_BA") != std::string::npos) {
261 if (listContains({1, 2, 5, 6, 9, 10}, ibiny)) {
262 constexpr
int maxPossible {11};
263 if (ibinx > maxPossible)
continue;
264 constexpr std::array<std::string_view, maxPossible> chamberNames {
278 }
else if (listContains({13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
279 constexpr
int maxPossible {10};
280 if (ibinx > maxPossible)
continue;
281 constexpr std::array<std::string_view, maxPossible> chamberNames {
294 }
else if (ibiny == 25 || ibiny == 26) {
295 constexpr
int maxPossible {11};
296 if (ibinx > maxPossible)
continue;
297 constexpr std::array<std::string_view, maxPossible> chamberNames {
311 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
312 constexpr
int maxPossible {13};
313 if (ibinx > maxPossible)
continue;
314 constexpr std::array<std::string_view, maxPossible> chamberNames {
331 constexpr
int maxPossible {13};
332 if (ibinx > maxPossible)
continue;
333 constexpr std::array<std::string_view, maxPossible> chamberNames {
350 }
else if (
Title.find(
"HighPt_BA") != std::string::npos) {
351 if (listContains({1, 2, 5, 6, 9, 10}, ibiny)) {
352 constexpr
int maxPossible {11};
353 if (ibinx > maxPossible)
continue;
354 constexpr std::array<std::string_view, maxPossible> chamberNames {
368 }
else if (listContains({13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
369 constexpr
int maxPossible {10};
370 if (ibinx > maxPossible)
continue;
371 constexpr std::array<std::string_view, maxPossible> chamberNames {
384 }
else if (ibiny == 25 || ibiny == 26) {
385 constexpr
int maxPossible {11};
386 if (ibinx > maxPossible)
continue;
387 constexpr std::array<std::string_view, maxPossible> chamberNames {
401 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
402 constexpr
int maxPossible {13};
403 if (ibinx > maxPossible)
continue;
404 constexpr std::array<std::string_view, maxPossible> chamberNames {
421 constexpr
int maxPossible {6};
422 if (ibinx > maxPossible)
continue;
423 constexpr std::array<std::string_view, maxPossible> chamberNames {
433 }
else if (
Title.find(
"HighPt0_BC") != std::string::npos ||
Title.find(
"HighPt1_BC") != std::string::npos) {
434 if (listContains({1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
435 constexpr
int maxPossible {12};
436 if (ibinx > maxPossible)
continue;
437 constexpr std::array<std::string_view, maxPossible> chamberNames {
452 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
453 constexpr
int maxPossible {12};
454 if (ibinx > maxPossible)
continue;
455 constexpr std::array<std::string_view, maxPossible> chamberNames {
470 }
else if (ibiny == 25 || ibiny == 26) {
471 constexpr
int maxPossible {13};
472 constexpr std::array<std::string_view, maxPossible> chamberNames {
488 chamber_name = (ibinx > maxPossible) ?
"" : chamberNames[ibinx - 1];
490 constexpr
int maxPossible {11};
491 if (ibinx > maxPossible)
continue;
492 constexpr std::array<std::string_view, maxPossible> chamberNames {
507 }
else if (
Title.find(
"LowPt0_BC") != std::string::npos ||
Title.find(
"LowPt1_BC") != std::string::npos) {
508 if (ibiny == 5 || ibiny == 6 || ibiny == 9 || ibiny == 10) {
509 constexpr
int maxPossible {10};
510 if (ibinx > maxPossible)
continue;
511 constexpr std::array<std::string_view, maxPossible> chamberNames {
524 }
else if (listContains({1, 2, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
525 constexpr
int maxPossible {9};
526 if (ibinx > maxPossible)
continue;
527 constexpr std::array<std::string_view, maxPossible> chamberNames {
539 }
else if (ibiny == 25 || ibiny == 26) {
540 constexpr
int maxPossible {10};
541 if (ibinx > maxPossible)
continue;
542 constexpr std::array<std::string_view, maxPossible> chamberNames {
555 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
556 constexpr
int maxPossible {12};
557 if (ibinx > maxPossible)
continue;
558 constexpr std::array<std::string_view, maxPossible> chamberNames {
574 constexpr
int maxPossible {5};
575 if (ibinx > maxPossible)
continue;
576 constexpr std::array<std::string_view, maxPossible> chamberNames {
585 }
else if (
Title.find(
"Pivot0_BC") != std::string::npos ||
Title.find(
"Pivot1_BC") != std::string::npos ||
586 Title.find(
"LowPt_BC") != std::string::npos) {
587 if (ibiny == 5 || ibiny == 6 || ibiny == 9 || ibiny == 10) {
588 constexpr
int maxPossible {11};
589 if (ibinx > maxPossible)
continue;
590 constexpr std::array<std::string_view, maxPossible> chamberNames {
604 }
else if (listContains({1, 2, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
605 constexpr
int maxPossible {10};
606 if (ibinx > maxPossible)
continue;
607 constexpr std::array<std::string_view, maxPossible> chamberNames {
620 }
else if (ibiny == 25 || ibiny == 26) {
621 constexpr
int maxPossible {11};
622 if (ibinx > maxPossible)
continue;
623 constexpr std::array<std::string_view, maxPossible> chamberNames {
637 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
638 constexpr
int maxPossible {13};
639 if (ibinx > maxPossible)
continue;
640 constexpr std::array<std::string_view, maxPossible> chamberNames {
657 constexpr
int maxPossible {13};
658 if (ibinx > maxPossible)
continue;
659 constexpr std::array<std::string_view, maxPossible> chamberNames {
676 }
else if (
Title.find(
"HighPt_BC") != std::string::npos) {
677 if (ibiny == 5 || ibiny == 6 || ibiny == 9 || ibiny == 10) {
678 constexpr
int maxPossible {11};
679 if (ibinx > maxPossible)
continue;
680 constexpr std::array<std::string_view, maxPossible> chamberNames {
694 }
else if (listContains({1, 2, 13, 14, 17, 18, 21, 22, 29, 30}, ibiny)) {
695 constexpr
int maxPossible {10};
696 if (ibinx > maxPossible)
continue;
697 constexpr std::array<std::string_view, maxPossible> chamberNames {
710 }
else if (ibiny == 25 || ibiny == 26) {
711 constexpr
int maxPossible {11};
712 if (ibinx > maxPossible)
continue;
713 constexpr std::array<std::string_view, maxPossible> chamberNames {
727 }
else if (listContains({3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 31, 32}, ibiny)) {
728 constexpr
int maxPossible {13};
729 if (ibinx > maxPossible)
continue;
730 constexpr std::array<std::string_view, maxPossible> chamberNames {
747 constexpr
int maxPossible {6};
748 if (ibinx > maxPossible)
continue;
749 constexpr std::array<std::string_view, maxPossible> chamberNames {
762 std::string sector_name = getChamberName(
histo, ibiny);
764 std::string sector {};
765 std::string secnum {};
766 std::string
layer {};
769 std::string dzeta {};
771 std::string
dot =
".";
772 if (
Title.find(
"Eta") != std::string::npos)
view =
"eta";
773 if (
Title.find(
"Phi") != std::string::npos)
view =
"phi";
774 secnum = sector_name.substr(1, 2);
775 if (sector_name.find(
"HV") != std::string::npos) {
777 if (secnum ==
"02" || secnum ==
"04" || secnum ==
"06" || secnum ==
"08" || secnum ==
"10" ||
778 secnum ==
"12" || secnum ==
"14" || secnum ==
"16") dphi =
"DP2";
779 }
else if (sector_name.find(
"RO") != std::string::npos) {
781 if (secnum ==
"02" || secnum ==
"04" || secnum ==
"06" || secnum ==
"08" || secnum ==
"10" ||
782 secnum ==
"12" || secnum ==
"14" || secnum ==
"16") dphi =
"DP1";
785 if (
Title.find(
"HighPt0") != std::string::npos) {
789 if (
Title.find(
"HighPt1") != std::string::npos) {
793 if (
Title.find(
"LowPt0") != std::string::npos) {
797 if (
Title.find(
"LowPt1") != std::string::npos) {
801 if (
Title.find(
"Pivot0") != std::string::npos) {
805 if (
Title.find(
"Pivot1") != std::string::npos) {
809 if (
Title.find(
"LowPt_") != std::string::npos) {
813 if (
Title.find(
"HighPt_") != std::string::npos) {
817 sector = sector_name.substr(0, 3);
822 dead_rpc_panel.push_back(panel_name);
823 coun_rpc_panel.push_back(
content);
830 std::map<std::string, double>
tags;
835 for (std::vector<std::string>::const_iterator itr = dead_rpc_panel.begin(); itr != dead_rpc_panel.end(); ++itr) {
841 int count = TotalPanels - dead_rpc_panel.size();
848 if (
count >= gthreshold) {
850 }
else if (
count > rthreshold) {
851 result->status_ = dqm_core::Result::Yellow;
869 if (std::string(
histo->GetYaxis()->GetBinLabel(biny)).size()) {
870 std::string
label =
histo->GetYaxis()->GetBinLabel(biny);
875 std::stringstream
ss;