CMS 3D CMS Logo

SiStripPulseShape.cc
Go to the documentation of this file.
2 #include <TF1.h>
3 #include <TMath.h>
4 
5 /* New Pulse Shape Fit by G. Auzinger June 2017
6 following methods are used to describe a pulse shape for a 3 stage CR-CR-RC pre-amplifier (CR)
7 + shaper (CR + RC) with time constants x, y, z respectively
8 some special cases (x=0. y=z, x=0 && y=z) are considered (divergence of equation) and
9 the shaper CR y is approximated via a pol(6) of x which gives a resonable respresentation and
10 reduces the number of free parameters -- this shape is derived from first principle and can
11 be used to fit peak mode signals and deconvolution mode signals
12 following parameters are added in addition to the time constants x, z:
13 a_0 ... baseline offset amplitude
14 s ... scale parameter
15 t_0 ... turn_on time of the pulse
16 par[5] ... scale parameter for the time slices in deco mode
17 */
18 
19 
20 double pulse_raw(double x, double y, double z, double t){
21 
22  double result1, result2, result3;
23 
24  result1 = z * y * exp(-t / y);
25  result1/= pow(y,2) - (x + z) * y + z * x;
26 
27  result2 = z * x * exp(-t / x);
28  result2/= pow(x,2) - (x - z) * y - z * x;
29 
30  result3 = pow(z,2) * exp(-t / z);
31  result3/= pow(z,2) + (x - z) * y - z * x;
32 
33  return result1 + result2 + result3;
34 }
35 
36 double pulse_x0(double y, double z, double t){
37  return z / (y - z) * (exp(-t / y) - exp(-t / z));
38 }
39 
40 double pulse_yz(double x, double z, double t){
41  double result1, result2;
42 
43  result1 = exp(-t / x) - exp(-t / z);
44  result1*= z * x / (z - x);
45 
46  result2 = t * exp(-t / z);
47 
48  return (result1 + result2) / (z - x);
49 }
50 
51 double pulse_x0_yz(double z, double t){
52  return t / z * exp(-t / z);
53 }
54 
55 double pulse(double x, double y, double z, double t){
56 
57  if(x > y){
58  double pivot = x;
59  x = y;
60  y = pivot;
61  }
62 
63  if((x == 0) && (y == z)) return pulse_x0_yz(z, t);
64  else if(x == 0) return pulse_x0(y, z, t);
65  else if(y == z) return pulse_yz(x, z, t);
66  else return pulse_raw(x, y, z, t);
67 }
68 
69 double fpeak(double *x, double *par){
70 
71  double xx = par[0];
72  double y = par[1];
73  double z = par[2];
74  double a_0 = par[3];
75  double s = par[4];
76  double t_0 = par[5];
77  double t = x[0] - t_0;
78 
79  // below turn-on time return just a constant
80  if(x[0] < t_0) return a_0;
81  // elswhere return the pulse
82  return a_0 + s * pulse(xx, y, z, t);
83 }
84 
85 double fturnOn(double *x, double *par){
86 
87  double a_0 = par[0];
88  double s = par[1];
89  double t_0 = par[2];
90  double width = par[3];
91 
92  return a_0+s*TMath::Erf((x[0]-t_0)/width);
93 }
94 
95 double fdecay (double *x, double *par){
96 
97  double s = par[0];
98  double c_exp = par[1];
99  double c_pow = par[2];
100 
101  return s*TMath::Exp(x[0]*c_exp)*(1+x[0]*c_pow);
102 }
103 
104 double fdecay(double *x, double *par);
105 
106 
107 double fdeconv(double *x, double *par){
108  double xm = par[6]*(x[0]-25);
109  double xp = par[6]*(x[0]+25);
110  double xz = par[6]*x[0];
111  return 1.2131 * fpeak(&xp,par) - 1.4715 * fpeak(&xz,par) + 0.4463 * fpeak(&xm,par);
112 }
113 
114 double fpeak_convoluted(double *x, double *par){
115  TF1 f("peak_convoluted",fpeak,0,250,4);
116  return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,nullptr,1.)/(par[4]);
117 }
118 
119 double fdeconv_convoluted(double *x, double *par){
120  double xm = (x[0]-25);
121  double xp = (x[0]+25);
122  double xz = x[0];
123  return 1.2131*fpeak_convoluted(&xp,par)-1.4715*fpeak_convoluted(&xz,par)+0.4463*fpeak_convoluted(&xm,par);
124 }
double fdeconv_convoluted(double *x, double *par)
double pulse_x0(double y, double z, double t)
double fdecay(double *x, double *par)
double fpeak_convoluted(double *x, double *par)
double pulse_yz(double x, double z, double t)
double pulse(double x, double y, double z, double t)
float float float z
double fdeconv(double *x, double *par)
double pulse_raw(double x, double y, double z, double t)
double f[11][100]
double fpeak(double *x, double *par)
double fturnOn(double *x, double *par)
double pulse_x0_yz(double z, double t)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40