test
CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalSiPMShape.cc
Go to the documentation of this file.
1 
4 #include "TMath.h"
5 #include <iostream>
6 
7 HcalSiPMShape::HcalSiPMShape(unsigned int signalShape) : CaloVShape(), nBins_(250*2),
8  nt_(nBins_, 0.) {
9  computeShape(signalShape);
10 }
11 
13  CaloVShape(other), nBins_(other.nBins_), nt_(other.nt_) {
14 }
15 
16 double HcalSiPMShape::operator () (double time) const {
17  int jtime = static_cast<int>(time*2 + 0.5);
18  if (jtime>=0 && jtime<nBins_)
19  return nt_[jtime];
20  return 0.;
21 }
22 
23 void HcalSiPMShape::computeShape(unsigned int signalShape) {
24 
25  double norm = 0.;
26  for (int j = 0; j < nBins_; ++j) {
27  nt_[j] = analyticPulseShape(j/2.,signalShape);
28  norm += (nt_[j]>0) ? nt_[j] : 0.;
29  }
30 
31  // std::cout << "SiPM pulse shape: ";
32  for (int j = 0; j < nBins_; ++j) {
33  nt_[j] /= norm;
34  // std::cout << nt_[j] << ' ';
35  }
36  // std::cout << std::endl;
37 }
38 
39 inline double gexp(double t, double A, double c, double t0, double s) {
40  static double const root2(sqrt(2));
41  return -A*0.5*exp(c*t+0.5*c*c*s*s-c*s)*(erf(-0.5*root2/s*(t-t0+c*s*s))-1);
42 }
43 
44 inline double onePulse(double t, double A, double sigma, double theta, double m) {
45  return (t<theta) ? 0 : A*TMath::LogNormal(t,sigma,theta,m);
46 }
47 
48 double HcalSiPMShape::analyticPulseShape(double t, unsigned int signalShape) const {
49  if(signalShape==HcalShapes::ZECOTEK || signalShape==HcalShapes::HAMAMATSU){
50  // HO SiPM pulse shape fit from Jake Anderson ca. 2013
51  double A1(0.08757), c1(-0.5257), t01(2.4013), s1(0.6721);
52  double A2(0.007598), c2(-0.1501), t02(6.9412), s2(0.8710);
53  return gexp(t,A1,c1,t01,s1) + gexp(t,A2,c2,t02,s2);
54  }
55  else if(signalShape==HcalShapes::HE2017){
56  // taken from fit to laser measurement taken by Iouri M. in Spring 2016.
57  double A1(5.204/6.94419), sigma1_shape(0.5387), theta1_loc(-0.3976), m1_scale(4.428);
58  double A2(1.855/6.94419), sigma2_shape(0.8132), theta2_loc(7.025), m2_scale(12.29);
59  return
60  onePulse(t,A1,sigma1_shape,theta1_loc,m1_scale) +
61  onePulse(t,A2,sigma2_shape,theta2_loc,m2_scale);
62  }
63  else return 0.;
64 }
HcalSiPMShape(unsigned int signalShape=203)
Definition: HcalSiPMShape.cc:7
virtual double operator()(double time) const
virtual double analyticPulseShape(double t, unsigned int signalShape) const
Geom::Theta< T > theta() const
Electronic response of the preamp.
Definition: CaloVShape.h:11
tuple s2
Definition: indexGen.py:106
std::vector< double > nt_
Definition: HcalSiPMShape.h:27
T sqrt(T t)
Definition: SSEVec.h:18
int j
Definition: DBlmapReader.cc:9
double gexp(double t, double A, double c, double t0, double s)
void computeShape(unsigned int signalShape)
double onePulse(double t, double A, double sigma, double theta, double m)