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