CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) return (3*data[31]-data[30])/2.; // extrapolation
16  return (data[fAdc]+data[fAdc+1])/2;
17 }
18 
19 unsigned CastorCalibrationQIECoder::adc (float fCharge) const {
20  const float* data = base ();
21  unsigned adc = 1;
22  for (; adc < 32; adc++) {
23  if (fCharge < data[adc]) return adc-1;
24  }
25  return 31; // overflow
26 }
27 
28 float CastorCalibrationQIECoder::minCharge (unsigned fBin) const {
29  const float* data = base ();
30  return fBin < 32 ? data[fBin] : data[31];
31 }
32 
34  const float* data = base ();
35  return data;
36 }
37 
38 
39 void CastorCalibrationQIECoder::setMinCharge (unsigned fBin, float fValue) {
40  float* data = base ();
41  if (fBin < 32) data [fBin] = fValue;
42 }
43 
45  float* data = base ();
46  for (int i = 0; i < 32; i++) data[i] = fValue[i];
47 }
int i
Definition: DBlmapReader.cc:9
void setMinCharges(const float fValue[32])
void setMinCharge(unsigned fBin, float fValue)
float minCharge(unsigned fBin) const
unsigned adc(const float fCharge) const
fC -&gt; ADC conversion
float charge(const unsigned fAdc) const
ADC [0..31] -&gt; fC conversion.