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 {
38  return z / (y - z) * (exp(-t / y) - exp(-t / z));
39 }
40 
41 double pulse_yz(double x, double z, double t)
42 {
43  double result1, result2;
44 
45  result1 = exp(-t / x) - exp(-t / z);
46  result1*= z * x / (z - x);
47 
48  result2 = t * exp(-t / z);
49 
50  return (result1 + result2) / (z - x);
51 }
52 
53 double pulse_x0_yz(double z, double t)
54 {
55  return t / z * exp(-t / z);
56 }
57 
58 double pulse(double x, double y, double z, double t)
59 {
60  if(x > y)
61  {
62  double pivot = x;
63  x = y;
64  y = pivot;
65  }
66 
67  if((x == 0) && (y == z)) return pulse_x0_yz(z, t);
68 
69  else if(x == 0) return pulse_x0(y, z, t);
70 
71  else if(y == z) return pulse_yz(x, z, t);
72 
73  else return pulse_raw(x, y, z, t);
74 }
75 
76 double get_compensation(double x)
77 {
78  return 49.9581
79  - 1.7941 * x
80  - 0.110089 * pow(x,2)
81  + 0.0113809 * pow(x,3)
82  - 0.000388111 * pow(x,4)
83  + 5.9761e-6 * pow(x,5)
84  - 3.51805e-8 * pow(x,6);
85 }
86 
87 double fpeak(double *x, double *par)
88 {
89  double xx = par[0];
90  double z = par[1];
91  double a_0 = par[2];
92  double s = par[3];
93  double t_0 = par[4];
94  double t = x[0] - t_0;
95 
96  double y = get_compensation(xx);
97 
98  if(x[0] < t_0) return a_0;
99  return a_0 + s * pulse(xx, y, z, t);
100 }
101 
102 double fdeconv(double *x, double *par)
103 {
104  double xm = par[5]*(x[0]-25);
105  double xp = par[5]*(x[0]+25);
106  double xz = par[5]*x[0];
107  return 1.2131 * fpeak(&xp,par) - 1.4715 * fpeak(&xz,par) + 0.4463 * fpeak(&xm,par);
108 }
109 
110 double fpeak_convoluted(double *x, double *par)
111 {
112  TF1 f("peak_convoluted",fpeak,0,200,4);
113  return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,nullptr,1.)/(par[4]);
114 }
115 
116 double fdeconv_convoluted(double *x, double *par)
117 {
118  double xm = (x[0]-25);
119  double xp = (x[0]+25);
120  double xz = x[0];
121  return 1.2131*fpeak_convoluted(&xp,par)-1.4715*fpeak_convoluted(&xz,par)+0.4463*fpeak_convoluted(&xm,par);
122 }
double fdeconv_convoluted(double *x, double *par)
double pulse_x0(double y, double z, double t)
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)
double get_compensation(double x)
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 pulse_x0_yz(double z, double t)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40