00001 #include "SimCalorimetry/CastorSim/src/CastorShape.h" 00002 #include <cmath> 00003 00004 CastorShape::CastorShape() 00005 : nbin_(256), 00006 nt_(nbin_, 0.) 00007 { 00008 computeShapeCastor(); 00009 } 00010 00011 00012 CastorShape::CastorShape(const CastorShape&d) 00013 : CaloVShape(d), 00014 nbin_(d.nbin_), 00015 nt_(d.nt_) 00016 { 00017 } 00018 00019 00020 void CastorShape::computeShapeCastor() 00021 { 00022 00023 // cout << endl << " ===== computeShapeCastor !!! " << endl << endl; 00024 00025 const float ts = 3.0; // time constant in t * exp(-(t/ts)**2) 00026 00027 00028 int j; 00029 float norm; 00030 00031 // HF SHAPE 00032 norm = 0.0; 00033 for( j = 0; j < 3 * ts && j < nbin_; j++){ 00034 //nt_[j] = ((float)j)*exp(-((float)(j*j))/(ts*ts)); 00035 nt_[j] = j * exp(-(j*j)/(ts*ts)); 00036 norm += nt_[j]; 00037 } 00038 // normalize pulse area to 1.0 00039 for( j = 0; j < 3 * ts && j < nbin_; j++){ 00040 nt_[j] /= norm; 00041 } 00042 } 00043 00044 double CastorShape::operator () (double time) const 00045 { 00046 00047 // return pulse amplitude for request time in ns 00048 int jtime; 00049 jtime = static_cast<int>(time+0.5); 00050 00051 if(jtime >= 0 && jtime < nbin_) 00052 return nt_[jtime]; 00053 else 00054 return 0.0; 00055 } 00056 00057 double 00058 CastorShape::timeToRise() const 00059 { 00060 return 0.0 ; 00061 }