Dear ROOT Experts:
To fit a histogram, a TF1 is created
TF1 *myDplusFit = new TF1(“myDplusFit”,“fit0p5MeV_GaussianPlusCBWithExp”,1800.,1940.,9);
and then it is used
where “I” indicates that it should integrate the fit function over each bin rather than using the function value at the center. This is pretty consistently generating a message
Warning in ROOT::Math::ROOT::Math::GaussIntegrator: Failed to reach the desired tolerance ; maxtol = 1e-09
Despite the warnings, the fits are excellent – better than without invoking the “I” option. But at some point the program hangs, perhaps because it has printed too many warnings. So I’d like to change the tolerance.
It seems like it should be possible to use the ROOT::Math:Integrator SetRelTolerance method to reset the default 1e-09 to another value. There some examples on the web using WrappedTF1 objects, but these don’t seem to “do the trick” (probably because I misunderstand the technology.
TF1 *myDplusFit = new TF1("myDplusFit","fit0p5MeV_GaussianPlusCBWithExp",1800.,1940.,9); ROOT::Math::WrappedTF1 wf(myDplusFit); ROOT::Math::GaussIntegrator ig; ig.SetFunction(wf, false); ig.SetRelTolerance(0.0001);
leads to exactly the same warnings indicating that maxtol = 1e-09, as above. myDplusFit is a TF1 *, not a TF1 (which is what sample code uses), but ROOT did not complain, so I am guessing WrappedTF1 can take either as an argument. I had hoped this magic incantation would somehow set the tolerance in myDplusFit. What should I be doing instead?