CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SimCalorimetry/HcalSimAlgos/src/ZDCShape.cc

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