CMS 3D CMS Logo

HGCalVFELinearizationImpl.cc
Go to the documentation of this file.
2 
5  linLSB_(conf.getParameter<double>("linLSB")),
6  adcsaturation_(conf.getParameter<double>("adcsaturation")),
7  tdcnBits_(conf.getParameter<uint32_t>("tdcnBits")),
8  tdcOnsetfC_(conf.getParameter<double>("tdcOnsetfC")),
9  adcnBits_(conf.getParameter<uint32_t>("adcnBits")),
10  tdcsaturation_(conf.getParameter<double>("tdcsaturation")),
11  linnBits_(conf.getParameter<uint32_t>("linnBits"))
12 {
15  linMax_ = (0x1<<linnBits_)-1;
16 }
17 
18 void
20 linearize(const std::vector<HGCDataFrame<DetId,HGCSample>>& dataframes,
21  std::vector<std::pair<DetId, uint32_t > >& linearized_dataframes)
22 {
23  double amplitude = 0.;
24  uint32_t amplitude_int = 0;
25  const int kIntimeSample = 2;
26 
27  for(const auto& frame : dataframes) {//loop on DIGI
28  unsigned det = frame.id().det();
29  if(det==DetId::Forward || det==DetId::HGCalEE || det==DetId::HGCalHSi) {
30  if (frame[kIntimeSample].mode()) {//TOT mode
31  amplitude =( floor(tdcOnsetfC_/adcLSB_) + 1.0 )* adcLSB_ + double(frame[kIntimeSample].data()) * tdcLSB_;
32  }
33  else {//ADC mode
34  amplitude = double(frame[kIntimeSample].data()) * adcLSB_;
35  }
36 
37  amplitude_int = uint32_t (floor(amplitude/linLSB_+0.5));
38  }
39  else if(det==DetId::Hcal || det==DetId::HGCalHSc) {
40  // no linearization here. Take the raw ADC data
41  amplitude_int = frame[kIntimeSample].data();
42  }
43  if (amplitude_int>linMax_) amplitude_int = linMax_;
44 
45  linearized_dataframes.push_back(std::make_pair (frame.id(), amplitude_int));
46  }
47 }
48 
49 
HGCalVFELinearizationImpl(const edm::ParameterSet &conf)
void linearize(const std::vector< HGCDataFrame< DetId, HGCSample >> &, std::vector< std::pair< DetId, uint32_t > > &)
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