Hi Experts,
is it possible to change between algorithms when fitting a histogram? Something like this:
#include "TH1F.h"
#include "TF1.h"
Double_t fitFunc (Double_t*x, Double_t*par)
{
return par[0]+par[1]*x[0];
}
void testMin(void)
{
TH1F h("h","h",10,0,10);
for (int i = 1; i != 11; ++i) {
for (int j = 0; j != i; ++j) {
h.Fill(i);
}
}
TF1 * f1 = new TF1("f1", fitFunc,0.,1000.,2);
f1->SetParameter(0, 1.);
f1->SetParameter(1, 0.);
Int_t r = h.Fit("f1","MER");
if (r != 0) {
// CHANGE fit algorithm to (e.g.) SEEK ??
h.Fit("f1","MER");// perform fit using minuit+new algorithm
}
delete f1;
}
I tried ROOT::Math::MinimizerOptions::SetMinimizerAlgorithm(const char*)
but requires an object.
TVirtualFitter don’t have a call to this function either.
Thanks in advance