CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalVFELinearizationImpl Class Reference

#include <HGCalVFELinearizationImpl.h>

Public Member Functions

 HGCalVFELinearizationImpl (const edm::ParameterSet &conf)
 
void linearize (const std::vector< HGCDataFrame< DetId, HGCSample >> &, std::vector< std::pair< DetId, uint32_t >> &)
 
uint32_t linnBits () const
 

Private Attributes

double adcLSB_sc_
 
double adcLSB_si_
 
uint32_t adcnBits_sc_
 
uint32_t adcnBits_si_
 
double adcsaturation_sc_
 
double adcsaturation_si_
 
double linLSB_sc_
 
double linLSB_si_
 
uint32_t linMax_
 
uint32_t linnBits_
 
std::vector< double > oot_coefficients_
 
double tdcLSB_sc_
 
double tdcLSB_si_
 
uint32_t tdcnBits_sc_
 
uint32_t tdcnBits_si_
 
double tdcOnset_sc_
 
double tdcOnset_si_
 
double tdcsaturation_sc_
 
double tdcsaturation_si_
 

Detailed Description

Definition at line 12 of file HGCalVFELinearizationImpl.h.

Constructor & Destructor Documentation

◆ HGCalVFELinearizationImpl()

HGCalVFELinearizationImpl::HGCalVFELinearizationImpl ( const edm::ParameterSet conf)

Definition at line 3 of file HGCalVFELinearizationImpl.cc.

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 }

References adcLSB_sc_, adcLSB_si_, adcnBits_sc_, adcnBits_si_, adcsaturation_sc_, adcsaturation_si_, Exception, linMax_, linnBits_, oot_coefficients_, tdcLSB_sc_, tdcLSB_si_, tdcnBits_sc_, tdcnBits_si_, tdcsaturation_sc_, and tdcsaturation_si_.

Member Function Documentation

◆ linearize()

void HGCalVFELinearizationImpl::linearize ( const std::vector< HGCDataFrame< DetId, HGCSample >> &  dataframes,
std::vector< std::pair< DetId, uint32_t >> &  linearized_dataframes 
)

Definition at line 29 of file HGCalVFELinearizationImpl.cc.

30  {
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 }

References adcLSB_sc_, adcLSB_si_, CustomPhysics_cfi::amplitude, data, DetId::Forward, amptDefault_cfi::frame, DetId::Hcal, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, linLSB_sc_, linLSB_si_, linMax_, SiStripPI::max, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, oot_coefficients_, tdcLSB_sc_, tdcLSB_si_, HGCalUncalibRecHit_cfi::tdcOnset, tdcOnset_sc_, and tdcOnset_si_.

◆ linnBits()

uint32_t HGCalVFELinearizationImpl::linnBits ( ) const
inline

Definition at line 19 of file HGCalVFELinearizationImpl.h.

19 { return linnBits_; }

References linnBits_.

Member Data Documentation

◆ adcLSB_sc_

double HGCalVFELinearizationImpl::adcLSB_sc_
private

Definition at line 31 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ adcLSB_si_

double HGCalVFELinearizationImpl::adcLSB_si_
private

Definition at line 22 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ adcnBits_sc_

uint32_t HGCalVFELinearizationImpl::adcnBits_sc_
private

Definition at line 36 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ adcnBits_si_

uint32_t HGCalVFELinearizationImpl::adcnBits_si_
private

Definition at line 27 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ adcsaturation_sc_

double HGCalVFELinearizationImpl::adcsaturation_sc_
private

Definition at line 33 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ adcsaturation_si_

double HGCalVFELinearizationImpl::adcsaturation_si_
private

Definition at line 24 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ linLSB_sc_

double HGCalVFELinearizationImpl::linLSB_sc_
private

Definition at line 32 of file HGCalVFELinearizationImpl.h.

Referenced by linearize().

◆ linLSB_si_

double HGCalVFELinearizationImpl::linLSB_si_
private

Definition at line 23 of file HGCalVFELinearizationImpl.h.

Referenced by linearize().

◆ linMax_

uint32_t HGCalVFELinearizationImpl::linMax_
private

Definition at line 40 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ linnBits_

uint32_t HGCalVFELinearizationImpl::linnBits_
private

Definition at line 41 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linnBits().

◆ oot_coefficients_

std::vector<double> HGCalVFELinearizationImpl::oot_coefficients_
private

Definition at line 42 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ tdcLSB_sc_

double HGCalVFELinearizationImpl::tdcLSB_sc_
private

Definition at line 38 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ tdcLSB_si_

double HGCalVFELinearizationImpl::tdcLSB_si_
private

Definition at line 29 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ tdcnBits_sc_

uint32_t HGCalVFELinearizationImpl::tdcnBits_sc_
private

Definition at line 34 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ tdcnBits_si_

uint32_t HGCalVFELinearizationImpl::tdcnBits_si_
private

Definition at line 25 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ tdcOnset_sc_

double HGCalVFELinearizationImpl::tdcOnset_sc_
private

Definition at line 35 of file HGCalVFELinearizationImpl.h.

Referenced by linearize().

◆ tdcOnset_si_

double HGCalVFELinearizationImpl::tdcOnset_si_
private

Definition at line 26 of file HGCalVFELinearizationImpl.h.

Referenced by linearize().

◆ tdcsaturation_sc_

double HGCalVFELinearizationImpl::tdcsaturation_sc_
private

Definition at line 37 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ tdcsaturation_si_

double HGCalVFELinearizationImpl::tdcsaturation_si_
private

Definition at line 28 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

HGCalVFELinearizationImpl::tdcnBits_sc_
uint32_t tdcnBits_sc_
Definition: HGCalVFELinearizationImpl.h:34
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
HGCalVFELinearizationImpl::linnBits_
uint32_t linnBits_
Definition: HGCalVFELinearizationImpl.h:41
HGCalVFELinearizationImpl::tdcsaturation_si_
double tdcsaturation_si_
Definition: HGCalVFELinearizationImpl.h:28
HGCalUncalibRecHit_cfi.tdcOnset
tdcOnset
Definition: HGCalUncalibRecHit_cfi.py:29
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::adcnBits_sc_
uint32_t adcnBits_sc_
Definition: HGCalVFELinearizationImpl.h:36
HGCalVFELinearizationImpl::linLSB_sc_
double linLSB_sc_
Definition: HGCalVFELinearizationImpl.h:32
HGCalVFELinearizationImpl::adcLSB_sc_
double adcLSB_sc_
Definition: HGCalVFELinearizationImpl.h:31
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HGCalVFELinearizationImpl::adcnBits_si_
uint32_t adcnBits_si_
Definition: HGCalVFELinearizationImpl.h:27
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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