Quoting Rene Brun <brun@pcbrun.cern.ch>: > Hi Karoly, > > In attachement, a small script peaks.C > This script: > - generate a histogram with a variable number of peaks (here 8) > - Use the TSpectrum class as a peak finder > - Compute the initial parameters > - Fit > > Rene Brun > Thank for the script. But my problem is that my gaussians are _overlapped_ ( for example 3 gaussians ... Double_t fun0(Double_t *x, Double_t *par) { Double_t arg1 = 0; if ( par[2] ) { arg1 = ( x[0] - par[1] ) / par[2]; } Double_t val = par[0] * TMath::Exp( kTH * arg1 * arg1 ) * x[0] * x[0] ; return val; } Double_t Total(Double_t *x, Double_t *par) { Double_t tot = fun0(x, par) + fun0(x, &par[3]) + fun0(x, &par[6]); return tot; } void create(){ int npar = 9; Double_t params[9] = {100, 2, 1, 100, 5, 1, 700, 8, 1}; TF1 *theory = new TF1("theory",Total,0,10,npar); theory->SetParameters(params); TH1F *Data = new TH1F("Data","Data sampled from theory",100,0,10); Data->FillRandom("theory",1000000); } ) I would need a strategy (or paper, keyword, ... ) to find the initial parameters in this case ( not only for 3 gaussinas ... ). Thanks, Karoly MAKONYI
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET