Hi all,
I have to fit an histogram with the sum of two gaussian cumulative functions:
Double_t doubleerf( Double_t *x, Double_t *par ) {
Double_t val1, val2;
val1 = x[0]-par[0];
val1 /= TMath::Sqrt(2.);
if (par[1] != 0) {
val1 /= par[1];
}
val2 = x[0]-par[2];
val2 /= TMath::Sqrt(2.);
if (par[3] != 0) {
val2 /= par[3];
}
return 1./2.*(1.+TMath::Erf(val1))+1./2.*(1.+TMath::Erf(val2));
}
The fit works fine (see attached ps file).
The problem is the ‘order’ of the parameters: I have 2 means (par[0] & par[2]) and two
sigmas (par[1] & par[3]) and I would like that par[0] < par[2]. In this way I could plot a
meaningful distribution of the par[0] and par[2].
For the moment the workaround is to check if par[0] < par[2] and then fill the histograms
properly (means1 & means2).
But I would like to know if there is a way to force the fit to always have par[0] < par[2].
Many thanks in advance!
Marco
doubleErf.ps (152 KB)