CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/SimCalorimetry/HcalSimAlgos/src/HFShape.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimAlgos/interface/HFShape.h"
00002 #include <cmath>
00003   
00004 HFShape::HFShape()
00005 : nbin_(256),
00006   nt_(nbin_, 0.)
00007 {   
00008   computeShapeHF();
00009 }
00010 
00011 
00012 HFShape::HFShape(const HFShape&d)
00013 : CaloVShape(d),
00014   nbin_(d.nbin_),
00015   nt_(d.nt_)
00016 {
00017 }
00018 
00019 double
00020 HFShape::timeToRise() const 
00021 {
00022    return 0. ;
00023 }
00024   
00025 void HFShape::computeShapeHF()
00026 {
00027 
00028   //  cout << endl << " ===== computeShapeHF  !!! " << endl << endl;
00029 
00030   const float k0=0.7956; // shape parameters
00031   const float p2=1.355;
00032   const float p4=2.327;
00033   const float p1=4.3;    // position parameter
00034 
00035   int j;
00036   float norm,r0,sigma0;
00037 
00038   // HF SHAPE
00039   norm = 0.0;
00040   for( j = 0; j < 25 && j < nbin_; j++){
00041 
00042     r0 = j-p1;
00043     if (r0<0) sigma0 = p2;
00044     else sigma0 =  p2*p4;
00045     r0 = r0/sigma0;
00046     if(r0 < k0) nt_[j] = exp(-0.5*r0*r0);
00047     else nt_[j] = exp(0.5*k0*k0-k0*r0);
00048     norm += nt_[j];
00049   }
00050   // normalize pulse area to 1.0
00051   for( j = 0; j < 25 && j < nbin_; j++){
00052     nt_[j] /= norm;
00053   }
00054 }
00055 
00056 double HFShape::operator () (double time) const
00057 {
00058 
00059   // return pulse amplitude for request time in ns
00060   int jtime;
00061   jtime = static_cast<int>(time+0.5);
00062 
00063   if(jtime >= 0 && jtime < nbin_)
00064     return nt_[jtime];
00065   else 
00066     return 0.0;
00067 }
00068