ATLAS Offline Software
Loading...
Searching...
No Matches
HitCreatorSilicon.cxx File Reference

Go to the source code of this file.

Functions

double langaufun_fast (double *x, double *par)

Function Documentation

◆ langaufun_fast()

double langaufun_fast ( double * x,
double * par )

Definition at line 114 of file HitCreatorSilicon.cxx.

114 {
115 //Fit parameters:
116 //par[0]=Width (scale) parameter of Landau density
117 //par[1]=Most Probable (MP, location) parameter of Landau density
118 //par[2]=Total area (integral -inf to inf, normalization constant)
119 //par[3]=Width (sigma) of convoluted Gaussian function
120 //
121 //In the Landau distribution (represented by the CERNLIB approximation),
122 //the maximum is located at x=-0.22278298 with the location parameter=0.
123 //This shift is corrected within this function, so that the actual
124 //maximum is identical to the MP parameter.
125
126 // Numeric constants
127 float invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
128 float mpshift = -0.22278298; // Landau maximum location
129 // Gauss lookup table - let's be honest, these are always the same values...
130 // This table is specific to the following np value and needs adaptation in case np is changed
131 double gauss_lut[50] = {0.998750780887374456,0.988813043727165275,0.96923323447634413,0.940588065326561695,0.903707082721058597,
132 0.859632757966350525,0.809571661213986715,0.754839601989007347,0.696804761374882342,0.636831621583786367,
133 0.576229102522380576,0.516205688098894111,0.457833361771614267,0.402021370154990454,0.349500576034800337,
134 0.300817976590658676,0.256340161499255759,0.216265166829887306,0.180639843651333204,0.149381761360416171,
135 0.122303465302261424,0.0991372321836489212,0.0795595087182276867,0.0632127172421080297,0.0497248676032363973,
136 0.0387257750604656018,0.0298595590948963728,0.0227941808836123437,0.0172274759940137939,0.0128906873307075114,
137 0.00954965878387800497,0.00700416504525899417,0.00508606923101270064,0.00365649704823364612,0.0026025848245772071,
138 0.0018340111405293852,0.00127954549250140965,0.000883826306935049958,0.000604414925679283501,0.000409223053150731654,
139 0.000274310255595171487,0.000182046138317709796,0.000119612883581024366,7.78093008945889215e-05,5.01120454198365631e-05,
140 3.19527960443799922e-05,2.01712861314266379e-05,1.26071051770485227e-05,7.8010709105552431e-06,4.77914424437207415e-06};
141 // Control constants
142 float np = 100.0; // number of convolution steps
143 float sc = 5.0; // convolution extends to +-sc Gaussian sigmas
144
145 // Variables
146 float xx;
147 float mpc;
148 float fland;
149 float sum = 0.0;
150 float xlow,xupp;
151 float step;
152 int i;
153
154 // MP shift correction
155 mpc = par[1] - mpshift * par[0];
156
157 // Range of convolution integral
158 xlow = x[0] - sc * par[3];
159 xupp = x[0] + sc * par[3];
160
161 step = (xupp-xlow) / np;
162
163 // Convolution integral of Landau and Gaussian by sum
164 for(i=0; i < np/2; i++) {
165 xx = x[0] +(((float) i)-.5) * step; //x[0] - (((float) i)+.5) * step;
166 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
167 sum += fland * gauss_lut[i];
168
169 xx = x[0] -(((float) i)-.5) * step; // x[0] + (((float) i)+.5) * step;
170 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
171 sum += fland * gauss_lut[i];
172 }
173
174 return (par[2] * step * sum * invsq2pi / par[3]);
175}
static Double_t sc
#define x