CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimCalorimetry/HcalSimAlgos/src/HcalSiPMShape.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimAlgos/interface/HcalSiPMShape.h"
00002 
00003 #include <cmath>
00004 
00005 HcalSiPMShape::HcalSiPMShape() : CaloVShape(), nBins_(512), nt_(nBins_, 0.) {
00006   computeShape();
00007 }
00008 
00009 HcalSiPMShape::HcalSiPMShape(const HcalSiPMShape & other) :
00010   CaloVShape(other), nBins_(other.nBins_), nt_(other.nt_) {
00011 }
00012 
00013 double HcalSiPMShape::operator () (double time) const {
00014   int jtime = static_cast<int>(time + 0.5);
00015   if (jtime>=0 && jtime<nBins_) 
00016     return nt_[jtime];
00017   return 0.;
00018 }
00019 
00020 void HcalSiPMShape::computeShape() {
00021 
00022   double norm = 0.;
00023   for (int j = 0; j < nBins_; ++j) {
00024     if (j <= 31.)
00025       nt_[j] = 2.15*j;
00026     else if ((j > 31) && (j <= 96))
00027       nt_[j] = 102.1 - 1.12*j;
00028     else 
00029       nt_[j] = 0.0076*j - 6.4;
00030     norm += (nt_[j]>0) ? nt_[j] : 0.;
00031   }
00032 
00033   for (int j = 0; j < nBins_; ++j) {
00034     nt_[j] /= norm;
00035   }
00036 }