CMS 3D CMS Logo

HcalShape.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimAlgos/interface/HcalShape.h"
00002 #include <cmath>
00003   
00004 HcalShape::HcalShape()
00005 : nbin_(256),
00006   nt_(nbin_, 0.)
00007 {
00008    setTpeak(32.0);
00009    computeShape();
00010 }
00011 
00012 HcalShape::HcalShape(const HcalShape&d):
00013   CaloVShape(d),
00014   nbin_(d.nbin_),
00015   nt_(d.nt_)
00016 {
00017   setTpeak(32.0);
00018 }
00019 
00020 
00021 void HcalShape::computeShape()
00022 {
00023 
00024   // pulse shape time constant_s in ns
00025   const float ts1  = 8.;          // scintillation time constant_s : 1,2,3
00026   const float ts2  = 10.;           
00027   const float ts3  = 29.3;         
00028   const float thpd = 4.;          // HPD current_ collection drift time
00029   const float tpre = 9.;          // preamp time constant_ (refit on TB04 data)
00030   
00031   const float wd1 = 2.;           // relative weights of decay exponent_s 
00032   const float wd2 = 0.7;
00033   const float wd3 = 1.;
00034   
00035   // pulse shape componnt_s over a range of time 0 ns to 255 ns in 1 ns steps
00036   std::vector<float> nth(nbin_,0.0);   // zeroing HPD drift shape
00037   std::vector<float> ntp(nbin_,0.0);   // zeroing Binkley preamp shape
00038   std::vector<float> ntd(nbin_,0.0);   // zeroing Scintillator decay shape
00039 
00040   int i,j,k;
00041   float norm;
00042 
00043   // HPD starts at I and rises to 2I in thpd of time
00044   norm=0.0;
00045   for(j=0;j<thpd && j<nbin_;j++){
00046     nth[j] = 1.0 + j/thpd;
00047     norm += nth[j];
00048   }
00049   // normalize integrated current_ to 1.0
00050   for(j=0;j<thpd && j<nbin_;j++){
00051     nth[j] /= norm;
00052   }
00053   
00054   // Binkley shape over 6 time constant_s
00055   norm=0.0;
00056   for(j=0;j<6*tpre && j<nbin_;j++){
00057     ntp[j] = j*exp(-(j*j)/(tpre*tpre));
00058     norm += ntp[j];
00059   }
00060   // normalize pulse area to 1.0
00061   for(j=0;j<6*tpre && j<nbin_;j++){
00062     ntp[j] /= norm;
00063   }
00064 
00065 // ignore stochastic variation of photoelectron emission
00066 // <...>
00067 
00068 // effective tile plus wave-length shifter decay time over 4 time constant_s
00069   int tmax = 6 * static_cast<int>(ts3);
00070  
00071   norm=0.0;
00072   for(j=0;j<tmax && j<nbin_;j++){
00073     ntd[j] = wd1 * exp(-j/ts1) + 
00074       wd2 * exp(-j/ts2) + 
00075       wd3 * exp(-j/ts3) ; 
00076     norm += ntd[j];
00077   }
00078   // normalize pulse area to 1.0
00079   for(j=0;j<tmax && j<nbin_;j++){
00080     ntd[j] /= norm;
00081   }
00082   
00083   int t1,t2,t3,t4;
00084   for(i=0;i<tmax && i<nbin_;i++){
00085     t1 = i;
00086     //    t2 = t1 + top*rand;
00087     // ignoring jitter from optical path length
00088     t2 = t1;
00089     for(j=0;j<thpd && j<nbin_;j++){
00090       t3 = t2 + j;
00091       for(k=0;k<4*tpre && k<nbin_;k++){       // here "4" is set deliberately,
00092  t4 = t3 + k;                         // as in test fortran toy MC ...
00093  if(t4<nbin_){                         
00094    int ntb=t4;                        
00095    nt_[ntb] += ntd[i]*nth[j]*ntp[k];
00096         }
00097       }
00098     }
00099   }
00100   
00101   // normalize for 1 GeV pulse height
00102   norm = 0.;
00103   for(i=0;i<nbin_;i++){
00104     norm += nt_[i];
00105   }
00106 
00107   //cout << " Convoluted SHAPE ==============  " << endl;
00108   for(i=0; i<nbin_; i++){
00109     nt_[i] /= norm;
00110     //  cout << " shape " << i << " = " << nt_[i] << endl;   
00111   }
00112 
00113 }
00114 
00115 double HcalShape::operator () (double time_) const
00116 {
00117 
00118   // return pulse amplitude for request time in ns
00119   int jtime = static_cast<int>(time_+0.5);
00120   if(jtime>=0 && jtime<nbin_){
00121     return nt_[jtime];
00122   } else {
00123     return 0.0;
00124   }
00125 
00126 }
00127 
00128 double HcalShape::derivative (double time_) const
00129 {
00130   return 0.0;
00131 }
00132 
00133 

Generated on Tue Jun 9 17:46:22 2009 for CMSSW by  doxygen 1.5.4