49double func(
double x){
55double func2(
const double *
x,
const double * =
nullptr){
66 std::cout <<
"\n\n***************************************************************\n";
67 std::cout <<
"Test integration performances in interval [ " <<
x1 <<
" , " <<
x2 <<
" ]\n\n";
80 for (
int i = 0; i <
n; ++i) {
85 std::cout <<
"Time using ROOT::Math::Integrator :\t" <<
timer.RealTime() << std::endl;
86 std::cout <<
"Number of function calls = " << nc/
n << std::endl;
87 int pr = std::cout.precision(18); std::cout <<
s1 << std::endl; std::cout.precision(
pr);
97 for (
int i = 0; i <
n; ++i) {
102 std::cout <<
"Time using TF1::Integral :\t\t\t" <<
timer.RealTime() << std::endl;
103 std::cout <<
"Number of function calls = " << nc/
n << std::endl;
104 pr = std::cout.precision(18); std::cout <<
s1 << std::endl; std::cout.precision(
pr);
111 std::cout <<
"\n\n***************************************************************\n";
112 std::cout <<
"Drawing cumulatives of BreitWigner in interval [ " <<
x1 <<
" , " <<
x2 <<
" ]\n\n";
118 for (
int i = 1; i <=
n; ++i) {
119 double x =
x1 +
dx*i;
131 for (
int i = 1; i <=
n; ++i) {
132 double x =
x1 +
dx*i;
133 cum1->SetBinContent(i,
ig.Integral(
x1,
x));
137 TF1 *
fBW =
new TF1(
"fBW",
"TMath::BreitWigner(x, 0, 1)",
x1,
x2);
141 for (
int i = 1; i <=
n; ++i) {
142 double x =
x1 +
dx*i;
148 for (
int i = 1; i <=
n; ++i) {
149 double delta =
cum1->GetBinContent(i) -
cum0->GetBinContent(i);
152 cum10->SetBinContent(i, delta );
153 cum10->SetBinError(i, std::numeric_limits<double>::epsilon() *
cum1->GetBinContent(i) );
163 cum0->SetTitle(
"BreitWigner - the cumulative");
164 cum0->SetStats(
false);
165 cum1->SetLineStyle(2);
166 cum2->SetLineStyle(3);
171 cum1->DrawCopy(
"same");
173 cum2->DrawCopy(
"same");
176 cum10->SetTitle(
"Difference");
177 cum10->SetStats(
false);
181 cum20->Draw(
"hsame");
184 l->AddEntry(
cum10,
"GSL integration - analytical ");
185 l->AddEntry(
cum20,
"TF1::Integral - analytical ");
190 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.