CMS 3D CMS Logo

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

#include <HcalShapeIntegrator.h>

Public Member Functions

 HcalShapeIntegrator (const HcalPulseShapes::Shape *aShape)
 
float operator() (double startTime, double stopTime) const
 

Private Member Functions

float at (double time) const
 

Private Attributes

int nbin_
 
std::vector< float > v_
 

Detailed Description

This class takes an existing Shape, and integrates it, summing up all the values, each nanosecond

Definition at line 12 of file HcalShapeIntegrator.h.

Constructor & Destructor Documentation

◆ HcalShapeIntegrator()

HcalShapeIntegrator::HcalShapeIntegrator ( const HcalPulseShapes::Shape aShape)

Definition at line 4 of file HcalShapeIntegrator.cc.

References nbin_, l1trig_cff::shape, submitPVValidationJobs::t, and v_.

4  : nbin_(shape->nbins()), v_(nbin_, 0.) {
5  for (int t = 0; t < nbin_; ++t) {
6  double amount = shape->at(t);
7  for (int ibin = t; ibin < nbin_; ++ibin) {
8  // v_ holds the cumulative integral
9  v_[ibin] += amount;
10  }
11  }
12 }
std::vector< float > v_

Member Function Documentation

◆ at()

float HcalShapeIntegrator::at ( double  time) const
private

Definition at line 14 of file HcalShapeIntegrator.cc.

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

Referenced by operator()().

14  {
15  // shape is in 1 ns steps
16  // I round down to match the old algorithm
17  int i = (int)(t - 0.5);
18  float rv = 0;
19  if (i < 0) {
20  rv = 0.;
21  } else if (i >= nbin_) {
22  rv = v_.back();
23  } else {
24  rv = v_[i];
25  // maybe interpolate
26  // assume 1 ns bins
27  float f = (t - 0.5 - i);
28  if (++i < nbin_ && f > 0) {
29  rv = rv * (1. - f) + v_[i] * f;
30  }
31  }
32  return rv;
33 }
double f[11][100]
std::vector< float > v_

◆ operator()()

float HcalShapeIntegrator::operator() ( double  startTime,
double  stopTime 
) const

Definition at line 35 of file HcalShapeIntegrator.cc.

References at(), and beamSpotPI::startTime.

35 { return at(stopTime) - at(startTime); }
float at(double time) const

Member Data Documentation

◆ nbin_

int HcalShapeIntegrator::nbin_
private

Definition at line 20 of file HcalShapeIntegrator.h.

Referenced by at(), and HcalShapeIntegrator().

◆ v_

std::vector<float> HcalShapeIntegrator::v_
private

Definition at line 21 of file HcalShapeIntegrator.h.

Referenced by at(), and HcalShapeIntegrator().