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();
905 int countLastButNotFirst(0);
906 int countFirstButNotLast(0);
910 for (
const auto&
d : allDetIds) {
911 if (LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
912 FirstFractionPerDetId.find(
d) == FirstFractionPerDetId.end()) {
913 tmap->fill(
d, LastFractionPerDetId[
d]);
915 countLastButNotFirst++;
917 }
else if (LastFractionPerDetId.find(
d) == LastFractionPerDetId.end() &&
918 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end()) {
919 tmap->fill(
d, -FirstFractionPerDetId[
d]);
921 countFirstButNotLast++;
923 }
else if (LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
924 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end()) {
925 float delta = (LastFractionPerDetId[
d] - FirstFractionPerDetId[
d]);
936 std::cout <<
"In 2 but not in 1:" << countLastButNotFirst << std::endl;
937 std::cout <<
"In 1 but not in 2:" << countFirstButNotLast << std::endl;
938 std::cout <<
"In both:" << countBoth << std::endl;
950 using SiStripBadStripFractionComparisonTrackerMapSingleTag =
951 SiStripBadStripFractionComparisonTrackerMapBase<1, MULTI_IOV>;
952 using SiStripBadStripFractionComparisonTrackerMapTwoTags =
953 SiStripBadStripFractionComparisonTrackerMapBase<2, SINGLE_IOV>;
959 class SiStripBadStripQualityAnalysis :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
961 SiStripBadStripQualityAnalysis()
966 bool fill()
override {
967 auto tag = PlotBase::getTag<0>();
968 auto iov =
tag.iovs.front();
969 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
981 int NTkBadComponent[4] = {0};
986 int NBadComponent[4][19][4] = {{{0}}};
995 std::stringstream
ss;
997 ss <<
"\n-----------------\nGlobal Info\n-----------------";
998 ss <<
"\nBadComponent \t Modules \tFibers " 999 "\tApvs\tStrips\n----------------------------------------------------------------";
1000 ss <<
"\nTracker:\t\t" << NTkBadComponent[0] <<
"\t" << NTkBadComponent[1] <<
"\t" << NTkBadComponent[2] <<
"\t" 1001 << NTkBadComponent[3];
1003 ss <<
"\nTIB:\t\t\t" << NBadComponent[0][0][0] <<
"\t" << NBadComponent[0][0][1] <<
"\t" << NBadComponent[0][0][2]
1004 <<
"\t" << NBadComponent[0][0][3];
1005 ss <<
"\nTID:\t\t\t" << NBadComponent[1][0][0] <<
"\t" << NBadComponent[1][0][1] <<
"\t" << NBadComponent[1][0][2]
1006 <<
"\t" << NBadComponent[1][0][3];
1007 ss <<
"\nTOB:\t\t\t" << NBadComponent[2][0][0] <<
"\t" << NBadComponent[2][0][1] <<
"\t" << NBadComponent[2][0][2]
1008 <<
"\t" << NBadComponent[2][0][3];
1009 ss <<
"\nTEC:\t\t\t" << NBadComponent[3][0][0] <<
"\t" << NBadComponent[3][0][1] <<
"\t" << NBadComponent[3][0][2]
1010 <<
"\t" << NBadComponent[3][0][3];
1013 for (
int i = 1;
i < 5; ++
i)
1014 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << NBadComponent[0][
i][0] <<
"\t" << NBadComponent[0][
i][1] <<
"\t" 1015 << NBadComponent[0][
i][2] <<
"\t" << NBadComponent[0][
i][3];
1017 for (
int i = 1;
i < 4; ++
i)
1018 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 1019 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
1020 for (
int i = 4;
i < 7; ++
i)
1021 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 1022 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
1024 for (
int i = 1;
i < 7; ++
i)
1025 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << NBadComponent[2][
i][0] <<
"\t" << NBadComponent[2][
i][1] <<
"\t" 1026 << NBadComponent[2][
i][2] <<
"\t" << NBadComponent[2][
i][3];
1028 for (
int i = 1;
i < 10; ++
i)
1029 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 1030 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
1031 for (
int i = 10;
i < 19; ++
i)
1032 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 1033 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
1036 edm::LogInfo(
"SiStripBadStrip_PayloadInspector") <<
ss.str() << std::endl;
1039 auto masterTable = std::make_unique<TH2I>(
"table",
"", 4, 0., 4., 39, 0., 39.);
1041 std::string labelsX[4] = {
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1043 "Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
1044 "TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
1045 "TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
1046 "TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
1047 "TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
1048 "TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1050 for (
int iX = 0; iX <= 3; iX++) {
1051 masterTable->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1054 for (
int iY = 39; iY >= 1; iY--) {
1055 masterTable->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1059 int layerBoundaries[4] = {4, 6, 6, 18};
1060 std::vector<int> boundaries;
1061 boundaries.push_back(39);
1062 boundaries.push_back(35);
1066 for (
int iY = 39; iY >= 1; iY--) {
1067 for (
int iX = 0; iX <= 3; iX++) {
1069 masterTable->SetBinContent(iX + 1, iY, NTkBadComponent[iX]);
1070 }
else if (iY >= 35) {
1071 masterTable->SetBinContent(iX + 1, iY, NBadComponent[(39 - iY) - 1][0][iX]);
1076 masterTable->SetBinContent(iX + 1, iY, NBadComponent[cursor][layerIndex][iX]);
1079 if (layerIndex == layerBoundaries[cursor]) {
1083 boundaries.push_back(iY);
1087 TCanvas canv(
"canv",
"canv", 800, 800);
1090 canv.SetTopMargin(0.05);
1091 canv.SetBottomMargin(0.07);
1092 canv.SetLeftMargin(0.18);
1093 canv.SetRightMargin(0.05);
1095 masterTable->GetYaxis()->SetLabelSize(0.04);
1096 masterTable->GetXaxis()->SetLabelSize(0.05);
1098 masterTable->SetStats(
false);
1101 masterTable->Draw(
"text");
1106 TLine
l[boundaries.size()];
1108 for (
const auto&
line : boundaries) {
1109 l[
i] = TLine(canv.cd()->GetUxmin(),
1110 masterTable->GetYaxis()->GetBinLowEdge(
line),
1111 canv.cd()->GetUxmax(),
1112 masterTable->GetYaxis()->GetBinLowEdge(
line));
1113 l[
i].SetLineWidth(2);
1114 l[
i].SetLineStyle(9);
1115 l[
i].SetLineColor(kMagenta);
1122 title.SetTextSize(0.027);
1123 title.SetTextColor(kBlue);
1124 title.DrawLatexNDC(0.12, 0.97, (
"IOV: " +
std::to_string(std::get<0>(iov)) +
"| " + std::get<1>(iov)).c_str());
1128 delete siStripQuality_;
1140 template <
int ntags, IOVMultiplicity nIOVs>
1141 class SiStripBadStripQualityComparisonBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
1143 SiStripBadStripQualityComparisonBase()
1148 bool fill()
override {
1150 gStyle->SetPalette(kTemperatureMap);
1153 auto theIOVs = PlotBase::getTag<0>().iovs;
1154 auto tagname1 = PlotBase::getTag<0>().
name;
1156 auto firstiov = theIOVs.front();
1157 std::tuple<cond::Time_t, cond::Hash> lastiov;
1160 assert(this->m_plotAnnotations.ntags < 3);
1162 if (this->m_plotAnnotations.ntags == 2) {
1163 auto tag2iovs = PlotBase::getTag<1>().iovs;
1164 tagname2 = PlotBase::getTag<1>().
name;
1165 lastiov = tag2iovs.front();
1167 lastiov = theIOVs.back();
1170 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
1171 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
1179 int f_NTkBadComponent[4] = {0};
1180 int l_NTkBadComponent[4] = {0};
1183 int tot_NTkComponents[4] = {0};
1188 int f_NBadComponent[4][19][4] = {{{0}}};
1189 int l_NBadComponent[4][19][4] = {{{0}}};
1192 int totNComponents[4][19][4] = {{{0}}};
1194 const auto detInfo =
1197 f_siStripQuality_->
add(first_payload.get());
1205 l_siStripQuality_->
add(last_payload.get());
1222 auto masterTable = std::make_unique<TH2F>(
"table",
"", 4, 0., 4., 39, 0., 39.);
1223 auto masterTableColor = std::make_unique<TH2F>(
"colortable",
"", 4, 0., 4., 39, 0., 39.);
1225 std::string labelsX[4] = {
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1227 "Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
1228 "TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
1229 "TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
1230 "TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
1231 "TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
1232 "TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1234 for (
int iX = 0; iX <= 3; iX++) {
1235 masterTable->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1236 masterTableColor->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1239 for (
int iY = 39; iY >= 1; iY--) {
1240 masterTable->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1241 masterTableColor->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1245 int layerBoundaries[4] = {4, 6, 6, 18};
1246 std::vector<int> boundaries;
1247 boundaries.push_back(39);
1248 boundaries.push_back(35);
1252 for (
int iY = 39; iY >= 1; iY--) {
1253 for (
int iX = 0; iX <= 3; iX++) {
1255 masterTable->SetBinContent(iX + 1, iY, l_NTkBadComponent[iX] - f_NTkBadComponent[iX]);
1256 masterTableColor->SetBinContent(
1257 iX + 1, iY, 100 *
float(l_NTkBadComponent[iX] - f_NTkBadComponent[iX]) / tot_NTkComponents[iX]);
1259 }
else if (iY >= 35) {
1260 masterTable->SetBinContent(
1261 iX + 1, iY, (l_NBadComponent[(39 - iY) - 1][0][iX] - f_NBadComponent[(39 - iY) - 1][0][iX]));
1262 masterTableColor->SetBinContent(
1265 100 *
float(l_NBadComponent[(39 - iY) - 1][0][iX] - f_NBadComponent[(39 - iY) - 1][0][iX]) /
1266 totNComponents[(39 - iY) - 1][0][iX]);
1271 masterTable->SetBinContent(
1272 iX + 1, iY, (l_NBadComponent[cursor][layerIndex][iX] - f_NBadComponent[cursor][layerIndex][iX]));
1273 masterTableColor->SetBinContent(
1276 100 *
float(l_NBadComponent[cursor][layerIndex][iX] - f_NBadComponent[cursor][layerIndex][iX]) /
1277 totNComponents[cursor][layerIndex][iX]);
1280 if (layerIndex == layerBoundaries[cursor]) {
1284 boundaries.push_back(iY);
1288 TCanvas canv(
"canv",
"canv", 1000, 800);
1291 canv.SetTopMargin(0.05);
1292 canv.SetBottomMargin(0.07);
1293 canv.SetLeftMargin(0.13);
1294 canv.SetRightMargin(0.16);
1296 masterTable->SetStats(
false);
1297 masterTableColor->SetStats(
false);
1300 masterTable->SetMarkerColor(kBlack);
1301 masterTable->SetMarkerSize(1.5);
1303 float extremum =
std::abs(masterTableColor->GetMaximum()) >
std::abs(masterTableColor->GetMinimum())
1304 ?
std::abs(masterTableColor->GetMaximum())
1305 :
std::abs(masterTableColor->GetMinimum());
1307 masterTableColor->GetZaxis()->SetRangeUser(-extremum, extremum);
1308 masterTableColor->GetZaxis()->SetTitle(
"percent change [%]");
1309 masterTableColor->GetZaxis()->CenterTitle(
true);
1310 masterTableColor->GetZaxis()->SetTitleSize(0.05);
1312 masterTableColor->GetYaxis()->SetLabelSize(0.04);
1313 masterTableColor->GetXaxis()->SetLabelSize(0.06);
1315 masterTable->GetYaxis()->SetLabelSize(0.04);
1316 masterTable->GetXaxis()->SetLabelSize(0.06);
1318 masterTableColor->Draw(
"COLZ");
1319 masterTable->Draw(
"textsame");
1324 TLine
l[boundaries.size()];
1326 for (
const auto&
line : boundaries) {
1327 l[
i] = TLine(canv.cd()->GetUxmin(),
1328 masterTable->GetYaxis()->GetBinLowEdge(
line),
1329 canv.cd()->GetUxmax(),
1330 masterTable->GetYaxis()->GetBinLowEdge(
line));
1331 l[
i].SetLineWidth(2);
1332 l[
i].SetLineStyle(9);
1333 l[
i].SetLineColor(kMagenta);
1340 title.SetTextSize(0.045);
1341 title.SetTextColor(kBlue);
1350 delete f_siStripQuality_;
1351 delete l_siStripQuality_;
1360 using SiStripBadStripQualityComparisonSingleTag = SiStripBadStripQualityComparisonBase<1, MULTI_IOV>;
1361 using SiStripBadStripQualityComparisonTwoTags = SiStripBadStripQualityComparisonBase<2, SINGLE_IOV>;
static constexpr auto TEC
bool cleanUp(bool force=false)
std::pair< int, const char * > regionType(int index)
void fillBCArrays(const SiStripQuality *siStripQuality_, int NTkBadComponent[4], int NBadComponent[4][19][4], const TrackerTopology m_trackerTopo)
void add(uint32_t, const SiStripBadStrip::Range &)
static std::string to_string(const XMLCh *ch)
#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