19 int kmax =
static_cast<int>(ceil(p[1])) * 10;
30 for (
int kint = 0; kint <= kmax; kint++) {
31 double k =
static_cast<double>(kint);
32 double sigmaK = sqrt(sigma0 * sigma0 + k * sigma1 * sigma1);
34 double gp = mu * TMath::Power((mu + k * lambda), k - 1) * TMath::Exp(-(mu + k * lambda)) / TMath::Factorial(kint);
36 sum += p[0] * gp * (1. / sqrt(2. * TMath::Pi()) / sigmaK) * TMath::Exp(-TMath::Power(((x[0] - (k * G + B)) / sqrt(2) / sigmaK), 2.));
64 int kmax =
static_cast<int>(ceil(p[1])) * 10;
78 for (
int kint = 0; kint <= kmax; kint++) {
80 double k =
static_cast<double>(kint);
82 double sigmaK = sqrt(sigma0 * sigma0 + k * sigma1 * sigma1);
83 double gausnormsigmak = 1. / (sqrt(2. * TMath::Pi()) * sigmaK);
85 double gauss = gausnormsigmak * TMath::Exp(-1. * TMath::Power(x[0] - (k * G + B), 2.) / (sigmaK * sigmaK * 2.));
88 double gp = p[0] * mu * TMath::Power((mu + k * lambda), k - 1) * TMath::Exp(-(mu + k * lambda)) / TMath::Factorial(kint);
95 double bk0 = TMath::Power(1. - alpha, k);
96 double bk1 = TMath::Factorial(kint) / TMath::Factorial(kint - 1) * alpha * TMath::Power(1. - alpha, k - 1);
97 double pk1 = TMath::Exp(-1. * (x[0] - (k * G + B)) / beta) * gausnormsigmak / beta * sigmaK * sqrt(TMath::Pi() / 2) * (TMath::Erf((x[0] - (k * G + B)) / (sqrt(2) * sigmaK)) + 1.);
100 if (kint == 1) sum += gp * (bk0 * gauss + bk1 * pk1);
103 for (
int ii = 2; ii < kint; ii++) {
104 double iid =
static_cast<double>(ii);
105 double bkialpha = TMath::Factorial(kint) / (TMath::Factorial(ii) * TMath::Factorial(kint - ii)) * TMath::Power(alpha, iid) * TMath::Power((1. - alpha), (k - iid));
107 if (x[0] > (k * G + B)) dpkidph = TMath::Power((x[0] - (k * G + B)), (iid - 1.)) / (TMath::Factorial(ii - 1) * TMath::Power(beta, iid)) * TMath::Exp(-1. * (x[0] - (k * G + B)) / beta);
108 api2k += bkialpha * dpkidph;
110 sum += gp * (bk0 * gauss + bk1 * pk1 + api2k);
139 int kmax =
static_cast<int>(ceil(p[1])) * 10;
142 double lambda = p[2];
144 double sigma0 = p[3];
145 double sigma1 = p[4];
153 for (
int kint = 0; kint <= kmax; kint++) {
154 double k =
static_cast<double>(kint);
155 double sigmaK = sqrt(sigma0 * sigma0 + k * sigma1 * sigma1);
157 double gp = mu * TMath::Power((mu + k * lambda), k - 1) * TMath::Exp(-(mu + k * lambda)) / TMath::Factorial(kint);
160 sum += a_ped * p[0] * gp * (1. / sqrt(2. * TMath::Pi()) / sigmaK) * TMath::Exp(-TMath::Power(((x[0] - x_ped) / sqrt(2) / sigmaK), 2));
163 sum += p[0] * gp * (1. / sqrt(2. * TMath::Pi()) / sigmaK) * TMath::Exp(-TMath::Power(((x[0] - (k * G + B)) / sqrt(2) / sigmaK), 2));
188 double pmt_charge_spectrum = 0.;
189 int kmax =
static_cast<int>(ceil(p[5])) * 10;
191 for (
int kint = 0; kint <= kmax; kint++) {
192 double k =
static_cast<double>(kint);
194 double poiss = TMath::Power(p[5], k) * TMath::Exp(-p[5]) / TMath::Factorial(kint);
196 double normgn_term = 1.;
197 if (kint != 0) normgn_term /= (p[6] * TMath::Sqrt(2. * TMath::Pi() * k));
198 double gn_term = (1. - p[1]) * normgn_term;
199 if (kint != 0) gn_term *= TMath::Exp(-1. * TMath::Power(x[0] - k * p[7] - p[4], 2.) / (2. * k * p[6] * p[6]));
200 else if (x[0] != p[4]) gn_term *= 0.;
202 double Qn = p[4] + k * p[7];
203 double sigman = TMath::Sqrt(p[3] * p[3] + k * p[6] * p[6]);
204 double ignxe_term_exp = p[2] / 2. * TMath::Exp(-1. * p[2] * (x[0] - Qn - p[2] * sigman * sigman));
206 double sgn_arg = x[0] - Qn - sigman * sigman * p[2];
208 if (sgn_arg < 0.) arg_sgn = -1.;
209 double ignxe_term_erf = TMath::Erf(fabs(p[4] - Qn - sigman * sigman * p[2]) / (sigman * TMath::Sqrt(2.))) + arg_sgn * TMath::Erf(fabs(sgn_arg) / (sigman * TMath::Sqrt(2.)));
211 pmt_charge_spectrum += p[0] * poiss * (gn_term + p[1] * ignxe_term_exp * ignxe_term_erf);
213 if (pmt_charge_spectrum < 0.) pmt_charge_spectrum = 0.;
214 return pmt_charge_spectrum;
238 double pmt_charge_spectrum = 0.;
239 int kmax =
static_cast<int>(ceil(p[5])) * 10;
241 for (
int kint = 0; kint <= kmax; kint++) {
242 double k =
static_cast<double>(kint);
244 double poiss = TMath::Power(p[5], k) * TMath::Exp(-p[5]) / TMath::Factorial(kint);
246 double normgn_term = 1.;
247 if (kint != 0) normgn_term /= (p[6] * TMath::Sqrt(2. * TMath::Pi() * k));
248 else normgn_term *= p[8] / (p[3] * TMath::Sqrt(2. * TMath::Pi()));
249 double gn_term = (1. - p[1]) * normgn_term;
250 if (kint != 0) gn_term *= TMath::Exp(-1. * TMath::Power(x[0] - k * p[7] - p[4], 2.) / (2. * k * p[6] * p[6]));
251 else gn_term *= TMath::Exp(-1. * TMath::Power(x[0] - p[4], 2.) / (2. * p[3] * p[3]));
253 double Qn = p[4] + k * p[7];
254 double sigman = TMath::Sqrt(p[3] * p[3] + k * p[6] * p[6]);
255 double ignxe_term_exp = p[2] / 2. * TMath::Exp(-1. * p[2] * (x[0] - Qn - p[2] * sigman * sigman));
257 double sgn_arg = x[0] - Qn - sigman * sigman * p[2];
259 if (sgn_arg < 0.) arg_sgn = -1.;
260 double ignxe_term_erf = TMath::Erf(fabs(p[4] - Qn - sigman * sigman * p[2]) / (sigman * TMath::Sqrt(2.))) + arg_sgn * TMath::Erf(fabs(sgn_arg) / (sigman * TMath::Sqrt(2.)));
262 pmt_charge_spectrum += p[0] * poiss * (gn_term + p[1] * ignxe_term_exp * ignxe_term_erf);
264 if (pmt_charge_spectrum < 0.) pmt_charge_spectrum = 0.;
265 return pmt_charge_spectrum;
284 double pmt_charge_spectrum = 0.;
286 int kmax =
static_cast<int>(ceil(p[1])) * 10;
288 for (
int kint = 1; kint <= kmax; kint++) {
289 double k =
static_cast<double>(kint);
291 double poiss = TMath::Power(p[1], k) * TMath::Exp(-p[1]) / TMath::Factorial(kint);
293 double norm = 1. / (p[2] * TMath::Sqrt(2. * TMath::Pi() * k));
295 double gauss = TMath::Exp(-1. * TMath::Power(x[0] - k * p[3], 2) / (2. * k * p[2] * p[2]));
297 pmt_charge_spectrum += p[0] * poiss * norm * gauss;
299 return pmt_charge_spectrum;
323 double invsq2pi = 0.3989422804014;
324 double mpshift = -0.22278298;
341 mpc = par[1] - mpshift * par[0];
344 xlow = x[0] - sc * par[3];
345 xupp = x[0] + sc * par[3];
347 step = (xupp - xlow) / np;
350 for (i = 1.0; i <= np / 2; i++) {
351 xx = xlow + (i - .5) * step;
352 fland = TMath::Landau(xx, mpc, par[0]) / par[0];
353 sum += fland * TMath::Gaus(x[0], xx, par[3]);
355 xx = xupp - (i - .5) * step;
356 fland = TMath::Landau(xx, mpc, par[0]) / par[0];
357 sum += fland * TMath::Gaus(x[0], xx, par[3]);
360 return (par[2] * step * sum * invsq2pi / par[3]);
384 int kmax =
static_cast<int>(ceil(p[1])) * 10;
387 double lambda = p[2];
389 double sigma0 = p[3];
390 double sigma1 = p[4];
398 for (
int kint = 0; kint <= kmax; kint++) {
399 double k =
static_cast<double>(kint);
400 double sigmaK = sqrt(sigma0 * sigma0 + k * sigma1 * sigma1);
402 double gp = ((1. - N0_dc) * (mu * TMath::Power((mu + k * lambda), k - 1) * TMath::Exp(-(mu + k * lambda))) + N0_dc * (mu_dc * TMath::Power((mu_dc + k * lambda), k - 1) * TMath::Exp(-(mu_dc + k * lambda)))) / TMath::Factorial(kint);
404 sum += p[0] * gp * (1. / sqrt(2. * TMath::Pi()) / sigmaK) * TMath::Exp(-TMath::Power(((x[0] - (k * G + B)) / sqrt(2) / sigmaK), 2));
430 for (
int kint = -k_pm; kint <= k_pm; kint++) {
431 k =
static_cast<double>(kint);
433 gauss += A * TMath::Exp(-TMath::Power(x[0] - mu + k * 360., 2.) / (2. * sigma * sigma));
455 Double_t start = par[1] - sc * (par[0] + par[3]);
458 TF1* langaus_fun =
new TF1(
"fun", langaus, start - 1, x[0] + 1, 4);
459 langaus_fun->SetParameter(0, par[0]);
460 langaus_fun->SetParameter(1, par[1]);
461 langaus_fun->SetParameter(2, par[2]);
462 langaus_fun->SetParameter(3, par[3]);
464 return (par[4] * (1. - langaus_fun->Integral(start, x[0])));
487 int kmax =
static_cast<int>(ceil(par[5])) * 10;
490 TF1* langaus_fun =
new TF1(
"fun", langaus, 0, 1, 4);
491 langaus_fun->SetParameter(0, par[0]);
492 langaus_fun->SetParameter(2, par[2]);
495 for (
int kint = 1; kint <= kmax; kint++) {
496 double k =
static_cast<double>(kint);
498 double peak_shift = (k - 1) * par[6];
499 langaus_fun->SetParameter(1, par[1] + peak_shift);
501 double sigmaK = sqrt(par[3] * par[3] + (k - 1) * par[4] * par[4]);
502 langaus_fun->SetParameter(3, sigmaK);
505 double poiss = TMath::Power(par[5], k) / (TMath::Factorial(kint) * (TMath::Exp(par[5]) - 1.));
507 sum += langaus_fun->Eval(x[0]) * poiss;
527 double tau_eff = par[0];
528 double sigma_gauss = par[1];
530 double norm = par[3];
532 double e_g = norm / (2 * TMath::Abs(tau_eff)) *
533 TMath::Exp((sigma_gauss * sigma_gauss + 2 * t_0 * tau_eff - 2 * tau_eff * x[0]) /
534 (2 * tau_eff * tau_eff)) *
535 TMath::Erfc((sigma_gauss * sigma_gauss + tau_eff * (t_0 - x[0])) /
536 (TMath::Sqrt2() * TMath::Abs(tau_eff) * sigma_gauss));
Ideal PMT charge spectrum.
double operator()(double *x, double *p)
Gauss-Poisson distribution for fit of PMT charge spectra.
double operator()(double *x, double *p)
Gauss-Poisson distribution for fit of PMT charge spectra.
double operator()(double *x, double *p)
Fit function for SiPMs missing after-pulses and dark counts but with biased pedestal.
double operator()(double *x, double *p)
Convolution of an exponential and a gaussian.
double operator()(double *x, double *par)
Default fit function for SiPMs with after-pulses missing dark counts.
double operator()(double *x, double *p)
Integral of Landau-Gauss-Convolution ("S-curve")
double operator()(double *x, double *par)
Poisson-distributed Landau-Gauss-Convolutions.
double operator()(double *x, double *par)
Landau-Gauss-convolution.
double operator()(double *x, double *par)
Periodic gauss fit function for angular reconstruction of SiPM array signal (SHiP SBT WOM tube)
double operator()(double *x, double *p)
Fit function for SiPMs missing after-pulses and dark counts but including additional dark count spect...
double operator()(double *x, double *p)
Default fit function for SiPMs missing after-pulses and dark counts.
double operator()(double *x, double *p)