CMS 3D CMS Logo

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