CMS 3D CMS Logo

HcaluLUTTPGCoder.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include <cmath>
4 #include <string>
31 
32 const float HcaluLUTTPGCoder::lsb_=1./16;
33 
37 
38 constexpr double MaximumFractionalError = 0.002; // 0.2% error allowed from this source
39 
41  topo_{},
42  delay_{},
45  bitToMask_{},
46  firstHBEta_{},
47  lastHBEta_{},
48  nHBEta_{},
49  maxDepthHB_{},
50  sizeHB_{},
51  firstHEEta_{},
52  lastHEEta_{},
53  nHEEta_{},
54  maxDepthHE_{},
55  sizeHE_{},
56  firstHFEta_{},
57  lastHFEta_{},
58  nHFEta_{},
59  maxDepthHF_{},
60  sizeHF_{},
64  allLinear_{},
68 }
69 
71  init(top, delay);
72 }
73 
74 void HcaluLUTTPGCoder::init(const HcalTopology* top, const HcalTimeSlew* delay) {
75  topo_ = top;
76  delay_ = delay;
77  LUTGenerationMode_ = true;
78  FG_HF_thresholds_ = {0, 0};
79  bitToMask_ = 0;
80  allLinear_ = false;
81  linearLSB_QIE8_ = 1.;
82  linearLSB_QIE11_ = 1.;
84  pulseCorr_ = std::make_unique<HcalPulseContainmentManager>(MaximumFractionalError);
87  nHBEta_ = (lastHBEta_-firstHBEta_+1);
100  size_t nluts= (size_t)(sizeHB_+sizeHE_+sizeHF_+1);
101  inputLUT_ = std::vector<HcaluLUTTPGCoder::Lut>(nluts);
102  gain_ = std::vector<float>(nluts, 0.);
103  ped_ = std::vector<float>(nluts, 0.);
105 }
106 
107 void HcaluLUTTPGCoder::compress(const IntegerCaloSamples& ics, const std::vector<bool>& featureBits, HcalTriggerPrimitiveDigi& tp) const {
108  throw cms::Exception("PROBLEM: This method should never be invoked!");
109 }
110 
112 }
113 
114 int HcaluLUTTPGCoder::getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const {
115  int retval(0);
116  if (id == HcalBarrel) {
117  retval = (depth-1)+maxDepthHB_*(iphi-1);
118  if (ieta>0) retval+=maxDepthHB_*nFi_*(ieta-firstHBEta_);
119  else retval+=maxDepthHB_*nFi_*(ieta+lastHBEta_+nHBEta_);
120  } else if (id == HcalEndcap) {
121  retval = sizeHB_;
122  retval+= (depth-1)+maxDepthHE_*(iphi-1);
123  if (ieta>0) retval+=maxDepthHE_*nFi_*(ieta-firstHEEta_);
124  else retval+=maxDepthHE_*nFi_*(ieta+lastHEEta_+nHEEta_);
125  } else if (id == HcalForward) {
126  retval = sizeHB_+sizeHE_;
127  retval+= (depth-1)+maxDepthHF_*(iphi-1);
128  if (ieta>0) retval+=maxDepthHF_*nFi_*(ieta-firstHFEta_);
129  else retval+=maxDepthHF_*nFi_*(ieta+lastHFEta_+nHFEta_);
130  }
131  return retval;
132 }
133 
134 int HcaluLUTTPGCoder::getLUTId(uint32_t rawid) const {
135  HcalDetId detid(rawid);
136  return getLUTId(detid.subdet(), detid.ieta(), detid.iphi(), detid.depth());
137 }
138 
139 int HcaluLUTTPGCoder::getLUTId(const HcalDetId& detid) const {
140  return getLUTId(detid.subdet(), detid.ieta(), detid.iphi(), detid.depth());
141 }
142 
143 void HcaluLUTTPGCoder::update(const char* filename, bool appendMSB) {
144 
145  std::ifstream file(filename, std::ios::in);
146  assert(file.is_open());
147 
148  std::vector<HcalSubdetector> subdet;
150 
151  // Drop first (comment) line
152  std::getline(file, buffer);
153  std::getline(file, buffer);
154 
155  unsigned int index = buffer.find("H", 0);
156  while (index < buffer.length()){
157  std::string subdetStr = buffer.substr(index, 2);
158  if (subdetStr == "HB") subdet.push_back(HcalBarrel);
159  else if (subdetStr == "HE") subdet.push_back(HcalEndcap);
160  else if (subdetStr == "HF") subdet.push_back(HcalForward);
161  //TODO Check subdet
162  //else exception
163  index += 2;
164  index = buffer.find("H", index);
165  }
166 
167  // Get upper/lower ranges for ieta/iphi/depth
168  size_t nCol = subdet.size();
169  assert(nCol > 0);
170 
171  std::vector<int> ietaU;
172  std::vector<int> ietaL;
173  std::vector<int> iphiU;
174  std::vector<int> iphiL;
175  std::vector<int> depU;
176  std::vector<int> depL;
177  std::vector< Lut > lutFromFile(nCol);
178  LutElement lutValue;
179 
180  for (size_t i=0; i<nCol; ++i) {
181  int ieta;
182  file >> ieta;
183  ietaL.push_back(ieta);
184  }
185 
186  for (size_t i=0; i<nCol; ++i) {
187  int ieta;
188  file >> ieta;
189  ietaU.push_back(ieta);
190  }
191 
192  for (size_t i=0; i<nCol; ++i) {
193  int iphi;
194  file >> iphi;
195  iphiL.push_back(iphi);
196  }
197 
198  for (size_t i=0; i<nCol; ++i) {
199  int iphi;
200  file >> iphi;
201  iphiU.push_back(iphi);
202  }
203 
204  for (size_t i=0; i<nCol; ++i) {
205  int dep;
206  file >> dep;
207  depL.push_back(dep);
208  }
209 
210  for (size_t i=0; i<nCol; ++i) {
211  int dep;
212  file >> dep;
213  depU.push_back(dep);
214  }
215 
216  // Read Lut Entry
217  for (size_t i=0; file >> lutValue; i = (i+1) % nCol){
218  lutFromFile[i].push_back(lutValue);
219  }
220 
221  // Check lut size
222  for (size_t i=0; i<nCol; ++i) assert(lutFromFile[i].size() == INPUT_LUT_SIZE);
223 
224  for (size_t i=0; i<nCol; ++i){
225  for (int ieta = ietaL[i]; ieta <= ietaU[i]; ++ieta){
226  for (int iphi = iphiL[i]; iphi <= iphiU[i]; ++iphi){
227  for (int depth = depL[i]; depth <= depU[i]; ++depth){
228 
229  HcalDetId id(subdet[i], ieta, iphi, depth);
230  if (!topo_->valid(id)) continue;
231 
232  int lutId = getLUTId(id);
233  for (size_t adc = 0; adc < INPUT_LUT_SIZE; ++adc){
234  if (appendMSB){
235  // Append FG bit LUT to MSB
236  // MSB = Most Significant Bit = bit 10
237  // Overwrite bit 10
238  LutElement msb = (lutFromFile[i][adc] != 0 ? QIE8_LUT_MSB : 0);
239  inputLUT_[lutId][adc] = (msb | (inputLUT_[lutId][adc] & QIE8_LUT_BITMASK));
240  }
241  else inputLUT_[lutId][adc] = lutFromFile[i][adc];
242  }// for adc
243  }// for depth
244  }// for iphi
245  }// for ieta
246  }// for nCol
247 }
248 
250  LutXml * _xml = new LutXml(filename);
251  _xml->create_lut_map();
253  for (int ieta = -HcalDetId::kHcalEtaMask2;
254  ieta <= (int)(HcalDetId::kHcalEtaMask2); ++ieta) {
255  for (unsigned int iphi = 0; iphi <= HcalDetId::kHcalPhiMask2; ++iphi) {
256  for (unsigned int depth = 1; depth < HcalDetId::kHcalDepthMask2; ++depth) {
257  for (int isub=0; isub<3; ++isub) {
258  HcalDetId detid(subdet[isub], ieta, iphi, depth);
259  if (!topo_->valid(detid)) continue;
260  int id = getLUTId(subdet[isub], ieta, iphi, depth);
261  std::vector<unsigned int>* lut = _xml->getLutFast(detid);
262  if (lut==nullptr) throw cms::Exception("PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
263  if (lut->size()!=INPUT_LUT_SIZE) throw cms::Exception ("PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
264  for (unsigned int i=0; i<INPUT_LUT_SIZE; ++i) inputLUT_[id][i] = (LutElement)lut->at(i);
265  }
266  }
267  }
268  }
269  delete _xml;
271 }
272 
273 double HcaluLUTTPGCoder::cosh_ieta(int ieta, int depth, HcalSubdetector subdet) {
274  // ieta = 28 and 29 are both associated with trigger tower 28
275  // so special handling is required. HF ieta=29 channels included in TT30
276  // are already handled correctly in cosh_ieta_
277  if (abs(ieta) >= 28 && subdet == HcalEndcap && allLinear_) {
278  if (abs(ieta) == 29) return cosh_ieta_29_HE_;
279  if (abs(ieta) == 28) {
280  if (depth <= 3) return cosh_ieta_28_HE_low_depths_;
281  else return cosh_ieta_28_HE_high_depths_;
282  }
283  }
284 
285  return cosh_ieta_[ieta];
286 }
287 
289 
290  cosh_ieta_ = std::vector<double>(lastHFEta_ + 1, -1.0);
291 
292  HcalTrigTowerGeometry triggeo(topo_);
293 
294  for (int i = 1; i <= firstHFEta_; ++i) {
295  double eta_low = 0., eta_high = 0.;
296  triggeo.towerEtaBounds(i, 0, eta_low, eta_high);
297  cosh_ieta_[i] = cosh((eta_low + eta_high)/2.);
298  }
299  for (int i = firstHFEta_; i <= lastHFEta_; ++i){
300  std::pair<double,double> etas = topo_->etaRange(HcalForward,i);
301  double eta1 = etas.first;
302  double eta2 = etas.second;
303  cosh_ieta_[i] = cosh((eta1 + eta2)/2.);
304  }
305 
306  // trigger tower 28 in HE has a more complicated geometry
307  std::pair<double, double> eta28 = topo_->etaRange(HcalEndcap, 28);
308  std::pair<double, double> eta29 = topo_->etaRange(HcalEndcap, 29);
309  cosh_ieta_29_HE_ = cosh((eta29.first + eta29.second)/2.);
310  cosh_ieta_28_HE_low_depths_ = cosh((eta28.first + eta28.second)/2.);
311  // for higher depths in ieta = 28, the trigger tower extends past
312  // the ieta = 29 channels
313  cosh_ieta_28_HE_high_depths_ = cosh((eta28.first + eta29.second)/2.);
314 }
315 
316 void HcaluLUTTPGCoder::update(const HcalDbService& conditions) {
317 
318  const HcalLutMetadata *metadata = conditions.getHcalLutMetadata();
319  assert(metadata !=nullptr);
320  float nominalgain_ = metadata->getNominalGain();
321 
322  pulseCorr_->beginRun(&conditions, delay_);
323 
325 
326  for (const auto& id: metadata->getAllChannels()) {
327 
328  if (not (id.det() == DetId::Hcal and topo_->valid(id))) continue;
329 
330  HcalDetId cell(id);
331  HcalSubdetector subdet = cell.subdet();
332 
333  if (subdet != HcalBarrel and subdet != HcalEndcap and subdet != HcalForward) continue;
334 
335  const HcalQIECoder* channelCoder = conditions.getHcalCoder (cell);
336  const HcalQIEShape* shape = conditions.getHcalShape(cell);
337  HcalCoderDb coder (*channelCoder, *shape);
338  const HcalLutMetadatum *meta = metadata->getValues(cell);
339 
340  unsigned int mipMax = 0;
341  unsigned int mipMin = 0;
342 
343  bool is2018OrLater = topo_->triggerMode() >= HcalTopologyMode::TriggerMode_2018 or
345  if (is2018OrLater or topo_->dddConstants()->isPlan1(cell)) {
346  const HcalTPChannelParameter *channelParameters = conditions.getHcalTPChannelParameter(cell);
347  mipMax = channelParameters->getFGBitInfo() >> 16;
348  mipMin = channelParameters->getFGBitInfo() & 0xFFFF;
349  }
350 
351  int lutId = getLUTId(cell);
352  Lut &lut=inputLUT_[lutId];
353  float ped = 0;
354  float gain = 0;
355  uint32_t status = 0;
356 
357  if (LUTGenerationMode_){
358  const HcalCalibrations& calibrations = conditions.getHcalCalibrations(cell);
359  for (auto capId : {0,1,2,3}){
360  ped += calibrations.effpedestal(capId);
361  gain += calibrations.LUTrespcorrgain(capId);
362  }
363  ped /= 4.0;
364  gain /= 4.0;
365 
366  //Get Channel Quality
367  const HcalChannelStatus* channelStatus = conditions.getHcalChannelStatus(cell);
368  status = channelStatus->getValue();
369 
370  } else {
371  const HcalL1TriggerObject* myL1TObj = conditions.getHcalL1TriggerObject(cell);
372  ped = myL1TObj->getPedestal();
373  gain = myL1TObj->getRespGain();
374  status = myL1TObj->getFlag();
375  } // LUTGenerationMode_
376 
377  ped_[lutId] = ped;
378  gain_[lutId] = gain;
379  bool isMasked = ( (status & bitToMask_) > 0 );
380  float rcalib = meta->getRCalib();
381 
382  auto adc2fC = [channelCoder, shape](unsigned int adc){
383  float fC = 0;
384  for (auto capId : {0,1,2,3}) fC += channelCoder->charge(*shape, adc, capId);
385  return fC/4;
386  };
387 
388  int qieType =conditions.getHcalQIEType(cell)->getValue();
389 
390  const size_t SIZE = qieType==QIE8 ? INPUT_LUT_SIZE : UPGRADE_LUT_SIZE;
391  const int MASK = qieType==QIE8 ? QIE8_LUT_BITMASK :
393  double linearLSB = linearLSB_QIE8_;
394  if (qieType == QIE11 and cell.ietaAbs() == topo_->lastHBRing())
395  linearLSB = linearLSB_QIE11Overlap_;
396  else if (qieType == QIE11)
397  linearLSB = linearLSB_QIE11_;
398 
399  lut.resize(SIZE, 0);
400 
401  // Input LUT for HB/HE/HF
402  if (subdet == HcalBarrel || subdet == HcalEndcap){
403 
404  int granularity = meta->getLutGranularity();
405 
406  double correctionPhaseNS = conditions.getHcalRecoParam(cell)->correctionPhaseNS();
407  for (unsigned int adc = 0; adc < SIZE; ++adc) {
408  if (isMasked) lut[adc] = 0;
409  else {
410  double nonlinearityCorrection = 1.0;
411  double containmentCorrection2TSCorrected = 1.0;
412  // SiPM nonlinearity was not corrected in 2017
413  // and containment corrections were not
414  // ET-dependent prior to 2018
415  if(is2018OrLater) {
416  double containmentCorrection1TS = pulseCorr_->correction(cell, 1, correctionPhaseNS, adc2fC(adc));
417  // Use the 1-TS containment correction to estimate the charge of the pulse
418  // from the individual samples
419  double correctedCharge = containmentCorrection1TS*adc2fC(adc);
420  containmentCorrection2TSCorrected = pulseCorr_->correction(cell, 2, correctionPhaseNS, correctedCharge);
421  if(qieType==QIE11) {
422  const HcalSiPMParameter& siPMParameter(*conditions.getHcalSiPMParameter(cell));
423  HcalSiPMnonlinearity corr(conditions.getHcalSiPMCharacteristics()->getNonLinearities(siPMParameter.getType()));
424  const double fcByPE = siPMParameter.getFCByPE();
425  const double effectivePixelsFired = correctedCharge/fcByPE;
426  nonlinearityCorrection = corr.getRecoCorrectionFactor(effectivePixelsFired);
427  }
428  }
429  if (allLinear_)
430  lut[adc] = (LutElement) std::min(std::max(0, int((adc2fC(adc) - ped) * gain * rcalib * nonlinearityCorrection * containmentCorrection2TSCorrected / linearLSB / cosh_ieta(cell.ietaAbs(), cell.depth(), HcalEndcap))), MASK);
431  else
432  lut[adc] = (LutElement) std::min(std::max(0, int((adc2fC(adc) - ped) * gain * rcalib * nonlinearityCorrection * containmentCorrection2TSCorrected / nominalgain_ / granularity)), MASK);
433 
434  if(qieType==QIE11){
435  if (adc >= mipMin and adc < mipMax) lut[adc] |= QIE11_LUT_MSB0;
436  else if (adc >= mipMax) lut[adc] |= QIE11_LUT_MSB1;
437  }
438  }
439  }
440  }
441  else if (subdet == HcalForward){
442  for (unsigned int adc = 0; adc < SIZE; ++adc) {
443  if (isMasked) lut[adc] = 0;
444  else {
445  lut[adc] = std::min(std::max(0,int((adc2fC(adc) - ped) * gain * rcalib / lsb_ / cosh_ieta_[cell.ietaAbs()])), MASK);
446  if(adc>FG_HF_thresholds_[0]) lut[adc] |= QIE10_LUT_MSB0;
447  if(adc>FG_HF_thresholds_[1]) lut[adc] |= QIE10_LUT_MSB1;
448  }
449  }
450  }
451  }
452 }
453 
455  int lutId = getLUTId(df.id());
456  const Lut& lut = inputLUT_.at(lutId);
457  for (int i=0; i<df.size(); i++){
458  ics[i] = (lut.at(df[i].adc()) & QIE8_LUT_BITMASK);
459  }
460 }
461 
463  int lutId = getLUTId(df.id());
464  const Lut& lut = inputLUT_.at(lutId);
465  for (int i=0; i<df.size(); i++){
466  ics[i] = (lut.at(df[i].adc()) & QIE8_LUT_BITMASK);
467  }
468 }
469 
471  int lutId = getLUTId(HcalDetId(df.id()));
472  const Lut& lut = inputLUT_.at(lutId);
473  for (int i=0; i<df.samples(); i++){
474  ics[i] = (lut.at(df[i].adc()) & QIE10_LUT_BITMASK);
475  }
476 }
477 
479  int lutId = getLUTId(HcalDetId(df.id()));
480  const Lut& lut = inputLUT_.at(lutId);
481  for (int i=0; i<df.samples(); i++){
482  ics[i] = (lut.at(df[i].adc()) & QIE11_LUT_BITMASK);
483  }
484 }
485 
487  int lutId = getLUTId(id);
488  return ((inputLUT_.at(lutId)).at(sample.adc()) & QIE8_LUT_BITMASK);
489 }
490 
492  int lutId = getLUTId(id);
493  return ped_.at(lutId);
494 }
495 
497  int lutId = getLUTId(id);
498  return gain_.at(lutId);
499 }
500 
501 std::vector<unsigned short> HcaluLUTTPGCoder::getLinearizationLUT(HcalDetId id) const{
502  int lutId = getLUTId(id);
503  return inputLUT_.at(lutId);
504 }
505 
506 void HcaluLUTTPGCoder::lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const{
507  msb.resize(df.size());
508  for (int i=0; i<df.size(); ++i)
509  msb[i] = getMSB(df.id(), df.sample(i).adc());
510 }
511 
512 bool HcaluLUTTPGCoder::getMSB(const HcalDetId& id, int adc) const{
513  int lutId = getLUTId(id);
514  const Lut& lut = inputLUT_.at(lutId);
515  return (lut.at(adc) & QIE8_LUT_MSB);
516 }
517 
518 void HcaluLUTTPGCoder::lookupMSB(const QIE10DataFrame& df, std::vector<std::bitset<2>>& msb) const{
519  msb.resize(df.samples());
520  int lutId = getLUTId(HcalDetId(df.id()));
521  const Lut& lut = inputLUT_.at(lutId);
522  for (int i = 0; i < df.samples(); ++i) {
523  msb[i][0] = lut.at(df[i].adc()) & QIE10_LUT_MSB0;
524  msb[i][1] = lut.at(df[i].adc()) & QIE10_LUT_MSB1;
525  }
526 }
527 
528 void
529 HcaluLUTTPGCoder::lookupMSB(const QIE11DataFrame& df, std::vector<std::bitset<2>>& msb) const
530 {
531  int lutId = getLUTId(HcalDetId(df.id()));
532  const Lut& lut = inputLUT_.at(lutId);
533  for (int i = 0; i < df.samples(); ++i) {
534  msb[i][0] = lut.at(df[i].adc()) & QIE11_LUT_MSB0;
535  msb[i][1] = lut.at(df[i].adc()) & QIE11_LUT_MSB1;
536  }
537 }
std::vector< uint32_t > FG_HF_thresholds_
int samples() const
total number of samples in the digi
size
Write out results.
uint32_t getFlag() const
int maxDepth(void) const
int firstHFRing() const
Definition: HcalTopology.h:91
float getPedestal() const
static const int nFi_
void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const override
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:168
double cosh_ieta_28_HE_high_depths_
int getValue() const
Definition: HcalQIEType.h:20
Definition: LutXml.h:27
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
const HcalTPChannelParameter * getHcalTPChannelParameter(const HcalGenericDetId &fId) const
bool valid(const DetId &id) const override
double linearLSB_QIE11Overlap_
static uint32_t kHcalEtaMask2
Definition: HcalDetId.h:21
const HcalRecoParam * getHcalRecoParam(const HcalGenericDetId &fId) const
static const int QIE11_LUT_MSB1
static const int QIE11_LUT_BITMASK
const HcalChannelStatus * getHcalChannelStatus(const HcalGenericDetId &fId) const
Definition: HcalQIENum.h:4
float getLUTGain(HcalDetId id) const override
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:31
int create_lut_map(void)
Definition: LutXml.cc:383
const HcalTopology * topo_
int firstHBRing() const
Definition: HcalTopology.h:87
edm::DataFrame::id_type id() const
int lastHBRing() const
Definition: HcalTopology.h:88
static const int QIE11_LUT_MSB0
static const float lsb_
void towerEtaBounds(int ieta, int version, double &eta1, double &eta2) const
where this tower begins and ends in eta
const Item * getValues(DetId fId, bool throwOnFail=true) const
double cosh_ieta_28_HE_low_depths_
void init(const HcalTopology *top, const HcalTimeSlew *delay)
static const int QIE8_LUT_BITMASK
uint8_t getLutGranularity() const
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
unsigned short LutElement
void update(const HcalDbService &conditions)
void updateXML(const char *filename)
static const int QIE10_LUT_MSB0
static const size_t UPGRADE_LUT_SIZE
int depth() const
get the tower depth
Definition: HcalDetId.h:166
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
float getRespGain() const
double MaximumFractionalError
HcalDetId const & id() const
Definition: HFDataFrame.h:26
int terminate(void)
std::vector< DetId > getAllChannels() const
constexpr float correctionPhaseNS() const
Definition: HcalRecoParam.h:31
float getNominalGain() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static uint32_t kHcalDepthMask2
Definition: HcalDetId.h:27
const HcalTimeSlew * delay_
float getRCalib() const
const HcalL1TriggerObject * getHcalL1TriggerObject(const HcalGenericDetId &fId) const
constexpr double effpedestal(int fCapId) const
get effective pedestal for capid=0..3
int ieta() const
get the cell ieta
Definition: HcalDetId.h:159
int lastHFRing() const
Definition: HcalTopology.h:92
edm::DataFrame::id_type id() const
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const HcalLutMetadata * getHcalLutMetadata() const
T min(T a, T b)
Definition: MathUtil.h:58
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
static const int QIE8_LUT_MSB
constexpr int adc() const
get the ADC sample
Definition: HcalQIESample.h:59
JetCorrectorParameters corr
Definition: classes.h:5
static const int QIE10_LUT_BITMASK
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:154
const HcalQIEType * getHcalQIEType(const HcalGenericDetId &fId) const
std::vector< double > cosh_ieta_
double const adc2fC[256]
Definition: Constants.h:240
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
std::vector< float > ped_
double cosh_ieta(int ieta, int depth, HcalSubdetector subdet)
std::vector< float > gain_
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:30
HcalQIESample const & sample(int i) const
access a sample
Definition: HBHEDataFrame.h:44
static uint32_t kHcalPhiMask2
Definition: HcalDetId.h:17
~HcaluLUTTPGCoder() override
int firstHERing() const
Definition: HcalTopology.h:89
constexpr double LUTrespcorrgain(int fCapId) const
get LUT corrected and response corrected gain for capid=0..3
const HcalSiPMCharacteristics * getHcalSiPMCharacteristics() const
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
std::vector< float > getNonLinearities(int type) const
get nonlinearity constants
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
std::vector< unsigned int > * getLutFast(uint32_t det_id)
Definition: LutXml.cc:88
static const size_t INPUT_LUT_SIZE
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
bool getMSB(const HcalDetId &id, int adc) const
float getLUTPedestal(HcalDetId id) const override
uint32_t getFGBitInfo() const
get FG bit information
const HcalDetId & id() const
Definition: HBHEDataFrame.h:27
bool isPlan1(const HcalDetId &id) const
void make_cosh_ieta_map(void)
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
int samples() const
total number of samples in the digi
std::unique_ptr< HcalPulseContainmentManager > pulseCorr_
const HcalSiPMParameter * getHcalSiPMParameter(const HcalGenericDetId &fId) const
#define constexpr
static const int QIE10_LUT_MSB1
static XMLProcessor * getInstance()
Definition: XMLProcessor.h:145
int lastHERing() const
Definition: HcalTopology.h:90
Definition: Lut.h:31
void compress(const IntegerCaloSamples &ics, const std::vector< bool > &featureBits, HcalTriggerPrimitiveDigi &tp) const override
std::vector< unsigned short > getLinearizationLUT(HcalDetId id) const override
Get the full linearization LUT (128 elements). Default implementation just uses adc2Linear to get all...
std::vector< Lut > inputLUT_
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
Definition: HcalQIECoder.cc:20