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")),
17  oot_coefficients_(conf.getParameter<std::vector<double>>("oot_coefficients")) {
18  constexpr int kOot_order = 2;
19  if (oot_coefficients_.size() != kOot_order) {
20  throw cms::Exception("BadConfiguration") << "OOT subtraction needs " << kOot_order << " coefficients";
21  }
26  linMax_ = (0x1 << linnBits_) - 1;
27 }
28 
30  std::vector<std::pair<DetId, uint32_t>>& linearized_dataframes) {
31  constexpr int kIntimeSample = 2;
32  constexpr int kOuttime1Sample = 1; // in time - 1;
33  constexpr int kOuttime2Sample = 0; // in time - 2;
34 
35  for (const auto& frame : dataframes) { //loop on DIGI
36  double amplitude = 0.;
37  uint32_t amplitude_int = 0;
38  unsigned det = frame.id().det();
39  double adcLSB = 0.;
40  double tdcLSB = 0.;
41  double tdcOnset = 0.;
42  double linLSB = 0.;
43  if (det == DetId::Forward || det == DetId::HGCalEE || det == DetId::HGCalHSi) {
44  adcLSB = adcLSB_si_;
45  tdcLSB = tdcLSB_si_;
47  linLSB = linLSB_si_;
48  if (frame[kIntimeSample].mode()) { //TOT mode
49  amplitude = (floor(tdcOnset / adcLSB) + 1.0) * adcLSB + double(frame[kIntimeSample].data()) * tdcLSB;
50  } else { //ADC mode
51  double data = frame[kIntimeSample].data();
52  // applies OOT PU subtraction only in the ADC mode
53  if (!frame[kOuttime1Sample].mode()) {
54  data += oot_coefficients_[kOuttime1Sample] * frame[kOuttime1Sample].data();
55  if (!frame[kOuttime2Sample].mode()) {
56  data += oot_coefficients_[kOuttime2Sample] * frame[kOuttime2Sample].data();
57  }
58  }
59  amplitude = std::max(0., data) * adcLSB;
60  }
61 
62  amplitude_int = uint32_t(floor(amplitude / linLSB + 0.5));
63  } else if (det == DetId::Hcal || det == DetId::HGCalHSc) {
64  adcLSB = adcLSB_sc_;
65  tdcLSB = tdcLSB_sc_;
67  linLSB = linLSB_sc_;
68  }
69  if (frame[kIntimeSample].mode()) { //TOT mode
70  amplitude = (floor(tdcOnset / adcLSB) + 1.0) * adcLSB + double(frame[kIntimeSample].data()) * tdcLSB;
71  } else { //ADC mode
72  amplitude = double(frame[kIntimeSample].data()) * adcLSB;
73  }
74 
75  amplitude_int = uint32_t(floor(amplitude / linLSB + 0.5));
76  if (amplitude_int == 0)
77  continue;
78  if (amplitude_int > linMax_)
79  amplitude_int = linMax_;
80 
81  linearized_dataframes.push_back(std::make_pair(frame.id(), amplitude_int));
82  }
83 }
HGCalVFELinearizationImpl::tdcnBits_sc_
uint32_t tdcnBits_sc_
Definition: HGCalVFELinearizationImpl.h:34
HGCalVFELinearizationImpl.h
CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
HGCalVFELinearizationImpl::adcsaturation_sc_
double adcsaturation_sc_
Definition: HGCalVFELinearizationImpl.h:33
HGCalVFELinearizationImpl::adcLSB_si_
double adcLSB_si_
Definition: HGCalVFELinearizationImpl.h:22
HGCalVFELinearizationImpl::tdcOnset_sc_
double tdcOnset_sc_
Definition: HGCalVFELinearizationImpl.h:35
DetId::Hcal
Definition: DetId.h:28
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
HGCalVFELinearizationImpl::tdcLSB_sc_
double tdcLSB_sc_
Definition: HGCalVFELinearizationImpl.h:38
HLTEgPhaseIITestSequence_cff.tdcOnset
tdcOnset
Definition: HLTEgPhaseIITestSequence_cff.py:950
HGCalVFELinearizationImpl::linnBits_
uint32_t linnBits_
Definition: HGCalVFELinearizationImpl.h:41
HGCalVFELinearizationImpl::tdcsaturation_si_
double tdcsaturation_si_
Definition: HGCalVFELinearizationImpl.h:28
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCalVFELinearizationImpl::tdcLSB_si_
double tdcLSB_si_
Definition: HGCalVFELinearizationImpl.h:29
HGCalVFELinearizationImpl::oot_coefficients_
std::vector< double > oot_coefficients_
Definition: HGCalVFELinearizationImpl.h:42
HGCalVFELinearizationImpl::tdcnBits_si_
uint32_t tdcnBits_si_
Definition: HGCalVFELinearizationImpl.h:25
HGCalVFELinearizationImpl::linLSB_si_
double linLSB_si_
Definition: HGCalVFELinearizationImpl.h:23
HGCalVFELinearizationImpl::adcsaturation_si_
double adcsaturation_si_
Definition: HGCalVFELinearizationImpl.h:24
HGCalVFELinearizationImpl::tdcOnset_si_
double tdcOnset_si_
Definition: HGCalVFELinearizationImpl.h:26
HGCalVFELinearizationImpl::HGCalVFELinearizationImpl
HGCalVFELinearizationImpl(const edm::ParameterSet &conf)
Definition: HGCalVFELinearizationImpl.cc:3
HGCalVFELinearizationImpl::adcnBits_sc_
uint32_t adcnBits_sc_
Definition: HGCalVFELinearizationImpl.h:36
HGCalVFELinearizationImpl::linLSB_sc_
double linLSB_sc_
Definition: HGCalVFELinearizationImpl.h:32
edm::ParameterSet
Definition: ParameterSet.h:36
HGCalVFELinearizationImpl::adcLSB_sc_
double adcLSB_sc_
Definition: HGCalVFELinearizationImpl.h:31
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HGCDataFrame
Readout digi for HGC.
Definition: HGCDataFrame.h:14
HGCalVFELinearizationImpl::adcnBits_si_
uint32_t adcnBits_si_
Definition: HGCalVFELinearizationImpl.h:27
HGCalVFELinearizationImpl::linearize
void linearize(const std::vector< HGCDataFrame< DetId, HGCSample >> &, std::vector< std::pair< DetId, uint32_t >> &)
Definition: HGCalVFELinearizationImpl.cc:29
std
Definition: JetResolutionObject.h:76
DetId::HGCalHSc
Definition: DetId.h:34
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
Exception
Definition: hltDiff.cc:246
HGCalVFELinearizationImpl::linMax_
uint32_t linMax_
Definition: HGCalVFELinearizationImpl.h:40
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HGCalVFELinearizationImpl::tdcsaturation_sc_
double tdcsaturation_sc_
Definition: HGCalVFELinearizationImpl.h:37
DetId::Forward
Definition: DetId.h:30