diff --git a/CondCore/EcalPlugins/plugins/ESChannelStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/ESChannelStatus_PayloadInspector.cc index 1de368e5e8201..1f02e9b428bd2 100644 --- a/CondCore/EcalPlugins/plugins/ESChannelStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/ESChannelStatus_PayloadInspector.cc @@ -21,9 +21,9 @@ namespace { enum { kESChannels = 137216 }; enum { IX_MIN = 1, IY_MIN = 1, IX_MAX = 40, IY_MAX = 40 }; // endcaps lower and upper bounds on x and y - /********************************************************* - 2d plot of ES channel status of 1 IOV - *********************************************************/ + /******************************************** + 2d plot of ES channel status of 1 IOV + *********************************************/ class ESChannelStatusPlot : public cond::payloadInspector::PlotImage { public: ESChannelStatusPlot() : cond::payloadInspector::PlotImage("ES channel status") { @@ -117,9 +117,9 @@ namespace { } // fill method }; - /************************************************************************ - 2d plot of ES channel status difference between 2 IOVs - ************************************************************************/ + /************************************************************* + 2d plot of ES channel status difference between 2 IOVs + **************************************************************/ template class ESChannelStatusDiffBase : public cond::payloadInspector::PlotImage { public: @@ -200,15 +200,19 @@ namespace { t1.SetNDC(); t1.SetTextAlign(26); int len = l_tagname[0].length() + l_tagname[1].length(); - if (ntags == 2 && len < 60) { - t1.SetTextSize(0.03); - t1.DrawLatex( - 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + if (ntags == 2) { + if (len < 60) { + t1.SetTextSize(0.03); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("ES Channel Status, IOV %i - %i", run[1], run[0])); + } } else { t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("ES Channel Status, IOV %i - %i", run[1], run[0])); + t1.DrawLatex(0.5, 0.96, Form("%s IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); } - t1.SetTextSize(0.025); float xmi[2] = {0.0, 0.5}; float xma[2] = {0.5, 1.0}; diff --git a/CondCore/EcalPlugins/plugins/ESIntercalibConstants_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/ESIntercalibConstants_PayloadInspector.cc index d4ad8bb8ca03c..d04270dcc2c26 100644 --- a/CondCore/EcalPlugins/plugins/ESIntercalibConstants_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/ESIntercalibConstants_PayloadInspector.cc @@ -112,13 +112,12 @@ namespace { /************************************************************************ 2d plot of ES channel status difference between 2 IOVs ************************************************************************/ - class ESIntercalibConstantsDiff : public cond::payloadInspector::PlotImage { + template + class ESIntercalibConstantsDiffBase : public cond::payloadInspector::PlotImage { public: - ESIntercalibConstantsDiff() - : cond::payloadInspector::PlotImage("ES IntercalibConstants difference") { - setSingleIov(false); - } - bool fill(const std::vector >& iovs) override { + ESIntercalibConstantsDiffBase() + : cond::payloadInspector::PlotImage("ES IntercalibConstants difference") {} + bool fill() override { TH2F*** esmap = new TH2F**[2]; std::string title[2][2] = {{"ES+F", "ES-F"}, {"ES+R", "ES-R"}}; for (int plane = 0; plane < 2; plane++) { @@ -127,12 +126,30 @@ namespace { esmap[plane][side] = new TH2F( Form("esmap%i%i", plane, side), title[plane][side].c_str(), IX_MAX, 0, IX_MAX, IY_MAX, 0, IY_MAX); } - unsigned int run[2], irun = 0; + unsigned int run[2]; + std::string l_tagname[2]; float val[kESChannels], valmin = 999.; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - // std::cout << " irun " << irun << " IOV " << run[irun] << std::endl; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { for (int id = 0; id < kESChannels; id++) // looping over all the ES channels if (ESDetId::validHashIndex(id)) { @@ -165,8 +182,7 @@ namespace { } // 2nd IOV } // validHashIndex } // payload - irun++; - } // loop over IOVs + } // loop over IOVs gStyle->SetOptStat(0); gStyle->SetPalette(1); @@ -174,10 +190,15 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("ES Intercalib Constants, IOV %i - %i", run[1], run[0])); - t1.SetTextSize(0.025); - + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 58) { + t1.SetTextSize(0.025); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("ES Intercalib Constants, IOV %i - %i", run[1], run[0])); + } float xmi[2] = {0.0, 0.5}; float xma[2] = {0.5, 1.0}; TPad*** pad = new TPad**[2]; @@ -203,15 +224,19 @@ namespace { } } - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class ESIntercalibConstantsDiffBase + using ESIntercalibConstantsDiffOneTag = ESIntercalibConstantsDiffBase; + using ESIntercalibConstantsDiffTwoTags = ESIntercalibConstantsDiffBase; + } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(ESIntercalibConstants) { PAYLOAD_INSPECTOR_CLASS(ESIntercalibConstantsPlot); - PAYLOAD_INSPECTOR_CLASS(ESIntercalibConstantsDiff); + PAYLOAD_INSPECTOR_CLASS(ESIntercalibConstantsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(ESIntercalibConstantsDiffTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalAlignment_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalAlignment_PayloadInspector.cc index af6db7749f596..58251537869de 100644 --- a/CondCore/EcalPlugins/plugins/EcalAlignment_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalAlignment_PayloadInspector.cc @@ -122,24 +122,44 @@ namespace { }; /********************************************************* - 2d plot of ECAL Alignment difference between 2 IOVs - **********************************************************/ - class EcalAlignmentDiff : public cond::payloadInspector::PlotImage { + 2d plot of ECAL Alignment difference between 2 IOVs + **********************************************************/ + template + class EcalAlignmentDiffBase : public cond::payloadInspector::PlotImage { public: - EcalAlignmentDiff() : cond::payloadInspector::PlotImage("ECAL Alignment difference") { - setSingleIov(false); - } + EcalAlignmentDiffBase() + : cond::payloadInspector::PlotImage("ECAL Alignment difference") {} - bool fill(const std::vector >& iovs) override { - unsigned int run[2], irun = 0; + bool fill() override { + unsigned int run[2]; float val[6][36]; TH2F* align = new TH2F("", "", 1, 0., 1., 1, 0., 1.); // pseudo creation std::string subdet; int NbRows = 0; + std::string l_tagname[2]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { NbRows = (*payload).m_align.size(); @@ -190,7 +210,6 @@ namespace { } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -199,10 +218,16 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); t1.SetTextColor(2); - t1.DrawLatex(0.5, 0.96, Form("Ecal %s Alignment, IOV %i - %i", subdet.c_str(), run[1], run[0])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 58) { + t1.SetTextSize(0.025); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal %s Alignment, IOV %i - %i", subdet.c_str(), run[1], run[0])); + } TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); pad->Draw(); pad->cd(); @@ -228,16 +253,19 @@ namespace { align->GetYaxis()->SetTickLength(0.); align->GetYaxis()->SetLabelSize(0.); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalAlignmentDiffBase + using EcalAlignmentDiffOneTag = EcalAlignmentDiffBase; + using EcalAlignmentDiffTwoTags = EcalAlignmentDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalAlignment) { PAYLOAD_INSPECTOR_CLASS(EcalAlignmentPlot); - PAYLOAD_INSPECTOR_CLASS(EcalAlignmentDiff); + PAYLOAD_INSPECTOR_CLASS(EcalAlignmentDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalAlignmentDiffTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalChannelStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalChannelStatus_PayloadInspector.cc index 45691dfd60369..95d96559db105 100644 --- a/CondCore/EcalPlugins/plugins/EcalChannelStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalChannelStatus_PayloadInspector.cc @@ -388,18 +388,17 @@ namespace { ebmap_coarse->Draw("text,same"); int len = l_tagname[0].length() + l_tagname[1].length(); - if (ntags == 2 && len < 60) { - t1.SetTextSize(0.03); - t1.DrawLatex(0.5, - 0.96, - Form("EB Channel Status Masks (Diff), %s IOV %i - %s IOV %i", - l_tagname[1].c_str(), - run[1], - l_tagname[0].c_str(), - run[0])); + if (ntags == 2) { + if (len < 60) { + t1.SetTextSize(0.03); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("EB Channel Status Masks (Diff), IOV %i - IOV %i", run[1], run[0])); } else { t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("EB Channel Status Masks (Diff), IOV: %i vs %i", run[0], run[1])); + t1.DrawLatex(0.5, 0.96, Form("%s IOV: %i - %i", l_tagname[0].c_str(), run[1], run[0])); } char txt[80]; @@ -560,18 +559,18 @@ namespace { t1.SetTextColor(1); int len = l_tagname[0].length() + l_tagname[1].length(); - if (ntags == 2 && len < 60) { - t1.SetTextSize(0.03); - t1.DrawLatex(0.5, - 0.96, - Form("EE Channel Status Masks (Diff), %s IOV %i - %s IOV %i", - l_tagname[1].c_str(), - run[1], - l_tagname[0].c_str(), - run[0])); + if (ntags == 2) { + if (len < 60) { + t1.SetTextSize(0.03); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("EE Channel Status Masks (Diff), IOV %i - IOV %i", run[1], run[0])); + } } else { t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("EE Channel Status Masks (Diff), IOV %i vs %i", run[0], run[1])); + t1.DrawLatex(0.5, 0.96, Form("%s IOV: %i - %i", l_tagname[0].c_str(), run[1], run[0])); } char txt[80]; @@ -592,9 +591,9 @@ namespace { using EcalChannelStatusEEDiffOneTag = EcalChannelStatusEEDiffBase; using EcalChannelStatusEEDiffTwoTags = EcalChannelStatusEEDiffBase; - /***************************************** - 2d plot of EcalChannelStatus Error Summary of 1 IOV - ******************************************/ + /******************************************************** + 2d plot of EcalChannelStatus Error Summary of 1 IOV + ********************************************************/ class EcalChannelStatusSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalChannelStatusSummaryPlot() diff --git a/CondCore/EcalPlugins/plugins/EcalDQMChannelStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalDQMChannelStatus_PayloadInspector.cc index a8b2d977c8661..13f0116bc67c3 100644 --- a/CondCore/EcalPlugins/plugins/EcalDQMChannelStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalDQMChannelStatus_PayloadInspector.cc @@ -22,8 +22,8 @@ namespace { enum { IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100 }; // endcaps lower and upper bounds on x and y /******************************************************* - 2d plot of ECAL barrel DQM channel status of 1 IOV - *******************************************************/ + 2d plot of ECAL barrel DQM channel status of 1 IOV + *******************************************************/ class EcalDQMChannelStatusEBMap : public cond::payloadInspector::PlotImage { public: EcalDQMChannelStatusEBMap() @@ -135,8 +135,8 @@ namespace { }; /******************************************************* - 2d plot of ECAL Endcap DQM channel status of 1 IOV -*******************************************************/ + 2d plot of ECAL Endcap DQM channel status of 1 IOV + *******************************************************/ class EcalDQMChannelStatusEEMap : public cond::payloadInspector::PlotImage { public: EcalDQMChannelStatusEEMap() @@ -281,27 +281,44 @@ namespace { /********************************************************************** 2d plot of ECAL barrel DQM channel status difference between 2 IOVs -***********************************************************************/ - class EcalDQMChannelStatusEBDiff : public cond::payloadInspector::PlotImage { + ***********************************************************************/ + template + class EcalDQMChannelStatusEBDiffBase : public cond::payloadInspector::PlotImage { public: - EcalDQMChannelStatusEBDiff() - : cond::payloadInspector::PlotImage("ECAL Barrel DQM channel status difference") { - setSingleIov(false); - } - bool fill(const std::vector > &iovs) override { + EcalDQMChannelStatusEBDiffBase() + : cond::payloadInspector::PlotImage( + "ECAL Barrel DQM channel status difference") {} + bool fill() override { TH2F *ebmap = new TH2F("ebmap", "", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F *ebmap_coarse = new TH2F("ebmap_coarse", "", MAX_IPHI / 20, 0, MAX_IPHI, 2, -MAX_IETA, MAX_IETA); Int_t ebcount = 0; - unsigned int run[2], irun = 0, status[kEBChannels]; - for (auto const &iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); + unsigned int run[2], status[kEBChannels]; + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { // looping over the EB channels, via the dense-index, mapped into EBDetId's if (payload->barrelItems().empty()) return false; - - run[irun] = std::get<0>(iov); - for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) { uint32_t rawid = EBDetId::unhashIndex(cellid); // check the existence of ECAL channel status, for a given ECAL barrel channel @@ -333,8 +350,7 @@ namespace { } } } // loop over cellid - irun++; - } // if payload.get() + } // if payload.get() else return false; } // loop over IOV's @@ -386,40 +402,67 @@ namespace { ebmap_coarse->SetMarkerSize(1.3); ebmap_coarse->Draw("text,same"); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("EB DQM Channel Status (Diff), IOV: %i vs %i", run[0], run[1])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 58) { + t1.SetTextSize(0.025); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("EB DQM Channel Status (Diff), IOV: %i vs %i", run[0], run[1])); + } char txt[80]; sprintf(txt, "Net difference: %d channel(s)", ebcount); t1.SetTextColor(2); t1.SetTextSize(0.045); t1.DrawLatex(0.5, 0.91, txt); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); c1.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalDQMChannelStatusEBDiffBase + using EcalDQMChannelStatusEBDiffOneTag = EcalDQMChannelStatusEBDiffBase; + using EcalDQMChannelStatusEBDiffTwoTags = EcalDQMChannelStatusEBDiffBase; /************************************************************************ 2d plot of ECAL endcaps DQM channel status difference between 2 IOVs - ************************************************************************/ - class EcalDQMChannelStatusEEDiff : public cond::payloadInspector::PlotImage { + ************************************************************************/ + template + class EcalDQMChannelStatusEEDiffBase : public cond::payloadInspector::PlotImage { public: - EcalDQMChannelStatusEEDiff() - : cond::payloadInspector::PlotImage("ECAL Endcaps DQM channel status difference") { - setSingleIov(true); - } + EcalDQMChannelStatusEEDiffBase() + : cond::payloadInspector::PlotImage( + "ECAL Endcaps DQM channel status difference") {} - bool fill(const std::vector > &iovs) override { + bool fill() override { TH2F *eemap = new TH2F("eemap", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX); TH2F *eemap_coarse = new TH2F("eemap_coarse", "", 2, 0, 2 * IX_MAX, 1, 0, IY_MAX); TH2F *eetemp = new TH2F("eetemp", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX); Int_t eecount = 0; - unsigned int run[2], irun = 0, status[kEEChannels]; - for (auto const &iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + unsigned int run[2], status[kEEChannels]; + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->endcapItems().empty()) return false; @@ -459,9 +502,8 @@ namespace { } // any difference ? } // 2nd IOV, fill the plots } // validDetId - irun++; - } // get the payload - } // loop over payloads + } // get the payload + } // loop over payloads gStyle->SetOptStat(0); //set the background color to white @@ -528,9 +570,15 @@ namespace { eemap_coarse->Draw("same,text"); t1.SetTextColor(1); - t1.SetTextSize(0.055); - t1.DrawLatex(0.5, 0.96, Form("EE DQM Channel Status (Diff), IOV %i vs %i", run[0], run[1])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 58) { + t1.SetTextSize(0.025); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.055); + t1.DrawLatex(0.5, 0.96, Form("EE DQM Channel Status (Diff), IOV %i vs %i", run[0], run[1])); + } char txt[80]; sprintf(txt, "Net difference: %d channel(s)", eecount); t1.SetTextColor(2); @@ -541,11 +589,13 @@ namespace { t1.DrawLatex(0.14, 0.84, "EE-"); t1.DrawLatex(0.86, 0.84, "EE+"); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); c1.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalDQMChannelStatusEEDiffBase + using EcalDQMChannelStatusEEDiffOneTag = EcalDQMChannelStatusEEDiffBase; + using EcalDQMChannelStatusEEDiffTwoTags = EcalDQMChannelStatusEEDiffBase; } // namespace @@ -553,6 +603,8 @@ namespace { PAYLOAD_INSPECTOR_MODULE(EcalDQMChannelStatus) { PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBMap); PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEMap); - PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiff); - PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiff); -} \ No newline at end of file + PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiffTwoTags); +} diff --git a/CondCore/EcalPlugins/plugins/EcalDQMTowerStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalDQMTowerStatus_PayloadInspector.cc index 6741a2d02c9db..5eaee06035cc2 100644 --- a/CondCore/EcalPlugins/plugins/EcalDQMTowerStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalDQMTowerStatus_PayloadInspector.cc @@ -126,28 +126,44 @@ namespace { } // fill method }; - /*********************************************** + /*************************************************** 2d plot of EcalDQMTowerStatus Diff between 2 IOV -************************************************/ - class EcalDQMTowerStatusDiffPlot : public cond::payloadInspector::PlotImage { + ****************************************************/ + template + class EcalDQMTowerStatusDiffBase : public cond::payloadInspector::PlotImage { public: - EcalDQMTowerStatusDiffPlot() - : cond::payloadInspector::PlotImage("EcalDQMTowerStatusDiff - map ") { - setSingleIov(false); - } - - bool fill(const std::vector >& iovs) override { + EcalDQMTowerStatusDiffBase() + : cond::payloadInspector::PlotImage("EcalDQMTowerStatusDiff - map ") {} + bool fill() override { TH2F* barrel = new TH2F("EB", "EB DQM Tower Status", 72, 0, 72, 34, -17, 17); TH2F* endc_p = new TH2F("EE+", "EE+ DQM Tower Status", 22, 0, 22, 22, 0, 22); TH2F* endc_m = new TH2F("EE-", "EE- DQM Tower Status", 22, 0, 22, 22, 0, 22); - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBTotalTowers], pEE[kEETotalTowers]; - - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { for (uint cellid = 0; cellid < EcalTrigTowerDetId::kEBTotalTowers; ++cellid) { if (payload->barrelItems().empty()) @@ -215,18 +231,22 @@ namespace { } } } - } // payload - irun++; } TCanvas canvas("CC map", "CC map", 800, 800); TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.04); - t1.DrawLatex(0.5, 0.96, Form("Ecal DQM Tower Status (Diff), IOV %i vs %i", run[0], run[1])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 58) { + t1.SetTextSize(0.025); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.04); + t1.DrawLatex(0.5, 0.96, Form("Ecal DQM Tower Status (Diff), IOV %i vs %i", run[0], run[1])); + } TPad* padb = new TPad("padb", "padb", 0., 0.45, 1., 0.9); padb->Draw(); TPad* padem = new TPad("padem", "padem", 0., 0., 0.45, 0.45); @@ -257,16 +277,19 @@ namespace { padep->cd(); DrawEE_Tower(endc_p, l, 0, 1.15); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalDQMTowerStatusDiffBase + using EcalDQMTowerStatusDiffOneTag = EcalDQMTowerStatusDiffBase; + using EcalDQMTowerStatusDiffTwoTags = EcalDQMTowerStatusDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalDQMTowerStatus) { PAYLOAD_INSPECTOR_CLASS(EcalDQMTowerStatusPlot); - PAYLOAD_INSPECTOR_CLASS(EcalDQMTowerStatusDiffPlot); -} \ No newline at end of file + PAYLOAD_INSPECTOR_CLASS(EcalDQMTowerStatusDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalDQMTowerStatusDiffTwoTags); +} diff --git a/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainerUtils.h b/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainerUtils.h index 6ac667ddc0148..a1068a5a7bfe8 100644 --- a/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainerUtils.h +++ b/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainerUtils.h @@ -66,8 +66,13 @@ void fillEEMap_SingleIOV(std::shared_ptr payload, TH2F*& endc_m, T } template -void fillEBMap_DiffIOV( - std::shared_ptr payload, TH2F*& barrel, int irun, float pEB[], float& pEBmin, float& pEBmax) { +void fillEBMap_TwoIOVs(std::shared_ptr payload, + TH2F*& barrel, + int irun, + float pEB[], + float& pEBmin, + float& pEBmax, + int method) { for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) { uint32_t rawid = EBDetId::unhashIndex(cellid); EcalCondObjectContainer::const_iterator value_ptr = payload->find(rawid); @@ -85,28 +90,38 @@ void fillEBMap_DiffIOV( eta = eta - 0.5; // 0.5 to 84.5 else eta = eta + 0.5; // -84.5 to -0.5 - - double diff = weight - pEB[cellid]; - - if (diff < pEBmin) - pEBmin = diff; - if (diff > pEBmax) - pEBmax = diff; - - barrel->Fill(phi, eta, diff); + double dr; + if (method == 0) { + dr = weight - pEB[cellid]; + } // diff + else { + if (pEB[cellid] != 0.) + dr = weight / pEB[cellid]; + else { + if (weight == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } + } // ratio + if (dr < pEBmin) + pEBmin = dr; + if (dr > pEBmax) + pEBmax = dr; + barrel->Fill(phi, eta, dr); } - } // loop over cellid } template -void fillEEMap_DiffIOV(std::shared_ptr payload, +void fillEEMap_TwoIOVs(std::shared_ptr payload, TH2F*& endc_m, TH2F*& endc_p, int irun, float pEE[], float& pEEmin, - float& pEEmax) { + float& pEEmax, + int method) { // looping over the EE channels for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1 for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++) @@ -124,16 +139,28 @@ void fillEEMap_DiffIOV(std::shared_ptr payload, if (irun == 0) pEE[cellid] = weight; else { - double diff = weight - pEE[cellid]; - if (diff < pEEmin) - pEEmin = diff; - - if (diff > pEEmax) - pEEmax = diff; + double dr; + if (method == 0) { + dr = weight - pEE[cellid]; + } // diff + else { + if (pEE[cellid] != 0.) + dr = weight / pEE[cellid]; + else { + if (weight == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } + } // ratio + if (dr < pEEmin) + pEEmin = dr; + if (dr > pEEmax) + pEEmax = dr; if (iz == 1) - endc_p->Fill(ix, iy, diff); + endc_p->Fill(ix, iy, dr); else - endc_m->Fill(ix, iy, diff); + endc_m->Fill(ix, iy, dr); } } // validDetId @@ -168,4 +195,4 @@ void fillTableWithSummary(TH2F*& align, align->GetXaxis()->SetLabelSize(0.); align->GetYaxis()->SetTickLength(0.); align->GetYaxis()->SetLabelSize(0.); -} \ No newline at end of file +} diff --git a/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc index 2a71898fb9dec..812443274bdf4 100644 --- a/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalFloatCondObjectContainer_PayloadInspector.cc @@ -131,26 +131,45 @@ namespace { /************************************************************************ 2d plot of ECAL FloatCondObjectContainer difference between 2 IOVs ************************************************************************/ - class EcalFloatCondObjectContainerDiff : public cond::payloadInspector::PlotImage { + template + class EcalFloatCondObjectContainerDiffBase + : public cond::payloadInspector::PlotImage { public: - EcalFloatCondObjectContainerDiff() - : cond::payloadInspector::PlotImage("ECAL FloatCondObjectContainer difference") { - setSingleIov(false); - } + EcalFloatCondObjectContainerDiffBase() + : cond::payloadInspector::PlotImage( + "ECAL FloatCondObjectContainer difference") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "EB difference", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "EE+ difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "EE- difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); double EBmean = 0., EBrms = 0., EEmean = 0., EErms = 0.; int EBtot = 0, EEtot = 0; - // unsigned int run[2] = {0, 0}, irun = 0; - unsigned int run[2], irun = 0; + unsigned int run[2]; float vEB[kEBChannels], vEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { for (int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) { Double_t eta = (Double_t)ieta; @@ -205,7 +224,6 @@ namespace { } // payload else return false; - irun++; } // loop over IOVs double vt = (double)EBtot; @@ -233,9 +251,15 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal FloatCondObjectContainer, IOV %i - %i", run[1], run[0])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 150) { + t1.SetTextSize(0.04); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; TPad** pad = new TPad*; @@ -251,16 +275,20 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; - + }; // class EcalFloatCondObjectContainerDiffBase + using EcalFloatCondObjectContainerDiffOneTag = + EcalFloatCondObjectContainerDiffBase; + using EcalFloatCondObjectContainerDiffTwoTags = + EcalFloatCondObjectContainerDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalFloatCondObjectContainer) { PAYLOAD_INSPECTOR_CLASS(EcalFloatCondObjectContainerPlot); - PAYLOAD_INSPECTOR_CLASS(EcalFloatCondObjectContainerDiff); + PAYLOAD_INSPECTOR_CLASS(EcalFloatCondObjectContainerDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalFloatCondObjectContainerDiffTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalGainRatios_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalGainRatios_PayloadInspector.cc index 01a2a0ad64fbf..b4ba47864b8d6 100644 --- a/CondCore/EcalPlugins/plugins/EcalGainRatios_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalGainRatios_PayloadInspector.cc @@ -167,13 +167,13 @@ namespace { /********************************************************** 2d plot of ECAL GainRatios difference between 2 IOVs **********************************************************/ - class EcalGainRatiosDiff : public cond::payloadInspector::PlotImage { + template + class EcalGainRatiosDiffBase : public cond::payloadInspector::PlotImage { public: - EcalGainRatiosDiff() : cond::payloadInspector::PlotImage("ECAL Gain Ratios difference") { - setSingleIov(false); - } + EcalGainRatiosDiffBase() + : cond::payloadInspector::PlotImage("ECAL Gain Ratios difference") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel_12O6 = new TH2F("EB_12O6", "EB gain 12/6 difference", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p_12O6 = @@ -191,11 +191,30 @@ namespace { TH1F* b_6O1 = new TH1F("b_6O1", "EB gain 6/1 difference", 100, -0.1, 0.1); TH1F* e_6O1 = new TH1F("e_6O1", "EE gain 6/1 difference", 100, -0.1, 0.1); - unsigned int run[2], irun = 0; + unsigned int run[2]; float gEB[3][kEBChannels], gEE[3][kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { // looping over the EB channels, via the dense-index, mapped into EBDetId's for (int cellid = 0; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) { // loop on EB cells @@ -245,7 +264,6 @@ namespace { } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -254,8 +272,15 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Gain Ratios, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2 && len < 70) { + t1.SetTextSize(0.03); + t1.DrawLatex( + 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); + } float xmi[3] = {0.0, 0.22, 0.78}; float xma[3] = {0.22, 0.78, 1.00}; @@ -323,15 +348,19 @@ namespace { st->SetX1NDC(0.6); //new x start position st->SetY1NDC(0.75); //new y start position - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalGainRatiosDiffBase + using EcalGainRatiosDiffOneTag = EcalGainRatiosDiffBase; + using EcalGainRatiosDiffTwoTags = EcalGainRatiosDiffBase; + } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalGainRatios) { PAYLOAD_INSPECTOR_CLASS(EcalGainRatiosPlot); - PAYLOAD_INSPECTOR_CLASS(EcalGainRatiosDiff); + PAYLOAD_INSPECTOR_CLASS(EcalGainRatiosDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalGainRatiosDiffTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc index a45c72415033a..9705da5a95933 100644 --- a/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalIntercalibConstantsMC_PayloadInspector.cc @@ -216,17 +216,18 @@ namespace { } // fill method }; - /***************************************************************** + /******************************************************************* 2d plot of ECAL IntercalibConstantsMC difference between 2 IOVs - *****************************************************************/ - class EcalIntercalibConstantsMCDiff : public cond::payloadInspector::PlotImage { + *******************************************************************/ + template + class EcalIntercalibConstantsMCBase + : public cond::payloadInspector::PlotImage { public: - EcalIntercalibConstantsMCDiff() - : cond::payloadInspector::PlotImage("ECAL Intercalib Constants MC difference ") { - setSingleIov(false); - } + EcalIntercalibConstantsMCBase() + : cond::payloadInspector::PlotImage( + "ECAL Intercalib Constants MC comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -236,27 +237,43 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -264,8 +281,27 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.04); - t1.DrawLatex(0.5, 0.96, Form("Ecal IntercalibConstants MC Diff, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 170) { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal IntercalibConstantsMC, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; @@ -283,15 +319,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; - - /******************************************************* - 2d plot of Ecal Intercalib Constants MC Summary of 1 IOV - *******************************************************/ + }; // class EcalIntercalibConstantsMCDiffBase + using EcalIntercalibConstantsMCDiffOneTag = EcalIntercalibConstantsMCBase; + using EcalIntercalibConstantsMCDiffTwoTags = EcalIntercalibConstantsMCBase; + using EcalIntercalibConstantsMCRatioOneTag = EcalIntercalibConstantsMCBase; + using EcalIntercalibConstantsMCRatioTwoTags = EcalIntercalibConstantsMCBase; + + /*********************************************************** + 2d plot of Ecal Intercalib Constants MC Summary of 1 IOV + ***********************************************************/ class EcalIntercalibConstantsMCSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalIntercalibConstantsMCSummaryPlot() @@ -357,6 +397,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalIntercalibConstantsMC) { PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCEBMap); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCEEMap); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCPlot); - PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCDiff); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsMCSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc index 7c84831560186..8f7603f320efa 100644 --- a/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalIntercalibConstants_PayloadInspector.cc @@ -34,11 +34,9 @@ namespace { EEhistXMax = 220 }; // endcaps lower and upper bounds on x and y - /******************************************************* - + /************************************************************** 2d histogram of ECAL barrel Intercalib Constants of 1 IOV - - *******************************************************/ + ***************************************************************/ // inherit from one of the predefined plot class: Histogram2D class EcalIntercalibConstantsEBMap : public cond::payloadInspector::Histogram2D { @@ -204,17 +202,17 @@ namespace { } // fill method }; - /***************************************************************** - 2d plot of ECAL IntercalibConstants difference between 2 IOVs - *****************************************************************/ - class EcalIntercalibConstantsDiff : public cond::payloadInspector::PlotImage { + /************************************************************************** + 2d plot of ECAL IntercalibConstants difference or ratio between 2 IOVs + ***************************************************************************/ + template + class EcalIntercalibConstantsBase : public cond::payloadInspector::PlotImage { public: - EcalIntercalibConstantsDiff() - : cond::payloadInspector::PlotImage("ECAL Intercalib Constants difference ") { - setSingleIov(false); - } + EcalIntercalibConstantsBase() + : cond::payloadInspector::PlotImage( + "ECAL Intercalib Constants comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -224,27 +222,40 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); - + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -252,9 +263,27 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal IntercalibConstants, IOV %i - %i", run[1], run[0])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 170) { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal IntercalibConstants, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; TPad** pad = new TPad*; @@ -269,15 +298,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; - - /******************************************************* - 2d plot of Ecal Intercalib Constants Summary of 1 IOV - *******************************************************/ + }; // class EcalIntercalibConstantsDiffBase + using EcalIntercalibConstantsDiffOneTag = EcalIntercalibConstantsBase; + using EcalIntercalibConstantsDiffTwoTags = EcalIntercalibConstantsBase; + using EcalIntercalibConstantsRatioOneTag = EcalIntercalibConstantsBase; + using EcalIntercalibConstantsRatioTwoTags = EcalIntercalibConstantsBase; + + /********************************************************* + 2d plot of Ecal Intercalib Constants Summary of 1 IOV + *********************************************************/ class EcalIntercalibConstantsSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalIntercalibConstantsSummaryPlot() @@ -344,6 +377,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalIntercalibConstants) { PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsEBMap); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsEEMap); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibConstantsSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc index 32c47623eae6d..612a6e86fb1d5 100644 --- a/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalIntercalibErrors_PayloadInspector.cc @@ -91,12 +91,9 @@ namespace { } //fill method }; - /******************************************************* - + /************************************************************* 2d histogram of ECAL EndCaps Intercalib Errors of 1 IOV - - *******************************************************/ - + *************************************************************/ class EcalIntercalibErrorsEEMap : public cond::payloadInspector::Histogram2D { private: int EEhistSplit = 20; @@ -218,14 +215,13 @@ namespace { /***************************************************************** 2d plot of ECAL Intercalib Errors difference between 2 IOVs *****************************************************************/ - class EcalIntercalibErrorsDiff : public cond::payloadInspector::PlotImage { + template + class EcalIntercalibErrorsBase : public cond::payloadInspector::PlotImage { public: - EcalIntercalibErrorsDiff() - : cond::payloadInspector::PlotImage("ECAL Intercalib Error difference ") { - setSingleIov(false); - } + EcalIntercalibErrorsBase() + : cond::payloadInspector::PlotImage("ECAL Intercalib Error comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "Intercalib Error EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "Intercalib Error EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "Intercalib Error EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -235,26 +231,39 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); - + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); - + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -262,8 +271,27 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Intercalib Errors Diff, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 170) { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal IntercalibErrorss, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; @@ -281,15 +309,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalIntercalibErrorsDiffBase + using EcalIntercalibErrorsDiffOneTag = EcalIntercalibErrorsBase; + using EcalIntercalibErrorsDiffTwoTags = EcalIntercalibErrorsBase; + using EcalIntercalibErrorsRatioOneTag = EcalIntercalibErrorsBase; + using EcalIntercalibErrorsRatioTwoTags = EcalIntercalibErrorsBase; /******************************************************* - 2d plot of Ecal Intercalib Errors Summary of 1 IOV - *******************************************************/ + 2d plot of Ecal Intercalib Errors Summary of 1 IOV + *******************************************************/ class EcalIntercalibErrorsSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalIntercalibErrorsSummaryPlot() @@ -354,6 +386,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalIntercalibErrors) { PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsEBMap); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsEEMap); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalIntercalibErrorsSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc index cb44f819736d2..9ae8a5cb993d3 100644 --- a/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatiosRef_PayloadInspector.cc @@ -34,11 +34,9 @@ namespace { EEhistXMax = 220 }; // endcaps lower and upper bounds on x and y - /******************************************************* - + /**************************************************************** 2d histogram of ECAL barrel Laser APDPN Ratios Ref of 1 IOV - - *******************************************************/ + *****************************************************************/ // inherit from one of the predefined plot class: Histogram2D class EcalLaserAPDPNRatiosRefEBMap : public cond::payloadInspector::Histogram2D { @@ -90,12 +88,9 @@ namespace { } //fill method }; - /******************************************************* - + /**************************************************************** 2d histogram of ECAL EndCaps Laser APDPN Ratios Ref of 1 IOV - - *******************************************************/ - + ****************************************************************/ class EcalLaserAPDPNRatiosRefEEMap : public cond::payloadInspector::Histogram2D { private: int EEhistSplit = 20; @@ -149,9 +144,9 @@ namespace { } // fill method }; - /************************************************* + /**************************************************** 2d plot of Ecal Laser APDPN Ratios Ref of 1 IOV - *************************************************/ + ****************************************************/ class EcalLaserAPDPNRatiosRefPlot : public cond::payloadInspector::PlotImage { public: EcalLaserAPDPNRatiosRefPlot() @@ -217,17 +212,17 @@ namespace { } // fill method }; - /***************************************************************** + /******************************************************************** 2d plot of Ecal Laser APDPN Ratios Ref difference between 2 IOVs - *****************************************************************/ - class EcalLaserAPDPNRatiosRefDiff : public cond::payloadInspector::PlotImage { + ********************************************************************/ + template + class EcalLaserAPDPNRatiosRefBase : public cond::payloadInspector::PlotImage { public: - EcalLaserAPDPNRatiosRefDiff() - : cond::payloadInspector::PlotImage("Ecal Laser APDPN Ratios Ref difference ") { - setSingleIov(false); - } + EcalLaserAPDPNRatiosRefBase() + : cond::payloadInspector::PlotImage( + "Ecal Laser APDPN Ratios Ref difference ") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "Laser APDPN Ratios Ref EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = @@ -240,27 +235,38 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; + std::string l_tagname[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { - if (payload->barrelItems().empty()) - return false; - - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); - - if (payload->endcapItems().empty()) - return false; - - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); - + if (!payload->barrelItems().empty()) + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); + if (!payload->endcapItems().empty()) + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -287,15 +293,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method }; - - /******************************************************* - 2d plot of Ecal Laser APDPN Ratios Ref Summary of 1 IOV - *******************************************************/ + using EcalLaserAPDPNRatiosRefDiffOneTag = EcalLaserAPDPNRatiosRefBase; + using EcalLaserAPDPNRatiosRefDiffTwoTags = EcalLaserAPDPNRatiosRefBase; + using EcalLaserAPDPNRatiosRefRatioOneTag = EcalLaserAPDPNRatiosRefBase; + using EcalLaserAPDPNRatiosRefRatioTwoTags = EcalLaserAPDPNRatiosRefBase; + + /********************************************************** + 2d plot of Ecal Laser APDPN Ratios Ref Summary of 1 IOV + **********************************************************/ class EcalLaserAPDPNRatiosRefSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalLaserAPDPNRatiosRefSummaryPlot() @@ -361,6 +371,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalLaserAPDPNRatiosRef) { PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefEBMap); PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefEEMap); PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefPlot); - PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefDiff); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRefSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatios_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatios_PayloadInspector.cc index 1a5643700954b..8a105b9208f0d 100644 --- a/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatios_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalLaserAPDPNRatios_PayloadInspector.cc @@ -272,19 +272,17 @@ namespace { /***************************************************************** 2d plot of ECAL IntercalibConstants difference between 2 IOVs ******************************************************************/ - class EcalLaserAPDPNRatiosDiff : public cond::payloadInspector::PlotImage { + template + class EcalLaserAPDPNRatiosBase : public cond::payloadInspector::PlotImage { public: - EcalLaserAPDPNRatiosDiff() - : cond::payloadInspector::PlotImage("ECAL Laser APDPNRatios difference") { - setSingleIov(false); - } + EcalLaserAPDPNRatiosBase() + : cond::payloadInspector::PlotImage("ECAL Laser APDPNRatios difference") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F** barrel = new TH2F*[3]; TH2F** endc_p = new TH2F*[3]; TH2F** endc_m = new TH2F*[3]; float pEBmin[3], pEEmin[3], pEBmax[3], pEEmax[3]; - for (int i = 0; i < 3; i++) { barrel[i] = new TH2F(Form("EBp%i", i), Form("EB p%i", i + 1), MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); @@ -297,16 +295,40 @@ namespace { pEBmax[i] = -10.; pEEmax[i] = -10.; } - unsigned int run[2] = {0, 0}, irun = 0; + unsigned int run[2] = {0, 0}; + std::string l_tagname[2]; unsigned long IOV = 0; float pEB[3][kEBChannels], pEE[3][kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - IOV = std::get<0>(iov); - if (IOV < 4294967296) - run[irun] = std::get<0>(iov); - else // time type IOV - run[irun] = IOV >> 32; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + IOV = std::get<0>(firstiov); + if (IOV < 4294967296) + run[0] = std::get<0>(firstiov); + else // time type IOV + run[0] = IOV >> 32; + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + IOV = std::get<0>(lastiov); + if (IOV < 4294967296) + run[1] = std::get<0>(lastiov); + else // time type IOV + run[1] = IOV >> 32; + + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { // looping over the EB channels, via the dense-index, mapped into EBDetId's for (int cellid = 0; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) { // loop on EB cells @@ -322,24 +344,55 @@ namespace { eta = eta - 0.5; // 0.5 to 84.5 else eta = eta + 0.5; // -84.5 to -0.5 - double diff = (payload->getLaserMap())[rawid].p1 - pEB[0][cellid]; - if (diff < pEBmin[0]) - pEBmin[0] = diff; - if (diff > pEBmax[0]) - pEBmax[0] = diff; - barrel[0]->Fill(phi, eta, diff); - diff = (payload->getLaserMap())[rawid].p2 - pEB[1][cellid]; - if (diff < pEBmin[1]) - pEBmin[1] = diff; - if (diff > pEBmax[1]) - pEBmax[1] = diff; - barrel[1]->Fill(phi, eta, diff); - diff = (payload->getLaserMap())[rawid].p3 - pEB[2][cellid]; - if (diff < pEBmin[2]) - pEBmin[2] = diff; - if (diff > pEBmax[2]) - pEBmax[2] = diff; - barrel[2]->Fill(phi, eta, diff); + double dr; + if (method == 0) // difference + dr = (payload->getLaserMap())[rawid].p1 - pEB[0][cellid]; + else { // ratio + if (pEB[0][cellid] == 0.) { + if ((payload->getLaserMap())[rawid].p1 == 0.) + dr = 1.; + else + dr = 9999.; //use a large value + } else + dr = (payload->getLaserMap())[rawid].p1 / pEB[0][cellid]; + } + if (dr < pEBmin[0]) + pEBmin[0] = dr; + if (dr > pEBmax[0]) + pEBmax[0] = dr; + barrel[0]->Fill(phi, eta, dr); + if (method == 0) // difference + dr = (payload->getLaserMap())[rawid].p2 - pEB[1][cellid]; + else { // ratio + if (pEB[1][cellid] == 0.) { + if ((payload->getLaserMap())[rawid].p2 == 0.) + dr = 1.; + else + dr = 9999.; //use a large value + } else + dr = (payload->getLaserMap())[rawid].p2 / pEB[1][cellid]; + } + if (dr < pEBmin[1]) + pEBmin[1] = dr; + if (dr > pEBmax[1]) + pEBmax[1] = dr; + barrel[1]->Fill(phi, eta, dr); + if (method == 0) // difference + dr = (payload->getLaserMap())[rawid].p3 - pEB[2][cellid]; + else { // ratio + if (pEB[2][cellid] == 0.) { + if ((payload->getLaserMap())[rawid].p3 == 0.) + dr = 1.; + else + dr = 9999.; //use a large value + } else + dr = (payload->getLaserMap())[rawid].p3 / pEB[2][cellid]; + } + if (dr < pEBmin[2]) + pEBmin[2] = dr; + if (dr > pEBmax[2]) + pEBmax[2] = dr; + barrel[2]->Fill(phi, eta, dr); } } // loop over cellid @@ -354,36 +407,66 @@ namespace { pEE[1][cellid] = (payload->getLaserMap())[rawid].p2; pEE[2][cellid] = (payload->getLaserMap())[rawid].p3; } else { - double diff1 = (payload->getLaserMap())[rawid].p1 - pEE[0][cellid]; - if (diff1 < pEEmin[0]) - pEEmin[0] = diff1; - if (diff1 > pEEmax[0]) - pEEmax[0] = diff1; - double diff2 = (payload->getLaserMap())[rawid].p2 - pEE[1][cellid]; - if (diff2 < pEEmin[1]) - pEEmin[1] = diff2; - if (diff2 > pEEmax[1]) - pEEmax[1] = diff2; - double diff3 = (payload->getLaserMap())[rawid].p3 - pEE[2][cellid]; - if (diff3 < pEEmin[2]) - pEEmin[2] = diff3; - if (diff3 > pEEmax[2]) - pEEmax[2] = diff3; + double dr1, dr2, dr3; + if (method == 0) // difference + dr1 = (payload->getLaserMap())[rawid].p1 - pEE[0][cellid]; + else { // ratio + if (pEE[0][cellid] == 0.) { + if ((payload->getLaserMap())[rawid].p1 == 0.) + dr1 = 1.; + else + dr1 = 9999.; //use a large value + } else + dr1 = (payload->getLaserMap())[rawid].p1 / pEE[0][cellid]; + } + if (dr1 < pEEmin[0]) + pEEmin[0] = dr1; + if (dr1 > pEEmax[0]) + pEEmax[0] = dr1; + if (method == 0) // difference + dr2 = (payload->getLaserMap())[rawid].p2 - pEE[1][cellid]; + else { // ratio + if (pEE[1][cellid] == 0.) { + if ((payload->getLaserMap())[rawid].p2 == 0.) + dr2 = 1.; + else + dr2 = 9999.; //use a large value + } else + dr2 = (payload->getLaserMap())[rawid].p2 / pEE[1][cellid]; + } + if (dr2 < pEEmin[1]) + pEEmin[1] = dr2; + if (dr2 > pEEmax[1]) + pEEmax[1] = dr2; + if (method == 0) // difference + dr3 = (payload->getLaserMap())[rawid].p3 - pEE[2][cellid]; + else { // ratio + if (pEE[0][cellid] == 0.) { + if ((payload->getLaserMap())[rawid].p3 == 0.) + dr3 = 1.; + else + dr3 = 9999.; //use a large value + } else + dr3 = (payload->getLaserMap())[rawid].p3 / pEE[2][cellid]; + } + if (dr3 < pEEmin[2]) + pEEmin[2] = dr3; + if (dr3 > pEEmax[2]) + pEEmax[2] = dr3; if (myEEId.zside() == 1) { - endc_p[0]->Fill(myEEId.ix(), myEEId.iy(), diff1); - endc_p[1]->Fill(myEEId.ix(), myEEId.iy(), diff2); - endc_p[2]->Fill(myEEId.ix(), myEEId.iy(), diff3); + endc_p[0]->Fill(myEEId.ix(), myEEId.iy(), dr1); + endc_p[1]->Fill(myEEId.ix(), myEEId.iy(), dr2); + endc_p[2]->Fill(myEEId.ix(), myEEId.iy(), dr3); } else { - endc_m[0]->Fill(myEEId.ix(), myEEId.iy(), diff1); - endc_m[1]->Fill(myEEId.ix(), myEEId.iy(), diff2); - endc_m[2]->Fill(myEEId.ix(), myEEId.iy(), diff3); + endc_m[0]->Fill(myEEId.ix(), myEEId.iy(), dr1); + endc_m[1]->Fill(myEEId.ix(), myEEId.iy(), dr2); + endc_m[2]->Fill(myEEId.ix(), myEEId.iy(), dr3); } } } // loop over cellid } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -392,10 +475,28 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; if (IOV < 4294967296) { - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Laser APD/PN, IOV %i - %i", run[1], run[0])); + if (ntags == 2) { + if (len < 80) { + t1.SetTextSize(0.02); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("Ecal LaserAPDPNRatios, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } } else { // time type IOV time_t t = run[0]; char buf0[256], buf1[256]; @@ -407,10 +508,26 @@ namespace { localtime_r(&t, <); strftime(buf1, sizeof(buf1), "%F %R:%S", <); buf1[sizeof(buf1) - 1] = 0; - t1.SetTextSize(0.015); - t1.DrawLatex(0.5, 0.96, Form("Ecal Laser APD/PN, IOV %s - %s", buf1, buf0)); + if (ntags == 2) { + if (len < 80) { + t1.SetTextSize(0.02); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("Ecal LaserAPDPNRatios, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } } - float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; TPad*** pad = new TPad**[3]; @@ -451,11 +568,15 @@ namespace { endc_p[i]->GetZaxis()->SetLabelSize(0.02); } - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalLaserAPDPNRatiosDiffBase + using EcalLaserAPDPNRatiosDiffOneTag = EcalLaserAPDPNRatiosBase; + using EcalLaserAPDPNRatiosDiffTwoTags = EcalLaserAPDPNRatiosBase; + using EcalLaserAPDPNRatiosRatioOneTag = EcalLaserAPDPNRatiosBase; + using EcalLaserAPDPNRatiosRatioTwoTags = EcalLaserAPDPNRatiosBase; } // namespace @@ -464,5 +585,8 @@ PAYLOAD_INSPECTOR_MODULE(EcalLaserAPDPNRatios) { PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosEBMap); PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosEEMap); PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosPlot); - PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosDiff); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAPDPNRatiosRatioTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc index b56d4110b7c2a..a7589dd70fbfa 100644 --- a/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalLaserAlphas_PayloadInspector.cc @@ -35,11 +35,8 @@ namespace { }; // endcaps lower and upper bounds on x and y /******************************************************* - 2d histogram of ECAL barrel Ecal Laser Alphas of 1 IOV - *******************************************************/ - // inherit from one of the predefined plot class: Histogram2D class EcalLaserAlphasEBMap : public cond::payloadInspector::Histogram2D { public: @@ -91,11 +88,8 @@ namespace { }; /******************************************************* - 2d histogram of ECAL EndCaps Laser Alphas of 1 IOV - *******************************************************/ - class EcalLaserAlphasEEMap : public cond::payloadInspector::Histogram2D { private: int EEhistSplit = 20; @@ -149,9 +143,9 @@ namespace { } // fill method }; - /************************************************* + /****************************************** 2d plot of Ecal Laser Alphas of 1 IOV - *************************************************/ + *******************************************/ class EcalLaserAlphasPlot : public cond::payloadInspector::PlotImage { public: EcalLaserAlphasPlot() : cond::payloadInspector::PlotImage("Ecal Laser Alphas - map ") { @@ -216,13 +210,13 @@ namespace { /***************************************************************** 2d plot of Ecal Laser Alphas difference between 2 IOVs *****************************************************************/ - class EcalLaserAlphasDiff : public cond::payloadInspector::PlotImage { + template + class EcalLaserAlphasBase : public cond::payloadInspector::PlotImage { public: - EcalLaserAlphasDiff() : cond::payloadInspector::PlotImage("Ecal Laser Alphas difference ") { - setSingleIov(false); - } + EcalLaserAlphasBase() + : cond::payloadInspector::PlotImage("Ecal Laser Alphas difference ") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "Laser Alphas EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "Laser Alphas EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "Laser Alphas EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -232,27 +226,43 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -260,9 +270,27 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Laser Alphas Diff, IOV %i - %i", run[1], run[0])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 180) { + t1.SetTextSize(0.04); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal Laser Alphas Diff, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; TPad** pad = new TPad*; @@ -279,15 +307,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalLaserAlphasDiffBase + using EcalLaserAlphasDiffOneTag = EcalLaserAlphasBase; + using EcalLaserAlphasDiffTwoTags = EcalLaserAlphasBase; + using EcalLaserAlphasRatioOneTag = EcalLaserAlphasBase; + using EcalLaserAlphasRatioTwoTags = EcalLaserAlphasBase; /******************************************************* - 2d plot of Ecal Laser Alphas Summary of 1 IOV - *******************************************************/ + 2d plot of Ecal Laser Alphas Summary of 1 IOV + *******************************************************/ class EcalLaserAlphasSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalLaserAlphasSummaryPlot() @@ -352,6 +384,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalLaserAlphas) { PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasEBMap); PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasEEMap); PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasPlot); - PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasDiff); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalLaserAlphasSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalLinearCorrections_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalLinearCorrections_PayloadInspector.cc index f25b92a2eef63..83e913719b9f8 100644 --- a/CondCore/EcalPlugins/plugins/EcalLinearCorrections_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalLinearCorrections_PayloadInspector.cc @@ -205,14 +205,13 @@ namespace { /**************************************************************** 2d plot of ECAL LinearCorrections difference between 2 IOVs ****************************************************************/ - class EcalLinearCorrectionsDiff : public cond::payloadInspector::PlotImage { + template + class EcalLinearCorrectionsDiffBase : public cond::payloadInspector::PlotImage { public: - EcalLinearCorrectionsDiff() - : cond::payloadInspector::PlotImage("ECAL LinearCorrections - map ") { - setSingleIov(false); - } + EcalLinearCorrectionsDiffBase() + : cond::payloadInspector::PlotImage("ECAL LinearCorrections - map ") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F** barrel = new TH2F*[kValues]; TH2F** endc_p = new TH2F*[kValues]; TH2F** endc_m = new TH2F*[kValues]; @@ -235,16 +234,39 @@ namespace { } float vEB[kValues][kEBChannels], vEE[kValues][kEEChannels]; - unsigned int run[2] = {0, 0}, irun = 0; + unsigned int run[2] = {0, 0}; unsigned long IOV = 0; - auto iov = iovs.front(); - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - IOV = std::get<0>(iov); - if (IOV < 4294967296) - run[irun] = std::get<0>(iov); - else { // time type IOV - run[irun] = IOV >> 32; + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + IOV = std::get<0>(firstiov); + if (IOV < 4294967296) + run[0] = IOV; + else { // time type IOV + run[0] = IOV >> 32; + } + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + IOV = std::get<0>(lastiov); + if (IOV < 4294967296) + run[1] = IOV; + else { // time type IOV + run[1] = IOV >> 32; + } + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); } if (payload.get()) { for (int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) { @@ -345,7 +367,6 @@ namespace { } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -355,6 +376,7 @@ namespace { t1.SetNDC(); t1.SetTextAlign(26); // t1.DrawLatex(0.5, 0.96, Form("Ecal Linear Corrections, IOV %lu", run)); + int len = l_tagname[0].length() + l_tagname[1].length(); if (IOV < 4294967296) { t1.SetTextSize(0.05); t1.DrawLatex(0.5, 0.96, Form("Ecal Linear Corrections, IOV %i - %i", run[1], run[0])); @@ -369,8 +391,18 @@ namespace { localtime_r(&t, <); strftime(buf1, sizeof(buf1), "%F %R:%S", <); buf1[sizeof(buf1) - 1] = 0; - t1.SetTextSize(0.015); - t1.DrawLatex(0.5, 0.96, Form("Ecal Linear Corrections, IOV %s - %s", buf1, buf0)); + if (ntags == 2) { + if (len < 80) { + t1.SetTextSize(0.02); + t1.DrawLatex(0.5, 0.96, Form("%s %s - %s %s", l_tagname[1].c_str(), buf1, l_tagname[0].c_str(), buf0)); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("Ecal Linear Corrections, IOV %s - %s", buf1, buf0)); + } + } else { + t1.SetTextSize(0.015); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %s - %s", l_tagname[0].c_str(), buf1, buf0)); + } } float xmi[3] = {0.0, 0.26, 0.74}; @@ -418,16 +450,19 @@ namespace { DrawEE(endc_p[valId], pEEmin[valId], pEEmax[valId]); } - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; // class EcalLinearCorrectionsDiff + }; // class EcalLinearCorrectionsDiffBase + using EcalLinearCorrectionsDiffOneTag = EcalLinearCorrectionsDiffBase; + using EcalLinearCorrectionsDiffTwoTags = EcalLinearCorrectionsDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalLinearCorrections) { PAYLOAD_INSPECTOR_CLASS(EcalLinearCorrectionsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalLinearCorrectionsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalLinearCorrectionsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalLinearCorrectionsDiffTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc index 45a97198e2f1d..db9cbc4a9881b 100644 --- a/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalPFRecHitThresholds_PayloadInspector.cc @@ -214,17 +214,17 @@ namespace { } // fill method }; - /***************************************************************** + /******************************************************** 2d plot of Ecal PFRec Hit Thresholds between 2 IOVs - *****************************************************************/ - class EcalPFRecHitThresholdsDiff : public cond::payloadInspector::PlotImage { + *********************************************************/ + template + class EcalPFRecHitThresholdsBase : public cond::payloadInspector::PlotImage { public: - EcalPFRecHitThresholdsDiff() - : cond::payloadInspector::PlotImage("Ecal PFRec Hit Thresholds difference ") { - setSingleIov(false); - } + EcalPFRecHitThresholdsBase() + : cond::payloadInspector::PlotImage( + "Ecal PFRec Hit Thresholds comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -234,27 +234,43 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -262,8 +278,23 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal PFRec Hit Thresholds Diff, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 180) { + t1.SetTextSize(0.05); + t1.DrawLatex( + 0.5, + 0.96, + Form("%s %i %s %s %i", l_tagname[1].c_str(), run[1], dr[method].c_str(), l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal PFRec Hit Thresholds, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; @@ -281,15 +312,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; - - /******************************************************* - 2d plot of Ecal PFRec Hit Thresholds Summary of 1 IOV - *******************************************************/ + }; // class EcalPFRecHitThresholdsDiffBase + using EcalPFRecHitThresholdsDiffOneTag = EcalPFRecHitThresholdsBase; + using EcalPFRecHitThresholdsDiffTwoTags = EcalPFRecHitThresholdsBase; + using EcalPFRecHitThresholdsRatioOneTag = EcalPFRecHitThresholdsBase; + using EcalPFRecHitThresholdsRatioTwoTags = EcalPFRecHitThresholdsBase; + + /********************************************************** + 2d plot of Ecal PFRec Hit Thresholds Summary of 1 IOV + **********************************************************/ class EcalPFRecHitThresholdsSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalPFRecHitThresholdsSummaryPlot() @@ -354,6 +389,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalPFRecHitThresholds) { PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsEBMap); PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsEEMap); PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalPFRecHitThresholdsSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalPedestals_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalPedestals_PayloadInspector.cc index 432f949d50337..fb7726f768bca 100644 --- a/CondCore/EcalPlugins/plugins/EcalPedestals_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalPedestals_PayloadInspector.cc @@ -22,9 +22,9 @@ namespace { enum { MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360 }; // barrel lower and upper bounds on eta and phi enum { IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100 }; // endcaps lower and upper bounds on x and y - /************************************************* + /************************************** 1d plot of ECAL pedestal of 1 IOV - *************************************************/ + ***************************************/ class EcalPedestalsHist : public cond::payloadInspector::PlotImage { public: EcalPedestalsHist() : cond::payloadInspector::PlotImage("ECAL pedestal map") { setSingleIov(true); } @@ -127,9 +127,9 @@ namespace { } // fill method }; // class EcalPedestalsHist - /************************************************* + /************************************** 2d plot of ECAL pedestal of 1 IOV - *************************************************/ + ***************************************/ class EcalPedestalsPlot : public cond::payloadInspector::PlotImage { public: @@ -392,14 +392,13 @@ namespace { }; // class EcalPedestalsPlot - /************************************************************ - 2d plot of ECAL pedestals difference between 2 IOVs - *************************************************************/ - template - class EcalPedestalsDiffBase : public cond::payloadInspector::PlotImage { + /***************************************************************** + 2d plot of ECAL pedestals difference or ratio between 2 IOVs + ******************************************************************/ + template + class EcalPedestalsBase : public cond::payloadInspector::PlotImage { public: - EcalPedestalsDiffBase() - : cond::payloadInspector::PlotImage("ECAL pedestals difference") {} + EcalPedestalsBase() : cond::payloadInspector::PlotImage("ECAL pedestals comparison") {} bool fill() override { uint32_t gainValues[kGains] = {12, 6, 1}; TH2F** barrel_m = new TH2F*[kGains]; @@ -496,141 +495,246 @@ namespace { } // std::cout << " irun " << irun << " tag " << l_tagname[irun] << " IOV " << run[irun] << std ::endl; if (payload.get()) { - if (payload->barrelItems().empty()) - return false; - for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) { - uint32_t rawid = EBDetId::unhashIndex(cellid); - if (payload->find(rawid) == payload->end()) - continue; - - if (irun == 0) { - meanEB[0][cellid] = (*payload)[rawid].mean_x12; - rmsEB[0][cellid] = (*payload)[rawid].rms_x12; - meanEB[1][cellid] = (*payload)[rawid].mean_x6; - rmsEB[1][cellid] = (*payload)[rawid].rms_x6; - meanEB[2][cellid] = (*payload)[rawid].mean_x1; - rmsEB[2][cellid] = (*payload)[rawid].rms_x1; - } else { - Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5; - Double_t eta = (Double_t)(EBDetId(rawid)).ieta(); - if (eta > 0.) - eta = eta - 0.5; // 0.5 to 84.5 - else - eta = eta + 0.5; // -84.5 to -0.5 - barrel_m[0]->Fill(phi, eta, (*payload)[rawid].mean_x12 - meanEB[0][cellid]); - double diff = (*payload)[rawid].rms_x12 - rmsEB[0][cellid]; - barrel_r[0]->Fill(phi, eta, diff); - if (std::abs(diff) < 1.) { - EBmean[0] = EBmean[0] + diff; - EBrms[0] = EBrms[0] + diff * diff; - EBtot[0]++; - } - // else std::cout << " gain 12 chan " << cellid << " diff " << diff << std::endl; - barrel_m[1]->Fill(phi, eta, (*payload)[rawid].mean_x6 - meanEB[1][cellid]); - diff = (*payload)[rawid].rms_x6 - rmsEB[1][cellid]; - barrel_r[1]->Fill(phi, eta, diff); - if (std::abs(diff) < 1.) { - EBmean[1] = EBmean[1] + diff; - EBrms[1] = EBrms[1] + diff * diff; - EBtot[1]++; - } - // else std::cout << " gain 6 chan " << cellid << " diff " << diff << std::endl; - barrel_m[2]->Fill(phi, eta, (*payload)[rawid].mean_x1 - meanEB[2][cellid]); - diff = (*payload)[rawid].rms_x1 - rmsEB[2][cellid]; - barrel_r[2]->Fill(phi, eta, diff); - if (std::abs(diff) < 1.) { - EBmean[2] = EBmean[2] + diff; - EBrms[2] = EBrms[2] + diff * diff; - EBtot[2]++; + if (!payload->barrelItems().empty()) { + for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) { + uint32_t rawid = EBDetId::unhashIndex(cellid); + if (payload->find(rawid) == payload->end()) + continue; + + if (irun == 0) { + meanEB[0][cellid] = (*payload)[rawid].mean_x12; + rmsEB[0][cellid] = (*payload)[rawid].rms_x12; + meanEB[1][cellid] = (*payload)[rawid].mean_x6; + rmsEB[1][cellid] = (*payload)[rawid].rms_x6; + meanEB[2][cellid] = (*payload)[rawid].mean_x1; + rmsEB[2][cellid] = (*payload)[rawid].rms_x1; + } else { + Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5; + Double_t eta = (Double_t)(EBDetId(rawid)).ieta(); + if (eta > 0.) + eta = eta - 0.5; // 0.5 to 84.5 + else + eta = eta + 0.5; // -84.5 to -0.5 + double dr, drms; + // gain 12 + float val = (*payload)[rawid].mean_x12; + float valr = (*payload)[rawid].rms_x12; + if (method == 0) { + dr = val - meanEB[0][cellid]; + drms = valr - rmsEB[0][cellid]; + } else { // ratio + if (meanEB[0][cellid] == 0) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } else + dr = val / meanEB[0][cellid]; + if (rmsEB[0][cellid] == 0) { + if (valr == 0.) + drms = 1.; + else + drms = 9999.; // use a large value + } else + drms = valr / rmsEB[0][cellid]; + } + barrel_m[0]->Fill(phi, eta, dr); + barrel_r[0]->Fill(phi, eta, drms); + if (std::abs(drms) < 1.) { + EBmean[0] = EBmean[0] + drms; + EBrms[0] = EBrms[0] + drms * drms; + EBtot[0]++; + } + // gain 6 + val = (*payload)[rawid].mean_x6; + valr = (*payload)[rawid].rms_x6; + if (method == 0) { + dr = val - meanEB[1][cellid]; + drms = valr - rmsEB[1][cellid]; + } else { // ratio + if (meanEB[1][cellid] == 0) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } else + dr = val / meanEB[1][cellid]; + if (rmsEB[1][cellid] == 0) { + if (valr == 0.) + drms = 1.; + else + drms = 9999.; // use a large value + } else + drms = valr / rmsEB[1][cellid]; + } + barrel_m[1]->Fill(phi, eta, dr); + barrel_r[1]->Fill(phi, eta, drms); + if (std::abs(drms) < 1.) { + EBmean[1] = EBmean[1] + drms; + EBrms[1] = EBrms[1] + drms * drms; + EBtot[1]++; + } + // gain 1 + val = (*payload)[rawid].mean_x1; + valr = (*payload)[rawid].rms_x1; + if (method == 0) { + dr = val - meanEB[2][cellid]; + drms = valr - rmsEB[2][cellid]; + } else { // ratio + if (meanEB[2][cellid] == 0) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } else + dr = val / meanEB[2][cellid]; + if (rmsEB[2][cellid] == 0) { + if (valr == 0.) + drms = 1.; + else + drms = 9999.; // use a large value + } else + drms = valr / rmsEB[2][cellid]; + } + barrel_m[2]->Fill(phi, eta, dr); + barrel_r[2]->Fill(phi, eta, drms); + if (std::abs(drms) < 1.) { + EBmean[2] = EBmean[2] + drms; + EBrms[2] = EBrms[2] + drms * drms; + EBtot[2]++; + } } - // else std::cout << " gain 1 chan " << cellid << " diff " << diff << std::endl; - } - } // loop over cellid - - if (payload->endcapItems().empty()) - return false; - // looping over the EE channels - for (int iz = -1; iz < 2; iz = iz + 2) { // -1 or +1 - for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++) { - for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++) { - if (EEDetId::validDetId(ix, iy, iz)) { - EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE); - uint32_t rawid = myEEId.rawId(); - uint32_t index = myEEId.hashedIndex(); - if (payload->find(rawid) == payload->end()) - continue; - if (irun == 0) { - meanEE[0][index] = (*payload)[rawid].mean_x12; - rmsEE[0][index] = (*payload)[rawid].rms_x12; - meanEE[1][index] = (*payload)[rawid].mean_x6; - rmsEE[1][index] = (*payload)[rawid].rms_x6; - meanEE[2][index] = (*payload)[rawid].mean_x1; - rmsEE[2][index] = (*payload)[rawid].rms_x1; - } // fist run - else { - if (iz == 1) { - endc_p_m[0]->Fill(ix, iy, (*payload)[rawid].mean_x12 - meanEE[0][index]); - double diff = (*payload)[rawid].rms_x12 - rmsEE[0][index]; - endc_p_r[0]->Fill(ix, iy, rmsEE[0][index] - (*payload)[rawid].rms_x12); - if (std::abs(diff) < 1.) { - EEmean[0] = EEmean[0] + diff; - EErms[0] = EErms[0] + diff * diff; - EEtot[0]++; - } - //else std::cout << " gain 12 chan " << index << " diff " << diff << std::endl; - endc_p_m[1]->Fill(ix, iy, (*payload)[rawid].mean_x6 - meanEE[1][index]); - diff = (*payload)[rawid].rms_x6 - rmsEE[1][index]; - endc_p_r[1]->Fill(ix, iy, diff); - if (std::abs(diff) < 1.) { - EEmean[1] = EEmean[1] + diff; - EErms[1] = EErms[1] + diff * diff; - EEtot[1]++; + } // loop over cellid + } // barrel data present + if (payload->endcapItems().empty()) { + // looping over the EE channels + for (int iz = -1; iz < 2; iz = iz + 2) { // -1 or +1 + for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++) { + for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++) { + if (EEDetId::validDetId(ix, iy, iz)) { + EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE); + uint32_t rawid = myEEId.rawId(); + uint32_t index = myEEId.hashedIndex(); + if (payload->find(rawid) == payload->end()) + continue; + if (irun == 0) { + meanEE[0][index] = (*payload)[rawid].mean_x12; + rmsEE[0][index] = (*payload)[rawid].rms_x12; + meanEE[1][index] = (*payload)[rawid].mean_x6; + rmsEE[1][index] = (*payload)[rawid].rms_x6; + meanEE[2][index] = (*payload)[rawid].mean_x1; + rmsEE[2][index] = (*payload)[rawid].rms_x1; + } // fist run + else { + double dr, drms; + // gain 12 + float val = (*payload)[rawid].mean_x12; + float valr = (*payload)[rawid].rms_x12; + if (method == 0) { + dr = val - meanEE[0][index]; + drms = valr - rmsEE[0][index]; + } else { // ratio + if (meanEE[0][index] == 0) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } else + dr = val / meanEE[0][index]; + if (rmsEE[0][index] == 0) { + if (valr == 0.) + drms = 1.; + else + drms = 9999.; // use a large value + } else + drms = valr / rmsEE[0][index]; } - //else std::cout << " gain 6 chan " << index << " diff " << diff << std::endl; - endc_p_m[2]->Fill(ix, iy, (*payload)[rawid].mean_x1 - meanEE[2][index]); - diff = (*payload)[rawid].rms_x1 - rmsEE[2][index]; - endc_p_r[2]->Fill(ix, iy, diff); - if (std::abs(diff) < 1.) { - EEmean[2] = EEmean[2] + diff; - EErms[2] = EErms[2] + diff * diff; - EEtot[2]++; + if (iz == 1) { // EE+ + endc_p_m[0]->Fill(ix, iy, dr); + endc_p_r[0]->Fill(ix, iy, drms); + } else { // EE- + endc_m_m[0]->Fill(ix, iy, dr); + endc_m_r[0]->Fill(ix, iy, drms); } - //else std::cout << " gain 1 chan " << index << " diff " << diff << std::endl; - } // EE+ - else { - endc_m_m[0]->Fill(ix, iy, (*payload)[rawid].mean_x12 - meanEE[0][index]); - double diff = (*payload)[rawid].rms_x12 - rmsEE[0][index]; - endc_m_r[0]->Fill(ix, iy, rmsEE[0][index] - (*payload)[rawid].rms_x12); - if (std::abs(diff) < 1.) { - EEmean[0] = EEmean[0] + diff; - EErms[0] = EErms[0] + diff * diff; + if (std::abs(drms) < 1.) { + EEmean[0] = EEmean[0] + drms; + EErms[0] = EErms[0] + drms * drms; EEtot[0]++; } - //else std::cout << " gain 12 chan " << index << " diff " << diff << std::endl; - endc_m_m[1]->Fill(ix, iy, (*payload)[rawid].mean_x6 - meanEE[1][index]); - diff = (*payload)[rawid].rms_x6 - rmsEE[1][index]; - endc_m_r[1]->Fill(ix, iy, diff); - if (std::abs(diff) < 1.) { - EEmean[1] = EEmean[1] + diff; - EErms[1] = EErms[1] + diff * diff; + // gain 6 + val = (*payload)[rawid].mean_x6; + valr = (*payload)[rawid].rms_x6; + if (method == 0) { + dr = val - meanEE[1][index]; + drms = valr - rmsEE[1][index]; + } else { // ratio + if (meanEE[1][index] == 0) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } else + dr = val / meanEE[1][index]; + if (rmsEE[1][index] == 0) { + if (valr == 0.) + drms = 1.; + else + drms = 9999.; // use a large value + } else + drms = valr / rmsEE[1][index]; + } + if (iz == 1) { // EE+ + endc_p_m[1]->Fill(ix, iy, dr); + endc_p_r[1]->Fill(ix, iy, drms); + } else { // EE- + endc_m_m[1]->Fill(ix, iy, dr); + endc_m_r[1]->Fill(ix, iy, drms); + } + if (std::abs(drms) < 1.) { + EEmean[1] = EEmean[1] + drms; + EErms[1] = EErms[1] + drms * drms; EEtot[1]++; } - //else std::cout << " gain 6 chan " << index << " diff " << diff << std::endl; - endc_m_m[2]->Fill(ix, iy, (*payload)[rawid].mean_x1 - meanEE[2][index]); - diff = (*payload)[rawid].rms_x1 - rmsEE[2][index]; - endc_m_r[2]->Fill(ix, iy, diff); - if (std::abs(diff) < 1.) { - EEmean[2] = EEmean[2] + diff; - EErms[2] = EErms[2] + diff * diff; + // gain 1 + val = (*payload)[rawid].mean_x1; + valr = (*payload)[rawid].rms_x1; + if (method == 0) { + dr = val - meanEE[2][index]; + drms = valr - rmsEE[2][index]; + } else { // ratio + if (meanEE[2][index] == 0) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; // use a large value + } else + dr = val / meanEE[2][index]; + if (rmsEE[2][index] == 0) { + if (valr == 0.) + drms = 1.; + else + drms = 9999.; // use a large value + } else + drms = valr / rmsEE[2][index]; + } + if (iz == 1) { // EE+ + endc_p_m[2]->Fill(ix, iy, dr); + endc_p_r[2]->Fill(ix, iy, drms); + } else { // EE- + endc_m_m[2]->Fill(ix, iy, dr); + endc_m_r[2]->Fill(ix, iy, drms); + } + if (std::abs(drms) < 1.) { + EEmean[2] = EEmean[2] + drms; + EErms[2] = EErms[2] + drms * drms; EEtot[2]++; } - //else std::cout << " gain 1 chan " << index << " diff " << diff << std::endl; - } // EE- - } // second run - } // validDetId - } // loop over ix - } // loop over iy - } // loop over iz + } // second run + } // validDetId + } // loop over ix + } // loop over iy + } // loop over iz + } // endcap data present } // if payload.get() else return false; @@ -643,13 +747,25 @@ namespace { t1.SetNDC(); t1.SetTextAlign(26); int len = l_tagname[0].length() + l_tagname[1].length(); - if (ntags == 2 && len < 58) { - t1.SetTextSize(0.025); - t1.DrawLatex( - 0.5, 0.96, Form("%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 58) { + t1.SetTextSize(0.025); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal Pedestals, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } } else { t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Pedestals, IOV %i - %i", run[1], run[0])); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; @@ -707,9 +823,11 @@ namespace { canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; // class EcalPedestalsDiffBase - using EcalPedestalsDiffOneTag = EcalPedestalsDiffBase; - using EcalPedestalsDiffTwoTags = EcalPedestalsDiffBase; + }; // class EcalPedestalsBase + using EcalPedestalsDiffOneTag = EcalPedestalsBase; + using EcalPedestalsDiffTwoTags = EcalPedestalsBase; + using EcalPedestalsRatioOneTag = EcalPedestalsBase; + using EcalPedestalsRatioTwoTags = EcalPedestalsBase; /************************************************* 2d histogram of ECAL barrel pedestal of 1 IOV @@ -1456,6 +1574,8 @@ PAYLOAD_INSPECTOR_MODULE(EcalPedestals) { PAYLOAD_INSPECTOR_CLASS(EcalPedestalsPlot); PAYLOAD_INSPECTOR_CLASS(EcalPedestalsDiffOneTag); PAYLOAD_INSPECTOR_CLASS(EcalPedestalsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalPedestalsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalPedestalsRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalPedestalsEBMean12Map); PAYLOAD_INSPECTOR_CLASS(EcalPedestalsEBMean6Map); PAYLOAD_INSPECTOR_CLASS(EcalPedestalsEBMean1Map); diff --git a/CondCore/EcalPlugins/plugins/EcalSamplesCorrelation_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalSamplesCorrelation_PayloadInspector.cc index a4ce143ed6f63..091ab2d5f00aa 100644 --- a/CondCore/EcalPlugins/plugins/EcalSamplesCorrelation_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalSamplesCorrelation_PayloadInspector.cc @@ -106,25 +106,41 @@ namespace { /******************************************************* 2d plot of Ecal Samples Correlation difference between 2 IOVs *******************************************************/ - - class EcalSamplesCorrelationDiff : public cond::payloadInspector::PlotImage { + template + class EcalSamplesCorrelationDiffBase + : public cond::payloadInspector::PlotImage { public: - //void fill_align(const std::vector& vect,TH2F* align,float val[],const int column, int row,unsigned irun); - - EcalSamplesCorrelationDiff() - : cond::payloadInspector::PlotImage("Ecal Samples Correlation difference") { - setSingleIov(false); - } - - bool fill(const std::vector >& iovs) override { - unsigned int run[2], irun = 0; + EcalSamplesCorrelationDiffBase() + : cond::payloadInspector::PlotImage( + "Ecal Samples Correlation difference") {} + bool fill() override { + unsigned int run[2]; float val[6][36]; TH2F* align = new TH2F("", "", 1, 0., 1., 1, 0., 1.); // pseudo creation int NbRows = 0; - - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + std::string l_tagname[2]; + + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { EcalSamplesCorrelation it = (*payload); @@ -154,7 +170,6 @@ namespace { } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -181,7 +196,7 @@ namespace { align->GetYaxis()->SetTickLength(0.); align->GetYaxis()->SetLabelSize(0.); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; @@ -201,12 +216,15 @@ namespace { irow++; } } - }; + }; // class EcalSamplesCorrelationDiffBase + using EcalSamplesCorrelationDiffOneTag = EcalSamplesCorrelationDiffBase; + using EcalSamplesCorrelationDiffTwoTags = EcalSamplesCorrelationDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalSamplesCorrelation) { PAYLOAD_INSPECTOR_CLASS(EcalSamplesCorrelationPlot); - PAYLOAD_INSPECTOR_CLASS(EcalSamplesCorrelationDiff); -} \ No newline at end of file + PAYLOAD_INSPECTOR_CLASS(EcalSamplesCorrelationDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalSamplesCorrelationDiffTwoTags); +} diff --git a/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc index 3c8b5cda3deba..73a04734c8c01 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGCrystalStatus_PayloadInspector.cc @@ -125,24 +125,42 @@ namespace { /************************************************************************ 2d plot of ECAL TPGCrystalStatus difference between 2 IOVs ************************************************************************/ - class EcalTPGCrystalStatusDiff : public cond::payloadInspector::PlotImage { + template + class EcalTPGCrystalStatusDiffBase : public cond::payloadInspector::PlotImage { public: - EcalTPGCrystalStatusDiff() - : cond::payloadInspector::PlotImage("ECAL TPGCrystalStatus difference") { - setSingleIov(false); - } + EcalTPGCrystalStatusDiffBase() + : cond::payloadInspector::PlotImage("ECAL TPGCrystalStatus difference") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "EB difference", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "EE+ difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "EE- difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); int EBstat = 0, EEstat[2] = {0, 0}; - unsigned int run[2] = {0, 0}, irun = 0; + unsigned int run[2] = {0, 0}; float vEB[kEBChannels], vEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { for (int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) { Double_t eta = (Double_t)ieta; @@ -198,7 +216,6 @@ namespace { } // payload else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -211,8 +228,19 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal TPGCrystalStatus, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2) { + if (len < 80) { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s %i - %s %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal TPGCrystalStatus, IOV %i - %i", run[1], run[0])); + } + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); + } // float xmi[3] = {0.0 , 0.24, 0.76}; // float xma[3] = {0.24, 0.76, 1.00}; @@ -236,15 +264,17 @@ namespace { DrawEE(endc_p, -1., 1.); t1.DrawLatex(0.15, 0.92, Form("%i differences", EEstat[1])); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalTPGCrystalStatusDiffBase + using EcalTPGCrystalStatusDiffOneTag = EcalTPGCrystalStatusDiffBase; + using EcalTPGCrystalStatusDiffTwoTags = EcalTPGCrystalStatusDiffBase; - /***************************************** - 2d plot of EcalTPGCrystalStatus Error Summary of 1 IOV - ******************************************/ + /********************************************************* + 2d plot of EcalTPGCrystalStatus Error Summary of 1 IOV + *********************************************************/ class EcalTPGCrystalStatusSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalTPGCrystalStatusSummaryPlot() @@ -342,6 +372,7 @@ namespace { // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTPGCrystalStatus) { PAYLOAD_INSPECTOR_CLASS(EcalTPGCrystalStatusPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTPGCrystalStatusDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTPGCrystalStatusDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGCrystalStatusDiffTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalTPGCrystalStatusSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalTPGLinearizationConst_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGLinearizationConst_PayloadInspector.cc index 51f812e851241..75cdfcb4a91f5 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGLinearizationConst_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGLinearizationConst_PayloadInspector.cc @@ -271,14 +271,14 @@ namespace { /****************************************************************** 2d plot of ECAL TPGLinearizationConst difference between 2 IOVs ******************************************************************/ - class EcalTPGLinearizationConstDiff : public cond::payloadInspector::PlotImage { + template + class EcalTPGLinearizationConstBase + : public cond::payloadInspector::PlotImage { public: - EcalTPGLinearizationConstDiff() - : cond::payloadInspector::PlotImage("ECAL Gain Ratios difference") { - setSingleIov(false); - } + EcalTPGLinearizationConstBase() + : cond::payloadInspector::PlotImage("ECAL Gain Ratios comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F** barrel_m = new TH2F*[kGains]; TH2F** endc_p_m = new TH2F*[kGains]; TH2F** endc_m_m = new TH2F*[kGains]; @@ -347,12 +347,32 @@ namespace { rEEmax[gainId] = -10.; } - unsigned int run[2], irun = 0; + unsigned int run[2]; //float gEB[3][kEBChannels], gEE[3][kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { + float dr; for (int sign = 0; sign < kSides; sign++) { int thesign = sign == 1 ? 1 : -1; @@ -367,67 +387,127 @@ namespace { if (irun == 0) { mEB[0][hashindex] = val; } else { - float diff = val - mEB[0][hashindex]; - barrel_m[0]->Fill(iphi, y, diff); - if (diff < mEBmin[0]) - mEBmin[0] = diff; - if (diff > mEBmax[0]) - mEBmax[0] = diff; + if (method == 0) + dr = val - mEB[0][hashindex]; + else { // ratio + if (mEB[0][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEB[0][hashindex]; + } + barrel_m[0]->Fill(iphi, y, dr); + if (dr < mEBmin[0]) + mEBmin[0] = dr; + if (dr > mEBmax[0]) + mEBmax[0] = dr; } val = (*payload)[id.rawId()].shift_x12; if (irun == 0) { rEB[0][hashindex] = val; } else { - float diff = val - rEB[0][hashindex]; - barrel_r[0]->Fill(iphi, y, diff); - if (diff < rEBmin[0]) - rEBmin[0] = diff; - if (diff > rEBmax[0]) - rEBmax[0] = diff; + if (method == 0) + dr = val - rEB[0][hashindex]; + else { // ratio + if (rEB[0][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / rEB[0][hashindex]; + } + barrel_r[0]->Fill(iphi, y, dr); + if (dr < rEBmin[0]) + rEBmin[0] = dr; + if (dr > rEBmax[0]) + rEBmax[0] = dr; } val = (*payload)[id.rawId()].mult_x6; if (irun == 0) { mEB[1][hashindex] = val; } else { - float diff = val - mEB[1][hashindex]; - barrel_m[1]->Fill(iphi, y, diff); - if (diff < mEBmin[1]) - mEBmin[1] = diff; - if (diff > mEBmax[1]) - mEBmax[1] = diff; + if (method == 0) + dr = val - mEB[1][hashindex]; + else { // ratio + if (mEB[1][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEB[1][hashindex]; + } + barrel_m[1]->Fill(iphi, y, dr); + if (dr < mEBmin[1]) + mEBmin[1] = dr; + if (dr > mEBmax[1]) + mEBmax[1] = dr; } val = (*payload)[id.rawId()].shift_x6; if (irun == 0) { rEB[1][hashindex] = val; } else { - float diff = val - rEB[1][hashindex]; - barrel_r[1]->Fill(iphi, y, diff); - if (diff < rEBmin[1]) - rEBmin[1] = diff; - if (diff > rEBmax[1]) - rEBmax[1] = diff; + if (method == 0) + dr = val - rEB[1][hashindex]; + else { // ratio + if (rEB[1][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / rEB[1][hashindex]; + } + barrel_r[1]->Fill(iphi, y, dr); + if (dr < rEBmin[1]) + rEBmin[1] = dr; + if (dr > rEBmax[1]) + rEBmax[1] = dr; } val = (*payload)[id.rawId()].mult_x1; if (irun == 0) { mEB[2][hashindex] = val; } else { - float diff = val - mEB[2][hashindex]; - barrel_m[2]->Fill(iphi, y, diff); - if (diff < mEBmin[2]) - mEBmin[2] = diff; - if (diff > mEBmax[2]) - mEBmax[2] = diff; + if (method == 0) + dr = val - mEB[2][hashindex]; + else { // ratio + if (mEB[2][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEB[2][hashindex]; + } + barrel_m[2]->Fill(iphi, y, dr); + if (dr < mEBmin[2]) + mEBmin[2] = dr; + if (dr > mEBmax[2]) + mEBmax[2] = dr; } val = (*payload)[id.rawId()].shift_x1; if (irun == 0) { rEB[2][hashindex] = val; } else { - float diff = val - rEB[2][hashindex]; - barrel_r[2]->Fill(iphi, y, diff); - if (diff < rEBmin[2]) - rEBmin[2] = diff; - if (diff > rEBmax[2]) - rEBmax[2] = diff; + if (method == 0) + dr = val - rEB[2][hashindex]; + else { // ratio + if (rEB[2][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / rEB[2][hashindex]; + } + barrel_r[2]->Fill(iphi, y, dr); + if (dr < rEBmin[2]) + rEBmin[2] = dr; + if (dr > rEBmax[2]) + rEBmax[2] = dr; } } // iphi } // ieta @@ -442,94 +522,153 @@ namespace { if (irun == 0) { mEE[0][hashindex] = val; } else { - float diff = val - mEE[0][hashindex]; + if (method == 0) + dr = val - mEE[0][hashindex]; + else { // ratio + if (mEE[0][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEE[0][hashindex]; + } if (thesign == 1) - endc_p_m[0]->Fill(ix + 1, iy + 1, diff); + endc_p_m[0]->Fill(ix + 1, iy + 1, dr); else - endc_m_m[0]->Fill(ix + 1, iy + 1, diff); - if (diff < mEEmin[0]) - mEEmin[0] = diff; - if (diff > mEEmax[0]) - mEEmax[0] = diff; + endc_m_m[0]->Fill(ix + 1, iy + 1, dr); + if (dr < mEEmin[0]) + mEEmin[0] = dr; + if (dr > mEEmax[0]) + mEEmax[0] = dr; } val = (*payload)[id.rawId()].shift_x12; if (irun == 0) { rEE[0][hashindex] = val; } else { - float diff = val - rEE[0][hashindex]; + if (method == 0) + dr = val - rEE[0][hashindex]; + else { // ratio + if (rEE[0][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / rEE[0][hashindex]; + } if (thesign == 1) - endc_p_r[0]->Fill(ix + 1, iy + 1, diff); + endc_p_r[0]->Fill(ix + 1, iy + 1, dr); else - endc_m_r[0]->Fill(ix + 1, iy + 1, diff); - if (diff < rEEmin[0]) - rEEmin[0] = diff; - if (diff > rEEmax[0]) - rEEmax[0] = diff; + endc_m_r[0]->Fill(ix + 1, iy + 1, dr); + if (dr < rEEmin[0]) + rEEmin[0] = dr; + if (dr > rEEmax[0]) + rEEmax[0] = dr; } val = (*payload)[id.rawId()].mult_x6; if (irun == 0) { mEE[1][hashindex] = val; } else { - float diff = val - mEE[1][hashindex]; + if (method == 0) + dr = val - mEE[1][hashindex]; + else { // ratio + if (mEE[1][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEE[1][hashindex]; + } if (thesign == 1) - endc_p_m[1]->Fill(ix + 1, iy + 1, diff); + endc_p_m[1]->Fill(ix + 1, iy + 1, dr); else - endc_m_m[1]->Fill(ix + 1, iy + 1, diff); - if (diff < mEEmin[1]) - mEEmin[1] = diff; - if (diff > mEEmax[1]) - mEEmax[1] = diff; + endc_m_m[1]->Fill(ix + 1, iy + 1, dr); + if (dr < mEEmin[1]) + mEEmin[1] = dr; + if (dr > mEEmax[1]) + mEEmax[1] = dr; } val = (*payload)[id.rawId()].shift_x6; if (irun == 0) { rEE[1][hashindex] = val; } else { - float diff = val - rEE[1][hashindex]; + if (method == 0) + dr = val - rEE[1][hashindex]; + else { // ratio + if (rEE[1][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / rEE[1][hashindex]; + } if (thesign == 1) - endc_p_r[1]->Fill(ix + 1, iy + 1, diff); + endc_p_r[1]->Fill(ix + 1, iy + 1, dr); else - endc_m_r[1]->Fill(ix + 1, iy + 1, diff); - if (diff < rEEmin[1]) - rEEmin[1] = diff; - if (diff > rEEmax[1]) - rEEmax[1] = diff; + endc_m_r[1]->Fill(ix + 1, iy + 1, dr); + if (dr < rEEmin[1]) + rEEmin[1] = dr; + if (dr > rEEmax[1]) + rEEmax[1] = dr; } val = (*payload)[id.rawId()].mult_x1; if (irun == 0) { mEE[2][hashindex] = val; } else { - float diff = val - mEE[2][hashindex]; + if (method == 0) + dr = val - mEE[2][hashindex]; + else { // ratio + if (mEE[2][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEE[2][hashindex]; + } if (thesign == 1) - endc_p_m[2]->Fill(ix + 1, iy + 1, diff); + endc_p_m[2]->Fill(ix + 1, iy + 1, dr); else - endc_m_m[2]->Fill(ix + 1, iy + 1, diff); - if (diff < mEEmin[2]) - mEEmin[2] = diff; - if (diff > mEEmax[2]) - mEEmax[2] = diff; + endc_m_m[2]->Fill(ix + 1, iy + 1, dr); + if (dr < mEEmin[2]) + mEEmin[2] = dr; + if (dr > mEEmax[2]) + mEEmax[2] = dr; } val = (*payload)[id.rawId()].shift_x1; if (irun == 0) { rEE[2][hashindex] = val; } else { - float diff = val - rEE[2][hashindex]; + if (method == 0) + dr = val - rEE[2][hashindex]; + else { // ratio + if (rEE[2][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / rEE[2][hashindex]; + } if (thesign == 1) - endc_p_r[2]->Fill(ix + 1, iy + 1, diff); + endc_p_r[2]->Fill(ix + 1, iy + 1, dr); else - endc_m_r[2]->Fill(ix + 1, iy + 1, diff); - if (diff < rEEmin[2]) - rEEmin[2] = diff; - if (diff > rEEmax[2]) - rEEmax[2] = diff; + endc_m_r[2]->Fill(ix + 1, iy + 1, dr); + if (dr < rEEmin[2]) + rEEmin[2] = dr; + if (dr > rEEmax[2]) + rEEmax[2] = dr; } - // fout << " x " << ix << " y " << " diff " << diff << std::endl; + // fout << " x " << ix << " y " << " dr " << dr << std::endl; } // iy } // ix } // side } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -538,8 +677,23 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal TPGLinearizationConst, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 70) { + t1.SetTextSize(0.03); + t1.DrawLatex( + 0.5, + 0.96, + Form("%s %i %s %s %i", l_tagname[1].c_str(), run[1], dr[method].c_str(), l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("Ecal TPGLinearizationConst, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.22, 0.78}; float xma[3] = {0.22, 0.78, 1.00}; @@ -569,16 +723,23 @@ namespace { DrawEE(endc_p_r[gId], rEEmin[gId], rEEmax[gId]); } - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalPedestalsDiffBase + using EcalTPGLinearizationConstDiffOneTag = EcalTPGLinearizationConstBase; + using EcalTPGLinearizationConstDiffTwoTags = EcalTPGLinearizationConstBase; + using EcalTPGLinearizationConstRatioOneTag = EcalTPGLinearizationConstBase; + using EcalTPGLinearizationConstRatioTwoTags = EcalTPGLinearizationConstBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTPGLinearizationConst) { PAYLOAD_INSPECTOR_CLASS(EcalTPGLinearizationConstPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTPGLinearizationConstDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTPGLinearizationConstDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGLinearizationConstDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalTPGLinearizationConstRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGLinearizationConstRatioTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalTPGPedestals_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGPedestals_PayloadInspector.cc index 31af8100e6b80..f918fe1df145e 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGPedestals_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGPedestals_PayloadInspector.cc @@ -187,13 +187,12 @@ namespace { /****************************************************************** 2d plot of ECAL TPGPedestals difference between 2 IOVs ******************************************************************/ - class EcalTPGPedestalsDiff : public cond::payloadInspector::PlotImage { + template + class EcalTPGPedestalsBase : public cond::payloadInspector::PlotImage { public: - EcalTPGPedestalsDiff() : cond::payloadInspector::PlotImage("ECAL Gain Ratios difference") { - setSingleIov(false); - } - - bool fill(const std::vector >& iovs) override { + EcalTPGPedestalsBase() + : cond::payloadInspector::PlotImage("ECAL Gain Ratios comparison") {} + bool fill() override { TH2F** barrel_m = new TH2F*[kGains]; TH2F** endc_p_m = new TH2F*[kGains]; TH2F** endc_m_m = new TH2F*[kGains]; @@ -230,12 +229,31 @@ namespace { mEEmax[gainId] = -10.; } - unsigned int run[2], irun = 0; - //float gEB[3][kEBChannels], gEE[3][kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + unsigned int run[2]; + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { + float dr; for (int sign = 0; sign < kSides; sign++) { int thesign = sign == 1 ? 1 : -1; @@ -250,34 +268,64 @@ namespace { if (irun == 0) { mEB[0][hashindex] = val; } else { - float diff = val - mEB[0][hashindex]; - barrel_m[0]->Fill(iphi, y, diff); - if (diff < mEBmin[0]) - mEBmin[0] = diff; - if (diff > mEBmax[0]) - mEBmax[0] = diff; + if (method == 0) + dr = val - mEB[0][hashindex]; + else { + if (mEB[0][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEB[0][hashindex]; + } + barrel_m[0]->Fill(iphi, y, dr); + if (dr < mEBmin[0]) + mEBmin[0] = dr; + if (dr > mEBmax[0]) + mEBmax[0] = dr; } val = (*payload)[id.rawId()].mean_x6; if (irun == 0) { mEB[1][hashindex] = val; } else { - float diff = val - mEB[1][hashindex]; - barrel_m[1]->Fill(iphi, y, diff); - if (diff < mEBmin[1]) - mEBmin[1] = diff; - if (diff > mEBmax[1]) - mEBmax[1] = diff; + if (method == 0) + dr = val - mEB[1][hashindex]; + else { + if (mEB[1][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEB[1][hashindex]; + } + barrel_m[1]->Fill(iphi, y, dr); + if (dr < mEBmin[1]) + mEBmin[1] = dr; + if (dr > mEBmax[1]) + mEBmax[1] = dr; } val = (*payload)[id.rawId()].mean_x1; if (irun == 0) { mEB[2][hashindex] = val; } else { - float diff = val - mEB[2][hashindex]; - barrel_m[2]->Fill(iphi, y, diff); - if (diff < mEBmin[2]) - mEBmin[2] = diff; - if (diff > mEBmax[2]) - mEBmax[2] = diff; + if (method == 0) + dr = val - mEB[2][hashindex]; + else { + if (mEB[2][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEB[2][hashindex]; + } + barrel_m[2]->Fill(iphi, y, dr); + if (dr < mEBmin[2]) + mEBmin[2] = dr; + if (dr > mEBmax[2]) + mEBmax[2] = dr; } } // iphi } // ieta @@ -292,52 +340,81 @@ namespace { if (irun == 0) { mEE[0][hashindex] = val; } else { - float diff = val - mEE[0][hashindex]; + if (method == 0) + dr = val - mEE[0][hashindex]; + else { + if (mEE[0][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEE[0][hashindex]; + } if (thesign == 1) - endc_p_m[0]->Fill(ix + 1, iy + 1, diff); + endc_p_m[0]->Fill(ix + 1, iy + 1, dr); else - endc_m_m[0]->Fill(ix + 1, iy + 1, diff); - if (diff < mEEmin[0]) - mEEmin[0] = diff; - if (diff > mEEmax[0]) - mEEmax[0] = diff; + endc_m_m[0]->Fill(ix + 1, iy + 1, dr); + if (dr < mEEmin[0]) + mEEmin[0] = dr; + if (dr > mEEmax[0]) + mEEmax[0] = dr; } val = (*payload)[id.rawId()].mean_x6; if (irun == 0) { mEE[1][hashindex] = val; } else { - float diff = val - mEE[1][hashindex]; + if (method == 0) + dr = val - mEE[1][hashindex]; + else { + if (mEE[1][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEE[1][hashindex]; + } if (thesign == 1) - endc_p_m[1]->Fill(ix + 1, iy + 1, diff); + endc_p_m[1]->Fill(ix + 1, iy + 1, dr); else - endc_m_m[1]->Fill(ix + 1, iy + 1, diff); - if (diff < mEEmin[1]) - mEEmin[1] = diff; - if (diff > mEEmax[1]) - mEEmax[1] = diff; + endc_m_m[1]->Fill(ix + 1, iy + 1, dr); + if (dr < mEEmin[1]) + mEEmin[1] = dr; + if (dr > mEEmax[1]) + mEEmax[1] = dr; } val = (*payload)[id.rawId()].mean_x1; if (irun == 0) { mEE[2][hashindex] = val; } else { - float diff = val - mEE[2][hashindex]; + if (method == 0) + dr = val - mEE[2][hashindex]; + else { + if (mEE[2][hashindex] == 0.) { + if (val == 0.) + dr = 1.; + else + dr = 9999.; + } else + dr = val / mEE[2][hashindex]; + } if (thesign == 1) - endc_p_m[2]->Fill(ix + 1, iy + 1, diff); + endc_p_m[2]->Fill(ix + 1, iy + 1, dr); else - endc_m_m[2]->Fill(ix + 1, iy + 1, diff); - if (diff < mEEmin[2]) - mEEmin[2] = diff; - if (diff > mEEmax[2]) - mEEmax[2] = diff; + endc_m_m[2]->Fill(ix + 1, iy + 1, dr); + if (dr < mEEmin[2]) + mEEmin[2] = dr; + if (dr > mEEmax[2]) + mEEmax[2] = dr; } - // fout << " x " << ix << " y " << " diff " << diff << std::endl; + // fout << " x " << ix << " y " << " dr " << dr << std::endl; } // iy } // ix } // side } // if payload.get() else return false; - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -346,8 +423,23 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal TPGPedestals, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 150) { + t1.SetTextSize(0.03); + t1.DrawLatex( + 0.5, + 0.96, + Form("%s %i %s %s %i", l_tagname[1].c_str(), run[1], dr[method].c_str(), l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("Ecal TPGPedestals, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.22, 0.78}; float xma[3] = {0.22, 0.78, 1.00}; @@ -371,16 +463,23 @@ namespace { DrawEE(endc_p_m[gId], mEEmin[gId], mEEmax[gId]); } - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalTPGPedestalsDiffBase + using EcalTPGPedestalsDiffOneTag = EcalTPGPedestalsBase; + using EcalTPGPedestalsDiffTwoTags = EcalTPGPedestalsBase; + using EcalTPGPedestalsRatioOneTag = EcalTPGPedestalsBase; + using EcalTPGPedestalsRatioTwoTags = EcalTPGPedestalsBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTPGPedestals) { PAYLOAD_INSPECTOR_CLASS(EcalTPGPedestalsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTPGPedestalsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTPGPedestalsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGPedestalsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalTPGPedestalsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGPedestalsRatioTwoTags); } diff --git a/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc index aa2a866cf6fb3..ca67b4b597e55 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGStripStatus_PayloadInspector.cc @@ -161,13 +161,13 @@ namespace { /*************************************************************** 2d plot of ECAL TPGStripStatus difference between 2 IOVs ****************************************************************/ - class EcalTPGStripStatusDiff : public cond::payloadInspector::PlotImage { + template + class EcalTPGStripStatusDiffBase : public cond::payloadInspector::PlotImage { public: - EcalTPGStripStatusDiff() : cond::payloadInspector::PlotImage("ECAL TPGStripStatus difference") { - setSingleIov(false); - } + EcalTPGStripStatusDiffBase() + : cond::payloadInspector::PlotImage("ECAL TPGStripStatus difference") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* endc_p = new TH2F("EE+", "EE+ TPG Strip Status", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "EE- TPG Strip Status", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); int EEstat[2][2] = {{0, 0}, {0, 0}}; @@ -203,12 +203,31 @@ namespace { } // read EEMap file f.close(); - unsigned int run[2] = {0, 0}, irun = 0; + unsigned int run[2] = {0, 0}; int vEE[100]; int istat = 0; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { const EcalTPGStripStatusMap& stripMap = (*payload).getMap(); // std::cout << " tower map size " << stripMap.size() << std::endl; @@ -271,7 +290,6 @@ namespace { } // payload else return false; - irun++; // std::cout << " nb of strips " << istat << std::endl; } // loop over IOVs @@ -331,8 +349,19 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal TPGStripStatus, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2) { + if (len < 180) { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s %i - %s %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal TPGStripStatus, IOV %i - %i", run[1], run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); + } float xmi[2] = {0.0, 0.5}; float xma[2] = {0.5, 1.0}; @@ -350,11 +379,13 @@ namespace { DrawEE(endc_p, -1.0, 1.0); t1.DrawLatex(0.15, 0.92, Form("new %i old %i", EEstat[1][0], EEstat[1][1])); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalTPGStripStatusDiffBase + using EcalTPGStripStatusDiffOneTag = EcalTPGStripStatusDiffBase; + using EcalTPGStripStatusDiffTwoTags = EcalTPGStripStatusDiffBase; /***************************************** 2d plot of EcalTPGStripStatus Error Summary of 1 IOV @@ -434,6 +465,7 @@ namespace { // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTPGStripStatus) { PAYLOAD_INSPECTOR_CLASS(EcalTPGStripStatusPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTPGStripStatusDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTPGStripStatusDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGStripStatusDiffTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalTPGStripStatusSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalTPGTowerStatus_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTPGTowerStatus_PayloadInspector.cc index f6ce344533e53..24734b898d9d1 100644 --- a/CondCore/EcalPlugins/plugins/EcalTPGTowerStatus_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTPGTowerStatus_PayloadInspector.cc @@ -18,7 +18,7 @@ #include namespace { - enum { kEBTotalTowers = 2448, kEETotalTowers = 1584 }; + enum { kEBTotalTowers = 2448 }; enum { MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 17, MAX_IPHI = 72 }; // barrel lower and upper bounds on eta and phi /*********************************************** @@ -32,7 +32,7 @@ namespace { bool fill(const std::vector >& iovs) override { TH2F* barrel = new TH2F("EB", "EB TPG Tower Status", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); - int EBstat = 0, EEstat = 0; + int EBstat = 0; auto iov = iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); @@ -53,8 +53,7 @@ namespace { if (ttId.subDet() == 1) { // barrel barrel->Fill(iphi, ieta, (*it).second); EBstat++; - } else - EEstat++; + } } } } // payload @@ -80,7 +79,6 @@ namespace { } t1.SetTextSize(0.03); t1.DrawLatex(0.2, 0.88, Form("%i towers", EBstat)); - t1.DrawLatex(0.5, 0.02, Form("EE : %i tower(s)", EEstat)); // canvas.cd(); pad[0]->cd(); // barrel->SetStats(false); @@ -104,22 +102,40 @@ namespace { /************************************************************************ 2d plot of ECAL TPGTowerStatus difference between 2 IOVs ************************************************************************/ - class EcalTPGTowerStatusDiff : public cond::payloadInspector::PlotImage { + template + class EcalTPGTowerStatusDiffBase : public cond::payloadInspector::PlotImage { public: - EcalTPGTowerStatusDiff() : cond::payloadInspector::PlotImage("ECAL TPGTowerStatus difference") { - setSingleIov(false); - } + EcalTPGTowerStatusDiffBase() + : cond::payloadInspector::PlotImage("ECAL TPGTowerStatus difference") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "EB difference", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); // int EBstat[2] = {0, 0}; - int EBstat = 0, EEstat = 0; - - unsigned int run[2] = {0, 0}, irun = 0, vEB[kEBTotalTowers]; - // EcalTrigTowerDetId EBId[kEBTotalTowers]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); + int EBstat = 0; + + unsigned int run[2] = {0, 0}, vEB[kEBTotalTowers]; + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { const EcalTPGTowerStatusMap& towerMap = (*payload).getMap(); // std::cout << " tower map size " << towerMap.size() << std::endl; @@ -138,16 +154,8 @@ namespace { if (stat > 0) { // bad tower if (towerId >= kEBTotalTowers) std::cout << " strange tower Id " << towerId << std::endl; - else { - // std::cout << " phi " << iphi << " eta " << ieta << std::endl; - // EBId[towerId] = ttId; - } } - } // barrel - else if (stat > 0) { - // std::cout << " EE phi " << iphi << " eta " << ieta << std::endl; - EEstat--; - } + } // barrel } // 1st run else { // 2nd run if (ttId.subDet() == 1) { // barrel @@ -164,16 +172,11 @@ namespace { // vEB[towerId] = 0; EBstat += diff; } // barrel - else if (stat > 0) { - // std::cout << " EE phi " << iphi << " eta " << ieta << std::endl; - EEstat++; - } - } // 2nd run - } // loop over towers - } // payload + } // 2nd run + } // loop over towers + } // payload else return false; - irun++; } // loop over IOVs /* // now check if towers have disappered @@ -199,8 +202,20 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2) { + if (len < 80) { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s %i - %s %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal TPGTowerStatus, IOV %i - %i", run[1], run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); + } t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal TPGTowerStatus, IOV %i - %i", run[1], run[0])); TPad** pad = new TPad*; for (int obj = 0; obj < 1; obj++) { @@ -209,11 +224,10 @@ namespace { } t1.SetTextSize(0.03); t1.DrawLatex(0.2, 0.88, Form("%i tower(s)", EBstat)); - t1.DrawLatex(0.5, 0.02, Form("EE : %i tower(s)", EEstat)); pad[0]->cd(); // barrel->SetStats(false); - barrel->Draw("col"); + barrel->Draw("colz"); TLine* l = new TLine(0., 0., 0., 0.); l->SetLineWidth(1); for (int i = 0; i < MAX_IETA; i++) { @@ -224,15 +238,17 @@ namespace { l = new TLine(0., 0., 72., 0.); l->Draw(); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalTPGTowerStatusDiffBase + using EcalTPGTowerStatusDiffOneTag = EcalTPGTowerStatusDiffBase; + using EcalTPGTowerStatusDiffTwoTags = EcalTPGTowerStatusDiffBase; - /***************************************** - 2d plot of EcalTPGTowerStatus Error Summary of 1 IOV - ******************************************/ + /******************************************************* + 2d plot of EcalTPGTowerStatus Error Summary of 1 IOV + ********************************************************/ class EcalTPGTowerStatusSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalTPGTowerStatusSummaryPlot() @@ -308,6 +324,7 @@ namespace { // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTPGTowerStatus) { PAYLOAD_INSPECTOR_CLASS(EcalTPGTowerStatusPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTPGTowerStatusDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTPGTowerStatusDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTPGTowerStatusDiffTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalTPGTowerStatusSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalTimeBiasCorrections_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTimeBiasCorrections_PayloadInspector.cc index b1aa3294fdd5e..4f59eb779482e 100644 --- a/CondCore/EcalPlugins/plugins/EcalTimeBiasCorrections_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTimeBiasCorrections_PayloadInspector.cc @@ -20,9 +20,9 @@ namespace { - /******************************************************* - 2d plot of Ecal TimeBias Corrections of 1 IOV - *******************************************************/ + /**************************************************** + 2d plot of Ecal TimeBias Corrections of 1 IOV + ****************************************************/ class EcalTimeBiasCorrectionsPlot : public cond::payloadInspector::PlotImage { public: //void fillPlot_align(std::vector& vect,TH2F* align, float column, double row); @@ -114,33 +114,46 @@ std::cout< { + /******************************************************************** + 2d plot of Ecal Time Bias Corrections difference between 2 IOVs + ********************************************************************/ + template + class EcalTimeBiasCorrectionsDiffBase + : public cond::payloadInspector::PlotImage { public: - //void fillDiff_align(const std::vector& vect,TH2F* align,float val[],const float column, double row,unsigned irun); - - EcalTimeBiasCorrectionsDiff() - : cond::payloadInspector::PlotImage("Ecal Time Bias Corrections difference") { - setSingleIov(false); - } - - bool fill(const std::vector >& iovs) override { - unsigned int run[2], irun = 0; + EcalTimeBiasCorrectionsDiffBase() + : cond::payloadInspector::PlotImage( + "Ecal Time Bias Corrections difference") {} + bool fill() override { + unsigned int run[2], NbRows = 0; float val[4][36]; TH2F* align = new TH2F("", "", 1, 0., 1., 1, 0., 1.); // pseudo creation - int NbRows = 0; - - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { EcalTimeBiasCorrections it = (*payload); - NbRows = it.EBTimeCorrAmplitudeBins.size(); + NbRows = it.EBTimeCorrAmplitudeBins.size(); if (irun == 1) { align = new TH2F("Ecal Time Bias Corrections", @@ -164,7 +177,6 @@ std::cout<SetPalette(1); @@ -189,7 +201,7 @@ std::cout<GetYaxis()->SetTickLength(0.); align->GetYaxis()->SetLabelSize(0.); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; @@ -209,12 +221,15 @@ std::cout<; + using EcalTimeBiasCorrectionsDiffTwoTags = EcalTimeBiasCorrectionsDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTimeBiasCorrections) { PAYLOAD_INSPECTOR_CLASS(EcalTimeBiasCorrectionsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTimeBiasCorrectionsDiff); -} \ No newline at end of file + PAYLOAD_INSPECTOR_CLASS(EcalTimeBiasCorrectionsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTimeBiasCorrectionsDiffTwoTags); +} diff --git a/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc index 6f1132b27e679..4674dcb2dd5a6 100644 --- a/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTimeCalibConstants_PayloadInspector.cc @@ -91,11 +91,9 @@ namespace { } //fill method }; - /******************************************************* - + /*************************************************************** 2d histogram of ECAL EndCaps Time Calib Constants of 1 IOV - - *******************************************************/ + ***************************************************************/ class EcalTimeCalibConstantsEEMap : public cond::payloadInspector::Histogram2D { private: @@ -216,16 +214,16 @@ namespace { }; /***************************************************************** - 2d plot of Ecal Time Calib Constants difference between 2 IOVs + 2d plot of Ecal Time Calib Constants difference between 2 IOVs *****************************************************************/ - class EcalTimeCalibConstantsDiff : public cond::payloadInspector::PlotImage { + template + class EcalTimeCalibConstantsBase : public cond::payloadInspector::PlotImage { public: - EcalTimeCalibConstantsDiff() - : cond::payloadInspector::PlotImage("Ecal Time Calib Constants difference ") { - setSingleIov(false); - } + EcalTimeCalibConstantsBase() + : cond::payloadInspector::PlotImage( + "Ecal Time Calib Constants comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -235,27 +233,43 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -263,8 +277,23 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Time Calib Constants Diff, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 180) { + t1.SetTextSize(0.05); + t1.DrawLatex( + 0.5, + 0.96, + Form("%s %i %s %s %i", l_tagname[1].c_str(), run[1], dr[method].c_str(), l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal Time Calib Constants, IOV %i %s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; @@ -282,15 +311,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalTimeCalibConstantsDiffBase + using EcalTimeCalibConstantsDiffOneTag = EcalTimeCalibConstantsBase; + using EcalTimeCalibConstantsDiffTwoTags = EcalTimeCalibConstantsBase; + using EcalTimeCalibConstantsRatioOneTag = EcalTimeCalibConstantsBase; + using EcalTimeCalibConstantsRatioTwoTags = EcalTimeCalibConstantsBase; /******************************************************* - 2d plot of Ecal Time Calib Constants Summary of 1 IOV - *******************************************************/ + 2d plot of Ecal Time Calib Constants Summary of 1 IOV + *******************************************************/ class EcalTimeCalibConstantsSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalTimeCalibConstantsSummaryPlot() @@ -355,6 +388,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalTimeCalibConstants) { PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsEBMap); PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsEEMap); PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibConstantsSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc index 63105360713e9..6b227b7997577 100644 --- a/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTimeCalibErrors_PayloadInspector.cc @@ -218,14 +218,13 @@ namespace { /***************************************************************** 2d plot of Ecal Time Calib Errors difference between 2 IOVs *****************************************************************/ - class EcalTimeCalibErrorsDiff : public cond::payloadInspector::PlotImage { + template + class EcalTimeCalibErrorsBase : public cond::payloadInspector::PlotImage { public: - EcalTimeCalibErrorsDiff() - : cond::payloadInspector::PlotImage("Ecal Time Calib Errors difference ") { - setSingleIov(false); - } + EcalTimeCalibErrorsBase() + : cond::payloadInspector::PlotImage("Ecal Time Calib Errors comparison") {} - bool fill(const std::vector >& iovs) override { + bool fill() override { TH2F* barrel = new TH2F("EB", "mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); TH2F* endc_p = new TH2F("EE+", "mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); TH2F* endc_m = new TH2F("EE-", "mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1); @@ -235,27 +234,43 @@ namespace { pEBmax = -10.; pEEmax = -10.; - unsigned int run[2], irun = 0; + unsigned int run[2]; float pEB[kEBChannels], pEE[kEEChannels]; - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { if (payload->barrelItems().empty()) return false; - fillEBMap_DiffIOV(payload, barrel, irun, pEB, pEBmin, pEBmax); + fillEBMap_TwoIOVs(payload, barrel, irun, pEB, pEBmin, pEBmax, method); if (payload->endcapItems().empty()) return false; - fillEEMap_DiffIOV(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax); + fillEEMap_TwoIOVs(payload, endc_m, endc_p, irun, pEE, pEEmin, pEEmax, method); } // payload - irun++; - - } // loop over IOVs + } // loop over IOVs gStyle->SetPalette(1); gStyle->SetOptStat(0); @@ -263,9 +278,27 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); - t1.DrawLatex(0.5, 0.96, Form("Ecal Time Calib Errors Diff, IOV %i - %i", run[1], run[0])); - + int len = l_tagname[0].length() + l_tagname[1].length(); + std::string dr[2] = {"-", "/"}; + if (ntags == 2) { + if (len < 170) { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, + 0.96, + Form("%s IOV %i %s %s IOV %i", + l_tagname[1].c_str(), + run[1], + dr[method].c_str(), + l_tagname[0].c_str(), + run[0])); + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("Ecal Time Calib Errors, IOV %i%s %i", run[1], dr[method].c_str(), run[0])); + } + } else { + t1.SetTextSize(0.05); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i %s %i", l_tagname[0].c_str(), run[1], dr[method].c_str(), run[0])); + } float xmi[3] = {0.0, 0.24, 0.76}; float xma[3] = {0.24, 0.76, 1.00}; TPad** pad = new TPad*; @@ -282,15 +315,19 @@ namespace { pad[2]->cd(); DrawEE(endc_p, pEEmin, pEEmax); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); return true; } // fill method - }; + }; // class EcalTimeCalibErrorsDiffBase + using EcalTimeCalibErrorsDiffOneTag = EcalTimeCalibErrorsBase; + using EcalTimeCalibErrorsDiffTwoTags = EcalTimeCalibErrorsBase; + using EcalTimeCalibErrorsRatioOneTag = EcalTimeCalibErrorsBase; + using EcalTimeCalibErrorsRatioTwoTags = EcalTimeCalibErrorsBase; /******************************************************* - 2d plot of Ecal Time Calib Errors Summary of 1 IOV - *******************************************************/ + 2d plot of Ecal Time Calib Errors Summary of 1 IOV + *******************************************************/ class EcalTimeCalibErrorsSummaryPlot : public cond::payloadInspector::PlotImage { public: EcalTimeCalibErrorsSummaryPlot() @@ -355,6 +392,9 @@ PAYLOAD_INSPECTOR_MODULE(EcalTimeCalibErrors) { PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsEBMap); PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsEEMap); PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsDiffTwoTags); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsRatioOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsRatioTwoTags); PAYLOAD_INSPECTOR_CLASS(EcalTimeCalibErrorsSummaryPlot); } diff --git a/CondCore/EcalPlugins/plugins/EcalTimeOffsetConstant_PayloadInspector.cc b/CondCore/EcalPlugins/plugins/EcalTimeOffsetConstant_PayloadInspector.cc index 4310077535983..c353096ae6fc3 100644 --- a/CondCore/EcalPlugins/plugins/EcalTimeOffsetConstant_PayloadInspector.cc +++ b/CondCore/EcalPlugins/plugins/EcalTimeOffsetConstant_PayloadInspector.cc @@ -78,27 +78,43 @@ namespace { } }; - /******************************************************* - 2d plot of Ecal Time Offset Constant difference between 2 IOVs -*******************************************************/ - - class EcalTimeOffsetConstantDiff : public cond::payloadInspector::PlotImage { + /***************************************************************** + 2d plot of Ecal Time Offset Constant difference between 2 IOVs + *****************************************************************/ + template + class EcalTimeOffsetConstantDiffBase + : public cond::payloadInspector::PlotImage { public: - EcalTimeOffsetConstantDiff() - : cond::payloadInspector::PlotImage("Ecal Time Offset Constant difference") { - setSingleIov(false); - } + EcalTimeOffsetConstantDiffBase() + : cond::payloadInspector::PlotImage( + "Ecal Time Offset Constant difference") {} - bool fill(const std::vector >& iovs) override { - unsigned int run[2], irun = 0; + bool fill() override { + unsigned int run[2], NbRows = 0; float val[2] = {}; TH2F* align = new TH2F("", "", 1, 0., 1., 1, 0., 1.); // pseudo creation - int NbRows = 0; - - for (auto const& iov : iovs) { - std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - run[irun] = std::get<0>(iov); - + std::string l_tagname[2]; + auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs; + l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name; + auto firstiov = iovs.front(); + run[0] = std::get<0>(firstiov); + std::tuple lastiov; + if (ntags == 2) { + auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs; + l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name; + lastiov = tag2iovs.front(); + } else { + lastiov = iovs.back(); + l_tagname[1] = l_tagname[0]; + } + run[1] = std::get<0>(lastiov); + for (int irun = 0; irun < nIOVs; irun++) { + std::shared_ptr payload; + if (irun == 0) { + payload = this->fetchPayload(std::get<1>(firstiov)); + } else { + payload = this->fetchPayload(std::get<1>(lastiov)); + } if (payload.get()) { NbRows = 1; @@ -120,8 +136,6 @@ namespace { } // if payload.get() else return false; - - irun++; } // loop over IOVs gStyle->SetPalette(1); @@ -130,9 +144,20 @@ namespace { TLatex t1; t1.SetNDC(); t1.SetTextAlign(26); - t1.SetTextSize(0.05); t1.SetTextColor(2); - t1.DrawLatex(0.5, 0.96, Form("Ecal Time Offset Constant, IOV %i - %i", run[1], run[0])); + int len = l_tagname[0].length() + l_tagname[1].length(); + if (ntags == 2) { + if (len < 80) { + t1.SetTextSize(0.02); + t1.DrawLatex(0.5, 0.96, Form("%s %i - %s %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0])); + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("Ecal Time Offset Constant, IOV %i - %i", run[1], run[0])); + } + } else { + t1.SetTextSize(0.03); + t1.DrawLatex(0.5, 0.96, Form("%s, IOV %i - %i", l_tagname[0].c_str(), run[1], run[0])); + } TPad* pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94); pad->Draw(); @@ -146,17 +171,19 @@ namespace { align->GetYaxis()->SetTickLength(0.); align->GetYaxis()->SetLabelSize(0.); - std::string ImageName(m_imageFileName); + std::string ImageName(this->m_imageFileName); canvas.SaveAs(ImageName.c_str()); - return true; } - }; + }; // class EcalTimeOffsetConstantDiffBase + using EcalTimeOffsetConstantDiffOneTag = EcalTimeOffsetConstantDiffBase; + using EcalTimeOffsetConstantDiffTwoTags = EcalTimeOffsetConstantDiffBase; } // namespace // Register the classes as boost python plugin PAYLOAD_INSPECTOR_MODULE(EcalTimeOffsetConstant) { PAYLOAD_INSPECTOR_CLASS(EcalTimeOffsetConstantPlot); - PAYLOAD_INSPECTOR_CLASS(EcalTimeOffsetConstantDiff); + PAYLOAD_INSPECTOR_CLASS(EcalTimeOffsetConstantDiffOneTag); + PAYLOAD_INSPECTOR_CLASS(EcalTimeOffsetConstantDiffTwoTags); }