1 #ifndef CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H
2 #define CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H
35 double tmean =
mean();
68 void Fill(
int apv,
int det,
double vx) {
122 :
entryx_(),
entryy_(),
mode_(
mode),
obj_(
name,
title, nbinsx,
xmin,
xmax, nbinsy,
ymin,
ymax) {}
128 void Fill(
int apv,
int det,
double vx,
double vy) {
185 return "should never be here";
203 return "should never be here";
253 auto region =
static_cast<std::underlying_type_t<SiStripPI::TrackerRegion>
>(
index);
257 return std::make_pair(1,
"TIB L1 r-#varphi");
259 return std::make_pair(2,
"TIB L1 stereo");
261 return std::make_pair(3,
"TIB L2 r-#varphi");
263 return std::make_pair(4,
"TIB L2 stereo");
265 return std::make_pair(5,
"TIB L3");
267 return std::make_pair(6,
"TIB L4");
269 return std::make_pair(7,
"TOB L1 r-#varphi");
271 return std::make_pair(8,
"TOB L1 stereo");
273 return std::make_pair(9,
"TOB L2 r-#varphi");
275 return std::make_pair(10,
"TOB L2 stereo");
277 return std::make_pair(11,
"TOB L3 r-#varphi");
279 return std::make_pair(12,
"TOB L4");
281 return std::make_pair(13,
"TOB L5");
283 return std::make_pair(14,
"TOB L6");
285 return std::make_pair(15,
"TEC D1 r-#varphi");
287 return std::make_pair(16,
"TEC D1 stereo");
289 return std::make_pair(17,
"TEC D2 r-#varphi");
291 return std::make_pair(18,
"TEC D2 stereo");
293 return std::make_pair(19,
"TEC D3 r-#varphi");
295 return std::make_pair(20,
"TEC D3 stereo");
297 return std::make_pair(21,
"TEC D4 r-#varphi");
299 return std::make_pair(22,
"TEC D4 stereo");
301 return std::make_pair(23,
"TEC D5 r-#varphi");
303 return std::make_pair(24,
"TEC D5 stereo");
305 return std::make_pair(25,
"TEC D6 r-#varphi");
307 return std::make_pair(26,
"TEC D6 stereo");
309 return std::make_pair(27,
"TEC D7 r-#varphi");
311 return std::make_pair(28,
"TEC D7 stereo");
313 return std::make_pair(29,
"TEC D8 r-#varphi");
315 return std::make_pair(30,
"TEC D8 stereo");
317 return std::make_pair(31,
"TEC D9 r-#varphi");
319 return std::make_pair(32,
"TEC D9 stereo");
321 return std::make_pair(33,
"TID D1 r-#varphi");
323 return std::make_pair(34,
"TID D1 stereo");
325 return std::make_pair(35,
"TID D2 r-#varphi");
327 return std::make_pair(36,
"TID D2 stereo");
329 return std::make_pair(37,
"TID D3 r-#varphi");
331 return std::make_pair(38,
"TID D3 stereo");
333 return std::make_pair(-1,
"undefined");
335 return std::make_pair(999,
"should never be here");
343 float sum = std::accumulate(
352 accum += (
p.second -
m) * (
p.second -
m);
358 return std::make_pair(
m - nsigma *
stdev,
m + nsigma *
stdev);
360 return std::make_pair(
m > 0. ? 0.95 *
m : 1.05 *
m,
m > 0 ? 1.05 *
m : 0.95 *
m);
366 std::map<std::string, int> colormap,
367 std::vector<std::string>
legend,
377 for (
const auto& element :
legend) {
378 TPaveText*
stat =
new TPaveText(
X,
Y - (
i *
H),
X + W,
Y - (
i + 1) *
H,
"NDC");
380 auto Histo =
histos[element];
381 sprintf(
buffer,
"Entries : %i\n", (
int)Histo->GetEntries());
384 sprintf(
buffer,
"Mean : %6.2f\n", Histo->GetMean());
387 sprintf(
buffer,
"RMS : %6.2f\n", Histo->GetRMS());
390 stat->SetFillColor(0);
391 stat->SetLineColor(colormap[element]);
392 stat->SetTextColor(colormap[element]);
393 stat->SetTextSize(0.03);
394 stat->SetBorderSize(0);
395 stat->SetMargin(0.05);
396 stat->SetTextAlign(12);
405 float theMax(-9999.);
407 theMax = h1->GetMaximum() > h2->GetMaximum() ? h1->GetMaximum() : h2->GetMaximum();
408 theMin = h1->GetMinimum() < h2->GetMaximum() ? h1->GetMinimum() : h2->GetMinimum();
410 float add_min = theMin > 0. ? -0.05 : 0.05;
411 float add_max = theMax > 0. ? 0.05 : -0.05;
413 auto result = std::make_pair(theMin * (1 + add_min), theMax * (1 + add_max));
421 hist->SetStats(kFALSE);
422 hist->SetLineWidth(2);
423 hist->GetXaxis()->CenterTitle(
true);
424 hist->GetYaxis()->CenterTitle(
true);
425 hist->GetXaxis()->SetTitleFont(42);
426 hist->GetYaxis()->SetTitleFont(42);
427 hist->GetXaxis()->SetTitleSize(0.05);
428 hist->GetYaxis()->SetTitleSize(0.05);
429 hist->GetXaxis()->SetTitleOffset(0.9);
430 hist->GetYaxis()->SetTitleOffset(1.3);
431 hist->GetXaxis()->SetLabelFont(42);
432 hist->GetYaxis()->SetLabelFont(42);
433 hist->GetYaxis()->SetLabelSize(.05);
434 hist->GetXaxis()->SetLabelSize(.05);
441 for (
const auto& element :
map) {
442 int count = element.second.count;
452 switch ((element.first) / 1000) {
467 int layer = (element.first) / 10 - (element.first) / 1000 * 100;
468 int stereo = (element.first) - (
layer * 10) - (element.first) / 1000 * 1000;
470 std::cout <<
"key of the map:" << element.first <<
" ( region: " <<
regionType(element.first).second <<
" ) "
472 <<
" rms: " <<
rms << std::endl;
483 NBadComponent[
i][0][2] += std::bitset<16>(BC.
BadApvs & 0x3f).count();
484 NBadComponent[
i][component][2] += std::bitset<16>(BC.
BadApvs & 0x3f).count();
488 NBadComponent[
i][0][1] += std::bitset<4>(BC.
BadFibers & 0x7).count();
489 NBadComponent[
i][component][1] += std::bitset<4>(BC.
BadFibers & 0x7).count();
493 NBadComponent[
i][0][0]++;
494 NBadComponent[
i][component][0]++;
501 std::shared_ptr<SiStripNoises>
payload,
507 std::vector<float> vstripnoise;
509 for (; rit != erit; ++rit) {
510 Nstrips = (rit->iend - rit->ibegin) * 8 / 9;
511 vstripnoise.resize(Nstrips);
514 make_pair(
payload->getDataVectorBegin() + rit->ibegin,
payload->getDataVectorBegin() + rit->iend));
521 DetId detId(rit->detid);
523 for (
size_t i = 0;
i < Nstrips; ++
i) {
524 mean += vstripnoise[
i];
525 rms += vstripnoise[
i] * vstripnoise[
i];
526 if (vstripnoise[
i] <
min)
527 min = vstripnoise[
i];
528 if (vstripnoise[
i] >
max)
529 max = vstripnoise[
i];
541 summaryNoise.
add(detId,
min);
544 summaryNoise.
add(detId,
max);
550 summaryNoise.
add(detId,
rms);
565 const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& DetInfos =
reader->getAllData();
566 for (
const auto& det : DetInfos) {
567 int nAPVs =
reader->getNumberOfApvsAndStripLength(det.first).first;
569 int nFibers = nAPVs / 2;
570 int nStrips = (128 *
reader->getNumberOfApvsAndStripLength(det.first).first);
572 NTkComponents[1] += nFibers;
573 NTkComponents[2] += nAPVs;
579 int subDetIndex = -1;
583 component = m_trackerTopo.
tibLayer(det.first);
586 component = m_trackerTopo.
tidSide(det.first) == 2 ? m_trackerTopo.
tidWheel(det.first)
587 : m_trackerTopo.
tidWheel(det.first) + 3;
590 component = m_trackerTopo.
tobLayer(det.first);
593 component = m_trackerTopo.
tecSide(det.first) == 2 ? m_trackerTopo.
tecWheel(det.first)
594 : m_trackerTopo.
tecWheel(det.first) + 9;
597 NComponents[subDetIndex][0][0]++;
598 NComponents[subDetIndex][0][1] += nFibers;
599 NComponents[subDetIndex][0][2] += nAPVs;
600 NComponents[subDetIndex][0][3] +=
nStrips;
602 NComponents[subDetIndex][component][0]++;
603 NComponents[subDetIndex][component][1] += nFibers;
604 NComponents[subDetIndex][component][2] += nAPVs;
605 NComponents[subDetIndex][component][3] +=
nStrips;
613 int NTkBadComponent[4],
614 int NBadComponent[4][19][4],
620 for (
size_t i = 0;
i < BC.size(); ++
i) {
625 if (BC.at(
i).BadModule)
626 NTkBadComponent[0]++;
627 if (BC.at(
i).BadFibers)
628 NTkBadComponent[1] +=
629 ((BC.at(
i).BadFibers >> 2) & 0
x1) + ((BC.at(
i).BadFibers >> 1) & 0
x1) + ((BC.at(
i).BadFibers) & 0
x1);
630 if (BC.at(
i).BadApvs)
631 NTkBadComponent[2] += ((BC.at(
i).BadApvs >> 5) & 0
x1) + ((BC.at(
i).BadApvs >> 4) & 0
x1) +
632 ((BC.at(
i).BadApvs >> 3) & 0
x1) + ((BC.at(
i).BadApvs >> 2) & 0
x1) +
633 ((BC.at(
i).BadApvs >> 1) & 0
x1) + ((BC.at(
i).BadApvs) & 0
x1);
646 component = m_trackerTopo.
tibLayer(BC.at(
i).detid);
654 component = m_trackerTopo.
tidSide(BC.at(
i).detid) == 2 ? m_trackerTopo.
tidWheel(BC.at(
i).detid)
655 : m_trackerTopo.
tidWheel(BC.at(
i).detid) + 3;
663 component = m_trackerTopo.
tobLayer(BC.at(
i).detid);
671 component = m_trackerTopo.
tecSide(BC.at(
i).detid) == 2 ? m_trackerTopo.
tecWheel(BC.at(
i).detid)
672 : m_trackerTopo.
tecWheel(BC.at(
i).detid) + 9;
684 float percentage = 0;
690 uint32_t detid = rp->detid;
693 int component = -999;
698 component = m_trackerTopo.
tibLayer(detid);
705 component = m_trackerTopo.
tobLayer(detid);
716 for (
int it = 0; it < sqrange.second - sqrange.first; it++) {
718 NTkBadComponent[3] +=
range;
719 NBadComponent[subdet][0][3] +=
range;
720 NBadComponent[subdet][component][3] +=
range;
724 percentage /= 128. *
reader->getNumberOfApvsAndStripLength(detid).first;
727 <<
"PROBLEM detid " << detid <<
" value " << percentage << std::endl;
741 std::stringstream
ss;
743 ss <<
"\n-----------------\nGlobal Info\n-----------------";
744 ss <<
"\nBadComponent \t Modules \tFibers "
745 "\tApvs\tStrips\n----------------------------------------------------------------";
746 ss <<
"\nTracker:\t\t" << NTkBadComponent[0] <<
"\t" << NTkBadComponent[1] <<
"\t" << NTkBadComponent[2] <<
"\t"
747 << NTkBadComponent[3];
749 ss <<
"\nTIB:\t\t\t" << NBadComponent[0][0][0] <<
"\t" << NBadComponent[0][0][1] <<
"\t" << NBadComponent[0][0][2]
750 <<
"\t" << NBadComponent[0][0][3];
751 ss <<
"\nTID:\t\t\t" << NBadComponent[1][0][0] <<
"\t" << NBadComponent[1][0][1] <<
"\t" << NBadComponent[1][0][2]
752 <<
"\t" << NBadComponent[1][0][3];
753 ss <<
"\nTOB:\t\t\t" << NBadComponent[2][0][0] <<
"\t" << NBadComponent[2][0][1] <<
"\t" << NBadComponent[2][0][2]
754 <<
"\t" << NBadComponent[2][0][3];
755 ss <<
"\nTEC:\t\t\t" << NBadComponent[3][0][0] <<
"\t" << NBadComponent[3][0][1] <<
"\t" << NBadComponent[3][0][2]
756 <<
"\t" << NBadComponent[3][0][3];
759 for (
int i = 1;
i < 5; ++
i)
760 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << NBadComponent[0][
i][0] <<
"\t" << NBadComponent[0][
i][1] <<
"\t"
761 << NBadComponent[0][
i][2] <<
"\t" << NBadComponent[0][
i][3];
763 for (
int i = 1;
i < 4; ++
i)
764 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t"
765 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
766 for (
int i = 4;
i < 7; ++
i)
767 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << NBadComponent[1][
i][0] <<
"\t" << NBadComponent[1][
i][1] <<
"\t"
768 << NBadComponent[1][
i][2] <<
"\t" << NBadComponent[1][
i][3];
770 for (
int i = 1;
i < 7; ++
i)
771 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << NBadComponent[2][
i][0] <<
"\t" << NBadComponent[2][
i][1] <<
"\t"
772 << NBadComponent[2][
i][2] <<
"\t" << NBadComponent[2][
i][3];
774 for (
int i = 1;
i < 10; ++
i)
775 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t"
776 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
777 for (
int i = 10;
i < 19; ++
i)
778 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << NBadComponent[3][
i][0] <<
"\t" << NBadComponent[3][
i][1] <<
"\t"
779 << NBadComponent[3][
i][2] <<
"\t" << NBadComponent[3][
i][3];
786 enum palette {
HALFGRAY,
GRAY,
BLUES,
REDS,
ANTIGRAY,
FIRE,
ANTIFIRE,
LOGREDBLUE,
BLUERED,
LOGBLUERED,
DEFAULT };
792 TStyle* palettestyle =
new TStyle(
"palettestyle",
"Style for P-TDR");
795 const int NCont = 255;
799 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
800 double red[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
801 double green[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
802 double blue[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
803 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
807 double stops[NRGBs] = {0.00, 0.01, 0.05, 0.09, 0.1};
808 double red[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
809 double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
810 double blue[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
811 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
815 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
816 double red[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
817 double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
818 double blue[NRGBs] = {1.00, 1.00, 1.00, 1.00, 1.00};
819 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
824 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
825 double red[NRGBs] = {1.00, 1.00, 1.00, 1.00, 1.00};
826 double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
827 double blue[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
828 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
832 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
833 double red[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
834 double green[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
835 double blue[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
836 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
841 double stops[NCOLs] = {0.00, 0.20, 0.80, 1.00};
842 double red[NCOLs] = {1.00, 1.00, 1.00, 0.50};
843 double green[NCOLs] = {1.00, 1.00, 0.00, 0.00};
844 double blue[NCOLs] = {0.20, 0.00, 0.00, 0.00};
845 TColor::CreateGradientColorTable(NCOLs, stops,
red, green,
blue, NCont);
850 double stops[NCOLs] = {0.00, 0.20, 0.80, 1.00};
851 double red[NCOLs] = {0.50, 1.00, 1.00, 1.00};
852 double green[NCOLs] = {0.00, 0.00, 1.00, 1.00};
853 double blue[NCOLs] = {0.00, 0.00, 0.00, 0.20};
854 TColor::CreateGradientColorTable(NCOLs, stops,
red, green,
blue, NCont);
858 double stops[NRGBs] = {0.0001, 0.0010, 0.0100, 0.1000, 1.0000};
859 double red[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
860 double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
861 double blue[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
862 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
866 double stops[NRGBs] = {0.0001, 0.0010, 0.0100, 0.1000, 1.0000};
867 double red[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
868 double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
869 double blue[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
870 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
874 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
875 double red[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
876 double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
877 double blue[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
878 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
882 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
883 double red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
884 double green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
885 double blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
886 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
889 std::cout <<
"should nevere be here" << std::endl;
893 palettestyle->SetNumberContours(NCont);