Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions hist/hist/src/AnalyticalIntegrals.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ Double_t AnalyticalIntegral(TF1 *f, Double_t a, Double_t b)
return TMath::QuietNaN();
}

if (num == 200)//expo: exp(p0+p1*x)
{
result = ( exp(p[0]+p[1]*xmax) - exp(p[0]+p[1]*xmin))/p[1];
else if (num == 200) { // expo: exp(p0 + p1*x)
const double p0 = p[0];
const double p1 = p[1];

if (p1 == 0) {
// Limit p1 -> 0: integral of constant exp(p0)
result = std::exp(p0) * (xmax - xmin);
} else {
const double ea = p0 + p1 * xmin;
const double eb = p0 + p1 * xmax;
result = (std::exp(eb) - std::exp(ea)) / p1;
}
}
else if (num == 100)//gaus: [0]*exp(-0.5*((x-[1])/[2])^2))

else if (num == 100) // gaus: [0]*exp(-0.5*((x-[1])/[2])^2))
{
double amp = p[0];
double mean = p[1];
Expand All @@ -54,8 +64,7 @@ Double_t AnalyticalIntegral(TF1 *f, Double_t a, Double_t b)
else
result = amp * sqrt(2 * TMath::Pi()) * sigma *
(ROOT::Math::gaussian_cdf(xmax, sigma, mean) - ROOT::Math::gaussian_cdf(xmin, sigma, mean)); //
}
else if (num == 400)//landau: root::math::landau(x,mpv=0,sigma=1,bool norm=false)
} else if (num == 400) // landau: root::math::landau(x,mpv=0,sigma=1,bool norm=false)
{

double amp = p[0];
Expand All @@ -66,8 +75,7 @@ Double_t AnalyticalIntegral(TF1 *f, Double_t a, Double_t b)
result = amp*(ROOT::Math::landau_cdf(xmax,sigma,mean) - ROOT::Math::landau_cdf(xmin,sigma,mean));
else
result = amp*sigma*(ROOT::Math::landau_cdf(xmax,sigma,mean) - ROOT::Math::landau_cdf(xmin,sigma,mean));
}
else if (num == 500) //crystal ball
} else if (num == 500) // crystal ball
{
double amp = p[0];
double mean = p[1];
Expand All @@ -83,15 +91,14 @@ Double_t AnalyticalIntegral(TF1 *f, Double_t a, Double_t b)
}
}

else if (num >= 300 && num < 400)//polN
else if (num >= 300 && num < 400) // polN
{
Int_t n = num - 300;
for (int i=0;i<n+1;i++)
{
result += p[i]/(i+1)*(std::pow(xmax,i+1)-std::pow(xmin,i+1));
}
}
else
} else
result = TMath::QuietNaN();

return result;
Expand Down
Loading