CMS 3D CMS Logo

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 }
HcalQIEShape.h
mps_fire.i
i
Definition: mps_fire.py:428
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
HcalQIEShape::setLowEdge
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:52
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
HcalQIEShape::HcalQIEShape
HcalQIEShape()
Definition: HcalQIEShape.cc:11
HcalQIEShape::mValues
std::vector< float > mValues
Definition: HcalQIEShape.h:39
HcalQIEShape::~HcalQIEShape
~HcalQIEShape()
Definition: HcalQIEShape.cc:13
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
HcalQIEShape::nbins_
unsigned int nbins_
Definition: HcalQIEShape.h:40
HcalQIEShape::setLowEdges
bool setLowEdges(unsigned int nVals, const float *fValue)
Definition: HcalQIEShape.cc:59
HcalQIEShape::highEdge
float highEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:46
HcalQIEShape::expand
void expand()
Definition: HcalQIEShape.cc:15
HcalQIEShape::center
float center(unsigned fAdc) const
Definition: HcalQIEShape.cc:36
HcalQIEShape::nbins
unsigned nbins() const
Definition: HcalQIEShape.h:33
goodZToMuMu_cfi.overlap
overlap
Definition: goodZToMuMu_cfi.py:108
HcalQIEShape::lowEdge
float lowEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:30
HcalQIEShape::range
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311