CMS 3D CMS Logo

HGCalVFELinearizationImpl.cc
Go to the documentation of this file.
2 
4  : linLSB_si_(conf.getParameter<double>("linLSB_si")),
5  adcsaturation_si_(conf.getParameter<double>("adcsaturation_si")),
6  tdcnBits_si_(conf.getParameter<uint32_t>("tdcnBits_si")),
7  tdcOnset_si_(conf.getParameter<double>("tdcOnset_si")),
8  adcnBits_si_(conf.getParameter<uint32_t>("adcnBits_si")),
9  tdcsaturation_si_(conf.getParameter<double>("tdcsaturation_si")),
10  linLSB_sc_(conf.getParameter<double>("linLSB_sc")),
11  adcsaturation_sc_(conf.getParameter<double>("adcsaturation_sc")),
12  tdcnBits_sc_(conf.getParameter<uint32_t>("tdcnBits_sc")),
13  tdcOnset_sc_(conf.getParameter<double>("tdcOnset_sc")),
14  adcnBits_sc_(conf.getParameter<uint32_t>("adcnBits_sc")),
15  tdcsaturation_sc_(conf.getParameter<double>("tdcsaturation_sc")),
16  linnBits_(conf.getParameter<uint32_t>("linnBits")) {
21  linMax_ = (0x1 << linnBits_) - 1;
22 }
23 
25  std::vector<std::pair<DetId, uint32_t>>& linearized_dataframes) {
26  double amplitude = 0.;
27  uint32_t amplitude_int = 0;
28  const int kIntimeSample = 2;
29 
30  for (const auto& frame : dataframes) { //loop on DIGI
31  unsigned det = frame.id().det();
32  double adcLSB = 0.;
33  double tdcLSB = 0.;
34  double tdcOnset = 0.;
35  double linLSB = 0.;
36  if (det == DetId::Forward || det == DetId::HGCalEE || det == DetId::HGCalHSi) {
37  adcLSB = adcLSB_si_;
38  tdcLSB = tdcLSB_si_;
39  tdcOnset = tdcOnset_si_;
40  linLSB = linLSB_si_;
41  } else if (det == DetId::Hcal || det == DetId::HGCalHSc) {
42  adcLSB = adcLSB_sc_;
43  tdcLSB = tdcLSB_sc_;
44  tdcOnset = tdcOnset_sc_;
45  linLSB = linLSB_sc_;
46  }
47  if (frame[kIntimeSample].mode()) { //TOT mode
48  amplitude = (floor(tdcOnset / adcLSB) + 1.0) * adcLSB + double(frame[kIntimeSample].data()) * tdcLSB;
49  } else { //ADC mode
50  amplitude = double(frame[kIntimeSample].data()) * adcLSB;
51  }
52 
53  amplitude_int = uint32_t(floor(amplitude / linLSB + 0.5));
54  if (amplitude_int > linMax_)
55  amplitude_int = linMax_;
56 
57  linearized_dataframes.push_back(std::make_pair(frame.id(), amplitude_int));
58  }
59 }
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:79
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30