//////////////////////////////////////////////////////////////////////////
// //
// GFFuncs //
// //
// Creator of TF1 //
// //
//////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "TF1.h"
#include "GFFuncs.h"
ClassImp(GFFuncs)
TF1* GFFuncs::CreateGaus(const char* name, Double_t xmin, Double_t xmax)
{
// normalised (!!!) gaus function
// sqrt(2pi) = 2.50662827463100024
TF1* f = new TF1(name, "[0]/(2.50662827463100024*[2]) * exp(-(x-[1])*(x-[1])/(2*[2]*[2]))",
xmin, xmax);
f->SetParameters(1., 0., 1.); // set 'normalised' start values...
f->SetParNames("N*binwidth", "#mu", "#sigma");
return f;
}
TF1* GFFuncs::CreateDiGaus(const char* name, Double_t xmin, Double_t xmax)
{
// overlay of two normalised gaus functions (6 params)
// sqrt(2pi) = 2.50662827463100024
TF1* f = new TF1(name, "[0]*[3]/(2.50662827463100024*[2])* exp(-(x-[1])*(x-[1])/(2*[2]*[2]))"
"+[0]*(1-[3])/(2.50662827463100024*[5]) * exp(-(x-[4])*(x-[4])/(2*[5]*[5]))",
xmin, xmax);
f->SetParameters(1., 0., 1., 1., 0., 0.3); // set some start values...
f->SetParNames("N*binwidth", "#mu_{1}", "#sigma_{1}",
"frac_{1}", "#mu_{2}", "#sigma_{2}");
return f;
}
TF1* GFFuncs::CreateDiGaus1Mean(const char* name, Double_t xmin, Double_t xmax)
{
// overlay of two normalised gaus functions with same mean, i.e. 5 params
// sqrt(2pi) = 2.50662827463100024
TF1* f = new TF1(name, "[0]*[3]/(2.50662827463100024*[2])* exp(-(x-[1])*(x-[1])/(2*[2]*[2]))"
"+[0]*(1-[3])/(2.50662827463100024*[4]) * exp(-(x-[1])*(x-[1])/(2*[4]*[4]))",
xmin, xmax);
f->SetParameters(1., 0., 1., 1., 0.3); // set some start values...
f->SetParNames("N*binwidth", "#mu", "#sigma_{1}", "frac_{1}", "#sigma_{2}");
return f;
}
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.