29 double *
x=
new double[
n*10*5];
30 double *
y=
new double[
n*10];
31 double *
e=
new double[
n*10];
35 x[0 + i*5] = randNum.
Uniform(-10, 10);
36 x[1 + i*5] = randNum.
Uniform(-10, 10);
37 x[2 + i*5] = randNum.
Uniform(-10, 10);
38 x[3 + i*5] = randNum.
Uniform(-10, 10);
39 x[4 + i*5] = randNum.
Uniform(-10, 10);
41 y[i] = 4*
x[0+i*5] +
x[1+i*5] + 2*
x[2+i*5] + 3*
x[3+i*5] + 0.2*
x[4+i*5] + randNum.
Gaus()*
e[i];
56 for (
int i=0; i<6; i++)
57 printf(
"par[%d]=%f+-%f\n", i, params(i), errors(i));
59 printf(
"chisquare=%f\n", chisquare);
63 for (i=
n; i<
n*2; i++) {
70 y[i] = 4*
x[0+i*5] +
x[1+i*5] + 2*
x[2+i*5] + 3*
x[3+i*5] + 0.2*
x[4+i*5] + randNum.
Gaus()*
e[i];
78 printf(
"\nMore Points:\n");
79 for (
int i=0; i<6; i++)
80 printf(
"par[%d]=%f+-%f\n", i, params(i), errors(i));
82 printf(
"chisquare=%.15f\n", chisquare);
93 printf(
"\nWithout Constant\n");
94 for (
int i=0; i<5; i++)
95 printf(
"par[%d]=%f+-%f\n", i, params(i), errors(i));
97 printf(
"chisquare=%f\n", chisquare);
106 printf(
"\nFixed Constant:\n");
108 printf(
"par[%d]=%f+-%f\n", i, params(i), errors(i));
110 printf(
"chisquare=%.15f\n", chisquare);
virtual Double_t GetChisquare()
Get the Chisquare.
virtual void GetErrors(TVectorD &vpar)
Returns parameter errors.
virtual Int_t Eval()
Perform the fit and evaluate the parameters Returns 0 if the fit is ok, 1 if there are errors.
virtual void AssignData(Int_t npoints, Int_t xncols, Double_t *x, Double_t *y, Double_t *e=nullptr)
This function is to use when you already have all the data in arrays and don't want to copy them into...
virtual void GetParameters(TVectorD &vpar)
Returns parameter values.
void FixParameter(Int_t ipar) override
Fixes paramter #ipar at its current value.
virtual void SetFormula(const char *formula)
Additive parts should be separated by "++".
This is the base class for the ROOT Random number generators.
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...
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).