CMS 3D CMS Logo

HcalDbHardcode.cc
Go to the documentation of this file.
1 //
2 // F.Ratnikov (UMd), Dec 14, 2005
3 //
4 #include <vector>
5 #include <string>
6 #include <cmath>
7 #include <sstream>
8 #include <iostream>
9 #include <memory>
10 #include <cassert>
11 
12 #include "CLHEP/Random/RandGauss.h"
17 
19  : //"generic" set of conditions
20  theDefaultParameters_(3.0, //pedestal
21  0.5, //pedestal width
22  {0.2, 0.2}, //gains
23  {0.0, 0.0}, //gain widths
24  0, //ZS threshold
25  0, //QIE type
26  {0.0, 0.0, 0.0, 0.0}, //QIE offsets
27  {0.9, 0.9, 0.9, 0.9}, //QIE slopes
28  125, //MC shape
29  105, //Reco shape
30  0.0, //photoelectronsToAnalog
31  {0.0} //dark current
32  ),
33  setHB_(false),
34  setHE_(false),
35  setHF_(false),
36  setHO_(false),
37  setHBUpgrade_(false),
38  setHEUpgrade_(false),
39  setHFUpgrade_(false),
40  useHBUpgrade_(false),
41  useHEUpgrade_(false),
42  useHOUpgrade_(true),
43  useHFUpgrade_(false),
44  testHFQIE10_(false),
45  testHEPlan1_(false) {}
46 
51  else if (!useHBUpgrade_ && setHB_)
52  return theHBParameters_;
53  else
54  return theDefaultParameters_;
55  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenEndcap) {
56  bool b_isHEPlan1 = testHEPlan1_ ? isHEPlan1(fId) : false;
57  if ((useHEUpgrade_ || b_isHEPlan1) && setHEUpgrade_)
59  else if (!useHEUpgrade_ && !b_isHEPlan1 && setHE_)
60  return theHEParameters_;
61  else
62  return theDefaultParameters_;
63  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenForward) {
66  else if (testHFQIE10_ && fId.isHcalDetId()) {
67  HcalDetId hid(fId);
68  //special mixed case for HF 2016
69  if (hid.iphi() == 39 && hid.zside() == 1 &&
70  (hid.depth() >= 3 || (hid.depth() == 2 && (hid.ieta() == 30 || hid.ieta() == 34))) && setHFUpgrade_)
72  else if (setHF_)
73  return theHFParameters_;
74  else
75  return theDefaultParameters_;
76  } else if (!useHFUpgrade_ && setHF_)
77  return theHFParameters_;
78  else
79  return theDefaultParameters_;
80  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter) {
81  if (setHO_)
82  return theHOParameters_;
83  else
84  return theDefaultParameters_;
85  } else
86  return theDefaultParameters_;
87 }
88 
90  int index = 0;
92  HcalDetId hid(fId);
93  if ((hid.ieta() > -5) && (hid.ieta() < 5))
94  index = 0;
95  else
96  index = 1;
97  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenForward) {
98  HcalDetId hid(fId);
99  if (hid.depth() % 2 == 1)
100  index = 0; //depths 1,3
101  else if (hid.depth() % 2 == 0)
102  index = 1; //depths 2,4
103  }
104  return index;
105 }
106 
108  HcalGenericDetId fId, bool fSmear, bool eff, const HcalTopology* topo, double intlumi) {
109  HcalPedestalWidth width = makePedestalWidth(fId, eff, topo, intlumi);
110  float value0 = getParameters(fId).pedestal();
111  if (eff) {
112  //account for dark current + crosstalk
113  auto sipmpar = makeHardcodeSiPMParameter(fId, topo, intlumi);
114  auto sipmchar = makeHardcodeSiPMCharacteristics();
115  value0 += sipmpar.getDarkCurrent() * 25. / (1. - sipmchar->getCrossTalk(sipmpar.getType()));
116  }
117  float value[4] = {value0, value0, value0, value0};
118  if (fSmear) {
119  for (int i = 0; i < 4; i++) {
120  value[i] = 0.0f;
121  while (value[i] <= 0.0f)
122  // ignore correlations, assume 10K pedestal run
123  value[i] = value0 + (float)CLHEP::RandGauss::shoot(0.0, width.getWidth(i) / 100.);
124  }
125  }
126  HcalPedestal result(fId.rawId(), value[0], value[1], value[2], value[3]);
127  return result;
128 }
129 
131  bool eff,
132  const HcalTopology* topo,
133  double intlumi) {
134  float value = getParameters(fId).pedestalWidth();
135  float width2 = value * value;
136  // everything in fC
137 
138  if (eff) {
139  //account for dark current + crosstalk
140  auto sipmpar = makeHardcodeSiPMParameter(fId, topo, intlumi);
141  auto sipmchar = makeHardcodeSiPMCharacteristics();
142  //add in quadrature
143  width2 += sipmpar.getDarkCurrent() * 25. / std::pow(1 - sipmchar->getCrossTalk(sipmpar.getType()), 3) *
144  sipmpar.getFCByPE();
145  }
146 
148  for (int i = 0; i < 4; i++) {
149  for (int j = 0; j < 4; j++) {
150  result.setSigma(i, j, 0.0);
151  }
152  result.setSigma(i, i, width2);
153  }
154  return result;
155 }
156 
157 HcalGain HcalDbHardcode::makeGain(HcalGenericDetId fId, bool fSmear) const { // GeV/fC
159  float value0 = getParameters(fId).gain(getGainIndex(fId));
160  float value[4] = {value0, value0, value0, value0};
161  if (fSmear) {
162  for (int i = 0; i < 4; i++) {
163  value[i] = 0.0f;
164  while (value[i] <= 0.0f)
165  value[i] = value0 + (float)CLHEP::RandGauss::shoot(0.0, width.getValue(i));
166  }
167  }
168  HcalGain result(fId.rawId(), value[0], value[1], value[2], value[3]);
169  return result;
170 }
171 
173  float value = getParameters(fId).gainWidth(getGainIndex(fId));
175  return result;
176 }
177 
179  int value = getParameters(fId).zsThreshold();
181  return result;
182 }
183 
185  HcalQIECoder result(fId.rawId());
186  // slope in ADC/fC
187  const HcalHardcodeParameters& param(getParameters(fId));
188  for (unsigned range = 0; range < 4; range++) {
189  for (unsigned capid = 0; capid < 4; capid++) {
190  result.setOffset(capid, range, param.qieOffset(range));
191  result.setSlope(capid, range, param.qieSlope(range));
192  }
193  }
194 
195  return result;
196 }
197 
199  HcalQIENum qieType = (HcalQIENum)(getParameters(fId).qieType());
200  HcalQIEType result(fId.rawId(), qieType);
201  return result;
202 }
203 
206  float lowEdges[64];
207  for (int i = 0; i < 64; i++) {
208  lowEdges[i] = -1.5 + i;
209  }
210  result.setMinCharges(lowEdges);
211  return result;
212 }
213 
215 
217  int r1bit[5];
218  r1bit[0] = 9; // [0,9]
219  int syncPhase = 0;
220  r1bit[1] = 1;
221  int binOfMaximum = 0;
222  r1bit[2] = 4;
223  float phase = -25.0f; // [-25.0,25.0]
224  float Xphase = (phase + 32.0f) * 4.0f; // never change this line
225  // (offset 50nsec, 0.25ns step)
226  int Iphase = Xphase;
227  r1bit[3] = 8; // [0,256] offset 50ns, .25ns step
228  int timeSmearing = 0;
229  r1bit[4] = 1; // bool
230 
231  const HcalHardcodeParameters& hparam(getParameters(fId));
232  int pulseShapeID = hparam.mcShape(); // a0
233 
235  syncPhase = 1; // a1 bool
236  binOfMaximum = 5; // a2
237  phase = 5.0f; // a3 [-25.0,25.0]
238  Xphase = (phase + 32.0f) * 4.0f; // never change this line
239  // (offset 50nsec, 0.25ns step)
240  Iphase = Xphase;
241  timeSmearing = 1; // a4
242 
243  }
244 
246  syncPhase = 1; // a1 bool
247  binOfMaximum = 5; // a2
248  phase = 5.0f; // a3 [-25.0,25.0]
249  Xphase = (phase + 32.0f) * 4.0f; // never change this line
250  // (offset 50nsec, 0.25ns step)
251  Iphase = Xphase;
252  timeSmearing = 1; // a4
253 
254  }
255 
256  else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter) {
257  syncPhase = 1; // a1 bool
258  binOfMaximum = 5; // a2
259  phase = 5.0f; // a3 [-25.0,25.0]
260  Xphase = (phase + 32.0f) * 4.0f; // never change this line
261  // (offset 50nsec, 0.25ns step)
262  Iphase = Xphase;
263  timeSmearing = 0; // a4
264 
265  HcalDetId cell = HcalDetId(fId);
266  if (cell.ieta() == 1 && cell.iphi() == 1)
267  pulseShapeID = 125;
268 
269  }
270 
272  syncPhase = 1; // a1 bool
273  binOfMaximum = 3; // a2
274  phase = 14.0f; // a3 [-25.0,25.0]
275  Xphase = (phase + 32.0f) * 4.0f; // never change this line
276  // (offset 50nsec, 0.25ns step)
277  Iphase = Xphase;
278  timeSmearing = 0; // a4
279 
280  }
281 
282  else if (fId.genericSubdet() == HcalGenericDetId::HcalGenZDC) {
283  pulseShapeID = 401; // a0
284  syncPhase = 1; // a1 bool
285  binOfMaximum = 5; // a2
286  phase = -4.0f; // a3 [-25.0,25.0]
287  Xphase = (phase + 32.0f) * 4.0f; // never change this line
288  // (offset 50nsec, 0.25ns step)
289  Iphase = Xphase;
290  timeSmearing = 0; // a4
291  }
292 
293  int rshift[7];
294  rshift[0] = 0;
295  for (int k = 0; k < 5; k++) {
296  rshift[k + 1] = rshift[k] + r1bit[k];
297  }
298 
299  int packingScheme = 1; // a5
300  unsigned int param = pulseShapeID | syncPhase << rshift[1] | (binOfMaximum << rshift[2]) | (Iphase << rshift[3]) |
301  (timeSmearing << rshift[4] | packingScheme << 27);
302 
303  HcalMCParam result(fId.rawId(), param);
304  return result;
305 }
306 
308  // Mostly comes from S.Kunori's macro
309  int p1bit[6];
310 
311  // param1
312  int containmentCorrectionFlag = 0;
313  p1bit[0] = 1; // bool
314  int containmentCorrectionPreSample = 0;
315  p1bit[1] = 1; // bool
316  float phase = 13.0; // [-25.0,25.0]
317  float Xphase = (phase + 32.0) * 4.0; //never change this line
318  // (offset 50nsec, 0.25ns step)
319  int Iphase = Xphase;
320  p1bit[2] = 8; // [0,256]
321  // (offset 50ns, 0.25ns step
322  int firstSample = 4;
323  p1bit[3] = 4; // [0,9]
324  int samplesToAdd = 2;
325  p1bit[4] = 4; // [0,9]
326  p1bit[5] = 9; // [0,9]
327 
328  const HcalHardcodeParameters& hparam(getParameters(fId));
329  int pulseShapeID = hparam.recoShape(); // a5
330 
331  int q2bit[10];
332  // param2.
333  int useLeakCorrection = 0;
334  q2bit[0] = 1; // bool
335  int LeakCorrectionID = 0;
336  q2bit[1] = 4; // [0,15]
337  int correctForTimeslew = 0;
338  q2bit[2] = 1; // bool
339  int timeCorrectionID = 0;
340  q2bit[3] = 4; // [0,15]
341  int correctTiming = 0;
342  q2bit[4] = 1; // bool
343  int firstAuxTS = 0;
344  q2bit[5] = 4; // [0,15]
345  int specialCaseID = 0;
346  q2bit[6] = 4; // [0,15]
347  int noiseFlaggingID = 0;
348  q2bit[7] = 4; // [0,15]
349  int pileupCleaningID = 0;
350  q2bit[8] = 4; // [0,15]
351  int packingScheme = 1;
352  q2bit[9] = 4;
353 
356  // param1.
357  containmentCorrectionFlag = 1; // p0
358  containmentCorrectionPreSample = 0; // p1
359  float phase = 6.0;
360  float Xphase = (phase + 32.0) * 4.0; // never change this line
361  //(offset 50nsec, 0.25ns step)
362  Iphase = Xphase; // p2
363  firstSample = 4; // p3
364  samplesToAdd = 2; // p4
365 
366  // param2.
367  useLeakCorrection = 0; // q0
368  LeakCorrectionID = 0; // q1
369  correctForTimeslew = 1; // q2
370  timeCorrectionID = 0; // q3
371  correctTiming = 1; // q4
372  firstAuxTS = 4; // q5
373  specialCaseID = 0; // q6
374  noiseFlaggingID = 1; // q7
375  pileupCleaningID = 0; // q8
376  }
377 
378  else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter) {
379  // param1.
380  containmentCorrectionFlag = 1; // p0
381  containmentCorrectionPreSample = 0; // p1
382  float phase = 13.0;
383  float Xphase = (phase + 32.0) * 4.0; // never change this line
384  // (offset 50nsec, 0.25ns step)
385  Iphase = Xphase; // p2
386  firstSample = 4; // p3
387  samplesToAdd = 4; // p4
388 
389  // param2.
390  useLeakCorrection = 0; // q0
391  LeakCorrectionID = 0; // q1
392  correctForTimeslew = 1; // q2
393  timeCorrectionID = 0; // q3
394  correctTiming = 1; // q4
395  firstAuxTS = 4; // q5
396  specialCaseID = 0; // q6
397  noiseFlaggingID = 1; // q7
398  pileupCleaningID = 0; // q8
399 
400  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenForward) {
401  // param1.
402  containmentCorrectionFlag = 0; // p0
403  containmentCorrectionPreSample = 0; // p1
404  float phase = 13.0;
405  float Xphase = (phase + 32.0) * 4.0; // never change this line
406  // (offset 50nsec, 0.25ns step)
407  Iphase = Xphase; // p2
408  firstSample = 2; // p3
409  samplesToAdd = 1; // p4
410 
411  // param2.
412  useLeakCorrection = 0; // q0
413  LeakCorrectionID = 0; // q1
414  correctForTimeslew = 0; // q2
415  timeCorrectionID = 0; // q3
416  correctTiming = 1; // q4
417  firstAuxTS = 1; // q5
418  specialCaseID = 0; // q6
419  noiseFlaggingID = 1; // q7
420  pileupCleaningID = 0; // q8
421  }
422 
423  // Packing parameters in two words
424 
425  int p1shift[7];
426  p1shift[0] = 0;
427  for (int k = 0; k < 6; k++) {
428  int j = k + 1;
429  p1shift[j] = p1shift[k] + p1bit[k];
430  // cout<<" j= "<<j<<" shift "<< p1shift[j]<<endl;
431  }
432  int param1 = 0;
433  param1 = containmentCorrectionFlag | (containmentCorrectionPreSample << p1shift[1]) | (Iphase << p1shift[2]) |
434  (firstSample << p1shift[3]) | (samplesToAdd << p1shift[4]) | (pulseShapeID << p1shift[5]);
435 
436  int q2shift[10];
437  q2shift[0] = 0;
438  for (int k = 0; k < 9; k++) {
439  int j = k + 1;
440  q2shift[j] = q2shift[k] + q2bit[k];
441  // cout<<" j= "<<j<<" shift "<< q2shift[j]<<endl;
442  }
443  int param2 = 0;
444  param2 = useLeakCorrection | (LeakCorrectionID << q2shift[1]) | (correctForTimeslew << q2shift[2]) |
445  (timeCorrectionID << q2shift[3]) | (correctTiming << q2shift[4]) | (firstAuxTS << q2shift[5]) |
446  (specialCaseID << q2shift[6]) | (noiseFlaggingID << q2shift[7]) | (pileupCleaningID << q2shift[8]) |
447  (packingScheme << q2shift[9]);
448 
449  HcalRecoParam result(fId.rawId(), param1, param2);
450 
451  return result;
452 }
453 
455  int nhits = 0;
456  float phase = 0.0;
457  float rms = 0.0;
459  nhits = 4;
460  phase = 4.5;
461  rms = 6.5;
462  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenEndcap) {
463  nhits = 4;
464  phase = 9.3;
465  rms = 7.8;
466  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter) {
467  nhits = 4;
468  phase = 8.6;
469  rms = 2.3;
470  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenForward) {
471  nhits = 4;
472  phase = 12.4;
473  rms = 12.29;
474  }
476 
477  return result;
478 }
479 
480 #define EMAP_NHBHECR 9
481 #define EMAP_NHFCR 3
482 #define EMAP_NHOCR 4
483 #define EMAP_NFBR 8
484 #define EMAP_NFCH 3
485 #define EMAP_NHTRS 3
486 #define EMAP_NHSETS 4
487 #define EMAP_NTOPBOT 2
488 #define EMAP_NHTRSHO 4
489 #define EMAP_NHSETSHO 3
490 
491 std::unique_ptr<HcalDcsMap> HcalDbHardcode::makeHardcodeDcsMap() const {
492  HcalDcsMapAddons::Helper dcs_map_helper;
493  dcs_map_helper.mapGeomId2DcsId(HcalDetId(HcalBarrel, -16, 1, 1),
495  dcs_map_helper.mapGeomId2DcsId(HcalDetId(HcalForward, -41, 3, 1),
497  dcs_map_helper.mapGeomId2DcsId(HcalDetId(HcalForward, -26, 25, 2),
499  dcs_map_helper.mapGeomId2DcsId(HcalDetId(HcalBarrel, -15, 68, 1),
501  dcs_map_helper.mapGeomId2DcsId(HcalDetId(HcalOuter, -14, 1, 4),
503  dcs_map_helper.mapGeomId2DcsId(HcalDetId(HcalForward, 41, 71, 2),
505  return std::make_unique<HcalDcsMap>(dcs_map_helper);
506 }
507 
508 std::unique_ptr<HcalElectronicsMap> HcalDbHardcode::makeHardcodeMap(const std::vector<HcalGenericDetId>& cells) const {
509  static const int kUTCAMask = 0x4000000; //set bit 26 for uTCA version
510  static const int kLinearIndexMax = 0x7FFFF; //19 bits
511  static const int kTriggerBitMask = 0x02000000; //2^25
512  uint32_t counter = 0;
513  uint32_t counterTrig = 0;
515  for (const auto& fId : cells) {
516  if (fId.genericSubdet() == HcalGenericDetId::HcalGenBarrel ||
517  fId.genericSubdet() == HcalGenericDetId::HcalGenEndcap ||
518  fId.genericSubdet() == HcalGenericDetId::HcalGenForward ||
519  fId.genericSubdet() == HcalGenericDetId::HcalGenOuter || fId.genericSubdet() == HcalGenericDetId::HcalGenZDC) {
520  ++counter;
521  assert(counter < kLinearIndexMax);
522  uint32_t raw = counter;
523  raw |= kUTCAMask;
524  HcalElectronicsId elId(raw);
525  emapHelper.mapEId2chId(elId, fId);
526  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenTriggerTower) {
527  ++counterTrig;
528  assert(counterTrig < kLinearIndexMax);
529  uint32_t raw = counterTrig;
530  raw |= kUTCAMask | kTriggerBitMask;
531  HcalElectronicsId elId(raw);
532  emapHelper.mapEId2tId(elId, fId);
533  }
534  }
535  return std::make_unique<HcalElectronicsMap>(emapHelper);
536 }
537 
538 std::unique_ptr<HcalFrontEndMap> HcalDbHardcode::makeHardcodeFrontEndMap(
539  const std::vector<HcalGenericDetId>& cells) const {
541  std::stringstream mystream;
542  std::string detector[5] = {"XX", "HB", "HE", "HO", "HF"};
543  for (const auto& fId : cells) {
544  if (fId.isHcalDetId()) {
545  HcalDetId id = HcalDetId(fId.rawId());
546  HcalSubdetector subdet = id.subdet();
547  int ieta = id.ietaAbs();
548  int iside = id.zside();
549  int iphi = id.iphi();
550  std::string det, rbx;
551  int irm(0);
552  char tempbuff[30];
553  char sidesign = (iside == -1) ? 'M' : 'P';
554  if (subdet == HcalBarrel || subdet == HcalEndcap) {
555  det = detector[subdet];
556  irm = (iphi + 1) % 4 + 1;
557  int iwedge(0);
558  if (ieta >= 21 && (irm == 1 || irm == 3))
559  iwedge = (iphi + 1 + irm + 1) / 4;
560  else
561  iwedge = (iphi + irm + 1) / 4;
562  if (iwedge > 18)
563  iwedge -= 18;
564  sprintf(tempbuff, "%s%c%2.2i%c", det.c_str(), sidesign, iwedge, '\0');
565  mystream << tempbuff;
566  rbx = mystream.str();
567  mystream.str("");
568  emapHelper.loadObject(id, irm, rbx);
569  } else if (subdet == HcalForward) {
570  det = detector[subdet];
571  int hfphi(0);
572  if ((iside == 1 && ieta == 40) || (iside == -1 && ieta == 41)) {
573  irm = ((iphi + 1) / 2) % 36 + 1;
574  hfphi = ((iphi + 1) / 6) % 12 + 1;
575  } else {
576  irm = (iphi + 1) / 2;
577  hfphi = (iphi - 1) / 6 + 1;
578  }
579  irm = (irm - 1) % 3 + 1;
580  sprintf(tempbuff, "%s%c%2.2i%c", det.c_str(), sidesign, hfphi, '\0');
581  mystream << tempbuff;
582  rbx = mystream.str();
583  mystream.str("");
584  emapHelper.loadObject(id, irm, rbx);
585  } else if (subdet == HcalOuter) {
586  det = detector[subdet];
587  int ring(0), sector(0);
588  if (ieta <= 4)
589  ring = 0;
590  else if (ieta >= 5 && ieta <= 10)
591  ring = 1;
592  else
593  ring = 2;
594  for (int i = -2; i < iphi; i += 6)
595  sector++;
596  if (sector > 12)
597  sector = 1;
598  irm = ((iphi + 1) / 2) % 6 + 1;
599  if (ring != 0 && sector % 2 != 0)
600  sector++;
601  if (ring == 0)
602  sprintf(tempbuff, "%s%i%2.2d", det.c_str(), ring, sector);
603  else
604  sprintf(tempbuff, "%s%i%c%2.2d", det.c_str(), ring, sidesign, sector);
605  mystream << tempbuff;
606  rbx = mystream.str();
607  mystream.str("");
608  emapHelper.loadObject(id, irm, rbx);
609  }
610  }
611  }
612  return std::make_unique<HcalFrontEndMap>(emapHelper);
613 }
614 
616  //check for cached value
617  auto eta_depth_pair = std::make_pair(ieta, depth);
618  auto nLayers = theLayersInDepths_.find(eta_depth_pair);
619  if (nLayers != theLayersInDepths_.end()) {
620  return nLayers->second;
621  } else {
622  std::vector<int> segmentation;
623  topo->getDepthSegmentation(ieta, segmentation);
624  //assume depth segmentation vector is sorted
625  int nLayersInDepth = std::distance(std::lower_bound(segmentation.begin(), segmentation.end(), depth),
626  std::upper_bound(segmentation.begin(), segmentation.end(), depth));
627  theLayersInDepths_.insert(std::make_pair(eta_depth_pair, nLayersInDepth));
628  return nLayersInDepth;
629  }
630 }
631 
633  if (fId.isHcalDetId()) {
634  HcalDetId hid(fId);
635  //special mixed case for HE 2017
636  if (hid.zside() == 1 && (hid.iphi() == 63 || hid.iphi() == 64 || hid.iphi() == 65 || hid.iphi() == 66))
637  return true;
638  }
639  return false;
640 }
641 
643  const HcalTopology* topo,
644  double intlumi) {
645  // SiPMParameter defined for each DetId the following quantities:
646  // SiPM type, PhotoElectronToAnalog, Dark Current, two auxiliary words
647  // These numbers come from some measurements done with SiPMs
648  // rule for type: cells with >4 layers use larger device (3.3mm diameter), otherwise 2.8mm
649  HcalSiPMType theType = HcalNoSiPM;
650  double thePe2fC = getParameters(fId).photoelectronsToAnalog();
651  double theDC = getParameters(fId).darkCurrent(0, intlumi);
653  if (useHBUpgrade_) {
654  HcalDetId hid(fId);
655  int nLayersInDepth = getLayersInDepth(hid.ietaAbs(), hid.depth(), topo);
656  if (nLayersInDepth > 4) {
657  theType = HcalHBHamamatsu2;
658  theDC = getParameters(fId).darkCurrent(1, intlumi);
659  } else {
660  theType = HcalHBHamamatsu1;
661  theDC = getParameters(fId).darkCurrent(0, intlumi);
662  }
663  } else
664  theType = HcalHPD;
665  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenEndcap) {
666  if (useHEUpgrade_ || (testHEPlan1_ && isHEPlan1(fId))) {
667  HcalDetId hid(fId);
668  int nLayersInDepth = getLayersInDepth(hid.ietaAbs(), hid.depth(), topo);
669  if (nLayersInDepth > 4) {
670  theType = HcalHEHamamatsu2;
671  theDC = getParameters(fId).darkCurrent(1, intlumi);
672  } else {
673  theType = HcalHEHamamatsu1;
674  theDC = getParameters(fId).darkCurrent(0, intlumi);
675  }
676  } else
677  theType = HcalHPD;
678  } else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter) {
679  if (useHOUpgrade_)
680  theType = HcalHOHamamatsu;
681  else
682  theType = HcalHPD;
683  }
684 
685  return HcalSiPMParameter(fId.rawId(), theType, thePe2fC, theDC, 0, 0);
686 }
687 
688 std::unique_ptr<HcalSiPMCharacteristics> HcalDbHardcode::makeHardcodeSiPMCharacteristics() const {
689  // SiPMCharacteristics are constants for each type of SiPM:
690  // Type, # of pixels, 3 parameters for non-linearity, cross talk parameter, ..
691  // Obtained from data sheet and measurements
692  // types (in order): HcalHOZecotek=1, HcalHOHamamatsu, HcalHEHamamatsu1, HcalHEHamamatsu2, HcalHBHamamatsu1, HcalHBHamamatsu2, HcalHPD
694  for (unsigned ip = 0; ip < theSiPMCharacteristics_.size(); ++ip) {
695  auto& ps = theSiPMCharacteristics_[ip];
696  sipmHelper.loadObject(ip + 1,
697  ps.getParameter<int>("pixels"),
698  ps.getParameter<double>("nonlin1"),
699  ps.getParameter<double>("nonlin2"),
700  ps.getParameter<double>("nonlin3"),
701  ps.getParameter<double>("crosstalk"),
702  0,
703  0);
704  }
705  return std::make_unique<HcalSiPMCharacteristics>(sipmHelper);
706 }
707 
709  // For each detId parameters for trigger primitive
710  // mask for channel validity and self trigger information, fine grain
711  // bit information and auxiliary words
712  uint32_t bitInfo = ((44 << 16) | 30);
713  return HcalTPChannelParameter(fId.rawId(), 0, bitInfo, 0, 0);
714 }
715 
717  // Parameters for a given TP algorithm:
718  // FineGrain Algorithm Version for HBHE, ADC threshold fof TDC mask of HF,
719  // TDC mask for HF, Self Trigger bits, auxiliary words
720  tppar.loadObject(0, 0, 0xFFFFFFFFFFFFFFFF, 0, 0, 0);
721 }
HcalHBHamamatsu2
Definition: HcalSiPMType.h:11
HcalDbHardcode::makeQIECoder
HcalQIECoder makeQIECoder(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:184
counter
Definition: counter.py:1
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
HcalCalibrationQIECoder
Definition: HcalCalibrationQIECoder.h:17
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:355
HcalDbHardcode::makeHardcodeSiPMCharacteristics
std::unique_ptr< HcalSiPMCharacteristics > makeHardcodeSiPMCharacteristics() const
Definition: HcalDbHardcode.cc:688
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
ecalSimParameterMap_cff.syncPhase
syncPhase
Definition: ecalSimParameterMap_cff.py:11
HcalHPD
Definition: HcalSiPMType.h:12
HcalDbHardcode::theHFParameters_
HcalHardcodeParameters theHFParameters_
Definition: HcalDbHardcode.h:125
HcalNoSiPM
Definition: HcalSiPMType.h:5
HcalDcsDetId
Definition: HcalDcsDetId.h:27
HcalGenericDetId
Definition: HcalGenericDetId.h:15
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HcalDetId::iphi
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
HcalDcsMapAddons::Helper::mapGeomId2DcsId
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
Definition: HcalDcsMap.cc:143
HcalDbHardcode::makeMCParam
HcalMCParam makeMCParam(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:216
HcalDbHardcode::testHFQIE10_
bool testHFQIE10_
Definition: HcalDbHardcode.h:128
HcalTPParameters
Definition: HcalTPParameters.h:10
HcalQIENum
HcalQIENum
Definition: HcalQIENum.h:4
HcalHardcodeParameters::pedestal
const double pedestal() const
Definition: HcalHardcodeParameters.h:34
HcalHEHamamatsu2
Definition: HcalSiPMType.h:9
HcalDbHardcode::makeGain
HcalGain makeGain(HcalGenericDetId fId, bool fSmear=false) const
Definition: HcalDbHardcode.cc:157
HcalHardcodeParameters::gainWidth
const double gainWidth(unsigned index) const
Definition: HcalHardcodeParameters.h:37
HcalHardcodeParameters::qieType
const int qieType() const
Definition: HcalHardcodeParameters.h:39
HcalTopology
Definition: HcalTopology.h:26
HcalDbHardcode::getLayersInDepth
int getLayersInDepth(int ieta, int depth, const HcalTopology *topo)
Definition: HcalDbHardcode.cc:615
HcalFrontEndMapAddons::Helper::loadObject
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
Definition: HcalFrontEndMap.cc:44
HcalDbHardcode::setHEUpgrade_
bool setHEUpgrade_
Definition: HcalDbHardcode.h:127
cms::cuda::assert
assert(be >=bs)
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
HcalGenericDetId::HcalGenEndcap
Definition: HcalGenericDetId.h:20
HcalDbHardcode::makeHardcodeTPParameters
void makeHardcodeTPParameters(HcalTPParameters &tppar) const
Definition: HcalDbHardcode.cc:716
HcalHardcodeParameters::gain
const double gain(unsigned index) const
Definition: HcalHardcodeParameters.h:36
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
castor_dqm_sourceclient-live_cfg.samplesToAdd
samplesToAdd
Definition: castor_dqm_sourceclient-live_cfg.py:56
HcalElectronicsMapAddons::Helper::mapEId2tId
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
Definition: HcalElectronicsMap.cc:166
HcalDcsDetId::DYN8
Definition: HcalDcsDetId.h:34
HcalDbHardcode::theHOParameters_
HcalHardcodeParameters theHOParameters_
Definition: HcalDbHardcode.h:125
hcalSimParameters_cfi.timeSmearing
timeSmearing
Definition: hcalSimParameters_cfi.py:50
HLT_2018_cff.phase
phase
Definition: HLT_2018_cff.py:5346
HcalBarrel
Definition: HcalAssistant.h:33
HcalZSThreshold
Definition: HcalZSThreshold.h:13
HcalDbHardcode::makeHardcodeFrontEndMap
void makeHardcodeFrontEndMap(HcalFrontEndMap &emap, const std::vector< HcalGenericDetId > &cells) const
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
HcalDbHardcode::useHOUpgrade_
bool useHOUpgrade_
Definition: HcalDbHardcode.h:128
HcalDbHardcode::makeTimingParam
HcalTimingParam makeTimingParam(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:454
HcalHardcodeParameters
Definition: HcalHardcodeParameters.h:9
HcalDbHardcode::setHO_
bool setHO_
Definition: HcalDbHardcode.h:127
HcalDbHardcode::testHEPlan1_
bool testHEPlan1_
Definition: HcalDbHardcode.h:128
HLT_2018_cff.firstAuxTS
firstAuxTS
Definition: HLT_2018_cff.py:7208
HcalDbHardcode::useHEUpgrade_
bool useHEUpgrade_
Definition: HcalDbHardcode.h:128
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HcalDbHardcode::isHEPlan1
bool isHEPlan1(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:632
HcalGenericDetId::HcalGenZDC
Definition: HcalGenericDetId.h:24
HcalHardcodeParameters::darkCurrent
const double darkCurrent(unsigned index, double intlumi) const
Definition: HcalHardcodeParameters.cc:47
HcalDbHardcode::HcalDbHardcode
HcalDbHardcode()
Definition: HcalDbHardcode.cc:18
HcalDbHardcode::makeHardcodeMap
std::unique_ptr< HcalElectronicsMap > makeHardcodeMap(const std::vector< HcalGenericDetId > &cells) const
Definition: HcalDbHardcode.cc:508
HcalRecoParam
Definition: HcalRecoParam.h:16
HcalDbHardcode::makeHardcodeSiPMParameter
HcalSiPMParameter makeHardcodeSiPMParameter(HcalGenericDetId fId, const HcalTopology *topo, double intlumi)
Definition: HcalDbHardcode.cc:642
cuda_std::upper_bound
__host__ constexpr __device__ RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:45
HcalDbHardcode::getParameters
const HcalHardcodeParameters & getParameters(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:47
HcalDbHardcode::setHE_
bool setHE_
Definition: HcalDbHardcode.h:127
HcalDbHardcode::makePedestal
HcalPedestal makePedestal(HcalGenericDetId fId, bool fSmear, bool eff, const HcalTopology *topo, double intlumi)
Definition: HcalDbHardcode.cc:107
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HcalDcsDetId::HV
Definition: HcalDcsDetId.h:30
HcalOuter
Definition: HcalAssistant.h:35
HcalDbHardcode::makeCalibrationQIECoder
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:204
HcalDbHardcode::setHBUpgrade_
bool setHBUpgrade_
Definition: HcalDbHardcode.h:127
HcalPedestal
Definition: HcalPedestal.h:15
dqmdumpme.k
k
Definition: dqmdumpme.py:60
nhits
Definition: HIMultiTrackSelector.h:42
HcalDbHardcode::useHBUpgrade_
bool useHBUpgrade_
Definition: HcalDbHardcode.h:128
HcalDbHardcode.h
HcalSiPMType.h
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalDcsOuter
Definition: HcalSubdetector.h:19
HcalTPChannelParameter
Definition: HcalTPChannelParameter.h:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalGain
Definition: HcalGain.h:16
HcalDbHardcode::setHFUpgrade_
bool setHFUpgrade_
Definition: HcalDbHardcode.h:127
MuonTCMETValueMapProducer_cff.nLayers
nLayers
Definition: MuonTCMETValueMapProducer_cff.py:38
HcalDbHardcode::theDefaultParameters_
HcalHardcodeParameters theDefaultParameters_
Definition: HcalDbHardcode.h:124
HcalDbHardcode::theSiPMCharacteristics_
std::vector< edm::ParameterSet > theSiPMCharacteristics_
Definition: HcalDbHardcode.h:129
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HcalDbHardcode::makeHardcodeDcsMap
std::unique_ptr< HcalDcsMap > makeHardcodeDcsMap() const
Definition: HcalDbHardcode.cc:491
HcalDetId::ieta
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
HcalDbHardcode::makeQIEShape
HcalQIEShape makeQIEShape() const
Definition: HcalDbHardcode.cc:214
castor_dqm_sourceclient-live_cfg.firstSample
firstSample
Definition: castor_dqm_sourceclient-live_cfg.py:58
HcalDbHardcode::setHB_
bool setHB_
Definition: HcalDbHardcode.h:127
HcalDbHardcode::theHEParameters_
HcalHardcodeParameters theHEParameters_
Definition: HcalDbHardcode.h:125
HcalDbHardcode::makeGainWidth
HcalGainWidth makeGainWidth(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:172
HcalHardcodeParameters::mcShape
const int mcShape() const
Definition: HcalHardcodeParameters.h:42
HcalHBHamamatsu1
Definition: HcalSiPMType.h:10
HcalHardcodeParameters::recoShape
const int recoShape() const
Definition: HcalHardcodeParameters.h:43
HcalHardcodeParameters::zsThreshold
const int zsThreshold() const
Definition: HcalHardcodeParameters.h:38
HcalGenericDetId::HcalGenTriggerTower
Definition: HcalGenericDetId.h:23
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalDetId
Definition: HcalDetId.h:12
HcalDbHardcode::theHBUpgradeParameters_
HcalHardcodeParameters theHBUpgradeParameters_
Definition: HcalDbHardcode.h:126
value
Definition: value.py:1
HcalHEHamamatsu1
Definition: HcalSiPMType.h:8
HcalDbHardcode::theHEUpgradeParameters_
HcalHardcodeParameters theHEUpgradeParameters_
Definition: HcalDbHardcode.h:126
HcalHOHamamatsu
Definition: HcalSiPMType.h:7
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
HcalGenericDetId::HcalGenBarrel
Definition: HcalGenericDetId.h:19
HcalDcsMapAddons::Helper
Definition: HcalDcsMap.h:144
HcalDbHardcode::theHFUpgradeParameters_
HcalHardcodeParameters theHFUpgradeParameters_
Definition: HcalDbHardcode.h:126
HcalQIECoder
Definition: HcalQIECoder.h:20
ecalEBTriggerPrimitiveDigis_cfi.binOfMaximum
binOfMaximum
Definition: ecalEBTriggerPrimitiveDigis_cfi.py:9
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalForward
Definition: HcalAssistant.h:36
HcalMCParam
Definition: HcalMCParam.h:29
HcalFrontEndMapAddons::Helper
Definition: HcalFrontEndMap.h:96
HcalTPParameters::loadObject
void loadObject(int version, int adcCut, uint64_t tdcMask, uint32_t tbits, int auxi1, int auxi2)
Definition: HcalTPParameters.cc:12
HcalSiPMCharacteristicsAddons::Helper::loadObject
bool loadObject(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1=0, float auxi2=0)
Definition: HcalSiPMCharacteristics.cc:55
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HcalTopology::getDepthSegmentation
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
Definition: HcalTopology.cc:1064
HcalDbHardcode::makeQIEType
HcalQIEType makeQIEType(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:198
HcalDbHardcode::theLayersInDepths_
std::map< std::pair< int, int >, int > theLayersInDepths_
Definition: HcalDbHardcode.h:130
HcalGenericDetId::isHcalDetId
bool isHcalDetId() const
Definition: HcalGenericDetId.cc:64
castor_dqm_sourceclient-live_cfg.correctForTimeslew
correctForTimeslew
Definition: castor_dqm_sourceclient-live_cfg.py:60
HcalDcsBarrel
Definition: HcalSubdetector.h:17
HcalEndcap
Definition: HcalAssistant.h:34
HcalGenericDetId::genericSubdet
HcalGenericSubdetector genericSubdet() const
Definition: HcalGenericDetId.cc:21
HcalElectronicsMapAddons::Helper
Definition: HcalElectronicsMap.h:137
relativeConstraints.value
value
Definition: relativeConstraints.py:53
HLT_2018_cff.correctTiming
correctTiming
Definition: HLT_2018_cff.py:7220
postprocess-scan-build.cells
cells
Definition: postprocess-scan-build.py:13
HcalDbHardcode::makeZSThreshold
HcalZSThreshold makeZSThreshold(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:178
HcalDbHardcode::makeRecoParam
HcalRecoParam makeRecoParam(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:307
HcalElectronicsMapAddons::Helper::mapEId2chId
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
Definition: HcalElectronicsMap.cc:182
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HLT_2018_cff.useLeakCorrection
useLeakCorrection
Definition: HLT_2018_cff.py:7214
HcalQIENum.h
HcalHardcodeParameters::pedestalWidth
const double pedestalWidth() const
Definition: HcalHardcodeParameters.h:35
HcalHardcodeParameters::photoelectronsToAnalog
const double photoelectronsToAnalog() const
Definition: HcalHardcodeParameters.h:44
HcalQIEShape
Definition: HcalQIEShape.h:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HcalDbHardcode::makeHardcodeTPChannelParameter
HcalTPChannelParameter makeHardcodeTPChannelParameter(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:708
HcalTimingParam
Definition: HcalTimingParam.h:7
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
HcalGenericDetId::HcalGenOuter
Definition: HcalGenericDetId.h:21
HcalSiPMType
HcalSiPMType
Definition: HcalSiPMType.h:4
mps_fire.result
result
Definition: mps_fire.py:303
HcalPedestalWidth
Definition: HcalPedestalWidth.h:15
HcalDetId::ietaAbs
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
HcalQIEType
Definition: HcalQIEType.h:12
HcalDbHardcode::getGainIndex
const int getGainIndex(HcalGenericDetId fId) const
Definition: HcalDbHardcode.cc:89
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HcalDetId::zside
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
HcalDbHardcode::useHFUpgrade_
bool useHFUpgrade_
Definition: HcalDbHardcode.h:128
HcalDcsForward
Definition: HcalSubdetector.h:20
HcalGenericDetId::HcalGenForward
Definition: HcalGenericDetId.h:22
HcalDbHardcode::makePedestalWidth
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology *topo, double intlumi)
Definition: HcalDbHardcode.cc:130
HcalSiPMCharacteristicsAddons::Helper
Definition: HcalSiPMCharacteristics.h:106
HcalDbHardcode::theHBParameters_
HcalHardcodeParameters theHBParameters_
Definition: HcalDbHardcode.h:125
HcalSiPMParameter
Definition: HcalSiPMParameter.h:7
HcalGainWidth
Definition: HcalGainWidth.h:15
HcalDbHardcode::setHF_
bool setHF_
Definition: HcalDbHardcode.h:127