// Kindly bear my ignorance and help me learn the syntax.
// Please correct me with my comments and questions in the following ROOT code:
//=======
#include “TF1.h”
// to ensure that a 1-dimensional formula can be defined
#include “Math/WrappedTF1.h”
// to wrap the defined formula
// why and for what reasons is the “wrapping”?
#include “Math/GaussIntegrator.h”
// is this the choice of integrator with a “Gaussian measure”?
int GaussIntegratorOneDim()
// should this be the same name at the filename?
{
TF1 f(“f”, “exp(x)”, 0, TMath::Pi());
// f - is the name of the formula
// exp(x) - is the defined formula
// 0, TMath::Pi() - is the range of the variable x
// -> is it really necessary to set the range?
// -> what happens when you integrate beyond the set range?
ROOT::Math::WrappedTF1 wf1(f);
// why does the function have to be wrapped?
ROOT::Math::GaussIntegrator ig;
// defining the integrator
ig.SetFunction(wf1);
// setting of the function
// “ig.SetFunction(wf1, false);” - i do not know why this does not work
// but why does it work without the “false” parameter?
ig.SetRelTolerance(0.001);
// what is this function?
// can it be set arbitrarily?
cout << ig.Integral(0, TMath::PiOver2()) << endl;
cout << ig.Integral(1, 0) << endl;
return 0;
// what does this mean?
// what happens when I put “return 1;” instead?
}
//=======
// Thanks always for your help - Jaybee