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