test
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  unsigned overlap = (nbins_ == 32) ? 2 : 3; // QIE10 -> 3 bin overlap
25  mValues [index] = mValues [index - overlap]; // link to previous range
26  for (unsigned i = 1; i < nbins_; i++) {
27  mValues [index + i] = mValues [index + i - 1] + scale * (mValues [i] - mValues [i - 1]);
28  }
29  }
30  mValues [nbins_*4] = 2 * mValues [nbins_*4-1] - mValues [nbins_*4-2]; // extrapolate
31 }
32 
33 float HcalQIEShape::lowEdge (unsigned fAdc) const {
34  if (fAdc < 4*nbins_) return mValues [fAdc];
35  return 0.;
36 }
37 
38 float HcalQIEShape::center (unsigned fAdc) const {
39  if (fAdc < 4*nbins_) {
40  if (fAdc % nbins_ == nbins_-1) return 0.5 * (3 * mValues [fAdc] - mValues [fAdc - 1]); // extrapolate
41  else return 0.5 * (mValues [fAdc] + mValues [fAdc + 1]); // interpolate
42  }
43  return 0.;
44 }
45 
46 float HcalQIEShape::highEdge (unsigned fAdc) const {
47  if (fAdc < 4*nbins_) return mValues [fAdc+1];
48  return 0.;
49 }
50 
51 bool HcalQIEShape::setLowEdge (float fValue, unsigned fAdc) {
52  if (fAdc >= nbins_) return false;
53  mValues [fAdc] = fValue;
54  return true;
55 }
56 
57 bool HcalQIEShape::setLowEdges (unsigned int nbins, const float *fValue) {
58  nbins_=nbins;
59  mValues.clear();
60  mValues.resize(4*nbins_+1);
61  bool result = true;
62  for (unsigned int adc = 0; adc < nbins_; adc++) result = result && setLowEdge (fValue [adc], adc);
63  expand ();
64  return result;
65 }
66 
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:33
tuple result
Definition: mps_fire.py:84
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:51
float center(unsigned fAdc) const
Definition: HcalQIEShape.cc:38
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
bool setLowEdges(unsigned int nVals, const float *fValue)
Definition: HcalQIEShape.cc:57
float highEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:46
unsigned nbins() const
Definition: HcalQIEShape.h:33