CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalPulseShape Class Reference

#include <HcalPulseShape.h>

Public Member Functions

float at (double time) const
 
std::vector< float > const & data () const
 
 HcalPulseShape ()
 
 HcalPulseShape (const std::vector< double > &, unsigned)
 
float integrate (double tmin, double tmax) const
 
int nbins () const
 
float operator() (double time) const
 
void setNBin (int n)
 
void setShapeBin (int i, float f)
 

Private Attributes

int nbin_
 
std::vector< float > shape_
 

Detailed Description

Definition at line 6 of file HcalPulseShape.h.

Constructor & Destructor Documentation

◆ HcalPulseShape() [1/2]

HcalPulseShape::HcalPulseShape ( )

Definition at line 3 of file HcalPulseShape.cc.

References nbin_.

3 { nbin_ = 0; }

◆ HcalPulseShape() [2/2]

HcalPulseShape::HcalPulseShape ( const std::vector< double > &  shape,
unsigned  nbin 
)

Definition at line 5 of file HcalPulseShape.cc.

6  : shape_(shape.begin(), shape.begin() + nbin), nbin_(nbin) {}
std::vector< float > shape_

Member Function Documentation

◆ at()

float HcalPulseShape::at ( double  time) const

Definition at line 23 of file HcalPulseShape.cc.

References mps_fire::i, createfilelist::int, nbin_, shape_, and submitPVValidationJobs::t.

Referenced by HBHEPulseShapeFlagSetter::Initialize(), integrate(), operator()(), HFShape::operator()(), and HcalShape::operator()().

23  {
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 }
std::vector< float > shape_

◆ data()

std::vector<float> const& HcalPulseShape::data ( ) const
inline

◆ integrate()

float HcalPulseShape::integrate ( double  tmin,
double  tmax 
) const

Definition at line 32 of file HcalPulseShape.cc.

References at(), submitPVValidationJobs::t, RandomServiceHelper::t1, and RandomServiceHelper::t2.

32  {
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 }
float at(double time) const

◆ nbins()

int HcalPulseShape::nbins ( ) const
inline

Definition at line 15 of file HcalPulseShape.h.

References nbin_.

15 { return nbin_; }

◆ operator()()

float HcalPulseShape::operator() ( double  time) const

Definition at line 18 of file HcalPulseShape.cc.

References at(), and submitPVValidationJobs::t.

18  {
19  // shape is in 1 ns steps
20  return at(t);
21 }
float at(double time) const

◆ setNBin()

void HcalPulseShape::setNBin ( int  n)

◆ setShapeBin()

void HcalPulseShape::setShapeBin ( int  i,
float  f 
)

Member Data Documentation

◆ nbin_

int HcalPulseShape::nbin_
private

Definition at line 20 of file HcalPulseShape.h.

Referenced by at(), HcalPulseShape(), nbins(), setNBin(), and setShapeBin().

◆ shape_

std::vector<float> HcalPulseShape::shape_
private

Definition at line 19 of file HcalPulseShape.h.

Referenced by at(), data(), setNBin(), and setShapeBin().