More curve fitting problems

Hi all,

I’ve been working on this for a while, and I simply can’t fit a gaussian curve to my histogram. Every time I play with the parameters and tweak it, the function seems to arbitrarily either just go to y=0, a single cycle of a square wave with a maximum at 10^30, or a very poor fit–usually, when I do actually get a gaussian curve, the peak is a little to the right and it’s too narrow.

By the way, the peak(Double_t x) function returns a predetermined lorentzian distribution for the peak on the left side of the curve. It fits very well.

Here is my histogram: slac.stanford.edu/~dneumann/500bins.pdf

Double_t gaussian(Double_t *x, Double_t *par){ if(x[0]<.5) { TF1::RejectPoint(); return 0; } return peak(x[0]) + TMath::Gaus(x[0],par[0],par[1]); }

Any ideas?[/code]

use standard gaus fit implementation, never failed for me.

histogram->Fit(“gaus”);