test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalPulseShape.cc
Go to the documentation of this file.
2 
4  nbin_=0;
5  tpeak_=0;
6 }
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_) shape_[i]=f;
15 }
16 
17 float HcalPulseShape::operator()(double t) const {
18  // shape is in 1 ns steps
19  return at(t);
20 }
21 
22 float HcalPulseShape::at(double t) const {
23  // shape is in 1 ns steps
24  int i=(int)(t+0.5);
25  float rv=0;
26  if (i>=0 && i<nbin_) rv=shape_[i];
27  return rv;
28 }
29 
30 float HcalPulseShape::integrate(double t1, double t2) const {
31  static const float int_delta_ns = 0.05f;
32  double intval = 0.0;
33 
34  for (double t = t1; t < t2; t+= int_delta_ns) {
35  float loedge = at(t);
36  float hiedge = at(t+int_delta_ns);
37  intval += (loedge+hiedge)*int_delta_ns/2.0;
38  }
39  return (float)intval;
40 }
41 
int i
Definition: DBlmapReader.cc:9
void setNBin(int n)
void setShapeBin(int i, float f)
float at(double time) const
float integrate(double tmin, double tmax) const
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
std::vector< float > shape_
double f[11][100]
float operator()(double time) const