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 SiStripBadStripFractionTH2PolyTkMap :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
195 SiStripBadStripFractionTH2PolyTkMap()
200 bool fill()
override {
202 gStyle->SetPalette(1);
204 auto tag = PlotBase::getTag<0>();
205 auto iov =
tag.iovs.front();
207 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
215 "Fraction of bad Strips per module, IOV: " + theIOVsince +
" (tag:#color[2]{" +
tagname +
"})";
218 myMap.bookMap(titleMap,
"Fraction of bad Strips per module");
221 ghost.bookMap(titleMap,
"");
223 std::vector<uint32_t> detid;
226 std::map<uint32_t, int> badStripsPerDetId;
228 for (
const auto&
d : detid) {
233 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
234 badStripsPerDetId[
d] +=
payload->decode(*badStrip).range;
236 float fraction = badStripsPerDetId[
d] / nStripsInModule;
238 ss_ <<
d <<
" :" << badStripsPerDetId[
d] <<
"/" << nStripsInModule <<
" = " <<
fraction <<
"\n";
246 edm::LogPrint(
"SiStripBadStripFractionTkMap") << ss_.str() << std::endl;
250 TCanvas
canvas(
"Bad Components fraction",
"bad components fraction");
251 myMap.drawMap(
canvas,
"");
252 ghost.drawMap(
canvas,
"same");
260 std::stringstream ss_;
267 class SiStripBadStripFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
269 SiStripBadStripFractionByRun()
271 ~SiStripBadStripFractionByRun()
override =
default;
277 std::vector<uint32_t> detid;
280 std::map<uint32_t, int> badStripsPerDetId;
282 for (
const auto&
d : detid) {
285 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
286 badStrips +=
payload.decode(*badStrip).range;
288 badStripsPerDetId[
d] = badStrips;
292 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
293 for (
const auto& det : all_detids) {
295 if (badStripsPerDetId.count(det) != 0)
308 class SiStripBadStripTIBFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
310 SiStripBadStripTIBFractionByRun()
312 "TIB Bad Strip fraction [%]") {}
313 ~SiStripBadStripTIBFractionByRun()
override =
default;
319 std::vector<uint32_t> detid;
322 std::map<uint32_t, int> badStripsPerDetId;
324 for (
const auto&
d : detid) {
327 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
328 badStrips +=
payload.decode(*badStrip).range;
330 badStripsPerDetId[
d] = badStrips;
334 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
335 for (
const auto& det : all_detids) {
340 if (badStripsPerDetId.count(det) != 0)
353 class SiStripBadStripTOBFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
355 SiStripBadStripTOBFractionByRun()
357 "TOB Bad Strip fraction [%]") {}
358 ~SiStripBadStripTOBFractionByRun()
override =
default;
364 std::vector<uint32_t> detid;
367 std::map<uint32_t, int> badStripsPerDetId;
369 for (
const auto&
d : detid) {
372 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
373 badStrips +=
payload.decode(*badStrip).range;
375 badStripsPerDetId[
d] = badStrips;
379 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
380 for (
const auto& det : all_detids) {
385 if (badStripsPerDetId.count(det) != 0)
398 class SiStripBadStripTIDFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
400 SiStripBadStripTIDFractionByRun()
402 "TID Bad Strip fraction [%]") {}
403 ~SiStripBadStripTIDFractionByRun()
override =
default;
409 std::vector<uint32_t> detid;
412 std::map<uint32_t, int> badStripsPerDetId;
414 for (
const auto&
d : detid) {
417 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
418 badStrips +=
payload.decode(*badStrip).range;
420 badStripsPerDetId[
d] = badStrips;
424 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
425 for (
const auto& det : all_detids) {
430 if (badStripsPerDetId.count(det) != 0)
443 class SiStripBadStripTECFractionByRun :
public HistoryPlot<SiStripBadStrip, float> {
445 SiStripBadStripTECFractionByRun()
447 "TEC Bad Strip fraction [%]") {}
448 ~SiStripBadStripTECFractionByRun()
override =
default;
454 std::vector<uint32_t> detid;
457 std::map<uint32_t, int> badStripsPerDetId;
459 for (
const auto&
d : detid) {
462 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
463 badStrips +=
payload.decode(*badStrip).range;
465 badStripsPerDetId[
d] = badStrips;
469 std::vector<uint32_t> all_detids = detInfo.getAllDetIds();
470 for (
const auto& det : all_detids) {
475 if (badStripsPerDetId.count(det) != 0)
488 class SiStripBadStripByRegion :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
490 SiStripBadStripByRegion()
495 bool fill()
override {
496 auto tag = PlotBase::getTag<0>();
497 auto iov =
tag.iovs.front();
498 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
500 std::vector<uint32_t> detid;
504 int totalBadStrips = 0;
506 for (
const auto&
d : detid) {
509 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
510 badStrips +=
payload->decode(*badStrip).range;
512 totalBadStrips += badStrips;
513 summaryBadStrips.add(
d, badStrips);
515 std::map<unsigned int, SiStripDetSummary::Values> mapBadStrips = summaryBadStrips.getCounts();
519 TCanvas
canvas(
"BadStrip Region summary",
"SiStripBadStrip region summary", 1200, 1000);
521 auto h_BadStrips = std::make_unique<TH1F>(
"BadStripsbyRegion",
522 "SiStrip Bad Strip summary by region;; n. bad strips",
525 mapBadStrips.size());
526 h_BadStrips->SetStats(
false);
528 canvas.SetBottomMargin(0.18);
529 canvas.SetLeftMargin(0.12);
530 canvas.SetRightMargin(0.05);
533 std::vector<int> boundaries;
534 unsigned int iBin = 0;
539 for (
const auto& element : mapBadStrips) {
541 int countBadStrips = (element.second.mean);
543 if (currentDetector.empty())
544 currentDetector =
"TIB";
546 switch ((element.first) / 1000) {
561 h_BadStrips->SetBinContent(iBin, countBadStrips);
563 h_BadStrips->GetXaxis()->LabelsOption(
"v");
566 boundaries.push_back(iBin);
571 h_BadStrips->SetMarkerStyle(21);
572 h_BadStrips->SetMarkerSize(1);
573 h_BadStrips->SetLineColor(kBlue);
574 h_BadStrips->SetLineStyle(9);
575 h_BadStrips->SetMarkerColor(kBlue);
576 h_BadStrips->GetYaxis()->SetRangeUser(0., h_BadStrips->GetMaximum() * 1.30);
577 h_BadStrips->GetYaxis()->SetTitleOffset(1.7);
578 h_BadStrips->Draw(
"HISTsame");
579 h_BadStrips->Draw(
"TEXTsame");
584 TLine
l[boundaries.size()];
586 for (
const auto&
line : boundaries) {
587 l[
i] = TLine(h_BadStrips->GetBinLowEdge(
line),
589 h_BadStrips->GetBinLowEdge(
line),
591 l[
i].SetLineWidth(1);
592 l[
i].SetLineStyle(9);
593 l[
i].SetLineColor(2);
598 TLegend
legend = TLegend(0.52, 0.82, 0.95, 0.9);
599 legend.SetHeader((std::get<1>(iov)).c_str(),
"C");
604 legend.SetTextSize(0.025);
621 template <
int ntags, IOVMultiplicity nIOVs>
622 class SiStripBadStripByRegionComparisonBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
624 SiStripBadStripByRegionComparisonBase()
629 bool fill()
override {
631 auto theIOVs = PlotBase::getTag<0>().iovs;
632 auto tagname1 = PlotBase::getTag<0>().
name;
634 auto firstiov = theIOVs.front();
635 std::tuple<cond::Time_t, cond::Hash> lastiov;
638 assert(this->m_plotAnnotations.ntags < 3);
640 if (this->m_plotAnnotations.ntags == 2) {
641 auto tag2iovs = PlotBase::getTag<1>().iovs;
642 tagname2 = PlotBase::getTag<1>().
name;
643 lastiov = tag2iovs.front();
645 lastiov = theIOVs.back();
648 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
649 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
655 std::vector<uint32_t> detid;
656 last_payload->getDetIds(detid);
659 int totalLastBadStrips = 0;
661 for (
const auto&
d : detid) {
664 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
665 badStrips += last_payload->decode(*badStrip).range;
667 totalLastBadStrips += badStrips;
668 summaryLastBadStrips.add(
d, badStrips);
670 std::map<unsigned int, SiStripDetSummary::Values> mapLastBadStrips = summaryLastBadStrips.getCounts();
675 first_payload->getDetIds(detid);
678 int totalFirstBadStrips = 0;
680 for (
const auto&
d : detid) {
683 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
684 badStrips += first_payload->decode(*badStrip).range;
686 totalFirstBadStrips += badStrips;
687 summaryFirstBadStrips.add(
d, badStrips);
689 std::map<unsigned int, SiStripDetSummary::Values> mapFirstBadStrips = summaryFirstBadStrips.getCounts();
693 TCanvas
canvas(
"BadStrip Partion summary",
"SiStripBadStrip region summary", 1200, 1000);
696 auto h_LastBadStrips = std::make_unique<TH1F>(
"BadStripsbyRegion1",
697 "SiStrip Bad Strip summary by region;; n. bad strips",
698 mapLastBadStrips.size(),
700 mapLastBadStrips.size());
701 h_LastBadStrips->SetStats(
false);
703 auto h_FirstBadStrips = std::make_unique<TH1F>(
"BadStripsbyRegion2",
704 "SiStrip Bad Strip summary by region;; n. bad strips",
705 mapFirstBadStrips.size(),
707 mapFirstBadStrips.size());
708 h_FirstBadStrips->SetStats(
false);
710 canvas.SetBottomMargin(0.18);
711 canvas.SetLeftMargin(0.12);
712 canvas.SetRightMargin(0.05);
715 std::vector<int> boundaries;
716 unsigned int iBin = 0;
721 for (
const auto& element : mapLastBadStrips) {
723 int countBadStrips = (element.second.mean);
725 if (currentDetector.empty())
726 currentDetector =
"TIB";
728 switch ((element.first) / 1000) {
743 h_LastBadStrips->SetBinContent(iBin, countBadStrips);
745 h_LastBadStrips->GetXaxis()->LabelsOption(
"v");
748 boundaries.push_back(iBin);
756 for (
const auto& element : mapFirstBadStrips) {
758 int countBadStrips = (element.second.mean);
760 h_FirstBadStrips->SetBinContent(iBin, countBadStrips);
762 h_FirstBadStrips->GetXaxis()->LabelsOption(
"v");
766 h_LastBadStrips->GetYaxis()->SetRangeUser(extrema.first, extrema.second);
768 h_LastBadStrips->SetMarkerStyle(21);
769 h_LastBadStrips->SetMarkerSize(1);
770 h_LastBadStrips->SetLineColor(kBlue);
771 h_LastBadStrips->SetFillColor(kBlue);
772 h_LastBadStrips->SetLineStyle(9);
773 h_LastBadStrips->SetMarkerColor(kBlue);
774 h_LastBadStrips->GetYaxis()->SetRangeUser(0., h_LastBadStrips->GetMaximum() * 1.30);
775 h_LastBadStrips->GetYaxis()->SetTitleOffset(1.7);
777 h_LastBadStrips->SetBarWidth(0.45);
778 h_LastBadStrips->SetBarOffset(0.1);
779 h_LastBadStrips->Draw(
"bar2");
780 h_LastBadStrips->Draw(
"TEXTsame");
782 h_FirstBadStrips->SetMarkerStyle(20);
783 h_FirstBadStrips->SetMarkerSize(1);
784 h_FirstBadStrips->SetFillColor(kRed);
785 h_FirstBadStrips->SetLineColor(kRed);
786 h_FirstBadStrips->SetLineStyle(1);
787 h_FirstBadStrips->SetMarkerColor(kRed);
788 h_FirstBadStrips->GetYaxis()->SetTitleOffset(1.7);
790 h_FirstBadStrips->SetBarWidth(0.4);
791 h_FirstBadStrips->SetBarOffset(0.55);
793 h_FirstBadStrips->Draw(
"bar2same");
794 h_FirstBadStrips->Draw(
"TEXT45same");
799 TLine
l[boundaries.size()];
801 for (
const auto&
line : boundaries) {
802 l[
i] = TLine(h_LastBadStrips->GetBinLowEdge(
line),
804 h_LastBadStrips->GetBinLowEdge(
line),
806 l[
i].SetLineWidth(1);
807 l[
i].SetLineStyle(9);
808 l[
i].SetLineColor(kMagenta);
813 TLegend
legend = TLegend(0.52, 0.82, 0.95, 0.9);
814 legend.SetHeader(
"Bad Components comparison",
"C");
816 h_LastBadStrips.get(),
820 legend.AddEntry(h_FirstBadStrips.get(),
825 legend.SetTextSize(0.025);
838 using SiStripBadStripByRegionComparisonSingleTag = SiStripBadStripByRegionComparisonBase<1, MULTI_IOV>;
839 using SiStripBadStripByRegionComparisonTwoTags = SiStripBadStripByRegionComparisonBase<2, SINGLE_IOV>;
845 template <
int ntags, IOVMultiplicity nIOVs>
846 class SiStripBadStripFractionComparisonTrackerMapBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
848 SiStripBadStripFractionComparisonTrackerMapBase()
851 bool fill()
override {
853 auto theIOVs = PlotBase::getTag<0>().iovs;
854 auto tagname1 = PlotBase::getTag<0>().
name;
856 auto firstiov = theIOVs.front();
857 std::tuple<cond::Time_t, cond::Hash> lastiov;
860 assert(this->m_plotAnnotations.ntags < 3);
862 if (this->m_plotAnnotations.ntags == 2) {
863 auto tag2iovs = PlotBase::getTag<1>().iovs;
864 tagname2 = PlotBase::getTag<1>().
name;
865 lastiov = tag2iovs.front();
867 lastiov = theIOVs.back();
870 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
871 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
880 "#Delta fraction of bad Strips per module (IOV:" + lastIOVsince +
" - IOV:" + firstIOVsince +
")";
882 std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>(
"SiStripBadStrips");
883 tmap->setTitle(titleMap);
886 std::vector<uint32_t> detid1;
887 last_payload->getDetIds(detid1);
889 std::map<uint32_t, float> FirstFractionPerDetId;
890 std::map<uint32_t, float> LastFractionPerDetId;
892 for (
const auto&
d : detid1) {
894 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
895 LastFractionPerDetId[
d] += last_payload->decode(*badStrip).range;
901 std::vector<uint32_t> detid2;
902 first_payload->getDetIds(detid2);
906 for (
const auto&
d : detid2) {
908 for (std::vector<unsigned int>::const_iterator badStrip =
range.first; badStrip !=
range.second; ++badStrip) {
909 FirstFractionPerDetId[
d] += first_payload->decode(*badStrip).range;
915 std::vector<uint32_t> allDetIds = detInfo.getAllDetIds();
918 int countLastButNotFirst(0);
919 int countFirstButNotLast(0);
923 for (
const auto&
d : allDetIds) {
924 if (LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
925 FirstFractionPerDetId.find(
d) == FirstFractionPerDetId.end()) {
926 tmap->fill(
d, LastFractionPerDetId[
d]);
928 countLastButNotFirst++;
930 }
else if (LastFractionPerDetId.find(
d) == LastFractionPerDetId.end() &&
931 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end()) {
932 tmap->fill(
d, -FirstFractionPerDetId[
d]);
934 countFirstButNotLast++;
936 }
else if (LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
937 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end()) {
938 float delta = (LastFractionPerDetId[
d] - FirstFractionPerDetId[
d]);
949 std::cout <<
"In 2 but not in 1:" << countLastButNotFirst << std::endl;
950 std::cout <<
"In 1 but not in 2:" << countFirstButNotLast << std::endl;
951 std::cout <<
"In both:" << countBoth << std::endl;
963 using SiStripBadStripFractionComparisonTrackerMapSingleTag =
964 SiStripBadStripFractionComparisonTrackerMapBase<1, MULTI_IOV>;
965 using SiStripBadStripFractionComparisonTrackerMapTwoTags =
966 SiStripBadStripFractionComparisonTrackerMapBase<2, SINGLE_IOV>;
972 class SiStripBadStripQualityAnalysis :
public PlotImage<SiStripBadStrip, SINGLE_IOV> {
974 SiStripBadStripQualityAnalysis()
979 bool fill()
override {
980 auto tag = PlotBase::getTag<0>();
981 auto iov =
tag.iovs.front();
982 std::shared_ptr<SiStripBadStrip>
payload = fetchPayload(std::get<1>(iov));
994 int NTkBadComponent[4] = {0};
999 int NBadComponent[4][19][4] = {{{0}}};
1008 std::stringstream
ss;
1010 ss <<
"\n-----------------\nGlobal Info\n-----------------";
1011 ss <<
"\nBadComponent \t Modules \tFibers " 1012 "\tApvs\tStrips\n----------------------------------------------------------------";
1013 ss <<
"\nTracker:\t\t" << NTkBadComponent[0] <<
"\t" << NTkBadComponent[1] <<
"\t" << NTkBadComponent[2] <<
"\t" 1014 << NTkBadComponent[3];
1016 ss <<
"\nTIB:\t\t\t" << NBadComponent[0][0][0] <<
"\t" << NBadComponent[0][0][1] <<
"\t" << NBadComponent[0][0][2]
1017 <<
"\t" << NBadComponent[0][0][3];
1018 ss <<
"\nTID:\t\t\t" << NBadComponent[1][0][0] <<
"\t" << NBadComponent[1][0][1] <<
"\t" << NBadComponent[1][0][2]
1019 <<
"\t" << NBadComponent[1][0][3];
1020 ss <<
"\nTOB:\t\t\t" << NBadComponent[2][0][0] <<
"\t" << NBadComponent[2][0][1] <<
"\t" << NBadComponent[2][0][2]
1021 <<
"\t" << NBadComponent[2][0][3];
1022 ss <<
"\nTEC:\t\t\t" << NBadComponent[3][0][0] <<
"\t" << NBadComponent[3][0][1] <<
"\t" << NBadComponent[3][0][2]
1023 <<
"\t" << NBadComponent[3][0][3];
1026 for (
int i = 1;
i < 5; ++
i)
1027 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << NBadComponent[0][
i][0] <<
"\t" << NBadComponent[0][
i][1] <<
"\t" 1028 << NBadComponent[0][
i][2] <<
"\t" << NBadComponent[0][
i][3];
1030 for (
int i = 1;
i < 4; ++
i)
1031 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 1032 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
1033 for (
int i = 4;
i < 7; ++
i)
1034 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t" 1035 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
1037 for (
int i = 1;
i < 7; ++
i)
1038 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << NBadComponent[2][
i][0] <<
"\t" << NBadComponent[2][
i][1] <<
"\t" 1039 << NBadComponent[2][
i][2] <<
"\t" << NBadComponent[2][
i][3];
1041 for (
int i = 1;
i < 10; ++
i)
1042 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 1043 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
1044 for (
int i = 10;
i < 19; ++
i)
1045 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t" 1046 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
1049 edm::LogInfo(
"SiStripBadStrip_PayloadInspector") <<
ss.str() << std::endl;
1052 auto masterTable = std::make_unique<TH2I>(
"table",
"", 4, 0., 4., 39, 0., 39.);
1054 std::string labelsX[4] = {
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1056 "Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
1057 "TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
1058 "TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
1059 "TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
1060 "TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
1061 "TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1063 for (
int iX = 0; iX <= 3; iX++) {
1064 masterTable->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1067 for (
int iY = 39; iY >= 1; iY--) {
1068 masterTable->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1072 int layerBoundaries[4] = {4, 6, 6, 18};
1073 std::vector<int> boundaries;
1074 boundaries.push_back(39);
1075 boundaries.push_back(35);
1079 for (
int iY = 39; iY >= 1; iY--) {
1080 for (
int iX = 0; iX <= 3; iX++) {
1082 masterTable->SetBinContent(iX + 1, iY, NTkBadComponent[iX]);
1083 }
else if (iY >= 35) {
1084 masterTable->SetBinContent(iX + 1, iY, NBadComponent[(39 - iY) - 1][0][iX]);
1089 masterTable->SetBinContent(iX + 1, iY, NBadComponent[cursor][layerIndex][iX]);
1092 if (layerIndex == layerBoundaries[cursor]) {
1096 boundaries.push_back(iY);
1100 TCanvas canv(
"canv",
"canv", 800, 800);
1103 canv.SetTopMargin(0.05);
1104 canv.SetBottomMargin(0.07);
1105 canv.SetLeftMargin(0.18);
1106 canv.SetRightMargin(0.05);
1108 masterTable->GetYaxis()->SetLabelSize(0.04);
1109 masterTable->GetXaxis()->SetLabelSize(0.05);
1111 masterTable->SetStats(
false);
1114 masterTable->Draw(
"text");
1119 TLine
l[boundaries.size()];
1121 for (
const auto&
line : boundaries) {
1122 l[
i] = TLine(canv.cd()->GetUxmin(),
1123 masterTable->GetYaxis()->GetBinLowEdge(
line),
1124 canv.cd()->GetUxmax(),
1125 masterTable->GetYaxis()->GetBinLowEdge(
line));
1126 l[
i].SetLineWidth(2);
1127 l[
i].SetLineStyle(9);
1128 l[
i].SetLineColor(kMagenta);
1135 title.SetTextSize(0.027);
1136 title.SetTextColor(kBlue);
1137 title.DrawLatexNDC(0.12, 0.97, (
"IOV: " +
std::to_string(std::get<0>(iov)) +
"| " + std::get<1>(iov)).c_str());
1141 delete siStripQuality_;
1153 template <
int ntags, IOVMultiplicity nIOVs>
1154 class SiStripBadStripQualityComparisonBase :
public PlotImage<SiStripBadStrip, nIOVs, ntags> {
1156 SiStripBadStripQualityComparisonBase()
1161 bool fill()
override {
1163 gStyle->SetPalette(kTemperatureMap);
1166 auto theIOVs = PlotBase::getTag<0>().iovs;
1167 auto tagname1 = PlotBase::getTag<0>().
name;
1169 auto firstiov = theIOVs.front();
1170 std::tuple<cond::Time_t, cond::Hash> lastiov;
1173 assert(this->m_plotAnnotations.ntags < 3);
1175 if (this->m_plotAnnotations.ntags == 2) {
1176 auto tag2iovs = PlotBase::getTag<1>().iovs;
1177 tagname2 = PlotBase::getTag<1>().
name;
1178 lastiov = tag2iovs.front();
1180 lastiov = theIOVs.back();
1183 std::shared_ptr<SiStripBadStrip> last_payload = this->fetchPayload(std::get<1>(lastiov));
1184 std::shared_ptr<SiStripBadStrip> first_payload = this->fetchPayload(std::get<1>(firstiov));
1192 int f_NTkBadComponent[4] = {0};
1193 int l_NTkBadComponent[4] = {0};
1196 int tot_NTkComponents[4] = {0};
1201 int f_NBadComponent[4][19][4] = {{{0}}};
1202 int l_NBadComponent[4][19][4] = {{{0}}};
1205 int totNComponents[4][19][4] = {{{0}}};
1207 const auto detInfo =
1210 f_siStripQuality_->
add(first_payload.get());
1218 l_siStripQuality_->
add(last_payload.get());
1235 auto masterTable = std::make_unique<TH2F>(
"table",
"", 4, 0., 4., 39, 0., 39.);
1236 auto masterTableColor = std::make_unique<TH2F>(
"colortable",
"", 4, 0., 4., 39, 0., 39.);
1238 std::string labelsX[4] = {
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1240 "Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
1241 "TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
1242 "TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
1243 "TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
1244 "TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
1245 "TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1247 for (
int iX = 0; iX <= 3; iX++) {
1248 masterTable->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1249 masterTableColor->GetXaxis()->SetBinLabel(iX + 1, labelsX[iX].c_str());
1252 for (
int iY = 39; iY >= 1; iY--) {
1253 masterTable->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1254 masterTableColor->GetYaxis()->SetBinLabel(iY, labelsY[39 - iY].c_str());
1258 int layerBoundaries[4] = {4, 6, 6, 18};
1259 std::vector<int> boundaries;
1260 boundaries.push_back(39);
1261 boundaries.push_back(35);
1265 for (
int iY = 39; iY >= 1; iY--) {
1266 for (
int iX = 0; iX <= 3; iX++) {
1268 masterTable->SetBinContent(iX + 1, iY, l_NTkBadComponent[iX] - f_NTkBadComponent[iX]);
1269 masterTableColor->SetBinContent(
1270 iX + 1, iY, 100 *
float(l_NTkBadComponent[iX] - f_NTkBadComponent[iX]) / tot_NTkComponents[iX]);
1272 }
else if (iY >= 35) {
1273 masterTable->SetBinContent(
1274 iX + 1, iY, (l_NBadComponent[(39 - iY) - 1][0][iX] - f_NBadComponent[(39 - iY) - 1][0][iX]));
1275 masterTableColor->SetBinContent(
1278 100 *
float(l_NBadComponent[(39 - iY) - 1][0][iX] - f_NBadComponent[(39 - iY) - 1][0][iX]) /
1279 totNComponents[(39 - iY) - 1][0][iX]);
1284 masterTable->SetBinContent(
1285 iX + 1, iY, (l_NBadComponent[cursor][layerIndex][iX] - f_NBadComponent[cursor][layerIndex][iX]));
1286 masterTableColor->SetBinContent(
1289 100 *
float(l_NBadComponent[cursor][layerIndex][iX] - f_NBadComponent[cursor][layerIndex][iX]) /
1290 totNComponents[cursor][layerIndex][iX]);
1293 if (layerIndex == layerBoundaries[cursor]) {
1297 boundaries.push_back(iY);
1301 TCanvas canv(
"canv",
"canv", 1000, 800);
1304 canv.SetTopMargin(0.05);
1305 canv.SetBottomMargin(0.07);
1306 canv.SetLeftMargin(0.13);
1307 canv.SetRightMargin(0.16);
1309 masterTable->SetStats(
false);
1310 masterTableColor->SetStats(
false);
1313 masterTable->SetMarkerColor(kBlack);
1314 masterTable->SetMarkerSize(1.5);
1316 float extremum =
std::abs(masterTableColor->GetMaximum()) >
std::abs(masterTableColor->GetMinimum())
1317 ?
std::abs(masterTableColor->GetMaximum())
1318 :
std::abs(masterTableColor->GetMinimum());
1320 masterTableColor->GetZaxis()->SetRangeUser(-extremum, extremum);
1321 masterTableColor->GetZaxis()->SetTitle(
"percent change [%]");
1322 masterTableColor->GetZaxis()->CenterTitle(
true);
1323 masterTableColor->GetZaxis()->SetTitleSize(0.05);
1325 masterTableColor->GetYaxis()->SetLabelSize(0.04);
1326 masterTableColor->GetXaxis()->SetLabelSize(0.06);
1328 masterTable->GetYaxis()->SetLabelSize(0.04);
1329 masterTable->GetXaxis()->SetLabelSize(0.06);
1331 masterTableColor->Draw(
"COLZ");
1332 masterTable->Draw(
"textsame");
1337 TLine
l[boundaries.size()];
1339 for (
const auto&
line : boundaries) {
1340 l[
i] = TLine(canv.cd()->GetUxmin(),
1341 masterTable->GetYaxis()->GetBinLowEdge(
line),
1342 canv.cd()->GetUxmax(),
1343 masterTable->GetYaxis()->GetBinLowEdge(
line));
1344 l[
i].SetLineWidth(2);
1345 l[
i].SetLineStyle(9);
1346 l[
i].SetLineColor(kMagenta);
1353 title.SetTextSize(0.045);
1354 title.SetTextColor(kBlue);
1363 delete f_siStripQuality_;
1364 delete l_siStripQuality_;
1373 using SiStripBadStripQualityComparisonSingleTag = SiStripBadStripQualityComparisonBase<1, MULTI_IOV>;
1374 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::Warning, true > LogPrint
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