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 
3 
4 #include <cmath>
5 #include <iostream>
6 
7 HcalSiPMShape::HcalSiPMShape() : CaloVShape(), nBins_(35*2+1),
8  nt_(nBins_, 0.) {
9  computeShape();
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 
24 
25  double norm = 0.;
26  for (int j = 0; j < nBins_; ++j) {
27  nt_[j] = analyticPulseShape(j/2.);
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 double HcalSiPMShape::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 double HcalSiPMShape::gexpIndefIntegral(double t, double A, double c,
45  double t0, double s) {
46  static double const root2(sqrt(2));
47 
48  return (exp(-c*t0)*(exp(c*t0)*erf((root2*t0-root2*t)/(2*s))-exp(c*t+(c*c*s*2)/2)*erf((t0-t-c*s*s)/(root2*s))+exp(c*t+(c*c*s*s)/2))*A)/(2*c);
49 }
50 
51 double HcalSiPMShape::gexpIntegral0Inf(double A, double c, double t0,
52  double s) {
53  static double const root2(sqrt(2));
54  return (exp(-c*t0)*(exp((c*c*s*s)/2)*erf((root2*t0-root2*c*s*s)/(2*s))-exp(c*t0)*erf(t0/(root2*s))-exp(c*t0)-exp((c*c*s*s)/2))*A)/(2*c);
55 }
56 
57 double HcalSiPMShape::analyticPulseShape(double t) const {
58  double A1(0.08757), c1(-0.5257), t01(2.4013), s1(0.6721);
59  double A2(0.007598), c2(-0.1501), t02(6.9412), s2(0.8710);
60  return gexp(t,A1,c1,t01,s1) + gexp(t,A2,c2,t02,s2);
61 }
virtual double operator()(double time) const
virtual double analyticPulseShape(double t) const
Electronic response of the preamp.
Definition: CaloVShape.h:11
static double gexp(double t, double A, double c, double t0, double s)
tuple s2
Definition: indexGen.py:106
tuple c2
Definition: counter.py:145
std::vector< double > nt_
Definition: HcalSiPMShape.h:32
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
static double gexpIndefIntegral(double t, double A, double c, double t0, double s)
void computeShape()
static double gexpIntegral0Inf(double A, double c, double t0, double s)