Problem drawing different fit functions

Hi just a quick problem. ive got 3 working fit functions, all different. But when it comes to drawing them only one of the fit functions appears on all the pads. even when defining a seperate canvas before each fit command.
(see attachment)
So my question is what steps do i need to add to my code, to draw each fitted histogram on a single canvas or at the very least bring them up on different pads?
(The trees ive called in the code. Haven’t been attached, so its not possible to run the code but hopefully somebody can still give me some help).

thank you
Rob
Fit.C (11.5 KB)

I suggest changing the last part of your script as shown below.
Look carefully at my changes.
If you still have the same problem, send a version of your script that we can execute, saving the 3 histograms in a ROOT file and sending this file.

Rene

[code]TCanvas *f1 = new TCanvas(“f1”,“f1”);
TF1 *g = new TF1(“gausspeak”,Gaussian,5.227,5.29,3);
g->SetParameters(pg0,pg1,pg2);
g->SetParNames(“centre1”,“sigma1”,“peakmax1”);
g->SetLineColor(kRed);

PmES_MC->Fit(g,“r”);

TCanvas *f2 = new TCanvas(“f2”,“f2”);
TF1 *a = new TF1(“fit”,Argus,5.227,5.29,2);
a->SetParameters(pA0,pA1);
a->SetParNames(“Aamp”,“Axi”);
a->SetLineColor(kBlue);

PmES_Off->Fit(a,“r”);

TCanvas *f3 = new TCanvas(“f3”,“f3”);
TF1 *f = new TF1(“Fitname”,Total,5.227,5.29,5);
f->SetParameters(p0,p1,p2,p3,p4);
f->SetParNames(“amp”,“xi”,“peakmax”,“centre”,“sigma”);
f->SetLineColor(kRed);

PmES_On->Fit(f,“r”);[/code]