CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
float minCharge(unsigned fBin) const
float charge(const unsigned fAdc) const
ADC [0..31] -&gt; fC conversion.
unsigned adc(const float fCharge) const
fC -&gt; ADC conversion
void setMinCharges(const float fValue[32])
const float * base() const
void setMinCharge(unsigned fBin, float fValue)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const float * minCharges() const