Update fit with Fit Panel

Hi,

I’m fitting an histogram in order to get some parameters. But the fit is complicated, and it has to be manually tuned.

What I do in my code, is to pause the execution, so I can tune the fit with the tool “Fit Panel”, until I get the a satisfactory fit, and then I want to that the execution continues with the new fit.
The problem is that when the continue executing, it doesn’t update the fit, and it continues using the previous fit.

I do this:
TH1F h;
TF1 * f = new TF1( TString::Format(“f_%s”, h.GetName()), “gaus(0)+gaus(3)”, -3e6, 100e6);
TFitResultPtr r_110=h.Fit(f, “LEMSR”, “”);
lets_pause();
cout << 0 << " " << 1100 << " " << r_1100.Get()->Parameter(4)-r_1100.Get()->Parameter(1) << " " << r_1100.Get()->Parameter(5)*r_1100.Get()->Parameter(5) + r_1100.Get()->Parameter(2)*r_1100.Get()->Parameter(2) << endl;

And in cout it shows the previous fit results, it doesn’t update it.
I need to retrieve the hand-tuned fit someway, but I don’t know how to do it. Some help will be welcome!

Thank you in advance,
J.

PS: This is the definition of lets_pause, in case it helps:

void lets_pause (){
TTimer * timer = new TTimer(“gSystem->ProcessEvents();”, 50, kFALSE);
timer->TurnOn();
timer->Reset();
std::cout << "q/Q to quit, other to continuee: ";
char kkey;
std::cin.get(kkey);
if( kkey == ‘q’ || kkey == ‘Q’) gSystem->Exit(0);
timer->TurnOff();
delete timer;
}

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.