CMS 3D CMS Logo

EcalDQMChannelStatus_PayloadInspector.cc
Go to the documentation of this file.
4 
5 // the data format of the condition to be inspected
9 
10 #include <memory>
11 #include <sstream>
12 
13 #include "TStyle.h"
14 #include "TH2F.h"
15 #include "TCanvas.h"
16 #include "TLine.h"
17 #include "TLatex.h"
18 
19 namespace {
20  enum { kEBChannels = 61200, kEEChannels = 14648, NRGBs = 5, NCont = 255 };
21  enum { MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360 }; // barrel lower and upper bounds on eta and phi
22  enum { IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100 }; // endcaps lower and upper bounds on x and y
23 
24  /*******************************************************
25  2d plot of ECAL barrel DQM channel status of 1 IOV
26  *******************************************************/
27  class EcalDQMChannelStatusEBMap : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus> {
28  public:
29  EcalDQMChannelStatusEBMap()
30  : cond::payloadInspector::PlotImage<EcalDQMChannelStatus>("ECAL Barrel DQM channel status") {
31  setSingleIov(true);
32  }
33 
34  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
35  TH2F *ebmap = new TH2F(
36  "ebmap", "", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA); //drawing the whole map (barels)
37  TH2F *ebmap_coarse = new TH2F(
38  "ebmap_coarse", "", MAX_IPHI / 20, 0, MAX_IPHI, 2, -MAX_IETA, MAX_IETA); //drawing the halves (18 by 2)
39  Int_t ebcount = 0;
40  unsigned int run = 0;
41  // for ( auto const & iov: iovs) {
42  auto iov = iovs.front();
43  std::shared_ptr<EcalDQMChannelStatus> payload = fetchPayload(std::get<1>(iov));
44  run = std::get<0>(iov);
45 
46  if (payload.get()) {
47  // looping over the EB channels, via the dense-index, mapped into EBDetId's
48  if (payload->barrelItems().empty())
49  return false;
50  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
51  uint32_t rawid = EBDetId::unhashIndex(cellid);
52  // check the existence of ECAL channel status, for a given ECAL barrel channel
53  if (payload->find(rawid) == payload->end())
54  continue;
55  //if (!(*payload)[rawid].getEncodedStatusCode()) continue;
56  Double_t weight = (Double_t)(*payload)[rawid].getStatusCode();
57  Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
58  Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
59  if (eta > 0.)
60  eta = eta - 0.5; // 0.5 to 84.5
61  else
62  eta = eta + 0.5; // -84.5 to -0.5
63 
64  ebmap->Fill(phi, eta, weight);
65  if (weight > 0) {
66  ebcount++;
67  ebmap_coarse->Fill(phi, eta);
68  }
69  } // loop over cellid
70  } // if payload.get()
71  else
72  return false;
73 
74  gStyle->SetOptStat(0);
75  //set the background color to white
76  gStyle->SetFillColor(10);
77  gStyle->SetFrameFillColor(10);
78  gStyle->SetCanvasColor(10);
79  gStyle->SetPadColor(10);
80  gStyle->SetTitleFillColor(0);
81  gStyle->SetStatColor(10);
82  //dont put a colored frame around the plots
83  gStyle->SetFrameBorderMode(0);
84  gStyle->SetCanvasBorderMode(0);
85  gStyle->SetPadBorderMode(0);
86  //use the primary color palette
87  gStyle->SetPalette(1);
88 
89  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
90  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
91  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
92  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
93  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
94  gStyle->SetNumberContours(NCont);
95 
96  TCanvas c1("c1", "c1", 1200, 700);
97  c1.SetGridx(1);
98  c1.SetGridy(1);
99 
100  TLatex t1;
101  t1.SetNDC();
102  t1.SetTextAlign(26);
103  t1.SetTextSize(0.06);
104 
105  ebmap->SetXTitle("i#phi");
106  ebmap->SetYTitle("i#eta");
107  ebmap->GetXaxis()->SetNdivisions(-418, kFALSE);
108  ebmap->GetYaxis()->SetNdivisions(-1702, kFALSE);
109  ebmap->GetXaxis()->SetLabelSize(0.03);
110  ebmap->GetYaxis()->SetLabelSize(0.03);
111  ebmap->GetXaxis()->SetTickLength(0.01);
112  ebmap->GetYaxis()->SetTickLength(0.01);
113  ebmap->SetMaximum(15);
114 
115  c1.cd();
116  ebmap->Draw("colz");
117 
118  ebmap_coarse->SetMarkerSize(1.3);
119  ebmap_coarse->Draw("text,same");
120 
121  t1.SetTextSize(0.05);
122  t1.DrawLatex(0.5, 0.96, Form("EB DQM Channel Status, IOV %i", run));
123 
124  char txt[80];
125  Double_t prop = (Double_t)ebcount / kEBChannels * 100.;
126  sprintf(txt, "%d/61200 (%4.3f%%)", ebcount, prop);
127  t1.SetTextColor(2);
128  t1.SetTextSize(0.045);
129  t1.DrawLatex(0.5, 0.91, txt);
130 
131  std::string ImageName(m_imageFileName);
132  c1.SaveAs(ImageName.c_str());
133  return true;
134  }
135  };
136 
137  /*******************************************************
138  2d plot of ECAL Endcap DQM channel status of 1 IOV
139  *******************************************************/
140  class EcalDQMChannelStatusEEMap : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus> {
141  public:
142  EcalDQMChannelStatusEEMap()
143  : cond::payloadInspector::PlotImage<EcalDQMChannelStatus>("ECAL EndCaps DQM channel status") {
144  setSingleIov(true);
145  }
146 
147  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
148  //TH2F *eemap = new TH2F("eemap","", 2*IX_MAX, IX_MIN, 2*IX_MAX+1, IY_MAX, IY_MIN, IY_MAX+IY_MIN);
149  TH2F *eemap = new TH2F("eemap", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
150  TH2F *eemap_coarse = new TH2F("eemap_coarse", "", 2, 0, 2 * IX_MAX, 1, 0, IY_MAX);
151  TH2F *eetemp = new TH2F("eetemp", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
152 
153  Int_t eecount = 0;
154  unsigned int run = 0;
155  auto iov = iovs.front();
156  std::shared_ptr<EcalDQMChannelStatus> payload = fetchPayload(std::get<1>(iov));
157  run = std::get<0>(iov); //Time_t parameter
158 
159  if (payload.get()) {
160  if (payload->endcapItems().empty())
161  return false;
162 
163  // looping over the EE channels
164  for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1
165  for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
166  for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
167 
168  if (EEDetId::validDetId(ix, iy, iz)) {
169  EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
170  uint32_t rawid = myEEId.rawId();
171  // check the existence of ECAL channel status, for a given ECAL endcap channel
172  if (payload->find(rawid) == payload->end())
173  continue;
174  // if (!(*payload)[rawid].getEncodedStatusCode()) continue;
175  float weight = (float)(*payload)[rawid].getStatusCode();
176  if (iz == -1) {
177  // eemap->Fill(ix, iy, weight);
178  eemap->Fill(ix - 1, iy - 1, weight);
179  if (weight > 0) {
180  eecount++;
181  eemap_coarse->Fill(ix - 1, iy - 1);
182  }
183  } else {
184  // eemap->Fill(ix+IX_MAX, iy, weight);
185  eemap->Fill(ix + IX_MAX - 1, iy - 1, weight);
186  if (weight > 0) {
187  eecount++;
188  eemap_coarse->Fill(ix + IX_MAX - 1, iy - 1);
189  }
190  }
191  } // validDetId
192 
193  } // payload
194 
195  gStyle->SetOptStat(0);
196  //set the background color to white
197  gStyle->SetFillColor(10);
198  gStyle->SetFrameFillColor(10);
199  gStyle->SetCanvasColor(10);
200  gStyle->SetPadColor(10);
201  gStyle->SetTitleFillColor(0);
202  gStyle->SetStatColor(10);
203  //dont put a colored frame around the plots
204  gStyle->SetFrameBorderMode(0);
205  gStyle->SetCanvasBorderMode(0);
206  gStyle->SetPadBorderMode(0);
207  //use the primary color palette
208  gStyle->SetPalette(1);
209 
210  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
211  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
212  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
213  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
214  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
215  gStyle->SetNumberContours(NCont);
216 
217  // set the EE contours
218  for (Int_t i = 1; i <= IX_MAX; i++) {
219  for (Int_t j = 1; j <= IY_MAX; j++) {
220  if (EEDetId::validDetId(i, j, 1)) {
221  // eetemp->SetBinContent(i + 1, j + 1, 2);
222  // eetemp->SetBinContent(i + IX_MAX + 1, j +1, 2);
223  eetemp->SetBinContent(i, j, 2);
224  eetemp->SetBinContent(i + IX_MAX, j, 2);
225  }
226  }
227  }
228 
229  eetemp->SetFillColor(920);
230  TCanvas c1("c1", "c1", 1200, 600);
231  c1.SetGridx(1);
232  c1.SetGridy(1);
233 
234  TLatex t1;
235  t1.SetNDC();
236  t1.SetTextAlign(26);
237  t1.SetTextSize(0.06);
238 
239  eetemp->GetXaxis()->SetNdivisions(40, kFALSE);
240  eetemp->GetYaxis()->SetNdivisions(20, kFALSE);
241  eetemp->GetXaxis()->SetLabelSize(0.00);
242  eetemp->GetYaxis()->SetLabelSize(0.00);
243  eetemp->GetXaxis()->SetTickLength(0.01);
244  eetemp->GetYaxis()->SetTickLength(0.01);
245  eetemp->SetMaximum(1.15);
246 
247  eemap->GetXaxis()->SetNdivisions(40, kFALSE);
248  eemap->GetYaxis()->SetNdivisions(20, kFALSE);
249  eemap->GetXaxis()->SetLabelSize(0.00);
250  eemap->GetYaxis()->SetLabelSize(0.00);
251  eemap->GetXaxis()->SetTickLength(0.01);
252  eemap->GetYaxis()->SetTickLength(0.01);
253  eemap->SetMaximum(15);
254 
255  eetemp->Draw("box");
256  eemap->Draw("same,colz");
257 
258  eemap_coarse->SetMarkerSize(2);
259  eemap_coarse->Draw("same,text");
260 
261  t1.SetTextColor(1);
262  t1.SetTextSize(0.055);
263  t1.DrawLatex(0.5, 0.96, Form("EE DQM Channel Status, IOV %i", run));
264 
265  char txt[80];
266  Double_t prop = (Double_t)eecount / kEEChannels * 100.;
267  sprintf(txt, "%d/14648 (%4.3f%%)", eecount, prop);
268  t1.SetTextColor(2);
269  t1.SetTextSize(0.045);
270  t1.DrawLatex(0.5, 0.91, txt);
271  t1.SetTextColor(1);
272  t1.SetTextSize(0.05);
273  t1.DrawLatex(0.14, 0.84, "EE-");
274  t1.DrawLatex(0.86, 0.84, "EE+");
275 
276  std::string ImageName(m_imageFileName);
277  c1.SaveAs(ImageName.c_str());
278  return true;
279  }
280  };
281 
282  /**********************************************************************
283  2d plot of ECAL barrel DQM channel status difference between 2 IOVs
284  ***********************************************************************/
285  template <cond::payloadInspector::IOVMultiplicity nIOVs, int ntags>
286  class EcalDQMChannelStatusEBDiffBase : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags> {
287  public:
288  EcalDQMChannelStatusEBDiffBase()
289  : cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags>(
290  "ECAL Barrel DQM channel status difference") {}
291  bool fill() override {
292  TH2F *ebmap = new TH2F("ebmap", "", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
293  TH2F *ebmap_coarse = new TH2F("ebmap_coarse", "", MAX_IPHI / 20, 0, MAX_IPHI, 2, -MAX_IETA, MAX_IETA);
294  Int_t ebcount = 0;
295  unsigned int run[2], status[kEBChannels];
296  std::string l_tagname[2];
297  auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
298  l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name;
299  auto firstiov = iovs.front();
300  run[0] = std::get<0>(firstiov);
301  std::tuple<cond::Time_t, cond::Hash> lastiov;
302  if (ntags == 2) {
303  auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
304  l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name;
305  lastiov = tag2iovs.front();
306  } else {
307  lastiov = iovs.back();
308  l_tagname[1] = l_tagname[0];
309  }
310  run[1] = std::get<0>(lastiov);
311  for (int irun = 0; irun < nIOVs; irun++) {
312  std::shared_ptr<EcalDQMChannelStatus> payload;
313  if (irun == 0) {
314  payload = this->fetchPayload(std::get<1>(firstiov));
315  } else {
316  payload = this->fetchPayload(std::get<1>(lastiov));
317  }
318  if (payload.get()) {
319  // looping over the EB channels, via the dense-index, mapped into EBDetId's
320  if (payload->barrelItems().empty())
321  return false;
322  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
323  uint32_t rawid = EBDetId::unhashIndex(cellid);
324  // check the existence of ECAL channel status, for a given ECAL barrel channel
325  if (payload->find(rawid) == payload->end())
326  continue;
327 
328  if (irun == 0) {
329  status[cellid] = (*payload)[rawid].getStatusCode();
330  } else {
331  unsigned int new_status = (*payload)[rawid].getStatusCode();
332  if (new_status != status[cellid]) {
333  int tmp3 = 0;
334 
335  if (new_status > status[cellid])
336  tmp3 = 1;
337  else
338  tmp3 = -1;
339 
340  Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
341  Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
342  if (eta > 0.)
343  eta = eta - 0.5; // 0.5 to 84.5
344  else
345  eta = eta + 0.5; // -84.5 to -0.5
346 
347  ebmap->Fill(phi, eta, 0.05 + 0.95 * (tmp3 > 0));
348  ebcount++;
349  ebmap_coarse->Fill(phi, eta, tmp3);
350  }
351  }
352  } // loop over cellid
353  } // if payload.get()
354  else
355  return false;
356  } // loop over IOV's
357 
358  gStyle->SetOptStat(0);
359  //set the background color to white
360  gStyle->SetFillColor(10);
361  gStyle->SetFrameFillColor(10);
362  gStyle->SetCanvasColor(10);
363  gStyle->SetPadColor(10);
364  gStyle->SetTitleFillColor(0);
365  gStyle->SetStatColor(10);
366  //dont put a colored frame around the plots
367  gStyle->SetFrameBorderMode(0);
368  gStyle->SetCanvasBorderMode(0);
369  gStyle->SetPadBorderMode(0);
370  //use the primary color palette
371  gStyle->SetPalette(1);
372 
373  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
374  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
375  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
376  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
377  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
378  gStyle->SetNumberContours(NCont);
379 
380  TCanvas c1("c1", "c1", 1200, 700);
381  c1.SetGridx(1);
382  c1.SetGridy(1);
383 
384  TLatex t1;
385  t1.SetNDC();
386  t1.SetTextAlign(26);
387  t1.SetTextSize(0.06);
388 
389  ebmap->SetXTitle("i#phi");
390  ebmap->SetYTitle("i#eta");
391  ebmap->GetXaxis()->SetNdivisions(-418, kFALSE);
392  ebmap->GetYaxis()->SetNdivisions(-1702, kFALSE);
393  ebmap->GetXaxis()->SetLabelSize(0.03);
394  ebmap->GetYaxis()->SetLabelSize(0.03);
395  ebmap->GetXaxis()->SetTickLength(0.01);
396  ebmap->GetYaxis()->SetTickLength(0.01);
397  ebmap->SetMaximum(1.15);
398 
399  c1.cd();
400  ebmap->Draw("colz");
401 
402  ebmap_coarse->SetMarkerSize(1.3);
403  ebmap_coarse->Draw("text,same");
404 
405  int len = l_tagname[0].length() + l_tagname[1].length();
406  if (ntags == 2 && len < 58) {
407  t1.SetTextSize(0.025);
408  t1.DrawLatex(
409  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]));
410  } else {
411  t1.SetTextSize(0.05);
412  t1.DrawLatex(0.5, 0.96, Form("EB DQM Channel Status (Diff), IOV: %i vs %i", run[0], run[1]));
413  }
414  char txt[80];
415  sprintf(txt, "Net difference: %d channel(s)", ebcount);
416  t1.SetTextColor(2);
417  t1.SetTextSize(0.045);
418  t1.DrawLatex(0.5, 0.91, txt);
419 
420  std::string ImageName(this->m_imageFileName);
421  c1.SaveAs(ImageName.c_str());
422  return true;
423  } // fill method
424  }; // class EcalDQMChannelStatusEBDiffBase
425  using EcalDQMChannelStatusEBDiffOneTag = EcalDQMChannelStatusEBDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
426  using EcalDQMChannelStatusEBDiffTwoTags = EcalDQMChannelStatusEBDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
427 
428  /************************************************************************
429  2d plot of ECAL endcaps DQM channel status difference between 2 IOVs
430  ************************************************************************/
431  template <cond::payloadInspector::IOVMultiplicity nIOVs, int ntags>
432  class EcalDQMChannelStatusEEDiffBase : public cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags> {
433  public:
434  EcalDQMChannelStatusEEDiffBase()
435  : cond::payloadInspector::PlotImage<EcalDQMChannelStatus, nIOVs, ntags>(
436  "ECAL Endcaps DQM channel status difference") {}
437 
438  bool fill() override {
439  TH2F *eemap = new TH2F("eemap", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
440  TH2F *eemap_coarse = new TH2F("eemap_coarse", "", 2, 0, 2 * IX_MAX, 1, 0, IY_MAX);
441  TH2F *eetemp = new TH2F("eetemp", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
442  Int_t eecount = 0;
443  unsigned int run[2], status[kEEChannels];
444  std::string l_tagname[2];
445  auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
446  l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name;
447  auto firstiov = iovs.front();
448  run[0] = std::get<0>(firstiov);
449  std::tuple<cond::Time_t, cond::Hash> lastiov;
450  if (ntags == 2) {
451  auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
452  l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name;
453  lastiov = tag2iovs.front();
454  } else {
455  lastiov = iovs.back();
456  l_tagname[1] = l_tagname[0];
457  }
458  run[1] = std::get<0>(lastiov);
459  for (int irun = 0; irun < nIOVs; irun++) {
460  std::shared_ptr<EcalDQMChannelStatus> payload;
461  if (irun == 0) {
462  payload = this->fetchPayload(std::get<1>(firstiov));
463  } else {
464  payload = this->fetchPayload(std::get<1>(lastiov));
465  }
466  if (payload.get()) {
467  if (payload->endcapItems().empty())
468  return false;
469 
470  // looping over the EE channels
471  for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1
472  for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
473  for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
474  if (EEDetId::validDetId(ix, iy, iz)) {
475  EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
476  uint32_t rawid = myEEId.rawId();
477  int channel = myEEId.hashedIndex();
478  // check the existence of ECAL channel status, for a given ECAL endcap channel
479  if (payload->find(rawid) == payload->end())
480  continue;
481 
482  if (irun == 0) {
483  status[channel] = (*payload)[rawid].getStatusCode();
484  } else {
485  unsigned int new_status = (*payload)[rawid].getStatusCode();
486  if (new_status != status[channel]) {
487  int tmp3 = 0;
488  if (new_status > status[channel])
489  tmp3 = 1;
490  else
491  tmp3 = -1;
492 
493  if (iz == -1) {
494  eemap->Fill(ix - 1, iy - 1, 0.05 + 0.95 * (tmp3 > 0));
495  eecount++;
496  eemap_coarse->Fill(ix - 1, iy - 1, tmp3);
497  } else {
498  eemap->Fill(ix + IX_MAX - 1, iy - 1, 0.05 + 0.95 * (tmp3 > 0));
499  eecount++;
500  eemap_coarse->Fill(ix + IX_MAX - 1, iy - 1, tmp3);
501  } // z side
502  } // any difference ?
503  } // 2nd IOV, fill the plots
504  } // validDetId
505  } // get the payload
506  } // loop over payloads
507 
508  gStyle->SetOptStat(0);
509  //set the background color to white
510  gStyle->SetFillColor(10);
511  gStyle->SetFrameFillColor(10);
512  gStyle->SetCanvasColor(10);
513  gStyle->SetPadColor(10);
514  gStyle->SetTitleFillColor(0);
515  gStyle->SetStatColor(10);
516  //dont put a colored frame around the plots
517  gStyle->SetFrameBorderMode(0);
518  gStyle->SetCanvasBorderMode(0);
519  gStyle->SetPadBorderMode(0);
520  //use the primary color palette
521  gStyle->SetPalette(1);
522 
523  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
524  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
525  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
526  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
527  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
528  gStyle->SetNumberContours(NCont);
529 
530  // set the EE contours
531  for (Int_t i = 1; i <= IX_MAX; i++) {
532  for (Int_t j = 1; j <= IY_MAX; j++) {
533  if (EEDetId::validDetId(i, j, 1)) {
534  eetemp->SetBinContent(i, j, 2);
535  eetemp->SetBinContent(i + IX_MAX, j, 2);
536  }
537  }
538  }
539 
540  eetemp->SetFillColor(920);
541  TCanvas c1("c1", "c1", 1200, 600);
542  c1.SetGridx(1);
543  c1.SetGridy(1);
544 
545  TLatex t1;
546  t1.SetNDC();
547  t1.SetTextAlign(26);
548  t1.SetTextSize(0.06);
549 
550  eetemp->GetXaxis()->SetNdivisions(40, kFALSE);
551  eetemp->GetYaxis()->SetNdivisions(20, kFALSE);
552  eetemp->GetXaxis()->SetLabelSize(0.00);
553  eetemp->GetYaxis()->SetLabelSize(0.00);
554  eetemp->GetXaxis()->SetTickLength(0.01);
555  eetemp->GetYaxis()->SetTickLength(0.01);
556  eetemp->SetMaximum(1.15);
557 
558  eemap->GetXaxis()->SetNdivisions(40, kFALSE);
559  eemap->GetYaxis()->SetNdivisions(20, kFALSE);
560  eemap->GetXaxis()->SetLabelSize(0.00);
561  eemap->GetYaxis()->SetLabelSize(0.00);
562  eemap->GetXaxis()->SetTickLength(0.01);
563  eemap->GetYaxis()->SetTickLength(0.01);
564  eemap->SetMaximum(1.15);
565 
566  eetemp->Draw("box");
567  eemap->Draw("same,colz");
568 
569  eemap_coarse->SetMarkerSize(2);
570  eemap_coarse->Draw("same,text");
571 
572  t1.SetTextColor(1);
573  int len = l_tagname[0].length() + l_tagname[1].length();
574  if (ntags == 2 && len < 58) {
575  t1.SetTextSize(0.025);
576  t1.DrawLatex(
577  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]));
578  } else {
579  t1.SetTextSize(0.055);
580  t1.DrawLatex(0.5, 0.96, Form("EE DQM Channel Status (Diff), IOV %i vs %i", run[0], run[1]));
581  }
582  char txt[80];
583  sprintf(txt, "Net difference: %d channel(s)", eecount);
584  t1.SetTextColor(2);
585  t1.SetTextSize(0.045);
586  t1.DrawLatex(0.5, 0.91, txt);
587  t1.SetTextColor(1);
588  t1.SetTextSize(0.05);
589  t1.DrawLatex(0.14, 0.84, "EE-");
590  t1.DrawLatex(0.86, 0.84, "EE+");
591 
592  std::string ImageName(this->m_imageFileName);
593  c1.SaveAs(ImageName.c_str());
594  return true;
595  } // fill method
596  }; // class EcalDQMChannelStatusEEDiffBase
597  using EcalDQMChannelStatusEEDiffOneTag = EcalDQMChannelStatusEEDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
598  using EcalDQMChannelStatusEEDiffTwoTags = EcalDQMChannelStatusEEDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
599 
600 } // namespace
601 
602 // Register the classes as boost python plugin
604  PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBMap);
605  PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEMap);
606  PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiffOneTag);
607  PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEBDiffTwoTags);
608  PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiffOneTag);
609  PAYLOAD_INSPECTOR_CLASS(EcalDQMChannelStatusEEDiffTwoTags);
610 }
static const int XYMODE
Definition: EEDetId.h:335
Definition: weight.py:1
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
static const int MIN_HASH
Definition: EBDetId.h:149
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
Definition: plugin.cc:23
int hashedIndex() const
Definition: EEDetId.h:183
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)