53 for (
int i = 0; i < 2; ++i)
57 for (
int i = 0; i < 5; ++i)
70 TH1D *
hB =
new TH1D(
"hB",
"histo B", 100, 0, 100);
71 TH1D *
hSB =
new TH1D(
"hSB",
"histo S+B", 100, 0, 100);
73 TF1 *fB =
new TF1(
"fB",
"expo", 0, 100);
77 TF1 *fS =
new TF1(
"fS",
"gaus", 0, 100);
80 hSB->FillRandom(
"fB", 2000);
81 hSB->FillRandom(
"fS", 1000);
85 TF1 *
fSB =
new TF1(
"fSB",
"expo + gaus(2)", 0, 100);
110 double par0[
Npar] = {5, 5, -0.1, 100, 30, 10};
115 fitter.
Config().ParSettings(4).Fix();
117 fitter.
Config().ParSettings(2).SetLimits(-10, -1.E-4);
118 fitter.
Config().ParSettings(3).SetLimits(0, 10000);
119 fitter.
Config().ParSettings(3).SetStepSize(5);
121 fitter.
Config().MinimizerOptions().SetPrintLevel(0);
122 fitter.
Config().SetMinimizer(
"Minuit2",
"Migrad");
130 std::cout <<
"Combined fit Chi2 = " <<
result.Chi2() << std::endl;
132 TCanvas *
c1 =
new TCanvas(
"Simfit",
"Simultaneous fit of two histograms", 10, 10, 700, 700);
140 hB->GetListOfFunctions()->Add(fB);
147 hSB->GetListOfFunctions()->Add(
fSB);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
TRObject operator()(const T1 &t1) const
R__EXTERN TStyle * gStyle
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
class describing the range in the coordinates it supports multiple range in a coordinate.
class containing the result of the fit and all the related information (fitted parameter values,...
Fitter class, entry point for performing all type of fits.
const FitResult & Result() const
get fit result
bool FitFCN(unsigned int npar, Function &fcn, const double *params=nullptr, unsigned int dataSize=0, int fitType=0)
Fit using the a generic FCN function as a C++ callable object implementing double () (const double *)...
const FitConfig & Config() const
access to the fit configuration (const method)
Documentation for the abstract class IBaseFunctionMultiDim.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
virtual void SetParameters(const Double_t *params)
virtual void SetFitResult(const ROOT::Fit::FitResult &result, const Int_t *indpar=nullptr)
Set the result from the fit parameter values, errors, chi2, etc... Optionally a pointer to a vector (...
1-D histogram with a double per channel (see TH1 documentation)
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
void FillData(BinData &dv, const TH1 *hist, TF1 *func=nullptr)
fill the data vector from a TH1.
DataOptions : simple structure holding the options on how the data are filled.