CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalQIEShape.cc
Go to the documentation of this file.
1 
10 
11 namespace {
12  const float binMin [32] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8,
13  9, 10, 11, 12, 13, 14, 16, 18, 20, 22,
14  24, 26, 28, 31, 34, 37, 40, 44, 48, 52,
15  57, 62};
16 }
17 
19 {
20  for (int i = 0; i < 32; i++) mValues [i] = binMin [i];
21  expand ();
22 }
23 
25 
27  int scale = 1;
28  for (unsigned range = 1; range < 4; range++) {
29  scale = scale * 5;
30  unsigned index = range * 32;
31  mValues [index] = mValues [index - 2]; // link to previous range
32  for (unsigned i = 1; i < 32; i++) {
33  mValues [index + i] = mValues [index + i - 1] + scale * (mValues [i] - mValues [i - 1]);
34  }
35  }
36  mValues [128] = 2 * mValues [127] - mValues [126]; // extrapolate
37 }
38 
39 float HcalQIEShape::lowEdge (unsigned fAdc) const {
40  if (fAdc < 128) return mValues [fAdc];
41  return 0.;
42 }
43 
44 float HcalQIEShape::center (unsigned fAdc) const {
45  if (fAdc < 128) {
46  if (fAdc % 32 == 31) return 0.5 * (3 * mValues [fAdc] - mValues [fAdc - 1]); // extrapolate
47  else return 0.5 * (mValues [fAdc] + mValues [fAdc + 1]); // interpolate
48  }
49  return 0.;
50 }
51 
52 float HcalQIEShape::highEdge (unsigned fAdc) const {
53  if (fAdc < 128) return mValues [fAdc+1];
54  return 0.;
55 }
56 
57 bool HcalQIEShape::setLowEdge (float fValue, unsigned fAdc) {
58  if (fAdc >= 32) return false;
59  mValues [fAdc] = fValue;
60  return true;
61 }
62 
63 bool HcalQIEShape::setLowEdges (const float fValue [32]) {
64  bool result = true;
65  for (int adc = 0; adc < 32; adc++) result = result && setLowEdge (fValue [adc], adc);
66  expand ();
67  return result;
68 }
69 
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
float mValues[129]
Definition: HcalQIEShape.h:31
float lowEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:39
bool setLowEdges(const float fValue[32])
Definition: HcalQIEShape.cc:63
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:57
tuple result
Definition: query.py:137
float center(unsigned fAdc) const
Definition: HcalQIEShape.cc:44
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
float highEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:52