46 #include "TPaveStats.h" 57 SiStripBadStripTest() :
cond::payloadInspector::Histogram1D<
SiStripBadStrip>(
"SiStrip Bad Strip test",
58 "SiStrip Bad Strip test", 10,0.0,10.0){
62 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
63 for (
auto const & iov: iovs) {
70 ss <<
"Summary of bad strips:" << std::endl;
76 std::vector<uint32_t> detid;
77 payload->getDetIds(detid);
79 for (
const auto &
d : detid) {
81 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
82 ss <<
"DetId="<<
d <<
" Strip=" << payload->decode(*badStrip).firstStrip <<
":"<< payload->decode(*badStrip).range <<
" flag="<< payload->decode(*badStrip).flag << std::endl;
99 SiStripBadModuleTrackerMap() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"Tracker Map of SiStrip Bad Strips" ){
100 setSingleIov(
true );
103 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
104 auto iov = iovs.front();
105 std::shared_ptr<SiStripBadStrip> payload = fetchPayload( std::get<1>(iov) );
107 std::string titleMap =
"Module with at least a bad Strip (payload : "+std::get<1>(iov)+
")";
109 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripBadStrips"));
110 tmap->setTitle(titleMap);
113 std::vector<uint32_t> detid;
114 payload->getDetIds(detid);
116 for (
const auto &
d : detid) {
134 SiStripBadStripFractionTrackerMap() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"Tracker Map of SiStrip Bad Components fraction" ){
135 setSingleIov(
true );
138 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
139 auto iov = iovs.front();
140 std::shared_ptr<SiStripBadStrip> payload = fetchPayload( std::get<1>(iov) );
145 std::string titleMap =
"Fraction of bad Strips per module (payload : "+std::get<1>(iov)+
")";
147 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripBadStrips"));
148 tmap->setTitle(titleMap);
151 std::vector<uint32_t> detid;
152 payload->getDetIds(detid);
154 std::map<uint32_t,int> badStripsPerDetId;
156 for (
const auto &
d : detid) {
158 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
159 badStripsPerDetId[
d]+= payload->decode(*badStrip).range;
163 tmap->fill(
d,fraction);
168 std::pair<float,float> extrema = tmap->getAutomaticRange();
173 if (extrema.first!=extrema.second){
176 tmap->save(
true,extrema.first*0.95,extrema.first*1.05,
fileName);
190 SiStripBadStripFractionByRun() :
cond::payloadInspector::HistoryPlot<
SiStripBadStrip,
float>(
"SiStrip Bad Strip fraction per run",
"Bad Strip fraction [%]"){}
191 ~SiStripBadStripFractionByRun()
override =
default;
198 std::vector<uint32_t> detid;
201 std::map<uint32_t,int> badStripsPerDetId;
203 for (
const auto &
d : detid) {
206 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
209 badStripsPerDetId[
d] = badStrips;
213 std::vector<uint32_t> all_detids=reader->
getAllDetIds();
214 for (
const auto & det : all_detids) {
216 if(badStripsPerDetId.count(det)!=0)
numerator+= badStripsPerDetId[det];
231 SiStripBadStripTIBFractionByRun() :
cond::payloadInspector::HistoryPlot<
SiStripBadStrip,
float>(
"SiStrip Inner Barrel Bad Strip fraction per run",
"TIB Bad Strip fraction [%]"){}
232 ~SiStripBadStripTIBFractionByRun()
override =
default;
239 std::vector<uint32_t> detid;
242 std::map<uint32_t,int> badStripsPerDetId;
244 for (
const auto &
d : detid) {
247 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
250 badStripsPerDetId[
d] = badStrips;
254 std::vector<uint32_t> all_detids=reader->
getAllDetIds();
255 for (
const auto & det : all_detids) {
259 if(badStripsPerDetId.count(det)!=0)
numerator+= badStripsPerDetId[det];
274 SiStripBadStripTOBFractionByRun() :
cond::payloadInspector::HistoryPlot<
SiStripBadStrip,
float>(
"SiStrip Outer Barrel Bad Strip fraction per run",
"TOB Bad Strip fraction [%]"){}
275 ~SiStripBadStripTOBFractionByRun()
override =
default;
282 std::vector<uint32_t> detid;
285 std::map<uint32_t,int> badStripsPerDetId;
287 for (
const auto &
d : detid) {
290 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
293 badStripsPerDetId[
d] = badStrips;
297 std::vector<uint32_t> all_detids=reader->
getAllDetIds();
298 for (
const auto & det : all_detids) {
302 if(badStripsPerDetId.count(det)!=0)
numerator+= badStripsPerDetId[det];
317 SiStripBadStripTIDFractionByRun() :
cond::payloadInspector::HistoryPlot<
SiStripBadStrip,
float>(
"SiStrip Inner Disks Bad Strip fraction per run",
"TID Bad Strip fraction [%]"){}
318 ~SiStripBadStripTIDFractionByRun()
override =
default;
325 std::vector<uint32_t> detid;
328 std::map<uint32_t,int> badStripsPerDetId;
330 for (
const auto &
d : detid) {
333 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
336 badStripsPerDetId[
d] = badStrips;
340 std::vector<uint32_t> all_detids=reader->
getAllDetIds();
341 for (
const auto & det : all_detids) {
345 if(badStripsPerDetId.count(det)!=0)
numerator+= badStripsPerDetId[det];
360 SiStripBadStripTECFractionByRun() :
cond::payloadInspector::HistoryPlot<
SiStripBadStrip,
float>(
"SiStrip Endcaps Bad Strip fraction per run",
"TEC Bad Strip fraction [%]"){}
361 ~SiStripBadStripTECFractionByRun()
override =
default;
368 std::vector<uint32_t> detid;
371 std::map<uint32_t,int> badStripsPerDetId;
373 for (
const auto &
d : detid) {
376 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
379 badStripsPerDetId[
d] = badStrips;
383 std::vector<uint32_t> all_detids=reader->
getAllDetIds();
384 for (
const auto & det : all_detids) {
388 if(badStripsPerDetId.count(det)!=0)
numerator+= badStripsPerDetId[det];
403 SiStripBadStripByRegion() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"SiStrip BadStrip By Region" ),
406 setSingleIov(
true );
409 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
410 auto iov = iovs.front();
411 std::shared_ptr<SiStripBadStrip> payload = fetchPayload( std::get<1>(iov) );
413 std::vector<uint32_t> detid;
414 payload->getDetIds(detid);
417 int totalBadStrips =0;
419 for (
const auto &
d : detid) {
422 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
423 badStrips+= payload->decode(*badStrip).range;
425 totalBadStrips+=badStrips;
426 summaryBadStrips.add(
d,badStrips);
428 std::map<unsigned int, SiStripDetSummary::Values> mapBadStrips = summaryBadStrips.getCounts();
432 TCanvas
canvas(
"BadStrip Region summary",
"SiStripBadStrip region summary",1200,1000);
434 auto h_BadStrips = std::unique_ptr<TH1F>(
new TH1F(
"BadStripsbyRegion",
"SiStrip Bad Strip summary by region;; n. bad strips",mapBadStrips.size(),0.,mapBadStrips.size()));
435 h_BadStrips->SetStats(
false);
437 canvas.SetBottomMargin(0.18);
438 canvas.SetLeftMargin(0.12);
439 canvas.SetRightMargin(0.05);
442 std::vector<int> boundaries;
448 for (
const auto &element : mapBadStrips){
450 int countBadStrips = (element.second.mean);
452 if(currentDetector.empty()) currentDetector=
"TIB";
454 switch ((element.first)/1000)
470 h_BadStrips->SetBinContent(iBin,countBadStrips);
472 h_BadStrips->GetXaxis()->LabelsOption(
"v");
474 if(detector!=currentDetector) {
475 boundaries.push_back(iBin);
480 h_BadStrips->SetMarkerStyle(21);
481 h_BadStrips->SetMarkerSize(1);
482 h_BadStrips->SetLineColor(kBlue);
483 h_BadStrips->SetLineStyle(9);
484 h_BadStrips->SetMarkerColor(kBlue);
485 h_BadStrips->GetYaxis()->SetRangeUser(0.,h_BadStrips->GetMaximum()*1.30);
486 h_BadStrips->GetYaxis()->SetTitleOffset(1.7);
487 h_BadStrips->Draw(
"HISTsame");
488 h_BadStrips->Draw(
"TEXTsame");
493 TLine
l[boundaries.size()];
495 for (
const auto &
line : boundaries){
496 l[
i] = TLine(h_BadStrips->GetBinLowEdge(
line),
canvas.cd()->GetUymin(),h_BadStrips->GetBinLowEdge(
line),
canvas.cd()->GetUymax());
497 l[
i].SetLineWidth(1);
498 l[
i].SetLineStyle(9);
499 l[
i].SetLineColor(2);
504 TLegend
legend = TLegend(0.52,0.82,0.95,0.9);
505 legend.SetHeader((std::get<1>(iov)).c_str(),
"C");
506 legend.AddEntry(h_BadStrips.get(),(
"IOV: "+std::to_string(std::get<0>(iov))+
"| n. of bad strips:"+std::to_string(totalBadStrips)).c_str(),
"PL");
507 legend.SetTextSize(0.025);
526 SiStripBadStripByRegionComparison() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"SiStrip BadStrip By Region Comparison" ),
529 setSingleIov(
false );
532 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
534 std::vector<std::tuple<cond::Time_t,cond::Hash> > sorted_iovs = iovs;
537 std::sort(
begin(sorted_iovs),
end(sorted_iovs), [](
auto const &t1,
auto const &t2) {
538 return std::get<0>(t1) < std::get<0>(t2);
541 auto firstiov = sorted_iovs.front();
542 auto lastiov = sorted_iovs.back();
544 std::shared_ptr<SiStripBadStrip> last_payload = fetchPayload( std::get<1>(lastiov) );
545 std::shared_ptr<SiStripBadStrip> first_payload = fetchPayload( std::get<1>(firstiov) );
547 std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
548 std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
551 std::vector<uint32_t> detid;
552 last_payload->getDetIds(detid);
555 int totalLastBadStrips =0;
557 for (
const auto &
d : detid) {
560 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
561 badStrips+=last_payload->decode(*badStrip).range;
563 totalLastBadStrips+=badStrips;
564 summaryLastBadStrips.add(
d,badStrips);
566 std::map<unsigned int, SiStripDetSummary::Values> mapLastBadStrips = summaryLastBadStrips.getCounts();
571 first_payload->getDetIds(detid);
574 int totalFirstBadStrips =0;
576 for (
const auto &
d : detid) {
579 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
580 badStrips+=first_payload->decode(*badStrip).range;
582 totalFirstBadStrips+=badStrips;
583 summaryFirstBadStrips.add(
d,badStrips);
585 std::map<unsigned int, SiStripDetSummary::Values> mapFirstBadStrips = summaryFirstBadStrips.getCounts();
589 TCanvas
canvas(
"BadStrip Partion summary",
"SiStripBadStrip region summary",1200,1000);
592 auto h_LastBadStrips = std::unique_ptr<TH1F>(
new TH1F(
"BadStripsbyRegion1",
"SiStrip Bad Strip summary by region;; n. bad strips",mapLastBadStrips.size(),0.,mapLastBadStrips.size()));
593 h_LastBadStrips->SetStats(
false);
595 auto h_FirstBadStrips = std::unique_ptr<TH1F>(
new TH1F(
"BadStripsbyRegion2",
"SiStrip Bad Strip summary by region;; n. bad strips",mapFirstBadStrips.size(),0.,mapFirstBadStrips.size()));
596 h_FirstBadStrips->SetStats(
false);
598 canvas.SetBottomMargin(0.18);
599 canvas.SetLeftMargin(0.12);
600 canvas.SetRightMargin(0.05);
603 std::vector<int> boundaries;
609 for (
const auto &element : mapLastBadStrips){
611 int countBadStrips = (element.second.mean);
613 if(currentDetector.empty()) currentDetector=
"TIB";
615 switch ((element.first)/1000)
631 h_LastBadStrips->SetBinContent(iBin,countBadStrips);
633 h_LastBadStrips->GetXaxis()->LabelsOption(
"v");
635 if(detector!=currentDetector) {
636 boundaries.push_back(iBin);
644 for (
const auto &element : mapFirstBadStrips){
646 int countBadStrips = (element.second.mean);
648 h_FirstBadStrips->SetBinContent(iBin,countBadStrips);
650 h_FirstBadStrips->GetXaxis()->LabelsOption(
"v");
655 h_LastBadStrips->GetYaxis()->SetRangeUser(extrema.first,extrema.second);
657 h_LastBadStrips->SetMarkerStyle(21);
658 h_LastBadStrips->SetMarkerSize(1);
659 h_LastBadStrips->SetLineColor(kBlue);
660 h_LastBadStrips->SetFillColor(kBlue);
661 h_LastBadStrips->SetLineStyle(9);
662 h_LastBadStrips->SetMarkerColor(kBlue);
663 h_LastBadStrips->GetYaxis()->SetRangeUser(0.,h_LastBadStrips->GetMaximum()*1.30);
664 h_LastBadStrips->GetYaxis()->SetTitleOffset(1.7);
666 h_LastBadStrips->SetBarWidth(0.45);
667 h_LastBadStrips->SetBarOffset(0.1);
668 h_LastBadStrips->Draw(
"bar2");
669 h_LastBadStrips->Draw(
"TEXTsame");
671 h_FirstBadStrips->SetMarkerStyle(20);
672 h_FirstBadStrips->SetMarkerSize(1);
673 h_FirstBadStrips->SetFillColor(kRed);
674 h_FirstBadStrips->SetLineColor(kRed);
675 h_FirstBadStrips->SetLineStyle(1);
676 h_FirstBadStrips->SetMarkerColor(kRed);
677 h_FirstBadStrips->GetYaxis()->SetTitleOffset(1.7);
679 h_FirstBadStrips->SetBarWidth(0.4);
680 h_FirstBadStrips->SetBarOffset(0.55);
682 h_FirstBadStrips->Draw(
"bar2same");
683 h_FirstBadStrips->Draw(
"TEXT45same");
688 TLine l[boundaries.size()];
690 for (
const auto &
line : boundaries){
691 l[
i] = TLine(h_LastBadStrips->GetBinLowEdge(
line),
canvas.cd()->GetUymin(),h_LastBadStrips->GetBinLowEdge(
line),
canvas.cd()->GetUymax());
692 l[
i].SetLineWidth(1);
693 l[
i].SetLineStyle(9);
694 l[
i].SetLineColor(kMagenta);
699 TLegend legend = TLegend(0.52,0.82,0.95,0.9);
700 legend.SetHeader(
"Bad Components comparison",
"C");
701 legend.AddEntry(h_LastBadStrips.get(),(
"IOV: "+std::to_string(std::get<0>(lastiov))+
"| n. of bad strips:"+std::to_string(totalLastBadStrips)).c_str(),
"PL");
702 legend.AddEntry(h_FirstBadStrips.get(),(
"IOV: "+std::to_string(std::get<0>(firstiov))+
"| n. of bad strips:"+std::to_string(totalFirstBadStrips)).c_str(),
"PL");
703 legend.SetTextSize(0.025);
720 SiStripBadStripFractionComparisonTrackerMap() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"Tracker Map of SiStrip bad strip fraction difference" ){
721 setSingleIov(
false );
724 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
726 std::vector<std::tuple<cond::Time_t,cond::Hash> > sorted_iovs = iovs;
729 std::sort(
begin(sorted_iovs),
end(sorted_iovs), [](
auto const &t1,
auto const &t2) {
730 return std::get<0>(t1) < std::get<0>(t2);
733 auto firstiov = sorted_iovs.front();
734 auto lastiov = sorted_iovs.back();
736 std::shared_ptr<SiStripBadStrip> last_payload = fetchPayload( std::get<1>(lastiov) );
737 std::shared_ptr<SiStripBadStrip> first_payload = fetchPayload( std::get<1>(firstiov) );
739 std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
740 std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
745 std::string titleMap =
"#Delta fraction of bad Strips per module (IOV:"+lastIOVsince+
" - IOV:"+firstIOVsince+
")";
747 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripBadStrips"));
748 tmap->setTitle(titleMap);
751 std::vector<uint32_t> detid1;
752 last_payload->getDetIds(detid1);
754 std::map<uint32_t,float> FirstFractionPerDetId;
755 std::map<uint32_t,float> LastFractionPerDetId;
757 for (
const auto &
d : detid1) {
759 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
760 LastFractionPerDetId[
d]+= last_payload->decode(*badStrip).range;
766 std::vector<uint32_t> detid2;
767 first_payload->getDetIds(detid2);
771 for (
const auto &
d : detid2) {
773 for( std::vector<unsigned int>::const_iterator badStrip = range.first;badStrip != range.second; ++badStrip ) {
774 FirstFractionPerDetId[
d]+= first_payload->decode(*badStrip).range;
780 std::vector<uint32_t> allDetIds = reader->
getAllDetIds();
782 int countLastButNotFirst(0);
783 int countFirstButNotLast(0);
786 for (
const auto &
d: allDetIds ){
787 if( LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
788 FirstFractionPerDetId.find(
d) == FirstFractionPerDetId.end() ) {
790 tmap->fill(
d,LastFractionPerDetId[
d]);
791 countLastButNotFirst++;
793 else if ( LastFractionPerDetId.find(
d) == LastFractionPerDetId.end() &&
794 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end() ) {
796 tmap->fill(
d,-FirstFractionPerDetId[
d]);
797 countFirstButNotLast++;
799 else if ( LastFractionPerDetId.find(
d) != LastFractionPerDetId.end() &&
800 FirstFractionPerDetId.find(
d) != FirstFractionPerDetId.end() ) {
802 float delta = (LastFractionPerDetId[
d] - FirstFractionPerDetId[
d]);
832 SiStripBadStripQualityAnalysis() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"SiStrip BadStrip Quality Analysis" ),
835 setSingleIov(
true );
838 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
839 auto iov = iovs.front();
840 std::shared_ptr<SiStripBadStrip> payload = fetchPayload( std::get<1>(iov) );
843 siStripQuality_->
add(payload.get());
850 int NTkBadComponent[4] = {0};
855 int NBadComponent[4][19][4] = {{{0}}};
864 std::stringstream ss;
866 ss <<
"\n-----------------\nGlobal Info\n-----------------";
867 ss <<
"\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
868 ss <<
"\nTracker:\t\t"<<NTkBadComponent[0]<<
"\t"<<NTkBadComponent[1]<<
"\t"<<NTkBadComponent[2]<<
"\t"<<NTkBadComponent[3];
870 ss <<
"\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<
"\t"<<NBadComponent[0][0][1]<<
"\t"<<NBadComponent[0][0][2]<<
"\t"<<NBadComponent[0][0][3];
871 ss <<
"\nTID:\t\t\t"<<NBadComponent[1][0][0]<<
"\t"<<NBadComponent[1][0][1]<<
"\t"<<NBadComponent[1][0][2]<<
"\t"<<NBadComponent[1][0][3];
872 ss <<
"\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<
"\t"<<NBadComponent[2][0][1]<<
"\t"<<NBadComponent[2][0][2]<<
"\t"<<NBadComponent[2][0][3];
873 ss <<
"\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<
"\t"<<NBadComponent[3][0][1]<<
"\t"<<NBadComponent[3][0][2]<<
"\t"<<NBadComponent[3][0][3];
876 for (
int i=1;i<5;++
i)
877 ss <<
"\nTIB Layer " << i <<
" :\t\t"<<NBadComponent[0][i][0]<<
"\t"<<NBadComponent[0][i][1]<<
"\t"<<NBadComponent[0][i][2]<<
"\t"<<NBadComponent[0][i][3];
879 for (
int i=1;i<4;++
i)
880 ss <<
"\nTID+ Disk " << i <<
" :\t\t"<<NBadComponent[1][i][0]<<
"\t"<<NBadComponent[1][i][1]<<
"\t"<<NBadComponent[1][i][2]<<
"\t"<<NBadComponent[1][i][3];
881 for (
int i=4;i<7;++
i)
882 ss <<
"\nTID- Disk " << i-3 <<
" :\t\t"<<NBadComponent[1][i][0]<<
"\t"<<NBadComponent[1][i][1]<<
"\t"<<NBadComponent[1][i][2]<<
"\t"<<NBadComponent[1][i][3];
884 for (
int i=1;i<7;++
i)
885 ss <<
"\nTOB Layer " << i <<
" :\t\t"<<NBadComponent[2][i][0]<<
"\t"<<NBadComponent[2][i][1]<<
"\t"<<NBadComponent[2][i][2]<<
"\t"<<NBadComponent[2][i][3];
887 for (
int i=1;i<10;++
i)
888 ss <<
"\nTEC+ Disk " << i <<
" :\t\t"<<NBadComponent[3][i][0]<<
"\t"<<NBadComponent[3][i][1]<<
"\t"<<NBadComponent[3][i][2]<<
"\t"<<NBadComponent[3][i][3];
889 for (
int i=10;i<19;++
i)
890 ss <<
"\nTEC- Disk " << i-9 <<
" :\t\t"<<NBadComponent[3][i][0]<<
"\t"<<NBadComponent[3][i][1]<<
"\t"<<NBadComponent[3][i][2]<<
"\t"<<NBadComponent[3][i][3];
893 edm::LogInfo(
"SiStripBadStrip_PayloadInspector") << ss.str() << std::endl;
896 auto masterTable = std::unique_ptr<TH2I>(
new TH2I(
"table",
"",4,0.,4.,39,0.,39.));
898 std::string labelsX[4]={
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
899 std::string labelsY[40]={
"Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
"TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
"TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
"TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
"TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
"TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
901 for(
int iX=0;iX<=3;iX++){
902 masterTable->GetXaxis()->SetBinLabel(iX+1,labelsX[iX].c_str());
905 for(
int iY=39;iY>=1;iY--){
906 masterTable->GetYaxis()->SetBinLabel(iY,labelsY[39-iY].c_str());
910 int layerBoundaries[4] = {4,6,6,18};
911 std::vector<int> boundaries;
912 boundaries.push_back(39);
913 boundaries.push_back(35);
917 for(
int iY=39;iY>=1;iY--){
918 for(
int iX=0;iX<=3;iX++){
920 masterTable->SetBinContent(iX+1,iY,NTkBadComponent[iX]);
922 masterTable->SetBinContent(iX+1,iY,NBadComponent[(39-iY)-1][0][iX]);
924 if(iX==0) layerIndex++;
926 masterTable->SetBinContent(iX+1,iY,NBadComponent[cursor][layerIndex][iX]);
929 if(layerIndex==layerBoundaries[cursor]){
933 boundaries.push_back(iY);
937 TCanvas canv(
"canv",
"canv",800,800);
940 canv.SetTopMargin(0.05);
941 canv.SetBottomMargin(0.07);
942 canv.SetLeftMargin(0.18);
943 canv.SetRightMargin(0.05);
945 masterTable->GetYaxis()->SetLabelSize(0.04);
946 masterTable->GetXaxis()->SetLabelSize(0.05);
948 masterTable->SetStats(
false);
951 masterTable->Draw(
"text");
956 TLine l[boundaries.size()];
958 for (
const auto &
line : boundaries){
959 l[
i] = TLine(canv.cd()->GetUxmin(),masterTable->GetYaxis()->GetBinLowEdge(
line),canv.cd()->GetUxmax(),masterTable->GetYaxis()->GetBinLowEdge(
line));
960 l[
i].SetLineWidth(2);
961 l[
i].SetLineStyle(9);
962 l[
i].SetLineColor(kMagenta);
969 title.SetTextSize(0.027);
970 title.SetTextColor(kBlue);
971 title.DrawLatexNDC(0.12,0.97,(
"IOV: "+std::to_string(std::get<0>(iov))+
"| "+std::get<1>(iov)).c_str());
975 delete siStripQuality_;
988 SiStripBadStripQualityComparison() :
cond::payloadInspector::PlotImage<
SiStripBadStrip>(
"SiStrip BadStrip Quality Comparison Analysis" ),
991 setSingleIov(
false );
994 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
997 gStyle->SetPalette(kTemperatureMap);
999 std::vector<std::tuple<cond::Time_t,cond::Hash> > sorted_iovs = iovs;
1002 std::sort(
begin(sorted_iovs),
end(sorted_iovs), [](
auto const &t1,
auto const &t2) {
1003 return std::get<0>(t1) < std::get<0>(t2);
1006 auto firstiov = sorted_iovs.front();
1007 auto lastiov = sorted_iovs.back();
1009 std::shared_ptr<SiStripBadStrip> last_payload = fetchPayload( std::get<1>(lastiov) );
1010 std::shared_ptr<SiStripBadStrip> first_payload = fetchPayload( std::get<1>(firstiov) );
1012 std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
1013 std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
1018 int f_NTkBadComponent[4] = {0};
1019 int l_NTkBadComponent[4] = {0};
1022 int tot_NTkComponents[4] = {0};
1027 int f_NBadComponent[4][19][4] = {{{0}}};
1028 int l_NBadComponent[4][19][4] = {{{0}}};
1031 int totNComponents[4][19][4] = {{{0}}};
1034 f_siStripQuality_->
add(first_payload.get());
1042 l_siStripQuality_->
add(last_payload.get());
1059 auto masterTable = std::unique_ptr<TH2F>(
new TH2F(
"table",
"",4,0.,4.,39,0.,39.));
1060 auto masterTableColor = std::unique_ptr<TH2F>(
new TH2F(
"colortable",
"",4,0.,4.,39,0.,39.));
1062 std::string labelsX[4]={
"Bad Modules",
"Bad Fibers",
"Bad APVs",
"Bad Strips"};
1063 std::string labelsY[40]={
"Tracker",
"TIB",
"TID",
"TOB",
"TEC",
"TIB Layer 1",
"TIB Layer 2",
"TIB Layer 3",
"TIB Layer 4",
"TID+ Disk 1",
"TID+ Disk 2",
"TID+ Disk 3",
"TID- Disk 1",
"TID- Disk 2",
"TID- Disk 3",
"TOB Layer 1",
"TOB Layer 2",
"TOB Layer 3",
"TOB Layer 4",
"TOB Layer 5",
"TOB Layer 6",
"TEC+ Disk 1",
"TEC+ Disk 2",
"TEC+ Disk 3",
"TEC+ Disk 4",
"TEC+ Disk 5",
"TEC+ Disk 6",
"TEC+ Disk 7",
"TEC+ Disk 8",
"TEC+ Disk 9",
"TEC- Disk 1",
"TEC- Disk 2",
"TEC- Disk 3",
"TEC- Disk 4",
"TEC- Disk 5",
"TEC- Disk 6",
"TEC- Disk 7",
"TEC- Disk 8",
"TEC- Disk 9"};
1065 for(
int iX=0;iX<=3;iX++){
1066 masterTable->GetXaxis()->SetBinLabel(iX+1,labelsX[iX].c_str());
1067 masterTableColor->GetXaxis()->SetBinLabel(iX+1,labelsX[iX].c_str());
1070 for(
int iY=39;iY>=1;iY--){
1071 masterTable->GetYaxis()->SetBinLabel(iY,labelsY[39-iY].c_str());
1072 masterTableColor->GetYaxis()->SetBinLabel(iY,labelsY[39-iY].c_str());
1076 int layerBoundaries[4] = {4,6,6,18};
1077 std::vector<int> boundaries;
1078 boundaries.push_back(39);
1079 boundaries.push_back(35);
1083 for(
int iY=39;iY>=1;iY--){
1084 for(
int iX=0;iX<=3;iX++){
1086 masterTable->SetBinContent(iX+1,iY,l_NTkBadComponent[iX]-f_NTkBadComponent[iX]);
1087 masterTableColor->SetBinContent(iX+1,iY,100*
float(l_NTkBadComponent[iX]-f_NTkBadComponent[iX])/tot_NTkComponents[iX]);
1090 masterTable->SetBinContent(iX+1,iY,(l_NBadComponent[(39-iY)-1][0][iX]-f_NBadComponent[(39-iY)-1][0][iX]));
1091 masterTableColor->SetBinContent(iX+1,iY,100*
float(l_NBadComponent[(39-iY)-1][0][iX]-f_NBadComponent[(39-iY)-1][0][iX])/totNComponents[(39-iY)-1][0][iX]);
1093 if(iX==0) layerIndex++;
1095 masterTable->SetBinContent(iX+1,iY,(l_NBadComponent[cursor][layerIndex][iX]-f_NBadComponent[cursor][layerIndex][iX]));
1096 masterTableColor->SetBinContent(iX+1,iY,100*
float(l_NBadComponent[cursor][layerIndex][iX]-f_NBadComponent[cursor][layerIndex][iX])/totNComponents[cursor][layerIndex][iX]);
1099 if(layerIndex==layerBoundaries[cursor]){
1103 boundaries.push_back(iY);
1107 TCanvas canv(
"canv",
"canv",1000,800);
1110 canv.SetTopMargin(0.05);
1111 canv.SetBottomMargin(0.07);
1112 canv.SetLeftMargin(0.13);
1113 canv.SetRightMargin(0.16);
1115 masterTable->SetStats(
false);
1116 masterTableColor->SetStats(
false);
1119 masterTable->SetMarkerColor(kBlack);
1120 masterTable->SetMarkerSize(1.5);
1122 float extremum =
std::abs(masterTableColor->GetMaximum()) >
std::abs(masterTableColor->GetMinimum()) ?
std::abs(masterTableColor->GetMaximum()) :
std::abs(masterTableColor->GetMinimum());
1124 masterTableColor->GetZaxis()->SetRangeUser(-extremum,extremum);
1125 masterTableColor->GetZaxis()->SetTitle(
"percent change [%]");
1126 masterTableColor->GetZaxis()->CenterTitle(
true);
1127 masterTableColor->GetZaxis()->SetTitleSize(0.05);
1129 masterTableColor->GetYaxis()->SetLabelSize(0.04);
1130 masterTableColor->GetXaxis()->SetLabelSize(0.06);
1132 masterTable->GetYaxis()->SetLabelSize(0.04);
1133 masterTable->GetXaxis()->SetLabelSize(0.06);
1135 masterTableColor->Draw(
"COLZ");
1136 masterTable->Draw(
"textsame");
1141 TLine l[boundaries.size()];
1143 for (
const auto &
line : boundaries){
1144 l[
i] = TLine(canv.cd()->GetUxmin(),masterTable->GetYaxis()->GetBinLowEdge(
line),canv.cd()->GetUxmax(),masterTable->GetYaxis()->GetBinLowEdge(
line));
1145 l[
i].SetLineWidth(2);
1146 l[
i].SetLineStyle(9);
1147 l[
i].SetLineColor(kMagenta);
1154 title.SetTextSize(0.045);
1155 title.SetTextColor(kBlue);
1156 title.DrawLatexNDC(0.33,0.96,(
"#DeltaIOV: "+std::to_string(std::get<0>(lastiov))+
" - "+std::to_string(std::get<0>(firstiov))).c_str());
1160 delete f_siStripQuality_;
1161 delete l_siStripQuality_;
bool cleanUp(bool force=false)
void getDetIds(std::vector< uint32_t > &DetIds_) const
void add(const uint32_t &, const SiStripBadStrip::Range &)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
void fillBCArrays(const SiStripQuality *siStripQuality_, int NTkBadComponent[4], int NBadComponent[4][19][4], const TrackerTopology m_trackerTopo)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
const std::vector< uint32_t > & getAllDetIds() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
void fillWithValue(float value, float weight=1)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::pair< int, const char * > regionType(int index)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
void setSingleIov(bool flag)
void fillTotalComponents(int NTkComponents[4], int NComponents[4][19][4], const TrackerTopology m_trackerTopo)
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
std::string fullPath() const
data decode(const unsigned int &value) const