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 
12  :nbins_(0)
13 {
14 }
15 
17 
19  int scale = 1;
20  for (unsigned range = 1; range < 4; range++) {
21  int factor = nbins_ == 32 ? 5 : 8; // QIE8/QIE10 -> 5/8
22  scale *= factor;
23  unsigned index = range * nbins_;
24  mValues [index] = mValues [index - 2]; // link to previous range
25  for (unsigned i = 1; i < nbins_; i++) {
26  mValues [index + i] = mValues [index + i - 1] + scale * (mValues [i] - mValues [i - 1]);
27  }
28  }
29  mValues [nbins_*4] = 2 * mValues [nbins_*4-1] - mValues [nbins_*4-2]; // extrapolate
30 }
31 
32 float HcalQIEShape::lowEdge (unsigned fAdc) const {
33  if (fAdc < 4*nbins_) return mValues [fAdc];
34  return 0.;
35 }
36 
37 float HcalQIEShape::center (unsigned fAdc) const {
38  if (fAdc < 4*nbins_) {
39  if (fAdc % nbins_ == nbins_-1) return 0.5 * (3 * mValues [fAdc] - mValues [fAdc - 1]); // extrapolate
40  else return 0.5 * (mValues [fAdc] + mValues [fAdc + 1]); // interpolate
41  }
42  return 0.;
43 }
44 
45 float HcalQIEShape::highEdge (unsigned fAdc) const {
46  if (fAdc < 4*nbins_) return mValues [fAdc+1];
47  return 0.;
48 }
49 
50 bool HcalQIEShape::setLowEdge (float fValue, unsigned fAdc) {
51  if (fAdc >= nbins_) return false;
52  mValues [fAdc] = fValue;
53  return true;
54 }
55 
56 bool HcalQIEShape::setLowEdges (unsigned int nbins, const float *fValue) {
57  nbins_=nbins;
58  mValues.clear();
59  mValues.resize(4*nbins_+1);
60  bool result = true;
61  for (unsigned int adc = 0; adc < nbins_; adc++) result = result && setLowEdge (fValue [adc], adc);
62  expand ();
63  return result;
64 }
65 
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
float lowEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:32
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:50
tuple result
Definition: query.py:137
float center(unsigned fAdc) const
Definition: HcalQIEShape.cc:37
unsigned int nbins_
Definition: HcalQIEShape.h:37
std::vector< float > mValues
Definition: HcalQIEShape.h:36
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
bool setLowEdges(unsigned int nVals, const float *fValue)
Definition: HcalQIEShape.cc:56
float highEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:45
unsigned nbins() const
Definition: HcalQIEShape.h:30