18 const double lgE = x[0];
23 lgJ = par[0] - par[2] * (lgE - par[1]);
25 double lgJ_exp = -par[3] * lgE - log10(1.0 + exp((lgE - par[4]) / par[5]));
26 double lgJ_ankle = -par[3] * par[1] - log10(1.0 + exp((par[1] - par[4]) / par[5]));
27 lgJ = par[0] + lgJ_exp - lgJ_ankle;
41 double J0 =
pow(10, par[0]);
42 double E12 =
pow(10, par[1]);
43 double E23 =
pow(10, par[4]);
45 double E =
pow(10, v[0]);
47 J =
pow(E / E12, -par[2]) * ( 1 +
pow(E / E12, par[2]) ) / (1 +
pow(E / E12, par[3] ) ) * (1. +
pow(E12 / E23, par[5]) ) / (1 +
pow(E / E23, par[5]));
67 const double lgE = x[0];
72 lgJ = par[0] - par[2] * (lgE - par[1]);
74 double E =
pow(10., lgE);
75 double Ea =
pow(10, par[1]);
76 double Es =
pow(10, par[4]);
78 double lgJ_exp = log10(1.0 +
pow(E / Es, par[5]));
79 double lgJ_ankle = log10(1.0 +
pow(Ea / Es, par[5]));
80 lgJ = par[0] - par[3] * (lgE - par[1]) + lgJ_ankle - lgJ_exp ;
104 const size_t breaks = n / 2 - 1;
105 const double lgE = x[0];
107 double lgJ = par[0] - par[breaks + 1] * (lgE - 18.5);
109 for (
size_t i = 1; i <= breaks; ++i) {
110 lgJ += TMath::Log10(1 +
pow(10, par[breaks + i] * (lgE - par[i])));
111 lgJ -= TMath::Log10(1 +
pow(10, par[breaks + i + 1] * (lgE - par[i])));
121 const double lgE = x[0];
126 lgJ = par[0] - par[2] * (lgE - par[1]);
128 lgJ = par[0] - par[3] * (lgE - par[1]);
144 const double lgNorm = par[0];
145 const double lgEbreak = par[1];
146 const double lgEa = par[2];
147 const double gamma0 = par[3];
148 const double gamma1 = par[4];
149 const double gamma2 = par[5];
150 const double rate = par[6];
152 const double lgE = x[0];
156 const double lgEs = 1000000;
157 const double dGamma = 2.5;
162 const double factor =
pow(10, lgE) /
pow(10, lgEbreak);
163 lgJ = lgNorm - gamma0 * (lgE - lgEbreak) + (gamma0 - gamma1) / rate * log10(1 +
pow(factor, rate));
165 const double factor =
pow(10, lgEa) /
pow(10, lgEbreak);
166 double E =
pow(10., lgE);
167 double Ea =
pow(10, lgEa);
168 double Es =
pow(10, lgEs);
169 double lgJ_exp = log10(1.0 +
pow(E / Es, dGamma));
170 double lgJ_ankle = log10(1.0 +
pow(Ea / Es, dGamma));
171 lgJ = lgNorm - gamma0 * (lgEa - lgEbreak) + (gamma0 - gamma1) / rate * log10(1 +
pow(factor, rate)) - gamma2 * (lgE - lgEa) + lgJ_ankle - lgJ_exp;
193 double w[3] = {par[8],par[9],par[10]};
194 double J = par[0] - par[4] * (lgE - 18.5);
195 double factor = (par[4] - par[5]) * w[0];
196 factor *= log10( 1. +
pow(10,(lgE - par[1]) / w[0] ) );
198 factor = (par[5] - par[6]) * w[1];
199 factor *= log10( 1. +
pow(10,(lgE - par[2]) / w[1] ) );
201 factor = (par[6] - par[7]) * w[2];
202 factor *= log10( 1. +
pow(10,(lgE - par[3]) / w[2] ) );
213 int ncol = x.GetNoElements();
216 for (
int i = 0; i < ncol; ++i)
224 int ncol = x.GetNoElements();
227 for (
int i = 0; i < ncol; ++i)
234 int ncol = x.GetNoElements();
237 for (
int i = 0; i < ncol; ++i)
244 int ncol = x.GetNoElements();
247 for (
int i = 0; i < ncol; ++i)
255 int ncol = x.GetNoElements();
258 for (
int i = 0; i < ncol; ++i)
266 int ncol = x.GetNoElements();
269 for (
int i = 0; i < ncol; ++i)
277 int ncol = x.GetNoElements();
280 for (
int i = 0; i < ncol; ++i)
290 TVectorD
FluxModel(
string model, TVectorD x,
double* par) {
291 if (model ==
"StandardICRC2013")
293 else if (model ==
"StandardICRC2015")
295 else if (model ==
"StandardMultiSmooth")
297 else if (model ==
"InfillHard")
299 else if (model ==
"Spectrum2015_2017SmoothAnkle")
301 else if (model ==
"SpectrumInfillICRC2019")
303 else if (model ==
"SpectrumLipari")
307 cerr << model <<
": no valid unfolding function chosen " << endl;
308 throw std::exception();
317 if (model ==
"StandardICRC2013")
319 else if (model ==
"StandardICRC2015")
321 else if (model ==
"StandardMultiSmooth")
323 else if (model ==
"InfillHard")
325 else if (model ==
"Spectrum2015_2017SmoothAnkle")
327 else if (model ==
"SpectrumInfillICRC2019")
329 else if (model ==
"SpectrumLipari")
333 cerr << model <<
": no valid unfolding function chosen " << endl;
334 throw std::exception();
343 int ncol = x.GetNoElements();
346 for (
int i = 0; i < ncol; ++i)
347 f0s[i] = f0s[i] *
pow(10, x[i]);
349 TVectorD f1s = m * f0s;
350 f1s *= (x[1] - x[0]);
353 for (
int i = 0; i < ncol; ++i)
354 corr[i] = f0s[i] / f1s[i];
362 int ncol =
vecLgE.GetNoElements();
364 double* par = &parsFit[0];
367 for (
int i = 0; i < ncol; ++i)
374 for (
int i = 0; i < ncol; ++i)
375 corr[i] = f0s[i] / f1s[i];
383 int ncol = x.GetNoElements();
386 for (
int i = 0; i < ncol; ++i)
387 f0s[i] = f0s[i] *
pow(10, x[i]);
389 TVectorD f1s = m * f0s;
390 f1s *= (x[1] - x[0]);
396 int N = frawAxis_lgE->GetNbins();
402 TVectorD corr_new(N);
403 for (
int i = 0; i < ncol; ++i) {
405 int bin = frawAxis_lgE->FindBin(ilgE);
414 mws[bin - 1] += f1s[i];
415 mws0[bin - 1] += f0s[i];
418 for (
int j = 0; j < N; ++j){
419 corr_new[j] = mws0[j]/mws[j];
428 int Nbins = fAxis_lgE->GetNbins();
429 TVectorD UnfoldCorrectionFactor_Likelihood(Nbins);
433 TVectorD UnfoldCorrectionFactorError_Likelihood(Nbins);
435 for (
int j = 0; j < Nbins; ++j){
437 double dunf_dp[
npar];
438 for (
int k=0; k<
npar; k++){
444 for (
int l=0; l<
npar; l++){
448 fpar[k] = par[k] + parerr[k]*ff;
451 TVectorD UnfoldCorrectionFactor_Likelihood_1(Nbins);
455 dunf_dp[k] = (UnfoldCorrectionFactor_Likelihood[j] - UnfoldCorrectionFactor_Likelihood_1[j]) / (fpar[k]-par[k]);
460 for (
int k1=0; k1<
npar; k1++){
461 for (
int k2=0; k2<
npar; k2++){
462 unf_err = unf_err + dunf_dp[k1]*dunf_dp[k2] * parcov[k1][k2];
466 unf_err =
sqrt(unf_err);
474 double err_th = 0.15/1e2;
475 if (unf_err<err_th) unf_err = err_th;
476 UnfoldCorrectionFactorError_Likelihood[j] = unf_err;
481 return UnfoldCorrectionFactorError_Likelihood;
double FluxModel(const modeltype mtype, double *x, double *par)
double SpectrumInfillFitFunction(double *x, double *par)
double pow(const double x, const unsigned int i)
TVectorD GetCorrectionFactorError_Likelihood(const TVectorD x, const TMatrixD m, int npar, TVectorD par, TVectorD parerr, TMatrixD parcov, string model, TAxis *fAxis_lgE)
double FluxModelMultiSmoothBreak(double *x, double *par)
Double_t Spectrum2015_2017SmoothAnkle(Double_t *v, Double_t *par)
Double_t SpectrumLipari(double *x, double *par)
double(*)(double *, double *) FluxModels(const modeltype mtype)
TVectorD GetCorrectionFactor_Likelihood(const TVectorD x, const TMatrixD m, double *par, string model, TAxis *frawAxis_lgE)
double SpectrumLgSmoothFitFunction2013(double *x, double *par)
double SpectrumInfillICRC2019(double *x, double *par)
TVectorD GetCorrectionFactor(const TVectorD x, const TMatrixD m, double *par, const modeltype mtype)
double SpectrumLgSmoothFitFunction2015(double *x, double *par)