26 for (
int i = 0; i <
n; ++i) {
30 v[i] =
sin(x[i] ) +
cos(y[i]) + z[i] + r.
Gaus(0,ev);
36 for(
int i = 0; i <
n; ++i) {
41 data.
Add(xx, v[i], ev);
44 TF3 *
f3 =
new TF3(
"f3",
"[0] * sin(x) + [1] * cos(y) + [2] * z",0,10,0,10,0,10);
51 bool ret = fitter.
Fit(data);
59 double prob = res.
Prob();
61 Error(
"exampleFit3D",
"Bad data fit - fit p-value is %f",prob);
63 std::cout <<
"Good fit : p-value = " << prob << std::endl;
67 Error(
"exampleFit3D",
"3D fit failed");
virtual void SetParameters(const Double_t *params)
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Class to Wrap a ROOT Function class (like TF1) in a IParamMultiFunction interface of multi-dimensions...
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
const FitResult & Result() const
get fit result
void Error(const char *location, const char *msgfmt,...)
bool Fit(const Data &data, const Function &func)
fit a data set using any generic model function If data set is binned a least square fit is performed...
A 3-Dim function with parameters.
Fitter class, entry point for performing all type of fits.
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
double Prob() const
p value of the fit (chi2 probability)
void SetFunction(const IModelFunction &func, bool useGradient=false)
Set the fitted function (model function) from a parametric function interface.
class containg the result of the fit and all the related information (fitted parameter values...
void Add(double x, double y)
add one dim data with only coordinate and values
void Print(std::ostream &os, bool covmat=false) const
print the result and optionaly covariance matrix and correlations
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual void SetFitResult(const ROOT::Fit::FitResult &result, const Int_t *indpar=0)
Set the result from the fit parameter values, errors, chi2, etc...