Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-04 04:34:35

0001 #include "CondCore/Utilities/interface/PayloadInspectorModule.h"
0002 #include "CondCore/Utilities/interface/PayloadInspector.h"
0003 #include "CondCore/CondDB/interface/Time.h"
0004 
0005 // the data format of the condition to be inspected
0006 #include "CondFormats/EcalObjects/interface/EcalDQMChannelStatus.h"
0007 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0008 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0009 
0010 #include <memory>
0011 #include <sstream>
0012 
0013 #include "TStyle.h"
0014 #include "TH2F.h"
0015 #include "TCanvas.h"
0016 #include "TLine.h"
0017 #include "TLatex.h"
0018 
0019 namespace {
0020   constexpr int kEBChannels = 61200, kEEChannels = 14648, NRGBs = 5, NCont = 255;
0021   constexpr int MAX_IETA = 85, MAX_IPHI = 360;                       // barrel lower and upper bounds on eta and phi
0022   constexpr int IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100;  // endcaps lower and upper bounds on x and y
0023 
0024   /*******************************************************
0025      2d plot of ECAL barrel DQM channel status of 1 IOV
0026   *******************************************************/
0027   class EcalDQMChannelStatusEBMap : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus> {
0028   public:
0029     EcalDQMChannelStatusEBMap()
0030         : cond::payloadInspector::PlotImage<EcalDQMChannelStatus>("ECAL Barrel DQM channel status") {
0031       setSingleIov(true);
0032     }
0033 
0034     bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
0035       TH2F *ebmap = new TH2F(
0036           "ebmap", "", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);  //drawing the whole map (barels)
0037       TH2F *ebmap_coarse = new TH2F(
0038           "ebmap_coarse", "", MAX_IPHI / 20, 0, MAX_IPHI, 2, -MAX_IETA, MAX_IETA);  //drawing the halves (18 by 2)
0039       Int_t ebcount = 0;
0040       unsigned int run = 0;
0041       //      for ( auto const & iov: iovs) {
0042       auto iov = iovs.front();
0043       std::shared_ptr<EcalDQMChannelStatus> payload = fetchPayload(std::get<1>(iov));
0044       run = std::get<0>(iov);
0045 
0046       if (payload.get()) {
0047         // looping over the EB channels, via the dense-index, mapped into EBDetId's
0048         if (payload->barrelItems().empty())
0049           return false;
0050         for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
0051           uint32_t rawid = EBDetId::unhashIndex(cellid);
0052           // check the existence of ECAL channel status, for a given ECAL barrel channel
0053           if (payload->find(rawid) == payload->end())
0054             continue;
0055           //if (!(*payload)[rawid].getEncodedStatusCode()) continue;
0056           Double_t weight = (Double_t)(*payload)[rawid].getStatusCode();
0057           Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
0058           Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
0059           if (eta > 0.)
0060             eta = eta - 0.5;  //   0.5 to 84.5
0061           else
0062             eta = eta + 0.5;  //  -84.5 to -0.5
0063 
0064           ebmap->Fill(phi, eta, weight);
0065           if (weight > 0) {
0066             ebcount++;
0067             ebmap_coarse->Fill(phi, eta);
0068           }
0069         }  // loop over cellid
0070       }    // if payload.get()
0071       else
0072         return false;
0073 
0074       gStyle->SetOptStat(0);
0075       //set the background color to white
0076       gStyle->SetFillColor(10);
0077       gStyle->SetFrameFillColor(10);
0078       gStyle->SetCanvasColor(10);
0079       gStyle->SetPadColor(10);
0080       gStyle->SetTitleFillColor(0);
0081       gStyle->SetStatColor(10);
0082       //dont put a colored frame around the plots
0083       gStyle->SetFrameBorderMode(0);
0084       gStyle->SetCanvasBorderMode(0);
0085       gStyle->SetPadBorderMode(0);
0086       //use the primary color palette
0087       gStyle->SetPalette(1);
0088 
0089       Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
0090       Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
0091       Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
0092       Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
0093       TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
0094       gStyle->SetNumberContours(NCont);
0095 
0096       TCanvas c1("c1", "c1", 1200, 700);
0097       c1.SetGridx(1);
0098       c1.SetGridy(1);
0099 
0100       TLatex t1;
0101       t1.SetNDC();
0102       t1.SetTextAlign(26);
0103       t1.SetTextSize(0.06);
0104 
0105       ebmap->SetXTitle("i#phi");
0106       ebmap->SetYTitle("i#eta");
0107       ebmap->GetXaxis()->SetNdivisions(-418, kFALSE);
0108       ebmap->GetYaxis()->SetNdivisions(-1702, kFALSE);
0109       ebmap->GetXaxis()->SetLabelSize(0.03);
0110       ebmap->GetYaxis()->SetLabelSize(0.03);
0111       ebmap->GetXaxis()->SetTickLength(0.01);
0112       ebmap->GetYaxis()->SetTickLength(0.01);
0113       ebmap->SetMaximum(15);
0114 
0115       c1.cd();
0116       ebmap->Draw("colz");
0117 
0118       ebmap_coarse->SetMarkerSize(1.3);
0119       ebmap_coarse->Draw("text,same");
0120 
0121       t1.SetTextSize(0.05);
0122       t1.DrawLatex(0.5, 0.96, Form("EB DQM Channel Status, IOV %i", run));
0123 
0124       char txt[80];
0125       Double_t prop = (Double_t)ebcount / kEBChannels * 100.;
0126       sprintf(txt, "%d/61200 (%4.3f%%)", ebcount, prop);
0127       t1.SetTextColor(2);
0128       t1.SetTextSize(0.045);
0129       t1.DrawLatex(0.5, 0.91, txt);
0130 
0131       std::string ImageName(m_imageFileName);
0132       c1.SaveAs(ImageName.c_str());
0133       return true;
0134     }
0135   };
0136 
0137   /*******************************************************
0138      2d plot of ECAL Endcap DQM channel status of 1 IOV
0139    *******************************************************/
0140   class EcalDQMChannelStatusEEMap : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus> {
0141   public:
0142     EcalDQMChannelStatusEEMap()
0143         : cond::payloadInspector::PlotImage<EcalDQMChannelStatus>("ECAL EndCaps DQM channel status") {
0144       setSingleIov(true);
0145     }
0146 
0147     bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
0148       //TH2F *eemap = new TH2F("eemap","", 2*IX_MAX, IX_MIN, 2*IX_MAX+1, IY_MAX, IY_MIN, IY_MAX+IY_MIN);
0149       TH2F *eemap = new TH2F("eemap", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
0150       TH2F *eemap_coarse = new TH2F("eemap_coarse", "", 2, 0, 2 * IX_MAX, 1, 0, IY_MAX);
0151       TH2F *eetemp = new TH2F("eetemp", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
0152 
0153       Int_t eecount = 0;
0154       unsigned int run = 0;
0155       auto iov = iovs.front();
0156       std::shared_ptr<EcalDQMChannelStatus> payload = fetchPayload(std::get<1>(iov));
0157       run = std::get<0>(iov);  //Time_t parameter
0158 
0159       if (payload.get()) {
0160         if (payload->endcapItems().empty())
0161           return false;
0162 
0163         // looping over the EE channels
0164         for (int iz = -1; iz < 2; iz = iz + 2)  // -1 or +1
0165           for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
0166             for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
0167 
0168               if (EEDetId::validDetId(ix, iy, iz)) {
0169                 EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
0170                 uint32_t rawid = myEEId.rawId();
0171                 // check the existence of ECAL channel status, for a given ECAL endcap channel
0172                 if (payload->find(rawid) == payload->end())
0173                   continue;
0174                 //        if (!(*payload)[rawid].getEncodedStatusCode()) continue;
0175                 float weight = (float)(*payload)[rawid].getStatusCode();
0176                 if (iz == -1) {
0177                   //          eemap->Fill(ix, iy, weight);
0178                   eemap->Fill(ix - 1, iy - 1, weight);
0179                   if (weight > 0) {
0180                     eecount++;
0181                     eemap_coarse->Fill(ix - 1, iy - 1);
0182                   }
0183                 } else {
0184                   //          eemap->Fill(ix+IX_MAX, iy, weight);
0185                   eemap->Fill(ix + IX_MAX - 1, iy - 1, weight);
0186                   if (weight > 0) {
0187                     eecount++;
0188                     eemap_coarse->Fill(ix + IX_MAX - 1, iy - 1);
0189                   }
0190                 }
0191               }  // validDetId
0192 
0193       }  // payload
0194 
0195       gStyle->SetOptStat(0);
0196       //set the background color to white
0197       gStyle->SetFillColor(10);
0198       gStyle->SetFrameFillColor(10);
0199       gStyle->SetCanvasColor(10);
0200       gStyle->SetPadColor(10);
0201       gStyle->SetTitleFillColor(0);
0202       gStyle->SetStatColor(10);
0203       //dont put a colored frame around the plots
0204       gStyle->SetFrameBorderMode(0);
0205       gStyle->SetCanvasBorderMode(0);
0206       gStyle->SetPadBorderMode(0);
0207       //use the primary color palette
0208       gStyle->SetPalette(1);
0209 
0210       Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
0211       Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
0212       Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
0213       Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
0214       TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
0215       gStyle->SetNumberContours(NCont);
0216 
0217       // set the EE contours
0218       for (Int_t i = 1; i <= IX_MAX; i++) {
0219         for (Int_t j = 1; j <= IY_MAX; j++) {
0220           if (EEDetId::validDetId(i, j, 1)) {
0221             //      eetemp->SetBinContent(i + 1, j + 1, 2);
0222             //      eetemp->SetBinContent(i + IX_MAX + 1, j +1, 2);
0223             eetemp->SetBinContent(i, j, 2);
0224             eetemp->SetBinContent(i + IX_MAX, j, 2);
0225           }
0226         }
0227       }
0228 
0229       eetemp->SetFillColor(920);
0230       TCanvas c1("c1", "c1", 1200, 600);
0231       c1.SetGridx(1);
0232       c1.SetGridy(1);
0233 
0234       TLatex t1;
0235       t1.SetNDC();
0236       t1.SetTextAlign(26);
0237       t1.SetTextSize(0.06);
0238 
0239       eetemp->GetXaxis()->SetNdivisions(40, kFALSE);
0240       eetemp->GetYaxis()->SetNdivisions(20, kFALSE);
0241       eetemp->GetXaxis()->SetLabelSize(0.00);
0242       eetemp->GetYaxis()->SetLabelSize(0.00);
0243       eetemp->GetXaxis()->SetTickLength(0.01);
0244       eetemp->GetYaxis()->SetTickLength(0.01);
0245       eetemp->SetMaximum(1.15);
0246 
0247       eemap->GetXaxis()->SetNdivisions(40, kFALSE);
0248       eemap->GetYaxis()->SetNdivisions(20, kFALSE);
0249       eemap->GetXaxis()->SetLabelSize(0.00);
0250       eemap->GetYaxis()->SetLabelSize(0.00);
0251       eemap->GetXaxis()->SetTickLength(0.01);
0252       eemap->GetYaxis()->SetTickLength(0.01);
0253       eemap->SetMaximum(15);
0254 
0255       eetemp->Draw("box");
0256       eemap->Draw("same,colz");
0257 
0258       eemap_coarse->SetMarkerSize(2);
0259       eemap_coarse->Draw("same,text");
0260 
0261       t1.SetTextColor(1);
0262       t1.SetTextSize(0.055);
0263       t1.DrawLatex(0.5, 0.96, Form("EE DQM Channel Status, IOV %i", run));
0264 
0265       char txt[80];
0266       Double_t prop = (Double_t)eecount / kEEChannels * 100.;
0267       sprintf(txt, "%d/14648 (%4.3f%%)", eecount, prop);
0268       t1.SetTextColor(2);
0269       t1.SetTextSize(0.045);
0270       t1.DrawLatex(0.5, 0.91, txt);
0271       t1.SetTextColor(1);
0272       t1.SetTextSize(0.05);
0273       t1.DrawLatex(0.14, 0.84, "EE-");
0274       t1.DrawLatex(0.86, 0.84, "EE+");
0275 
0276       std::string ImageName(m_imageFileName);
0277       c1.SaveAs(ImageName.c_str());
0278       return true;
0279     }
0280   };
0281 
0282   /**********************************************************************
0283      2d plot of ECAL barrel DQM channel status difference between 2 IOVs
0284   ***********************************************************************/
0285   template <cond::payloadInspector::IOVMultiplicity nIOVs, int ntags>
0286   class EcalDQMChannelStatusEBDiffBase : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags> {
0287   public:
0288     EcalDQMChannelStatusEBDiffBase()
0289         : cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags>(
0290               "ECAL Barrel DQM channel status difference") {}
0291     bool fill() override {
0292       TH2F *ebmap = new TH2F("ebmap", "", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
0293       TH2F *ebmap_coarse = new TH2F("ebmap_coarse", "", MAX_IPHI / 20, 0, MAX_IPHI, 2, -MAX_IETA, MAX_IETA);
0294       Int_t ebcount = 0;
0295       unsigned int run[2], status[kEBChannels];
0296       std::string l_tagname[2];
0297       auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
0298       l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name;
0299       auto firstiov = iovs.front();
0300       run[0] = std::get<0>(firstiov);
0301       std::tuple<cond::Time_t, cond::Hash> lastiov;
0302       if (ntags == 2) {
0303         auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
0304         l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name;
0305         lastiov = tag2iovs.front();
0306       } else {
0307         lastiov = iovs.back();
0308         l_tagname[1] = l_tagname[0];
0309       }
0310       run[1] = std::get<0>(lastiov);
0311       for (int irun = 0; irun < nIOVs; irun++) {
0312         std::shared_ptr<EcalDQMChannelStatus> payload;
0313         if (irun == 0) {
0314           payload = this->fetchPayload(std::get<1>(firstiov));
0315         } else {
0316           payload = this->fetchPayload(std::get<1>(lastiov));
0317         }
0318         if (payload.get()) {
0319           // looping over the EB channels, via the dense-index, mapped into EBDetId's
0320           if (payload->barrelItems().empty())
0321             return false;
0322           for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
0323             uint32_t rawid = EBDetId::unhashIndex(cellid);
0324             // check the existence of ECAL channel status, for a given ECAL barrel channel
0325             if (payload->find(rawid) == payload->end())
0326               continue;
0327 
0328             if (irun == 0) {
0329               status[cellid] = (*payload)[rawid].getStatusCode();
0330             } else {
0331               unsigned int new_status = (*payload)[rawid].getStatusCode();
0332               if (new_status != status[cellid]) {
0333                 int tmp3 = 0;
0334 
0335                 if (new_status > status[cellid])
0336                   tmp3 = 1;
0337                 else
0338                   tmp3 = -1;
0339 
0340                 Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
0341                 Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
0342                 if (eta > 0.)
0343                   eta = eta - 0.5;  //   0.5 to 84.5
0344                 else
0345                   eta = eta + 0.5;  //  -84.5 to -0.5
0346 
0347                 ebmap->Fill(phi, eta, 0.05 + 0.95 * (tmp3 > 0));
0348                 ebcount++;
0349                 ebmap_coarse->Fill(phi, eta, tmp3);
0350               }
0351             }
0352           }  // loop over cellid
0353         }    // if payload.get()
0354         else
0355           return false;
0356       }  // loop over IOV's
0357 
0358       gStyle->SetOptStat(0);
0359       //set the background color to white
0360       gStyle->SetFillColor(10);
0361       gStyle->SetFrameFillColor(10);
0362       gStyle->SetCanvasColor(10);
0363       gStyle->SetPadColor(10);
0364       gStyle->SetTitleFillColor(0);
0365       gStyle->SetStatColor(10);
0366       //dont put a colored frame around the plots
0367       gStyle->SetFrameBorderMode(0);
0368       gStyle->SetCanvasBorderMode(0);
0369       gStyle->SetPadBorderMode(0);
0370       //use the primary color palette
0371       gStyle->SetPalette(1);
0372 
0373       Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
0374       Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
0375       Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
0376       Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
0377       TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
0378       gStyle->SetNumberContours(NCont);
0379 
0380       TCanvas c1("c1", "c1", 1200, 700);
0381       c1.SetGridx(1);
0382       c1.SetGridy(1);
0383 
0384       TLatex t1;
0385       t1.SetNDC();
0386       t1.SetTextAlign(26);
0387       t1.SetTextSize(0.06);
0388 
0389       ebmap->SetXTitle("i#phi");
0390       ebmap->SetYTitle("i#eta");
0391       ebmap->GetXaxis()->SetNdivisions(-418, kFALSE);
0392       ebmap->GetYaxis()->SetNdivisions(-1702, kFALSE);
0393       ebmap->GetXaxis()->SetLabelSize(0.03);
0394       ebmap->GetYaxis()->SetLabelSize(0.03);
0395       ebmap->GetXaxis()->SetTickLength(0.01);
0396       ebmap->GetYaxis()->SetTickLength(0.01);
0397       ebmap->SetMaximum(1.15);
0398 
0399       c1.cd();
0400       ebmap->Draw("colz");
0401 
0402       ebmap_coarse->SetMarkerSize(1.3);
0403       ebmap_coarse->Draw("text,same");
0404 
0405       int len = l_tagname[0].length() + l_tagname[1].length();
0406       if (ntags == 2 && len < 58) {
0407         t1.SetTextSize(0.025);
0408         t1.DrawLatex(
0409             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]));
0410       } else {
0411         t1.SetTextSize(0.05);
0412         t1.DrawLatex(0.5, 0.96, Form("EB DQM Channel Status (Diff), IOV: %i vs %i", run[0], run[1]));
0413       }
0414       char txt[80];
0415       sprintf(txt, "Net difference: %d channel(s)", ebcount);
0416       t1.SetTextColor(2);
0417       t1.SetTextSize(0.045);
0418       t1.DrawLatex(0.5, 0.91, txt);
0419 
0420       std::string ImageName(this->m_imageFileName);
0421       c1.SaveAs(ImageName.c_str());
0422       return true;
0423     }  // fill method
0424   };   // class EcalDQMChannelStatusEBDiffBase
0425   using EcalDQMChannelStatusEBDiffOneTag = EcalDQMChannelStatusEBDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
0426   using EcalDQMChannelStatusEBDiffTwoTags = EcalDQMChannelStatusEBDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
0427 
0428   /************************************************************************
0429       2d plot of ECAL endcaps DQM channel status difference between 2 IOVs
0430   ************************************************************************/
0431   template <cond::payloadInspector::IOVMultiplicity nIOVs, int ntags>
0432   class EcalDQMChannelStatusEEDiffBase : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags> {
0433   public:
0434     EcalDQMChannelStatusEEDiffBase()
0435         : cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags>(
0436               "ECAL Endcaps DQM channel status difference") {}
0437 
0438     bool fill() override {
0439       TH2F *eemap = new TH2F("eemap", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
0440       TH2F *eemap_coarse = new TH2F("eemap_coarse", "", 2, 0, 2 * IX_MAX, 1, 0, IY_MAX);
0441       TH2F *eetemp = new TH2F("eetemp", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
0442       Int_t eecount = 0;
0443       unsigned int run[2], status[kEEChannels];
0444       std::string l_tagname[2];
0445       auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
0446       l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name;
0447       auto firstiov = iovs.front();
0448       run[0] = std::get<0>(firstiov);
0449       std::tuple<cond::Time_t, cond::Hash> lastiov;
0450       if (ntags == 2) {
0451         auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
0452         l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name;
0453         lastiov = tag2iovs.front();
0454       } else {
0455         lastiov = iovs.back();
0456         l_tagname[1] = l_tagname[0];
0457       }
0458       run[1] = std::get<0>(lastiov);
0459       for (int irun = 0; irun < nIOVs; irun++) {
0460         std::shared_ptr<EcalDQMChannelStatus> payload;
0461         if (irun == 0) {
0462           payload = this->fetchPayload(std::get<1>(firstiov));
0463         } else {
0464           payload = this->fetchPayload(std::get<1>(lastiov));
0465         }
0466         if (payload.get()) {
0467           if (payload->endcapItems().empty())
0468             return false;
0469 
0470           // looping over the EE channels
0471           for (int iz = -1; iz < 2; iz = iz + 2)  // -1 or +1
0472             for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
0473               for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
0474                 if (EEDetId::validDetId(ix, iy, iz)) {
0475                   EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
0476                   uint32_t rawid = myEEId.rawId();
0477                   int channel = myEEId.hashedIndex();
0478                   // check the existence of ECAL channel status, for a given ECAL endcap channel
0479                   if (payload->find(rawid) == payload->end())
0480                     continue;
0481 
0482                   if (irun == 0) {
0483                     status[channel] = (*payload)[rawid].getStatusCode();
0484                   } else {
0485                     unsigned int new_status = (*payload)[rawid].getStatusCode();
0486                     if (new_status != status[channel]) {
0487                       int tmp3 = 0;
0488                       if (new_status > status[channel])
0489                         tmp3 = 1;
0490                       else
0491                         tmp3 = -1;
0492 
0493                       if (iz == -1) {
0494                         eemap->Fill(ix - 1, iy - 1, 0.05 + 0.95 * (tmp3 > 0));
0495                         eecount++;
0496                         eemap_coarse->Fill(ix - 1, iy - 1, tmp3);
0497                       } else {
0498                         eemap->Fill(ix + IX_MAX - 1, iy - 1, 0.05 + 0.95 * (tmp3 > 0));
0499                         eecount++;
0500                         eemap_coarse->Fill(ix + IX_MAX - 1, iy - 1, tmp3);
0501                       }  // z side
0502                     }    //  any difference ?
0503                   }      //   2nd IOV, fill the plots
0504                 }        //    validDetId
0505         }                //     get the payload
0506       }                  //      loop over payloads
0507 
0508       gStyle->SetOptStat(0);
0509       //set the background color to white
0510       gStyle->SetFillColor(10);
0511       gStyle->SetFrameFillColor(10);
0512       gStyle->SetCanvasColor(10);
0513       gStyle->SetPadColor(10);
0514       gStyle->SetTitleFillColor(0);
0515       gStyle->SetStatColor(10);
0516       //dont put a colored frame around the plots
0517       gStyle->SetFrameBorderMode(0);
0518       gStyle->SetCanvasBorderMode(0);
0519       gStyle->SetPadBorderMode(0);
0520       //use the primary color palette
0521       gStyle->SetPalette(1);
0522 
0523       Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
0524       Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
0525       Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
0526       Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
0527       TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
0528       gStyle->SetNumberContours(NCont);
0529 
0530       // set the EE contours
0531       for (Int_t i = 1; i <= IX_MAX; i++) {
0532         for (Int_t j = 1; j <= IY_MAX; j++) {
0533           if (EEDetId::validDetId(i, j, 1)) {
0534             eetemp->SetBinContent(i, j, 2);
0535             eetemp->SetBinContent(i + IX_MAX, j, 2);
0536           }
0537         }
0538       }
0539 
0540       eetemp->SetFillColor(920);
0541       TCanvas c1("c1", "c1", 1200, 600);
0542       c1.SetGridx(1);
0543       c1.SetGridy(1);
0544 
0545       TLatex t1;
0546       t1.SetNDC();
0547       t1.SetTextAlign(26);
0548       t1.SetTextSize(0.06);
0549 
0550       eetemp->GetXaxis()->SetNdivisions(40, kFALSE);
0551       eetemp->GetYaxis()->SetNdivisions(20, kFALSE);
0552       eetemp->GetXaxis()->SetLabelSize(0.00);
0553       eetemp->GetYaxis()->SetLabelSize(0.00);
0554       eetemp->GetXaxis()->SetTickLength(0.01);
0555       eetemp->GetYaxis()->SetTickLength(0.01);
0556       eetemp->SetMaximum(1.15);
0557 
0558       eemap->GetXaxis()->SetNdivisions(40, kFALSE);
0559       eemap->GetYaxis()->SetNdivisions(20, kFALSE);
0560       eemap->GetXaxis()->SetLabelSize(0.00);
0561       eemap->GetYaxis()->SetLabelSize(0.00);
0562       eemap->GetXaxis()->SetTickLength(0.01);
0563       eemap->GetYaxis()->SetTickLength(0.01);
0564       eemap->SetMaximum(1.15);
0565 
0566       eetemp->Draw("box");
0567       eemap->Draw("same,colz");
0568 
0569       eemap_coarse->SetMarkerSize(2);
0570       eemap_coarse->Draw("same,text");
0571 
0572       t1.SetTextColor(1);
0573       int len = l_tagname[0].length() + l_tagname[1].length();
0574       if (ntags == 2 && len < 58) {
0575         t1.SetTextSize(0.025);
0576         t1.DrawLatex(
0577             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]));
0578       } else {
0579         t1.SetTextSize(0.055);
0580         t1.DrawLatex(0.5, 0.96, Form("EE DQM Channel Status (Diff), IOV %i vs %i", run[0], run[1]));
0581       }
0582       char txt[80];
0583       sprintf(txt, "Net difference: %d channel(s)", eecount);
0584       t1.SetTextColor(2);
0585       t1.SetTextSize(0.045);
0586       t1.DrawLatex(0.5, 0.91, txt);
0587       t1.SetTextColor(1);
0588       t1.SetTextSize(0.05);
0589       t1.DrawLatex(0.14, 0.84, "EE-");
0590       t1.DrawLatex(0.86, 0.84, "EE+");
0591 
0592       std::string ImageName(this->m_imageFileName);
0593       c1.SaveAs(ImageName.c_str());
0594       return true;
0595     }  // fill method
0596   };   // class EcalDQMChannelStatusEEDiffBase
0597   using EcalDQMChannelStatusEEDiffOneTag = EcalDQMChannelStatusEEDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
0598   using EcalDQMChannelStatusEEDiffTwoTags = EcalDQMChannelStatusEEDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
0599 
0600 }  // namespace
0601 
0602 // Register the classes as boost python plugin
0603 PAYLOAD_INSPECTOR_MODULE(EcalDQMChannelStatus) {
0604   PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBMap);
0605   PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEMap);
0606   PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiffOneTag);
0607   PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiffTwoTags);
0608   PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiffOneTag);
0609   PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiffTwoTags);
0610 }