Hello,

So say I have a histogram that I want to fit a gaussian to. Is it possible to have a very fine binwidth and yet the gaussian fitting well? I think even in a fine bin width case, the density of populated bins decreases as you reach the gaussian tails, so one should be able to take this into account when fitting? (ie, more bins are populated towards the center and fewer towards the tails)

For example from this tutorail, if I change N is it possible to obtain the same gaussian mean and sigma?

if N=10000000 I get different mu and sigma than if N were 100.

TH1F *hpx = new TH1F(“hpx”,“hpx”,N,-10.,10.);

TF1 *f1 = new TF1(“f1”,“gaus”,-10.,10.);

// Fill histograms randomly

gRandom->SetSeed();

Float_t px, py, pz;

const Int_t kUPDATE = 1000;

for (Int_t i = 0; i < 25000; i++) {

gRandom->Rannor(px,py);

Float_t random = gRandom->Rndm(1);

hpx->Fill(px);

}

hpx->Sumw2();

hpx->Fit(“f1”,“emr”);

hpx->Draw();

cout<GetParameter(1)<<endl;

cout<GetParameter(2)<<endl;

Thanks!

- Sujeewa