Suppress graph picture for fit

Dear Rooters,

to fit a gaussian distribution with a random noise by a gaus, as defined in TMath, the following code only generates a popup window with a graph, when the last line is uncommented.

TF1* myGaus = new TF1(“myGaus”,“gaus”,-5,5);
myH1->FillRandom(“gaus”,6000);
myH1->Fit(“myGaus”);
//myH1->Draw();

Whereas, when using a custom defined function, always a popup window with a graph appears.

TF1* myGaus = new TF1(“myGaus”,CustomDefinedGaus,-5,5,3);
myH1->FillRandom(“gaus”,6000);
myH1->Fit(“myGaus”);

In my application, I need a complicated custom defined function, however do not want a graph window to appear. How can I do this?

Many thanks in advance,
Daniel

Hi,

you can use the option “0” to suppress the plot of the fit:

myH1->Fit("myGaus","0"); 

Best Regards

Lorenzo

Excellent! Thank you!

Note that it is mentioned in the doc here:
root.cern.ch/root/html/TH1.html#TH1:Fit