CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalQIEShape.cc
Go to the documentation of this file.
1 
10 
12 
14 
16  int scale = 1;
17  for (unsigned range = 1; range < 4; range++) {
18  int factor = nbins_ == 32 ? 5 : 8; // QIE8/QIE10 -> 5/8
19  scale *= factor;
20  unsigned index = range * nbins_;
21  unsigned overlap = (nbins_ == 32) ? 2 : 3; // QIE10 -> 3 bin overlap
22  mValues[index] = mValues[index - overlap]; // link to previous range
23  for (unsigned i = 1; i < nbins_; i++) {
24  mValues[index + i] = mValues[index + i - 1] + scale * (mValues[i] - mValues[i - 1]);
25  }
26  }
27  mValues[nbins_ * 4] = 2 * mValues[nbins_ * 4 - 1] - mValues[nbins_ * 4 - 2]; // extrapolate
28 }
29 
30 float HcalQIEShape::lowEdge(unsigned fAdc) const {
31  if (fAdc < 4 * nbins_)
32  return mValues[fAdc];
33  return 0.;
34 }
35 
36 float HcalQIEShape::center(unsigned fAdc) const {
37  if (fAdc < 4 * nbins_) {
38  if (fAdc % nbins_ == nbins_ - 1)
39  return 0.5 * (3 * mValues[fAdc] - mValues[fAdc - 1]); // extrapolate
40  else
41  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_)
48  return mValues[fAdc + 1];
49  return 0.;
50 }
51 
52 bool HcalQIEShape::setLowEdge(float fValue, unsigned fAdc) {
53  if (fAdc >= nbins_)
54  return false;
55  mValues[fAdc] = fValue;
56  return true;
57 }
58 
59 bool HcalQIEShape::setLowEdges(unsigned int nbins, const float *fValue) {
60  nbins_ = nbins;
61  mValues.clear();
62  mValues.resize(4 * nbins_ + 1);
63  bool result = true;
64  for (unsigned int adc = 0; adc < nbins_; adc++)
65  result = result && setLowEdge(fValue[adc], adc);
66  expand();
67  return result;
68 }
float lowEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:30
tuple result
Definition: mps_fire.py:311
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:52
float center(unsigned fAdc) const
Definition: HcalQIEShape.cc:36
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:59
float highEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:46
uint16_t *__restrict__ uint16_t const *__restrict__ adc
unsigned nbins() const
Definition: HcalQIEShape.h:33