CMS 3D CMS Logo

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