50double func(
double x){
56double func2(
const double *
x,
const double * =
nullptr){
67 std::cout <<
"\n\n***************************************************************\n";
68 std::cout <<
"Test integration performances in interval [ " <<
x1 <<
" , " <<
x2 <<
" ]\n\n";
81 for (
int i = 0; i <
n; ++i) {
86 std::cout <<
"Time using ROOT::Math::Integrator :\t" <<
timer.RealTime() << std::endl;
87 std::cout <<
"Number of function calls = " << nc/
n << std::endl;
88 int pr = std::cout.precision(18); std::cout <<
s1 << std::endl; std::cout.precision(
pr);
98 for (
int i = 0; i <
n; ++i) {
103 std::cout <<
"Time using TF1::Integral :\t\t\t" <<
timer.RealTime() << std::endl;
104 std::cout <<
"Number of function calls = " << nc/
n << std::endl;
105 pr = std::cout.precision(18); std::cout <<
s1 << std::endl; std::cout.precision(
pr);
112 std::cout <<
"\n\n***************************************************************\n";
113 std::cout <<
"Drawing cumulatives of BreitWigner in interval [ " <<
x1 <<
" , " <<
x2 <<
" ]\n\n";
119 for (
int i = 1; i <=
n; ++i) {
120 double x =
x1 +
dx*i;
132 for (
int i = 1; i <=
n; ++i) {
133 double x =
x1 +
dx*i;
134 cum1->SetBinContent(i,
ig.Integral(
x1,
x));
138 TF1 *
fBW =
new TF1(
"fBW",
"TMath::BreitWigner(x, 0, 1)",
x1,
x2);
142 for (
int i = 1; i <=
n; ++i) {
143 double x =
x1 +
dx*i;
149 for (
int i = 1; i <=
n; ++i) {
150 double delta =
cum1->GetBinContent(i) -
cum0->GetBinContent(i);
153 cum10->SetBinContent(i, delta );
154 cum10->SetBinError(i, std::numeric_limits<double>::epsilon() *
cum1->GetBinContent(i) );
164 cum0->SetTitle(
"BreitWigner - the cumulative");
165 cum0->SetStats(
false);
172 cum1->DrawCopy(
"same");
174 cum2->DrawCopy(
"same");
177 cum10->SetTitle(
"Difference");
178 cum10->SetStats(
false);
182 cum20->Draw(
"hsame");
185 l->AddEntry(
cum10,
"GSL integration - analytical ");
186 l->AddEntry(
cum20,
"TF1::Integral - analytical ");
191 std::cout <<
"\n***************************************************************\n";
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Functor1D class for one-dimensional functions.
User Class for performing numerical integration of a function in one dimension.
Template class to wrap any C++ callable object which takes one argument i.e.
1-D histogram with a double per channel (see TH1 documentation)
This class displays a legend box (TPaveText) containing several legend entries.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
@ kADAPTIVE
to be used for general functions without singularities
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1)
Calculates a Breit Wigner function with mean and gamma.