Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "SimCalorimetry/CastorSim/interface/CastorShape.h"
0003 #include <cmath>
0004 
0005 CastorShape::CastorShape() : nbin_(256), nt_(nbin_, 0.) { computeShapeCastor(); }
0006 
0007 CastorShape::CastorShape(const CastorShape &d) : CaloVShape(d), nbin_(d.nbin_), nt_(d.nt_) {}
0008 
0009 void CastorShape::computeShapeCastor() {
0010   edm::LogVerbatim("CastorSim") << "\n ===== computeShapeCastor  !!! \n";
0011 
0012   const float ts = 3.0;  // time constant in   t * exp(-(t/ts)**2)
0013 
0014   int j;
0015   float norm;
0016 
0017   // HF SHAPE
0018   norm = 0.0;
0019   for (j = 0; j < 3 * ts && j < nbin_; j++) {
0020     // nt_[j] = ((float)j)*exp(-((float)(j*j))/(ts*ts));
0021     nt_[j] = j * exp(-(j * j) / (ts * ts));
0022     norm += nt_[j];
0023   }
0024   // normalize pulse area to 1.0
0025   for (j = 0; j < 3 * ts && j < nbin_; j++) {
0026     nt_[j] /= norm;
0027   }
0028 }
0029 
0030 double CastorShape::operator()(double time) const {
0031   // return pulse amplitude for request time in ns
0032   int jtime;
0033   jtime = static_cast<int>(time + 0.5);
0034 
0035   if (jtime >= 0 && jtime < nbin_)
0036     return nt_[jtime];
0037   else
0038     return 0.0;
0039 }
0040 
0041 double CastorShape::timeToRise() const { return 0.0; }