CMS 3D CMS Logo

HcalPulseShape.cc
Go to the documentation of this file.
2 
4 
5 HcalPulseShape::HcalPulseShape(const std::vector<double>& shape, unsigned nbin)
6  : shape_(shape.begin(), shape.begin() + nbin), nbin_(nbin) {}
7 
9  nbin_ = n;
10  shape_ = std::vector<float>(n, 0.0f);
11 }
12 
13 void HcalPulseShape::setShapeBin(int i, float f) {
14  if (i >= 0 && i < nbin_)
15  shape_[i] = f;
16 }
17 
18 float HcalPulseShape::operator()(double t) const {
19  // shape is in 1 ns steps
20  return at(t);
21 }
22 
23 float HcalPulseShape::at(double t) const {
24  // shape is in 1 ns steps
25  int i = (int)(t + 0.5);
26  float rv = 0;
27  if (i >= 0 && i < nbin_)
28  rv = shape_[i];
29  return rv;
30 }
31 
32 float HcalPulseShape::integrate(double t1, double t2) const {
33  static const float int_delta_ns = 0.05f;
34  double intval = 0.0;
35 
36  for (double t = t1; t < t2; t += int_delta_ns) {
37  float loedge = at(t);
38  float hiedge = at(t + int_delta_ns);
39  intval += (loedge + hiedge) * int_delta_ns / 2.0;
40  }
41  return (float)intval;
42 }
HcalPulseShape::setNBin
void setNBin(int n)
Definition: HcalPulseShape.cc:8
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HcalPulseShape::integrate
float integrate(double tmin, double tmax) const
Definition: HcalPulseShape.cc:32
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HcalPulseShape::nbin_
int nbin_
Definition: HcalPulseShape.h:20
HcalPulseShape::HcalPulseShape
HcalPulseShape()
Definition: HcalPulseShape.cc:3
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
HcalPulseShape::shape_
std::vector< float > shape_
Definition: HcalPulseShape.h:19
HcalPulseShape.h
createfilelist.int
int
Definition: createfilelist.py:10
ZMuMuCategoriesSequences_cff.nbin
nbin
Definition: ZMuMuCategoriesSequences_cff.py:25
HcalPulseShape::operator()
float operator()(double time) const
Definition: HcalPulseShape.cc:18
HcalPulseShape::at
float at(double time) const
Definition: HcalPulseShape.cc:23
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
HcalPulseShape::setShapeBin
void setShapeBin(int i, float f)
Definition: HcalPulseShape.cc:13