48 fChi2_1(&f1), fChi2_2(&f2) {}
52 double operator() (
const double *
par)
const {
54 for (
int i = 0; i < 2; ++i) p1[i] = par[iparB[i] ];
57 for (
int i = 0; i < 5; ++i) p2[i] = par[iparSB[i] ];
59 return (*fChi2_1)(
p1) + (*fChi2_2)(
p2);
68 TH1D * hB =
new TH1D(
"hB",
"histo B",100,0,100);
69 TH1D * hSB =
new TH1D(
"hSB",
"histo S+B",100, 0,100);
71 TF1 * fB =
new TF1(
"fB",
"expo",0,100);
75 TF1 * fS =
new TF1(
"fS",
"gaus",0,100);
83 TF1 * fSB =
new TF1(
"fSB",
"expo + gaus(2)",0,100);
103 GlobalChi2 globalChi2(chi2_B, chi2_SB);
108 double par0[Npar] = { 5,5,-0.1,100, 30,10};
124 fitter.
FitFCN(6,globalChi2,0,dataB.Size()+dataSB.Size(),
true);
126 result.
Print(std::cout);
virtual void SetParameters(const Double_t *params)
void SetPrintLevel(int level)
set print level
Class to Wrap a ROOT Function class (like TF1) in a IParamMultiFunction interface of multi-dimensions...
R__EXTERN TStyle * gStyle
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
bool FitFCN(unsigned int npar, Function &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
Fit using the a generic FCN function as a C++ callable object implementing double () (const double *)...
ROOT::Math::MinimizerOptions & MinimizerOptions()
access to the minimizer control parameter (non const method)
const ParameterSettings & ParSettings(unsigned int i) const
get the parameter settings for the i-th parameter (const method)
const FitResult & Result() const
get fit result
static double p2(double t, double a, double b, double c)
void Fix()
fix the parameter
const FitConfig & Config() const
access to the fit configuration (const method)
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Chi2FCN class for binnned fits using the least square methods.
void SetMinimizer(const char *type, const char *algo=0)
set minimizer type
void SetStepSize(double err)
set the step size
void FillData(BinData &dv, const TH1 *hist, TF1 *func=0)
fill the data vector from a TH1.
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
DataOptions : simple structure holding the options on how the data are filled.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
void SetRange(unsigned int icoord, double xmin, double xmax)
set a range [xmin,xmax] for the new coordinate icoord If more range exists for other coordinates...
Fitter class, entry point for performing all type of fits.
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
static double p1(double t, double a, double b)
tomato 1-D histogram with a double per channel (see TH1 documentation)}
class containg the result of the fit and all the related information (fitted parameter values...
class describing the range in the coordinates it supports multiple range in a coordinate.
void Print(std::ostream &os, bool covmat=false) const
print the result and optionaly covariance matrix and correlations
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
virtual void Add(TObject *obj)
double f2(const double *x)
void SetParamsSettings(unsigned int npar, const double *params, const double *vstep=0)
set the parameter settings from number of parameters and a vector of values and optionally step value...
virtual void SetFitResult(const ROOT::Fit::FitResult &result, const Int_t *indpar=0)
Set the result from the fit parameter values, errors, chi2, etc...
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
void SetLimits(double low, double up)
set a double side limit, if low == up the parameter is fixed if low > up the limits are removed ...
Documentation for the abstract class IBaseFunctionMultiDim.
TList * GetListOfFunctions() const