CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/SimCalorimetry/CaloSimAlgos/src/CaloCachedShapeIntegrator.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/CaloSimAlgos/interface/CaloCachedShapeIntegrator.h"
00002 
00003 const int NBINS = 281; // 256, plus 25 before 
00004 
00005 CaloCachedShapeIntegrator::CaloCachedShapeIntegrator( const CaloVShape* aShape ) :
00006   v_(NBINS, 0.),
00007   timeToRise_(aShape->timeToRise())
00008 {
00009   for(int t = 0; t < 256; ++t) 
00010   {
00011     double amount = (*aShape)(t);
00012     for(int istep = 0; istep < 25; ++istep) 
00013     {
00014       int ibin = t + istep;
00015       v_[ibin] += amount;
00016     }
00017   }
00018 }
00019 
00020 CaloCachedShapeIntegrator::~CaloCachedShapeIntegrator() 
00021 {
00022 }
00023 
00024 double 
00025 CaloCachedShapeIntegrator::timeToRise() const 
00026 {
00027    return timeToRise_;
00028 }
00029 
00030 double 
00031 CaloCachedShapeIntegrator::operator() ( double startTime ) const 
00032 {
00033   // round up, and account for the -25 ns offset 
00034   int ibin = static_cast<int>(startTime+25.0);
00035   return (ibin<0 || ibin >= NBINS) ? 0. : v_[ibin];
00036 }
00037 
00038