CMS 3D CMS Logo

HcalCalibrationQIECoder.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 
11 
12 float HcalCalibrationQIECoder::charge(unsigned fAdc) const {
13  const float* data = base();
14  if (fAdc >= 31)
15  return (3 * data[31] - data[30]) / 2.; // extrapolation
16  return (data[fAdc] + data[fAdc + 1]) / 2;
17 }
18 
19 unsigned HcalCalibrationQIECoder::adc(float fCharge) const {
20  const float* data = base();
21  unsigned adc = 1;
22  for (; adc < 32; adc++) {
23  if (fCharge < data[adc])
24  return adc - 1;
25  }
26  return 31; // overflow
27 }
28 
29 float HcalCalibrationQIECoder::minCharge(unsigned fBin) const {
30  const float* data = base();
31  return fBin < 32 ? data[fBin] : data[31];
32 }
33 
35  const float* data = base();
36  return data;
37 }
38 
39 void HcalCalibrationQIECoder::setMinCharge(unsigned fBin, float fValue) {
40  float* data = base();
41  if (fBin < 32)
42  data[fBin] = fValue;
43 }
44 
45 void HcalCalibrationQIECoder::setMinCharges(const float fValue[32]) {
46  float* data = base();
47  for (int i = 0; i < 32; i++)
48  data[i] = fValue[i];
49 }
mps_fire.i
i
Definition: mps_fire.py:355
HcalCalibrationQIECoder::minCharges
const float * minCharges() const
Definition: HcalCalibrationQIECoder.cc:34
HcalCalibrationQIECoder.h
HcalCalibrationQIECoder::minCharge
float minCharge(unsigned fBin) const
Definition: HcalCalibrationQIECoder.cc:29
HcalCalibrationQIECoder::base
const float * base() const
Definition: HcalCalibrationQIECoder.h:67
HcalCalibrationQIECoder::setMinCharge
void setMinCharge(unsigned fBin, float fValue)
Definition: HcalCalibrationQIECoder.cc:39
HcalCalibrationQIECoder::charge
float charge(const unsigned fAdc) const
ADC [0..31] -> fC conversion.
Definition: HcalCalibrationQIECoder.cc:12
HcalCalibrationQIECoder::setMinCharges
void setMinCharges(const float fValue[32])
Definition: HcalCalibrationQIECoder.cc:45
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HcalCalibrationQIECoder::adc
unsigned adc(const float fCharge) const
fC -> ADC conversion
Definition: HcalCalibrationQIECoder.cc:19