Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:32

0001 #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h"
0002 #include "SimCalorimetry/HcalSimAlgos/interface/HcalSiPMShape.h"
0003 #include "SimCalorimetry/HcalSimAlgos/interface/HcalShapes.h"
0004 #include <iostream>
0005 
0006 HcalSiPMShape::HcalSiPMShape(unsigned int signalShape)
0007     : CaloVShape(), nBins_(HcalPulseShapes::nBinsSiPM_ * HcalPulseShapes::invDeltaTSiPM_), nt_(nBins_, 0.) {
0008   computeShape(signalShape);
0009 }
0010 
0011 HcalSiPMShape::HcalSiPMShape(const HcalSiPMShape& other) : CaloVShape(other), nBins_(other.nBins_), nt_(other.nt_) {}
0012 
0013 void HcalSiPMShape::computeShape(unsigned int signalShape) {
0014   //grab correct function pointer based on shape
0015   double (*analyticPulseShape)(double);
0016   if (signalShape == HcalShapes::ZECOTEK || signalShape == HcalShapes::HAMAMATSU)
0017     analyticPulseShape = &HcalPulseShapes::analyticPulseShapeSiPMHO;
0018   else if (signalShape == HcalShapes::HE2017 or signalShape == HcalShapes::HE2018)
0019     analyticPulseShape = &HcalPulseShapes::analyticPulseShapeSiPMHE;
0020   else
0021     return;
0022 
0023   double norm = 0.;
0024   for (int j = 0; j < nBins_; ++j) {
0025     nt_[j] = analyticPulseShape(j * HcalPulseShapes::deltaTSiPM_);
0026     norm += (nt_[j] > 0) ? nt_[j] : 0.;
0027   }
0028 
0029   for (int j = 0; j < nBins_; ++j) {
0030     nt_[j] /= norm;
0031   }
0032 }