46 #include "TPaveStats.h" 56 class SiStripBadStripTest :
public Histogram1D<SiStripBadStrip, SINGLE_IOV> {
61 bool fill()
override {
62 auto tag = PlotBase::getTag<0>();
63 for (
auto const& iov :
tag.iovs) {
64 std::shared_ptr<SiStripBadStrip>
payload = Base::fetchPayload(std::get<1>(iov));
69 ss <<
"Summary of bad strips:" << std::endl;
75 std::vector<uint32_t> detid;
78 for (
const auto&
d : detid) {
80 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second;
82 ss <<
"DetId=" <<
d <<
" Strip=" <<
payload->decode(*badStrip).firstStrip <<
":" 83 <<
payload->decode(*badStrip).range <<
" flag=" <<
payload->decode(*badStrip).flag << std::endl;
98 class SiStripBadModuleTrackerMap :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
102 bool fill()
override {
103 auto tag = PlotBase::getTag<0>();
104 auto iov =
tag.iovs.front();
106 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
110 std::string titleMap =
"Modules w/ at least 1 bad Strip, Run: " + theIOVsince +
" (tag: " +
tagname +
")";
112 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripBadStrips");
113 tmap->setTitle(titleMap);
116 std::vector<uint32_t> detid;
119 for (
const auto&
d : detid) {
135 class SiStripBadStripFractionTrackerMap :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
137 SiStripBadStripFractionTrackerMap()
140 bool fill()
override {
141 auto tag = PlotBase::getTag<0>();
142 auto iov =
tag.iovs.front();
144 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
151 std::string titleMap =
"Fraction of bad Strips per module, Run: " + theIOVsince +
" (tag: " +
tagname +
")";
153 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripBadStrips");
154 tmap->setTitle(titleMap);
157 std::vector<uint32_t> detid;
160 std::map<uint32_t, int> badStripsPerDetId;
162 for (
const auto&
d : detid) {
164 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
165 badStripsPerDetId[
d] +=
payload->decode(*badStrip).range;
175 std::pair<float, float> extrema = tmap->getAutomaticRange();
180 if (extrema.first != extrema.second) {
183 tmap->save(
true, extrema.first * 0.95, extrema.first * 1.05,
fileName);
193 class SiStripBadStripFractionTkMap :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
195 SiStripBadStripFractionTkMap()
198 bool fill()
override {
200 gStyle->SetPalette(1);
202 auto tag = PlotBase::getTag<0>();
203 auto iov =
tag.iovs.front();
205 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
213 "Fraction of bad Strips per module, Run: " + theIOVsince +
" (tag:#color[2]{" +
tagname +
"})";
216 myMap.bookMap(titleMap,
"Fraction of bad Strips per module");
219 ghost.bookMap(titleMap,
"");
221 std::vector<uint32_t> detid;
224 std::map<uint32_t, int> badStripsPerDetId;
226 for (
const auto&
d : detid) {
228 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
229 badStripsPerDetId[
d] +=
payload->decode(*badStrip).range;
241 TCanvas
canvas(
"Bad Components fraction",
"bad components fraction");
242 myMap.drawMap(
canvas,
"");
243 ghost.drawMap(
canvas,
"same");
254 class SiStripBadStripFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
256 SiStripBadStripFractionByRun()
258 ~SiStripBadStripFractionByRun()
override =
default;
264 std::vector<uint32_t> detid;
267 std::map<uint32_t, int> badStripsPerDetId;
269 for (
const auto&
d : detid) {
272 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
273 badStrips +=
payload.decode(*badStrip).range;
275 badStripsPerDetId[
d] = badStrips;
279 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
280 for (
const auto& det : all_detids) {
282 if (badStripsPerDetId.count(det) != 0)
295 class SiStripBadStripTIBFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
297 SiStripBadStripTIBFractionByRun()
299 "TIB Bad Strip fraction [%]") {}
300 ~SiStripBadStripTIBFractionByRun()
override =
default;
306 std::vector<uint32_t> detid;
309 std::map<uint32_t, int> badStripsPerDetId;
311 for (
const auto&
d : detid) {
314 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
315 badStrips +=
payload.decode(*badStrip).range;
317 badStripsPerDetId[
d] = badStrips;
321 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
322 for (
const auto& det : all_detids) {
327 if (badStripsPerDetId.count(det) != 0)
340 class SiStripBadStripTOBFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
342 SiStripBadStripTOBFractionByRun()
344 "TOB Bad Strip fraction [%]") {}
345 ~SiStripBadStripTOBFractionByRun()
override =
default;
351 std::vector<uint32_t> detid;
354 std::map<uint32_t, int> badStripsPerDetId;
356 for (
const auto&
d : detid) {
359 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
360 badStrips +=
payload.decode(*badStrip).range;
362 badStripsPerDetId[
d] = badStrips;
366 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
367 for (
const auto& det : all_detids) {
372 if (badStripsPerDetId.count(det) != 0)
385 class SiStripBadStripTIDFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
387 SiStripBadStripTIDFractionByRun()
389 "TID Bad Strip fraction [%]") {}
390 ~SiStripBadStripTIDFractionByRun()
override =
default;
396 std::vector<uint32_t> detid;
399 std::map<uint32_t, int> badStripsPerDetId;
401 for (
const auto&
d : detid) {
404 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
405 badStrips +=
payload.decode(*badStrip).range;
407 badStripsPerDetId[
d] = badStrips;
411 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
412 for (
const auto& det : all_detids) {
417 if (badStripsPerDetId.count(det) != 0)
430 class SiStripBadStripTECFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
432 SiStripBadStripTECFractionByRun()
434 "TEC Bad Strip fraction [%]") {}
435 ~SiStripBadStripTECFractionByRun()
override =
default;
441 std::vector<uint32_t> detid;
444 std::map<uint32_t, int> badStripsPerDetId;
446 for (
const auto&
d : detid) {
449 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
450 badStrips +=
payload.decode(*badStrip).range;
452 badStripsPerDetId[
d] = badStrips;
456 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
457 for (
const auto& det : all_detids) {
462 if (badStripsPerDetId.count(det) != 0)
475 class SiStripBadStripByRegion :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
477 SiStripBadStripByRegion()
482 bool fill()
override {
483 auto tag = PlotBase::getTag<0>();
484 auto iov =
tag.iovs.front();
485 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
487 std::vector<uint32_t> detid;
491 int totalBadStrips = 0;
493 for (
const auto&
d : detid) {
496 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
497 badStrips +=
payload->decode(*badStrip).range;
499 totalBadStrips += badStrips;
500 summaryBadStrips.add(
d, badStrips);
502 std::map<unsigned int, SiStripDetSummary::Values> mapBadStrips = summaryBadStrips.getCounts();
506 TCanvas
canvas(
"BadStrip Region summary",
"SiStripBadStrip region summary", 1200, 1000);
508 auto h_BadStrips = std::make_unique<TH1F>(
"BadStripsbyRegion",
509 "SiStrip Bad Strip summary by region;; n. bad strips",
512 mapBadStrips.size());
513 h_BadStrips->SetStats(
false);
515 canvas.SetBottomMargin(0.18);
516 canvas.SetLeftMargin(0.12);
517 canvas.SetRightMargin(0.05);
520 std::vector<int> boundaries;
521 unsigned int iBin = 0;
526 for (
const auto& element : mapBadStrips) {
528 int countBadStrips = (element.second.mean);
530 if (currentDetector.empty())
531 currentDetector =
"TIB";
533 switch ((element.first) / 1000) {
548 h_BadStrips->SetBinContent(iBin, countBadStrips);
550 h_BadStrips->GetXaxis()->LabelsOption(
"v");
553 boundaries.push_back(iBin);
558 h_BadStrips->SetMarkerStyle(21);
559 h_BadStrips->SetMarkerSize(1);
560 h_BadStrips->SetLineColor(kBlue);
561 h_BadStrips->SetLineStyle(9);
562 h_BadStrips->SetMarkerColor(kBlue);
563 h_BadStrips->GetYaxis()->SetRangeUser(0., h_BadStrips->GetMaximum() * 1.30);
564 h_BadStrips->GetYaxis()->SetTitleOffset(1.7);
565 h_BadStrips->Draw(
"HISTsame");
566 h_BadStrips->Draw(
"TEXTsame");
571 TLine
l[boundaries.size()];
573 for (
const auto&
line : boundaries) {
574 l[
i] = TLine(h_BadStrips->GetBinLowEdge(
line),
576 h_BadStrips->GetBinLowEdge(
line),
578 l[
i].SetLineWidth(1);
579 l[
i].SetLineStyle(9);
580 l[
i].SetLineColor(2);
585 TLegend
legend = TLegend(0.52, 0.82, 0.95, 0.9);
586 legend.SetHeader((std::get<1>(iov)).c_str(),
"C");
591 legend.SetTextSize(0.025);
608 template <
int ntags, IOVMultiplicity nIOVs>
609 class SiStripBadStripByRegionComparisonBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
611 SiStripBadStripByRegionComparisonBase()
616 bool fill()
override {
618 auto theIOVs = PlotBase::getTag<0>().iovs;
619 auto tagname1 = PlotBase::getTag<0>().
name;
621 auto firstiov = theIOVs.front();
622 std::tuple<cond::Time_t, cond::Hash> lastiov;
625 assert(this->m_plotAnnotations.ntags < 3);
627 if (this->m_plotAnnotations.ntags == 2) {
628 auto tag2iovs = PlotBase::getTag<1>().iovs;
629 tagname2 = PlotBase::getTag<1>().
name;
630 lastiov = tag2iovs.front();
632 lastiov = theIOVs.back();
635 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
636 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
642 std::vector<uint32_t> detid;
643 last_payload->getDetIds(detid);
646 int totalLastBadStrips = 0;
648 for (
const auto&
d : detid) {
651 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
652 badStrips += last_payload->decode(*badStrip).range;
654 totalLastBadStrips += badStrips;
655 summaryLastBadStrips.add(
d, badStrips);
657 std::map<unsigned int, SiStripDetSummary::Values> mapLastBadStrips = summaryLastBadStrips.getCounts();
662 first_payload->getDetIds(detid);
665 int totalFirstBadStrips = 0;
667 for (
const auto&
d : detid) {
670 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
671 badStrips += first_payload->decode(*badStrip).range;
673 totalFirstBadStrips += badStrips;
674 summaryFirstBadStrips.add(
d, badStrips);
676 std::map<unsigned int, SiStripDetSummary::Values> mapFirstBadStrips = summaryFirstBadStrips.getCounts();
680 TCanvas
canvas(
"BadStrip Partion summary",
"SiStripBadStrip region summary", 1200, 1000);
683 auto h_LastBadStrips = std::make_unique<TH1F>(
"BadStripsbyRegion1",
684 "SiStrip Bad Strip summary by region;; n. bad strips",
685 mapLastBadStrips.size(),
687 mapLastBadStrips.size());
688 h_LastBadStrips->SetStats(
false);
690 auto h_FirstBadStrips = std::make_unique<TH1F>(
"BadStripsbyRegion2",
691 "SiStrip Bad Strip summary by region;; n. bad strips",
692 mapFirstBadStrips.size(),
694 mapFirstBadStrips.size());
695 h_FirstBadStrips->SetStats(
false);
697 canvas.SetBottomMargin(0.18);
698 canvas.SetLeftMargin(0.12);
699 canvas.SetRightMargin(0.05);
702 std::vector<int> boundaries;
703 unsigned int iBin = 0;
708 for (
const auto& element : mapLastBadStrips) {
710 int countBadStrips = (element.second.mean);
712 if (currentDetector.empty())
713 currentDetector =
"TIB";
715 switch ((element.first) / 1000) {
730 h_LastBadStrips->SetBinContent(iBin, countBadStrips);
732 h_LastBadStrips->GetXaxis()->LabelsOption(
"v");
735 boundaries.push_back(iBin);
743 for (
const auto& element : mapFirstBadStrips) {
745 int countBadStrips = (element.second.mean);
747 h_FirstBadStrips->SetBinContent(iBin, countBadStrips);
749 h_FirstBadStrips->GetXaxis()->LabelsOption(
"v");
753 h_LastBadStrips->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
755 h_LastBadStrips->SetMarkerStyle(21);
756 h_LastBadStrips->SetMarkerSize(1);
757 h_LastBadStrips->SetLineColor(kBlue);
758 h_LastBadStrips->SetFillColor(kBlue);
759 h_LastBadStrips->SetLineStyle(9);
760 h_LastBadStrips->SetMarkerColor(kBlue);
761 h_LastBadStrips->GetYaxis()->SetRangeUser(0., h_LastBadStrips->GetMaximum() * 1.30);
762 h_LastBadStrips->GetYaxis()->SetTitleOffset(1.7);
764 h_LastBadStrips->SetBarWidth(0.45);
765 h_LastBadStrips->SetBarOffset(0.1);
766 h_LastBadStrips->Draw(
"bar2");
767 h_LastBadStrips->Draw(
"TEXTsame");
769 h_FirstBadStrips->SetMarkerStyle(20);
770 h_FirstBadStrips->SetMarkerSize(1);
771 h_FirstBadStrips->SetFillColor(kRed);
772 h_FirstBadStrips->SetLineColor(kRed);
773 h_FirstBadStrips->SetLineStyle(1);
774 h_FirstBadStrips->SetMarkerColor(kRed);
775 h_FirstBadStrips->GetYaxis()->SetTitleOffset(1.7);
777 h_FirstBadStrips->SetBarWidth(0.4);
778 h_FirstBadStrips->SetBarOffset(0.55);
780 h_FirstBadStrips->Draw(
"bar2same");
781 h_FirstBadStrips->Draw(
"TEXT45same");
786 TLine
l[boundaries.size()];
788 for (
const auto&
line : boundaries) {
789 l[
i] = TLine(h_LastBadStrips->GetBinLowEdge(
line),
791 h_LastBadStrips->GetBinLowEdge(
line),
793 l[
i].SetLineWidth(1);
794 l[
i].SetLineStyle(9);
795 l[
i].SetLineColor(kMagenta);
800 TLegend
legend = TLegend(0.52, 0.82, 0.95, 0.9);
801 legend.SetHeader(
"Bad Components comparison",
"C");
803 h_LastBadStrips.get(),
807 legend.AddEntry(h_FirstBadStrips.get(),
812 legend.SetTextSize(0.025);
825 using SiStripBadStripByRegionComparisonSingleTag = SiStripBadStripByRegionComparisonBase<1, MULTI_IOV>;
826 using SiStripBadStripByRegionComparisonTwoTags = SiStripBadStripByRegionComparisonBase<2, SINGLE_IOV>;
832 template <
int ntags, IOVMultiplicity nIOVs>
833 class SiStripBadStripFractionComparisonTrackerMapBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
835 SiStripBadStripFractionComparisonTrackerMapBase()
838 bool fill()
override {
840 auto theIOVs = PlotBase::getTag<0>().iovs;
841 auto tagname1 = PlotBase::getTag<0>().
name;
843 auto firstiov = theIOVs.front();
844 std::tuple<cond::Time_t, cond::Hash> lastiov;
847 assert(this->m_plotAnnotations.ntags < 3);
849 if (this->m_plotAnnotations.ntags == 2) {
850 auto tag2iovs = PlotBase::getTag<1>().iovs;
851 tagname2 = PlotBase::getTag<1>().
name;
852 lastiov = tag2iovs.front();
854 lastiov = theIOVs.back();
857 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
858 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
867 "#Delta fraction of bad Strips per module (IOV:" + lastIOVsince +
" - IOV:" + firstIOVsince +
")";
869 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripBadStrips");
870 tmap->setTitle(titleMap);
873 std::vector<uint32_t> detid1;
874 last_payload->getDetIds(detid1);
876 std::map<uint32_t, float> FirstFractionPerDetId;
877 std::map<uint32_t, float> LastFractionPerDetId;
879 for (
const auto&
d : detid1) {
881 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
882 LastFractionPerDetId[
d] += last_payload->decode(*badStrip).range;
888 std::vector<uint32_t> detid2;
889 first_payload->getDetIds(detid2);
893 for (
const auto&
d : detid2) {
895 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
896 FirstFractionPerDetId[
d] += first_payload->decode(*badStrip).range;
902 std::vector<uint32_t> allDetIds = detInfo.getAllDetIds();
904 int countLastButNotFirst(0);
905 int countFirstButNotLast(0);
908 for (
const auto&
d : allDetIds) {
909 if (LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
910 FirstFractionPerDetId.find(
d) == FirstFractionPerDetId.end()) {
911 tmap->fill(
d, LastFractionPerDetId[
d]);
912 countLastButNotFirst++;
913 }
else if (LastFractionPerDetId.find(
d) == LastFractionPerDetId.end() &&
914 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end()) {
915 tmap->fill(
d, -FirstFractionPerDetId[
d]);
916 countFirstButNotLast++;
917 }
else if (LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
918 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end()) {
919 float delta = (LastFractionPerDetId[
d] - FirstFractionPerDetId[
d]);
928 std::cout <<
"In 2 but not in 1:" << countLastButNotFirst << std::endl;
929 std::cout <<
"In 1 but not in 2:" << countFirstButNotLast << std::endl;
930 std::cout <<
"In both:" << countBoth << std::endl;
942 using SiStripBadStripFractionComparisonTrackerMapSingleTag =
943 SiStripBadStripFractionComparisonTrackerMapBase<1, MULTI_IOV>;
944 using SiStripBadStripFractionComparisonTrackerMapTwoTags =
945 SiStripBadStripFractionComparisonTrackerMapBase<2, SINGLE_IOV>;
951 class SiStripBadStripQualityAnalysis :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
953 SiStripBadStripQualityAnalysis()
958 bool fill()
override {
959 auto tag = PlotBase::getTag<0>();
960 auto iov =
tag.iovs.front();
961 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
973 int NTkBadComponent[4] = {0};
978 int NBadComponent[4][19][4] = {{{0}}};
987 std::stringstream
ss;
989 ss <<
"\n-----------------\nGlobal Info\n-----------------";
990 ss <<
"\nBadComponent \t Modules \tFibers " 991 "\tApvs\tStrips\n----------------------------------------------------------------";
992 ss <<
"\nTracker:\t\t" << NTkBadComponent[0] <<
"\t" << NTkBadComponent[1] <<
"\t" << NTkBadComponent[2] <<
"\t" 993 << NTkBadComponent[3];
995 ss <<
"\nTIB:\t\t\t" << NBadComponent[0][0][0] <<
"\t" << NBadComponent[0][0][1] <<
"\t" << NBadComponent[0][0][2]
996 <<
"\t" << NBadComponent[0][0][3];
997 ss <<
"\nTID:\t\t\t" << NBadComponent[1][0][0] <<
"\t" << NBadComponent[1][0][1] <<
"\t" << NBadComponent[1][0][2]
998 <<
"\t" << NBadComponent[1][0][3];
999 ss <<
"\nTOB:\t\t\t" << NBadComponent[2][0][0] <<
"\t" << NBadComponent[2][0][1] <<
"\t" << NBadComponent[2][0][2]
1000 <<
"\t" << NBadComponent[2][0][3];
1001 ss <<
"\nTEC:\t\t\t" << NBadComponent[3][0][0] <<
"\t" << NBadComponent[3][0][1] <<
"\t" << NBadComponent[3][0][2]
1002 <<
"\t" << NBadComponent[3][0][3];
1005 for (
int i = 1;
i < 5; ++
i)
1006 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << NBadComponent[0][
i][0] <<
"\t" << NBadComponent[0][
i][1] <<
"\t" 1007 << NBadComponent[0][
i][2] <<
"\t" << NBadComponent[0][
i][3];
1009 for (
int i = 1;
i < 4; ++
i)
1010 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 1011 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
1012 for (
int i = 4;
i < 7; ++
i)
1013 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 1014 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
1016 for (
int i = 1;
i < 7; ++
i)
1017 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << NBadComponent[2][
i][0] <<
"\t" << NBadComponent[2][
i][1] <<
"\t" 1018 << NBadComponent[2][
i][2] <<
"\t" << NBadComponent[2][
i][3];
1020 for (
int i = 1;
i < 10; ++
i)
1021 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 1022 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
1023 for (
int i = 10;
i < 19; ++
i)
1024 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 1025 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
1028 edm::LogInfo(
"SiStripBadStrip_PayloadInspector") <<
ss.str() << std::endl;
1031 auto masterTable = std::make_unique<TH2I>(
"table",
"", 4, 0., 4., 39, 0., 39.);
1033 std::string labelsX[4] = {
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1035 "Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
1036 "TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
1037 "TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
1038 "TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
1039 "TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
1040 "TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1042 for (
int iX = 0; iX <= 3; iX++) {
1043 masterTable->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1046 for (
int iY = 39; iY >= 1; iY--) {
1047 masterTable->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1051 int layerBoundaries[4] = {4, 6, 6, 18};
1052 std::vector<int> boundaries;
1053 boundaries.push_back(39);
1054 boundaries.push_back(35);
1058 for (
int iY = 39; iY >= 1; iY--) {
1059 for (
int iX = 0; iX <= 3; iX++) {
1061 masterTable->SetBinContent(iX + 1, iY, NTkBadComponent[iX]);
1062 }
else if (iY >= 35) {
1063 masterTable->SetBinContent(iX + 1, iY, NBadComponent[(39 - iY) - 1][0][iX]);
1068 masterTable->SetBinContent(iX + 1, iY, NBadComponent[cursor][layerIndex][iX]);
1071 if (layerIndex == layerBoundaries[cursor]) {
1075 boundaries.push_back(iY);
1079 TCanvas canv(
"canv",
"canv", 800, 800);
1082 canv.SetTopMargin(0.05);
1083 canv.SetBottomMargin(0.07);
1084 canv.SetLeftMargin(0.18);
1085 canv.SetRightMargin(0.05);
1087 masterTable->GetYaxis()->SetLabelSize(0.04);
1088 masterTable->GetXaxis()->SetLabelSize(0.05);
1090 masterTable->SetStats(
false);
1093 masterTable->Draw(
"text");
1098 TLine
l[boundaries.size()];
1100 for (
const auto&
line : boundaries) {
1101 l[
i] = TLine(canv.cd()->GetUxmin(),
1102 masterTable->GetYaxis()->GetBinLowEdge(
line),
1103 canv.cd()->GetUxmax(),
1104 masterTable->GetYaxis()->GetBinLowEdge(
line));
1105 l[
i].SetLineWidth(2);
1106 l[
i].SetLineStyle(9);
1107 l[
i].SetLineColor(kMagenta);
1114 title.SetTextSize(0.027);
1115 title.SetTextColor(kBlue);
1116 title.DrawLatexNDC(0.12, 0.97, (
"IOV: " +
std::to_string(std::get<0>(iov)) +
"| " + std::get<1>(iov)).c_str());
1120 delete siStripQuality_;
1132 template <
int ntags, IOVMultiplicity nIOVs>
1133 class SiStripBadStripQualityComparisonBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
1135 SiStripBadStripQualityComparisonBase()
1140 bool fill()
override {
1142 gStyle->SetPalette(kTemperatureMap);
1145 auto theIOVs = PlotBase::getTag<0>().iovs;
1146 auto tagname1 = PlotBase::getTag<0>().
name;
1148 auto firstiov = theIOVs.front();
1149 std::tuple<cond::Time_t, cond::Hash> lastiov;
1152 assert(this->m_plotAnnotations.ntags < 3);
1154 if (this->m_plotAnnotations.ntags == 2) {
1155 auto tag2iovs = PlotBase::getTag<1>().iovs;
1156 tagname2 = PlotBase::getTag<1>().
name;
1157 lastiov = tag2iovs.front();
1159 lastiov = theIOVs.back();
1162 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
1163 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
1171 int f_NTkBadComponent[4] = {0};
1172 int l_NTkBadComponent[4] = {0};
1175 int tot_NTkComponents[4] = {0};
1180 int f_NBadComponent[4][19][4] = {{{0}}};
1181 int l_NBadComponent[4][19][4] = {{{0}}};
1184 int totNComponents[4][19][4] = {{{0}}};
1186 const auto detInfo =
1189 f_siStripQuality_->
add(first_payload.get());
1197 l_siStripQuality_->
add(last_payload.get());
1214 auto masterTable = std::make_unique<TH2F>(
"table",
"", 4, 0., 4., 39, 0., 39.);
1215 auto masterTableColor = std::make_unique<TH2F>(
"colortable",
"", 4, 0., 4., 39, 0., 39.);
1217 std::string labelsX[4] = {
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1219 "Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
1220 "TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
1221 "TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
1222 "TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
1223 "TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
1224 "TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1226 for (
int iX = 0; iX <= 3; iX++) {
1227 masterTable->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1228 masterTableColor->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1231 for (
int iY = 39; iY >= 1; iY--) {
1232 masterTable->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1233 masterTableColor->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1237 int layerBoundaries[4] = {4, 6, 6, 18};
1238 std::vector<int> boundaries;
1239 boundaries.push_back(39);
1240 boundaries.push_back(35);
1244 for (
int iY = 39; iY >= 1; iY--) {
1245 for (
int iX = 0; iX <= 3; iX++) {
1247 masterTable->SetBinContent(iX + 1, iY, l_NTkBadComponent[iX] - f_NTkBadComponent[iX]);
1248 masterTableColor->SetBinContent(
1249 iX + 1, iY, 100 *
float(l_NTkBadComponent[iX] - f_NTkBadComponent[iX]) / tot_NTkComponents[iX]);
1251 }
else if (iY >= 35) {
1252 masterTable->SetBinContent(
1253 iX + 1, iY, (l_NBadComponent[(39 - iY) - 1][0][iX] - f_NBadComponent[(39 - iY) - 1][0][iX]));
1254 masterTableColor->SetBinContent(
1257 100 *
float(l_NBadComponent[(39 - iY) - 1][0][iX] - f_NBadComponent[(39 - iY) - 1][0][iX]) /
1258 totNComponents[(39 - iY) - 1][0][iX]);
1263 masterTable->SetBinContent(
1264 iX + 1, iY, (l_NBadComponent[cursor][layerIndex][iX] - f_NBadComponent[cursor][layerIndex][iX]));
1265 masterTableColor->SetBinContent(
1268 100 *
float(l_NBadComponent[cursor][layerIndex][iX] - f_NBadComponent[cursor][layerIndex][iX]) /
1269 totNComponents[cursor][layerIndex][iX]);
1272 if (layerIndex == layerBoundaries[cursor]) {
1276 boundaries.push_back(iY);
1280 TCanvas canv(
"canv",
"canv", 1000, 800);
1283 canv.SetTopMargin(0.05);
1284 canv.SetBottomMargin(0.07);
1285 canv.SetLeftMargin(0.13);
1286 canv.SetRightMargin(0.16);
1288 masterTable->SetStats(
false);
1289 masterTableColor->SetStats(
false);
1292 masterTable->SetMarkerColor(kBlack);
1293 masterTable->SetMarkerSize(1.5);
1295 float extremum =
std::abs(masterTableColor->GetMaximum()) >
std::abs(masterTableColor->GetMinimum())
1296 ?
std::abs(masterTableColor->GetMaximum())
1297 :
std::abs(masterTableColor->GetMinimum());
1299 masterTableColor->GetZaxis()->SetRangeUser(-extremum, extremum);
1300 masterTableColor->GetZaxis()->SetTitle(
"percent change [%]");
1301 masterTableColor->GetZaxis()->CenterTitle(
true);
1302 masterTableColor->GetZaxis()->SetTitleSize(0.05);
1304 masterTableColor->GetYaxis()->SetLabelSize(0.04);
1305 masterTableColor->GetXaxis()->SetLabelSize(0.06);
1307 masterTable->GetYaxis()->SetLabelSize(0.04);
1308 masterTable->GetXaxis()->SetLabelSize(0.06);
1310 masterTableColor->Draw(
"COLZ");
1311 masterTable->Draw(
"textsame");
1316 TLine
l[boundaries.size()];
1318 for (
const auto&
line : boundaries) {
1319 l[
i] = TLine(canv.cd()->GetUxmin(),
1320 masterTable->GetYaxis()->GetBinLowEdge(
line),
1321 canv.cd()->GetUxmax(),
1322 masterTable->GetYaxis()->GetBinLowEdge(
line));
1323 l[
i].SetLineWidth(2);
1324 l[
i].SetLineStyle(9);
1325 l[
i].SetLineColor(kMagenta);
1332 title.SetTextSize(0.045);
1333 title.SetTextColor(kBlue);
1342 delete f_siStripQuality_;
1343 delete l_siStripQuality_;
1352 using SiStripBadStripQualityComparisonSingleTag = SiStripBadStripQualityComparisonBase<1, MULTI_IOV>;
1353 using SiStripBadStripQualityComparisonTwoTags = SiStripBadStripQualityComparisonBase<2, SINGLE_IOV>;
static constexpr auto TEC
bool cleanUp(bool force=false)
std::pair< int, const char * > regionType(int index)
std::string to_string(const V &value)
void fillBCArrays(const SiStripQuality *siStripQuality_, int NTkBadComponent[4], int NBadComponent[4][19][4], const TrackerTopology m_trackerTopo)
void add(uint32_t, const SiStripBadStrip::Range &)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Abs< T >::type abs(const T &t)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
SiStripDetInfo read(std::string filePath)
static constexpr auto TOB
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Log< level::Info, false > LogInfo
static constexpr auto TIB
void fillTotalComponents(int NTkComponents[4], int NComponents[4][19][4], const TrackerTopology m_trackerTopo)
static const uint16_t STRIPS_PER_APV
std::pair< ContainerIterator, ContainerIterator > Range
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
static constexpr char const *const kDefaultFile
static constexpr auto TID