From b7d539b00d798febd9ee91e8fc8a8a9d1420dcee Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 21 Dec 2020 14:44:57 +0100 Subject: [PATCH] migrate to new PayloadInspector class interfaces --- .../SiStripPlugins/interface/SiStripTkMaps.h | 4 +- .../SiStripApvGain_PayloadInspector.cc | 518 +++++++++--------- ...ripBackPlaneCorrection_PayloadInspector.cc | 37 +- .../SiStripBadStrip_PayloadInspector.cc | 200 +++---- .../SiStripConfObject_PayloadInspector.cc | 23 +- .../SiStripDetVOff_PayloadInspector.cc | 72 +-- .../SiStripFedCabling_PayloadInspector.cc | 27 +- .../SiStripLatency_PayloadInspector.cc | 16 +- .../SiStripLorentzAngle_PayloadInspector.cc | 37 +- .../SiStripThreshold_PayloadInspector.cc | 43 +- 10 files changed, 504 insertions(+), 473 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index 7d65330170a73..53cdf84ce21a7 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -251,11 +251,11 @@ class SiStripTkMaps { text_Y.SetTextSize(0.04); text_Y.SetTextAlign(11); text_Y.SetTextColor(kBlue); - text_Y.DrawLatexNDC(x_X2+0.005, y_Y2 - 0.01, y_label); + text_Y.DrawLatexNDC(x_X2 + 0.005, y_Y2 - 0.01, y_label); } //============================================================================ - void adjustCanvasMargins(TVirtualPad* pad, float top, float bottom, float left, float right) { + void adjustCanvasMargins(TVirtualPad* pad, const float top, const float bottom, const float left, const float right) { if (top > 0) { pad->SetTopMargin(top); } diff --git a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc index 78e2a41673f99..39ff28eaed62c 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc @@ -45,13 +45,12 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvGainsValue : public cond::payloadInspector::Histogram1D { + class SiStripApvGainsValue + : public cond::payloadInspector::Histogram1D { public: SiStripApvGainsValue() - : cond::payloadInspector::Histogram1D( - "SiStripApv Gains values", "SiStripApv Gains values", 200, 0.0, 2.0) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStripApv Gains values", "SiStripApv Gains values", 200, 0.0, 2.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -81,17 +80,17 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvBarrelGainsByLayer : public cond::payloadInspector::Histogram1D { + class SiStripApvBarrelGainsByLayer + : public cond::payloadInspector::Histogram1D { public: SiStripApvBarrelGainsByLayer() - : cond::payloadInspector::Histogram1D("SiStripApv Gains averages by Barrel layer", - "Barrel layer (0-3: TIB), (4-9: TOB)", - 10, - 0, - 10, - "average SiStripApv Gain") { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStripApv Gains averages by Barrel layer", + "Barrel layer (0-3: TIB), (4-9: TOB)", + 10, + 0, + 10, + "average SiStripApv Gain") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -142,21 +141,20 @@ namespace { SiStripApvGains for Tracker Barrel of 1 IOV *************************************************/ - class SiStripApvAbsoluteBarrelGainsByLayer : public cond::payloadInspector::Histogram2D { + class SiStripApvAbsoluteBarrelGainsByLayer + : public cond::payloadInspector::Histogram2D { public: SiStripApvAbsoluteBarrelGainsByLayer() - : cond::payloadInspector::Histogram2D("SiStripApv Gains by Barrel layer", - "Barrel layer (0-3: TIB), (4-9: TOB)", - 10, - 0, - 10, - "SiStripApv Gain", - 200, - 0.0, - 2.0) { - Base::setSingleIov(true); - } - + : cond::payloadInspector::Histogram2D( + "SiStripApv Gains by Barrel layer", + "Barrel layer (0-3: TIB), (4-9: TOB)", + 10, + 0, + 10, + "SiStripApv Gain", + 200, + 0.0, + 2.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); for (auto const& iov : tag.iovs) { @@ -191,17 +189,17 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvEndcapMinusGainsByDisk : public cond::payloadInspector::Histogram1D { + class SiStripApvEndcapMinusGainsByDisk + : public cond::payloadInspector::Histogram1D { public: SiStripApvEndcapMinusGainsByDisk() - : cond::payloadInspector::Histogram1D("SiStripApv Gains averages by Endcap (minus) disk", - "Endcap (minus) disk (0-2: TID), (3-11: TEC)", - 12, - 0, - 12, - "average SiStripApv Gain") { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStripApv Gains averages by Endcap (minus) disk", + "Endcap (minus) disk (0-2: TID), (3-11: TEC)", + 12, + 0, + 12, + "average SiStripApv Gain") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -261,17 +259,17 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvEndcapPlusGainsByDisk : public cond::payloadInspector::Histogram1D { + class SiStripApvEndcapPlusGainsByDisk + : public cond::payloadInspector::Histogram1D { public: SiStripApvEndcapPlusGainsByDisk() - : cond::payloadInspector::Histogram1D("SiStripApv Gains averages by Endcap (plus) disk", - "Endcap (plus) disk (0-2: TID), (3-11: TEC)", - 12, - 0, - 12, - "average SiStripApv Gain") { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStripApv Gains averages by Endcap (plus) disk", + "Endcap (plus) disk (0-2: TID), (3-11: TEC)", + 12, + 0, + 12, + "average SiStripApv Gain") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -330,20 +328,20 @@ namespace { 2D histogram of absolute (i.e. not average) SiStripApv Gains on the Endcap- for 1 IOV ************************************************/ - class SiStripApvAbsoluteEndcapMinusGainsByDisk : public cond::payloadInspector::Histogram2D { + class SiStripApvAbsoluteEndcapMinusGainsByDisk + : public cond::payloadInspector::Histogram2D { public: SiStripApvAbsoluteEndcapMinusGainsByDisk() - : cond::payloadInspector::Histogram2D("SiStripApv Gains averages by Endcap (minus) disk", - "Endcap (minus) disk (0-2: TID), (3-11: TEC)", - 12, - 0, - 12, - "SiStripApv Gain", - 200, - 0.0, - 2.0) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram2D( + "SiStripApv Gains averages by Endcap (minus) disk", + "Endcap (minus) disk (0-2: TID), (3-11: TEC)", + 12, + 0, + 12, + "SiStripApv Gain", + 200, + 0.0, + 2.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -390,21 +388,20 @@ namespace { 2D histogram of absolute (i.e. not average) SiStripApv Gains on the Endcap+ for 1 IOV ************************************************/ - class SiStripApvAbsoluteEndcapPlusGainsByDisk : public cond::payloadInspector::Histogram2D { + class SiStripApvAbsoluteEndcapPlusGainsByDisk + : public cond::payloadInspector::Histogram2D { public: SiStripApvAbsoluteEndcapPlusGainsByDisk() - : cond::payloadInspector::Histogram2D("SiStripApv Gains averages by Endcap (plus) disk", - "Endcap (plus) disk (0-2: TID), (3-11: TEC)", - 12, - 0, - 12, - "SiStripApv Gain", - 200, - 0.0, - 2.0) { - Base::setSingleIov(true); - } - + : cond::payloadInspector::Histogram2D( + "SiStripApv Gains averages by Endcap (plus) disk", + "Endcap (plus) disk (0-2: TID), (3-11: TEC)", + 12, + 0, + 12, + "SiStripApv Gain", + 200, + 0.0, + 2.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); for (auto const& iov : tag.iovs) { @@ -449,15 +446,16 @@ namespace { /************************************************ TrackerMap of SiStripApvGains (average gain per detid) *************************************************/ - class SiStripApvGainsAverageTrackerMap : public cond::payloadInspector::PlotImage { + class SiStripApvGainsAverageTrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsAverageTrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map of average SiStripGains") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map of average SiStripGains") {} - bool fill(const std::vector>& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::string titleMap = "SiStrip APV Gain average per module (payload : " + std::get<1>(iov) + ")"; @@ -498,15 +496,16 @@ namespace { /************************************************ TrackerMap of SiStripApvGains (module with default) *************************************************/ - class SiStripApvGainsDefaultTrackerMap : public cond::payloadInspector::PlotImage { + class SiStripApvGainsDefaultTrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsDefaultTrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map of SiStripGains to default") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map of SiStripGains to default") {} - bool fill(const std::vector>& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripApvGains"); @@ -568,6 +567,7 @@ namespace { TrackerMap of SiStripApvGains (ratio with previous gain per detid) *************************************************/ + template class SiStripApvGainsRatioWithPreviousIOVTrackerMapBase : public cond::payloadInspector::PlotImage { public: SiStripApvGainsRatioWithPreviousIOVTrackerMapBase() @@ -575,7 +575,8 @@ namespace { cond::payloadInspector::PlotBase::addInputParam("nsigma"); } - bool fill(const std::vector>& iovs) override { + bool fill() override { + // determine n. sigmas unsigned int nsigma(1); auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); @@ -584,14 +585,23 @@ namespace { nsigma = boost::lexical_cast(ip->second); } - 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); - }); + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + // 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 = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -659,37 +669,27 @@ namespace { } }; - class SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap - : public SiStripApvGainsRatioWithPreviousIOVTrackerMapBase { - public: - SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap() : SiStripApvGainsRatioWithPreviousIOVTrackerMapBase() { - this->setSingleIov(false); - } - }; - - class SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags : public SiStripApvGainsRatioWithPreviousIOVTrackerMapBase { - public: - SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags() : SiStripApvGainsRatioWithPreviousIOVTrackerMapBase() { - this->setTwoTags(true); - } - }; + using SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap = + SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags = + SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ TrackerMap of SiStripApvGains (ratio for largest deviation with previous gain per detid) *************************************************/ + template class SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase - : public cond::payloadInspector::PlotImage { + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase() - : cond::payloadInspector::PlotImage( + : cond::payloadInspector::PlotImage( "Tracker Map of ratio (for largest deviation) of SiStripGains with previous IOV") { cond::payloadInspector::PlotBase::addInputParam("nsigma"); } - bool fill(const std::vector>& iovs) override { + bool fill() override { unsigned int nsigma(1); - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { @@ -699,18 +699,26 @@ namespace { std::cout << "using default saturation: " << nsigma << " sigmas" << std::endl; } - std::vector> sorted_iovs = iovs; + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; - // 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); - }); + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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 titleMap = "SiStrip APV Gain ratio for largest deviation per module (IOV: "; @@ -787,43 +795,32 @@ namespace { //========================= - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); tmap->save(true, range.first, range.second, fileName); return true; } }; - class SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap - : public SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase { - public: - SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap() - : SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase() { - this->setSingleIov(false); - } - }; + using SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap = + SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<1, cond::payloadInspector::MULTI_IOV>; - class SiStripApvGainsMaxDeviationRatioTrackerMapTwoTags - : public SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase { - public: - SiStripApvGainsMaxDeviationRatioTrackerMapTwoTags() - : SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase() { - this->setTwoTags(true); - } - }; + using SiStripApvGainsMaxDeviationRatioTrackerMapTwoTags = + SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ TrackerMap of SiStripApvGains (maximum gain per detid) *************************************************/ - class SiStripApvGainsMaximumTrackerMap : public cond::payloadInspector::PlotImage { + class SiStripApvGainsMaximumTrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsMaximumTrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map of SiStripAPVGains (maximum per DetId)") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map of SiStripAPVGains (maximum per DetId)") {} - bool fill(const std::vector>& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::string titleMap = "SiStrip APV Gain maximum per module (payload : " + std::get<1>(iov) + ")"; @@ -868,15 +865,17 @@ namespace { /************************************************ TrackerMap of SiStripApvGains (minimum gain per detid) *************************************************/ - class SiStripApvGainsMinimumTrackerMap : public cond::payloadInspector::PlotImage { + class SiStripApvGainsMinimumTrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsMinimumTrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map of SiStripAPVGains (minimum per DetId)") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map of SiStripAPVGains (minimum per DetId)") {} + + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); - bool fill(const std::vector>& iovs) override { - auto iov = iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::string titleMap = "SiStrip APV Gain minumum per module (payload : " + std::get<1>(iov) + ")"; @@ -1159,15 +1158,14 @@ namespace { test class *************************************************/ - class SiStripApvGainsTest : public cond::payloadInspector::Histogram1D { + class SiStripApvGainsTest + : public cond::payloadInspector::Histogram1D { public: SiStripApvGainsTest() - : cond::payloadInspector::Histogram1D( + : cond::payloadInspector::Histogram1D( "SiStripApv Gains test", "SiStripApv Gains test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - Base::setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -1207,23 +1205,33 @@ namespace { Compare Gains from 2 IOVs, 2 pads canvas, firsr for ratio, second for scatter plot *************************************************/ - class SiStripApvGainsComparatorBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsComparatorBase : public cond::payloadInspector::PlotImage { public: - SiStripApvGainsComparatorBase() : cond::payloadInspector::PlotImage("SiStripGains Comparison") {} + SiStripApvGainsComparatorBase() + : cond::payloadInspector::PlotImage("SiStripGains 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(); + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + 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 = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -1391,47 +1399,49 @@ namespace { legend2.Draw("same"); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; } }; - class SiStripApvGainsComparatorSingleTag : public SiStripApvGainsComparatorBase { - public: - SiStripApvGainsComparatorSingleTag() : SiStripApvGainsComparatorBase() { setSingleIov(false); } - }; - - class SiStripApvGainsComparatorTwoTags : public SiStripApvGainsComparatorBase { - public: - SiStripApvGainsComparatorTwoTags() : SiStripApvGainsComparatorBase() { setTwoTags(true); } - }; + using SiStripApvGainsComparatorSingleTag = SiStripApvGainsComparatorBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripApvGainsComparatorTwoTags = SiStripApvGainsComparatorBase<2, cond::payloadInspector::SINGLE_IOV>; //*******************************************// // Compare Gains from 2 IOVs //******************************************// - class SiStripApvGainsValuesComparatorBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsValuesComparatorBase : public cond::payloadInspector::PlotImage { public: SiStripApvGainsValuesComparatorBase() - : cond::payloadInspector::PlotImage("Comparison of SiStrip APV gains values") {} + : cond::payloadInspector::PlotImage("Comparison of SiStrip APV gains values") {} - bool fill(const std::vector>& iovs) override { + bool fill() override { TH1F::SetDefaultSumw2(true); - std::vector> sorted_iovs = iovs; + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; - // 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); - }); + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -1567,50 +1577,56 @@ namespace { hratio->GetXaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) hratio->GetXaxis()->SetTitleOffset(3.); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; } }; - class SiStripApvGainsValuesComparatorSingleTag : public SiStripApvGainsValuesComparatorBase { - public: - SiStripApvGainsValuesComparatorSingleTag() : SiStripApvGainsValuesComparatorBase() { setSingleIov(false); } - }; - - class SiStripApvGainsValuesComparatorTwoTags : public SiStripApvGainsValuesComparatorBase { - public: - SiStripApvGainsValuesComparatorTwoTags() : SiStripApvGainsValuesComparatorBase() { setTwoTags(true); } - }; + using SiStripApvGainsValuesComparatorSingleTag = + SiStripApvGainsValuesComparatorBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripApvGainsValuesComparatorTwoTags = + SiStripApvGainsValuesComparatorBase<2, cond::payloadInspector::SINGLE_IOV>; //*******************************************// // Compare Gains ratio from 2 IOVs, region by region //******************************************// - class SiStripApvGainsRatioComparatorByRegionBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsRatioComparatorByRegionBase + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsRatioComparatorByRegionBase() - : cond::payloadInspector::PlotImage("Module by Module Comparison of SiStrip APV gains"), + : cond::payloadInspector::PlotImage( + "Module by Module Comparison of SiStrip APV gains"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector>& iovs) override { + bool fill() override { //gStyle->SetPalette(5); SiStripPI::setPaletteStyle(SiStripPI::GRAY); - std::vector> sorted_iovs = iovs; + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; - // 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); - }); + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -1739,7 +1755,7 @@ namespace { hpfx_tmp->SetMarkerStyle(20); hpfx_tmp->Draw("same"); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); delete hpfx_tmp; @@ -1784,42 +1800,44 @@ namespace { } }; - class SiStripApvGainsRatioComparatorByRegionSingleTag : public SiStripApvGainsRatioComparatorByRegionBase { - public: - SiStripApvGainsRatioComparatorByRegionSingleTag() : SiStripApvGainsRatioComparatorByRegionBase() { - setSingleIov(false); - } - }; - - class SiStripApvGainsRatioComparatorByRegionTwoTags : public SiStripApvGainsRatioComparatorByRegionBase { - public: - SiStripApvGainsRatioComparatorByRegionTwoTags() : SiStripApvGainsRatioComparatorByRegionBase() { setTwoTags(true); } - }; + using SiStripApvGainsRatioComparatorByRegionSingleTag = + SiStripApvGainsRatioComparatorByRegionBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripApvGainsRatioComparatorByRegionTwoTags = + SiStripApvGainsRatioComparatorByRegionBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ Compare Gains for each tracker region *************************************************/ - class SiStripApvGainsComparatorByRegionBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsComparatorByRegionBase : public cond::payloadInspector::PlotImage { public: SiStripApvGainsComparatorByRegionBase() - : cond::payloadInspector::PlotImage("SiStripGains Comparison By Region"), + : cond::payloadInspector::PlotImage("SiStripGains Comparison By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - 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); - }); + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + 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 = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = theIOVs.back(); + } - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.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::vector detid; last_payload->getDetIds(detid); @@ -1955,7 +1973,7 @@ namespace { legend.AddEntry(hlast.get(), ("IOV: " + std::to_string(std::get<0>(lastiov))).c_str(), "PL"); legend.Draw("same"); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; @@ -1965,31 +1983,27 @@ namespace { TrackerTopology m_trackerTopo; }; - class SiStripApvGainsComparatorByRegionSingleTag : public SiStripApvGainsComparatorByRegionBase { - public: - SiStripApvGainsComparatorByRegionSingleTag() : SiStripApvGainsComparatorByRegionBase() { setSingleIov(false); } - }; - - class SiStripApvGainsComparatorByRegionTwoTags : public SiStripApvGainsComparatorByRegionBase { - public: - SiStripApvGainsComparatorByRegionTwoTags() : SiStripApvGainsComparatorByRegionBase() { setTwoTags(true); } - }; + using SiStripApvGainsComparatorByRegionSingleTag = + SiStripApvGainsComparatorByRegionBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripApvGainsComparatorByRegionTwoTags = + SiStripApvGainsComparatorByRegionBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ Plot gain averages by region *************************************************/ - class SiStripApvGainsByRegion : public cond::payloadInspector::PlotImage { + class SiStripApvGainsByRegion + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsByRegion() - : cond::payloadInspector::PlotImage("SiStripGains By Region"), + : cond::payloadInspector::PlotImage( + "SiStripGains By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector>& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::vector detid; diff --git a/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc index 1971d763b25dd..678debfbad7f6 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc @@ -38,13 +38,12 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripBackPlaneCorrectionValue : public cond::payloadInspector::Histogram1D { + class SiStripBackPlaneCorrectionValue + : public cond::payloadInspector::Histogram1D { public: SiStripBackPlaneCorrectionValue() - : cond::payloadInspector::Histogram1D( - "SiStrip BackPlaneCorrection values", "SiStrip BackPlaneCorrection values", 100, 0.0, 0.1) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStrip BackPlaneCorrection values", "SiStrip BackPlaneCorrection values", 100, 0.0, 0.1) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -65,15 +64,16 @@ namespace { /************************************************ TrackerMap of SiStrip BackPlane Correction *************************************************/ - class SiStripBackPlaneCorrection_TrackerMap : public cond::payloadInspector::PlotImage { + class SiStripBackPlaneCorrection_TrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripBackPlaneCorrection_TrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map SiStrip Backplane correction") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map SiStrip Backplane correction") {} - bool fill(const std::vector > &iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripBackPlaneCorrection"); @@ -106,17 +106,18 @@ namespace { Plot SiStrip BackPlane Correction averages by partition *************************************************/ - class SiStripBackPlaneCorrectionByRegion : public cond::payloadInspector::PlotImage { + class SiStripBackPlaneCorrectionByRegion + : public cond::payloadInspector::PlotImage { public: SiStripBackPlaneCorrectionByRegion() - : cond::payloadInspector::PlotImage("SiStripBackPlaneCorrection By Region"), + : cond::payloadInspector::PlotImage( + "SiStripBackPlaneCorrection By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector > &iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); SiStripDetSummary summaryBP{&m_trackerTopo}; diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index ccd4f6915db81..e88afda8620bc 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -51,13 +51,12 @@ namespace { test class *************************************************/ - class SiStripBadStripTest : public cond::payloadInspector::Histogram1D { + class SiStripBadStripTest + : public cond::payloadInspector::Histogram1D { public: SiStripBadStripTest() - : cond::payloadInspector::Histogram1D( - "SiStrip Bad Strip test", "SiStrip Bad Strip test", 10, 0.0, 10.0) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStrip Bad Strip test", "SiStrip Bad Strip test", 10, 0.0, 10.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -486,17 +485,18 @@ namespace { Plot BadStrip by region *************************************************/ - class SiStripBadStripByRegion : public cond::payloadInspector::PlotImage { + class SiStripBadStripByRegion + : public cond::payloadInspector::PlotImage { public: SiStripBadStripByRegion() - : cond::payloadInspector::PlotImage("SiStrip BadStrip By Region"), + : cond::payloadInspector::PlotImage( + "SiStrip BadStrip By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::vector detid; @@ -620,26 +620,36 @@ namespace { Plot BadStrip by region comparison *************************************************/ - class SiStripBadStripByRegionComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripBadStripByRegionComparisonBase + : public cond::payloadInspector::PlotImage { public: SiStripBadStripByRegionComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip BadStrip By Region Comparison"), + : cond::payloadInspector::PlotImage("SiStrip BadStrip By Region Comparison"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - 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(); + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + 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 = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -818,7 +828,7 @@ namespace { legend.SetTextSize(0.025); legend.Draw("same"); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canvas.SaveAs(fileName.c_str()); return true; @@ -828,37 +838,44 @@ namespace { TrackerTopology m_trackerTopo; }; - class SiStripBadStripByRegionComparisonSingleTag : public SiStripBadStripByRegionComparisonBase { - public: - SiStripBadStripByRegionComparisonSingleTag() : SiStripBadStripByRegionComparisonBase() { setSingleIov(false); } - }; - - class SiStripBadStripByRegionComparisonTwoTags : public SiStripBadStripByRegionComparisonBase { - public: - SiStripBadStripByRegionComparisonTwoTags() : SiStripBadStripByRegionComparisonBase() { setTwoTags(true); } - }; + using SiStripBadStripByRegionComparisonSingleTag = + SiStripBadStripByRegionComparisonBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripBadStripByRegionComparisonTwoTags = + SiStripBadStripByRegionComparisonBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ TrackerMap of SiStripBadStrip (bad strips fraction difference) *************************************************/ - class SiStripBadStripFractionComparisonTrackerMapBase : public cond::payloadInspector::PlotImage { + + template + class SiStripBadStripFractionComparisonTrackerMapBase + : public cond::payloadInspector::PlotImage { public: SiStripBadStripFractionComparisonTrackerMapBase() - : cond::payloadInspector::PlotImage("Tracker Map of SiStrip bad strip fraction difference") {} - - 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); - }); + : cond::payloadInspector::PlotImage( + "Tracker Map of SiStrip bad strip fraction difference") {} - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + bool fill() override { + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + 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 = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -935,7 +952,7 @@ namespace { //========================= - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); tmap->save(true, 0, 0, fileName); delete reader; @@ -943,35 +960,27 @@ namespace { } }; - class SiStripBadStripFractionComparisonTrackerMapSingleTag : public SiStripBadStripFractionComparisonTrackerMapBase { - public: - SiStripBadStripFractionComparisonTrackerMapSingleTag() : SiStripBadStripFractionComparisonTrackerMapBase() { - setSingleIov(false); - } - }; - - class SiStripBadStripFractionComparisonTrackerMapTwoTags : public SiStripBadStripFractionComparisonTrackerMapBase { - public: - SiStripBadStripFractionComparisonTrackerMapTwoTags() : SiStripBadStripFractionComparisonTrackerMapBase() { - setTwoTags(true); - } - }; + using SiStripBadStripFractionComparisonTrackerMapSingleTag = + SiStripBadStripFractionComparisonTrackerMapBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripBadStripFractionComparisonTrackerMapTwoTags = + SiStripBadStripFractionComparisonTrackerMapBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ Plot BadStrip Quality analysis *************************************************/ - class SiStripBadStripQualityAnalysis : public cond::payloadInspector::PlotImage { + class SiStripBadStripQualityAnalysis + : public cond::payloadInspector::PlotImage { public: SiStripBadStripQualityAnalysis() - : cond::payloadInspector::PlotImage("SiStrip BadStrip Quality Analysis"), + : cond::payloadInspector::PlotImage( + "SiStrip BadStrip Quality Analysis"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); SiStripQuality* siStripQuality_ = new SiStripQuality(); @@ -1141,29 +1150,39 @@ namespace { Plot BadStrip Quality Comparison *************************************************/ - class SiStripBadStripQualityComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripBadStripQualityComparisonBase : public cond::payloadInspector::PlotImage { public: SiStripBadStripQualityComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip BadStrip Quality Comparison Analysis"), + : cond::payloadInspector::PlotImage( + "SiStrip BadStrip Quality Comparison Analysis"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector >& iovs) override { + bool fill() override { //SiStripPI::setPaletteStyle(SiStripPI::BLUERED); gStyle->SetPalette(kTemperatureMap); - std::vector > sorted_iovs = iovs; + // trick to deal with the multi-ioved tag and two tag case at the same time + auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name; + std::string tagname2 = ""; + auto firstiov = theIOVs.front(); + std::tuple lastiov; - // 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); - }); + // we don't support (yet) comparison with more than 2 tags + assert(this->m_plotAnnotations.ntags < 3); - auto firstiov = sorted_iovs.front(); - auto lastiov = sorted_iovs.back(); + if (this->m_plotAnnotations.ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + tagname2 = cond::payloadInspector::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)); @@ -1337,7 +1356,7 @@ namespace { 0.96, ("#DeltaIOV: " + std::to_string(std::get<0>(lastiov)) + " - " + std::to_string(std::get<0>(firstiov))) .c_str()); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); canv.SaveAs(fileName.c_str()); delete f_siStripQuality_; @@ -1350,15 +1369,10 @@ namespace { TrackerTopology m_trackerTopo; }; - class SiStripBadStripQualityComparisonSingleTag : public SiStripBadStripQualityComparisonBase { - public: - SiStripBadStripQualityComparisonSingleTag() : SiStripBadStripQualityComparisonBase() { setSingleIov(false); } - }; - - class SiStripBadStripQualityComparisonTwoTags : public SiStripBadStripQualityComparisonBase { - public: - SiStripBadStripQualityComparisonTwoTags() : SiStripBadStripQualityComparisonBase() { setTwoTags(true); } - }; + using SiStripBadStripQualityComparisonSingleTag = + SiStripBadStripQualityComparisonBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripBadStripQualityComparisonTwoTags = + SiStripBadStripQualityComparisonBase<2, cond::payloadInspector::SINGLE_IOV>; } // namespace diff --git a/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc index 2457710634c13..f422cb338bfc0 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc @@ -37,13 +37,12 @@ namespace { // test class - class SiStripConfObjectTest : public cond::payloadInspector::Histogram1D { + class SiStripConfObjectTest + : public cond::payloadInspector::Histogram1D { public: SiStripConfObjectTest() - : cond::payloadInspector::Histogram1D( - "SiStrip Configuration Object test", "SiStrip Configuration Object test", 1, 0.0, 1.0) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStrip Configuration Object test", "SiStrip Configuration Object test", 1, 0.0, 1.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -69,14 +68,16 @@ namespace { }; // display class - class SiStripConfObjectDisplay : public cond::payloadInspector::PlotImage { + class SiStripConfObjectDisplay + : public cond::payloadInspector::PlotImage { public: - SiStripConfObjectDisplay() : cond::payloadInspector::PlotImage("Display Configuration Values") { - setSingleIov(true); - } + SiStripConfObjectDisplay() + : cond::payloadInspector::PlotImage( + "Display Configuration Values") {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); unsigned int run = std::get<0>(iov); diff --git a/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc index a81cc94eac700..40c4efff7c00d 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc @@ -44,15 +44,16 @@ namespace { /************************************************ TrackerMap of Module VOff *************************************************/ - class SiStripDetVOff_IsModuleVOff_TrackerMap : public cond::payloadInspector::PlotImage { + class SiStripDetVOff_IsModuleVOff_TrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripDetVOff_IsModuleVOff_TrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map IsModuleVOff") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map IsModuleVOff") {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripIsModuleVOff"); @@ -79,15 +80,16 @@ namespace { /************************************************ TrackerMap of Module HVOff *************************************************/ - class SiStripDetVOff_IsModuleHVOff_TrackerMap : public cond::payloadInspector::PlotImage { + class SiStripDetVOff_IsModuleHVOff_TrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripDetVOff_IsModuleHVOff_TrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map IsModuleHVOff") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map IsModuleHVOff") {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripIsModuleHVOff"); @@ -114,15 +116,16 @@ namespace { /************************************************ TrackerMap of Module LVOff *************************************************/ - class SiStripDetVOff_IsModuleLVOff_TrackerMap : public cond::payloadInspector::PlotImage { + class SiStripDetVOff_IsModuleLVOff_TrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripDetVOff_IsModuleLVOff_TrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map IsModuleLVOff") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map IsModuleLVOff") {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripIsModuleLVOff"); @@ -155,13 +158,12 @@ namespace { } template - class SiStripDetVOffListOfModules : public cond::payloadInspector::Histogram1DD { + class SiStripDetVOffListOfModules + : public cond::payloadInspector::Histogram1DD { public: SiStripDetVOffListOfModules() - : cond::payloadInspector::Histogram1DD( - "SiStrip Off modules", "SiStrip Off modules", 15148, 0., 15148., "DetId of VOff module") { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1DD( + "SiStrip Off modules", "SiStrip Off modules", 15148, 0., 15148., "DetId of VOff module") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -217,15 +219,14 @@ namespace { test class *************************************************/ - class SiStripDetVOffTest : public cond::payloadInspector::Histogram1D { + class SiStripDetVOffTest + : public cond::payloadInspector::Histogram1D { public: SiStripDetVOffTest() - : cond::payloadInspector::Histogram1D( + : cond::payloadInspector::Histogram1D( "SiStrip DetVOff test", "SiStrip DetVOff test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - Base::setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -271,17 +272,18 @@ namespace { Plot DetVOff by region *************************************************/ - class SiStripDetVOffByRegion : public cond::payloadInspector::PlotImage { + class SiStripDetVOffByRegion + : public cond::payloadInspector::PlotImage { public: SiStripDetVOffByRegion() - : cond::payloadInspector::PlotImage("SiStrip DetVOff By Region"), + : cond::payloadInspector::PlotImage( + "SiStrip DetVOff By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::vector detid; diff --git a/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc index 995cc8e2a2f31..1d64a01fbb29e 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc @@ -30,15 +30,16 @@ namespace { /************************************************ TrackerMap of SiStrip FED Cabling *************************************************/ - class SiStripFedCabling_TrackerMap : public cond::payloadInspector::PlotImage { + class SiStripFedCabling_TrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripFedCabling_TrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map SiStrip Fed Cabling") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map SiStrip Fed Cabling") {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripFedCabling"); @@ -75,14 +76,16 @@ namespace { /************************************************ Summary Plot of SiStrip FED Cabling *************************************************/ - class SiStripFedCabling_Summary : public cond::payloadInspector::PlotImage { + class SiStripFedCabling_Summary + : public cond::payloadInspector::PlotImage { public: - SiStripFedCabling_Summary() : cond::payloadInspector::PlotImage("SiStrip Fed Cabling Summary") { - setSingleIov(true); - } + SiStripFedCabling_Summary() + : cond::payloadInspector::PlotImage( + "SiStrip Fed Cabling Summary") {} - bool fill(const std::vector >& iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); int IOV = std::get<0>(iov); std::vector activeDetIds; diff --git a/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc index 9364008a917ee..5c19f738adbec 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc @@ -44,13 +44,12 @@ namespace { *************** test class ****************** *************************************************/ - class SiStripLatencyTest : public cond::payloadInspector::Histogram1D { + class SiStripLatencyTest + : public cond::payloadInspector::Histogram1D { public: SiStripLatencyTest() - : cond::payloadInspector::Histogram1D( - "SiStripLatency values", "SiStripLatency values", 5, 0.0, 5.0) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStripLatency values", "SiStripLatency values", 5, 0.0, 5.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -68,13 +67,12 @@ namespace { /*********************************************** // 1d histogram of mode of 1 IOV ************************************************/ - class SiStripLatencyMode : public cond::payloadInspector::Histogram1D { + class SiStripLatencyMode + : public cond::payloadInspector::Histogram1D { public: SiStripLatencyMode() : cond::payloadInspector::Histogram1D( - "SiStripLatency mode", "SiStripLatency mode", 70, -10, 60) { - Base::setSingleIov(true); - } + "SiStripLatency mode", "SiStripLatency mode", 70, -10, 60) {} bool fill() override { auto tag = PlotBase::getTag<0>(); diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index 61be13dabe231..720a1cef15365 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -40,13 +40,12 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripLorentzAngleValue : public cond::payloadInspector::Histogram1D { + class SiStripLorentzAngleValue + : public cond::payloadInspector::Histogram1D { public: SiStripLorentzAngleValue() - : cond::payloadInspector::Histogram1D( - "SiStrip LorentzAngle values", "SiStrip LorentzAngle values", 100, 0.0, 0.05) { - Base::setSingleIov(true); - } + : cond::payloadInspector::Histogram1D( + "SiStrip LorentzAngle values", "SiStrip LorentzAngle values", 100, 0.0, 0.05) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -67,15 +66,16 @@ namespace { /************************************************ TrackerMap of SiStrip Lorentz Angle *************************************************/ - class SiStripLorentzAngle_TrackerMap : public cond::payloadInspector::PlotImage { + class SiStripLorentzAngle_TrackerMap + : public cond::payloadInspector::PlotImage { public: SiStripLorentzAngle_TrackerMap() - : cond::payloadInspector::PlotImage("Tracker Map SiStrip Lorentz Angle") { - setSingleIov(true); - } + : cond::payloadInspector::PlotImage( + "Tracker Map SiStrip Lorentz Angle") {} - bool fill(const std::vector > &iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); std::unique_ptr tmap = std::make_unique("SiStripLorentzAngle"); @@ -152,17 +152,18 @@ namespace { Plot Lorentz Angle averages by partition *************************************************/ - class SiStripLorentzAngleByRegion : public cond::payloadInspector::PlotImage { + class SiStripLorentzAngleByRegion + : public cond::payloadInspector::PlotImage { public: SiStripLorentzAngleByRegion() - : cond::payloadInspector::PlotImage("SiStripLorentzAngle By Region"), + : cond::payloadInspector::PlotImage( + "SiStripLorentzAngle By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector > &iovs) override { - auto iov = iovs.front(); + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); SiStripDetSummary summaryLA{&m_trackerTopo}; diff --git a/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc index be534eee6f44e..8f0d436d314a9 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc @@ -48,15 +48,14 @@ namespace { test class *************************************************/ - class SiStripThresholdTest : public cond::payloadInspector::Histogram1D { + class SiStripThresholdTest + : public cond::payloadInspector::Histogram1D { public: SiStripThresholdTest() - : cond::payloadInspector::Histogram1D( + : cond::payloadInspector::Histogram1D( "SiStrip Threshold test", "SiStrip Threshold test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - Base::setSingleIov(true); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -86,17 +85,16 @@ namespace { 1d histogram of SiStripThresholds of 1 IOV - High Threshold *************************************************************/ - class SiStripThresholdValueHigh : public cond::payloadInspector::Histogram1D { + class SiStripThresholdValueHigh + : public cond::payloadInspector::Histogram1D { public: SiStripThresholdValueHigh() - : cond::payloadInspector::Histogram1D("SiStrip High threshold values (checked per APV)", - "SiStrip High threshold values (cheched per APV)", - 10, - 0.0, - 10) { - Base::setSingleIov(true); - } - + : cond::payloadInspector::Histogram1D( + "SiStrip High threshold values (checked per APV)", + "SiStrip High threshold values (cheched per APV)", + 10, + 0.0, + 10) {} bool fill() override { auto tag = PlotBase::getTag<0>(); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); @@ -132,17 +130,16 @@ namespace { 1d histogram of SiStripThresholds of 1 IOV - Low Threshold *************************************************************/ - class SiStripThresholdValueLow : public cond::payloadInspector::Histogram1D { + class SiStripThresholdValueLow + : public cond::payloadInspector::Histogram1D { public: SiStripThresholdValueLow() - : cond::payloadInspector::Histogram1D("SiStrip Low threshold values (checked per APV)", - "SiStrip Low threshold values (cheched per APV)", - 10, - 0.0, - 10) { - Base::setSingleIov(true); - } - + : cond::payloadInspector::Histogram1D( + "SiStrip Low threshold values (checked per APV)", + "SiStrip Low threshold values (cheched per APV)", + 10, + 0.0, + 10) {} bool fill() override { auto tag = PlotBase::getTag<0>(); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");