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  template <cond::payloadInspector::IOVMultiplicity nIOVs, int ntags>
275  class EcalChannelStatusEBDiffBase : public cond::payloadInspector::PlotImage<EcalChannelStatus, nIOVs, ntags> {
276  public:
277  EcalChannelStatusEBDiffBase()
278  : cond::payloadInspector::PlotImage<EcalChannelStatus, nIOVs, ntags>("ECAL Barrel channel status difference") {}
279  bool fill() override {
280  TH2F *ebmap = new TH2F("ebmap", "", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
281  TH2F *ebmap_coarse = new TH2F("ebmap_coarse", "", MAX_IPHI / 20, 0, MAX_IPHI, 2, -MAX_IETA, MAX_IETA);
282  Int_t ebcount = 0;
283  unsigned int run[2] = {0, 0}, status[kEBChannels];
284  std::string l_tagname[2];
285  auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
286  l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name;
287  auto firstiov = iovs.front();
288  run[0] = std::get<0>(firstiov);
289  std::tuple<cond::Time_t, cond::Hash> lastiov;
290  if (ntags == 2) {
291  auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
292  l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name;
293  lastiov = tag2iovs.front();
294  } else {
295  lastiov = iovs.back();
296  l_tagname[1] = l_tagname[0];
297  }
298  run[1] = std::get<0>(lastiov);
299  for (int irun = 0; irun < nIOVs; irun++) {
300  std::shared_ptr<EcalChannelStatus> payload;
301  if (irun == 0) {
302  payload = this->fetchPayload(std::get<1>(firstiov));
303  } else {
304  payload = this->fetchPayload(std::get<1>(lastiov));
305  }
306  if (payload.get()) {
307  // looping over the EB channels, via the dense-index, mapped into EBDetId's
308  if (payload->barrelItems().empty())
309  return false;
310  for (int cellid = EBDetId::MIN_HASH; cellid < EBDetId::kSizeForDenseIndexing; ++cellid) {
311  uint32_t rawid = EBDetId::unhashIndex(cellid);
312  // check the existence of ECAL channel status, for a given ECAL barrel channel
313  if (payload->find(rawid) == payload->end())
314  continue;
315  // if (!(*payload)[rawid].getEncodedStatusCode()) continue;
316  if (irun == 0) {
317  status[cellid] = (*payload)[rawid].getEncodedStatusCode();
318  } else {
319  unsigned int new_status = (*payload)[rawid].getEncodedStatusCode();
320  if (new_status != status[cellid]) {
321  int tmp3 = 0;
322  if (new_status > status[cellid])
323  tmp3 = 1;
324  else
325  tmp3 = -1;
326  Double_t phi = (Double_t)(EBDetId(rawid)).iphi() - 0.5;
327  Double_t eta = (Double_t)(EBDetId(rawid)).ieta();
328  if (eta > 0.)
329  eta = eta - 0.5; // 0.5 to 84.5
330  else
331  eta = eta + 0.5; // -84.5 to -0.5
332  ebmap->Fill(phi, eta, 0.05 + 0.95 * (tmp3 > 0));
333  ebcount++;
334  ebmap_coarse->Fill(phi, eta, tmp3);
335  }
336  }
337  } // loop over cellid
338  } // if payload.get()
339  else
340  return false;
341  } // loop over IOV's
342 
343  gStyle->SetOptStat(0);
344  //set the background color to white
345  gStyle->SetFillColor(10);
346  gStyle->SetFrameFillColor(10);
347  gStyle->SetCanvasColor(10);
348  gStyle->SetPadColor(10);
349  gStyle->SetTitleFillColor(0);
350  gStyle->SetStatColor(10);
351  //dont put a colored frame around the plots
352  gStyle->SetFrameBorderMode(0);
353  gStyle->SetCanvasBorderMode(0);
354  gStyle->SetPadBorderMode(0);
355  //use the primary color palette
356  gStyle->SetPalette(1);
357 
358  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
359  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
360  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
361  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
362  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
363  gStyle->SetNumberContours(NCont);
364 
365  TCanvas c1("c1", "c1", 1200, 700);
366  c1.SetGridx(1);
367  c1.SetGridy(1);
368 
369  TLatex t1;
370  t1.SetNDC();
371  t1.SetTextAlign(26);
372  t1.SetTextSize(0.06);
373 
374  ebmap->SetXTitle("i#phi");
375  ebmap->SetYTitle("i#eta");
376  ebmap->GetXaxis()->SetNdivisions(-418, kFALSE);
377  ebmap->GetYaxis()->SetNdivisions(-1702, kFALSE);
378  ebmap->GetXaxis()->SetLabelSize(0.03);
379  ebmap->GetYaxis()->SetLabelSize(0.03);
380  ebmap->GetXaxis()->SetTickLength(0.01);
381  ebmap->GetYaxis()->SetTickLength(0.01);
382  ebmap->SetMaximum(1.15);
383 
384  c1.cd();
385  ebmap->Draw("colz");
386 
387  ebmap_coarse->SetMarkerSize(1.3);
388  ebmap_coarse->Draw("text,same");
389 
390  int len = l_tagname[0].length() + l_tagname[1].length();
391  if (ntags == 2 && len < 60) {
392  t1.SetTextSize(0.03);
393  t1.DrawLatex(0.5,
394  0.96,
395  Form("EB Channel Status Masks (Diff), %s IOV %i - %s IOV %i",
396  l_tagname[1].c_str(),
397  run[1],
398  l_tagname[0].c_str(),
399  run[0]));
400  } else {
401  t1.SetTextSize(0.05);
402  t1.DrawLatex(0.5, 0.96, Form("EB Channel Status Masks (Diff), IOV: %i vs %i", run[0], run[1]));
403  }
404 
405  char txt[80];
406  sprintf(txt, "Net difference: %d channel(s)", ebcount);
407  t1.SetTextColor(2);
408  t1.SetTextSize(0.045);
409  t1.DrawLatex(0.5, 0.91, txt);
410 
411  std::string ImageName(this->m_imageFileName);
412  c1.SaveAs(ImageName.c_str());
413  return true;
414  } // fill method
415  };
416  using EcalChannelStatusEBDiffOneTag = EcalChannelStatusEBDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
417  using EcalChannelStatusEBDiffTwoTags = EcalChannelStatusEBDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
418 
419  /************************************************************************
420  2d plot of ECAL endcaps channel status difference between 2 IOVs
421  ************************************************************************/
422  template <cond::payloadInspector::IOVMultiplicity nIOVs, int ntags>
423  class EcalChannelStatusEEDiffBase : public cond::payloadInspector::PlotImage<EcalChannelStatus, nIOVs, ntags> {
424  public:
425  EcalChannelStatusEEDiffBase()
426  : cond::payloadInspector::PlotImage<EcalChannelStatus, nIOVs, ntags>("ECAL Endcaps channel status difference") {
427  }
428  bool fill() override {
429  TH2F *eemap = new TH2F("eemap", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
430  TH2F *eemap_coarse = new TH2F("eemap_coarse", "", 2, 0, 2 * IX_MAX, 1, 0, IY_MAX);
431  TH2F *eetemp = new TH2F("eetemp", "", 2 * IX_MAX, 0, 2 * IX_MAX, IY_MAX, 0, IY_MAX);
432  Int_t eecount = 0;
433  unsigned int run[2]{0, 0}, status[kEEChannels];
434  std::string l_tagname[2];
435  auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
436  l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().name;
437  auto firstiov = iovs.front();
438  run[0] = std::get<0>(firstiov);
439  std::tuple<cond::Time_t, cond::Hash> lastiov;
440  if (ntags == 2) {
441  auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
442  l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().name;
443  lastiov = tag2iovs.front();
444  lastiov = tag2iovs.front();
445  } else {
446  lastiov = iovs.back();
447  l_tagname[1] = l_tagname[0];
448  }
449  run[1] = std::get<0>(lastiov);
450  for (int irun = 0; irun < nIOVs; irun++) {
451  std::shared_ptr<EcalChannelStatus> payload;
452  if (irun == 0) {
453  payload = this->fetchPayload(std::get<1>(firstiov));
454  } else {
455  payload = this->fetchPayload(std::get<1>(lastiov));
456  }
457  if (payload.get()) {
458  if (payload->endcapItems().empty())
459  return false;
460 
461  // looping over the EE channels
462  for (int iz = -1; iz < 2; iz = iz + 2) // -1 or +1
463  for (int iy = IY_MIN; iy < IY_MAX + IY_MIN; iy++)
464  for (int ix = IX_MIN; ix < IX_MAX + IX_MIN; ix++)
465  if (EEDetId::validDetId(ix, iy, iz)) {
466  EEDetId myEEId = EEDetId(ix, iy, iz, EEDetId::XYMODE);
467  uint32_t rawid = myEEId.rawId();
468  int channel = myEEId.hashedIndex();
469  // check the existence of ECAL channel status, for a given ECAL endcap channel
470  if (payload->find(rawid) == payload->end())
471  continue;
472  if (irun == 0) {
473  status[channel] = (*payload)[rawid].getEncodedStatusCode();
474  } else {
475  unsigned int new_status = (*payload)[rawid].getEncodedStatusCode();
476  if (new_status != status[channel]) {
477  int tmp3 = 0;
478  if (new_status > status[channel])
479  tmp3 = 1;
480  else
481  tmp3 = -1;
482  if (iz == -1) {
483  eemap->Fill(ix - 1, iy - 1, 0.05 + 0.95 * (tmp3 > 0));
484  eecount++;
485  eemap_coarse->Fill(ix - 1, iy - 1, tmp3);
486  } else {
487  eemap->Fill(ix + IX_MAX - 1, iy - 1, 0.05 + 0.95 * (tmp3 > 0));
488  eecount++;
489  eemap_coarse->Fill(ix + IX_MAX - 1, iy - 1, tmp3);
490  } // z side
491  } // any difference ?
492  } // 2nd IOV, fill the plots
493  } // validDetId
494  } // get the payload
495  } // loop over payloads
496 
497  gStyle->SetOptStat(0);
498  //set the background color to white
499  gStyle->SetFillColor(10);
500  gStyle->SetFrameFillColor(10);
501  gStyle->SetCanvasColor(10);
502  gStyle->SetPadColor(10);
503  gStyle->SetTitleFillColor(0);
504  gStyle->SetStatColor(10);
505  //dont put a colored frame around the plots
506  gStyle->SetFrameBorderMode(0);
507  gStyle->SetCanvasBorderMode(0);
508  gStyle->SetPadBorderMode(0);
509  //use the primary color palette
510  gStyle->SetPalette(1);
511 
512  Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
513  Double_t red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
514  Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
515  Double_t blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
516  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
517  gStyle->SetNumberContours(NCont);
518 
519  // set the EE contours
520  for (Int_t i = 1; i <= IX_MAX; i++) {
521  for (Int_t j = 1; j <= IY_MAX; j++) {
522  if (EEDetId::validDetId(i, j, 1)) {
523  eetemp->SetBinContent(i, j, 2);
524  eetemp->SetBinContent(i + IX_MAX, j, 2);
525  }
526  }
527  }
528 
529  eetemp->SetFillColor(920);
530  TCanvas c1("c1", "c1", 1200, 600);
531  c1.SetGridx(1);
532  c1.SetGridy(1);
533 
534  TLatex t1;
535  t1.SetNDC();
536  t1.SetTextAlign(26);
537  t1.SetTextSize(0.06);
538 
539  eetemp->GetXaxis()->SetNdivisions(40, kFALSE);
540  eetemp->GetYaxis()->SetNdivisions(20, kFALSE);
541  eetemp->GetXaxis()->SetLabelSize(0.00);
542  eetemp->GetYaxis()->SetLabelSize(0.00);
543  eetemp->GetXaxis()->SetTickLength(0.01);
544  eetemp->GetYaxis()->SetTickLength(0.01);
545  eetemp->SetMaximum(1.15);
546 
547  eemap->GetXaxis()->SetNdivisions(40, kFALSE);
548  eemap->GetYaxis()->SetNdivisions(20, kFALSE);
549  eemap->GetXaxis()->SetLabelSize(0.00);
550  eemap->GetYaxis()->SetLabelSize(0.00);
551  eemap->GetXaxis()->SetTickLength(0.01);
552  eemap->GetYaxis()->SetTickLength(0.01);
553  eemap->SetMaximum(1.15);
554 
555  eetemp->Draw("box");
556  eemap->Draw("same,colz");
557 
558  eemap_coarse->SetMarkerSize(2);
559  eemap_coarse->Draw("same,text");
560 
561  t1.SetTextColor(1);
562  int len = l_tagname[0].length() + l_tagname[1].length();
563  if (ntags == 2 && len < 60) {
564  t1.SetTextSize(0.03);
565  t1.DrawLatex(0.5,
566  0.96,
567  Form("EE Channel Status Masks (Diff), %s IOV %i - %s IOV %i",
568  l_tagname[1].c_str(),
569  run[1],
570  l_tagname[0].c_str(),
571  run[0]));
572  } else {
573  t1.SetTextSize(0.05);
574  t1.DrawLatex(0.5, 0.96, Form("EE Channel Status Masks (Diff), IOV %i vs %i", run[0], run[1]));
575  }
576 
577  char txt[80];
578  sprintf(txt, "Net difference: %d channel(s)", eecount);
579  t1.SetTextColor(2);
580  t1.SetTextSize(0.045);
581  t1.DrawLatex(0.5, 0.91, txt);
582  t1.SetTextColor(1);
583  t1.SetTextSize(0.05);
584  t1.DrawLatex(0.14, 0.84, "EE-");
585  t1.DrawLatex(0.86, 0.84, "EE+");
586 
587  std::string ImageName(this->m_imageFileName);
588  c1.SaveAs(ImageName.c_str());
589  return true;
590  } // fill method
591  };
592  using EcalChannelStatusEEDiffOneTag = EcalChannelStatusEEDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
593  using EcalChannelStatusEEDiffTwoTags = EcalChannelStatusEEDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
594 
595  /*****************************************
596  2d plot of EcalChannelStatus Error Summary of 1 IOV
597  ******************************************/
598  class EcalChannelStatusSummaryPlot : public cond::payloadInspector::PlotImage<EcalChannelStatus> {
599  public:
600  EcalChannelStatusSummaryPlot()
601  : cond::payloadInspector::PlotImage<EcalChannelStatus>("Ecal Channel Status Error Summary - map ") {
602  setSingleIov(true);
603  }
604 
605  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
606  auto iov = iovs.front(); //get reference to 1st element in the vector iovs
607  std::shared_ptr<EcalChannelStatus> payload =
608  fetchPayload(std::get<1>(iov)); //std::get<1>(iov) refers to the Hash in the tuple iov
609  unsigned int run = std::get<0>(iov); //referes to Time_t in iov.
610  TH2F *align; //pointer to align which is a 2D histogram
611 
612  int NbRows = 3;
613  int NbColumns = 3;
614 
615  if (payload.get()) { //payload is an iov retrieved from payload using hash.
616 
617  align = new TH2F("Ecal Channel Status Error Summary",
618  "EB/EE-/EE+ ErrorCount Total Number",
619  NbColumns,
620  0,
621  NbColumns,
622  NbRows,
623  0,
624  NbRows);
625 
626  long unsigned int ebErrorCount = 0;
627  long unsigned int ee1ErrorCount = 0;
628  long unsigned int ee2ErrorCount = 0;
629 
630  long unsigned int ebTotal = (payload->barrelItems()).size();
631  long unsigned int ee1Total = 0;
632  long unsigned int ee2Total = 0;
633 
634  getBarrelErrorSummary<EcalChannelStatusCode>(payload->barrelItems(), ebErrorCount);
635  getEndCapErrorSummary<EcalChannelStatusCode>(
636  payload->endcapItems(), ee1ErrorCount, ee2ErrorCount, ee1Total, ee2Total);
637 
638  double row = NbRows - 0.5;
639 
640  //EB summary values
641  align->Fill(0.5, row, 1);
642  align->Fill(1.5, row, ebErrorCount);
643  align->Fill(2.5, row, ebTotal);
644 
645  row--;
646 
647  align->Fill(0.5, row, 2);
648  align->Fill(1.5, row, ee1ErrorCount);
649  align->Fill(2.5, row, ee1Total);
650 
651  row--;
652 
653  align->Fill(0.5, row, 3);
654  align->Fill(1.5, row, ee2ErrorCount);
655  align->Fill(2.5, row, ee2Total);
656 
657  } // if payload.get()
658  else
659  return false;
660 
661  gStyle->SetPalette(1);
662  gStyle->SetOptStat(0);
663  TCanvas canvas("CC map", "CC map", 1000, 1000);
664  TLatex t1;
665  t1.SetNDC();
666  t1.SetTextAlign(26);
667  t1.SetTextSize(0.045);
668  t1.SetTextColor(2);
669  t1.DrawLatex(0.5, 0.96, Form("EcalChannelStatus Error Summary, IOV %i", run));
670 
671  TPad *pad = new TPad("pad", "pad", 0.0, 0.0, 1.0, 0.94);
672  pad->Draw();
673  pad->cd();
674  align->Draw("TEXT");
675 
676  drawTable(NbRows, NbColumns);
677 
678  align->GetXaxis()->SetTickLength(0.);
679  align->GetXaxis()->SetLabelSize(0.);
680  align->GetYaxis()->SetTickLength(0.);
681  align->GetYaxis()->SetLabelSize(0.);
682 
683  std::string ImageName(m_imageFileName);
684  canvas.SaveAs(ImageName.c_str());
685  return true;
686  } // fill method
687  };
688 
689 } // namespace
690 
691 // Register the classes as boost python plugin
693  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusEBMap);
694  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusEEMap);
695  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusEBDiffOneTag);
696  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusEBDiffTwoTags);
697  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusEEDiffOneTag);
698  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusEEDiffTwoTags);
699  PAYLOAD_INSPECTOR_CLASS(EcalChannelStatusSummaryPlot);
700 }
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
mps_fire.i
i
Definition: mps_fire.py:428
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
Definition: EcalCondObjectContainer.h:13
DivergingColor.red
list red
Definition: DivergingColor.py:172
PayloadInspectorModule.h
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
PVValHelper::eta
Definition: PVValidationHelpers.h:70
MIN_IETA
Definition: EcalFloatCondObjectContainerUtils.h:11
jets_cff.payload
payload
Definition: jets_cff.py:32
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:905
EEDetId::hashedIndex
int hashedIndex() const
Definition: EEDetId.h:183
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
MIN_IPHI
Definition: EcalFloatCondObjectContainerUtils.h:12
DivergingColor.blue
list blue
Definition: DivergingColor.py:173
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
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:894
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