CMS 3D CMS Logo

SiPixelGainCalibHelper.h
Go to the documentation of this file.
1 #ifndef CONDCORE_SIPIXELPLUGINS_SIPIXELGAINCALIBHELPER_H
2 #define CONDCORE_SIPIXELPLUGINS_SIPIXELGAINCALIBHELPER_H
3 
14 
15 #include <type_traits>
16 #include <memory>
17 #include <sstream>
18 
19 // include ROOT
20 #include "TH2F.h"
21 #include "TH1F.h"
22 #include "TLegend.h"
23 #include "TCanvas.h"
24 #include "TLine.h"
25 #include "TStyle.h"
26 #include "TLatex.h"
27 #include "TPave.h"
28 #include "TPaveStats.h"
29 #include "TGaxis.h"
30 
31 namespace gainCalibHelper {
32 
33  using AvgMap = std::map<uint32_t, float>;
34 
35  namespace gainCalibPI {
36 
37  enum type { t_gain = 0, t_pedestal = 1, t_correlation = 2 };
38 
39  //============================================================================
40  // helper method to fill the gain / pedestals distributions
41  template <typename PayloadType>
42  static void fillTheHisto(const std::shared_ptr<PayloadType>& payload,
43  std::shared_ptr<TH1F> h1,
44  gainCalibPI::type theType,
45  const std::vector<uint32_t>& wantedIds = {}) {
46  std::vector<uint32_t> detids;
47  if (wantedIds.empty()) {
48  payload->getDetIds(detids);
49  } else {
50  detids.assign(wantedIds.begin(), wantedIds.end());
51  }
52 
53  for (const auto& d : detids) {
54  // skip the special case used to signal there are no attached dets
55  if (d == 0xFFFFFFFF)
56  continue;
57 
58  auto range = payload->getRange(d);
59  int numberOfRowsToAverageOver = payload->getNumberOfRowsToAverageOver();
60  int ncols = payload->getNCols(d);
61  int nRocsInRow = (range.second - range.first) / ncols / numberOfRowsToAverageOver;
62  unsigned int nRowsForHLT = 1;
63  int nrows = std::max((payload->getNumberOfRowsToAverageOver() * nRocsInRow),
64  nRowsForHLT); // dirty trick to make it work for the HLT payload
65 
66  auto rangeAndCol = payload->getRangeAndNCols(d);
67  bool isDeadColumn;
68  bool isNoisyColumn;
69 
70  COUT << "NCOLS: " << payload->getNCols(d) << " " << rangeAndCol.second << " NROWS:" << nrows
71  << ", RANGES: " << rangeAndCol.first.second - rangeAndCol.first.first
72  << ", Ratio: " << float(rangeAndCol.first.second - rangeAndCol.first.first) / rangeAndCol.second
73  << std::endl;
74 
75  float quid(-99999.);
76 
77  for (int col = 0; col < ncols; col++) {
78  for (int row = 0; row < nrows; row++) {
79  switch (theType) {
81  quid = payload->getGain(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
82  break;
84  quid = payload->getPed(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
85  break;
86  default:
87  edm::LogError("gainCalibPI::fillTheHisto") << "Unrecognized type " << theType << std::endl;
88  break;
89  }
90  h1->Fill(quid);
91  } // loop on rows
92  } // loop on cols
93  } // loop on detids
94  } // fillTheHisto
95 
96  //============================================================================
97  // helper method to fill the gain / pedestal averages per module maps
98  template <typename PayloadType>
99  static void fillThePerModuleMap(const std::shared_ptr<PayloadType>& payload,
100  AvgMap& map,
101  gainCalibPI::type theType) {
102  std::vector<uint32_t> detids;
103  payload->getDetIds(detids);
104 
105  for (const auto& d : detids) {
106  auto range = payload->getRange(d);
107  int numberOfRowsToAverageOver = payload->getNumberOfRowsToAverageOver();
108  int ncols = payload->getNCols(d);
109  int nRocsInRow = (range.second - range.first) / ncols / numberOfRowsToAverageOver;
110  unsigned int nRowsForHLT = 1;
111  int nrows = std::max((payload->getNumberOfRowsToAverageOver() * nRocsInRow),
112  nRowsForHLT); // dirty trick to make it work for the HLT payload
113 
114  auto rangeAndCol = payload->getRangeAndNCols(d);
115  bool isDeadColumn;
116  bool isNoisyColumn;
117 
118  float sumOfX(0.);
119  int nPixels(0);
120  for (int col = 0; col < ncols; col++) {
121  for (int row = 0; row < nrows; row++) {
122  nPixels++;
123  switch (theType) {
124  case gainCalibPI::t_gain:
125  sumOfX +=
126  payload->getGain(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
127  break;
129  sumOfX += payload->getPed(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
130  break;
131  default:
132  edm::LogError("gainCalibPI::fillThePerModuleMap") << "Unrecognized type " << theType << std::endl;
133  break;
134  } // switch on the type
135  } // rows
136  } // columns
137  // fill the return value map
138  map[d] = sumOfX / nPixels;
139  } // loop on the detId
140  } // fillThePerModuleMap
141 
142  //============================================================================
143  // helper method to fill the gain / pedestals distributions
144  template <typename PayloadType>
145  static void fillTheHistos(const std::shared_ptr<PayloadType>& payload,
146  std::shared_ptr<TH1> hBPix,
147  std::shared_ptr<TH1> hFPix,
148  gainCalibPI::type theType) {
149  std::vector<uint32_t> detids;
150  payload->getDetIds(detids);
151 
152  bool isCorrelation_ = hBPix.get()->InheritsFrom(TH2::Class()) && (theType == gainCalibPI::t_correlation);
153 
154  for (const auto& d : detids) {
155  int subid = DetId(d).subdetId();
156  auto range = payload->getRange(d);
157  int numberOfRowsToAverageOver = payload->getNumberOfRowsToAverageOver();
158  int ncols = payload->getNCols(d);
159  int nRocsInRow = (range.second - range.first) / ncols / numberOfRowsToAverageOver;
160  unsigned int nRowsForHLT = 1;
161  int nrows = std::max((payload->getNumberOfRowsToAverageOver() * nRocsInRow),
162  nRowsForHLT); // dirty trick to make it work for the HLT payload
163 
164  auto rangeAndCol = payload->getRangeAndNCols(d);
165  bool isDeadColumn;
166  bool isNoisyColumn;
167 
168  for (int col = 0; col < ncols; col++) {
169  for (int row = 0; row < nrows; row++) {
170  float gain = payload->getGain(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
171  float ped = payload->getPed(col, row, rangeAndCol.first, rangeAndCol.second, isDeadColumn, isNoisyColumn);
172 
173  switch (subid) {
175  if (isCorrelation_) {
176  hBPix->Fill(gain, ped);
177  } else {
178  hBPix->Fill((theType == gainCalibPI::t_gain ? gain : ped));
179  }
180  break;
181  }
183  if (isCorrelation_) {
184  hFPix->Fill(gain, ped);
185  } else {
186  hFPix->Fill((theType == gainCalibPI::t_gain ? gain : ped));
187  }
188  break;
189  }
190  default:
191  edm::LogError("gainCalibPI::fillTheHistos") << d << " is not a Pixel DetId" << std::endl;
192  break;
193  } // switch on subid
194  } // row loop
195  } // column loop
196  } // detid loop
197  } // filltheHistos
198  } // namespace gainCalibPI
199 
200  constexpr char const* TypeName[2] = {"Gains", "Pedestals"};
201 
202  /*******************************************************************
203  1d histogram of SiPixelGainCalibration for Gains of 1 IOV
204  ********************************************************************/
205  template <gainCalibPI::type myType, class PayloadType>
207  : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
208  public:
210  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
211  Form("SiPixelGainCalibration %s Values", TypeName[myType])) {
212  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
213  isForHLT_ = false;
214  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
215  } else {
216  isForHLT_ = true;
217  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
218  }
219  }
220 
221  bool fill() override {
222  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
223  auto iov = tag.iovs.front();
224 
225  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
226 
227  gStyle->SetOptStat("emr");
228 
229  float minimum(9999.);
230  float maximum(-9999.);
231 
232  switch (myType) {
233  case gainCalibPI::t_gain:
234  maximum = payload->getGainHigh();
235  minimum = payload->getGainLow();
236  break;
238  maximum = payload->getPedHigh();
239  minimum = payload->getPedLow();
240  break;
241  default:
242  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
243  break;
244  }
245 
246  TCanvas canvas("Canv", "Canv", 1200, 1000);
247  auto h1 = std::make_shared<TH1F>(Form("%s values", TypeName[myType]),
248  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
249  (isForHLT_ ? "ForHLT" : "Offline"),
250  TypeName[myType],
251  (isForHLT_ ? "Column" : "Pixel"),
252  TypeName[myType],
253  (isForHLT_ ? "column" : "pixel")),
254  200,
255  minimum,
256  maximum);
257  canvas.cd();
258  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.06, 0.12, 0.12, 0.05);
259  canvas.Modified();
260 
261  // fill the histogram
262  gainCalibPI::fillTheHisto(payload, h1, myType);
263 
264  canvas.cd()->SetLogy();
265  h1->SetTitle("");
266  h1->GetYaxis()->SetRangeUser(0.1, h1->GetMaximum() * 10.);
267  h1->SetFillColor(kBlue);
268  h1->SetMarkerStyle(20);
269  h1->SetMarkerSize(1);
270  h1->Draw("bar2");
271 
273  h1->SetStats(true);
274 
275  canvas.Update();
276 
277  TLegend legend = TLegend(0.40, 0.88, 0.94, 0.93);
278  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
279  "C"); // option "C" allows to center the header
280  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
281  legend.SetLineColor(10);
282  legend.SetTextSize(0.025);
283  legend.Draw("same");
284 
285  TPaveStats* st = (TPaveStats*)h1->FindObject("stats");
286  st->SetTextSize(0.03);
287  SiPixelPI::adjustStats(st, 0.15, 0.83, 0.39, 0.93);
288 
289  auto ltx = TLatex();
290  ltx.SetTextFont(62);
291  //ltx.SetTextColor(kBlue);
292  ltx.SetTextSize(0.05);
293  ltx.SetTextAlign(11);
294  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.1,
295  1 - gPad->GetTopMargin() + 0.01,
296  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
297 
299  canvas.SaveAs(fileName.c_str());
300 
301  return true;
302  }
303 
304  protected:
305  bool isForHLT_;
307  };
308 
309  /*******************************************************************
310  1d histograms per region of SiPixelGainCalibration for Gains of 1 IOV
311  ********************************************************************/
312  template <bool isBarrel, gainCalibPI::type myType, class PayloadType>
314  : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
315  public:
317  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
318  Form("SiPixelGainCalibration %s Values Per Region", TypeName[myType])) {
320 
321  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
322  isForHLT_ = false;
323  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
324  } else {
325  isForHLT_ = true;
326  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
327  }
328  }
329 
330  bool fill() override {
331  gStyle->SetOptStat("mr");
332 
333  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
334  auto iov = tag.iovs.front();
335 
336  // parse first if log
337  bool setLog(true);
339  auto ip = paramValues.find("SetLog");
340  if (ip != paramValues.end()) {
341  auto answer = boost::lexical_cast<std::string>(ip->second);
342  if (!SiPixelPI::checkAnswerOK(answer, setLog)) {
343  throw cms::Exception(label_)
344  << "\nERROR: " << answer
345  << " is not a valid setting for this parameter, please use True,False,1,0,Yes,No \n\n";
346  }
347  }
348 
349  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
350 
351  std::vector<uint32_t> detids;
352  payload->getDetIds(detids);
353 
354  float minimum(9999.);
355  float maximum(-9999.);
356 
357  switch (myType) {
358  case gainCalibPI::t_gain:
359  maximum = payload->getGainHigh();
360  minimum = payload->getGainLow();
361  break;
363  maximum = payload->getPedHigh();
364  minimum = payload->getPedLow();
365  break;
366  default:
367  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
368  break;
369  }
370 
371  TCanvas canvas("Canv", "Canv", isBarrel ? 1400 : 1800, 1200);
372  if (detids.size() > SiPixelPI::phase1size) {
373  SiPixelPI::displayNotSupported(canvas, detids.size());
375  canvas.SaveAs(fileName.c_str());
376  return false;
377  }
378 
379  canvas.Divide(isBarrel ? 2 : 4, isBarrel ? 2 : 3);
380  canvas.cd();
381 
382  const char* path_toTopologyXML = (detids.size() == SiPixelPI::phase0size)
383  ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
384  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
385  TrackerTopology tTopo =
387 
388  auto myPlots = PixelRegions::PixelRegionContainers(&tTopo, (detids.size() == SiPixelPI::phase1size));
389  myPlots.bookAll(Form("SiPixel Gain Calibration %s - %s", (isForHLT_ ? "ForHLT" : "Offline"), TypeName[myType]),
390  Form("per %s %s", (isForHLT_ ? "Column" : "Pixel"), TypeName[myType]),
391  Form("# %ss", (isForHLT_ ? "column" : "pixel")),
392  200,
393  minimum,
394  maximum);
395 
396  canvas.Modified();
397 
398  // fill the histograms
399  for (const auto& pixelId : PixelRegions::PixelIDs) {
400  auto wantedDets = PixelRegions::attachedDets(pixelId, &tTopo, (detids.size() == SiPixelPI::phase1size));
401  gainCalibPI::fillTheHisto(payload, myPlots.getHistoFromMap(pixelId), myType, wantedDets);
402  }
403 
404  if (setLog) {
405  myPlots.setLogScale();
406  }
407  myPlots.beautify(kBlue, -1);
408  myPlots.draw(canvas, isBarrel, "HIST");
409 
410  TLegend legend = TLegend(0.45, 0.88, 0.91, 0.92);
411  legend.SetHeader(("hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
412  "C"); // option "C" allows to center the header
413  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
414  legend.SetLineColor(10);
415  legend.SetTextSize(0.025);
416  legend.Draw("same");
417 
418  unsigned int maxPads = isBarrel ? 4 : 12;
419  for (unsigned int c = 1; c <= maxPads; c++) {
420  canvas.cd(c);
421  SiPixelPI::adjustCanvasMargins(canvas.cd(c), 0.06, 0.12, 0.12, 0.05);
422  legend.Draw("same");
423  canvas.cd(c)->Update();
424  }
425 
426  myPlots.stats();
427 
428  auto ltx = TLatex();
429  ltx.SetTextFont(62);
430  ltx.SetTextSize(0.05);
431  ltx.SetTextAlign(11);
432 
433  for (unsigned int c = 1; c <= maxPads; c++) {
434  auto index = isBarrel ? c - 1 : c + 3;
435  canvas.cd(c);
436  auto leftX = setLog ? 0. : 0.1;
437  ltx.DrawLatexNDC(gPad->GetLeftMargin() + leftX,
438  1 - gPad->GetTopMargin() + 0.01,
439  (PixelRegions::IDlabels.at(index) + ", IOV:" + std::to_string(std::get<0>(iov))).c_str());
440  }
441 
443  canvas.SaveAs(fileName.c_str());
444 
445  return true;
446  }
447 
448  protected:
449  bool isForHLT_;
451  };
452 
453  /*******************************************************************
454  1d histograms comparison per region of SiPixelGainCalibration for Gains of 2 IOV
455  ********************************************************************/
456  template <bool isBarrel,
457  gainCalibPI::type myType,
459  int ntags,
460  class PayloadType>
462  : public cond::payloadInspector::PlotImage<PayloadType, nIOVs, ntags> {
463  public:
466  Form("SiPixelGainCalibration %s Values Per Region %i tag(s)", TypeName[myType], ntags)) {
468 
469  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
470  isForHLT_ = false;
471  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
472  } else {
473  isForHLT_ = true;
474  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
475  }
476  }
477 
478  bool fill() override {
479  gStyle->SetOptStat("mr");
480 
481  COUT << "ntags: " << ntags << " this->m_plotAnnotations.ntags: " << this->m_plotAnnotations.ntags << std::endl;
482 
483  // trick to deal with the multi-ioved tag and two tag case at the same time
484  auto theIOVs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
485  auto tagname1 = cond::payloadInspector::PlotBase::getTag<0>().name;
486  std::string tagname2 = "";
487  auto firstiov = theIOVs.front();
488  std::tuple<cond::Time_t, cond::Hash> lastiov;
489 
490  // we don't support (yet) comparison with more than 2 tags
491  assert(this->m_plotAnnotations.ntags < 3);
492 
493  if (this->m_plotAnnotations.ntags == 2) {
494  auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
495  tagname2 = cond::payloadInspector::PlotBase::getTag<1>().name;
496  lastiov = tag2iovs.front();
497  } else {
498  lastiov = theIOVs.back();
499  }
500 
501  // parse first if log
502  bool setLog(true);
504  auto ip = paramValues.find("SetLog");
505  if (ip != paramValues.end()) {
506  auto answer = boost::lexical_cast<std::string>(ip->second);
507  if (!SiPixelPI::checkAnswerOK(answer, setLog)) {
508  throw cms::Exception(label_)
509  << "\nERROR: " << answer
510  << " is not a valid setting for this parameter, please use True,False,1,0,Yes,No \n\n";
511  }
512  }
513 
514  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
515  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
516 
517  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
518  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
519 
520  std::vector<uint32_t> f_detids, l_detids;
521  last_payload->getDetIds(l_detids);
522  first_payload->getDetIds(f_detids);
523 
524  float minimum(9999.);
525  float maximum(-9999.);
526 
527  switch (myType) {
528  case gainCalibPI::t_gain:
529  maximum = std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
530  minimum = std::min(last_payload->getGainLow(), first_payload->getGainLow());
531  break;
533  maximum = std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
534  minimum = std::min(last_payload->getPedLow(), first_payload->getPedLow());
535  break;
536  default:
537  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
538  break;
539  }
540 
541  TCanvas canvas("Canv", "Canv", isBarrel ? 1400 : 1800, 1200);
542  if (std::max(l_detids.size(), f_detids.size()) > SiPixelPI::phase1size) {
543  SiPixelPI::displayNotSupported(canvas, std::max(f_detids.size(), l_detids.size()));
545  canvas.SaveAs(fileName.c_str());
546  return false;
547  }
548 
549  canvas.Divide(isBarrel ? 2 : 4, isBarrel ? 2 : 3);
550  canvas.cd();
551 
552  bool is_l_phase0 = (l_detids.size() == SiPixelPI::phase0size);
553  bool is_f_phase0 = (f_detids.size() == SiPixelPI::phase0size);
554 
555  const char* path_toTopologyXML = is_l_phase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
556  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
557  auto l_tTopo =
559 
560  auto l_myPlots = PixelRegions::PixelRegionContainers(&l_tTopo, !is_l_phase0);
561  l_myPlots.bookAll(
562  Form("Last SiPixel Gain Calibration %s - %s", (isForHLT_ ? "ForHLT" : "Offline"), TypeName[myType]),
563  Form("per %s %s", (isForHLT_ ? "Column" : "Pixel"), TypeName[myType]),
564  Form("# %ss", (isForHLT_ ? "column" : "pixel")),
565  200,
566  minimum,
567  maximum);
568 
569  path_toTopologyXML = is_f_phase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
570  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
571  auto f_tTopo =
573 
574  auto f_myPlots = PixelRegions::PixelRegionContainers(&f_tTopo, !is_f_phase0);
575  f_myPlots.bookAll(
576  Form("First SiPixel Gain Calibration %s - %s", (isForHLT_ ? "ForHLT" : "Offline"), TypeName[myType]),
577  Form("per %s %s", (isForHLT_ ? "Column" : "Pixel"), TypeName[myType]),
578  Form("# %ss", (isForHLT_ ? "column" : "pixel")),
579  200,
580  minimum,
581  maximum);
582 
583  // fill the histograms
584  for (const auto& pixelId : PixelRegions::PixelIDs) {
585  auto f_wantedDets = PixelRegions::attachedDets(pixelId, &f_tTopo, !is_f_phase0);
586  auto l_wantedDets = PixelRegions::attachedDets(pixelId, &l_tTopo, !is_l_phase0);
587  gainCalibPI::fillTheHisto(first_payload, f_myPlots.getHistoFromMap(pixelId), myType, f_wantedDets);
588  gainCalibPI::fillTheHisto(last_payload, l_myPlots.getHistoFromMap(pixelId), myType, l_wantedDets);
589  }
590 
591  if (setLog) {
592  f_myPlots.setLogScale();
593  l_myPlots.setLogScale();
594  }
595 
596  l_myPlots.beautify(kRed, -1);
597  f_myPlots.beautify(kAzure, -1);
598 
599  l_myPlots.draw(canvas, isBarrel, "HIST", (!is_f_phase0 || !is_l_phase0));
600  f_myPlots.draw(canvas, isBarrel, "HISTsames", (!is_f_phase0 || !is_l_phase0));
601 
602  // rescale the y-axis ranges in order to fit the canvas
603  l_myPlots.rescaleMax(f_myPlots);
604 
605  // done dealing with IOVs
606  auto colorTag = isBarrel ? PixelRegions::L1 : PixelRegions::Rm1l;
607  std::unique_ptr<TLegend> legend;
608  if (this->m_plotAnnotations.ntags == 2) {
609  legend = std::make_unique<TLegend>(0.36, 0.86, 0.94, 0.92);
610  legend->AddEntry(l_myPlots.getHistoFromMap(colorTag).get(), ("#color[2]{" + tagname2 + "}").c_str(), "F");
611  legend->AddEntry(f_myPlots.getHistoFromMap(colorTag).get(), ("#color[4]{" + tagname1 + "}").c_str(), "F");
612  legend->SetTextSize(0.024);
613  } else {
614  legend = std::make_unique<TLegend>(0.58, 0.80, 0.90, 0.92);
615  legend->AddEntry(l_myPlots.getHistoFromMap(colorTag).get(), ("#color[2]{" + lastIOVsince + "}").c_str(), "F");
616  legend->AddEntry(f_myPlots.getHistoFromMap(colorTag).get(), ("#color[4]{" + firstIOVsince + "}").c_str(), "F");
617  legend->SetTextSize(0.040);
618  }
619  legend->SetLineColor(10);
620 
621  unsigned int maxPads = isBarrel ? 4 : 12;
622  for (unsigned int c = 1; c <= maxPads; c++) {
623  canvas.cd(c);
624  SiPixelPI::adjustCanvasMargins(canvas.cd(c), 0.06, 0.12, 0.12, 0.05);
625  legend->Draw("same");
626  canvas.cd(c)->Update();
627  }
628 
629  f_myPlots.stats(0);
630  l_myPlots.stats(1);
631 
632  auto ltx = TLatex();
633  ltx.SetTextFont(62);
634  ltx.SetTextSize(0.05);
635  ltx.SetTextAlign(11);
636 
637  for (unsigned int c = 1; c <= maxPads; c++) {
638  auto index = isBarrel ? c - 1 : c + 3;
639  canvas.cd(c);
640  auto leftX = setLog ? 0. : 0.1;
641  ltx.DrawLatexNDC(gPad->GetLeftMargin() + leftX,
642  1 - gPad->GetTopMargin() + 0.01,
643  (PixelRegions::IDlabels.at(index) + " : #color[4]{" + std::to_string(std::get<0>(firstiov)) +
644  "} vs #color[2]{" + std::to_string(std::get<0>(lastiov)) + "}")
645  .c_str());
646  }
647 
649  canvas.SaveAs(fileName.c_str());
650 
651  return true;
652  }
653 
654  protected:
655  bool isForHLT_;
657  };
658 
659  /*******************************************************************
660  1d histogram of SiPixelGainCalibration for Gain/Pedestals
661  correlation of 1 IOV
662  ********************************************************************/
663  template <class PayloadType>
665  : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
666  public:
669  "SiPixelGainCalibration gain/pedestal correlations") {
670  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
671  isForHLT_ = false;
672  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
673  } else {
674  isForHLT_ = true;
675  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
676  }
677  }
678 
679  bool fill() override {
680  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
681  auto iov = tag.iovs.front();
682 
683  gStyle->SetOptStat("emr");
684  gStyle->SetPalette(1);
685 
686  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
687 
688  TCanvas canvas("Canv", "Canv", 1400, 800);
689  canvas.Divide(2, 1);
690  canvas.cd();
691 
692  auto hBPix = std::make_shared<TH2F>("Correlation BPIX",
693  Form("SiPixel Gain Calibration %s BPIx;per %s gains;per %s pedestals",
694  (isForHLT_ ? "ForHLT" : "Offline"),
695  (isForHLT_ ? "column" : "pixel"),
696  (isForHLT_ ? "column" : "pixel")),
697  200,
698  payload->getGainLow(),
699  payload->getGainHigh(),
700  200,
701  payload->getPedLow(),
702  payload->getPedHigh());
703 
704  auto hFPix = std::make_shared<TH2F>("Correlation FPIX",
705  Form("SiPixel Gain Calibration %s FPix;per %s gains;per %s pedestals",
706  (isForHLT_ ? "ForHLT" : "Offline"),
707  (isForHLT_ ? "column" : "pixel"),
708  (isForHLT_ ? "column" : "pixel")),
709  200,
710  payload->getGainLow(),
711  payload->getGainHigh(),
712  200,
713  payload->getPedLow(),
714  payload->getPedHigh());
715 
716  for (unsigned int i : {1, 2}) {
717  SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.04, 0.12, 0.15, 0.13);
718  canvas.cd(i)->Modified();
719  }
720 
721  // actually fill the histograms
723 
724  canvas.cd(1)->SetLogz();
725  hBPix->SetTitle("");
726  hBPix->Draw("colz");
727 
728  SiPixelPI::makeNicePlotStyle(hBPix.get());
729  hBPix->GetYaxis()->SetTitleOffset(1.65);
730 
731  canvas.cd(2)->SetLogz();
732  hFPix->SetTitle("");
733  hFPix->Draw("colz");
734 
735  SiPixelPI::makeNicePlotStyle(hFPix.get());
736  hFPix->GetYaxis()->SetTitleOffset(1.65);
737  canvas.Update();
738 
739  TLegend legend = TLegend(0.3, 0.92, 0.70, 0.95);
740  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
741  "C"); // option "C" allows to center the header
742  legend.SetLineColor(10);
743  legend.SetTextSize(0.025);
744  canvas.cd(1);
745  legend.Draw("same");
746  canvas.cd(2);
747  legend.Draw("same");
748 
749  auto ltx = TLatex();
750  ltx.SetTextFont(62);
751  //ltx.SetTextColor(kBlue);
752  ltx.SetTextSize(0.045);
753  ltx.SetTextAlign(11);
754  canvas.cd(1);
755  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
756  1 - gPad->GetTopMargin() + 0.01,
757  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
758 
759  ltx.DrawLatexNDC(0.75, 0.15, "BPIX");
760 
761  canvas.cd(2);
762  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
763  1 - gPad->GetTopMargin() + 0.01,
764  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
765 
766  ltx.DrawLatexNDC(0.75, 0.15, "FPIX");
767 
769  canvas.SaveAs(fileName.c_str());
770 #ifdef MMDEBUG
771  canvas.SaveAs("out.root");
772 #endif
773  return true;
774  }
775 
776  protected:
777  bool isForHLT_;
779  };
780 
781  /*******************************************************************
782  1d histogram of SiPixelGainCalibration for Pedestals of 1 IOV
783  ********************************************************************/
784  template <gainCalibPI::type myType, class PayloadType>
786  : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
787  public:
790  Form("SiPixelGainCalibrationOffline %s Values By Partition", TypeName[myType])) {
791  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
792  isForHLT_ = false;
793  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
794  } else {
795  isForHLT_ = true;
796  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
797  }
798  }
799 
800  bool fill() override {
801  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
802  auto iov = tag.iovs.front();
803 
804  gStyle->SetOptStat("emr");
805 
806  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
807 
808  TCanvas canvas("Canv", "Canv", 1400, 800);
809  canvas.Divide(2, 1);
810  canvas.cd();
811 
812  float minimum(9999.);
813  float maximum(-9999.);
814 
815  switch (myType) {
816  case gainCalibPI::t_gain:
817  maximum = payload->getGainHigh();
818  minimum = payload->getGainLow();
819  break;
821  maximum = payload->getPedHigh();
822  minimum = payload->getPedLow();
823  break;
824  default:
825  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
826  break;
827  }
828 
829  auto hBPix = std::make_shared<TH1F>(Form("%s BPIX", TypeName[myType]),
830  Form("SiPixel Gain Calibration %s BPIx -%s;per %s %s (BPix);# %ss",
831  (isForHLT_ ? "ForHLT" : "Offline"),
832  TypeName[myType],
833  (isForHLT_ ? "Column" : "Pixel"),
834  TypeName[myType],
835  (isForHLT_ ? "column" : "pixel")),
836  200,
837  minimum,
838  maximum);
839 
840  auto hFPix = std::make_shared<TH1F>(Form("%s FPIX", TypeName[myType]),
841  Form("SiPixel Gain Calibration %s FPix -%s;per %s %s (FPix);# %ss",
842  (isForHLT_ ? "ForHLT" : "Offline"),
843  TypeName[myType],
844  (isForHLT_ ? "Column" : "Pixel"),
845  TypeName[myType],
846  (isForHLT_ ? "column" : "pixel")),
847  200,
848  minimum,
849  maximum);
850 
851  for (unsigned int i : {1, 2}) {
852  SiPixelPI::adjustCanvasMargins(canvas.cd(i), 0.04, 0.12, 0.12, 0.02);
853  canvas.cd(i)->Modified();
854  }
855 
856  // actually fill the histograms
857  fillTheHistos(payload, hBPix, hFPix, myType);
858 
859  canvas.cd(1)->SetLogy();
860  hBPix->SetTitle("");
861  hBPix->GetYaxis()->SetRangeUser(0.1, hBPix->GetMaximum() * 10);
862  hBPix->SetFillColor(kBlue);
863  hBPix->SetMarkerStyle(20);
864  hBPix->SetMarkerSize(1);
865  hBPix->Draw("hist");
866 
867  SiPixelPI::makeNicePlotStyle(hBPix.get());
868  hBPix->SetStats(true);
869 
870  canvas.cd(2)->SetLogy();
871  hFPix->SetTitle("");
872  hFPix->GetYaxis()->SetRangeUser(0.1, hFPix->GetMaximum() * 10);
873  hFPix->SetFillColor(kBlue);
874  hFPix->SetMarkerStyle(20);
875  hFPix->SetMarkerSize(1);
876  hFPix->Draw("hist");
877 
878  SiPixelPI::makeNicePlotStyle(hFPix.get());
879  hFPix->SetStats(true);
880 
881  canvas.Update();
882 
883  TLegend legend = TLegend(0.32, 0.92, 0.97, 0.95);
884  legend.SetHeader(("Payload hash: #bf{" + (std::get<1>(iov)) + "}").c_str(),
885  "C"); // option "C" allows to center the header
886  //legend.AddEntry(h1.get(), ("IOV: " + std::to_string(std::get<0>(iov))).c_str(), "PL");
887  legend.SetLineColor(10);
888  legend.SetTextSize(0.025);
889  canvas.cd(1);
890  legend.Draw("same");
891  canvas.cd(2);
892  legend.Draw("same");
893 
894  canvas.cd(1);
895  TPaveStats* st1 = (TPaveStats*)hBPix->FindObject("stats");
896  st1->SetTextSize(0.03);
897  SiPixelPI::adjustStats(st1, 0.13, 0.815, 0.44, 0.915);
898 
899  canvas.cd(2);
900  TPaveStats* st2 = (TPaveStats*)hFPix->FindObject("stats");
901  st2->SetTextSize(0.03);
902  SiPixelPI::adjustStats(st2, 0.14, 0.815, 0.44, 0.915);
903 
904  auto ltx = TLatex();
905  ltx.SetTextFont(62);
906  //ltx.SetTextColor(kBlue);
907  ltx.SetTextSize(0.045);
908  ltx.SetTextAlign(11);
909  canvas.cd(1);
910  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
911  1 - gPad->GetTopMargin() + 0.01,
912  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
913 
914  canvas.cd(2);
915  ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
916  1 - gPad->GetTopMargin() + 0.01,
917  ("SiPixel Gain Calibration IOV:" + std::to_string(std::get<0>(iov))).c_str());
918 
920  canvas.SaveAs(fileName.c_str());
921 
922  return true;
923  }
924 
925  protected:
926  bool isForHLT_;
928  };
929 
930  /************************************************
931  1d histogram comparison of SiPixelGainCalibration
932  *************************************************/
933  template <gainCalibPI::type myType, class PayloadType>
935  public:
938  Form("SiPixelGainCalibration %s Values Comparison", TypeName[myType])) {
939  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
940  isForHLT_ = false;
941  } else {
942  isForHLT_ = true;
943  }
944  }
945  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash>>& iovs) override {
946  gStyle->SetOptStat("emr");
947  TGaxis::SetExponentOffset(-0.1, 0.01, "y"); // Y offset
948  TH1F::SetDefaultSumw2(true);
949 
950  std::vector<std::tuple<cond::Time_t, cond::Hash>> sorted_iovs = iovs;
951  // make absolute sure the IOVs are sortd by since
952  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const& t1, auto const& t2) {
953  return std::get<0>(t1) < std::get<0>(t2);
954  });
955  auto firstiov = sorted_iovs.front();
956  auto lastiov = sorted_iovs.back();
957 
958  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
959  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
960 
961  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
962  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
963 
964  float minimum(9999.);
965  float maximum(-9999.);
966 
967  switch (myType) {
968  case gainCalibPI::t_gain:
969  maximum = std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
970  minimum = std::min(last_payload->getGainLow(), first_payload->getGainLow());
971  break;
973  maximum = std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
974  minimum = std::min(last_payload->getPedLow(), first_payload->getPedLow());
975  break;
976  default:
977  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
978  break;
979  }
980 
981  TCanvas canvas("Canv", "Canv", 1200, 1000);
982  canvas.cd();
983  auto hfirst = std::make_shared<TH1F>(Form("First, IOV %s", firstIOVsince.c_str()),
984  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
985  (isForHLT_ ? "ForHLT" : "Offline"),
986  TypeName[myType],
987  (isForHLT_ ? "Column" : "Pixel"),
988  TypeName[myType],
989  (isForHLT_ ? "column" : "pixel")),
990  200,
991  minimum,
992  maximum);
993 
994  auto hlast = std::make_shared<TH1F>(Form("Last, IOV %s", lastIOVsince.c_str()),
995  Form("SiPixel Gain Calibration %s - %s;per %s %s;# %ss",
996  (isForHLT_ ? "ForHLT" : "Offline"),
997  TypeName[myType],
998  (isForHLT_ ? "Column" : "Pixel"),
999  TypeName[myType],
1000  (isForHLT_ ? "column" : "pixel")),
1001  200,
1002  minimum,
1003  maximum);
1004 
1005  SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.05, 0.12, 0.12, 0.03);
1006  canvas.Modified();
1007 
1008  gainCalibPI::fillTheHisto(first_payload, hfirst, myType);
1009  gainCalibPI::fillTheHisto(last_payload, hlast, myType);
1010 
1011  canvas.cd()->SetLogy();
1012  auto extrema = SiPixelPI::getExtrema(hfirst.get(), hlast.get());
1013  //hfirst->GetYaxis()->SetRangeUser(extrema.first, extrema.second * 1.10);
1014  hfirst->GetYaxis()->SetRangeUser(1., extrema.second * 10);
1015 
1016  hfirst->SetTitle("");
1017  hfirst->SetLineColor(kRed);
1018  hfirst->SetBarWidth(0.95);
1019  hfirst->Draw("hist");
1020 
1021  hlast->SetTitle("");
1022  hlast->SetFillColorAlpha(kBlue, 0.20);
1023  hlast->SetBarWidth(0.95);
1024  hlast->Draw("histsames");
1025 
1026  SiPixelPI::makeNicePlotStyle(hfirst.get());
1027  hfirst->SetStats(true);
1028  SiPixelPI::makeNicePlotStyle(hlast.get());
1029  hlast->SetStats(true);
1030 
1031  canvas.Update();
1032 
1033  TLegend legend = TLegend(0.45, 0.86, 0.74, 0.94);
1034  //legend.SetHeader("#font[22]{SiPixel Offline Gain Calibration Comparison}", "C"); // option "C" allows to center the header
1035  //legend.AddEntry(hfirst.get(), ("IOV: " + std::to_string(std::get<0>(firstiov))).c_str(), "FL");
1036  //legend.AddEntry(hlast.get(), ("IOV: " + std::to_string(std::get<0>(lastiov))).c_str(), "FL");
1037  legend.AddEntry(hfirst.get(), ("payload: #color[2]{" + std::get<1>(firstiov) + "}").c_str(), "F");
1038  legend.AddEntry(hlast.get(), ("payload: #color[4]{" + std::get<1>(lastiov) + "}").c_str(), "F");
1039  legend.SetTextSize(0.022);
1040  legend.SetLineColor(10);
1041  legend.Draw("same");
1042 
1043  TPaveStats* st1 = (TPaveStats*)hfirst->FindObject("stats");
1044  st1->SetTextSize(0.022);
1045  st1->SetLineColor(kRed);
1046  st1->SetTextColor(kRed);
1047  SiPixelPI::adjustStats(st1, 0.13, 0.84, 0.31, 0.94);
1048 
1049  TPaveStats* st2 = (TPaveStats*)hlast->FindObject("stats");
1050  st2->SetTextSize(0.022);
1051  st2->SetLineColor(kBlue);
1052  st2->SetTextColor(kBlue);
1053  SiPixelPI::adjustStats(st2, 0.13, 0.73, 0.31, 0.83);
1054 
1055  auto ltx = TLatex();
1056  ltx.SetTextFont(62);
1057  //ltx.SetTextColor(kBlue);
1058  ltx.SetTextSize(0.047);
1059  ltx.SetTextAlign(11);
1060  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1061  1 - gPad->GetTopMargin() + 0.01,
1062  ("SiPixel Gain Calibration IOV:#color[2]{" + std::to_string(std::get<0>(firstiov)) +
1063  "} vs IOV:#color[4]{" + std::to_string(std::get<0>(lastiov)) + "}")
1064  .c_str());
1065 
1067  canvas.SaveAs(fileName.c_str());
1068 #ifdef MMDEBUG
1069  canvas.SaveAs("out.root");
1070 #endif
1072  return true;
1073  }
1074 
1075  protected:
1076  bool isForHLT_;
1078  };
1079 
1080  template <gainCalibPI::type myType, class PayloadType>
1082  : public SiPixelGainCalibrationValueComparisonBase<myType, PayloadType> {
1083  public:
1086  this->setSingleIov(false);
1087  }
1088  };
1089 
1090  template <gainCalibPI::type myType, class PayloadType>
1092  : public SiPixelGainCalibrationValueComparisonBase<myType, PayloadType> {
1093  public:
1095  this->setTwoTags(true);
1096  }
1097  };
1099  // 2D MAPS
1100 
1101  /************************************************
1102  occupancy style map BPix
1103  *************************************************/
1104  template <gainCalibPI::type myType, class PayloadType>
1106  : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
1107  public:
1110  Form("SiPixelGainCalibration %s Barrel Pixel Map", TypeName[myType])),
1112  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
1113  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
1114  isForHLT_ = false;
1115  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
1116  } else {
1117  isForHLT_ = true;
1118  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
1119  }
1120  };
1121 
1122  bool fill() override {
1123  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
1124  auto iov = tag.iovs.front();
1125 
1126  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
1127 
1128  static const int n_layers = 4;
1129  int nlad_list[n_layers] = {6, 14, 22, 32};
1130  int divide_roc = 1;
1131 
1132  // --------------------- BOOK HISTOGRAMS
1133  std::array<TH2D*, n_layers> h_bpix_Gains;
1134 
1135  for (unsigned int lay = 1; lay <= 4; lay++) {
1136  int nlad = nlad_list[lay - 1];
1137 
1138  std::string name = "occ_Gain_Layer_" + std::to_string(lay);
1139  std::string title = "; Module # ; Ladder #";
1140  h_bpix_Gains[lay - 1] = new TH2D(name.c_str(),
1141  title.c_str(),
1142  72 * divide_roc,
1143  -4.5,
1144  4.5,
1145  (nlad * 4 + 2) * divide_roc,
1146  -nlad - 0.5,
1147  nlad + 0.5);
1148  }
1149 
1150  std::map<uint32_t, float> GainCalibMap_;
1151  gainCalibPI::fillThePerModuleMap(payload, GainCalibMap_, myType);
1152  if (GainCalibMap_.size() != SiPixelPI::phase1size) {
1153  edm::LogError(label_) << "SiPixelGainCalibration maps are not supported for non-Phase1 Pixel geometries !";
1154  TCanvas canvas("Canv", "Canv", 1200, 1000);
1155  SiPixelPI::displayNotSupported(canvas, GainCalibMap_.size());
1157  canvas.SaveAs(fileName.c_str());
1158  return false;
1159  }
1160 
1161  // hard-coded phase-I
1162  std::array<double, 4> minima = {{999., 999., 999., 999.}};
1163 
1164  for (const auto& element : GainCalibMap_) {
1165  int subid = DetId(element.first).subdetId();
1166  if (subid == PixelSubdetector::PixelBarrel) {
1167  auto layer = m_trackerTopo.pxbLayer(DetId(element.first));
1168  auto s_ladder = SiPixelPI::signed_ladder(DetId(element.first), m_trackerTopo, true);
1169  auto s_module = SiPixelPI::signed_module(DetId(element.first), m_trackerTopo, true);
1170 
1171  auto ladder = m_trackerTopo.pxbLadder(DetId(element.first));
1172  auto module = m_trackerTopo.pxbModule(DetId(element.first));
1173  COUT << "layer:" << layer << " ladder:" << ladder << " module:" << module << " signed ladder: " << s_ladder
1174  << " signed module: " << s_module << std::endl;
1175 
1176  if (element.second < minima.at(layer - 1))
1177  minima.at(layer - 1) = element.second;
1178 
1179  auto rocsToMask = SiPixelPI::maskedBarrelRocsToBins(layer, s_ladder, s_module);
1180  for (const auto& bin : rocsToMask) {
1181  h_bpix_Gains[layer - 1]->SetBinContent(bin.first, bin.second, element.second);
1182  }
1183  }
1184  }
1185 
1186  gStyle->SetOptStat(0);
1187  //=========================
1188  TCanvas canvas("Summary", "Summary", 1200, 1200);
1189  canvas.Divide(2, 2);
1190 
1191  for (unsigned int lay = 1; lay <= 4; lay++) {
1192  SiPixelPI::adjustCanvasMargins(canvas.cd(lay), -1, 0.08, 0.1, 0.13);
1193 
1194  COUT << " layer:" << lay << " max:" << h_bpix_Gains[lay - 1]->GetMaximum() << " min: " << minima.at(lay - 1)
1195  << std::endl;
1196 
1197  SiPixelPI::dress_occup_plot(canvas, h_bpix_Gains[lay - 1], lay, 0, 1, true, true, false);
1198  h_bpix_Gains[lay - 1]->GetZaxis()->SetRangeUser(minima.at(lay - 1) - 0.001,
1199  h_bpix_Gains[lay - 1]->GetMaximum() + 0.001);
1200  }
1201 
1202  auto unpacked = SiPixelPI::unpack(std::get<0>(iov));
1203 
1204  for (unsigned int lay = 1; lay <= 4; lay++) {
1205  canvas.cd(lay);
1206  auto ltx = TLatex();
1207  ltx.SetTextFont(62);
1208  ltx.SetTextColor(kBlue);
1209  ltx.SetTextSize(0.055);
1210  ltx.SetTextAlign(11);
1211  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1212  1 - gPad->GetTopMargin() + 0.01,
1213  unpacked.first == 0
1214  ? ("IOV:" + std::to_string(unpacked.second)).c_str()
1215  : (std::to_string(unpacked.first) + "," + std::to_string(unpacked.second)).c_str());
1216  }
1217 
1219  canvas.SaveAs(fileName.c_str());
1220 
1221  return true;
1222  }
1224  private:
1226 
1227  protected:
1228  bool isForHLT_;
1230  };
1231 
1232  /************************************************
1233  occupancy style map FPix
1234  *************************************************/
1235 
1236  template <gainCalibPI::type myType, class PayloadType>
1238  : public cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV> {
1239  public:
1242  Form("SiPixelGainCalibration %s Forward Pixel Map", TypeName[myType])),
1244  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
1245  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
1246  isForHLT_ = false;
1247  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
1248  } else {
1249  isForHLT_ = true;
1250  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
1251  }
1252  }
1253 
1254  bool fill() override {
1255  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
1256  auto iov = tag.iovs.front();
1257  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
1258 
1259  static const int n_rings = 2;
1260  std::array<TH2D*, n_rings> h_fpix_Gains;
1261  int divide_roc = 1;
1262 
1263  // --------------------- BOOK HISTOGRAMS
1264  for (unsigned int ring = 1; ring <= n_rings; ring++) {
1265  int n = ring == 1 ? 92 : 140;
1266  float y = ring == 1 ? 11.5 : 17.5;
1267  std::string name = "occ_Gains_ring_" + std::to_string(ring);
1268  std::string title = "; Disk # ; Blade/Panel #";
1269 
1270  h_fpix_Gains[ring - 1] =
1271  new TH2D(name.c_str(), title.c_str(), 56 * divide_roc, -3.5, 3.5, n * divide_roc, -y, y);
1272  }
1273 
1274  std::map<uint32_t, float> GainCalibMap_;
1275  gainCalibPI::fillThePerModuleMap(payload, GainCalibMap_, myType);
1276  if (GainCalibMap_.size() != SiPixelPI::phase1size) {
1277  edm::LogError(label_) << "SiPixelGainCalibration maps are not supported for non-Phase1 Pixel geometries !";
1278  TCanvas canvas("Canv", "Canv", 1200, 1000);
1279  SiPixelPI::displayNotSupported(canvas, GainCalibMap_.size());
1281  canvas.SaveAs(fileName.c_str());
1282  return false;
1283  }
1284 
1285  // hardcoded phase-I
1286  std::array<double, 2> minima = {{999., 999.}};
1287 
1288  for (const auto& element : GainCalibMap_) {
1289  int subid = DetId(element.first).subdetId();
1290  if (subid == PixelSubdetector::PixelEndcap) {
1291  auto ring = SiPixelPI::ring(DetId(element.first), m_trackerTopo, true);
1292  auto s_blade = SiPixelPI::signed_blade(DetId(element.first), m_trackerTopo, true);
1293  auto s_disk = SiPixelPI::signed_disk(DetId(element.first), m_trackerTopo, true);
1294  auto s_blade_panel = SiPixelPI::signed_blade_panel(DetId(element.first), m_trackerTopo, true);
1295  auto panel = m_trackerTopo.pxfPanel(element.first);
1296 
1297  COUT << "ring:" << ring << " blade: " << s_blade << " panel: " << panel
1298  << " signed blade/panel: " << s_blade_panel << " disk: " << s_disk << std::endl;
1299 
1300  if (element.second < minima.at(ring - 1))
1301  minima.at(ring - 1) = element.second;
1302 
1303  auto rocsToMask = SiPixelPI::maskedForwardRocsToBins(ring, s_blade, panel, s_disk);
1304  for (const auto& bin : rocsToMask) {
1305  h_fpix_Gains[ring - 1]->SetBinContent(bin.first, bin.second, element.second);
1306  }
1307  }
1308  }
1309 
1310  gStyle->SetOptStat(0);
1311  //=========================
1312  TCanvas canvas("Summary", "Summary", 1200, 600);
1313  canvas.Divide(2, 1);
1314 
1315  for (unsigned int ring = 1; ring <= n_rings; ring++) {
1316  SiPixelPI::adjustCanvasMargins(canvas.cd(ring), -1, 0.08, 0.1, 0.13);
1317 
1318  COUT << " ringer:" << ring << " max:" << h_fpix_Gains[ring - 1]->GetMaximum() << " min: " << minima.at(ring - 1)
1319  << std::endl;
1320 
1321  SiPixelPI::dress_occup_plot(canvas, h_fpix_Gains[ring - 1], 0, ring, 1, true, true, false);
1322  h_fpix_Gains[ring - 1]->GetZaxis()->SetRangeUser(minima.at(ring - 1) - 0.001,
1323  h_fpix_Gains[ring - 1]->GetMaximum() + 0.001);
1324  }
1325 
1326  auto unpacked = SiPixelPI::unpack(std::get<0>(iov));
1327 
1328  for (unsigned int ring = 1; ring <= n_rings; ring++) {
1329  canvas.cd(ring);
1330  auto ltx = TLatex();
1331  ltx.SetTextFont(62);
1332  ltx.SetTextColor(kBlue);
1333  ltx.SetTextSize(0.05);
1334  ltx.SetTextAlign(11);
1335  ltx.DrawLatexNDC(gPad->GetLeftMargin(),
1336  1 - gPad->GetTopMargin() + 0.01,
1337  unpacked.first == 0
1338  ? ("IOV:" + std::to_string(unpacked.second)).c_str()
1339  : (std::to_string(unpacked.first) + "," + std::to_string(unpacked.second)).c_str());
1340  }
1343  canvas.SaveAs(fileName.c_str());
1344  return true;
1345  }
1346 
1347  private:
1349 
1350  protected:
1351  bool isForHLT_;
1353  };
1354 
1355  /************************************************
1356  Summary Comparison per region of SiPixelGainCalibration between 2 IOVs
1357  *************************************************/
1358  template <gainCalibPI::type myType, class PayloadType>
1360  public:
1363  Form("SiPixelGainCalibration %s Comparison by Region", TypeName[myType])) {
1364  if constexpr (std::is_same_v<PayloadType, SiPixelGainCalibrationOffline>) {
1365  isForHLT_ = false;
1366  label_ = "SiPixelGainCalibrationOffline_PayloadInspector";
1367  } else {
1368  isForHLT_ = true;
1369  label_ = "SiPixelGainCalibrationForHLT_PayloadInspector";
1370  }
1371  }
1372  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash>>& iovs) override {
1373  gStyle->SetPaintTextFormat(".3f");
1374 
1375  std::vector<std::tuple<cond::Time_t, cond::Hash>> sorted_iovs = iovs;
1376 
1377  // make absolute sure the IOVs are sortd by since
1378  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const& t1, auto const& t2) {
1379  return std::get<0>(t1) < std::get<0>(t2);
1380  });
1381 
1382  auto firstiov = sorted_iovs.front();
1383  auto lastiov = sorted_iovs.back();
1384 
1385  std::shared_ptr<PayloadType> last_payload = this->fetchPayload(std::get<1>(lastiov));
1386  std::shared_ptr<PayloadType> first_payload = this->fetchPayload(std::get<1>(firstiov));
1387 
1388  std::map<uint32_t, float> f_GainsMap_;
1389  gainCalibPI::fillThePerModuleMap(first_payload, f_GainsMap_, myType);
1390 
1391  std::map<uint32_t, float> l_GainsMap_;
1392  gainCalibPI::fillThePerModuleMap(last_payload, l_GainsMap_, myType);
1393 
1394  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
1395  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
1396 
1397  TCanvas canvas("Comparison", "Comparison", 1600, 800);
1398 
1399  std::map<SiPixelPI::regions, std::shared_ptr<TH1F>> FirstGains_spectraByRegion;
1400  std::map<SiPixelPI::regions, std::shared_ptr<TH1F>> LastGains_spectraByRegion;
1401  std::shared_ptr<TH1F> summaryFirst;
1402  std::shared_ptr<TH1F> summaryLast;
1403 
1404  float minimum(9999.);
1405  float maximum(-9999.);
1406 
1407  switch (myType) {
1408  case gainCalibPI::t_gain:
1409  maximum = std::max(last_payload->getGainHigh(), first_payload->getGainHigh());
1410  minimum = std::min(last_payload->getGainLow(), first_payload->getGainLow());
1411  break;
1413  maximum = std::max(last_payload->getPedHigh(), first_payload->getPedHigh());
1414  minimum = std::min(last_payload->getPedLow(), first_payload->getPedLow());
1415  break;
1416  default:
1417  edm::LogError(label_) << "Unrecognized type " << myType << std::endl;
1418  break;
1419  }
1420 
1421  // book the intermediate histograms
1422  for (int r = SiPixelPI::BPixL1o; r != SiPixelPI::NUM_OF_REGIONS; r++) {
1423  SiPixelPI::regions part = static_cast<SiPixelPI::regions>(r);
1425 
1426  FirstGains_spectraByRegion[part] =
1427  std::make_shared<TH1F>(Form("hfirstGains_%s", s_part.c_str()),
1428  Form(";%s #LT %s #GT;n. of modules", s_part.c_str(), TypeName[myType]),
1429  200,
1430  minimum,
1431  maximum);
1432 
1433  LastGains_spectraByRegion[part] =
1434  std::make_shared<TH1F>(Form("hlastGains_%s", s_part.c_str()),
1435  Form(";%s #LT %s #GT;n. of modules", s_part.c_str(), TypeName[myType]),
1436  200,
1437  minimum,
1438  maximum);
1439  }
1440 
1441  summaryFirst = std::make_shared<TH1F>("first Summary",
1442  Form("Summary of #LT per %s %s #GT;;average %s",
1443  (isForHLT_ ? "Column" : "Pixel"),
1444  TypeName[myType],
1445  TypeName[myType]),
1446  FirstGains_spectraByRegion.size(),
1447  0,
1448  FirstGains_spectraByRegion.size());
1449 
1450  summaryLast = std::make_shared<TH1F>("last Summary",
1451  Form("Summary of #LT per %s %s #GT;;average %s",
1452  (isForHLT_ ? "Column" : "Pixel"),
1453  TypeName[myType],
1454  TypeName[myType]),
1455  LastGains_spectraByRegion.size(),
1456  0,
1457  LastGains_spectraByRegion.size());
1458 
1459  const char* path_toTopologyXML = (f_GainsMap_.size() == SiPixelPI::phase0size)
1460  ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
1461  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1462  TrackerTopology f_tTopo =
1464 
1465  bool isPhase0(false);
1466  if (f_GainsMap_.size() == SiPixelPI::phase0size) {
1467  isPhase0 = true;
1468  }
1469 
1470  // -------------------------------------------------------------------
1471  // loop on the first Gains Map
1472  // -------------------------------------------------------------------
1473  for (const auto& it : f_GainsMap_) {
1474  if (DetId(it.first).det() != DetId::Tracker) {
1475  edm::LogWarning(label_) << "Encountered invalid Tracker DetId:" << it.first << " - terminating ";
1476  return false;
1477  }
1478 
1479  SiPixelPI::topolInfo t_info_fromXML;
1480  t_info_fromXML.init();
1481  DetId detid(it.first);
1482  t_info_fromXML.fillGeometryInfo(detid, f_tTopo, isPhase0);
1483 
1484  SiPixelPI::regions thePart = t_info_fromXML.filterThePartition();
1485  FirstGains_spectraByRegion[thePart]->Fill(it.second);
1486  } // ends loop on the vector of error transforms
1487 
1488  path_toTopologyXML = (l_GainsMap_.size() == SiPixelPI::phase0size)
1489  ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
1490  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1491  TrackerTopology l_tTopo =
1493 
1494  if (l_GainsMap_.size() == SiPixelPI::phase0size) {
1495  isPhase0 = true;
1496  }
1497 
1498  // -------------------------------------------------------------------
1499  // loop on the second Gains Map
1500  // -------------------------------------------------------------------
1501  for (const auto& it : l_GainsMap_) {
1502  if (DetId(it.first).det() != DetId::Tracker) {
1503  edm::LogWarning(label_) << "Encountered invalid Tracker DetId:" << it.first << " - terminating ";
1504  return false;
1505  }
1506 
1507  SiPixelPI::topolInfo t_info_fromXML;
1508  t_info_fromXML.init();
1509  DetId detid(it.first);
1510  t_info_fromXML.fillGeometryInfo(detid, l_tTopo, isPhase0);
1511 
1512  SiPixelPI::regions thePart = t_info_fromXML.filterThePartition();
1513  LastGains_spectraByRegion[thePart]->Fill(it.second);
1514  } // ends loop on the vector of error transforms
1515 
1516  // fill the summary plots
1517  int bin = 1;
1518  for (int r = SiPixelPI::BPixL1o; r != SiPixelPI::NUM_OF_REGIONS; r++) {
1519  SiPixelPI::regions part = static_cast<SiPixelPI::regions>(r);
1520 
1521  summaryFirst->GetXaxis()->SetBinLabel(bin, SiPixelPI::getStringFromRegionEnum(part).c_str());
1522  // avoid filling the histogram with numerical noise
1523  float f_mean =
1524  FirstGains_spectraByRegion[part]->GetMean() > 10.e-6 ? FirstGains_spectraByRegion[part]->GetMean() : 0.;
1525  summaryFirst->SetBinContent(bin, f_mean);
1526  //summaryFirst->SetBinError(bin,Gains_spectraByRegion[hash]->GetRMS());
1527 
1528  summaryLast->GetXaxis()->SetBinLabel(bin, SiPixelPI::getStringFromRegionEnum(part).c_str());
1529  // avoid filling the histogram with numerical noise
1530  float l_mean =
1531  LastGains_spectraByRegion[part]->GetMean() > 10.e-6 ? LastGains_spectraByRegion[part]->GetMean() : 0.;
1532  summaryLast->SetBinContent(bin, l_mean);
1533  //summaryLast->SetBinError(bin,Gains_spectraByRegion[hash]->GetRMS());
1534  bin++;
1535  }
1536 
1537  SiPixelPI::makeNicePlotStyle(summaryFirst.get()); //, kBlue);
1538  summaryFirst->SetMarkerColor(kRed);
1539  summaryFirst->GetXaxis()->LabelsOption("v");
1540  summaryFirst->GetXaxis()->SetLabelSize(0.05);
1541  summaryFirst->GetYaxis()->SetTitleOffset(0.9);
1542 
1543  SiPixelPI::makeNicePlotStyle(summaryLast.get()); //, kRed);
1544  summaryLast->SetMarkerColor(kBlue);
1545  summaryLast->GetYaxis()->SetTitleOffset(0.9);
1546  summaryLast->GetXaxis()->LabelsOption("v");
1547  summaryLast->GetXaxis()->SetLabelSize(0.05);
1548 
1549  canvas.cd()->SetGridy();
1550 
1551  SiPixelPI::adjustCanvasMargins(canvas.cd(), -1, 0.18, 0.11, 0.02);
1552  canvas.Modified();
1553 
1554  summaryFirst->SetFillColor(kRed);
1555  summaryLast->SetFillColor(kBlue);
1556 
1557  summaryFirst->SetBarWidth(0.45);
1558  summaryFirst->SetBarOffset(0.1);
1559 
1560  summaryLast->SetBarWidth(0.4);
1561  summaryLast->SetBarOffset(0.55);
1562 
1563  summaryLast->SetMarkerSize(1.2);
1564  summaryFirst->SetMarkerSize(1.2);
1565 
1566  float max = (summaryFirst->GetMaximum() > summaryLast->GetMaximum()) ? summaryFirst->GetMaximum()
1567  : summaryLast->GetMaximum();
1568 
1569  summaryFirst->GetYaxis()->SetRangeUser(0., std::max(0., max * 1.40));
1570 
1571  summaryFirst->Draw("b text0");
1572  summaryLast->Draw("b text0 same");
1573 
1574  TLegend legend = TLegend(0.52, 0.80, 0.98, 0.9);
1575  legend.SetHeader(Form("#LT %s #GT value comparison", TypeName[myType]),
1576  "C"); // option "C" allows to center the header
1577  legend.AddEntry(
1578  summaryLast.get(),
1579  ("IOV: #scale[1.2]{" + std::to_string(std::get<0>(lastiov)) + "} | #color[4]{" + std::get<1>(lastiov) + "}")
1580  .c_str(),
1581  "F");
1582  legend.AddEntry(
1583  summaryFirst.get(),
1584  ("IOV: #scale[1.2]{" + std::to_string(std::get<0>(firstiov)) + "} | #color[2]{" + std::get<1>(firstiov) + "}")
1585  .c_str(),
1586  "F");
1587  legend.SetTextSize(0.025);
1588  legend.Draw("same");
1591  canvas.SaveAs(fileName.c_str());
1592  return true;
1593  }
1594 
1595  protected:
1596  bool isForHLT_;
1598  };
1599 
1600  template <gainCalibPI::type myType, class PayloadType>
1602  : public SiPixelGainCalibrationByRegionComparisonBase<myType, PayloadType> {
1603  public:
1606  this->setSingleIov(false);
1607  }
1608  };
1609 
1610  template <gainCalibPI::type myType, class PayloadType>
1611  class SiPixelGainCalibrationByRegionComparisonTwoTags
1612  : public SiPixelGainCalibrationByRegionComparisonBase<myType, PayloadType> {
1613  public:
1615  : SiPixelGainCalibrationByRegionComparisonBase<myType, PayloadType>() {
1616  this->setTwoTags(true);
1617  }
1618  };
1619 } // namespace gainCalibHelper
1620 
1621 #endif
gainCalibHelper::gainCalibPI::t_pedestal
Definition: SiPixelGainCalibHelper.h:37
gainCalibHelper::SiPixelGainCalibrationBPIXMap::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1222
SiPixelPI::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: SiPixelPayloadInspectorHelper.h:44
PixelRegionContainers.h
PixelRegions::L1
Definition: PixelRegionContainers.h:27
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:449
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonBase
Definition: SiPixelGainCalibHelper.h:1350
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
gainCalibHelper::SiPixelGainCalibrationValuesByPart::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:923
gainCalibHelper::SiPixelGainCalibrationCorrelations::SiPixelGainCalibrationCorrelations
SiPixelGainCalibrationCorrelations()
Definition: SiPixelGainCalibHelper.h:665
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:845
mps_fire.i
i
Definition: mps_fire.py:355
cond::payloadInspector::IOVMultiplicity
IOVMultiplicity
Definition: PayloadInspector.h:265
PixelSubdetector.h
gainCalibHelper::SiPixelGainCalibrationFPIXMap::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: SiPixelGainCalibHelper.h:1341
gainCalibHelper::SiPixelGainCalibrationFPIXMap::SiPixelGainCalibrationFPIXMap
SiPixelGainCalibrationFPIXMap()
Definition: SiPixelGainCalibHelper.h:1233
gainCalibHelper::gainCalibPI::t_gain
Definition: SiPixelGainCalibHelper.h:37
SiPixelPI::signed_disk
int signed_disk(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:128
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
gainCalibHelper::SiPixelGainCalibrationValueComparisonTwoTags::SiPixelGainCalibrationValueComparisonTwoTags
SiPixelGainCalibrationValueComparisonTwoTags()
Definition: SiPixelGainCalibHelper.h:1088
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
gainCalibHelper::SiPixelGainCalibrationBPIXMap::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: SiPixelGainCalibHelper.h:1219
PixelRegions::PixelIDs
const std::vector< PixelId > PixelIDs
Definition: PixelRegionContainers.h:46
SiPixelPI::ring
int ring(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:93
min
T min(T a, T b)
Definition: MathUtil.h:58
cond::payloadInspector::PlotAnnotations::ntags
int ntags
Definition: PayloadInspector.h:54
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::setSingleIov
void setSingleIov(bool flag)
Definition: PayloadInspector.h:395
gainCalibHelper::SiPixelGainCalibrationValueComparisonSingleTag::SiPixelGainCalibrationValueComparisonSingleTag
SiPixelGainCalibrationValueComparisonSingleTag()
Definition: SiPixelGainCalibHelper.h:1078
gainCalibHelper::SiPixelGainCalibrationValuesByPart::SiPixelGainCalibrationValuesByPart
SiPixelGainCalibrationValuesByPart()
Definition: SiPixelGainCalibHelper.h:784
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
TrackerTopology
Definition: TrackerTopology.h:16
PayloadInspector.h
PixelRegions::Rm1l
Definition: PixelRegionContainers.h:31
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TrackerTopology::pxbLadder
unsigned int pxbLadder(const DetId &id) const
Definition: TrackerTopology.h:155
cuy.col
col
Definition: cuy.py:1010
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::SiPixelGainCalibrationValueComparisonBase
SiPixelGainCalibrationValueComparisonBase()
Definition: SiPixelGainCalibHelper.h:931
SiPixelPI::getStringFromRegionEnum
std::string getStringFromRegionEnum(SiPixelPI::regions e)
Definition: SiPixelPayloadInspectorHelper.h:520
gainCalibHelper::SiPixelGainCalibrationValuesComparisonPerRegion
Definition: SiPixelGainCalibHelper.h:458
gainCalibHelper
Definition: SiPixelGainCalibHelper.h:31
cms::cuda::assert
assert(be >=bs)
cond::payloadInspector::PlotBase::inputParamValues
const std::map< std::string, std::string > & inputParamValues() const
Definition: PayloadInspector.cc:139
gainCalibHelper::SiPixelGainCalibrationValuesComparisonPerRegion::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:476
HLT_2018_cff.Class
Class
Definition: HLT_2018_cff.py:7110
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonBase::SiPixelGainCalibrationByRegionComparisonBase
SiPixelGainCalibrationByRegionComparisonBase()
Definition: SiPixelGainCalibHelper.h:1353
gainCalibHelper::SiPixelGainCalibrationBPIXMap::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:1116
gainCalibHelper::SiPixelGainCalibrationFPIXMap::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1344
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:832
SiPixelGainCalibrationForHLT.h
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiPixelPI::displayNotSupported
void displayNotSupported(TCanvas &canv, const unsigned int size)
Definition: SiPixelPayloadInspectorHelper.h:971
SiPixelPI::phase0size
static const unsigned int phase0size
Definition: SiPixelPayloadInspectorHelper.h:40
gainCalibHelper::SiPixelGainCalibrationFPIXMap
Definition: SiPixelGainCalibHelper.h:1229
PayloadInspectorModule.h
end
#define end
Definition: vmac.h:39
SiPixelPI::checkAnswerOK
bool checkAnswerOK(std::string &answer, bool &result)
Definition: SiPixelPayloadInspectorHelper.h:998
FileInPath.h
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:448
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonSingleTag
Definition: SiPixelGainCalibHelper.h:1592
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
gainCalibHelper::gainCalibPI::t_correlation
Definition: SiPixelGainCalibHelper.h:37
gainCalibHelper::SiPixelGainCalibrationCorrelations
Definition: SiPixelGainCalibHelper.h:660
gainCalibHelper::SiPixelGainCalibrationFPIXMap::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:1247
gainCalibHelper::SiPixelGainCalibrationFPIXMap::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1345
TrackerTopology::pxfPanel
unsigned int pxfPanel(const DetId &id) const
Definition: TrackerTopology.h:450
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
gainCalibHelper::SiPixelGainCalibrationValueComparisonSingleTag
Definition: SiPixelGainCalibHelper.h:1075
part
part
Definition: HCALResponse.h:20
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
gainCalibHelper::SiPixelGainCalibrationValuesComparisonPerRegion::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:653
SiPixelPI::signed_blade
int signed_blade(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:108
StandaloneTrackerTopology.h
gainCalibHelper::TypeName
constexpr char const * TypeName[2]
Definition: SiPixelGainCalibHelper.h:200
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:329
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::setTwoTags
void setTwoTags(bool flag)
Definition: PayloadInspector.h:400
cond::payloadInspector::PlotBase::ntags
unsigned int ntags() const
Definition: PayloadInspector.cc:48
PixelRegions::PixelRegionContainers
Definition: PixelRegionContainers.h:160
SiPixelPI::BPixL1o
Definition: SiPixelPayloadInspectorHelper.h:502
jets_cff.payload
payload
Definition: jets_cff.py:34
cond::payloadInspector::PlotImpl< UNSPECIFIED_IOV, 0 >::fill
virtual bool fill()
Definition: PayloadInspector.h:379
gainCalibHelper::SiPixelGainCalibrationCorrelations::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:776
gainCalibHelper::SiPixelGainCalibrationValues::SiPixelGainCalibrationValues
SiPixelGainCalibrationValues()
Definition: SiPixelGainCalibHelper.h:209
SiPixelPI::topolInfo::filterThePartition
SiPixelPI::regions filterThePartition()
Definition: SiPixelPayloadInspectorHelper.h:651
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
submit.answer
answer
Definition: submit.py:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::payloadInspector::PlotBase::title
std::string title() const
Definition: PayloadInspector.cc:42
edm::LogWarning
Definition: MessageLogger.h:141
gainCalibHelper::SiPixelGainCalibrationValueComparisonTwoTags
Definition: SiPixelGainCalibHelper.h:1085
cond
Definition: plugin.cc:23
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonBase::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1589
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
SiPixelGainCalibrationOffline.h
gainCalibHelper::gainCalibPI::fillThePerModuleMap
static void fillThePerModuleMap(const std::shared_ptr< PayloadType > &payload, AvgMap &map, gainCalibPI::type theType)
Definition: SiPixelGainCalibHelper.h:99
gainCalibHelper::SiPixelGainCalibrationValues::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:221
Time.h
edm::LogError
Definition: MessageLogger.h:183
DetId::Tracker
Definition: DetId.h:25
SiPixelPI::maskedBarrelRocsToBins
std::vector< std::pair< int, int > > maskedBarrelRocsToBins(int layer, int ladder, int module)
Definition: SiPixelPayloadInspectorHelper.h:697
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SiPixelPI::phase1size
static const unsigned int phase1size
Definition: SiPixelPayloadInspectorHelper.h:41
gainCalibHelper::SiPixelGainCalibrationCorrelations::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:775
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:37
listHistos.legend
legend
Definition: listHistos.py:41
PixelRegions::IDlabels
const std::vector< std::string > IDlabels
Definition: PixelRegionContainers.h:64
gainCalibHelper::SiPixelGainCalibrationValues
Definition: SiPixelGainCalibHelper.h:205
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonTwoTags::SiPixelGainCalibrationByRegionComparisonTwoTags
SiPixelGainCalibrationByRegionComparisonTwoTags()
Definition: SiPixelGainCalibHelper.h:1605
SiPixelPI::signed_blade_panel
int signed_blade_panel(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:118
SiPixelPI::regions
regions
Definition: SiPixelPayloadInspectorHelper.h:501
gainCalibHelper::SiPixelGainCalibrationCorrelations::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:677
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1071
gainCalibHelper::gainCalibPI::fillTheHisto
static void fillTheHisto(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1F > h1, gainCalibPI::type theType, const std::vector< uint32_t > &wantedIds={})
Definition: SiPixelGainCalibHelper.h:42
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
module
Definition: vlib.h:198
SiPixelPI::adjustStats
void adjustStats(TPaveStats *stats, float X1, float Y1, float X2, float Y2)
Definition: SiPixelPayloadInspectorHelper.h:449
gainCalibHelper::SiPixelGainCalibrationValuesByPart::fill
bool fill() override
Definition: SiPixelGainCalibHelper.h:796
gainCalibHelper::SiPixelGainCalibrationBPIXMap
Definition: SiPixelGainCalibHelper.h:1098
SiPixelPI::NUM_OF_REGIONS
Definition: SiPixelPayloadInspectorHelper.h:516
alignCSCRings.r
r
Definition: alignCSCRings.py:93
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiPixelPI::signed_module
int signed_module(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:77
gainCalibHelper::SiPixelGainCalibrationValues::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:305
COUT
#define COUT
Definition: PVValidationHelpers.h:13
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion
Definition: SiPixelGainCalibHelper.h:311
gainCalibHelper::AvgMap
std::map< uint32_t, float > AvgMap
Definition: SiPixelGainCalibHelper.h:33
gainCalibHelper::SiPixelGainCalibrationValuesPerRegion::SiPixelGainCalibrationValuesPerRegion
SiPixelGainCalibrationValuesPerRegion()
Definition: SiPixelGainCalibHelper.h:315
SiPixelPI::topolInfo
Definition: SiPixelPayloadInspectorHelper.h:582
TrackerTopology::pxbModule
unsigned int pxbModule(const DetId &id) const
Definition: TrackerTopology.h:160
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1072
Exception
Definition: hltDiff.cc:246
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonSingleTag::SiPixelGainCalibrationByRegionComparisonSingleTag
SiPixelGainCalibrationByRegionComparisonSingleTag()
Definition: SiPixelGainCalibHelper.h:1595
PVValHelper::ladder
Definition: PVValidationHelpers.h:72
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
cond::payloadInspector::PlotImage
Definition: PayloadInspector.h:829
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
SiPixelPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: SiPixelPayloadInspectorHelper.h:475
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
gainCalibHelper::SiPixelGainCalibrationValues::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:306
SiPixelPI::getExtrema
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Definition: SiPixelPayloadInspectorHelper.h:459
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiPixelPI::dress_occup_plot
void dress_occup_plot(TCanvas &canv, TH2 *h, int lay, int ring=0, int phase=0, bool half_shift=true, bool mark_zero=true, bool standard_palette=true)
Definition: SiPixelPayloadInspectorHelper.h:148
gainCalibHelper::SiPixelGainCalibrationValuesByPart::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:922
ztail.d
d
Definition: ztail.py:151
SiPixelPayloadInspectorHelper.h
genParticles_cff.map
map
Definition: genParticles_cff.py:11
gainCalibHelper::SiPixelGainCalibrationValueComparisonBase
Definition: SiPixelGainCalibHelper.h:928
PixelRegions::attachedDets
const std::vector< uint32_t > attachedDets(const PixelRegions::PixelId theId, const TrackerTopology *trackTopo, const bool phase1)
Definition: PixelRegionContainers.h:119
gainCalibHelper::gainCalibPI::fillTheHistos
static void fillTheHistos(const std::shared_ptr< PayloadType > &payload, std::shared_ptr< TH1 > hBPix, std::shared_ptr< TH1 > hFPix, gainCalibPI::type theType)
Definition: SiPixelGainCalibHelper.h:145
cond::payloadInspector::PlotBase::addInputParam
void addInputParam(const std::string &paramName)
Definition: PayloadInspector.cc:35
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:265
gainCalibHelper::SiPixelGainCalibrationByRegionComparisonBase::isForHLT_
bool isForHLT_
Definition: SiPixelGainCalibHelper.h:1588
SiPixelPI::topolInfo::init
void init()
Definition: SiPixelPayloadInspectorHelper.h:609
gainCalibHelper::SiPixelGainCalibrationValuesComparisonPerRegion::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:654
SiPixelPI::topolInfo::fillGeometryInfo
void fillGeometryInfo(const DetId &detId, const TrackerTopology &tTopo, bool isPhase0)
Definition: SiPixelPayloadInspectorHelper.h:631
gainCalibHelper::SiPixelGainCalibrationValuesByPart
Definition: SiPixelGainCalibHelper.h:780
cond::payloadInspector::PlotBase::m_plotAnnotations
PlotAnnotations m_plotAnnotations
Definition: PayloadInspector.h:252
SiPixelPI::signed_ladder
int signed_ladder(const DetId &detid, const TrackerTopology &tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:65
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
begin
#define begin
Definition: vmac.h:32
gainCalibHelper::SiPixelGainCalibrationBPIXMap::SiPixelGainCalibrationBPIXMap
SiPixelGainCalibrationBPIXMap()
Definition: SiPixelGainCalibHelper.h:1102
SiPixelPI::maskedForwardRocsToBins
std::vector< std::pair< int, int > > maskedForwardRocsToBins(int ring, int blade, int panel, int disk)
Definition: SiPixelPayloadInspectorHelper.h:803
SiPixelPI::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: SiPixelPayloadInspectorHelper.h:435
gainCalibHelper::SiPixelGainCalibrationBPIXMap::label_
std::string label_
Definition: SiPixelGainCalibHelper.h:1223
gainCalibHelper::SiPixelGainCalibrationValuesComparisonPerRegion::SiPixelGainCalibrationValuesComparisonPerRegion
SiPixelGainCalibrationValuesComparisonPerRegion()
Definition: SiPixelGainCalibHelper.h:462