Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:21

0001 #include "SimCalorimetry/CaloSimAlgos/interface/CaloCachedShapeIntegrator.h"
0002 
0003 const int NBINS = 281;  // 256, plus 25 before
0004 
0005 CaloCachedShapeIntegrator::CaloCachedShapeIntegrator(const CaloVShape *aShape)
0006     : v_(NBINS, 0.), timeToRise_(aShape->timeToRise()) {
0007   for (int t = 0; t < 256; ++t) {
0008     double amount = (*aShape)(t);
0009     for (int istep = 0; istep < 25; ++istep) {
0010       int ibin = t + istep;
0011       v_[ibin] += amount;
0012     }
0013   }
0014 }
0015 
0016 CaloCachedShapeIntegrator::~CaloCachedShapeIntegrator() {}
0017 
0018 double CaloCachedShapeIntegrator::timeToRise() const { return timeToRise_; }
0019 
0020 double CaloCachedShapeIntegrator::operator()(double startTime) const {
0021   // round up, and account for the -25 ns offset
0022   int ibin = static_cast<int>(startTime + 25.0);
0023   return (ibin < 0 || ibin >= NBINS) ? 0. : v_[ibin];
0024 }