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 }
float minCharge(unsigned fBin) const
unsigned adc(const float fCharge) const
fC -> ADC conversion
void setMinCharges(const float fValue[32])
void setMinCharge(unsigned fBin, float fValue)
float charge(const unsigned fAdc) const
ADC [0..31] -> fC conversion.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79