CMS 3D CMS Logo

HGCalVFELinearizationImpl.cc
Go to the documentation of this file.
2 
4  : linLSB_(conf.getParameter<double>("linLSB")),
5  adcsaturation_(conf.getParameter<double>("adcsaturation")),
6  tdcnBits_(conf.getParameter<uint32_t>("tdcnBits")),
7  tdcOnsetfC_(conf.getParameter<double>("tdcOnsetfC")),
8  adcnBits_(conf.getParameter<uint32_t>("adcnBits")),
9  tdcsaturation_(conf.getParameter<double>("tdcsaturation")),
10  linnBits_(conf.getParameter<uint32_t>("linnBits")) {
13  linMax_ = (0x1 << linnBits_) - 1;
14 }
15 
17  std::vector<std::pair<DetId, uint32_t>>& linearized_dataframes) {
18  double amplitude = 0.;
19  uint32_t amplitude_int = 0;
20  const int kIntimeSample = 2;
21 
22  for (const auto& frame : dataframes) { //loop on DIGI
23  unsigned det = frame.id().det();
24  if (det == DetId::Forward || det == DetId::HGCalEE || det == DetId::HGCalHSi) {
25  if (frame[kIntimeSample].mode()) { //TOT mode
26  amplitude = (floor(tdcOnsetfC_ / adcLSB_) + 1.0) * adcLSB_ + double(frame[kIntimeSample].data()) * tdcLSB_;
27  } else { //ADC mode
28  amplitude = double(frame[kIntimeSample].data()) * adcLSB_;
29  }
30 
31  amplitude_int = uint32_t(floor(amplitude / linLSB_ + 0.5));
32  } else if (det == DetId::Hcal || det == DetId::HGCalHSc) {
33  // no linearization here. Take the raw ADC data
34  amplitude_int = frame[kIntimeSample].data();
35  }
36  if (amplitude_int > linMax_)
37  amplitude_int = linMax_;
38 
39  linearized_dataframes.push_back(std::make_pair(frame.id(), amplitude_int));
40  }
41 }
HGCalVFELinearizationImpl(const edm::ParameterSet &conf)
void linearize(const std::vector< HGCDataFrame< DetId, HGCSample >> &, std::vector< std::pair< DetId, uint32_t >> &)
Readout digi for HGC.
Definition: HGCDataFrame.h:14
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40