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< HGCalDataFrame > &, std::vector< std::pair< DetId, uint32_t >> &)
 

Private Attributes

double adcLSB_
 
uint32_t adcnBits_
 
double adcsaturation_
 
double linLSB_
 
uint32_t linMax_
 
uint32_t linnBits_
 
std::vector< double > oot_coefficients_
 
double tdcLSB_
 
uint32_t tdcnBits_
 
double tdcOnset_
 
double tdcsaturation_
 

Detailed Description

Definition at line 10 of file HGCalVFELinearizationImpl.h.

Constructor & Destructor Documentation

◆ HGCalVFELinearizationImpl()

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

Definition at line 5 of file HGCalVFELinearizationImpl.cc.

6  : linLSB_(conf.getParameter<double>("linLSB")),
7  adcsaturation_(conf.getParameter<double>("adcsaturation")),
8  tdcnBits_(conf.getParameter<uint32_t>("tdcnBits")),
9  tdcOnset_(conf.getParameter<double>("tdcOnset")),
10  adcnBits_(conf.getParameter<uint32_t>("adcnBits")),
11  tdcsaturation_(conf.getParameter<double>("tdcsaturation")),
12  linnBits_(conf.getParameter<uint32_t>("linnBits")),
13  oot_coefficients_(conf.getParameter<std::vector<double>>("oot_coefficients")) {
14  constexpr int kOot_order = 2;
15  if (oot_coefficients_.size() != kOot_order) {
16  throw cms::Exception("BadConfiguration") << "OOT subtraction needs " << kOot_order << " coefficients";
17  }
18  adcLSB_ = std::ldexp(adcsaturation_, -adcnBits_);
19  tdcLSB_ = std::ldexp(tdcsaturation_, -tdcnBits_);
20  linMax_ = (0x1 << linnBits_) - 1;
21 }

References adcLSB_, adcnBits_, adcsaturation_, Exception, linMax_, linnBits_, oot_coefficients_, tdcLSB_, tdcnBits_, and tdcsaturation_.

Member Function Documentation

◆ linearize()

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

Definition at line 23 of file HGCalVFELinearizationImpl.cc.

24  {
25  constexpr int kIntimeSample = 2;
26  constexpr int kOuttime1Sample = 1; // in time - 1;
27  constexpr int kOuttime2Sample = 0; // in time - 2;
28 
29  for (const auto& frame : dataframes) { //loop on DIGI
30  double amplitude = 0.;
31  if (frame[kIntimeSample].mode()) { //TOT mode
32  amplitude = (std::floor(tdcOnset_ / adcLSB_) + 1.0) * adcLSB_ + double(frame[kIntimeSample].data()) * tdcLSB_;
33  } else { //ADC mode
34  double data = frame[kIntimeSample].data();
35  // applies OOT PU subtraction only in the ADC mode
36  if (!frame[kOuttime1Sample].mode()) {
37  data += oot_coefficients_[kOuttime1Sample] * frame[kOuttime1Sample].data();
38  if (!frame[kOuttime2Sample].mode()) {
39  data += oot_coefficients_[kOuttime2Sample] * frame[kOuttime2Sample].data();
40  }
41  }
42  amplitude = std::max(0., data) * adcLSB_;
43  }
44  uint32_t amplitude_int = uint32_t(std::floor(amplitude / linLSB_ + 0.5));
45  if (amplitude_int == 0)
46  continue;
47  if (amplitude_int > linMax_)
48  amplitude_int = linMax_;
49 
50  linearized_dataframes.emplace_back(frame.id(), amplitude_int);
51  }
52 }

References adcLSB_, CustomPhysics_cfi::amplitude, data, amptDefault_cfi::frame, linLSB_, linMax_, SiStripPI::max, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, oot_coefficients_, tdcLSB_, and tdcOnset_.

Member Data Documentation

◆ adcLSB_

double HGCalVFELinearizationImpl::adcLSB_
private

Definition at line 17 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ adcnBits_

uint32_t HGCalVFELinearizationImpl::adcnBits_
private

Definition at line 22 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ adcsaturation_

double HGCalVFELinearizationImpl::adcsaturation_
private

Definition at line 19 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ linLSB_

double HGCalVFELinearizationImpl::linLSB_
private

Definition at line 18 of file HGCalVFELinearizationImpl.h.

Referenced by linearize().

◆ linMax_

uint32_t HGCalVFELinearizationImpl::linMax_
private

Definition at line 26 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ linnBits_

uint32_t HGCalVFELinearizationImpl::linnBits_
private

Definition at line 27 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ oot_coefficients_

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

Definition at line 28 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ tdcLSB_

double HGCalVFELinearizationImpl::tdcLSB_
private

Definition at line 24 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl(), and linearize().

◆ tdcnBits_

uint32_t HGCalVFELinearizationImpl::tdcnBits_
private

Definition at line 20 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

◆ tdcOnset_

double HGCalVFELinearizationImpl::tdcOnset_
private

Definition at line 21 of file HGCalVFELinearizationImpl.h.

Referenced by linearize().

◆ tdcsaturation_

double HGCalVFELinearizationImpl::tdcsaturation_
private

Definition at line 23 of file HGCalVFELinearizationImpl.h.

Referenced by HGCalVFELinearizationImpl().

CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
HGCalVFELinearizationImpl::linLSB_
double linLSB_
Definition: HGCalVFELinearizationImpl.h:18
HGCalVFELinearizationImpl::tdcsaturation_
double tdcsaturation_
Definition: HGCalVFELinearizationImpl.h:23
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
HGCalVFELinearizationImpl::tdcLSB_
double tdcLSB_
Definition: HGCalVFELinearizationImpl.h:24
HGCalVFELinearizationImpl::adcnBits_
uint32_t adcnBits_
Definition: HGCalVFELinearizationImpl.h:22
HGCalVFELinearizationImpl::linnBits_
uint32_t linnBits_
Definition: HGCalVFELinearizationImpl.h:27
HGCalVFELinearizationImpl::tdcnBits_
uint32_t tdcnBits_
Definition: HGCalVFELinearizationImpl.h:20
HGCalVFELinearizationImpl::oot_coefficients_
std::vector< double > oot_coefficients_
Definition: HGCalVFELinearizationImpl.h:28
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HGCalVFELinearizationImpl::adcsaturation_
double adcsaturation_
Definition: HGCalVFELinearizationImpl.h:19
HGCalVFELinearizationImpl::adcLSB_
double adcLSB_
Definition: HGCalVFELinearizationImpl.h:17
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
Exception
Definition: hltDiff.cc:246
HGCalVFELinearizationImpl::linMax_
uint32_t linMax_
Definition: HGCalVFELinearizationImpl.h:26
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HGCalVFELinearizationImpl::tdcOnset_
double tdcOnset_
Definition: HGCalVFELinearizationImpl.h:21