From 78c24e2f5befed3137eb478e59d3600956e8f1ba Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 19 Aug 2021 10:41:47 +0200 Subject: [PATCH 1/2] miscellaneous payload inspector fixes --- .../plugins/TrackerAlignment_PayloadInspector.cc | 8 ++++---- CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc index 0bee612603bf5..1633380424575 100644 --- a/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc +++ b/CondCore/AlignmentPlugins/plugins/TrackerAlignment_PayloadInspector.cc @@ -995,10 +995,10 @@ namespace { final->SetMarkerSize(2.5); t1.SetTextColor(kRed); initial->Draw(); - t1.DrawLatex(x0i, y0i - 0.5, Form("(%.2f,%.2f)", x0i, y0i)); + t1.DrawLatex(x0i, y0i + (y0i > y0f ? 0.3 : -0.5), Form("(%.2f,%.2f)", x0i, y0i)); final->Draw("same"); t1.SetTextColor(kBlue); - t1.DrawLatex(x0f, y0f + 0.3, Form("(%.2f,%.2f)", x0f, y0f)); + t1.DrawLatex(x0f, y0f + (y0i > y0f ? -0.5 : 0.3), Form("(%.2f,%.2f)", x0f, y0f)); } // fourth pad is a special case for the z coordinate @@ -1032,10 +1032,10 @@ namespace { final->SetMarkerSize(2.5); initial->Draw(); t1.SetTextColor(kRed); - t1.DrawLatex(c - 1, z0i - 1.5, Form("(%.2f)", z0i)); + t1.DrawLatex(c - 1, z0i + (z0i > z0f ? 1. : -1.5), Form("(%.2f)", z0i)); final->Draw("same"); t1.SetTextColor(kBlue); - t1.DrawLatex(c - 1, z0f + 1., Form("(%.2f)", z0f)); + t1.DrawLatex(c - 1, z0f + (z0i > z0f ? -1.5 : 1), Form("(%.2f)", z0f)); } std::string fileName(this->m_imageFileName); diff --git a/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h b/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h index 7cf6dd251a897..873856e23addc 100644 --- a/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h +++ b/CondCore/SiPixelPlugins/interface/SiPixelTemplateHelper.h @@ -242,7 +242,10 @@ namespace templateHelper { h2_Header->GetXaxis()->SetBinLabel(idx, ""); for (unsigned int iy = 1; iy <= 12; iy++) { - if (tempValue.head.Dtype != 0 || uH < 0) { + // Some of the Phase-2 templates have DType = 0 for all partitions (TBPX, TEPX, TFPX) + // so they are distinguished by the uH strength value (<0). + // To avoid changing the behaviour of 0T payload (uH=-99) that case is treated separately + if (tempValue.head.Dtype != 0 || (uH < 0 && uH > -99)) { h2_ghost->SetBinContent(idx, iy, 1); } else { h2_ghost->SetBinContent(idx, iy, -1); From 9114727d5653839e79131b4bced96fde1ecef975 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 10 Sep 2021 16:29:53 +0200 Subject: [PATCH 2/2] improve AlCaRecoTriggerBits_PayloadInspector and tests --- .../AlCaRecoTriggerBits_PayloadInspector.cc | 64 ++++++++++--------- CondCore/HLTPlugins/test/test.sh | 15 ++++- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc index 70096f1615be2..2a19317a2f8c1 100644 --- a/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc +++ b/CondCore/HLTPlugins/plugins/AlCaRecoTriggerBits_PayloadInspector.cc @@ -3,6 +3,7 @@ #include "CondCore/CondDB/interface/Time.h" #include "CondFormats/HLTObjects/interface/AlCaRecoTriggerBits.h" +#include #include #include #include @@ -12,13 +13,14 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ Display AlCaRecoTriggerBits mapping *************************************************/ - class AlCaRecoTriggerBits_Display : public cond::payloadInspector::PlotImage { + class AlCaRecoTriggerBits_Display : public PlotImage { public: - AlCaRecoTriggerBits_Display() - : cond::payloadInspector::PlotImage("Table of AlCaRecoTriggerBits") { + AlCaRecoTriggerBits_Display() : PlotImage("Table of AlCaRecoTriggerBits") { setSingleIov(true); } @@ -127,24 +129,33 @@ namespace { /************************************************ Compare AlCaRecoTriggerBits mapping *************************************************/ - class AlCaRecoTriggerBits_CompareBase : public cond::payloadInspector::PlotImage { + template + class AlCaRecoTriggerBits_CompareBase : public PlotImage { public: AlCaRecoTriggerBits_CompareBase() - : cond::payloadInspector::PlotImage("Table of AlCaRecoTriggerBits comparison") {} - - bool fill(const std::vector > &iovs) override { - std::vector > sorted_iovs = iovs; - - // make absolute sure the IOVs are sortd by since - std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) { - return std::get<0>(t1) < std::get<0>(t2); - }); - - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + : PlotImage("Table of AlCaRecoTriggerBits comparison") {} + + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = PlotBase::getTag<0>().iovs; + auto f_tagname = PlotBase::getTag<0>().name; + std::string l_tagname = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; + + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); + + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = PlotBase::getTag<1>().iovs; + l_tagname = PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = theIOVs.back(); + } - std::shared_ptr last_payload = fetchPayload(std::get<1>(lastiov)); - std::shared_ptr first_payload = fetchPayload(std::get<1>(firstiov)); + std::shared_ptr last_payload = this->fetchPayload(std::get<1>(lastiov)); + std::shared_ptr first_payload = this->fetchPayload(std::get<1>(firstiov)); std::string lastIOVsince = std::to_string(std::get<0>(lastiov)); std::string firstIOVsince = std::to_string(std::get<0>(firstiov)); @@ -195,9 +206,9 @@ namespace { y_x1.push_back(y); s_x1.push_back("#scale[1.2]{Key}"); y_x2.push_back(y); - s_x2.push_back("#scale[1.2]{in IOV: " + firstIOVsince + "}"); + s_x2.push_back(fmt::sprintf("#scale[1.2]{%s in IOV: %s}", f_tagname, firstIOVsince)); y_x3.push_back(y); - s_x3.push_back("#scale[1.2]{in IOV: " + lastIOVsince + "}"); + s_x3.push_back(fmt::sprintf("#scale[1.2]{%s in IOV: %s}", l_tagname, lastIOVsince)); y -= pitch / 3; // print the ones missing in the last key @@ -391,21 +402,14 @@ namespace { } //canvas.SetCanvasSize(2000,(1-y)*1000); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; } }; - class AlCaRecoTriggerBits_Compare : public AlCaRecoTriggerBits_CompareBase { - public: - AlCaRecoTriggerBits_Compare() : AlCaRecoTriggerBits_CompareBase() { this->setSingleIov(false); } - }; - - class AlCaRecoTriggerBits_CompareTwoTags : public AlCaRecoTriggerBits_CompareBase { - public: - AlCaRecoTriggerBits_CompareTwoTags() : AlCaRecoTriggerBits_CompareBase() { this->setTwoTags(true); } - }; + using AlCaRecoTriggerBits_Compare = AlCaRecoTriggerBits_CompareBase; + using AlCaRecoTriggerBits_CompareTwoTags = AlCaRecoTriggerBits_CompareBase; } // namespace diff --git a/CondCore/HLTPlugins/test/test.sh b/CondCore/HLTPlugins/test/test.sh index 739e1cceed0b6..e9d1d5ca299cd 100755 --- a/CondCore/HLTPlugins/test/test.sh +++ b/CondCore/HLTPlugins/test/test.sh @@ -38,4 +38,17 @@ getPayloadData.py \ --db Prod \ --test; -mv *.png $W_DIR/plots/AlCaRecoTriggerBits_Compare.png \ No newline at end of file +mv *.png $W_DIR/plots/AlCaRecoTriggerBits_Compare.png + +getPayloadData.py \ + --plugin pluginAlCaRecoTriggerBits_PayloadInspector \ + --plot plot_AlCaRecoTriggerBits_CompareTwoTags \ + --tag AlCaRecoTriggerBits_TrackerDQM_v2_prompt \ + --tagtwo AlCaRecoTriggerBits_TrackerDQM_v6_offline \ + --time_type Run \ + --iovs '{"start_iov": "325492", "end_iov": "325492"}' \ + --iovstwo '{"start_iov": "304738", "end_iov": "304738"}' \ + --db Prod \ + --test; + +mv *.png $W_DIR/plots/AlCaRecoTriggerBits_CompareTwoTags.png