From 3ec5215518ad6f4ab87f0a1346fe7b9050402ed6 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 10 Dec 2020 13:03:13 +0100 Subject: [PATCH 01/12] introduce and use SiStripTkMaps --- .../SiStripPlugins/interface/SiStripTkMaps.h | 199 ++++++++++++++++++ .../SiStripBadStrip_PayloadInspector.cc | 74 +++++++ .../SiStripLorentzAngle_PayloadInspector.cc | 54 +++++ CondCore/SiStripPlugins/test/test.sh | 21 ++ 4 files changed, 348 insertions(+) create mode 100644 CondCore/SiStripPlugins/interface/SiStripTkMaps.h diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h new file mode 100644 index 0000000000000..8b091a295b9b1 --- /dev/null +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -0,0 +1,199 @@ +#ifndef CONDCORE_SISTRIPPLUGINS_SISTRIPTKMAPS_H +#define CONDCORE_SISTRIPPLUGINS_SISTRIPTKMAPS_H + +// CMSSW includes +#include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h" +#include "DataFormats/SiPixelDetId/interface/PXBDetId.h" +#include "DataFormats/SiPixelDetId/interface/PXFDetId.h" +#include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" +#include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +// ROOT includes +#include "TPaletteAxis.h" +#include "TGaxis.h" +#include "TCanvas.h" +#include "TColor.h" +#include "TGraph.h" +#include "TH1.h" +#include "TH2.h" +#include "TLatex.h" +#include "TH2Poly.h" +#include "TObjArray.h" +#include "TObjString.h" +#include "TProfile2D.h" +#include "TStyle.h" + +// STL includes +#include +#include +#include +#include +#include +#include +#include + +#define MYOUT LogDebug("SiStripTkMaps") + +/*-------------------------------------------------------------------- +/ Ancillary class to build SiStrip Tracker maps +/--------------------------------------------------------------------*/ +class SiStripTkMaps { +public: + SiStripTkMaps(const char* option) + : m_option{option}, + m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( + edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {} + + ~SiStripTkMaps() {} + + //============================================================================ + void bookMap(const std::string mapTitle,const std::string zAxisTitle) { + double minx = 0xFFFFFF, maxx = -0xFFFFFF, miny = 0xFFFFFF, maxy = -0xFFFFFFF; + readVertices(minx, maxx, miny, maxy); + + // set the titles + m_zAxisTitle=zAxisTitle; + m_mapTitle=mapTitle; + + TGaxis::SetMaxDigits(2); + + static constexpr int margin = 5; + m_trackerMap = + new TH2Poly("Tracker Map", m_mapTitle.c_str(), minx - margin, maxx + margin, miny - margin, maxy + margin); + m_trackerMap->SetFloat(); + m_trackerMap->SetOption(m_option); + m_trackerMap->SetStats(false); + m_trackerMap->GetZaxis()->SetLabelSize(0.03); + m_trackerMap->GetZaxis()->SetTitleOffset(0.7); + m_trackerMap->GetZaxis()->SetTitle(m_zAxisTitle.c_str()); + m_trackerMap->GetZaxis()->CenterTitle(); + + for (const auto& pair : m_bins) { + m_trackerMap->AddBin(pair.second->Clone()); + } + } + + //============================================================================ + void fill(long rawid, double val) { m_trackerMap->Fill(TString::Format("%ld", rawid), val); } + + //============================================================================ + void drawMap(TCanvas& canvas, std::string option = "") { + canvas.cd(); + adjustCanvasMargins(canvas.cd(), 0.07, 0.01, 0.01, 0.10); + + m_trackerMap->SetTitle(""); + if (!option.empty()) { + m_trackerMap->Draw(option.c_str()); + } else { + m_trackerMap->Draw(); + } + + canvas.SetFrameLineColor(0); + + } + + //============================================================================ + TH2Poly* getTheMap() { return m_trackerMap; } + + //============================================================================ + void setZAxisRange(double xmin, double xmax) { m_trackerMap->GetZaxis()->SetRangeUser(xmin, xmax); } + + //============================================================================ + void adjustCanvasMargins(TVirtualPad* pad, float top, float bottom, float left, float right) { + if (top > 0) { + pad->SetTopMargin(top); + } + if (bottom > 0) { + pad->SetBottomMargin(bottom); + } + if (left > 0) { + pad->SetLeftMargin(left); + } + if (right > 0) { + pad->SetRightMargin(right); + } + } + + //============================================================================ + void readVertices(double& minx, double& maxx, double& miny, double& maxy) { + std::ifstream in; + + in.open(edm::FileInPath("DQM/SiStripMonitorClient/data/Geometry/tracker_map_bare").fullPath().c_str()); + + if (!in.good()) { + throw cms::Exception("FileError") << "Problem opening corner file!!" << std::endl; + return; + } + + while (in.good()) { + long detid = 0; + double x[5], y[5]; + + std::string line; + std::getline(in, line); + + TString string(line); + TObjArray* array = string.Tokenize(" "); + int ix{0}, iy{0}; + bool isPixel{false}; + for (int i = 0; i < array->GetEntries(); ++i) { + if (i == 0) { + detid = static_cast(array->At(i))->String().Atoll(); + + // Drop Pixel Data + DetId detId(detid); + if (detId.subdetId() == PixelSubdetector::PixelBarrel || detId.subdetId() == PixelSubdetector::PixelEndcap) { + isPixel = true; + break; + } + } else { + if (i % 2 == 0) { + x[ix] = static_cast(array->At(i))->String().Atof(); + + if (x[ix] < minx) { + minx = x[ix]; + } + + if (x[ix] > maxx) { + maxx = x[ix]; + } + + ++ix; + } else { + y[iy] = static_cast(array->At(i))->String().Atof(); + + if (y[iy] < miny) { + miny = y[iy]; + } + if (y[iy] > maxy) { + maxy = y[iy]; + } + + ++iy; + } + } + } + + if (isPixel) { + continue; + } + + m_detIdVector.push_back(detid); + m_bins[detid] = std::make_shared(ix, x, y); + m_bins[detid]->SetName(TString::Format("%ld", detid)); + m_bins[detid]->SetTitle(TString::Format("Module ID=%ld", detid)); + } + } + +private: + Option_t* m_option; + std::string m_mapTitle=""; + std::string m_zAxisTitle=""; + std::map > m_bins; + std::vector m_detIdVector; + TrackerTopology m_trackerTopo; + TH2Poly* m_trackerMap{nullptr}; +}; + +#endif diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 232c09f5561b5..652c32ee8b3f3 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -22,6 +22,7 @@ // needed for the tracker map #include "CommonTools/TrackerMap/interface/TrackerMap.h" +#include "CondCore/SiStripPlugins/interface/SiStripTkMaps.h" // auxilliary functions #include "CondCore/SiStripPlugins/interface/SiStripPayloadInspectorHelper.h" @@ -192,6 +193,78 @@ namespace { } }; + /************************************************ + TrackerMap of SiStripBadStrip (bad strips fraction) + *************************************************/ + class SiStripBadStripFractionTkMap + : public cond::payloadInspector::PlotImage { + public: + SiStripBadStripFractionTkMap() + : cond::payloadInspector::PlotImage( + "Tracker Map of SiStrip Bad Components fraction") {} + + bool fill() override { + gStyle->SetPalette(kRainBow); + + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); + auto tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + std::shared_ptr payload = fetchPayload(std::get<1>(iov)); + + edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); + + auto theIOVsince = std::to_string(std::get<0>(iov)); + + std::string titleMap = "Fraction of bad Strips per module, Run: " + theIOVsince + " (tag: " + tagname + ")"; + + SiStripTkMaps myMap("COLZA0 L"); + myMap.bookMap(titleMap,""); + + SiStripTkMaps ghost("AL"); + ghost.bookMap(titleMap,""); + + std::vector detid; + payload->getDetIds(detid); + + std::map badStripsPerDetId; + + for (const auto& d : detid) { + SiStripBadStrip::Range range = payload->getRange(d); + for (std::vector::const_iterator badStrip = range.first; badStrip != range.second; ++badStrip) { + badStripsPerDetId[d] += payload->decode(*badStrip).range; + //ss << "DetId="<< d << " Strip=" << payload->decode(*badStrip).firstStrip <<":"<< payload->decode(*badStrip).range << " flag="<< payload->decode(*badStrip).flag << std::endl; + } + float fraction = badStripsPerDetId[d] / (128. * reader->getNumberOfApvsAndStripLength(d).first); + if (fraction > 0.) { + myMap.fill(d, fraction); + } + } // loop over detIds + + //========================= + + std::string fileName(m_imageFileName); + + //myMap.setZAxisRange(-0.4,1.); + TCanvas canvas("Bad Components fraction", "bad components fraction", 3000, 1200); + myMap.drawMap(canvas, ""); + ghost.drawMap(canvas, "same"); + + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.045); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC(gPad->GetLeftMargin(), + 1 - gPad->GetTopMargin() + 0.02, + titleMap.c_str()); + + canvas.SaveAs(fileName.c_str()); + + delete reader; + return true; + } + }; + /************************************************ time history histogram of bad components fraction *************************************************/ @@ -1304,6 +1377,7 @@ PAYLOAD_INSPECTOR_MODULE(SiStripBadStrip) { PAYLOAD_INSPECTOR_CLASS(SiStripBadStripTest); PAYLOAD_INSPECTOR_CLASS(SiStripBadModuleTrackerMap); PAYLOAD_INSPECTOR_CLASS(SiStripBadStripFractionTrackerMap); + PAYLOAD_INSPECTOR_CLASS(SiStripBadStripFractionTkMap); PAYLOAD_INSPECTOR_CLASS(SiStripBadStripFractionByRun); PAYLOAD_INSPECTOR_CLASS(SiStripBadStripTIBFractionByRun); PAYLOAD_INSPECTOR_CLASS(SiStripBadStripTOBFractionByRun); diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index 2c66589867673..2b2acbc8c005f 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -15,6 +15,8 @@ #include "CommonTools/TrackerMap/interface/TrackerMap.h" #include "CondCore/SiStripPlugins/interface/SiStripPayloadInspectorHelper.h" +#include "CondCore/SiStripPlugins/interface/SiStripTkMaps.h" + #include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h" #include @@ -102,6 +104,57 @@ namespace { } }; + /************************************************ + SiStripTkMaps of SiStrip Lorentz Angle + *************************************************/ + class SiStripLorentzAngleTkMap + : public cond::payloadInspector::PlotImage { + public: + SiStripLorentzAngleTkMap() + : cond::payloadInspector::PlotImage( + "Tracker Map SiStrip Lorentz Angle") {} + + bool fill() override { + gStyle->SetPalette(kRainBow); + + auto tag = PlotBase::getTag<0>(); + auto iov = tag.iovs.front(); + auto tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + + std::shared_ptr payload = fetchPayload(std::get<1>(iov)); + + auto theIOVsince = std::to_string(std::get<0>(iov)); + std::string titleMap = "SiStrip Lorentz Angle Map, Run: " + theIOVsince + " (tag: " + tagname + ")"; + + SiStripTkMaps myMap("COLZA L"); + myMap.bookMap(titleMap,"SiStrip #mu_{H}=(tan#theta_{L}/B) [1/T]"); + + std::map LAMap_ = payload->getLorentzAngles(); + + for (const auto &element : LAMap_) { + myMap.fill(element.first, element.second); + } // loop over the LA MAP + + std::string fileName(m_imageFileName); + + TCanvas canvas("LA map", "LA map", 3000, 1200); + myMap.drawMap(canvas); + + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.045); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC(gPad->GetLeftMargin(), + 1 - gPad->GetTopMargin() + 0.02, + titleMap.c_str()); + + canvas.SaveAs(fileName.c_str()); + canvas.SaveAs("test.root"); + + return true; + } + }; + /************************************************ Plot Lorentz Angle averages by partition *************************************************/ @@ -405,6 +458,7 @@ namespace { PAYLOAD_INSPECTOR_MODULE(SiStripLorentzAngle) { PAYLOAD_INSPECTOR_CLASS(SiStripLorentzAngleValue); + PAYLOAD_INSPECTOR_CLASS(SiStripLorentzAngleTkMap); PAYLOAD_INSPECTOR_CLASS(SiStripLorentzAngle_TrackerMap); PAYLOAD_INSPECTOR_CLASS(SiStripLorentzAngleByRegion); PAYLOAD_INSPECTOR_CLASS(SiStripLorentzAngleByRegionCompareSingleTag); diff --git a/CondCore/SiStripPlugins/test/test.sh b/CondCore/SiStripPlugins/test/test.sh index b2d6ce8c54e11..8b8e14d6e5533 100755 --- a/CondCore/SiStripPlugins/test/test.sh +++ b/CondCore/SiStripPlugins/test/test.sh @@ -119,3 +119,24 @@ getPayloadData.py \ --iovs '{"start_iov": "6850066318803433472", "end_iov": "6850066318803433472"}' \ --db Prod \ --test; + +###################### +# Test SiStripTkMaps +###################### +getPayloadData.py \ + --plugin pluginSiStripBadStrip_PayloadInspector \ + --plot plot_SiStripBadStripFractionTkMap \ + --tag SiStripBadComponents_startupMC_for2017_v1_mc \ + --time_type Run \ + --iovs '{"start_iov": "1", "end_iov": "1"}' \ + --db Prod \ + --test ; + +getPayloadData.py \ + --plugin pluginSiStripLorentzAngle_PayloadInspector \ + --plot plot_SiStripLorentzAngleTkMap \ + --tag SiStripLorentzAngleDeco_GR10_v1_prompt \ + --time_type Run \ + --iovs '{"start_iov": "1", "end_iov": "1"}' \ + --db Prod \ + --test; From 87b4b7b79c6a1b4cec6fd68f3b5d895b3a1309a9 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 14 Dec 2020 16:10:15 +0100 Subject: [PATCH 02/12] fix a couple of memory leaks --- .../SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc | 2 +- .../plugins/SiStripPedestals_PayloadInspector.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc index 75b4978c7f667..52ceb97ceca33 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc @@ -150,7 +150,7 @@ namespace { TCanvas canvas("ByDetId", "ByDetId", sides.second * 800, sides.first * 600); canvas.Divide(sides.second, sides.first); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); - SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); + auto reader = std::make_unique(fp_.fullPath()); for (const auto& the_detid : the_detids) { edm::LogPrint("SiStripNoisePerDetId") << "DetId:" << the_detid << std::endl; diff --git a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc index ef5899cb742aa..1534577d2951c 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc @@ -148,7 +148,7 @@ namespace { TCanvas canvas("ByDetId", "ByDetId", sides.second * 800, sides.first * 600); canvas.Divide(sides.second, sides.first); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); - SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); + auto reader = std::make_unique(fp_.fullPath()); for (const auto& the_detid : the_detids) { edm::LogPrint("SiStripNoisePerDetId") << "DetId:" << the_detid << std::endl; @@ -689,7 +689,7 @@ namespace { std::shared_ptr payload = fetchPayload(std::get<1>(iov)); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); - SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); + auto reader = std::make_unique(fp_.fullPath()); std::string titleMap = "Tracker Map of Zero SiStrip Pedestals fraction per module (payload : " + std::get<1>(iov) + ")"; From 80fdeaf0bffb6116434bdfa836383376f6ad019b Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 15 Dec 2020 00:39:45 +0100 Subject: [PATCH 03/12] miscellaneous fixes --- .../interface/SiStripPayloadInspectorHelper.h | 22 ++++---- .../SiStripPlugins/interface/SiStripTkMaps.h | 51 +++++++++++++++---- .../SiStripBadStrip_PayloadInspector.cc | 8 ++- .../SiStripLorentzAngle_PayloadInspector.cc | 11 ++-- .../plugins/SiStripNoises_PayloadInspector.cc | 2 +- 5 files changed, 63 insertions(+), 31 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripPayloadInspectorHelper.h b/CondCore/SiStripPlugins/interface/SiStripPayloadInspectorHelper.h index d7e1edc2913c3..a227de7772127 100644 --- a/CondCore/SiStripPlugins/interface/SiStripPayloadInspectorHelper.h +++ b/CondCore/SiStripPlugins/interface/SiStripPayloadInspectorHelper.h @@ -837,19 +837,21 @@ namespace SiStripPI { } break; case FIRE: { - double stops[NRGBs] = {0.00, 0.20, 0.80, 1.00}; - double red[NRGBs] = {1.00, 1.00, 1.00, 0.50}; - double green[NRGBs] = {1.00, 1.00, 0.00, 0.00}; - double blue[NRGBs] = {0.20, 0.00, 0.00, 0.00}; - TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); + const int NCOLs = 4; + double stops[NCOLs] = {0.00, 0.20, 0.80, 1.00}; + double red[NCOLs] = {1.00, 1.00, 1.00, 0.50}; + double green[NCOLs] = {1.00, 1.00, 0.00, 0.00}; + double blue[NCOLs] = {0.20, 0.00, 0.00, 0.00}; + TColor::CreateGradientColorTable(NCOLs, stops, red, green, blue, NCont); } break; case ANTIFIRE: { - double stops[NRGBs] = {0.00, 0.20, 0.80, 1.00}; - double red[NRGBs] = {0.50, 1.00, 1.00, 1.00}; - double green[NRGBs] = {0.00, 0.00, 1.00, 1.00}; - double blue[NRGBs] = {0.00, 0.00, 0.00, 0.20}; - TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); + const int NCOLs = 4; + double stops[NCOLs] = {0.00, 0.20, 0.80, 1.00}; + double red[NCOLs] = {0.50, 1.00, 1.00, 1.00}; + double green[NCOLs] = {0.00, 0.00, 1.00, 1.00}; + double blue[NCOLs] = {0.00, 0.00, 0.00, 0.20}; + TColor::CreateGradientColorTable(NCOLs, stops, red, green, blue, NCont); } break; case LOGREDBLUE: { diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index 8b091a295b9b1..91596a7037fbe 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -48,13 +48,13 @@ class SiStripTkMaps { ~SiStripTkMaps() {} //============================================================================ - void bookMap(const std::string mapTitle,const std::string zAxisTitle) { + void bookMap(const std::string mapTitle, const std::string zAxisTitle) { double minx = 0xFFFFFF, maxx = -0xFFFFFF, miny = 0xFFFFFF, maxy = -0xFFFFFFF; readVertices(minx, maxx, miny, maxy); // set the titles - m_zAxisTitle=zAxisTitle; - m_mapTitle=mapTitle; + m_zAxisTitle = zAxisTitle; + m_mapTitle = mapTitle; TGaxis::SetMaxDigits(2); @@ -75,22 +75,53 @@ class SiStripTkMaps { } //============================================================================ - void fill(long rawid, double val) { m_trackerMap->Fill(TString::Format("%ld", rawid), val); } + void fill(long rawid, double val) { + m_trackerMap->Fill(TString::Format("%ld", rawid), val); + m_values.push_back(val); + } //============================================================================ void drawMap(TCanvas& canvas, std::string option = "") { canvas.cd(); - adjustCanvasMargins(canvas.cd(), 0.07, 0.01, 0.01, 0.10); + adjustCanvasMargins(canvas.cd(), 0.08, 0.06, 0.01, 0.06); + + /* + if(!m_values.empty()){ + + m_axmax = *std::max_element(m_values.begin(), m_values.end()); + m_axmin = *std::min_element(m_values.begin(), m_values.end()); - m_trackerMap->SetTitle(""); + canvas.cd(); + + auto color_bar_axis = new TGaxis(gPad->GetUxmin()-0.01,0.03, gPad->GetUxmax()-0.01, 0.03 , m_axmin, m_axmax ,505, "SDH"); + color_bar_axis->SetName("color_bar_axis"); + color_bar_axis->Draw(); + + } + */ + + canvas.Update(); + + m_trackerMap->SetTitle(""); if (!option.empty()) { m_trackerMap->Draw(option.c_str()); } else { m_trackerMap->Draw(); } - canvas.SetFrameLineColor(0); + gPad->Update(); + TPaletteAxis* palette = (TPaletteAxis*)m_trackerMap->GetListOfFunctions()->FindObject("palette"); + if (palette != nullptr) { + palette->SetLabelSize(0.02); + palette->SetX1NDC(0.95); + palette->SetX2NDC(0.96); + palette->SetY1NDC(0.05); + palette->SetY2NDC(0.95); + gPad->Modified(); + gPad->Update(); + } + canvas.SetFrameLineColor(0); } //============================================================================ @@ -188,10 +219,12 @@ class SiStripTkMaps { private: Option_t* m_option; - std::string m_mapTitle=""; - std::string m_zAxisTitle=""; + std::string m_mapTitle = ""; + std::string m_zAxisTitle = ""; + double m_axmin, m_axmax; std::map > m_bins; std::vector m_detIdVector; + std::vector m_values; TrackerTopology m_trackerTopo; TH2Poly* m_trackerMap{nullptr}; }; diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 652c32ee8b3f3..44d49d9e2d9c9 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -219,10 +219,10 @@ namespace { std::string titleMap = "Fraction of bad Strips per module, Run: " + theIOVsince + " (tag: " + tagname + ")"; SiStripTkMaps myMap("COLZA0 L"); - myMap.bookMap(titleMap,""); + myMap.bookMap(titleMap, ""); SiStripTkMaps ghost("AL"); - ghost.bookMap(titleMap,""); + ghost.bookMap(titleMap, ""); std::vector detid; payload->getDetIds(detid); @@ -254,9 +254,7 @@ namespace { ltx.SetTextFont(62); ltx.SetTextSize(0.045); ltx.SetTextAlign(11); - ltx.DrawLatexNDC(gPad->GetLeftMargin(), - 1 - gPad->GetTopMargin() + 0.02, - titleMap.c_str()); + ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.02, titleMap.c_str()); canvas.SaveAs(fileName.c_str()); diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index 2b2acbc8c005f..af098a2d84891 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -115,7 +115,8 @@ namespace { "Tracker Map SiStrip Lorentz Angle") {} bool fill() override { - gStyle->SetPalette(kRainBow); + //gStyle->SetPalette(kRainBow); + SiStripPI::setPaletteStyle(SiStripPI::BLUERED); auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); @@ -127,7 +128,7 @@ namespace { std::string titleMap = "SiStrip Lorentz Angle Map, Run: " + theIOVsince + " (tag: " + tagname + ")"; SiStripTkMaps myMap("COLZA L"); - myMap.bookMap(titleMap,"SiStrip #mu_{H}=(tan#theta_{L}/B) [1/T]"); + myMap.bookMap(titleMap, "SiStrip #mu_{H}=(tan#theta_{L}/B) [1/T]"); std::map LAMap_ = payload->getLorentzAngles(); @@ -138,15 +139,13 @@ namespace { std::string fileName(m_imageFileName); TCanvas canvas("LA map", "LA map", 3000, 1200); - myMap.drawMap(canvas); + myMap.drawMap(canvas, ""); auto ltx = TLatex(); ltx.SetTextFont(62); ltx.SetTextSize(0.045); ltx.SetTextAlign(11); - ltx.DrawLatexNDC(gPad->GetLeftMargin(), - 1 - gPad->GetTopMargin() + 0.02, - titleMap.c_str()); + ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.02, titleMap.c_str()); canvas.SaveAs(fileName.c_str()); canvas.SaveAs("test.root"); diff --git a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc index 52ceb97ceca33..95e1667720250 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc @@ -150,7 +150,7 @@ namespace { TCanvas canvas("ByDetId", "ByDetId", sides.second * 800, sides.first * 600); canvas.Divide(sides.second, sides.first); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); - auto reader = std::make_unique(fp_.fullPath()); + auto reader = std::make_unique(fp_.fullPath()); for (const auto& the_detid : the_detids) { edm::LogPrint("SiStripNoisePerDetId") << "DetId:" << the_detid << std::endl; From 83f7b0229693a18b7a34652aaeee93746868b7f8 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 15 Dec 2020 20:55:13 +0100 Subject: [PATCH 04/12] graphics improvements --- .../SiStripPlugins/interface/SiStripTkMaps.h | 43 ++++++------------- .../SiStripBadStrip_PayloadInspector.cc | 5 ++- .../SiStripLorentzAngle_PayloadInspector.cc | 5 +-- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index 91596a7037fbe..41e8066fe1845 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -58,6 +58,7 @@ class SiStripTkMaps { TGaxis::SetMaxDigits(2); + // margin of the box static constexpr int margin = 5; m_trackerMap = new TH2Poly("Tracker Map", m_mapTitle.c_str(), minx - margin, maxx + margin, miny - margin, maxy + margin); @@ -65,7 +66,8 @@ class SiStripTkMaps { m_trackerMap->SetOption(m_option); m_trackerMap->SetStats(false); m_trackerMap->GetZaxis()->SetLabelSize(0.03); - m_trackerMap->GetZaxis()->SetTitleOffset(0.7); + m_trackerMap->GetZaxis()->SetTitleOffset(0.5); + m_trackerMap->GetZaxis()->SetTitleSize(0.05); m_trackerMap->GetZaxis()->SetTitle(m_zAxisTitle.c_str()); m_trackerMap->GetZaxis()->CenterTitle(); @@ -82,23 +84,13 @@ class SiStripTkMaps { //============================================================================ void drawMap(TCanvas& canvas, std::string option = "") { - canvas.cd(); - adjustCanvasMargins(canvas.cd(), 0.08, 0.06, 0.01, 0.06); - - /* - if(!m_values.empty()){ - - m_axmax = *std::max_element(m_values.begin(), m_values.end()); - m_axmin = *std::min_element(m_values.begin(), m_values.end()); - - canvas.cd(); + static constexpr float tmargin_ = 0.08; + static constexpr float bmargin_ = 0.02; + static constexpr float lmargin_ = 0.02; + static constexpr float rmargin_ = 0.08; - auto color_bar_axis = new TGaxis(gPad->GetUxmin()-0.01,0.03, gPad->GetUxmax()-0.01, 0.03 , m_axmin, m_axmax ,505, "SDH"); - color_bar_axis->SetName("color_bar_axis"); - color_bar_axis->Draw(); - - } - */ + canvas.cd(); + adjustCanvasMargins(canvas.cd(), tmargin_, bmargin_, lmargin_, rmargin_); canvas.Update(); @@ -113,10 +105,8 @@ class SiStripTkMaps { TPaletteAxis* palette = (TPaletteAxis*)m_trackerMap->GetListOfFunctions()->FindObject("palette"); if (palette != nullptr) { palette->SetLabelSize(0.02); - palette->SetX1NDC(0.95); - palette->SetX2NDC(0.96); - palette->SetY1NDC(0.05); - palette->SetY2NDC(0.95); + palette->SetX1NDC(1 - rmargin_); + palette->SetX2NDC(1 - rmargin_ + lmargin_); gPad->Modified(); gPad->Update(); } @@ -181,30 +171,25 @@ class SiStripTkMaps { } else { if (i % 2 == 0) { x[ix] = static_cast(array->At(i))->String().Atof(); - if (x[ix] < minx) { minx = x[ix]; } - if (x[ix] > maxx) { maxx = x[ix]; } - ++ix; } else { y[iy] = static_cast(array->At(i))->String().Atof(); - if (y[iy] < miny) { miny = y[iy]; } if (y[iy] > maxy) { maxy = y[iy]; } - ++iy; - } - } - } + } // else + } // else + } // loop on entries if (isPixel) { continue; diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 44d49d9e2d9c9..5f9d39b427ec4 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -216,10 +216,11 @@ namespace { auto theIOVsince = std::to_string(std::get<0>(iov)); - std::string titleMap = "Fraction of bad Strips per module, Run: " + theIOVsince + " (tag: " + tagname + ")"; + std::string titleMap = + "Fraction of bad Strips per module, Run: " + theIOVsince + " (tag: #color[2]{" + tagname + "})"; SiStripTkMaps myMap("COLZA0 L"); - myMap.bookMap(titleMap, ""); + myMap.bookMap(titleMap, "Fraction of bad Strips per module"); SiStripTkMaps ghost("AL"); ghost.bookMap(titleMap, ""); diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index af098a2d84891..11753440781e6 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -115,8 +115,7 @@ namespace { "Tracker Map SiStrip Lorentz Angle") {} bool fill() override { - //gStyle->SetPalette(kRainBow); - SiStripPI::setPaletteStyle(SiStripPI::BLUERED); + SiStripPI::setPaletteStyle(SiStripPI::DEFAULT); auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); @@ -125,7 +124,7 @@ namespace { std::shared_ptr payload = fetchPayload(std::get<1>(iov)); auto theIOVsince = std::to_string(std::get<0>(iov)); - std::string titleMap = "SiStrip Lorentz Angle Map, Run: " + theIOVsince + " (tag: " + tagname + ")"; + std::string titleMap = "SiStrip Lorentz Angle Map, Run: " + theIOVsince + " (tag: #color[2]{" + tagname + "})"; SiStripTkMaps myMap("COLZA L"); myMap.bookMap(titleMap, "SiStrip #mu_{H}=(tan#theta_{L}/B) [1/T]"); From d76ff103de09aeb1dbf0c48983825123a10e6fcb Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 16 Dec 2020 14:21:35 +0100 Subject: [PATCH 05/12] miscellaneous graphical improvements --- .../SiStripPlugins/interface/SiStripTkMaps.h | 71 +++++++++++++++++-- .../SiStripBadStrip_PayloadInspector.cc | 18 ++--- .../SiStripLorentzAngle_PayloadInspector.cc | 20 +++--- 3 files changed, 79 insertions(+), 30 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index 41e8066fe1845..1576310508778 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -91,7 +91,6 @@ class SiStripTkMaps { canvas.cd(); adjustCanvasMargins(canvas.cd(), tmargin_, bmargin_, lmargin_, rmargin_); - canvas.Update(); m_trackerMap->SetTitle(""); @@ -101,17 +100,79 @@ class SiStripTkMaps { m_trackerMap->Draw(); } + canvas.SetFrameLineColor(0); gPad->Update(); TPaletteAxis* palette = (TPaletteAxis*)m_trackerMap->GetListOfFunctions()->FindObject("palette"); if (palette != nullptr) { palette->SetLabelSize(0.02); palette->SetX1NDC(1 - rmargin_); palette->SetX2NDC(1 - rmargin_ + lmargin_); - gPad->Modified(); - gPad->Update(); } + } - canvas.SetFrameLineColor(0); + //============================================================================ + void dressMap(TCanvas& canv) { + static constexpr int wH_ = 3000; + static constexpr int hH_ = 850; + if (canv.GetWindowHeight() != hH_ && canv.GetWindowWidth() != wH_) { + std::cout << "resetting the window size!" + << "height is: " << canv.GetWindowHeight() << "width is: " << canv.GetWindowWidth() << std::endl; + canv.SetWindowSize(wH_, hH_); + } + + std::array barrelNames = { + {"TIB L2", "TIB L1", "TIB L4", "TIB L3", "TOB L2", "TOB L1", "TOB L4", " TOB L3", "TOB L6", "TOB L5"}}; + std::array endcapNames = {{"TID", "TEC", "TID", "TEC"}}; + std::array disknumbering = {{"+1", "+2", "+3", "+1", "+2", "+3", "+4", "+5", + "+6", "+7", "+8", "+9", "-1", "-2", "-3", "-1", + "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9"}}; + + static constexpr std::array b_coordx = { + {0.1, 0.1, 0.26, 0.26, 0.41, 0.41, 0.56, 0.56, 0.725, 0.725, 0.05, 0.17}}; + static constexpr std::array b_coordy = { + {0.70, 0.45, 0.70, 0.45, 0.70, 0.46, 0.70, 0.46, 0.70, 0.46, 0.85, 0.85}}; + + static constexpr std::array e_coordx = {{0.01, 0.21, 0.01, 0.21}}; + static constexpr std::array e_coordy = {{0.89, 0.89, 0.17, 0.17}}; + + static constexpr std::array n_coordx = {{0.01, 0.087, 0.165, 0.227, 0.305, 0.383, 0.461, 0.539, + 0.616, 0.694, 0.772, 0.850, 0.01, 0.087, 0.165, 0.227, + 0.305, 0.383, 0.461, 0.539, 0.617, 0.695, 0.773, 0.851}}; + + static constexpr std::array n_coordy = {{0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, + 0.85, 0.85, 0.85, 0.85, 0.13, 0.13, 0.13, 0.13, + 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13}}; + + canv.cd(); + for (const auto& name : barrelNames | boost::adaptors::indexed(0)) { + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.035); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC(b_coordx[name.index()], b_coordy[name.index()], name.value().c_str()); + } + + for (const auto& name : endcapNames | boost::adaptors::indexed(0)) { + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.05); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC(e_coordx[name.index()], e_coordy[name.index()], name.value().c_str()); + } + + for (const auto& name : disknumbering | boost::adaptors::indexed(0)) { + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.035); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC(n_coordx[name.index()], n_coordy[name.index()], name.value().c_str()); + } + + auto ltx = TLatex(); + ltx.SetTextFont(62); + ltx.SetTextSize(0.045); + ltx.SetTextAlign(11); + ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.03, m_mapTitle.c_str()); } //============================================================================ @@ -195,10 +256,10 @@ class SiStripTkMaps { continue; } - m_detIdVector.push_back(detid); m_bins[detid] = std::make_shared(ix, x, y); m_bins[detid]->SetName(TString::Format("%ld", detid)); m_bins[detid]->SetTitle(TString::Format("Module ID=%ld", detid)); + m_detIdVector.push_back(detid); } } diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 5f9d39b427ec4..26de08bbf4c01 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -204,7 +204,8 @@ namespace { "Tracker Map of SiStrip Bad Components fraction") {} bool fill() override { - gStyle->SetPalette(kRainBow); + //SiStripPI::setPaletteStyle(SiStripPI::DEFAULT); + gStyle->SetPalette(1); auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); @@ -217,7 +218,7 @@ namespace { auto theIOVsince = std::to_string(std::get<0>(iov)); std::string titleMap = - "Fraction of bad Strips per module, Run: " + theIOVsince + " (tag: #color[2]{" + tagname + "})"; + "Fraction of bad Strips per module, Run: " + theIOVsince + " (tag:#color[2]{" + tagname + "})"; SiStripTkMaps myMap("COLZA0 L"); myMap.bookMap(titleMap, "Fraction of bad Strips per module"); @@ -234,7 +235,6 @@ namespace { SiStripBadStrip::Range range = payload->getRange(d); for (std::vector::const_iterator badStrip = range.first; badStrip != range.second; ++badStrip) { badStripsPerDetId[d] += payload->decode(*badStrip).range; - //ss << "DetId="<< d << " Strip=" << payload->decode(*badStrip).firstStrip <<":"<< payload->decode(*badStrip).range << " flag="<< payload->decode(*badStrip).flag << std::endl; } float fraction = badStripsPerDetId[d] / (128. * reader->getNumberOfApvsAndStripLength(d).first); if (fraction > 0.) { @@ -245,18 +245,10 @@ namespace { //========================= std::string fileName(m_imageFileName); - - //myMap.setZAxisRange(-0.4,1.); - TCanvas canvas("Bad Components fraction", "bad components fraction", 3000, 1200); + TCanvas canvas("Bad Components fraction", "bad components fraction"); myMap.drawMap(canvas, ""); ghost.drawMap(canvas, "same"); - - auto ltx = TLatex(); - ltx.SetTextFont(62); - ltx.SetTextSize(0.045); - ltx.SetTextAlign(11); - ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.02, titleMap.c_str()); - + ghost.dressMap(canvas); canvas.SaveAs(fileName.c_str()); delete reader; diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index 11753440781e6..935b13d46f253 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -115,7 +115,8 @@ namespace { "Tracker Map SiStrip Lorentz Angle") {} bool fill() override { - SiStripPI::setPaletteStyle(SiStripPI::DEFAULT); + //SiStripPI::setPaletteStyle(SiStripPI::DEFAULT); + gStyle->SetPalette(1); auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); @@ -124,7 +125,7 @@ namespace { std::shared_ptr payload = fetchPayload(std::get<1>(iov)); auto theIOVsince = std::to_string(std::get<0>(iov)); - std::string titleMap = "SiStrip Lorentz Angle Map, Run: " + theIOVsince + " (tag: #color[2]{" + tagname + "})"; + std::string titleMap = "SiStrip Lorentz Angle Map, Run: " + theIOVsince + " (tag:#color[2]{" + tagname + "})"; SiStripTkMaps myMap("COLZA L"); myMap.bookMap(titleMap, "SiStrip #mu_{H}=(tan#theta_{L}/B) [1/T]"); @@ -136,19 +137,14 @@ namespace { } // loop over the LA MAP std::string fileName(m_imageFileName); - - TCanvas canvas("LA map", "LA map", 3000, 1200); + TCanvas canvas("LA map", "LA map"); myMap.drawMap(canvas, ""); - - auto ltx = TLatex(); - ltx.SetTextFont(62); - ltx.SetTextSize(0.045); - ltx.SetTextAlign(11); - ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.02, titleMap.c_str()); - + myMap.dressMap(canvas); canvas.SaveAs(fileName.c_str()); - canvas.SaveAs("test.root"); +#ifdef MMDEBUG + canvas.SaveAs("test.root"); +#endif return true; } }; From bdf891e0377e4062091fd4debb36790848a3a244 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 17 Dec 2020 19:28:07 +0100 Subject: [PATCH 06/12] add SiStripTkMaps-based plot to unit tests --- .../test/testSiStripPayloadInspector.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp index 6815ec4f7ac6f..1b0a6e2823c59 100644 --- a/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp +++ b/CondCore/SiStripPlugins/test/testSiStripPayloadInspector.cpp @@ -7,6 +7,7 @@ #include "CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc" #include "CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc" #include "CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc" +#include "CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc" #include "FWCore/PluginManager/interface/PluginManager.h" #include "FWCore/PluginManager/interface/standard.h" @@ -143,6 +144,17 @@ int main(int argc, char** argv) { histo14.process(connectionString, PI::mk_input(tag, start, start)); edm::LogPrint("testSiStripPayloadInspector") << histo14.data() << std::endl; + // test SiStripTkMaps + tag = "SiStripBadComponents_startupMC_for2017_v1_mc"; + start = boost::lexical_cast(1); + end = boost::lexical_cast(1); + + edm::LogPrint("testSiStripPayloadInspector") << "## Exercising SiStripTkMaps plots " << std::endl; + + SiStripBadStripFractionTkMap histoTkMap; + histoTkMap.process(connectionString, PI::mk_input(tag, start, start)); + edm::LogPrint("testSiStripPayloadInspector") << histoTkMap.data() << std::endl; + inputs.clear(); #if PY_MAJOR_VERSION >= 3 // TODO I don't know why this Py_INCREF is necessary... From ae80d05305ecf9d901b12209a71e863da7da2d93 Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 18 Dec 2020 11:51:04 +0100 Subject: [PATCH 07/12] add a bunch of getters to SiStripTkMaps --- .../SiStripPlugins/interface/SiStripTkMaps.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index 1576310508778..df71b17633363 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -176,7 +176,19 @@ class SiStripTkMaps { } //============================================================================ - TH2Poly* getTheMap() { return m_trackerMap; } + const TH2Poly* getTheMap() { return m_trackerMap; } + + //============================================================================ + inline const std::string& getTheMapTitle() { return m_mapTitle; } + + //============================================================================ + inline const std::string& getTheZAxisTitle() { return m_zAxisTitle; } + + //============================================================================ + inline const std::vector& getTheFilledIds() { return m_detIdVector; } + + //============================================================================ + inline const std::vector& getTheFilledValues() { return m_values; } //============================================================================ void setZAxisRange(double xmin, double xmax) { m_trackerMap->GetZaxis()->SetRangeUser(xmin, xmax); } @@ -269,7 +281,7 @@ class SiStripTkMaps { std::string m_zAxisTitle = ""; double m_axmin, m_axmax; std::map > m_bins; - std::vector m_detIdVector; + std::vector m_detIdVector; std::vector m_values; TrackerTopology m_trackerTopo; TH2Poly* m_trackerMap{nullptr}; From 91c41c3b885433e36b6ebd898f68262e18f71edb Mon Sep 17 00:00:00 2001 From: mmusich Date: Fri, 18 Dec 2020 21:19:30 +0100 Subject: [PATCH 08/12] add coordinate reference frames --- .../SiStripPlugins/interface/SiStripTkMaps.h | 84 ++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index df71b17633363..b67ee5198fb29 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -10,6 +10,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" // ROOT includes +#include "TArrow.h" #include "TPaletteAxis.h" #include "TGaxis.h" #include "TCanvas.h" @@ -115,8 +116,6 @@ class SiStripTkMaps { static constexpr int wH_ = 3000; static constexpr int hH_ = 850; if (canv.GetWindowHeight() != hH_ && canv.GetWindowWidth() != wH_) { - std::cout << "resetting the window size!" - << "height is: " << canv.GetWindowHeight() << "width is: " << canv.GetWindowWidth() << std::endl; canv.SetWindowSize(wH_, hH_); } @@ -173,6 +172,87 @@ class SiStripTkMaps { ltx.SetTextSize(0.045); ltx.SetTextAlign(11); ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.03, m_mapTitle.c_str()); + + // barrel axes + float phiX1 = 0.09; + float phiX2 = 0.23; + float phiY1 = 0.24; + float phiY2 = phiY1; + auto arrowPhi = TArrow(); + arrowPhi.SetLineColor(kBlue); + arrowPhi.SetLineWidth(2); + arrowPhi.SetOption("|>"); + arrowPhi.SetArrowSize(10); + arrowPhi.DrawLineNDC(phiX1, phiY1, phiX2, phiY2); + //arrowPhi.SetNDC(kTRUE); + //arrowPhi.DrawArrow(0.09,0.25,0.23,0.25,0.1,"|>"); + + float zX1 = phiX2; + float zX2 = zX1; + float zY1 = phiY1; + float zY2 = 0.45; + auto arrowZ = TArrow(); + arrowZ.SetLineColor(kBlue); + arrowZ.SetLineWidth(2); + arrowZ.SetOption("|>"); + arrowZ.SetArrowSize(10); + arrowZ.DrawLineNDC(zX1, zY1, zX2, zY2); + //arrowZ.SetNDC(kTRUE); + //arrowZ.DrawArrow(0.09,0.25,0.09,0.45,0.1,"|>"); + + auto textPhi = TLatex(); + textPhi.SetTextSize(0.04); + textPhi.SetTextAlign(11); + textPhi.SetTextColor(kBlue); + textPhi.DrawLatexNDC(phiX1 - 0.01, phiY1 + 0.01, "#phi"); + + auto textZ = TLatex(); + textZ.SetTextSize(0.04); + textZ.SetTextAlign(11); + textZ.SetTextColor(kBlue); + textZ.DrawLatexNDC(zX1 + 0.005, zY2, "z"); + + // endcap axes + float xX1 = 0.85; + float xX2 = 0.89; + float xY1 = 0.83; + float xY2 = xY1; + auto arrowX = TArrow(); + arrowX.SetLineColor(kBlue); + arrowX.SetLineWidth(2); + arrowX.SetOption("|>"); + arrowX.SetArrowSize(10); + arrowX.DrawLineNDC(xX1, xY1, xX2, xY2); + //arrowX.SetNDC(kTRUE); + //arrowX.DrawArrow(0.09,0.25,0.23,0.25,0.1,"|>"); + + float yX1 = xX2; + float yX2 = yX1; + float yY1 = xY1; + float yY2 = 0.95; + auto arrowY = TArrow(); + arrowY.SetLineColor(kBlue); + arrowY.SetLineWidth(2); + arrowY.SetOption("|>"); + arrowY.SetArrowSize(10); + arrowY.DrawLineNDC(yX1, yY1, yX2, yY2); + //arrowY.SetNDC(kTRUE); + //arrowY.DrawArrow(0.09,0.25,0.09,0.45,0.1,"|>"); + + auto textX = TLatex(); + textX.SetTextSize(0.04); + textX.SetTextAlign(11); + textX.SetTextColor(kBlue); + textX.DrawLatexNDC(xX1, xY1 - 0.03, "x"); + + auto textY = TLatex(); + textY.SetTextSize(0.04); + textY.SetTextAlign(11); + textY.SetTextColor(kBlue); + textY.DrawLatexNDC(yX1 - 0.01, yY2, "y"); + + canv.Modified(); + canv.Update(); // make sure it's really (re)drawn } //============================================================================ From 634e3ba3bd0d550ee7e4ff520a2952fbcb782df0 Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 21 Dec 2020 11:56:40 +0100 Subject: [PATCH 09/12] rationalize use of private methods in SiStripTkMaps --- .../SiStripPlugins/interface/SiStripTkMaps.h | 188 ++++++++---------- .../SiStripBadStrip_PayloadInspector.cc | 1 - .../SiStripLorentzAngle_PayloadInspector.cc | 1 - 3 files changed, 79 insertions(+), 111 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index b67ee5198fb29..7d65330170a73 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -46,7 +46,7 @@ class SiStripTkMaps { m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {} - ~SiStripTkMaps() {} + ~SiStripTkMaps() = default; //============================================================================ void bookMap(const std::string mapTitle, const std::string zAxisTitle) { @@ -85,11 +85,16 @@ class SiStripTkMaps { //============================================================================ void drawMap(TCanvas& canvas, std::string option = "") { + // margins static constexpr float tmargin_ = 0.08; static constexpr float bmargin_ = 0.02; static constexpr float lmargin_ = 0.02; static constexpr float rmargin_ = 0.08; + // window size + static constexpr int wH_ = 3000; + static constexpr int hH_ = 850; + canvas.cd(); adjustCanvasMargins(canvas.cd(), tmargin_, bmargin_, lmargin_, rmargin_); canvas.Update(); @@ -109,16 +114,49 @@ class SiStripTkMaps { palette->SetX1NDC(1 - rmargin_); palette->SetX2NDC(1 - rmargin_ + lmargin_); } + + // if not right size, and not drawn in same mode + if (canvas.GetWindowHeight() != hH_ && canvas.GetWindowWidth() != wH_ && option.find("same") == std::string::npos) { + canvas.SetWindowSize(wH_, hH_); + } + + // call the map dressing + dressMap(canvas); } //============================================================================ - void dressMap(TCanvas& canv) { - static constexpr int wH_ = 3000; - static constexpr int hH_ = 850; - if (canv.GetWindowHeight() != hH_ && canv.GetWindowWidth() != wH_) { - canv.SetWindowSize(wH_, hH_); - } + const TH2Poly* getTheMap() { return m_trackerMap; } + + //============================================================================ + inline const std::string& getTheMapTitle() { return m_mapTitle; } + + //============================================================================ + inline const std::string& getTheZAxisTitle() { return m_zAxisTitle; } + + //============================================================================ + inline const std::vector& getTheFilledIds() { return m_detIdVector; } + + //============================================================================ + inline const std::vector& getTheFilledValues() { return m_values; } + + //============================================================================ + void setZAxisRange(double xmin, double xmax) { m_trackerMap->GetZaxis()->SetRangeUser(xmin, xmax); } + +private: + // private members + Option_t* m_option; + std::string m_mapTitle = ""; + std::string m_zAxisTitle = ""; + double m_axmin, m_axmax; + std::map > m_bins; + std::vector m_detIdVector; + std::vector m_values; + TrackerTopology m_trackerTopo; + TH2Poly* m_trackerMap{nullptr}; + // private methods + //============================================================================ + void dressMap(TCanvas& canv) { std::array barrelNames = { {"TIB L2", "TIB L1", "TIB L4", "TIB L3", "TOB L2", "TOB L1", "TOB L4", " TOB L3", "TOB L6", "TOB L5"}}; std::array endcapNames = {{"TID", "TEC", "TID", "TEC"}}; @@ -174,104 +212,47 @@ class SiStripTkMaps { ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.03, m_mapTitle.c_str()); // barrel axes - float phiX1 = 0.09; - float phiX2 = 0.23; - float phiY1 = 0.24; - float phiY2 = phiY1; - auto arrowPhi = TArrow(); - arrowPhi.SetLineColor(kBlue); - arrowPhi.SetLineWidth(2); - arrowPhi.SetOption("|>"); - arrowPhi.SetArrowSize(10); - arrowPhi.DrawLineNDC(phiX1, phiY1, phiX2, phiY2); - //arrowPhi.SetNDC(kTRUE); - //arrowPhi.DrawArrow(0.09,0.25,0.23,0.25,0.1,"|>"); - - float zX1 = phiX2; - float zX2 = zX1; - float zY1 = phiY1; - float zY2 = 0.45; - auto arrowZ = TArrow(); - arrowZ.SetLineColor(kBlue); - arrowZ.SetLineWidth(2); - arrowZ.SetOption("|>"); - arrowZ.SetArrowSize(10); - arrowZ.DrawLineNDC(zX1, zY1, zX2, zY2); - //arrowZ.SetNDC(kTRUE); - //arrowZ.DrawArrow(0.09,0.25,0.09,0.45,0.1,"|>"); - - auto textPhi = TLatex(); - textPhi.SetTextSize(0.04); - textPhi.SetTextAlign(11); - textPhi.SetTextColor(kBlue); - textPhi.DrawLatexNDC(phiX1 - 0.01, phiY1 + 0.01, "#phi"); - - auto textZ = TLatex(); - textZ.SetTextSize(0.04); - textZ.SetTextAlign(11); - textZ.SetTextColor(kBlue); - textZ.DrawLatexNDC(zX1 + 0.005, zY2, "z"); - + drawArrows(0.09, 0.23, 0.24, 0.45, "#phi", "z"); // endcap axes - float xX1 = 0.85; - float xX2 = 0.89; - float xY1 = 0.83; - float xY2 = xY1; - auto arrowX = TArrow(); - arrowX.SetLineColor(kBlue); - arrowX.SetLineWidth(2); - arrowX.SetOption("|>"); - arrowX.SetArrowSize(10); - arrowX.DrawLineNDC(xX1, xY1, xX2, xY2); - //arrowX.SetNDC(kTRUE); - //arrowX.DrawArrow(0.09,0.25,0.23,0.25,0.1,"|>"); - - float yX1 = xX2; - float yX2 = yX1; - float yY1 = xY1; - float yY2 = 0.95; - auto arrowY = TArrow(); - arrowY.SetLineColor(kBlue); - arrowY.SetLineWidth(2); - arrowY.SetOption("|>"); - arrowY.SetArrowSize(10); - arrowY.DrawLineNDC(yX1, yY1, yX2, yY2); - //arrowY.SetNDC(kTRUE); - //arrowY.DrawArrow(0.09,0.25,0.09,0.45,0.1,"|>"); - - auto textX = TLatex(); - textX.SetTextSize(0.04); - textX.SetTextAlign(11); - textX.SetTextColor(kBlue); - textX.DrawLatexNDC(xX1, xY1 - 0.03, "x"); - - auto textY = TLatex(); - textY.SetTextSize(0.04); - textY.SetTextAlign(11); - textY.SetTextColor(kBlue); - textY.DrawLatexNDC(yX1 - 0.01, yY2, "y"); + drawArrows(0.85, 0.89, 0.83, 0.95, "x", "y"); canv.Modified(); canv.Update(); // make sure it's really (re)drawn } //============================================================================ - const TH2Poly* getTheMap() { return m_trackerMap; } - - //============================================================================ - inline const std::string& getTheMapTitle() { return m_mapTitle; } - - //============================================================================ - inline const std::string& getTheZAxisTitle() { return m_zAxisTitle; } - - //============================================================================ - inline const std::vector& getTheFilledIds() { return m_detIdVector; } - - //============================================================================ - inline const std::vector& getTheFilledValues() { return m_values; } - - //============================================================================ - void setZAxisRange(double xmin, double xmax) { m_trackerMap->GetZaxis()->SetRangeUser(xmin, xmax); } + void drawArrows(const float x_X1, + const float x_X2, + const float x_Y1, + const float y_Y2, + const char* x_label, + const char* y_label) { + auto arrow_X = TArrow(); + arrow_X.SetLineColor(kBlue); + arrow_X.SetLineWidth(2); + arrow_X.SetOption("|>"); + arrow_X.SetArrowSize(10); + arrow_X.DrawLineNDC(x_X1, x_Y1, x_X2, x_Y1); + + auto arrow_Y = TArrow(); + arrow_Y.SetLineColor(kBlue); + arrow_Y.SetLineWidth(2); + arrow_Y.SetOption("|>"); + arrow_Y.SetArrowSize(10); + arrow_Y.DrawLineNDC(x_X2, x_Y1, x_X2, y_Y2); + + auto text_X = TLatex(); + text_X.SetTextSize(0.04); + text_X.SetTextAlign(11); + text_X.SetTextColor(kBlue); + text_X.DrawLatexNDC(x_X1, x_Y1 - 0.03, x_label); + + auto text_Y = TLatex(); + 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); + } //============================================================================ void adjustCanvasMargins(TVirtualPad* pad, float top, float bottom, float left, float right) { @@ -354,17 +335,6 @@ class SiStripTkMaps { m_detIdVector.push_back(detid); } } - -private: - Option_t* m_option; - std::string m_mapTitle = ""; - std::string m_zAxisTitle = ""; - double m_axmin, m_axmax; - std::map > m_bins; - std::vector m_detIdVector; - std::vector m_values; - TrackerTopology m_trackerTopo; - TH2Poly* m_trackerMap{nullptr}; }; #endif diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 26de08bbf4c01..ccd4f6915db81 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -248,7 +248,6 @@ namespace { TCanvas canvas("Bad Components fraction", "bad components fraction"); myMap.drawMap(canvas, ""); ghost.drawMap(canvas, "same"); - ghost.dressMap(canvas); canvas.SaveAs(fileName.c_str()); delete reader; diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index 935b13d46f253..61be13dabe231 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -139,7 +139,6 @@ namespace { std::string fileName(m_imageFileName); TCanvas canvas("LA map", "LA map"); myMap.drawMap(canvas, ""); - myMap.dressMap(canvas); canvas.SaveAs(fileName.c_str()); #ifdef MMDEBUG From 5bf310094af0cebd6bf40eda93d1457b8bd392aa Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 21 Dec 2020 14:44:57 +0100 Subject: [PATCH 10/12] migrate to new PayloadInspector class interfaces --- .../SiStripPlugins/interface/SiStripTkMaps.h | 4 +- .../SiStripApvGain_PayloadInspector.cc | 530 +++++++++--------- ...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 +- .../plugins/SiStripNoises_PayloadInspector.cc | 231 ++++---- .../SiStripPedestals_PayloadInspector.cc | 57 +- .../SiStripThreshold_PayloadInspector.cc | 43 +- 12 files changed, 660 insertions(+), 617 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..0aa3c68e39c16 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,14 +567,18 @@ namespace { TrackerMap of SiStripApvGains (ratio with previous gain per detid) *************************************************/ - class SiStripApvGainsRatioWithPreviousIOVTrackerMapBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsRatioWithPreviousIOVTrackerMapBase + : public cond::payloadInspector::PlotImage { public: SiStripApvGainsRatioWithPreviousIOVTrackerMapBase() - : cond::payloadInspector::PlotImage("Tracker Map of ratio of SiStripGains with previous IOV") { + : cond::payloadInspector::PlotImage( + "Tracker Map of ratio of SiStripGains with previous IOV") { 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,17 +587,26 @@ 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); - std::shared_ptr last_payload = fetchPayload(std::get<1>(lastiov)); - std::shared_ptr first_payload = fetchPayload(std::get<1>(firstiov)); + 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 = this->fetchPayload(std::get<1>(lastiov)); + std::shared_ptr first_payload = this->fetchPayload(std::get<1>(firstiov)); std::string titleMap = "SiStrip APV Gain ratio per module average (IOV: "; @@ -652,44 +664,34 @@ namespace { //========================= auto range = SiStripPI::getTheRange(cachedRatio, nsigma); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); tmap->save(true, range.first, range.second, fileName); return true; } }; - 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 +701,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 +797,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 +867,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 +1160,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 +1207,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") {} - - 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); - }); + SiStripApvGainsComparatorBase() + : cond::payloadInspector::PlotImage("SiStripGains Comparison") {} - 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 +1401,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 +1579,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 +1757,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 +1802,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); - }); - - 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::vector detid; last_payload->getDetIds(detid); @@ -1955,7 +1975,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 +1985,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/SiStripNoises_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc index 95e1667720250..2c2cf88291d64 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc @@ -466,25 +466,33 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: PlotImage - template - class SiStripNoiseDistributionComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseDistributionComparisonBase : public cond::payloadInspector::PlotImage { public: SiStripNoiseDistributionComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip Noise values comparison") {} - - bool fill(const std::vector>& iovs) override { - std::vector> sorted_iovs = iovs; + : cond::payloadInspector::PlotImage("SiStrip Noise values comparison") {} - // 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 f_payload = fetchPayload(std::get<1>(firstiov)); - std::shared_ptr l_payload = fetchPayload(std::get<1>(lastiov)); + std::shared_ptr f_payload = this->fetchPayload(std::get<1>(firstiov)); + std::shared_ptr l_payload = this->fetchPayload(std::get<1>(lastiov)); auto f_mon = std::unique_ptr(new SiStripPI::Monitor1D( op_mode_, @@ -634,7 +642,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; @@ -647,20 +655,12 @@ namespace { }; template - class SiStripNoiseDistributionComparisonSingleTag : public SiStripNoiseDistributionComparisonBase { - public: - SiStripNoiseDistributionComparisonSingleTag() : SiStripNoiseDistributionComparisonBase() { - this->setSingleIov(false); - } - }; + using SiStripNoiseDistributionComparisonSingleTag = + SiStripNoiseDistributionComparisonBase; template - class SiStripNoiseDistributionComparisonTwoTags : public SiStripNoiseDistributionComparisonBase { - public: - SiStripNoiseDistributionComparisonTwoTags() : SiStripNoiseDistributionComparisonBase() { - this->setTwoTags(true); - } - }; + using SiStripNoiseDistributionComparisonTwoTags = + SiStripNoiseDistributionComparisonBase; typedef SiStripNoiseDistributionComparisonSingleTag SiStripNoiseValueComparisonPerStripSingleTag; @@ -678,24 +678,33 @@ namespace { // inherit from one of the predefined plot class: PlotImage - class SiStripNoiseValueComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseValueComparisonBase : public cond::payloadInspector::PlotImage { public: SiStripNoiseValueComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip Noise values comparison") {} + : cond::payloadInspector::PlotImage("SiStrip Noise values 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 f_payload = fetchPayload(std::get<1>(firstiov)); - std::shared_ptr l_payload = fetchPayload(std::get<1>(lastiov)); + std::shared_ptr f_payload = this->fetchPayload(std::get<1>(firstiov)); + std::shared_ptr l_payload = this->fetchPayload(std::get<1>(lastiov)); auto h_first = std::make_unique("f_Noise", @@ -778,22 +787,15 @@ 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; } }; - class SiStripNoiseValueComparisonSingleTag : public SiStripNoiseValueComparisonBase { - public: - SiStripNoiseValueComparisonSingleTag() : SiStripNoiseValueComparisonBase() { setSingleIov(false); } - }; - - class SiStripNoiseValueComparisonTwoTags : public SiStripNoiseValueComparisonBase { - public: - SiStripNoiseValueComparisonTwoTags() : SiStripNoiseValueComparisonBase() { setTwoTags(true); } - }; + using SiStripNoiseValueComparisonSingleTag = SiStripNoiseValueComparisonBase<1, cond::payloadInspector::MULTI_IOV>; + using SiStripNoiseValueComparisonTwoTags = SiStripNoiseValueComparisonBase<2, cond::payloadInspector::SINGLE_IOV>; /************************************************ SiStrip Noise Tracker Map @@ -904,12 +906,13 @@ namespace { SiStrip Noise Tracker Map (ratio with previous gain per detid) *************************************************/ - template - class SiStripNoiseRatioWithPreviousIOVTrackerMapBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseRatioWithPreviousIOVTrackerMapBase + : public cond::payloadInspector::PlotImage { public: SiStripNoiseRatioWithPreviousIOVTrackerMapBase() - : cond::payloadInspector::PlotImage("Tracker Map of ratio of SiStripNoises " + - estimatorType(est) + "with previous IOV") { + : cond::payloadInspector::PlotImage("Tracker Map of ratio of SiStripNoises " + + estimatorType(est) + "with previous IOV") { cond::payloadInspector::PlotBase::addInputParam("nsigma"); } @@ -969,7 +972,7 @@ namespace { return info_per_detid; } - bool fill(const std::vector>& iovs) override { + bool fill() override { unsigned int nsigma(1); auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); @@ -978,16 +981,26 @@ namespace { nsigma = boost::lexical_cast(ip->second); } - std::vector> sorted_iovs = iovs; - 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); - std::shared_ptr last_payload = fetchPayload(std::get<1>(lastiov)); - std::shared_ptr first_payload = fetchPayload(std::get<1>(firstiov)); + 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 = this->fetchPayload(std::get<1>(lastiov)); + std::shared_ptr first_payload = this->fetchPayload(std::get<1>(firstiov)); std::string titleMap = "SiStripNoise " + estimatorType(est) + " ratio per module average (IOV: "; @@ -1016,7 +1029,7 @@ namespace { } auto range = SiStripPI::getTheRange(cachedRatio, nsigma); - std::string fileName(m_imageFileName); + std::string fileName(this->m_imageFileName); if (est == SiStripPI::rms && (range.first < 0.)) { tmap->save(true, 0., range.second, fileName); } else { @@ -1028,21 +1041,12 @@ namespace { }; template - class SiStripNoiseRatioWithPreviousIOVTrackerMapSingleTag - : public SiStripNoiseRatioWithPreviousIOVTrackerMapBase { - public: - SiStripNoiseRatioWithPreviousIOVTrackerMapSingleTag() : SiStripNoiseRatioWithPreviousIOVTrackerMapBase() { - this->setSingleIov(false); - } - }; + using SiStripNoiseRatioWithPreviousIOVTrackerMapSingleTag = + SiStripNoiseRatioWithPreviousIOVTrackerMapBase; template - class SiStripNoiseRatioWithPreviousIOVTrackerMapTwoTags : public SiStripNoiseRatioWithPreviousIOVTrackerMapBase { - public: - SiStripNoiseRatioWithPreviousIOVTrackerMapTwoTags() : SiStripNoiseRatioWithPreviousIOVTrackerMapBase() { - this->setTwoTags(true); - } - }; + using SiStripNoiseRatioWithPreviousIOVTrackerMapTwoTags = + SiStripNoiseRatioWithPreviousIOVTrackerMapBase; typedef SiStripNoiseRatioWithPreviousIOVTrackerMapSingleTag SiStripNoiseMin_RatioWithPreviousIOVTrackerMapSingleTag; @@ -1194,28 +1198,36 @@ namespace { SiStrip Noise Comparator *************************************************/ - template - class SiStripNoiseComparatorByRegionBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseComparatorByRegionBase : public cond::payloadInspector::PlotImage { public: SiStripNoiseComparatorByRegionBase() - : cond::payloadInspector::PlotImage("SiStrip Noise " + estimatorType(est) + - " comparator by Region"), + : cond::payloadInspector::PlotImage("SiStrip Noise " + estimatorType(est) + + " comparator 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); - }); - - 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 f_payload = fetchPayload(std::get<1>(firstiov)); - std::shared_ptr l_payload = fetchPayload(std::get<1>(lastiov)); + std::shared_ptr f_payload = this->fetchPayload(std::get<1>(firstiov)); + std::shared_ptr l_payload = this->fetchPayload(std::get<1>(lastiov)); SiStripDetSummary f_summaryNoise{&m_trackerTopo}; SiStripDetSummary l_summaryNoise{&m_trackerTopo}; @@ -1363,7 +1375,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; @@ -1374,16 +1386,12 @@ namespace { }; template - class SiStripNoiseComparatorByRegionSingleTag : public SiStripNoiseComparatorByRegionBase { - public: - SiStripNoiseComparatorByRegionSingleTag() : SiStripNoiseComparatorByRegionBase() { this->setSingleIov(false); } - }; + using SiStripNoiseComparatorByRegionSingleTag = + SiStripNoiseComparatorByRegionBase; template - class SiStripNoiseComparatorByRegionTwoTags : public SiStripNoiseComparatorByRegionBase { - public: - SiStripNoiseComparatorByRegionTwoTags() : SiStripNoiseComparatorByRegionBase() { this->setTwoTags(true); } - }; + using SiStripNoiseComparatorByRegionTwoTags = + SiStripNoiseComparatorByRegionBase; typedef SiStripNoiseComparatorByRegionSingleTag SiStripNoiseComparatorMeanByRegionSingleTag; typedef SiStripNoiseComparatorByRegionSingleTag SiStripNoiseComparatorMinByRegionSingleTag; @@ -1658,17 +1666,18 @@ namespace { template Noise run history per layer *************************************************/ template - class NoiseLayerRunHistory : public cond::payloadInspector::PlotImage { + class NoiseLayerRunHistory + : public cond::payloadInspector::PlotImage { public: NoiseLayerRunHistory() - : cond::payloadInspector::PlotImage("SiStrip Noise values comparison"), + : cond::payloadInspector::PlotImage( + "SiStrip Noise values comparison"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( - edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} { - setSingleIov(false); - } + edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} - bool fill(const std::vector>& iovs) override { - std::vector> sorted_iovs = iovs; + bool fill() override { + auto tag = PlotBase::getTag<0>(); + auto sorted_iovs = tag.iovs; // make absolute sure the IOVs are sortd by since std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const& t1, auto const& t2) { diff --git a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc index 1534577d2951c..2a18dacab6350 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc @@ -463,25 +463,34 @@ namespace { // inherit from one of the predefined plot class: PlotImage - template - class SiStripPedestalDistributionComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripPedestalDistributionComparisonBase + : public cond::payloadInspector::PlotImage { public: SiStripPedestalDistributionComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip Pedestal values comparison") {} - - bool fill(const std::vector>& iovs) override { - std::vector> sorted_iovs = iovs; + : cond::payloadInspector::PlotImage("SiStrip Pedestal values comparison") {} - // 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 f_payload = fetchPayload(std::get<1>(firstiov)); - std::shared_ptr l_payload = fetchPayload(std::get<1>(lastiov)); + std::shared_ptr f_payload = this->fetchPayload(std::get<1>(firstiov)); + std::shared_ptr l_payload = this->fetchPayload(std::get<1>(lastiov)); auto f_mon = std::unique_ptr(new SiStripPI::Monitor1D( op_mode_, @@ -630,7 +639,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; @@ -643,20 +652,12 @@ namespace { }; template - class SiStripPedestalDistributionComparisonSingleTag : public SiStripPedestalDistributionComparisonBase { - public: - SiStripPedestalDistributionComparisonSingleTag() : SiStripPedestalDistributionComparisonBase() { - this->setSingleIov(false); - } - }; + using SiStripPedestalDistributionComparisonSingleTag = + SiStripPedestalDistributionComparisonBase; template - class SiStripPedestalDistributionComparisonTwoTags : public SiStripPedestalDistributionComparisonBase { - public: - SiStripPedestalDistributionComparisonTwoTags() : SiStripPedestalDistributionComparisonBase() { - this->setTwoTags(true); - } - }; + using SiStripPedestalDistributionComparisonTwoTags = + SiStripPedestalDistributionComparisonBase; typedef SiStripPedestalDistributionComparisonSingleTag SiStripPedestalValueComparisonPerStripSingleTag; 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"); From c0ff2c5b01ef8d89a7326ccd60377a1c25538006 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 22 Dec 2020 15:42:58 +0100 Subject: [PATCH 11/12] using namespace cond::payloadInspector in CondCore/SiStripPlugins --- .../SiStripApvGain_PayloadInspector.cc | 322 ++++++++---------- ...ripBackPlaneCorrection_PayloadInspector.cc | 19 +- .../SiStripBadStrip_PayloadInspector.cc | 136 ++++---- .../SiStripConfObject_PayloadInspector.cc | 14 +- .../SiStripDetVOff_PayloadInspector.cc | 50 +-- .../SiStripFedCabling_PayloadInspector.cc | 16 +- .../SiStripLatency_PayloadInspector.cc | 25 +- .../SiStripLorentzAngle_PayloadInspector.cc | 50 ++- .../plugins/SiStripNoises_PayloadInspector.cc | 162 ++++----- .../SiStripPedestals_PayloadInspector.cc | 78 ++--- .../SiStripThreshold_PayloadInspector.cc | 36 +- 11 files changed, 385 insertions(+), 523 deletions(-) diff --git a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc index 0aa3c68e39c16..8cc04a51eac01 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc @@ -40,17 +40,18 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ 1d histogram of SiStripApvGains of 1 IOV *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvGainsValue - : public cond::payloadInspector::Histogram1D { + class SiStripApvGainsValue : public Histogram1D { public: SiStripApvGainsValue() - : cond::payloadInspector::Histogram1D( - "SiStripApv Gains values", "SiStripApv Gains values", 200, 0.0, 2.0) {} + : Histogram1D("SiStripApv Gains values", "SiStripApv Gains values", 200, 0.0, 2.0) { + } bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -80,17 +81,15 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvBarrelGainsByLayer - : public cond::payloadInspector::Histogram1D { + class SiStripApvBarrelGainsByLayer : public 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") {} + : 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>(); @@ -141,20 +140,18 @@ namespace { SiStripApvGains for Tracker Barrel of 1 IOV *************************************************/ - class SiStripApvAbsoluteBarrelGainsByLayer - : public cond::payloadInspector::Histogram2D { + class SiStripApvAbsoluteBarrelGainsByLayer : public 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) {} + : 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) { @@ -189,17 +186,15 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvEndcapMinusGainsByDisk - : public cond::payloadInspector::Histogram1D { + class SiStripApvEndcapMinusGainsByDisk : public 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") {} + : 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>(); @@ -259,17 +254,15 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripApvEndcapPlusGainsByDisk - : public cond::payloadInspector::Histogram1D { + class SiStripApvEndcapPlusGainsByDisk : public 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") {} + : 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>(); @@ -328,20 +321,18 @@ 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 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) {} + : 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>(); @@ -388,20 +379,18 @@ 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 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) {} + : 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) { @@ -446,12 +435,9 @@ namespace { /************************************************ TrackerMap of SiStripApvGains (average gain per detid) *************************************************/ - class SiStripApvGainsAverageTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripApvGainsAverageTrackerMap : public PlotImage { public: - SiStripApvGainsAverageTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of average SiStripGains") {} + SiStripApvGainsAverageTrackerMap() : PlotImage("Tracker Map of average SiStripGains") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -496,12 +482,10 @@ namespace { /************************************************ TrackerMap of SiStripApvGains (module with default) *************************************************/ - class SiStripApvGainsDefaultTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripApvGainsDefaultTrackerMap : public PlotImage { public: SiStripApvGainsDefaultTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStripGains to default") {} + : PlotImage("Tracker Map of SiStripGains to default") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -567,29 +551,27 @@ namespace { TrackerMap of SiStripApvGains (ratio with previous gain per detid) *************************************************/ - template - class SiStripApvGainsRatioWithPreviousIOVTrackerMapBase - : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsRatioWithPreviousIOVTrackerMapBase : public PlotImage { public: SiStripApvGainsRatioWithPreviousIOVTrackerMapBase() - : cond::payloadInspector::PlotImage( - "Tracker Map of ratio of SiStripGains with previous IOV") { - cond::payloadInspector::PlotBase::addInputParam("nsigma"); + : PlotImage("Tracker Map of ratio of SiStripGains with previous IOV") { + PlotBase::addInputParam("nsigma"); } bool fill() override { // determine n. sigmas unsigned int nsigma(1); - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { nsigma = boost::lexical_cast(ip->second); } // 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -598,8 +580,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -672,27 +654,26 @@ namespace { }; using SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap = - SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<1, cond::payloadInspector::MULTI_IOV>; + SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<1, MULTI_IOV>; using SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags = - SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<2, cond::payloadInspector::SINGLE_IOV>; + SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<2, SINGLE_IOV>; /************************************************ TrackerMap of SiStripApvGains (ratio for largest deviation with previous gain per detid) *************************************************/ - template - class SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase - : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase : public PlotImage { public: SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase() - : cond::payloadInspector::PlotImage( + : PlotImage( "Tracker Map of ratio (for largest deviation) of SiStripGains with previous IOV") { - cond::payloadInspector::PlotBase::addInputParam("nsigma"); + PlotBase::addInputParam("nsigma"); } bool fill() override { unsigned int nsigma(1); - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { nsigma = boost::lexical_cast(ip->second); @@ -702,8 +683,8 @@ namespace { } // 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -712,8 +693,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -805,20 +786,18 @@ namespace { }; using SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap = - SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<1, cond::payloadInspector::MULTI_IOV>; + SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<1, MULTI_IOV>; using SiStripApvGainsMaxDeviationRatioTrackerMapTwoTags = - SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<2, cond::payloadInspector::SINGLE_IOV>; + SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<2, SINGLE_IOV>; /************************************************ TrackerMap of SiStripApvGains (maximum gain per detid) *************************************************/ - class SiStripApvGainsMaximumTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripApvGainsMaximumTrackerMap : public PlotImage { public: SiStripApvGainsMaximumTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStripAPVGains (maximum per DetId)") {} + : PlotImage("Tracker Map of SiStripAPVGains (maximum per DetId)") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -867,12 +846,10 @@ namespace { /************************************************ TrackerMap of SiStripApvGains (minimum gain per detid) *************************************************/ - class SiStripApvGainsMinimumTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripApvGainsMinimumTrackerMap : public PlotImage { public: SiStripApvGainsMinimumTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStripAPVGains (minimum per DetId)") {} + : PlotImage("Tracker Map of SiStripAPVGains (minimum per DetId)") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -923,11 +900,10 @@ namespace { time history histogram of SiStripApvGains *************************************************/ - class SiStripApvGainByRunMeans : public cond::payloadInspector::HistoryPlot { + class SiStripApvGainByRunMeans : public HistoryPlot { public: SiStripApvGainByRunMeans() - : cond::payloadInspector::HistoryPlot("SiStripApv Gains average", - "average Strip APV gain value") {} + : HistoryPlot("SiStripApv Gains average", "average Strip APV gain value") {} ~SiStripApvGainByRunMeans() override = default; float getFromPayload(SiStripApvGain& payload) override { @@ -954,11 +930,11 @@ namespace { *************************************************/ template - class SiStripApvGainProperties : public cond::payloadInspector::HistoryPlot { + class SiStripApvGainProperties : public HistoryPlot { public: SiStripApvGainProperties() - : cond::payloadInspector::HistoryPlot("SiStripApv Gains " + estimatorType(est), - estimatorType(est) + " Strip APV gain value") {} + : HistoryPlot("SiStripApv Gains " + estimatorType(est), + estimatorType(est) + " Strip APV gain value") {} ~SiStripApvGainProperties() override = default; float getFromPayload(SiStripApvGain& payload) override { @@ -1021,11 +997,11 @@ namespace { time history histogram of TIB SiStripApvGains *************************************************/ - class SiStripApvTIBGainByRunMeans : public cond::payloadInspector::HistoryPlot { + class SiStripApvTIBGainByRunMeans : public HistoryPlot { public: SiStripApvTIBGainByRunMeans() - : cond::payloadInspector::HistoryPlot("SiStripApv Gains average", - "average Tracker Inner Barrel APV gain value") {} + : HistoryPlot("SiStripApv Gains average", + "average Tracker Inner Barrel APV gain value") {} ~SiStripApvTIBGainByRunMeans() override = default; float getFromPayload(SiStripApvGain& payload) override { @@ -1056,11 +1032,10 @@ namespace { time history histogram of TOB SiStripApvGains *************************************************/ - class SiStripApvTOBGainByRunMeans : public cond::payloadInspector::HistoryPlot { + class SiStripApvTOBGainByRunMeans : public HistoryPlot { public: SiStripApvTOBGainByRunMeans() - : cond::payloadInspector::HistoryPlot("SiStripApv Gains average", - "average Tracker Outer Barrel gain value") {} + : HistoryPlot("SiStripApv Gains average", "average Tracker Outer Barrel gain value") {} ~SiStripApvTOBGainByRunMeans() override = default; float getFromPayload(SiStripApvGain& payload) override { @@ -1091,11 +1066,11 @@ namespace { time history histogram of TID SiStripApvGains *************************************************/ - class SiStripApvTIDGainByRunMeans : public cond::payloadInspector::HistoryPlot { + class SiStripApvTIDGainByRunMeans : public HistoryPlot { public: SiStripApvTIDGainByRunMeans() - : cond::payloadInspector::HistoryPlot("SiStripApv Gains average", - "average Tracker Inner Disks APV gain value") {} + : HistoryPlot("SiStripApv Gains average", "average Tracker Inner Disks APV gain value") { + } ~SiStripApvTIDGainByRunMeans() override = default; float getFromPayload(SiStripApvGain& payload) override { @@ -1125,11 +1100,11 @@ namespace { time history histogram of TEC SiStripApvGains *************************************************/ - class SiStripApvTECGainByRunMeans : public cond::payloadInspector::HistoryPlot { + class SiStripApvTECGainByRunMeans : public HistoryPlot { public: SiStripApvTECGainByRunMeans() - : cond::payloadInspector::HistoryPlot("SiStripApv Gains average in TEC", - "average Tracker Endcaps APV gain value") {} + : HistoryPlot("SiStripApv Gains average in TEC", + "average Tracker Endcaps APV gain value") {} ~SiStripApvTECGainByRunMeans() override = default; float getFromPayload(SiStripApvGain& payload) override { @@ -1160,12 +1135,10 @@ namespace { test class *************************************************/ - class SiStripApvGainsTest - : public cond::payloadInspector::Histogram1D { + class SiStripApvGainsTest : public Histogram1D { public: SiStripApvGainsTest() - : cond::payloadInspector::Histogram1D( - "SiStripApv Gains test", "SiStripApv Gains test", 10, 0.0, 10.0), + : Histogram1D("SiStripApv Gains test", "SiStripApv Gains test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -1207,16 +1180,15 @@ namespace { Compare Gains from 2 IOVs, 2 pads canvas, firsr for ratio, second for scatter plot *************************************************/ - template - class SiStripApvGainsComparatorBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsComparatorBase : public PlotImage { public: - SiStripApvGainsComparatorBase() - : cond::payloadInspector::PlotImage("SiStripGains Comparison") {} + SiStripApvGainsComparatorBase() : PlotImage("SiStripGains Comparison") {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -1225,8 +1197,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1408,25 +1380,25 @@ namespace { } }; - using SiStripApvGainsComparatorSingleTag = SiStripApvGainsComparatorBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripApvGainsComparatorTwoTags = SiStripApvGainsComparatorBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripApvGainsComparatorSingleTag = SiStripApvGainsComparatorBase<1, MULTI_IOV>; + using SiStripApvGainsComparatorTwoTags = SiStripApvGainsComparatorBase<2, SINGLE_IOV>; //*******************************************// // Compare Gains from 2 IOVs //******************************************// - template - class SiStripApvGainsValuesComparatorBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsValuesComparatorBase : public PlotImage { public: SiStripApvGainsValuesComparatorBase() - : cond::payloadInspector::PlotImage("Comparison of SiStrip APV gains values") {} + : PlotImage("Comparison of SiStrip APV gains values") {} bool fill() override { TH1F::SetDefaultSumw2(true); // 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -1435,8 +1407,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1586,22 +1558,18 @@ namespace { } }; - using SiStripApvGainsValuesComparatorSingleTag = - SiStripApvGainsValuesComparatorBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripApvGainsValuesComparatorTwoTags = - SiStripApvGainsValuesComparatorBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripApvGainsValuesComparatorSingleTag = SiStripApvGainsValuesComparatorBase<1, MULTI_IOV>; + using SiStripApvGainsValuesComparatorTwoTags = SiStripApvGainsValuesComparatorBase<2, SINGLE_IOV>; //*******************************************// // Compare Gains ratio from 2 IOVs, region by region //******************************************// - template - class SiStripApvGainsRatioComparatorByRegionBase - : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsRatioComparatorByRegionBase : public PlotImage { public: SiStripApvGainsRatioComparatorByRegionBase() - : cond::payloadInspector::PlotImage( - "Module by Module Comparison of SiStrip APV gains"), + : PlotImage("Module by Module Comparison of SiStrip APV gains"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -1610,8 +1578,8 @@ namespace { SiStripPI::setPaletteStyle(SiStripPI::GRAY); // 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -1620,8 +1588,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1802,27 +1770,25 @@ namespace { } }; - using SiStripApvGainsRatioComparatorByRegionSingleTag = - SiStripApvGainsRatioComparatorByRegionBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripApvGainsRatioComparatorByRegionTwoTags = - SiStripApvGainsRatioComparatorByRegionBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripApvGainsRatioComparatorByRegionSingleTag = SiStripApvGainsRatioComparatorByRegionBase<1, MULTI_IOV>; + using SiStripApvGainsRatioComparatorByRegionTwoTags = SiStripApvGainsRatioComparatorByRegionBase<2, SINGLE_IOV>; /************************************************ Compare Gains for each tracker region *************************************************/ - template - class SiStripApvGainsComparatorByRegionBase : public cond::payloadInspector::PlotImage { + template + class SiStripApvGainsComparatorByRegionBase : public PlotImage { public: SiStripApvGainsComparatorByRegionBase() - : cond::payloadInspector::PlotImage("SiStripGains Comparison By Region"), + : PlotImage("SiStripGains Comparison By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -1831,8 +1797,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1985,21 +1951,17 @@ namespace { TrackerTopology m_trackerTopo; }; - using SiStripApvGainsComparatorByRegionSingleTag = - SiStripApvGainsComparatorByRegionBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripApvGainsComparatorByRegionTwoTags = - SiStripApvGainsComparatorByRegionBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripApvGainsComparatorByRegionSingleTag = SiStripApvGainsComparatorByRegionBase<1, MULTI_IOV>; + using SiStripApvGainsComparatorByRegionTwoTags = SiStripApvGainsComparatorByRegionBase<2, SINGLE_IOV>; /************************************************ Plot gain averages by region *************************************************/ - class SiStripApvGainsByRegion - : public cond::payloadInspector::PlotImage { + class SiStripApvGainsByRegion : public PlotImage { public: SiStripApvGainsByRegion() - : cond::payloadInspector::PlotImage( - "SiStripGains By Region"), + : PlotImage("SiStripGains By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} diff --git a/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc index 678debfbad7f6..bea719907a3b1 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBackPlaneCorrection_PayloadInspector.cc @@ -33,16 +33,17 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ 1d histogram of SiStripBackPlaneCorrection of 1 IOV *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripBackPlaneCorrectionValue - : public cond::payloadInspector::Histogram1D { + class SiStripBackPlaneCorrectionValue : public Histogram1D { public: SiStripBackPlaneCorrectionValue() - : cond::payloadInspector::Histogram1D( + : Histogram1D( "SiStrip BackPlaneCorrection values", "SiStrip BackPlaneCorrection values", 100, 0.0, 0.1) {} bool fill() override { @@ -64,12 +65,10 @@ namespace { /************************************************ TrackerMap of SiStrip BackPlane Correction *************************************************/ - class SiStripBackPlaneCorrection_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripBackPlaneCorrection_TrackerMap : public PlotImage { public: SiStripBackPlaneCorrection_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map SiStrip Backplane correction") {} + : PlotImage("Tracker Map SiStrip Backplane correction") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -106,12 +105,10 @@ namespace { Plot SiStrip BackPlane Correction averages by partition *************************************************/ - class SiStripBackPlaneCorrectionByRegion - : public cond::payloadInspector::PlotImage { + class SiStripBackPlaneCorrectionByRegion : public PlotImage { public: SiStripBackPlaneCorrectionByRegion() - : cond::payloadInspector::PlotImage( - "SiStripBackPlaneCorrection By Region"), + : PlotImage("SiStripBackPlaneCorrection By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index e88afda8620bc..5e5af46d198a7 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -47,16 +47,16 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ test class *************************************************/ - class SiStripBadStripTest - : public cond::payloadInspector::Histogram1D { + class SiStripBadStripTest : public Histogram1D { public: SiStripBadStripTest() - : cond::payloadInspector::Histogram1D( - "SiStrip Bad Strip test", "SiStrip Bad Strip test", 10, 0.0, 10.0) {} + : Histogram1D("SiStrip Bad Strip test", "SiStrip Bad Strip test", 10, 0.0, 10.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -95,17 +95,14 @@ namespace { /************************************************ TrackerMap of SiStripBadStrip (bad strip per detid) *************************************************/ - class SiStripBadModuleTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripBadModuleTrackerMap : public PlotImage { public: - SiStripBadModuleTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStrip Bad Strips") {} + SiStripBadModuleTrackerMap() : PlotImage("Tracker Map of SiStrip Bad Strips") {} bool fill() override { auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); - auto tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + auto tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); auto theIOVsince = std::to_string(std::get<0>(iov)); @@ -135,17 +132,15 @@ namespace { /************************************************ TrackerMap of SiStripBadStrip (bad strips fraction) *************************************************/ - class SiStripBadStripFractionTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripBadStripFractionTrackerMap : public PlotImage { public: SiStripBadStripFractionTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStrip Bad Components fraction") {} + : PlotImage("Tracker Map of SiStrip Bad Components fraction") {} bool fill() override { auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); - auto tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + auto tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); @@ -195,12 +190,10 @@ namespace { /************************************************ TrackerMap of SiStripBadStrip (bad strips fraction) *************************************************/ - class SiStripBadStripFractionTkMap - : public cond::payloadInspector::PlotImage { + class SiStripBadStripFractionTkMap : public PlotImage { public: SiStripBadStripFractionTkMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStrip Bad Components fraction") {} + : PlotImage("Tracker Map of SiStrip Bad Components fraction") {} bool fill() override { //SiStripPI::setPaletteStyle(SiStripPI::DEFAULT); @@ -208,7 +201,7 @@ namespace { auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); - auto tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + auto tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); @@ -258,11 +251,10 @@ namespace { time history histogram of bad components fraction *************************************************/ - class SiStripBadStripFractionByRun : public cond::payloadInspector::HistoryPlot { + class SiStripBadStripFractionByRun : public HistoryPlot { public: SiStripBadStripFractionByRun() - : cond::payloadInspector::HistoryPlot("SiStrip Bad Strip fraction per run", - "Bad Strip fraction [%]") {} + : HistoryPlot("SiStrip Bad Strip fraction per run", "Bad Strip fraction [%]") {} ~SiStripBadStripFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { @@ -301,11 +293,11 @@ namespace { time history histogram of bad components fraction (TIB) *************************************************/ - class SiStripBadStripTIBFractionByRun : public cond::payloadInspector::HistoryPlot { + class SiStripBadStripTIBFractionByRun : public HistoryPlot { public: SiStripBadStripTIBFractionByRun() - : cond::payloadInspector::HistoryPlot("SiStrip Inner Barrel Bad Strip fraction per run", - "TIB Bad Strip fraction [%]") {} + : HistoryPlot("SiStrip Inner Barrel Bad Strip fraction per run", + "TIB Bad Strip fraction [%]") {} ~SiStripBadStripTIBFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { @@ -347,11 +339,11 @@ namespace { time history histogram of bad components fraction (TOB) *************************************************/ - class SiStripBadStripTOBFractionByRun : public cond::payloadInspector::HistoryPlot { + class SiStripBadStripTOBFractionByRun : public HistoryPlot { public: SiStripBadStripTOBFractionByRun() - : cond::payloadInspector::HistoryPlot("SiStrip Outer Barrel Bad Strip fraction per run", - "TOB Bad Strip fraction [%]") {} + : HistoryPlot("SiStrip Outer Barrel Bad Strip fraction per run", + "TOB Bad Strip fraction [%]") {} ~SiStripBadStripTOBFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { @@ -393,11 +385,11 @@ namespace { time history histogram of bad components fraction (TID) *************************************************/ - class SiStripBadStripTIDFractionByRun : public cond::payloadInspector::HistoryPlot { + class SiStripBadStripTIDFractionByRun : public HistoryPlot { public: SiStripBadStripTIDFractionByRun() - : cond::payloadInspector::HistoryPlot("SiStrip Inner Disks Bad Strip fraction per run", - "TID Bad Strip fraction [%]") {} + : HistoryPlot("SiStrip Inner Disks Bad Strip fraction per run", + "TID Bad Strip fraction [%]") {} ~SiStripBadStripTIDFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { @@ -439,11 +431,11 @@ namespace { time history histogram of bad components fraction (TEC) *************************************************/ - class SiStripBadStripTECFractionByRun : public cond::payloadInspector::HistoryPlot { + class SiStripBadStripTECFractionByRun : public HistoryPlot { public: SiStripBadStripTECFractionByRun() - : cond::payloadInspector::HistoryPlot("SiStrip Endcaps Bad Strip fraction per run", - "TEC Bad Strip fraction [%]") {} + : HistoryPlot("SiStrip Endcaps Bad Strip fraction per run", + "TEC Bad Strip fraction [%]") {} ~SiStripBadStripTECFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { @@ -485,12 +477,10 @@ namespace { Plot BadStrip by region *************************************************/ - class SiStripBadStripByRegion - : public cond::payloadInspector::PlotImage { + class SiStripBadStripByRegion : public PlotImage { public: SiStripBadStripByRegion() - : cond::payloadInspector::PlotImage( - "SiStrip BadStrip By Region"), + : PlotImage("SiStrip BadStrip By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -620,19 +610,18 @@ namespace { Plot BadStrip by region comparison *************************************************/ - template - class SiStripBadStripByRegionComparisonBase - : public cond::payloadInspector::PlotImage { + template + class SiStripBadStripByRegionComparisonBase : public PlotImage { public: SiStripBadStripByRegionComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip BadStrip By Region Comparison"), + : PlotImage("SiStrip BadStrip By Region Comparison"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -641,8 +630,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -838,27 +827,23 @@ namespace { TrackerTopology m_trackerTopo; }; - using SiStripBadStripByRegionComparisonSingleTag = - SiStripBadStripByRegionComparisonBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripBadStripByRegionComparisonTwoTags = - SiStripBadStripByRegionComparisonBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripBadStripByRegionComparisonSingleTag = SiStripBadStripByRegionComparisonBase<1, MULTI_IOV>; + using SiStripBadStripByRegionComparisonTwoTags = SiStripBadStripByRegionComparisonBase<2, SINGLE_IOV>; /************************************************ TrackerMap of SiStripBadStrip (bad strips fraction difference) *************************************************/ - template - class SiStripBadStripFractionComparisonTrackerMapBase - : public cond::payloadInspector::PlotImage { + template + class SiStripBadStripFractionComparisonTrackerMapBase : public PlotImage { public: SiStripBadStripFractionComparisonTrackerMapBase() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStrip bad strip fraction difference") {} + : PlotImage("Tracker Map of SiStrip bad strip fraction difference") {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -867,8 +852,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -961,20 +946,18 @@ namespace { }; using SiStripBadStripFractionComparisonTrackerMapSingleTag = - SiStripBadStripFractionComparisonTrackerMapBase<1, cond::payloadInspector::MULTI_IOV>; + SiStripBadStripFractionComparisonTrackerMapBase<1, MULTI_IOV>; using SiStripBadStripFractionComparisonTrackerMapTwoTags = - SiStripBadStripFractionComparisonTrackerMapBase<2, cond::payloadInspector::SINGLE_IOV>; + SiStripBadStripFractionComparisonTrackerMapBase<2, SINGLE_IOV>; /************************************************ Plot BadStrip Quality analysis *************************************************/ - class SiStripBadStripQualityAnalysis - : public cond::payloadInspector::PlotImage { + class SiStripBadStripQualityAnalysis : public PlotImage { public: SiStripBadStripQualityAnalysis() - : cond::payloadInspector::PlotImage( - "SiStrip BadStrip Quality Analysis"), + : PlotImage("SiStrip BadStrip Quality Analysis"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -1150,12 +1133,11 @@ namespace { Plot BadStrip Quality Comparison *************************************************/ - template - class SiStripBadStripQualityComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripBadStripQualityComparisonBase : public PlotImage { public: SiStripBadStripQualityComparisonBase() - : cond::payloadInspector::PlotImage( - "SiStrip BadStrip Quality Comparison Analysis"), + : PlotImage("SiStrip BadStrip Quality Comparison Analysis"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -1164,8 +1146,8 @@ namespace { gStyle->SetPalette(kTemperatureMap); // 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -1174,8 +1156,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1369,10 +1351,8 @@ namespace { TrackerTopology m_trackerTopo; }; - using SiStripBadStripQualityComparisonSingleTag = - SiStripBadStripQualityComparisonBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripBadStripQualityComparisonTwoTags = - SiStripBadStripQualityComparisonBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripBadStripQualityComparisonSingleTag = SiStripBadStripQualityComparisonBase<1, MULTI_IOV>; + using SiStripBadStripQualityComparisonTwoTags = SiStripBadStripQualityComparisonBase<2, SINGLE_IOV>; } // namespace diff --git a/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc index f422cb338bfc0..a637f6f1022aa 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripConfObject_PayloadInspector.cc @@ -36,12 +36,13 @@ namespace { + using namespace cond::payloadInspector; + // test class - class SiStripConfObjectTest - : public cond::payloadInspector::Histogram1D { + class SiStripConfObjectTest : public Histogram1D { public: SiStripConfObjectTest() - : cond::payloadInspector::Histogram1D( + : Histogram1D( "SiStrip Configuration Object test", "SiStrip Configuration Object test", 1, 0.0, 1.0) {} bool fill() override { @@ -68,12 +69,9 @@ namespace { }; // display class - class SiStripConfObjectDisplay - : public cond::payloadInspector::PlotImage { + class SiStripConfObjectDisplay : public PlotImage { public: - SiStripConfObjectDisplay() - : cond::payloadInspector::PlotImage( - "Display Configuration Values") {} + SiStripConfObjectDisplay() : PlotImage("Display Configuration Values") {} bool fill() override { auto tag = PlotBase::getTag<0>(); diff --git a/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc index 40c4efff7c00d..a7a60ae57a92d 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripDetVOff_PayloadInspector.cc @@ -25,18 +25,18 @@ namespace { - class SiStripDetVOff_LV : public cond::payloadInspector::TimeHistoryPlot { + using namespace cond::payloadInspector; + + class SiStripDetVOff_LV : public TimeHistoryPlot { public: - SiStripDetVOff_LV() - : cond::payloadInspector::TimeHistoryPlot("Nr of mod with LV OFF vs time", "nLVOff") {} + SiStripDetVOff_LV() : TimeHistoryPlot("Nr of mod with LV OFF vs time", "nLVOff") {} int getFromPayload(SiStripDetVOff& payload) override { return payload.getLVoffCounts(); } }; - class SiStripDetVOff_HV : public cond::payloadInspector::TimeHistoryPlot { + class SiStripDetVOff_HV : public TimeHistoryPlot { public: - SiStripDetVOff_HV() - : cond::payloadInspector::TimeHistoryPlot("Nr of mod with HV OFF vs time", "nHVOff") {} + SiStripDetVOff_HV() : TimeHistoryPlot("Nr of mod with HV OFF vs time", "nHVOff") {} int getFromPayload(SiStripDetVOff& payload) override { return payload.getHVoffCounts(); } }; @@ -44,12 +44,9 @@ namespace { /************************************************ TrackerMap of Module VOff *************************************************/ - class SiStripDetVOff_IsModuleVOff_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripDetVOff_IsModuleVOff_TrackerMap : public PlotImage { public: - SiStripDetVOff_IsModuleVOff_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map IsModuleVOff") {} + SiStripDetVOff_IsModuleVOff_TrackerMap() : PlotImage("Tracker Map IsModuleVOff") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -80,12 +77,9 @@ namespace { /************************************************ TrackerMap of Module HVOff *************************************************/ - class SiStripDetVOff_IsModuleHVOff_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripDetVOff_IsModuleHVOff_TrackerMap : public PlotImage { public: - SiStripDetVOff_IsModuleHVOff_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map IsModuleHVOff") {} + SiStripDetVOff_IsModuleHVOff_TrackerMap() : PlotImage("Tracker Map IsModuleHVOff") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -116,12 +110,9 @@ namespace { /************************************************ TrackerMap of Module LVOff *************************************************/ - class SiStripDetVOff_IsModuleLVOff_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripDetVOff_IsModuleLVOff_TrackerMap : public PlotImage { public: - SiStripDetVOff_IsModuleLVOff_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map IsModuleLVOff") {} + SiStripDetVOff_IsModuleLVOff_TrackerMap() : PlotImage("Tracker Map IsModuleLVOff") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -158,11 +149,10 @@ namespace { } template - class SiStripDetVOffListOfModules - : public cond::payloadInspector::Histogram1DD { + class SiStripDetVOffListOfModules : public Histogram1DD { public: SiStripDetVOffListOfModules() - : cond::payloadInspector::Histogram1DD( + : Histogram1DD( "SiStrip Off modules", "SiStrip Off modules", 15148, 0., 15148., "DetId of VOff module") {} bool fill() override { @@ -219,12 +209,10 @@ namespace { test class *************************************************/ - class SiStripDetVOffTest - : public cond::payloadInspector::Histogram1D { + class SiStripDetVOffTest : public Histogram1D { public: SiStripDetVOffTest() - : cond::payloadInspector::Histogram1D( - "SiStrip DetVOff test", "SiStrip DetVOff test", 10, 0.0, 10.0), + : Histogram1D("SiStrip DetVOff test", "SiStrip DetVOff test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -272,12 +260,10 @@ namespace { Plot DetVOff by region *************************************************/ - class SiStripDetVOffByRegion - : public cond::payloadInspector::PlotImage { + class SiStripDetVOffByRegion : public PlotImage { public: SiStripDetVOffByRegion() - : cond::payloadInspector::PlotImage( - "SiStrip DetVOff By Region"), + : PlotImage("SiStrip DetVOff By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} diff --git a/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc index 1d64a01fbb29e..bc64031b8ef9b 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripFedCabling_PayloadInspector.cc @@ -27,15 +27,14 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ TrackerMap of SiStrip FED Cabling *************************************************/ - class SiStripFedCabling_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripFedCabling_TrackerMap : public PlotImage { public: - SiStripFedCabling_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map SiStrip Fed Cabling") {} + SiStripFedCabling_TrackerMap() : PlotImage("Tracker Map SiStrip Fed Cabling") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -76,12 +75,9 @@ namespace { /************************************************ Summary Plot of SiStrip FED Cabling *************************************************/ - class SiStripFedCabling_Summary - : public cond::payloadInspector::PlotImage { + class SiStripFedCabling_Summary : public PlotImage { public: - SiStripFedCabling_Summary() - : cond::payloadInspector::PlotImage( - "SiStrip Fed Cabling Summary") {} + SiStripFedCabling_Summary() : PlotImage("SiStrip Fed Cabling Summary") {} bool fill() override { auto tag = PlotBase::getTag<0>(); diff --git a/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc index 5c19f738adbec..80827e9e67137 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLatency_PayloadInspector.cc @@ -40,16 +40,16 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ *************** test class ****************** *************************************************/ - class SiStripLatencyTest - : public cond::payloadInspector::Histogram1D { + class SiStripLatencyTest : public Histogram1D { public: SiStripLatencyTest() - : cond::payloadInspector::Histogram1D( - "SiStripLatency values", "SiStripLatency values", 5, 0.0, 5.0) {} + : Histogram1D("SiStripLatency values", "SiStripLatency values", 5, 0.0, 5.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -67,12 +67,9 @@ namespace { /*********************************************** // 1d histogram of mode of 1 IOV ************************************************/ - class SiStripLatencyMode - : public cond::payloadInspector::Histogram1D { + class SiStripLatencyMode : public Histogram1D { public: - SiStripLatencyMode() - : cond::payloadInspector::Histogram1D( - "SiStripLatency mode", "SiStripLatency mode", 70, -10, 60) {} + SiStripLatencyMode() : Histogram1D("SiStripLatency mode", "SiStripLatency mode", 70, -10, 60) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -98,10 +95,9 @@ namespace { *******************1D histo of mode as a function of the run**************** *****************************************************************************/ - class SiStripLatencyModeHistory : public cond::payloadInspector::HistoryPlot { + class SiStripLatencyModeHistory : public HistoryPlot { public: - SiStripLatencyModeHistory() - : cond::payloadInspector::HistoryPlot("Mode vs run number", "Mode vs run number") {} + SiStripLatencyModeHistory() : HistoryPlot("Mode vs run number", "Mode vs run number") {} uint16_t getFromPayload(SiStripLatency& payload) override { uint16_t singlemode = payload.singleMode(); @@ -112,11 +108,10 @@ namespace { /**************************************************************************** *****************number of modes per run ************************************* **************************************************************************/ - class SiStripLatencyNumbOfModeHistory : public cond::payloadInspector::HistoryPlot { + class SiStripLatencyNumbOfModeHistory : public HistoryPlot { public: SiStripLatencyNumbOfModeHistory() - : cond::payloadInspector::HistoryPlot("Number of modes vs run ", - "Number of modes vs run") {} + : HistoryPlot("Number of modes vs run ", "Number of modes vs run") {} int getFromPayload(SiStripLatency& payload) override { std::vector modes; diff --git a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc index 720a1cef15365..6c11481e65438 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripLorentzAngle_PayloadInspector.cc @@ -35,16 +35,17 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ 1d histogram of SiStripLorentzAngle of 1 IOV *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripLorentzAngleValue - : public cond::payloadInspector::Histogram1D { + class SiStripLorentzAngleValue : public Histogram1D { public: SiStripLorentzAngleValue() - : cond::payloadInspector::Histogram1D( + : Histogram1D( "SiStrip LorentzAngle values", "SiStrip LorentzAngle values", 100, 0.0, 0.05) {} bool fill() override { @@ -66,12 +67,10 @@ namespace { /************************************************ TrackerMap of SiStrip Lorentz Angle *************************************************/ - class SiStripLorentzAngle_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripLorentzAngle_TrackerMap : public PlotImage { public: SiStripLorentzAngle_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map SiStrip Lorentz Angle") {} + : PlotImage("Tracker Map SiStrip Lorentz Angle") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -107,12 +106,9 @@ namespace { /************************************************ SiStripTkMaps of SiStrip Lorentz Angle *************************************************/ - class SiStripLorentzAngleTkMap - : public cond::payloadInspector::PlotImage { + class SiStripLorentzAngleTkMap : public PlotImage { public: - SiStripLorentzAngleTkMap() - : cond::payloadInspector::PlotImage( - "Tracker Map SiStrip Lorentz Angle") {} + SiStripLorentzAngleTkMap() : PlotImage("Tracker Map SiStrip Lorentz Angle") {} bool fill() override { //SiStripPI::setPaletteStyle(SiStripPI::DEFAULT); @@ -120,7 +116,7 @@ namespace { auto tag = PlotBase::getTag<0>(); auto iov = tag.iovs.front(); - auto tagname = cond::payloadInspector::PlotBase::getTag<0>().name; + auto tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); @@ -152,12 +148,10 @@ namespace { Plot Lorentz Angle averages by partition *************************************************/ - class SiStripLorentzAngleByRegion - : public cond::payloadInspector::PlotImage { + class SiStripLorentzAngleByRegion : public PlotImage { public: SiStripLorentzAngleByRegion() - : cond::payloadInspector::PlotImage( - "SiStripLorentzAngle By Region"), + : PlotImage("SiStripLorentzAngle By Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -268,20 +262,18 @@ namespace { Plot SiStripLorentz Angle averages by partition comparison *************************************************/ - template - class SiStripLorentzAngleComparatorByRegionBase - : public cond::payloadInspector::PlotImage { + template + class SiStripLorentzAngleComparatorByRegionBase : public PlotImage { public: SiStripLorentzAngleComparatorByRegionBase() - : cond::payloadInspector::PlotImage( - "SiStripLorentzAngle By Region Comparison"), + : PlotImage("SiStripLorentzAngle By Region Comparison"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -290,8 +282,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -443,10 +435,8 @@ namespace { } }; - using SiStripLorentzAngleByRegionCompareSingleTag = - SiStripLorentzAngleComparatorByRegionBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripLorentzAngleByRegionCompareTwoTags = - SiStripLorentzAngleComparatorByRegionBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripLorentzAngleByRegionCompareSingleTag = SiStripLorentzAngleComparatorByRegionBase<1, MULTI_IOV>; + using SiStripLorentzAngleByRegionCompareTwoTags = SiStripLorentzAngleComparatorByRegionBase<2, SINGLE_IOV>; } // namespace diff --git a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc index 2c2cf88291d64..0c7ae062c84f0 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripNoises_PayloadInspector.cc @@ -47,16 +47,16 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ test class *************************************************/ - class SiStripNoisesTest - : public cond::payloadInspector::Histogram1D { + class SiStripNoisesTest : public Histogram1D { public: SiStripNoisesTest() - : cond::payloadInspector::Histogram1D( - "SiStrip Noise test", "SiStrip Noise test", 10, 0.0, 10.0), + : Histogram1D("SiStrip Noise test", "SiStrip Noise test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -100,13 +100,10 @@ namespace { SiStrip Noise Profile of 1 IOV for one selected DetId *************************************************/ - class SiStripNoisePerDetId - : public cond::payloadInspector::PlotImage { + class SiStripNoisePerDetId : public PlotImage { public: - SiStripNoisePerDetId() - : cond::payloadInspector::PlotImage( - "SiStrip Noise values Per DetId") { - cond::payloadInspector::PlotBase::addInputParam("DetIds"); + SiStripNoisePerDetId() : PlotImage("SiStrip Noise values Per DetId") { + PlotBase::addInputParam("DetIds"); } bool fill() override { @@ -117,7 +114,7 @@ namespace { std::vector the_detids = {}; - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetIds"); if (ip != paramValues.end()) { auto input = boost::lexical_cast(ip->second); @@ -272,12 +269,10 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripNoiseValue - : public cond::payloadInspector::Histogram1D { + class SiStripNoiseValue : public Histogram1D { public: SiStripNoiseValue() - : cond::payloadInspector::Histogram1D( - "SiStrip Noise values", "SiStrip Noise values", 100, 0.0, 10.0) {} + : Histogram1D("SiStrip Noise values", "SiStrip Noise values", 100, 0.0, 10.0) {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -306,13 +301,12 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripNoiseValuePerDetId - : public cond::payloadInspector::Histogram1D { + class SiStripNoiseValuePerDetId : public Histogram1D { public: SiStripNoiseValuePerDetId() - : cond::payloadInspector::Histogram1D( + : Histogram1D( "SiStrip Noise values per DetId", "SiStrip Noise values per DetId", 100, 0.0, 10.0) { - cond::payloadInspector::PlotBase::addInputParam("DetId"); + PlotBase::addInputParam("DetId"); } bool fill() override { @@ -320,7 +314,7 @@ namespace { for (auto const& iov : tag.iovs) { std::shared_ptr payload = Base::fetchPayload(std::get<1>(iov)); unsigned int the_detid(0xFFFFFFFF); - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetId"); if (ip != paramValues.end()) { the_detid = boost::lexical_cast(ip->second); @@ -345,12 +339,9 @@ namespace { // inherit from one of the predefined plot class: PlotImage template - class SiStripNoiseDistribution - : public cond::payloadInspector::PlotImage { + class SiStripNoiseDistribution : public PlotImage { public: - SiStripNoiseDistribution() - : cond::payloadInspector::PlotImage("SiStrip Noise values") { - } + SiStripNoiseDistribution() : PlotImage("SiStrip Noise values") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -466,16 +457,16 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: PlotImage - template - class SiStripNoiseDistributionComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseDistributionComparisonBase : public PlotImage { public: SiStripNoiseDistributionComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip Noise values comparison") {} + : PlotImage("SiStrip Noise values comparison") {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -484,8 +475,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -655,12 +646,10 @@ namespace { }; template - using SiStripNoiseDistributionComparisonSingleTag = - SiStripNoiseDistributionComparisonBase; + using SiStripNoiseDistributionComparisonSingleTag = SiStripNoiseDistributionComparisonBase; template - using SiStripNoiseDistributionComparisonTwoTags = - SiStripNoiseDistributionComparisonBase; + using SiStripNoiseDistributionComparisonTwoTags = SiStripNoiseDistributionComparisonBase; typedef SiStripNoiseDistributionComparisonSingleTag SiStripNoiseValueComparisonPerStripSingleTag; @@ -678,16 +667,15 @@ namespace { // inherit from one of the predefined plot class: PlotImage - template - class SiStripNoiseValueComparisonBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseValueComparisonBase : public PlotImage { public: - SiStripNoiseValueComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip Noise values comparison") {} + SiStripNoiseValueComparisonBase() : PlotImage("SiStrip Noise values comparison") {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -696,8 +684,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -794,20 +782,18 @@ namespace { } }; - using SiStripNoiseValueComparisonSingleTag = SiStripNoiseValueComparisonBase<1, cond::payloadInspector::MULTI_IOV>; - using SiStripNoiseValueComparisonTwoTags = SiStripNoiseValueComparisonBase<2, cond::payloadInspector::SINGLE_IOV>; + using SiStripNoiseValueComparisonSingleTag = SiStripNoiseValueComparisonBase<1, MULTI_IOV>; + using SiStripNoiseValueComparisonTwoTags = SiStripNoiseValueComparisonBase<2, SINGLE_IOV>; /************************************************ SiStrip Noise Tracker Map *************************************************/ template - class SiStripNoiseTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripNoiseTrackerMap : public PlotImage { public: SiStripNoiseTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStripNoise " + estimatorType(est) + " per module") {} + : PlotImage("Tracker Map of SiStripNoise " + estimatorType(est) + " per module") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -906,14 +892,13 @@ namespace { SiStrip Noise Tracker Map (ratio with previous gain per detid) *************************************************/ - template - class SiStripNoiseRatioWithPreviousIOVTrackerMapBase - : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseRatioWithPreviousIOVTrackerMapBase : public PlotImage { public: SiStripNoiseRatioWithPreviousIOVTrackerMapBase() - : cond::payloadInspector::PlotImage("Tracker Map of ratio of SiStripNoises " + - estimatorType(est) + "with previous IOV") { - cond::payloadInspector::PlotBase::addInputParam("nsigma"); + : PlotImage("Tracker Map of ratio of SiStripNoises " + estimatorType(est) + + "with previous IOV") { + PlotBase::addInputParam("nsigma"); } std::map computeEstimator(std::shared_ptr payload) { @@ -975,15 +960,15 @@ namespace { bool fill() override { unsigned int nsigma(1); - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { nsigma = boost::lexical_cast(ip->second); } // 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -992,8 +977,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1042,11 +1027,11 @@ namespace { template using SiStripNoiseRatioWithPreviousIOVTrackerMapSingleTag = - SiStripNoiseRatioWithPreviousIOVTrackerMapBase; + SiStripNoiseRatioWithPreviousIOVTrackerMapBase; template using SiStripNoiseRatioWithPreviousIOVTrackerMapTwoTags = - SiStripNoiseRatioWithPreviousIOVTrackerMapBase; + SiStripNoiseRatioWithPreviousIOVTrackerMapBase; typedef SiStripNoiseRatioWithPreviousIOVTrackerMapSingleTag SiStripNoiseMin_RatioWithPreviousIOVTrackerMapSingleTag; @@ -1071,12 +1056,10 @@ namespace { *************************************************/ template - class SiStripNoiseByRegion - : public cond::payloadInspector::PlotImage { + class SiStripNoiseByRegion : public PlotImage { public: SiStripNoiseByRegion() - : cond::payloadInspector::PlotImage( - "SiStrip Noise " + estimatorType(est) + " by Region"), + : PlotImage("SiStrip Noise " + estimatorType(est) + " by Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -1198,19 +1181,18 @@ namespace { SiStrip Noise Comparator *************************************************/ - template - class SiStripNoiseComparatorByRegionBase : public cond::payloadInspector::PlotImage { + template + class SiStripNoiseComparatorByRegionBase : public PlotImage { public: SiStripNoiseComparatorByRegionBase() - : cond::payloadInspector::PlotImage("SiStrip Noise " + estimatorType(est) + - " comparator by Region"), + : PlotImage("SiStrip Noise " + estimatorType(est) + " comparator by Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -1219,8 +1201,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -1386,12 +1368,10 @@ namespace { }; template - using SiStripNoiseComparatorByRegionSingleTag = - SiStripNoiseComparatorByRegionBase; + using SiStripNoiseComparatorByRegionSingleTag = SiStripNoiseComparatorByRegionBase; template - using SiStripNoiseComparatorByRegionTwoTags = - SiStripNoiseComparatorByRegionBase; + using SiStripNoiseComparatorByRegionTwoTags = SiStripNoiseComparatorByRegionBase; typedef SiStripNoiseComparatorByRegionSingleTag SiStripNoiseComparatorMeanByRegionSingleTag; typedef SiStripNoiseComparatorByRegionSingleTag SiStripNoiseComparatorMinByRegionSingleTag; @@ -1406,12 +1386,10 @@ namespace { /************************************************ Noise linearity *************************************************/ - class SiStripNoiseLinearity - : public cond::payloadInspector::PlotImage { + class SiStripNoiseLinearity : public PlotImage { public: SiStripNoiseLinearity() - : cond::payloadInspector::PlotImage( - "Linearity of Strip Noise as a fuction of strip length") {} + : PlotImage("Linearity of Strip Noise as a fuction of strip length") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -1532,10 +1510,10 @@ namespace { *************************************************/ template - class NoiseHistory : public cond::payloadInspector::HistoryPlot> { + class NoiseHistory : public HistoryPlot> { public: NoiseHistory() - : cond::payloadInspector::HistoryPlot>( + : HistoryPlot>( "Average " + SiStripPI::getStringFromSubdet(sub) + " noise vs run number", "average " + SiStripPI::getStringFromSubdet(sub) + " Noise") {} @@ -1577,10 +1555,10 @@ namespace { *************************************************/ template - class NoiseRunHistory : public cond::payloadInspector::RunHistoryPlot> { + class NoiseRunHistory : public RunHistoryPlot> { public: NoiseRunHistory() - : cond::payloadInspector::RunHistoryPlot>( + : RunHistoryPlot>( "Average " + SiStripPI::getStringFromSubdet(sub) + " noise vs run number", "average " + SiStripPI::getStringFromSubdet(sub) + " Noise") {} @@ -1622,10 +1600,10 @@ namespace { *************************************************/ template - class NoiseTimeHistory : public cond::payloadInspector::TimeHistoryPlot> { + class NoiseTimeHistory : public TimeHistoryPlot> { public: NoiseTimeHistory() - : cond::payloadInspector::TimeHistoryPlot>( + : TimeHistoryPlot>( "Average " + SiStripPI::getStringFromSubdet(sub) + " noise vs run number", "average " + SiStripPI::getStringFromSubdet(sub) + " Noise") {} @@ -1666,12 +1644,10 @@ namespace { template Noise run history per layer *************************************************/ template - class NoiseLayerRunHistory - : public cond::payloadInspector::PlotImage { + class NoiseLayerRunHistory : public PlotImage { public: NoiseLayerRunHistory() - : cond::payloadInspector::PlotImage( - "SiStrip Noise values comparison"), + : PlotImage("SiStrip Noise values comparison"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} diff --git a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc index 2a18dacab6350..11a0715977dc8 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripPedestals_PayloadInspector.cc @@ -46,16 +46,16 @@ namespace { + using namespace cond::payloadInspector; + /************************************************ test class *************************************************/ - class SiStripPedestalsTest - : public cond::payloadInspector::Histogram1D { + class SiStripPedestalsTest : public Histogram1D { public: SiStripPedestalsTest() - : cond::payloadInspector::Histogram1D( - "SiStrip Pedestals test", "SiStrip Pedestals test", 10, 0.0, 10.0), + : Histogram1D("SiStrip Pedestals test", "SiStrip Pedestals test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -99,13 +99,10 @@ namespace { SiStrip Pedestals Profile of 1 IOV for one selected DetId *************************************************/ - class SiStripPedestalPerDetId - : public cond::payloadInspector::PlotImage { + class SiStripPedestalPerDetId : public PlotImage { public: - SiStripPedestalPerDetId() - : cond::payloadInspector::PlotImage( - "SiStrip Pedestal values per DetId") { - cond::payloadInspector::PlotBase::addInputParam("DetIds"); + SiStripPedestalPerDetId() : PlotImage("SiStrip Pedestal values per DetId") { + PlotBase::addInputParam("DetIds"); } bool fill() override { @@ -116,7 +113,7 @@ namespace { std::vector the_detids = {}; - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetIds"); if (ip != paramValues.end()) { auto input = boost::lexical_cast(ip->second); @@ -270,11 +267,10 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripPedestalsValue - : public cond::payloadInspector::Histogram1D { + class SiStripPedestalsValue : public Histogram1D { public: SiStripPedestalsValue() - : cond::payloadInspector::Histogram1D( + : Histogram1D( "SiStrip Pedestals values", "SiStrip Pedestals values", 300, 0.0, 300.0) {} bool fill() override { @@ -304,13 +300,12 @@ namespace { *************************************************/ // inherit from one of the predefined plot class: Histogram1D - class SiStripPedestalsValuePerDetId - : public cond::payloadInspector::Histogram1D { + class SiStripPedestalsValuePerDetId : public Histogram1D { public: SiStripPedestalsValuePerDetId() - : cond::payloadInspector::Histogram1D( + : Histogram1D( "SiStrip Pedestal values per DetId", "SiStrip Pedestal values per DetId", 100, 0.0, 10.0) { - cond::payloadInspector::PlotBase::addInputParam("DetId"); + PlotBase::addInputParam("DetId"); } bool fill() override { @@ -318,7 +313,7 @@ namespace { for (auto const& iov : tag.iovs) { std::shared_ptr payload = Base::fetchPayload(std::get<1>(iov)); unsigned int the_detid(0xFFFFFFFF); - auto paramValues = cond::payloadInspector::PlotBase::inputParamValues(); + auto paramValues = PlotBase::inputParamValues(); auto ip = paramValues.find("DetId"); if (ip != paramValues.end()) { the_detid = boost::lexical_cast(ip->second); @@ -343,12 +338,9 @@ namespace { // inherit from one of the predefined plot class: PlotImage template - class SiStripPedestalDistribution - : public cond::payloadInspector::PlotImage { + class SiStripPedestalDistribution : public PlotImage { public: - SiStripPedestalDistribution() - : cond::payloadInspector::PlotImage( - "SiStrip Pedestal values") {} + SiStripPedestalDistribution() : PlotImage("SiStrip Pedestal values") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -463,17 +455,16 @@ namespace { // inherit from one of the predefined plot class: PlotImage - template - class SiStripPedestalDistributionComparisonBase - : public cond::payloadInspector::PlotImage { + template + class SiStripPedestalDistributionComparisonBase : public PlotImage { public: SiStripPedestalDistributionComparisonBase() - : cond::payloadInspector::PlotImage("SiStrip Pedestal values comparison") {} + : PlotImage("SiStrip Pedestal values comparison") {} 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; + auto theIOVs = PlotBase::getTag<0>().iovs; + auto tagname1 = PlotBase::getTag<0>().name; std::string tagname2 = ""; auto firstiov = theIOVs.front(); std::tuple lastiov; @@ -482,8 +473,8 @@ namespace { 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; + auto tag2iovs = PlotBase::getTag<1>().iovs; + tagname2 = PlotBase::getTag<1>().name; lastiov = tag2iovs.front(); } else { lastiov = theIOVs.back(); @@ -653,11 +644,11 @@ namespace { template using SiStripPedestalDistributionComparisonSingleTag = - SiStripPedestalDistributionComparisonBase; + SiStripPedestalDistributionComparisonBase; template using SiStripPedestalDistributionComparisonTwoTags = - SiStripPedestalDistributionComparisonBase; + SiStripPedestalDistributionComparisonBase; typedef SiStripPedestalDistributionComparisonSingleTag SiStripPedestalValueComparisonPerStripSingleTag; @@ -677,12 +668,10 @@ namespace { *************************************************/ // inherit from one of the predefined plot class PlotImage - class SiStripZeroPedestalsFraction_TrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripZeroPedestalsFraction_TrackerMap : public PlotImage { public: SiStripZeroPedestalsFraction_TrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of Zero SiStripPedestals fraction per module") {} + : PlotImage("Tracker Map of Zero SiStripPedestals fraction per module") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -736,12 +725,11 @@ namespace { *************************************************/ template - class SiStripPedestalsTrackerMap - : public cond::payloadInspector::PlotImage { + class SiStripPedestalsTrackerMap : public PlotImage { public: SiStripPedestalsTrackerMap() - : cond::payloadInspector::PlotImage( - "Tracker Map of SiStripPedestals " + estimatorType(est) + " per module") {} + : PlotImage("Tracker Map of SiStripPedestals " + estimatorType(est) + + " per module") {} bool fill() override { auto tag = PlotBase::getTag<0>(); @@ -822,12 +810,10 @@ namespace { *************************************************/ template - class SiStripPedestalsByRegion - : public cond::payloadInspector::PlotImage { + class SiStripPedestalsByRegion : public PlotImage { public: SiStripPedestalsByRegion() - : cond::payloadInspector::PlotImage( - "SiStrip Pedestals " + estimatorType(est) + " by Region"), + : PlotImage("SiStrip Pedestals " + estimatorType(est) + " by Region"), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} diff --git a/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc index 8f0d436d314a9..a8f589f069f81 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripThreshold_PayloadInspector.cc @@ -44,16 +44,16 @@ using namespace std; namespace { + using namespace cond::payloadInspector; + /************************************************ test class *************************************************/ - class SiStripThresholdTest - : public cond::payloadInspector::Histogram1D { + class SiStripThresholdTest : public Histogram1D { public: SiStripThresholdTest() - : cond::payloadInspector::Histogram1D( - "SiStrip Threshold test", "SiStrip Threshold test", 10, 0.0, 10.0), + : Histogram1D("SiStrip Threshold test", "SiStrip Threshold test", 10, 0.0, 10.0), m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile( edm::FileInPath("Geometry/TrackerCommonData/data/trackerParameters.xml").fullPath())} {} @@ -85,16 +85,14 @@ namespace { 1d histogram of SiStripThresholds of 1 IOV - High Threshold *************************************************************/ - class SiStripThresholdValueHigh - : public cond::payloadInspector::Histogram1D { + class SiStripThresholdValueHigh : public Histogram1D { public: SiStripThresholdValueHigh() - : cond::payloadInspector::Histogram1D( - "SiStrip High threshold values (checked per APV)", - "SiStrip High threshold values (cheched per APV)", - 10, - 0.0, - 10) {} + : 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"); @@ -130,16 +128,14 @@ namespace { 1d histogram of SiStripThresholds of 1 IOV - Low Threshold *************************************************************/ - class SiStripThresholdValueLow - : public cond::payloadInspector::Histogram1D { + class SiStripThresholdValueLow : public Histogram1D { public: SiStripThresholdValueLow() - : cond::payloadInspector::Histogram1D( - "SiStrip Low threshold values (checked per APV)", - "SiStrip Low threshold values (cheched per APV)", - 10, - 0.0, - 10) {} + : 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"); From 1c97e5fce857150032ff2f07c8f38f87db8f3bcf Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 22 Dec 2020 16:25:45 +0100 Subject: [PATCH 12/12] final clean-up --- .../SiStripPlugins/interface/SiStripTkMaps.h | 26 +++++++++---------- .../SiStripApvGain_PayloadInspector.cc | 24 ++++++++--------- .../SiStripBadStrip_PayloadInspector.cc | 10 +++---- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h index 53cdf84ce21a7..bb60f52b80ac1 100644 --- a/CondCore/SiStripPlugins/interface/SiStripTkMaps.h +++ b/CondCore/SiStripPlugins/interface/SiStripTkMaps.h @@ -16,13 +16,8 @@ #include "TCanvas.h" #include "TColor.h" #include "TGraph.h" -#include "TH1.h" -#include "TH2.h" #include "TLatex.h" #include "TH2Poly.h" -#include "TObjArray.h" -#include "TObjString.h" -#include "TProfile2D.h" #include "TStyle.h" // STL includes @@ -31,6 +26,8 @@ #include #include #include + +// boost includes #include #include @@ -148,7 +145,7 @@ class SiStripTkMaps { std::string m_mapTitle = ""; std::string m_zAxisTitle = ""; double m_axmin, m_axmax; - std::map > m_bins; + std::map> m_bins; std::vector m_detIdVector; std::vector m_values; TrackerTopology m_trackerTopo; @@ -274,10 +271,11 @@ class SiStripTkMaps { void readVertices(double& minx, double& maxx, double& miny, double& maxy) { std::ifstream in; + // TPolyline vertices stored at https://github.com/cms-data/DQM-SiStripMonitorClient in.open(edm::FileInPath("DQM/SiStripMonitorClient/data/Geometry/tracker_map_bare").fullPath().c_str()); if (!in.good()) { - throw cms::Exception("FileError") << "Problem opening corner file!!" << std::endl; + throw cms::Exception("FileError") << "SiStripTkMaps: problem opening vertices file!!" << std::endl; return; } @@ -287,14 +285,16 @@ class SiStripTkMaps { std::string line; std::getline(in, line); + typedef boost::tokenizer> tokenizer; + boost::char_separator sep{" "}; + tokenizer tok{line, sep}; - TString string(line); - TObjArray* array = string.Tokenize(" "); int ix{0}, iy{0}; bool isPixel{false}; - for (int i = 0; i < array->GetEntries(); ++i) { + for (const auto& t : tok | boost::adaptors::indexed(0)) { + int i = t.index(); if (i == 0) { - detid = static_cast(array->At(i))->String().Atoll(); + detid = atoll((t.value()).c_str()); // Drop Pixel Data DetId detId(detid); @@ -304,7 +304,7 @@ class SiStripTkMaps { } } else { if (i % 2 == 0) { - x[ix] = static_cast(array->At(i))->String().Atof(); + x[ix] = atof((t.value()).c_str()); if (x[ix] < minx) { minx = x[ix]; } @@ -313,7 +313,7 @@ class SiStripTkMaps { } ++ix; } else { - y[iy] = static_cast(array->At(i))->String().Atof(); + y[iy] = atof((t.value()).c_str()); if (y[iy] < miny) { miny = y[iy]; } diff --git a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc index 8cc04a51eac01..93aeb2d9f7185 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripApvGain_PayloadInspector.cc @@ -552,9 +552,9 @@ namespace { *************************************************/ template - class SiStripApvGainsRatioWithPreviousIOVTrackerMapBase : public PlotImage { + class SiStripApvGainsRatioTrackerMapBase : public PlotImage { public: - SiStripApvGainsRatioWithPreviousIOVTrackerMapBase() + SiStripApvGainsRatioTrackerMapBase() : PlotImage("Tracker Map of ratio of SiStripGains with previous IOV") { PlotBase::addInputParam("nsigma"); } @@ -653,19 +653,17 @@ namespace { } }; - using SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap = - SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<1, MULTI_IOV>; - using SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags = - SiStripApvGainsRatioWithPreviousIOVTrackerMapBase<2, SINGLE_IOV>; + using SiStripApvGainsAvgDeviationRatioWithPreviousIOVTrackerMap = SiStripApvGainsRatioTrackerMapBase<1, MULTI_IOV>; + using SiStripApvGainsAvgDeviationRatioTrackerMapTwoTags = SiStripApvGainsRatioTrackerMapBase<2, SINGLE_IOV>; /************************************************ TrackerMap of SiStripApvGains (ratio for largest deviation with previous gain per detid) *************************************************/ template - class SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase : public PlotImage { + class SiStripApvGainsRatioMaxDeviationTrackerMapBase : public PlotImage { public: - SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase() + SiStripApvGainsRatioMaxDeviationTrackerMapBase() : PlotImage( "Tracker Map of ratio (for largest deviation) of SiStripGains with previous IOV") { PlotBase::addInputParam("nsigma"); @@ -677,9 +675,11 @@ namespace { auto ip = paramValues.find("nsigma"); if (ip != paramValues.end()) { nsigma = boost::lexical_cast(ip->second); - std::cout << "using custom z-axis saturation: " << nsigma << " sigmas" << std::endl; + edm::LogPrint("SiStripApvGain_PayloadInspector") + << "using custom z-axis saturation: " << nsigma << " sigmas" << std::endl; } else { - std::cout << "using default saturation: " << nsigma << " sigmas" << std::endl; + edm::LogPrint("SiStripApvGain_PayloadInspector") + << "using default saturation: " << nsigma << " sigmas" << std::endl; } // trick to deal with the multi-ioved tag and two tag case at the same time @@ -786,10 +786,10 @@ namespace { }; using SiStripApvGainsMaxDeviationRatioWithPreviousIOVTrackerMap = - SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<1, MULTI_IOV>; + SiStripApvGainsRatioMaxDeviationTrackerMapBase<1, MULTI_IOV>; using SiStripApvGainsMaxDeviationRatioTrackerMapTwoTags = - SiStripApvGainsRatioMaxDeviationWithPreviousIOVTrackerMapBase<2, SINGLE_IOV>; + SiStripApvGainsRatioMaxDeviationTrackerMapBase<2, SINGLE_IOV>; /************************************************ TrackerMap of SiStripApvGains (maximum gain per detid) diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 5e5af46d198a7..c9bc2f20f944a 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -929,11 +929,11 @@ namespace { } } - /* - std::cout<<"In 2 but not in 1:"<< countLastButNotFirst << std::endl; - std::cout<<"In 1 but not in 2:"<< countFirstButNotLast << std::endl; - std::cout<<"In both:"<< countBoth << std::endl; - */ +#ifdef MMDEBUG + std::cout << "In 2 but not in 1:" << countLastButNotFirst << std::endl; + std::cout << "In 1 but not in 2:" << countFirstButNotLast << std::endl; + std::cout << "In both:" << countBoth << std::endl; +#endif //=========================