Problems with FitSlices method

Hi,

I am using the following macro:

void Esc_Etrue_vs_no_xtals_tot()
{
make_plots(“uncorrESC_Etrue_tot”);
}

void make_plots(TString histname)
{
TFile f1 = TFile::Open(“Mean_Pt5_100.root”);
h1 = (TH2F
)f1->Get(histname);

TCanvas* c1 = new TCanvas(“c1”, “c1”);
h1->Draw();
h1->FitSlicesY(0, 1, 100, 0, “G2”);

TH1F* G_mean_tot = (TH1F*)gDirectory->Get(histname+“1");
TCanvas * c2 = new TCanvas(“c2”, “c2”);
G_mean_tot->Draw();
c2->Print("Mean
”+histname+".gif");

}

When I draw h1 it is obvious that most of the points in the TH2F lie below 1. However, when I plot the Mean from the FitSlices it can sometimes be 5 orders of magnetude too high!! I am inculding both the plots that are produced by this macro. I think that setting a range in Y to fit over would help but I am not quite sue how to do this.

Thanks for your help, Claire



Could you post a script together with a script (as attachments)?

Rene

I have attached the macro that I run to produce the plots.

Thanks, Claire
Esc_Etrue_vs_no_xtals_tot.cpp (996 Bytes)

you forgot to post the data file

Rene

Sorry, here it is.

Claire
Mean_Pt5_100.root (470 KB)

Claire,

Use lhe loglikelihood option when fitting your slices. A normal chisquare fit will give rubbish in many of your slices with low statistics per bin.
Replace your line:
h1->FitSlicesY(0, 1, 100, 0, “G2”);
by
h1->FitSlicesY(0, 1, 100, 0, “G2L”);

Rene

Thank you very much, it works.

Claire