63 {
64 const TH2*
histo =
dynamic_cast<const TH2*
> (&
object);
65
66 if (!histo) {
67 throw dqm_core::BadConfig(ERS_HERE, name, "Input object is not a TH2");
68 }
69
70 std::vector<std::string> dead_rpc_panel {};
71 std::vector<int> coun_rpc_panel {};
72
74
75 if (
histo->GetEntries() < minstat) {
76 dqm_core::Result*
result =
new dqm_core::Result(dqm_core::Result::Undefined);
77 result->tags_[
"InsufficientEntries"] =
histo->GetEntries();
79 }
80
82
83 double gthreshold {};
84 double rthreshold {};
85 double bin_threshold {};
86 try {
90 }
91 catch (dqm_core::Exception& ex) {
92 throw dqm_core::BadConfig(ERS_HERE, name, ex.what(), ex);
93 }
94
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) {
101 if (content < bin_threshold) {
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;
108
109 constexpr std::array<std::string_view, maxPossible> chamberNames {
122 };
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 {
140 };
142 } else if (ibiny == 25 || ibiny == 26) {
143 constexpr int maxPossible {13};
144 constexpr std::array<std::string_view, maxPossible> chamberNames {
158 };
159
160 if (ibinx <= maxPossible)
chamber_name = chamberNames[ibinx - 1];
161
162 } else {
163 constexpr int maxPossible {12};
164 if (ibinx > maxPossible) continue;
165 constexpr std::array<std::string_view, maxPossible> chamberNames {
178 };
180 }
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 {
196 };
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 {
211 };
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 {
227 };
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 {
245 };
247 } else {
248 constexpr int maxPossible {5};
249 if (ibinx > maxPossible) continue;
250 constexpr std::array<std::string_view, maxPossible> chamberNames {
256 };
258 }
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 {
276 };
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 {
292 };
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 {
309 };
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 {
328 };
330 } else {
331 constexpr int maxPossible {13};
332 if (ibinx > maxPossible) continue;
333 constexpr std::array<std::string_view, maxPossible> chamberNames {
347 };
349 }
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 {
366 };
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 {
382 };
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 {
399 };
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 {
418 };
420 } else {
421 constexpr int maxPossible {6};
422 if (ibinx > maxPossible) continue;
423 constexpr std::array<std::string_view, maxPossible> chamberNames {
430 };
432 }
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 {
450 };
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 {
468 };
470 } else if (ibiny == 25 || ibiny == 26) {
471 constexpr int maxPossible {13};
472 constexpr std::array<std::string_view, maxPossible> chamberNames {
486 };
487
488 chamber_name = (ibinx > maxPossible) ?
"" : chamberNames[ibinx - 1];
489 } else {
490 constexpr int maxPossible {11};
491 if (ibinx > maxPossible) continue;
492 constexpr std::array<std::string_view, maxPossible> chamberNames {
504 };
506 }
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 {
522 };
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 {
537 };
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 {
553 };
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 {
571 };
573 } else {
574 constexpr int maxPossible {5};
575 if (ibinx > maxPossible) continue;
576 constexpr std::array<std::string_view, maxPossible> chamberNames {
582 };
584 }
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 {
602 };
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 {
618 };
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 {
635 };
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 {
654 };
656 } else {
657 constexpr int maxPossible {13};
658 if (ibinx > maxPossible) continue;
659 constexpr std::array<std::string_view, maxPossible> chamberNames {
673 };
675 }
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 {
692 };
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 {
708 };
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 {
725 };
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 {
744 };
746 } else {
747 constexpr int maxPossible {6};
748 if (ibinx > maxPossible) continue;
749 constexpr std::array<std::string_view, maxPossible> chamberNames {
756 };
758 }
759 }
760
761
764 std::string sector {};
765 std::string secnum {};
766 std::string
layer {};
767 std::string dphi {};
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) {
776 dphi = "DP1";
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) {
780 dphi = "DP2";
781 if (secnum == "02" || secnum == "04" || secnum == "06" || secnum == "08" || secnum == "10" ||
782 secnum == "12" || secnum == "14" || secnum == "16") dphi = "DP1";
783 }
784
785 if (
Title.find(
"HighPt0") != std::string::npos) {
788 }
789 if (
Title.find(
"HighPt1") != std::string::npos) {
792 }
793 if (
Title.find(
"LowPt0") != std::string::npos) {
796 }
797 if (
Title.find(
"LowPt1") != std::string::npos) {
800 }
801 if (
Title.find(
"Pivot0") != std::string::npos) {
804 }
805 if (
Title.find(
"Pivot1") != std::string::npos) {
808 }
809 if (
Title.find(
"LowPt_") != std::string::npos) {
812 }
813 if (
Title.find(
"HighPt_") != std::string::npos) {
816 }
817 sector = sector_name.substr(0, 3);
819 dzeta.erase(0, 4);
822 dead_rpc_panel.push_back(std::move(panel_name));
823 coun_rpc_panel.push_back(content);
824 }
825 }
826 }
827
828
829 dqm_core::Result*
result =
new dqm_core::Result();
830 std::map<std::string, double>
tags;
831
832
833 int writes = 0;
834
835 for (std::vector<std::string>::const_iterator itr = dead_rpc_panel.begin(); itr != dead_rpc_panel.end(); ++itr) {
836 tags[TString::Format(
"%s", (*itr).c_str()).Data()] = coun_rpc_panel.at(writes);
837 writes++;
838 if (writes > 100) break;
839 }
840
841 int count = TotalPanels - dead_rpc_panel.size();
842
843 tags[TString::Format(
"Alive panels").Data()] = 100. *
count / TotalPanels;
844 tags[TString::Format(
"# Alive panels").Data()] =
count;
845 tags[TString::Format(
"# Dead panels").Data()] = writes;
846
847
848 if (
count >= gthreshold) {
849 result->status_ = dqm_core::Result::Green;
850 }
else if (
count > rthreshold) {
851 result->status_ = dqm_core::Result::Yellow;
852 } else {
853 result->status_ = dqm_core::Result::Red;
854 }
855
858}
std::vector< std::string > tags
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
gap(flags, cells_name, *args, **kw)
dot(G, fn, nodesToHighlight=[])
std::string getChamberName(const TH2 *histo, int biny)