CMS 3D CMS Logo

HcalHardcodeCalibrations.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Original Author: Fedor Ratnikov
3 //
4 //
5 
6 #include <memory>
7 #include <iostream>
8 #include <string>
9 #include <vector>
10 
18 
21 
25 
27 
28 //#define EDM_ML_DEBUG
29 
30 // class decleration
31 //
32 
33 using namespace cms;
34 
35 namespace {
36 
37  const std::vector<HcalGenericDetId>& allCells(const HcalTopology& hcaltopology,
38  const ZdcTopology& zdctopology,
39  bool killHE = false) {
40  static std::vector<HcalGenericDetId> result;
41  int maxDepth = hcaltopology.maxDepth();
42 
43 #ifdef EDM_ML_DEBUG
44  edm::LogVerbatim("HcalCalib") << std::endl << "HcalHardcodeCalibrations: maxDepth = " << maxDepth;
45 #endif
46 
47  if (result.empty()) {
49  for (unsigned int phi = 0; phi <= HcalDetId::kHcalPhiMask2; phi++) {
50  for (int depth = 1; depth <= maxDepth; depth++) {
51  for (int det = 1; det <= HcalForward; det++) {
52  HcalDetId cell((HcalSubdetector)det, eta, phi, depth);
53  if (killHE && HcalEndcap == cell.subdetId())
54  continue;
55  if (hcaltopology.valid(cell)) {
56  result.push_back(cell);
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("HcalCalib") << " HcalHardcodedCalibrations: det|eta|phi|depth = " << det << "|" << eta
59  << "|" << phi << "|" << depth;
60 #endif
61  }
62  }
63  }
64  }
65  }
66  HcalZDCDetId zcell;
68  for (int depth = 1; depth < 6; depth++) {
69  zcell = HcalZDCDetId(section, true, depth);
70  if (zdctopology.valid(zcell)) {
71  result.push_back(zcell);
72 #ifdef EDM_ML_DEBUG
73  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
74 #endif
75  }
76  zcell = HcalZDCDetId(section, false, depth);
77  if (zdctopology.valid(zcell)) {
78  result.push_back(zcell);
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
81 #endif
82  }
83  }
85  for (int depth = 1; depth < 5; depth++) {
86  zcell = HcalZDCDetId(section, true, depth);
87  if (zdctopology.valid(zcell)) {
88  result.push_back(zcell);
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
91 #endif
92  }
93  zcell = HcalZDCDetId(section, false, depth);
94  if (zdctopology.valid(zcell)) {
95  result.push_back(zcell);
96 #ifdef EDM_ML_DEBUG
97  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
98 #endif
99  }
100  }
102  for (int depth = 1; depth < 3; depth++) {
103  zcell = HcalZDCDetId(section, true, depth);
104  if (zdctopology.valid(zcell)) {
105  result.push_back(zcell);
106 #ifdef EDM_ML_DEBUG
107  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
108 #endif
109  }
110  zcell = HcalZDCDetId(section, false, depth);
111  if (zdctopology.valid(zcell)) {
112  result.push_back(zcell);
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
115 #endif
116  }
117  }
119  for (int depth = 1; depth < 17; depth++) {
120  zcell = HcalZDCDetId(section, true, depth);
121  if (zdctopology.valid(zcell)) {
122  result.push_back(zcell);
123 #ifdef EDM_ML_DEBUG
124  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
125 #endif
126  }
127  zcell = HcalZDCDetId(section, false, depth);
128  if (zdctopology.valid(zcell)) {
129  result.push_back(zcell);
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HcalCalib") << " ZDC cell : " << zcell;
132 #endif
133  }
134  }
135 
136  // HcalGenTriggerTower (HcalGenericSubdetector = 5)
137  // NASTY HACK !!!
138  // - As no valid(cell) check found for HcalTrigTowerDetId
139  // to create HT cells (ieta=1-28, iphi=1-72)&(ieta=29-32, iphi=1,5,... 69)
140 
141  for (int vers = 0; vers <= HcalTrigTowerDetId::kHcalVersMask; ++vers) {
142  for (int depth = 0; depth <= HcalTrigTowerDetId::kHcalDepthMask; ++depth) {
144  for (int phi = 1; phi <= HcalTrigTowerDetId::kHcalPhiMask; phi++) {
145  HcalTrigTowerDetId cell(eta, phi, depth, vers);
146  if (hcaltopology.validHT(cell)) {
147  result.push_back(cell);
148 #ifdef EDM_ML_DEBUG
149  edm::LogVerbatim("HcalCalib") << " HcalHardcodedCalibrations: eta|phi|depth|vers = " << eta << "|"
150  << phi << "|" << depth << "|" << vers;
151 #endif
152  }
153  }
154  }
155  }
156  }
157  }
158  return result;
159  }
160 
161 } // namespace
162 
164  : hb_recalibration(nullptr),
165  he_recalibration(nullptr),
166  hf_recalibration(nullptr),
167  setHEdsegm(false),
168  setHBdsegm(false) {
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::HcalHardcodeCalibrations->...";
171 #endif
172 
173  if (iConfig.exists("GainWidthsForTrigPrims"))
174  switchGainWidthsForTrigPrims = iConfig.getParameter<bool>("GainWidthsForTrigPrims");
175  else
177 
178  //DB helper preparation
186  dbHardcode.useHBUpgrade(iConfig.getParameter<bool>("useHBUpgrade"));
187  dbHardcode.useHEUpgrade(iConfig.getParameter<bool>("useHEUpgrade"));
188  dbHardcode.useHFUpgrade(iConfig.getParameter<bool>("useHFUpgrade"));
189  dbHardcode.useHOUpgrade(iConfig.getParameter<bool>("useHOUpgrade"));
190  dbHardcode.testHFQIE10(iConfig.getParameter<bool>("testHFQIE10"));
191  dbHardcode.testHEPlan1(iConfig.getParameter<bool>("testHEPlan1"));
192  dbHardcode.setKillHE(iConfig.getParameter<bool>("killHE"));
193  dbHardcode.setSiPMCharacteristics(iConfig.getParameter<std::vector<edm::ParameterSet>>("SiPMCharacteristics"));
194 
195  useLayer0Weight = iConfig.getParameter<bool>("useLayer0Weight");
196  useIeta18depth1 = iConfig.getParameter<bool>("useIeta18depth1");
197  testHEPlan1 = iConfig.getParameter<bool>("testHEPlan1");
198  // HB, HE, HF recalibration preparation
199  iLumi = iConfig.getParameter<double>("iLumi");
200 
201  if (iLumi > 0.0) {
202  bool hb_recalib = iConfig.getParameter<bool>("HBRecalibration");
203  bool he_recalib = iConfig.getParameter<bool>("HERecalibration");
204  bool hf_recalib = iConfig.getParameter<bool>("HFRecalibration");
205  if (hb_recalib) {
207  std::make_unique<HBHERecalibration>(iLumi,
208  iConfig.getParameter<double>("HBreCalibCutoff"),
209  iConfig.getParameter<edm::FileInPath>("HBmeanenergies").fullPath());
210  }
211  if (he_recalib) {
213  std::make_unique<HBHERecalibration>(iLumi,
214  iConfig.getParameter<double>("HEreCalibCutoff"),
215  iConfig.getParameter<edm::FileInPath>("HEmeanenergies").fullPath());
216  }
217  if (hf_recalib && !iConfig.getParameter<edm::ParameterSet>("HFRecalParameterBlock").empty())
219  std::make_unique<HFRecalibration>(iConfig.getParameter<edm::ParameterSet>("HFRecalParameterBlock"));
220 
221 #ifdef EDM_ML_DEBUG
222  edm::LogVerbatim("HcalCalib") << " HcalHardcodeCalibrations: iLumi = " << iLumi;
223 #endif
224  }
225 
226  std::vector<std::string> toGet = iConfig.getUntrackedParameter<std::vector<std::string>>("toGet");
227  for (auto& objectName : toGet) {
228  bool all = objectName == "all";
229 #ifdef EDM_ML_DEBUG
230  edm::LogVerbatim("HcalCalib") << "Load parameters for " << objectName;
231 #endif
232  if ((objectName == "Pedestals") || all) {
234  topoTokens_[kPedestals] = c.consumes();
235  zdcTopoTokens_[kPedestals] = c.consumes();
236  findingRecord<HcalPedestalsRcd>();
237  }
238  if ((objectName == "PedestalWidths") || all) {
240  topoTokens_[kPedestalWidths] = c.consumes();
241  zdcTopoTokens_[kPedestalWidths] = c.consumes();
242  findingRecord<HcalPedestalWidthsRcd>();
243  }
244  if ((objectName == "EffectivePedestals") || all) {
246  topoTokens_[kEffectivePedestals] = c.consumes();
247  zdcTopoTokens_[kEffectivePedestals] = c.consumes();
248  findingRecord<HcalPedestalsRcd>();
249  }
250  if ((objectName == "EffectivePedestalWidths") || all) {
251  auto c =
253  topoTokens_[kEffectivePedestalWidths] = c.consumes();
255  findingRecord<HcalPedestalWidthsRcd>();
256  }
257  if ((objectName == "Gains") || all) {
259  topoTokens_[kGains] = c.consumes();
260  zdcTopoTokens_[kGains] = c.consumes();
261  findingRecord<HcalGainsRcd>();
262  }
263  if ((objectName == "GainWidths") || all) {
265  topoTokens_[kGainWidths] = c.consumes();
266  zdcTopoTokens_[kGainWidths] = c.consumes();
267  findingRecord<HcalGainWidthsRcd>();
268  }
269  if ((objectName == "PFCuts") || all) {
271  topoTokens_[kPFCuts] = c.consumes();
272  zdcTopoTokens_[kPFCuts] = c.consumes();
273  findingRecord<HcalPFCutsRcd>();
274  }
275  if ((objectName == "QIEData") || all) {
277  topoTokens_[kQIEData] = c.consumes();
278  zdcTopoTokens_[kQIEData] = c.consumes();
279  findingRecord<HcalQIEDataRcd>();
280  }
281  if ((objectName == "QIETypes") || all) {
283  topoTokens_[kQIETypes] = c.consumes();
284  zdcTopoTokens_[kQIETypes] = c.consumes();
285  findingRecord<HcalQIETypesRcd>();
286  }
287  if ((objectName == "ChannelQuality") || (objectName == "channelQuality") || all) {
289  topoTokens_[kChannelQuality] = c.consumes();
290  zdcTopoTokens_[kChannelQuality] = c.consumes();
291  findingRecord<HcalChannelQualityRcd>();
292  }
293  if ((objectName == "ElectronicsMap") || (objectName == "electronicsMap") || all) {
295  topoTokens_[kElectronicsMap] = c.consumes();
296  zdcTopoTokens_[kElectronicsMap] = c.consumes();
297  findingRecord<HcalElectronicsMapRcd>();
298  }
299  if ((objectName == "ZSThresholds") || (objectName == "zsThresholds") || all) {
301  topoTokens_[kZSThresholds] = c.consumes();
302  zdcTopoTokens_[kZSThresholds] = c.consumes();
303  findingRecord<HcalZSThresholdsRcd>();
304  }
305  if ((objectName == "RespCorrs") || (objectName == "ResponseCorrection") || all) {
307  topoTokens_[kRespCorrs] = c.consumes();
308  zdcTopoTokens_[kRespCorrs] = c.consumes();
309  if (he_recalibration) {
310  heDarkeningToken_ = c.consumes(edm::ESInputTag("", "HE"));
311  }
312  if (hb_recalibration) {
313  hbDarkeningToken_ = c.consumes(edm::ESInputTag("", "HB"));
314  }
315  findingRecord<HcalRespCorrsRcd>();
316  }
317  if ((objectName == "LUTCorrs") || (objectName == "LUTCorrection") || all) {
319  topoTokens_[kLUTCorrs] = c.consumes();
320  zdcTopoTokens_[kLUTCorrs] = c.consumes();
321  findingRecord<HcalLUTCorrsRcd>();
322  }
323  if ((objectName == "PFCorrs") || (objectName == "PFCorrection") || all) {
325  topoTokens_[kPFCorrs] = c.consumes();
326  zdcTopoTokens_[kPFCorrs] = c.consumes();
327  findingRecord<HcalPFCorrsRcd>();
328  }
329  if ((objectName == "TimeCorrs") || (objectName == "TimeCorrection") || all) {
331  topoTokens_[kTimeCorrs] = c.consumes();
332  zdcTopoTokens_[kTimeCorrs] = c.consumes();
333  findingRecord<HcalTimeCorrsRcd>();
334  }
335  if ((objectName == "L1TriggerObjects") || (objectName == "L1Trigger") || all) {
337  topoTokens_[kL1TriggerObjects] = c.consumes();
338  zdcTopoTokens_[kL1TriggerObjects] = c.consumes();
339  findingRecord<HcalL1TriggerObjectsRcd>();
340  }
341  if ((objectName == "ValidationCorrs") || (objectName == "ValidationCorrection") || all) {
343  topoTokens_[kValidationCorrs] = c.consumes();
344  zdcTopoTokens_[kValidationCorrs] = c.consumes();
345  findingRecord<HcalValidationCorrsRcd>();
346  }
347  if ((objectName == "LutMetadata") || (objectName == "lutMetadata") || all) {
349  topoTokens_[kLutMetadata] = c.consumes();
350  zdcTopoTokens_[kLutMetadata] = c.consumes();
351  findingRecord<HcalLutMetadataRcd>();
352  }
353  if ((objectName == "DcsValues") || all) {
355  findingRecord<HcalDcsRcd>();
356  }
357  if ((objectName == "DcsMap") || (objectName == "dcsMap") || all) {
359  findingRecord<HcalDcsMapRcd>();
360  }
361  if ((objectName == "RecoParams") || all) {
363  topoTokens_[kRecoParams] = c.consumes();
364  zdcTopoTokens_[kRecoParams] = c.consumes();
365  findingRecord<HcalRecoParamsRcd>();
366  }
367  if ((objectName == "LongRecoParams") || all) {
369  topoTokens_[kLongRecoParams] = c.consumes();
370  zdcTopoTokens_[kLongRecoParams] = c.consumes();
371  findingRecord<HcalLongRecoParamsRcd>();
372  }
373  if ((objectName == "ZDCLowGainFractions") || all) {
375  topoTokens_[kZDCLowGainFractions] = c.consumes();
376  zdcTopoTokens_[kZDCLowGainFractions] = c.consumes();
377  findingRecord<HcalZDCLowGainFractionsRcd>();
378  }
379  if ((objectName == "MCParams") || all) {
381  topoTokens_[kMCParams] = c.consumes();
382  zdcTopoTokens_[kMCParams] = c.consumes();
383  findingRecord<HcalMCParamsRcd>();
384  }
385  if ((objectName == "FlagHFDigiTimeParams") || all) {
387  topoTokens_[kFlagHFDigiTimeParams] = c.consumes();
388  zdcTopoTokens_[kFlagHFDigiTimeParams] = c.consumes();
389  findingRecord<HcalFlagHFDigiTimeParamsRcd>();
390  }
391  if ((objectName == "FrontEndMap") || (objectName == "frontEndMap") || all) {
393  topoTokens_[kFrontEndMap] = c.consumes();
394  zdcTopoTokens_[kFrontEndMap] = c.consumes();
395  findingRecord<HcalFrontEndMapRcd>();
396  }
397  if ((objectName == "SiPMParameters") || all) {
399  topoTokens_[kSiPMParameters] = c.consumes();
400  zdcTopoTokens_[kSiPMParameters] = c.consumes();
401  findingRecord<HcalSiPMParametersRcd>();
402  }
403  if ((objectName == "SiPMCharacteristics") || all) {
405  findingRecord<HcalSiPMCharacteristicsRcd>();
406  }
407  if ((objectName == "TPChannelParameters") || all) {
409  topoTokens_[kTPChannelParameters] = c.consumes();
410  zdcTopoTokens_[kTPChannelParameters] = c.consumes();
411  findingRecord<HcalTPChannelParametersRcd>();
412  }
413  if ((objectName == "TPParameters") || all) {
415  findingRecord<HcalTPParametersRcd>();
416  }
417  }
418 }
419 
421 
422 //
423 // member functions
424 //
426  const edm::IOVSyncValue& iTime,
427  edm::ValidityInterval& oInterval) {
428  std::string record = iKey.name();
429 #ifdef EDM_ML_DEBUG
430  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::setIntervalFor-> key: " << record
431  << " time: " << iTime.eventID() << '/' << iTime.time().value();
432 #endif
434 }
435 
436 std::unique_ptr<HcalPedestals> HcalHardcodeCalibrations::producePedestals_(
437  const HcalPedestalsRcd& rec,
440  bool eff) {
441  std::string seff = eff ? "Effective" : "";
442 #ifdef EDM_ML_DEBUG
443  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produce" << seff << "Pedestals-> ...";
444 #endif
445  auto const& topo = rec.get(token);
446  auto const& zdcTopo = rec.get(zdctoken);
447  auto result = std::make_unique<HcalPedestals>(&topo, false);
448  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
449  for (auto cell : cells) {
450  HcalPedestal item = dbHardcode.makePedestal(cell, false, eff, &topo, iLumi);
451  result->addValues(item);
452  }
453  return result;
454 }
455 
456 std::unique_ptr<HcalPedestalWidths> HcalHardcodeCalibrations::producePedestalWidths_(
457  const HcalPedestalWidthsRcd& rec,
460  bool eff) {
461  std::string seff = eff ? "Effective" : "";
462 #ifdef EDM_ML_DEBUG
463  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produce" << seff << "PedestalWidths-> ...";
464 #endif
465  auto const& topo = rec.get(token);
466  auto const& zdcTopo = rec.get(zdctoken);
467  auto result = std::make_unique<HcalPedestalWidths>(&topo, false);
468  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
469  for (auto cell : cells) {
471  result->addValues(item);
472  }
473  return result;
474 }
475 
476 std::unique_ptr<HcalPedestals> HcalHardcodeCalibrations::producePedestals(const HcalPedestalsRcd& rec) {
478 }
479 
480 std::unique_ptr<HcalPedestals> HcalHardcodeCalibrations::produceEffectivePedestals(const HcalPedestalsRcd& rec) {
482 }
483 
484 std::unique_ptr<HcalPedestalWidths> HcalHardcodeCalibrations::producePedestalWidths(const HcalPedestalWidthsRcd& rec) {
486 }
487 
489  const HcalPedestalWidthsRcd& rec) {
490  return producePedestalWidths_(
492 }
493 
494 std::unique_ptr<HcalGains> HcalHardcodeCalibrations::produceGains(const HcalGainsRcd& rec) {
495 #ifdef EDM_ML_DEBUG
496  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceGains-> ...";
497 #endif
498  auto const& topo = rec.get(topoTokens_[kGains]);
499  auto const& zdcTopo = rec.get(zdcTopoTokens_[kGains]);
500  auto result = std::make_unique<HcalGains>(&topo);
501  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
502  for (auto cell : cells) {
504  result->addValues(item);
505  }
506  return result;
507 }
508 
509 std::unique_ptr<HcalGainWidths> HcalHardcodeCalibrations::produceGainWidths(const HcalGainWidthsRcd& rec) {
510 #ifdef EDM_ML_DEBUG
511  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceGainWidths-> ...";
512 #endif
513  auto const& topo = rec.get(topoTokens_[kGainWidths]);
514  auto const& zdcTopo = rec.get(zdcTopoTokens_[kGainWidths]);
515  auto result = std::make_unique<HcalGainWidths>(&topo);
516  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
517  for (auto cell : cells) {
518  // for Upgrade - include TrigPrims, for regular case - only HcalDetId
520 #ifdef EDM_ML_DEBUG
521  edm::LogVerbatim("HcalCalib") << " HcalGainWidths cell (with TPs) : " << std::hex << cell.rawId() << std::dec
522  << " " << cell;
523 #endif
525  result->addValues(item);
526  } else if (!cell.isHcalTrigTowerDetId()) {
527 #ifdef EDM_ML_DEBUG
528  edm::LogVerbatim("HcalCalib") << " HcalGainWidths cell (without TPs) : " << std::hex << cell.rawId() << std::dec
529  << " " << cell;
530 #endif
532  result->addValues(item);
533  }
534  }
535  return result;
536 }
537 
538 std::unique_ptr<HcalPFCuts> HcalHardcodeCalibrations::producePFCuts(const HcalPFCutsRcd& rec) {
539 #ifdef EDM_ML_DEBUG
540  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::producePFCuts-> ...";
541 #endif
542  auto const& topo = rec.get(topoTokens_[kPFCuts]);
543  auto const& zdcTopo = rec.get(zdcTopoTokens_[kPFCuts]);
544  auto result = std::make_unique<HcalPFCuts>(&topo);
545  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
546  for (auto cell : cells) {
547  // Use only standard Hcal channels for now, no TrigPrims
548  if (!cell.isHcalTrigTowerDetId()) {
550  result->addValues(item);
551  }
552  }
553  return result;
554 }
555 
556 std::unique_ptr<HcalQIEData> HcalHardcodeCalibrations::produceQIEData(const HcalQIEDataRcd& rcd) {
557 #ifdef EDM_ML_DEBUG
558  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceQIEData-> ...";
559 #endif
560 
561  auto const& topo = rcd.get(topoTokens_[kQIEData]);
562  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kQIEData]);
563  auto result = std::make_unique<HcalQIEData>(&topo);
564  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
565  for (auto cell : cells) {
566  HcalQIECoder coder = dbHardcode.makeQIECoder(cell);
567  result->addCoder(coder);
568  }
569  return result;
570 }
571 
572 std::unique_ptr<HcalQIETypes> HcalHardcodeCalibrations::produceQIETypes(const HcalQIETypesRcd& rcd) {
573 #ifdef EDM_ML_DEBUG
574  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceQIETypes-> ...";
575 #endif
576  auto const& topo = rcd.get(topoTokens_[kQIETypes]);
577  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kQIETypes]);
578 
579  auto result = std::make_unique<HcalQIETypes>(&topo);
580  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
581  for (auto cell : cells) {
583  result->addValues(item);
584  }
585  return result;
586 }
587 
588 std::unique_ptr<HcalChannelQuality> HcalHardcodeCalibrations::produceChannelQuality(const HcalChannelQualityRcd& rcd) {
589 #ifdef EDM_ML_DEBUG
590  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceChannelQuality-> ...";
591 #endif
592  auto const& topo = rcd.get(topoTokens_[kChannelQuality]);
593  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kChannelQuality]);
594 
595  auto result = std::make_unique<HcalChannelQuality>(&topo);
596  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
597  for (auto cell : cells) {
598  // Special: removal of (non-instrumented) layer "-1"("nose") = depth 1
599  // from Upgrade HE, either from
600  // (i) HEP17 sector in 2017 or
601  // (ii) the entire HE rin=18 from 2018 through Run 3.
602  // May require a revision by 2021.
603 
604  uint32_t status = 0;
605 
606  if (!(cell.isHcalZDCDetId())) {
607  HcalDetId hid = HcalDetId(cell);
608  int iphi = hid.iphi();
609  int ieta = hid.ieta();
610  int absieta = hid.ietaAbs();
611  int depth = hid.depth();
612 
613  // specific HEP17 sector (2017 only)
614  bool isHEP17 = (iphi >= 63) && (iphi <= 66) && (ieta > 0);
615  // |ieta|=18, depth=1
616  bool is18d1 = (absieta == 18) && (depth == 1);
617 
618  if ((!useIeta18depth1 && is18d1) && ((testHEPlan1 && isHEP17) || (!testHEPlan1))) {
619  status = 0x8002; // dead cell
620  }
621  }
622 
623  HcalChannelStatus item(cell.rawId(), status);
624  result->addValues(item);
625  }
626 
627  return result;
628 }
629 
630 std::unique_ptr<HcalRespCorrs> HcalHardcodeCalibrations::produceRespCorrs(const HcalRespCorrsRcd& rcd) {
631 #ifdef EDM_ML_DEBUG
632  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceRespCorrs-> ...";
633 #endif
634  auto const& topo = rcd.get(topoTokens_[kRespCorrs]);
635  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kRespCorrs]);
636 
637  //set depth segmentation for HB/HE recalib - only happens once
639  std::vector<std::vector<int>> m_segmentation;
640  int maxEta = topo.lastHBHERing();
641  m_segmentation.resize(maxEta);
642  for (int i = 0; i < maxEta; i++) {
643  topo.getDepthSegmentation(i + 1, m_segmentation[i]);
644  }
645  if (he_recalibration && !setHEdsegm) {
646  he_recalibration->setup(m_segmentation, &rcd.get(heDarkeningToken_));
647  setHEdsegm = true;
648  }
649  if (hb_recalibration && !setHBdsegm) {
650  hb_recalibration->setup(m_segmentation, &rcd.get(hbDarkeningToken_));
651  setHBdsegm = true;
652  }
653  }
654 
655  auto result = std::make_unique<HcalRespCorrs>(&topo);
656  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
657  for (const auto& cell : cells) {
658  double corr = 1.0;
659 
660  //check for layer 0 reweighting: when depth 1 has only one layer, it is layer 0
661  if (useLayer0Weight &&
662  ((cell.genericSubdet() == HcalGenericDetId::HcalGenEndcap) ||
663  (cell.genericSubdet() == HcalGenericDetId::HcalGenBarrel)) &&
664  (HcalDetId(cell).depth() == 1 &&
665  dbHardcode.getLayersInDepth(HcalDetId(cell).ietaAbs(), HcalDetId(cell).depth(), &topo) == 1)) {
666  //layer 0 is thicker than other layers (9mm vs 3.7mm) and brighter (Bicron vs SCSN81)
667  //in Run1/Run2 (pre-2017 for HE), ODU for layer 0 had neutral density filter attached
668  //NDF was simulated as weight of 0.5 applied to Geant energy deposits
669  //for Phase1, NDF is removed - simulated as weight of 1.2 applied to Geant energy deposits
670  //to maintain RECO calibrations, move the layer 0 energy scale back to its previous state using respcorrs
671  corr = 0.5 / 1.2;
672  }
673 
674  if ((hb_recalibration != nullptr) && (cell.genericSubdet() == HcalGenericDetId::HcalGenBarrel)) {
675  int depth_ = HcalDetId(cell).depth();
676  int ieta_ = HcalDetId(cell).ieta();
677  corr *= hb_recalibration->getCorr(ieta_, depth_);
678 #ifdef EDM_ML_DEBUG
679  edm::LogVerbatim("HcalCalib") << "HB ieta, depth = " << ieta_ << ", " << depth_ << " corr = " << corr;
680 #endif
681  } else if ((he_recalibration != nullptr) && (cell.genericSubdet() == HcalGenericDetId::HcalGenEndcap)) {
682  int depth_ = HcalDetId(cell).depth();
683  int ieta_ = HcalDetId(cell).ieta();
684  corr *= he_recalibration->getCorr(ieta_, depth_);
685 #ifdef EDM_ML_DEBUG
686  edm::LogVerbatim("HcalCalib") << "HE ieta, depth = " << ieta_ << ", " << depth_ << " corr = " << corr;
687 #endif
688  } else if ((hf_recalibration != nullptr) && (cell.genericSubdet() == HcalGenericDetId::HcalGenForward)) {
689  int depth_ = HcalDetId(cell).depth();
690  int ieta_ = HcalDetId(cell).ieta();
691  corr = hf_recalibration->getCorr(ieta_, depth_, iLumi);
692 #ifdef EDM_ML_DEBUG
693  edm::LogVerbatim("HcalCalib") << "HF ieta, depth = " << ieta_ << ", " << depth_ << " corr = " << corr;
694 #endif
695  }
696 
697  HcalRespCorr item(cell.rawId(), corr);
698  result->addValues(item);
699  }
700  return result;
701 }
702 
703 std::unique_ptr<HcalLUTCorrs> HcalHardcodeCalibrations::produceLUTCorrs(const HcalLUTCorrsRcd& rcd) {
704 #ifdef EDM_ML_DEBUG
705  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceLUTCorrs-> ...";
706 #endif
707  auto const& topo = rcd.get(topoTokens_[kLUTCorrs]);
708  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kLUTCorrs]);
709 
710  auto result = std::make_unique<HcalLUTCorrs>(&topo);
711  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
712  for (auto cell : cells) {
713  HcalLUTCorr item(cell.rawId(), 1.0);
714  result->addValues(item);
715  }
716  return result;
717 }
718 
719 std::unique_ptr<HcalPFCorrs> HcalHardcodeCalibrations::producePFCorrs(const HcalPFCorrsRcd& rcd) {
720 #ifdef EDM_ML_DEBUG
721  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::producePFCorrs-> ...";
722 #endif
723  auto const& topo = rcd.get(topoTokens_[kPFCorrs]);
724  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kPFCorrs]);
725 
726  auto result = std::make_unique<HcalPFCorrs>(&topo);
727  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
728  for (auto cell : cells) {
729  HcalPFCorr item(cell.rawId(), 1.0);
730  result->addValues(item);
731  }
732  return result;
733 }
734 
735 std::unique_ptr<HcalTimeCorrs> HcalHardcodeCalibrations::produceTimeCorrs(const HcalTimeCorrsRcd& rcd) {
736 #ifdef EDM_ML_DEBUG
737  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceTimeCorrs-> ...";
738 #endif
739  auto const& topo = rcd.get(topoTokens_[kTimeCorrs]);
740  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kTimeCorrs]);
741 
742  auto result = std::make_unique<HcalTimeCorrs>(&topo);
743  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
744  for (auto cell : cells) {
745  HcalTimeCorr item(cell.rawId(), 0.0);
746  result->addValues(item);
747  }
748  return result;
749 }
750 
751 std::unique_ptr<HcalZSThresholds> HcalHardcodeCalibrations::produceZSThresholds(const HcalZSThresholdsRcd& rcd) {
752 #ifdef EDM_ML_DEBUG
753  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceZSThresholds-> ...";
754 #endif
755  auto const& topo = rcd.get(topoTokens_[kZSThresholds]);
756  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kZSThresholds]);
757 
758  auto result = std::make_unique<HcalZSThresholds>(&topo);
759  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
760  for (auto cell : cells) {
762  result->addValues(item);
763  }
764  return result;
765 }
766 
767 std::unique_ptr<HcalL1TriggerObjects> HcalHardcodeCalibrations::produceL1TriggerObjects(
768  const HcalL1TriggerObjectsRcd& rcd) {
769 #ifdef EDM_ML_DEBUG
770  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceL1TriggerObjects-> ...";
771 #endif
772  auto const& topo = rcd.get(topoTokens_[kL1TriggerObjects]);
773  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kL1TriggerObjects]);
774 
775  auto result = std::make_unique<HcalL1TriggerObjects>(&topo);
776  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
777  for (auto cell : cells) {
778  HcalL1TriggerObject item(cell.rawId(), 0., 1., 0);
779  result->addValues(item);
780  }
781  // add tag and algo values
782  result->setTagString("hardcoded");
783  result->setAlgoString("hardcoded");
784  return result;
785 }
786 
787 std::unique_ptr<HcalElectronicsMap> HcalHardcodeCalibrations::produceElectronicsMap(const HcalElectronicsMapRcd& rcd) {
788 #ifdef EDM_ML_DEBUG
789  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceElectronicsMap-> ...";
790 #endif
791  auto const& topo = rcd.get(topoTokens_[kElectronicsMap]);
792  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kElectronicsMap]);
793 
794  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
796 }
797 
798 std::unique_ptr<HcalValidationCorrs> HcalHardcodeCalibrations::produceValidationCorrs(
799  const HcalValidationCorrsRcd& rcd) {
800 #ifdef EDM_ML_DEBUG
801  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceValidationCorrs-> ...";
802 #endif
803  auto const& topo = rcd.get(topoTokens_[kValidationCorrs]);
804  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kValidationCorrs]);
805 
806  auto result = std::make_unique<HcalValidationCorrs>(&topo);
807  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
808  for (auto cell : cells) {
809  HcalValidationCorr item(cell.rawId(), 1.0);
810  result->addValues(item);
811  }
812  return result;
813 }
814 
815 std::unique_ptr<HcalLutMetadata> HcalHardcodeCalibrations::produceLutMetadata(const HcalLutMetadataRcd& rcd) {
816 #ifdef EDM_ML_DEBUG
817  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceLutMetadata-> ...";
818 #endif
819  auto const& topo = rcd.get(topoTokens_[kLutMetadata]);
820  auto const& zdcTopo = rcd.get(zdcTopoTokens_[kLutMetadata]);
821 
822  auto result = std::make_unique<HcalLutMetadata>(&topo);
823 
824  result->setRctLsb(0.5);
825  result->setNominalGain(0.177); // for HBHE SiPMs
826 
827  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
828  for (const auto& cell : cells) {
829  float rcalib = 1.;
830  int granularity = 1;
831  int threshold = 0;
832 
833  if (cell.isHcalTrigTowerDetId()) {
834  rcalib = 0.;
835  }
836 
837  HcalLutMetadatum item(cell.rawId(), rcalib, granularity, threshold);
838  result->addValues(item);
839  }
840 
841  return result;
842 }
843 
844 std::unique_ptr<HcalDcsValues> HcalHardcodeCalibrations::produceDcsValues(const HcalDcsRcd& rcd) {
845 #ifdef EDM_ML_DEBUG
846  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceDcsValues-> ...";
847 #endif
848  auto result = std::make_unique<HcalDcsValues>();
849  return result;
850 }
851 
852 std::unique_ptr<HcalDcsMap> HcalHardcodeCalibrations::produceDcsMap(const HcalDcsMapRcd& rcd) {
853 #ifdef EDM_ML_DEBUG
854  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceDcsMap-> ...";
855 #endif
857 }
858 
859 std::unique_ptr<HcalRecoParams> HcalHardcodeCalibrations::produceRecoParams(const HcalRecoParamsRcd& rec) {
860 #ifdef EDM_ML_DEBUG
861  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceRecoParams-> ...";
862 #endif
863  auto const& topo = rec.get(topoTokens_[kRecoParams]);
864  auto const& zdcTopo = rec.get(zdcTopoTokens_[kRecoParams]);
865 
866  auto result = std::make_unique<HcalRecoParams>(&topo);
867  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
868  for (auto cell : cells) {
870  result->addValues(item);
871  }
872  return result;
873 }
874 
875 std::unique_ptr<HcalTimingParams> HcalHardcodeCalibrations::produceTimingParams(const HcalTimingParamsRcd& rec) {
876 #ifdef EDM_ML_DEBUG
877  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceTimingParams-> ...";
878 #endif
879  auto const& topo = rec.get(topoTokens_[kTimingParams]);
880  auto const& zdcTopo = rec.get(zdcTopoTokens_[kTimingParams]);
881 
882  auto result = std::make_unique<HcalTimingParams>(&topo);
883  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
884  for (auto cell : cells) {
886  result->addValues(item);
887  }
888  return result;
889 }
890 
891 std::unique_ptr<HcalLongRecoParams> HcalHardcodeCalibrations::produceLongRecoParams(const HcalLongRecoParamsRcd& rec) {
892 #ifdef EDM_ML_DEBUG
893  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceLongRecoParams-> ...";
894 #endif
895  auto const& topo = rec.get(topoTokens_[kLongRecoParams]);
896  auto const& zdcTopo = rec.get(zdcTopoTokens_[kLongRecoParams]);
897 
898  auto result = std::make_unique<HcalLongRecoParams>(&topo);
899  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
900  std::vector<unsigned int> mSignal;
901  mSignal.push_back(4);
902  mSignal.push_back(5);
903  mSignal.push_back(6);
904  std::vector<unsigned int> mNoise;
905  mNoise.push_back(1);
906  mNoise.push_back(2);
907  mNoise.push_back(3);
908  for (auto cell : cells) {
909  if (cell.isHcalZDCDetId()) {
910  HcalLongRecoParam item(cell.rawId(), mSignal, mNoise);
911  result->addValues(item);
912  }
913  }
914  return result;
915 }
916 
917 std::unique_ptr<HcalZDCLowGainFractions> HcalHardcodeCalibrations::produceZDCLowGainFractions(
918  const HcalZDCLowGainFractionsRcd& rec) {
919 #ifdef EDM_ML_DEBUG
920  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceZDCLowGainFractions-> ...";
921 #endif
922  auto const& topo = rec.get(topoTokens_[kZDCLowGainFractions]);
923  auto const& zdcTopo = rec.get(zdcTopoTokens_[kZDCLowGainFractions]);
924 
925  auto result = std::make_unique<HcalZDCLowGainFractions>(&topo);
926  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
927  for (auto cell : cells) {
928  HcalZDCLowGainFraction item(cell.rawId(), 0.0);
929  result->addValues(item);
930  }
931  return result;
932 }
933 
934 std::unique_ptr<HcalMCParams> HcalHardcodeCalibrations::produceMCParams(const HcalMCParamsRcd& rec) {
935 #ifdef EDM_ML_DEBUG
936  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceMCParams-> ...";
937 #endif
938  auto const& topo = rec.get(topoTokens_[kMCParams]);
939  auto const& zdcTopo = rec.get(zdcTopoTokens_[kMCParams]);
940  auto result = std::make_unique<HcalMCParams>(&topo);
941  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
942  for (auto cell : cells) {
944  result->addValues(item);
945  }
946  return result;
947 }
948 
949 std::unique_ptr<HcalFlagHFDigiTimeParams> HcalHardcodeCalibrations::produceFlagHFDigiTimeParams(
950  const HcalFlagHFDigiTimeParamsRcd& rec) {
951 #ifdef EDM_ML_DEBUG
952  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceFlagHFDigiTimeParams-> ...";
953 #endif
954  auto const& topo = rec.get(topoTokens_[kFlagHFDigiTimeParams]);
955  auto const& zdcTopo = rec.get(zdcTopoTokens_[kFlagHFDigiTimeParams]);
956 
957  auto result = std::make_unique<HcalFlagHFDigiTimeParams>(&topo);
958  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
959 
960  std::vector<double> coef;
961  coef.push_back(0.93);
962  coef.push_back(-0.38275);
963  coef.push_back(-0.012667);
964 
965  for (auto cell : cells) {
966  HcalFlagHFDigiTimeParam item(cell.rawId(),
967  1, //firstsample
968  3, // samplestoadd
969  2, //expectedpeak
970  40., // min energy threshold
971  coef // coefficients
972  );
973  result->addValues(item);
974  }
975  return result;
976 }
977 
978 std::unique_ptr<HcalFrontEndMap> HcalHardcodeCalibrations::produceFrontEndMap(const HcalFrontEndMapRcd& rec) {
979 #ifdef EDM_ML_DEBUG
980  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceFrontEndMap-> ...";
981 #endif
982  auto const& topo = rec.get(topoTokens_[kFrontEndMap]);
983  auto const& zdcTopo = rec.get(zdcTopoTokens_[kFrontEndMap]);
984 
985  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
986 
988 }
989 
990 std::unique_ptr<HcalSiPMParameters> HcalHardcodeCalibrations::produceSiPMParameters(const HcalSiPMParametersRcd& rec) {
991 #ifdef EDM_ML_DEBUG
992  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceSiPMParameters-> ...";
993 #endif
994  auto const& topo = rec.get(topoTokens_[kSiPMParameters]);
995  auto const& zdcTopo = rec.get(zdcTopoTokens_[kSiPMParameters]);
996 
997  auto result = std::make_unique<HcalSiPMParameters>(&topo);
998  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
999  for (auto cell : cells) {
1001  result->addValues(item);
1002  }
1003  return result;
1004 }
1005 
1006 std::unique_ptr<HcalSiPMCharacteristics> HcalHardcodeCalibrations::produceSiPMCharacteristics(
1007  const HcalSiPMCharacteristicsRcd& rcd) {
1008 #ifdef EDM_ML_DEBUG
1009  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceSiPMCharacteristics-> ...";
1010 #endif
1012 }
1013 
1014 std::unique_ptr<HcalTPChannelParameters> HcalHardcodeCalibrations::produceTPChannelParameters(
1015  const HcalTPChannelParametersRcd& rec) {
1016 #ifdef EDM_ML_DEBUG
1017  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceTPChannelParameters-> ...";
1018 #endif
1019  auto const& topo = rec.get(topoTokens_[kTPChannelParameters]);
1020  auto const& zdcTopo = rec.get(zdcTopoTokens_[kTPChannelParameters]);
1021 
1022  auto result = std::make_unique<HcalTPChannelParameters>(&topo);
1023  const std::vector<HcalGenericDetId>& cells = allCells(topo, zdcTopo, dbHardcode.killHE());
1024  for (auto cell : cells) {
1025  // Thinking about Phase2 and the new FIR filter,
1026  // for now, don't put TT in TPChannelParams
1027  if (cell.subdetId() == HcalTriggerTower)
1028  continue;
1030  result->addValues(item);
1031  }
1032  return result;
1033 }
1034 
1035 std::unique_ptr<HcalTPParameters> HcalHardcodeCalibrations::produceTPParameters(const HcalTPParametersRcd& rcd) {
1036 #ifdef EDM_ML_DEBUG
1037  edm::LogVerbatim("HCAL") << "HcalHardcodeCalibrations::produceTPParameters-> ...";
1038 #endif
1039  auto result = std::make_unique<HcalTPParameters>();
1041  return result;
1042 }
1043 
1046  desc.add<double>("iLumi", -1.);
1047  desc.add<bool>("HBRecalibration", false);
1048  desc.add<double>("HBreCalibCutoff", 20.);
1049  desc.add<edm::FileInPath>("HBmeanenergies", edm::FileInPath("CalibCalorimetry/HcalPlugins/data/meanenergiesHB.txt"));
1050  desc.add<bool>("HERecalibration", false);
1051  desc.add<double>("HEreCalibCutoff", 20.);
1052  desc.add<edm::FileInPath>("HEmeanenergies", edm::FileInPath("CalibCalorimetry/HcalPlugins/data/meanenergiesHE.txt"));
1053  desc.add<bool>("HFRecalibration", false);
1054  desc.add<bool>("GainWidthsForTrigPrims", false);
1055  desc.add<bool>("useHBUpgrade", false);
1056  desc.add<bool>("useHEUpgrade", false);
1057  desc.add<bool>("useHFUpgrade", false);
1058  desc.add<bool>("useHOUpgrade", true);
1059  desc.add<bool>("testHFQIE10", false);
1060  desc.add<bool>("testHEPlan1", false);
1061  desc.add<bool>("killHE", false);
1062  desc.add<bool>("useLayer0Weight", false);
1063  desc.add<bool>("useIeta18depth1", true);
1064  desc.addUntracked<std::vector<std::string>>("toGet", std::vector<std::string>());
1065  desc.addUntracked<bool>("fromDDD", false);
1066 
1068  desc_hb.add<std::vector<double>>("gain", std::vector<double>({0.19}));
1069  desc_hb.add<std::vector<double>>("gainWidth", std::vector<double>({0.0}));
1070  desc_hb.add<double>("pedestal", 3.0);
1071  desc_hb.add<double>("pedestalWidth", 0.55);
1072  desc_hb.add<int>("zsThreshold", 8);
1073  desc_hb.add<std::vector<double>>("qieOffset", std::vector<double>({-0.49, 1.8, 7.2, 37.9}));
1074  desc_hb.add<std::vector<double>>("qieSlope", std::vector<double>({0.912, 0.917, 0.922, 0.923}));
1075  desc_hb.add<int>("qieType", 0);
1076  desc_hb.add<int>("mcShape", 125);
1077  desc_hb.add<int>("recoShape", 105);
1078  desc_hb.add<double>("photoelectronsToAnalog", 0.0);
1079  desc_hb.add<std::vector<double>>("darkCurrent", std::vector<double>({0.0}));
1080  desc_hb.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.0}));
1081  desc_hb.add<bool>("doRadiationDamage", false);
1082  desc_hb.add<double>("noiseThreshold", 0.0);
1083  desc_hb.add<double>("seedThreshold", 0.1);
1084  desc.add<edm::ParameterSetDescription>("hb", desc_hb);
1085 
1086  edm::ParameterSetDescription desc_hbRaddam;
1087  desc_hbRaddam.add<double>("temperatureBase", 20.0);
1088  desc_hbRaddam.add<double>("temperatureNew", -5.0);
1089  desc_hbRaddam.add<double>("intlumiOffset", 150);
1090  desc_hbRaddam.add<double>("depVsTemp", 0.0631);
1091  desc_hbRaddam.add<double>("intlumiToNeutrons", 3.67e8);
1092  desc_hbRaddam.add<std::vector<double>>("depVsNeutrons", {5.69e-11, 7.90e-11});
1093 
1094  edm::ParameterSetDescription desc_hbUpgrade;
1095  desc_hbUpgrade.add<std::vector<double>>("gain", std::vector<double>({0.00111111111111}));
1096  desc_hbUpgrade.add<std::vector<double>>("gainWidth", std::vector<double>({0}));
1097  desc_hbUpgrade.add<double>("pedestal", 18.0);
1098  desc_hbUpgrade.add<double>("pedestalWidth", 5.0);
1099  desc_hbUpgrade.add<int>("zsThreshold", 3);
1100  desc_hbUpgrade.add<std::vector<double>>("qieOffset", std::vector<double>({0.0, 0.0, 0.0, 0.0}));
1101  desc_hbUpgrade.add<std::vector<double>>("qieSlope", std::vector<double>({0.333, 0.333, 0.333, 0.333}));
1102  desc_hbUpgrade.add<int>("qieType", 2);
1103  desc_hbUpgrade.add<int>("mcShape", 206);
1104  desc_hbUpgrade.add<int>("recoShape", 206);
1105  desc_hbUpgrade.add<double>("photoelectronsToAnalog", 57.5);
1106  desc_hbUpgrade.add<std::vector<double>>("darkCurrent", std::vector<double>({0.055}));
1107  desc_hbUpgrade.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.26}));
1108  desc_hbUpgrade.add<bool>("doRadiationDamage", true);
1109  desc_hbUpgrade.add<edm::ParameterSetDescription>("radiationDamage", desc_hbRaddam);
1110  desc_hbUpgrade.add<double>("noiseThreshold", 0.0);
1111  desc_hbUpgrade.add<double>("seedThreshold", 0.1);
1112  desc.add<edm::ParameterSetDescription>("hbUpgrade", desc_hbUpgrade);
1113 
1115  desc_he.add<std::vector<double>>("gain", std::vector<double>({0.23}));
1116  desc_he.add<std::vector<double>>("gainWidth", std::vector<double>({0}));
1117  desc_he.add<double>("pedestal", 3.0);
1118  desc_he.add<double>("pedestalWidth", 0.79);
1119  desc_he.add<int>("zsThreshold", 9);
1120  desc_he.add<std::vector<double>>("qieOffset", std::vector<double>({-0.38, 2.0, 7.6, 39.6}));
1121  desc_he.add<std::vector<double>>("qieSlope", std::vector<double>({0.912, 0.916, 0.92, 0.922}));
1122  desc_he.add<int>("qieType", 0);
1123  desc_he.add<int>("mcShape", 125);
1124  desc_he.add<int>("recoShape", 105);
1125  desc_he.add<double>("photoelectronsToAnalog", 0.0);
1126  desc_he.add<std::vector<double>>("darkCurrent", std::vector<double>({0.0}));
1127  desc_he.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.0}));
1128  desc_he.add<bool>("doRadiationDamage", false);
1129  desc_he.add<double>("noiseThreshold", 0.0);
1130  desc_he.add<double>("seedThreshold", 0.1);
1131  desc.add<edm::ParameterSetDescription>("he", desc_he);
1132 
1133  edm::ParameterSetDescription desc_heRaddam;
1134  desc_heRaddam.add<double>("temperatureBase", 20.0);
1135  desc_heRaddam.add<double>("temperatureNew", 5.0);
1136  desc_heRaddam.add<double>("intlumiOffset", 75);
1137  desc_heRaddam.add<double>("depVsTemp", 0.0631);
1138  desc_heRaddam.add<double>("intlumiToNeutrons", 2.92e8);
1139  desc_heRaddam.add<std::vector<double>>("depVsNeutrons", {5.69e-11, 7.90e-11});
1140 
1141  edm::ParameterSetDescription desc_heUpgrade;
1142  desc_heUpgrade.add<std::vector<double>>("gain", std::vector<double>({0.00111111111111}));
1143  desc_heUpgrade.add<std::vector<double>>("gainWidth", std::vector<double>({0}));
1144  desc_heUpgrade.add<double>("pedestal", 18.0);
1145  desc_heUpgrade.add<double>("pedestalWidth", 5.0);
1146  desc_heUpgrade.add<int>("zsThreshold", 3);
1147  desc_heUpgrade.add<std::vector<double>>("qieOffset", std::vector<double>({0.0, 0.0, 0.0, 0.0}));
1148  desc_heUpgrade.add<std::vector<double>>("qieSlope", std::vector<double>({0.333, 0.333, 0.333, 0.333}));
1149  desc_heUpgrade.add<int>("qieType", 2);
1150  desc_heUpgrade.add<int>("mcShape", 206);
1151  desc_heUpgrade.add<int>("recoShape", 206);
1152  desc_heUpgrade.add<double>("photoelectronsToAnalog", 57.5);
1153  desc_heUpgrade.add<std::vector<double>>("darkCurrent", std::vector<double>({0.055}));
1154  desc_heUpgrade.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.26}));
1155  desc_heUpgrade.add<bool>("doRadiationDamage", true);
1156  desc_heUpgrade.add<edm::ParameterSetDescription>("radiationDamage", desc_heRaddam);
1157  desc_heUpgrade.add<double>("noiseThreshold", 0.0);
1158  desc_heUpgrade.add<double>("seedThreshold", 0.1);
1159  desc.add<edm::ParameterSetDescription>("heUpgrade", desc_heUpgrade);
1160 
1162  desc_hf.add<std::vector<double>>("gain", std::vector<double>({0.14, 0.135}));
1163  desc_hf.add<std::vector<double>>("gainWidth", std::vector<double>({0.0, 0.0}));
1164  desc_hf.add<double>("pedestal", 3.0);
1165  desc_hf.add<double>("pedestalWidth", 0.84);
1166  desc_hf.add<int>("zsThreshold", -9999);
1167  desc_hf.add<std::vector<double>>("qieOffset", std::vector<double>({-0.87, 1.4, 7.8, -29.6}));
1168  desc_hf.add<std::vector<double>>("qieSlope", std::vector<double>({0.359, 0.358, 0.36, 0.367}));
1169  desc_hf.add<int>("qieType", 0);
1170  desc_hf.add<int>("mcShape", 301);
1171  desc_hf.add<int>("recoShape", 301);
1172  desc_hf.add<double>("photoelectronsToAnalog", 0.0);
1173  desc_hf.add<std::vector<double>>("darkCurrent", std::vector<double>({0.0}));
1174  desc_hf.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.0}));
1175  desc_hf.add<bool>("doRadiationDamage", false);
1176  desc_hf.add<double>("noiseThreshold", 0.0);
1177  desc_hf.add<double>("seedThreshold", 0.1);
1178  desc.add<edm::ParameterSetDescription>("hf", desc_hf);
1179 
1180  edm::ParameterSetDescription desc_hfUpgrade;
1181  desc_hfUpgrade.add<std::vector<double>>("gain", std::vector<double>({0.14, 0.135}));
1182  desc_hfUpgrade.add<std::vector<double>>("gainWidth", std::vector<double>({0.0, 0.0}));
1183  desc_hfUpgrade.add<double>("pedestal", 13.33);
1184  desc_hfUpgrade.add<double>("pedestalWidth", 3.33);
1185  desc_hfUpgrade.add<int>("zsThreshold", -9999);
1186  desc_hfUpgrade.add<std::vector<double>>("qieOffset", std::vector<double>({0.0697, -0.7405, 12.38, -671.9}));
1187  desc_hfUpgrade.add<std::vector<double>>("qieSlope", std::vector<double>({0.297, 0.298, 0.298, 0.313}));
1188  desc_hfUpgrade.add<int>("qieType", 1);
1189  desc_hfUpgrade.add<int>("mcShape", 301);
1190  desc_hfUpgrade.add<int>("recoShape", 301);
1191  desc_hfUpgrade.add<double>("photoelectronsToAnalog", 0.0);
1192  desc_hfUpgrade.add<std::vector<double>>("darkCurrent", std::vector<double>({0.0}));
1193  desc_hfUpgrade.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.0}));
1194  desc_hfUpgrade.add<bool>("doRadiationDamage", false);
1195  desc_hfUpgrade.add<double>("noiseThreshold", 0.0);
1196  desc_hfUpgrade.add<double>("seedThreshold", 0.1);
1197  desc.add<edm::ParameterSetDescription>("hfUpgrade", desc_hfUpgrade);
1198 
1199  edm::ParameterSetDescription desc_hfrecal;
1200  desc_hfrecal.add<std::vector<double>>("HFdepthOneParameterA", std::vector<double>());
1201  desc_hfrecal.add<std::vector<double>>("HFdepthOneParameterB", std::vector<double>());
1202  desc_hfrecal.add<std::vector<double>>("HFdepthTwoParameterA", std::vector<double>());
1203  desc_hfrecal.add<std::vector<double>>("HFdepthTwoParameterB", std::vector<double>());
1204  desc.add<edm::ParameterSetDescription>("HFRecalParameterBlock", desc_hfrecal);
1205 
1207  desc_ho.add<std::vector<double>>("gain", std::vector<double>({0.006, 0.0087}));
1208  desc_ho.add<std::vector<double>>("gainWidth", std::vector<double>({0.0, 0.0}));
1209  desc_ho.add<double>("pedestal", 11.0);
1210  desc_ho.add<double>("pedestalWidth", 0.57);
1211  desc_ho.add<int>("zsThreshold", 24);
1212  desc_ho.add<std::vector<double>>("qieOffset", std::vector<double>({-0.44, 1.4, 7.1, 38.5}));
1213  desc_ho.add<std::vector<double>>("qieSlope", std::vector<double>({0.907, 0.915, 0.92, 0.921}));
1214  desc_ho.add<int>("qieType", 0);
1215  desc_ho.add<int>("mcShape", 201);
1216  desc_ho.add<int>("recoShape", 201);
1217  desc_ho.add<double>("photoelectronsToAnalog", 4.0);
1218  desc_ho.add<std::vector<double>>("darkCurrent", std::vector<double>({0.0}));
1219  desc_ho.add<std::vector<double>>("noiseCorrelation", std::vector<double>({0.0}));
1220  desc_ho.add<bool>("doRadiationDamage", false);
1221  desc_ho.add<double>("noiseThreshold", 0.0);
1222  desc_ho.add<double>("seedThreshold", 0.1);
1223  desc.add<edm::ParameterSetDescription>("ho", desc_ho);
1224 
1225  edm::ParameterSetDescription validator_sipm;
1226  validator_sipm.add<int>("pixels", 1);
1227  validator_sipm.add<double>("crosstalk", 0);
1228  validator_sipm.add<double>("nonlin1", 1);
1229  validator_sipm.add<double>("nonlin2", 0);
1230  validator_sipm.add<double>("nonlin3", 0);
1231  std::vector<edm::ParameterSet> default_sipm(1);
1232  desc.addVPSet("SiPMCharacteristics", validator_sipm, default_sipm);
1233 
1234  descriptions.addDefault(desc);
1235 }
std::unique_ptr< HcalPedestals > producePedestals(const HcalPedestalsRcd &rcd)
std::unique_ptr< HcalPFCuts > producePFCuts(const HcalPFCutsRcd &rcd)
Log< level::Info, true > LogVerbatim
static const int kHcalVersMask
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
bool validHT(const HcalTrigTowerDetId &id) const
static constexpr uint32_t kHcalPhiMask2
Definition: HcalDetId.h:15
std::unique_ptr< HcalGains > produceGains(const HcalGainsRcd &rcd)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void useHBUpgrade(bool b)
HcalHardcodeCalibrations(const edm::ParameterSet &)
std::unique_ptr< HcalPedestalWidths > produceEffectivePedestalWidths(const HcalPedestalWidthsRcd &rcd)
std::unique_ptr< HcalPFCorrs > producePFCorrs(const HcalPFCorrsRcd &rcd)
std::unique_ptr< HcalQIEData > produceQIEData(const HcalQIEDataRcd &rcd)
HcalRecoParam makeRecoParam(HcalGenericDetId fId) const
void setHBUpgrade(HcalHardcodeParameters p)
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
void testHEPlan1(bool b)
std::unique_ptr< HcalTimeCorrs > produceTimeCorrs(const HcalTimeCorrsRcd &rcd)
void useHFUpgrade(bool b)
std::unique_ptr< HcalLongRecoParams > produceLongRecoParams(const HcalLongRecoParamsRcd &rcd)
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
std::unique_ptr< HcalPedestals > produceEffectivePedestals(const HcalPedestalsRcd &rcd)
std::unique_ptr< HcalSiPMCharacteristics > produceSiPMCharacteristics(const HcalSiPMCharacteristicsRcd &rcd)
bool valid(const DetId &id) const override
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > hbDarkeningToken_
HcalPFCut makePFCut(HcalGenericDetId fId, double intlumi, bool noHE) const
std::unique_ptr< HcalElectronicsMap > produceElectronicsMap(const HcalElectronicsMapRcd &rcd)
void setHF(HcalHardcodeParameters p)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
void makeHardcodeFrontEndMap(HcalFrontEndMap &emap, const std::vector< HcalGenericDetId > &cells) const
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
std::unique_ptr< HcalDcsValues > produceDcsValues(const HcalDcsRcd &rcd)
static const int kHcalEtaMask
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
HcalZSThreshold makeZSThreshold(HcalGenericDetId fId) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< HcalPedestals > producePedestals_(const HcalPedestalsRcd &rcd, const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > &, const edm::ESGetToken< ZdcTopology, HcalRecNumberingRecord > &, bool eff)
std::unique_ptr< HcalPedestalWidths > producePedestalWidths(const HcalPedestalWidthsRcd &rcd)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ietaAbs(uint32_t id)
const bool killHE() const
std::unique_ptr< HcalSiPMCharacteristics > makeHardcodeSiPMCharacteristics() const
HcalGainWidth makeGainWidth(HcalGenericDetId fId) const
void addDefault(ParameterSetDescription const &psetDescription)
std::unique_ptr< HcalPedestalWidths > producePedestalWidths_(const HcalPedestalWidthsRcd &rcd, const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > &, const edm::ESGetToken< ZdcTopology, HcalRecNumberingRecord > &, bool eff)
std::unique_ptr< HFRecalibration > hf_recalibration
std::unique_ptr< HcalRespCorrs > produceRespCorrs(const HcalRespCorrsRcd &rcd)
dictionary corr
std::unique_ptr< HcalLutMetadata > produceLutMetadata(const HcalLutMetadataRcd &rcd)
void setHO(HcalHardcodeParameters p)
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
bool empty() const
Definition: ParameterSet.h:202
void setHFUpgrade(HcalHardcodeParameters p)
std::unordered_map< int, edm::ESGetToken< ZdcTopology, HcalRecNumberingRecord > > zdcTopoTokens_
HcalTimingParam makeTimingParam(HcalGenericDetId fId) const
void setHE(HcalHardcodeParameters p)
void setKillHE(bool b)
HcalTPChannelParameter makeHardcodeTPChannelParameter(HcalGenericDetId fId) const
std::unique_ptr< HcalFlagHFDigiTimeParams > produceFlagHFDigiTimeParams(const HcalFlagHFDigiTimeParamsRcd &rcd)
HcalQIECoder makeQIECoder(HcalGenericDetId fId) const
std::unique_ptr< HcalFrontEndMap > produceFrontEndMap(const HcalFrontEndMapRcd &rcd)
int maxDepth(void) const
HcalSubdetector
Definition: HcalAssistant.h:31
std::unique_ptr< HBHERecalibration > hb_recalibration
static const int kHcalDepthMask
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void useHOUpgrade(bool b)
std::unique_ptr< HcalSiPMParameters > produceSiPMParameters(const HcalSiPMParametersRcd &rcd)
std::unique_ptr< HBHERecalibration > he_recalibration
std::unique_ptr< HcalDcsMap > makeHardcodeDcsMap() const
static constexpr uint32_t kHcalEtaMask2
Definition: HcalDetId.h:19
HcalQIEType makeQIEType(HcalGenericDetId fId) const
virtual bool valid(const HcalZDCDetId &id) const
Definition: ZdcTopology.cc:30
static const int kHcalPhiMask
Namespace of DDCMS conversion namespace.
std::unique_ptr< HcalRecoParams > produceRecoParams(const HcalRecoParamsRcd &rcd)
void setHB(HcalHardcodeParameters p)
std::unique_ptr< HcalTPParameters > produceTPParameters(const HcalTPParametersRcd &rcd)
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false) const
TimeValue_t value() const
Definition: Timestamp.h:38
void makeHardcodeTPParameters(HcalTPParameters &tppar) const
std::unique_ptr< HcalGainWidths > produceGainWidths(const HcalGainWidthsRcd &rcd)
std::unique_ptr< HcalTPChannelParameters > produceTPChannelParameters(const HcalTPChannelParametersRcd &rcd)
std::unique_ptr< HcalElectronicsMap > makeHardcodeMap(const std::vector< HcalGenericDetId > &cells) const
std::unique_ptr< HcalL1TriggerObjects > produceL1TriggerObjects(const HcalL1TriggerObjectsRcd &rcd)
std::unique_ptr< HcalZSThresholds > produceZSThresholds(const HcalZSThresholdsRcd &rcd)
std::unique_ptr< HcalZDCLowGainFractions > produceZDCLowGainFractions(const HcalZDCLowGainFractionsRcd &rcd)
void setSiPMCharacteristics(std::vector< edm::ParameterSet > vps)
std::unique_ptr< HcalMCParams > produceMCParams(const HcalMCParamsRcd &rcd)
const EventID & eventID() const
Definition: IOVSyncValue.h:40
void useHEUpgrade(bool b)
std::unique_ptr< HcalTimingParams > produceTimingParams(const HcalTimingParamsRcd &rcd)
std::unique_ptr< HcalQIETypes > produceQIETypes(const HcalQIETypesRcd &rcd)
HcalMCParam makeMCParam(HcalGenericDetId fId) const
const Timestamp & time() const
Definition: IOVSyncValue.h:42
int getLayersInDepth(int ieta, int depth, const HcalTopology *topo)
std::unique_ptr< HcalChannelQuality > produceChannelQuality(const HcalChannelQualityRcd &rcd)
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear, bool eff, const HcalTopology *topo, double intlumi)
edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > heDarkeningToken_
const std::string & fullPath() const
Definition: FileInPath.cc:144
HcalSiPMParameter makeHardcodeSiPMParameter(HcalGenericDetId fId, const HcalTopology *topo, double intlumi)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
void setHEUpgrade(HcalHardcodeParameters p)
std::unique_ptr< HcalDcsMap > produceDcsMap(const HcalDcsMapRcd &rcd)
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
std::unique_ptr< HcalLUTCorrs > produceLUTCorrs(const HcalLUTCorrsRcd &rcd)
std::unordered_map< int, edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > > topoTokens_
void testHFQIE10(bool b)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology *topo, double intlumi)
std::unique_ptr< HcalValidationCorrs > produceValidationCorrs(const HcalValidationCorrsRcd &rcd)
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164