Accessing statistics box

Hi,

I’ve attached a simple macro which is drawing to gaussion functions and fits them. I want to access both statistic boxes and move them around on the pad, however I can’t even access a single statistics box… I’m assuming that the error is obvious, but I just don’t see it. Thanks for any help!

Cheers,
Carsten
test.C (550 Bytes)

You must force an update of the pad to get the stats box generated.
See the small mods in your code below

[code]{
gStyle->SetOptStat(111111);
gStyle->SetOptFit(1);

TH1F *h1 = new TH1F(“h1”,“histo from gaussian”,100,-3,3);
h1->FillRandom(“gaus”,10000);
TH1F *h2 = new TH1F(“h2”,“histo from gaussian”,100,-3,3);
h2->FillRandom(“gaus”,10000);

h1->SetLineColor(2);
h2->SetLineColor(4);

h1->Draw();
h1->Fit(“gaus”);

h2->Draw();
h2->Fit(“gaus”);

h1->Draw();
h2->Draw(“sames”);
c1->Update();

TPaveStats stats = (TPaveStats)(h1->GetListOfFunctions()->FindObject(“stats”));
stats->SetX1NDC(0.2);
stats->SetX2NDC(0.7);
c1->Modified();
}
[/code]

Rene