29 Double_t upp[5] = { 10, 10, 10, 10, 1 };
30 Double_t low[5] = { 0, 0, 0, 0, .1 };
31 for (
int i = 0; i < 4; i++)
32 x[i] = (upp[i] - low[i]) *
gRandom->
Rndm() + low[i];
34 d = x[0] *
TMath::Sqrt(x[1] * x[1] + x[2] * x[2] + x[3] * x[3]);
46 double GoodCoeffsNoFit[] = {
71 double GoodCoeffs[] = {
124 if (nc != 21)
return 1;
127 for (
Int_t i=0;i<nc;i++) {
132 if (
TMath::Abs((*coeffs)[i] - GoodCoeffsNoFit[i]) > 5e-5)
return 2;
134 for (
Int_t j=0;j<nv;j++) {
135 if (powers[pindex[i]*nv+j] != GoodPower[k])
return 3;
141 gROOT->ProcessLine(
".L MDF.C");
143 Double_t refMDF = (doFit) ? 43.95 : 43.98;
148 Long_t iret =
gROOT->ProcessLine(
" Double_t xvalues[] = {5,5,5,5}; double result=MDF(xvalues); &result;");
151 if (
TMath::Abs(rMDF -refMDF) > 1e-2)
return 4;
156 Int_t multidimfit(
bool doFit =
true)
159 cout <<
"*************************************************" << endl;
160 cout <<
"* Multidimensional Fit *" << endl;
161 cout <<
"* *" << endl;
162 cout <<
"* By Christian Holm <cholm@nbi.dk> 14/10/00 *" << endl;
163 cout <<
"*************************************************" << endl;
180 Int_t mPowers[] = { 6 , 6, 6, 6 };
197 printf(
"======================================\n");
201 for (i = 0; i < nData ; i++) {
226 for (i = 0; i < nVars; i++) {
235 for (i = 0; i < nData ; i++) {
239 for (j = 0; j < nVars; j++)
240 if (x[j] < xMin[j] || x[j] > xMax[j])
268 Int_t compare = CompareResults(fit, doFit);
270 printf(
"\nmultidimfit .............................................. OK\n");
272 printf(
"\nmultidimfit .............................................. fails case %d\n",compare);
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 void Fit(Option_t *option="")
Try to fit the found parameterisation to the test sample.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void SetMaxPowers(const Int_t *powers)
Set the maximum power to be considered in the fit for each variable.
const Int_t * GetPowers() const
const TVectorD * GetMinVariables() const
void SetPowerLimit(Double_t limit=1e-3)
Set the user parameter for the function selection.
This is the base class for the ROOT Random number generators.
Int_t GetNCoefficients() const
void SetMinAngle(Double_t angle=1)
Set the min angle (in degrees) between a new candidate function and the subspace spanned by the previ...
void SetMaxAngle(Double_t angle=0)
Set the max angle (in degrees) between the initial data vector to be fitted, and the new candidate fu...
const TVectorD * GetCoefficients() const
virtual void AddRow(const Double_t *x, Double_t D, Double_t E=0)
Add a row consisting of fNVariables independent variables, the known, dependent quantity, and optionally, the square error in the dependent quantity, to the training sample to be used for the parameterization.
const TVectorD * GetMaxVariables() const
void SetMaxTerms(Int_t terms)
virtual Double_t Rndm()
Machine independent random number generator.
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Int_t GetNVariables() const
virtual void Print(Option_t *option="ps") const
Print statistics etc.
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
Write memory objects to this file.
Multidimensional Fits in ROOT.
virtual void FindParameterization(Option_t *option="")
Find the parameterization.
Int_t * GetPowerIndex() const
R__EXTERN TRandom * gRandom
virtual void AddTestRow(const Double_t *x, Double_t D, Double_t E=0)
Add a row consisting of fNVariables independent variables, the known, dependent quantity, and optionally, the square error in the dependent quantity, to the test sample to be used for the test of the parameterization.
virtual void MakeHistograms(Option_t *option="A")
Make histograms of the result of the analysis.
void SetMinRelativeError(Double_t error)
Set the acceptable relative error for when sum of square residuals is considered minimized.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual void MakeCode(const char *functionName="MDF", Option_t *option="")
Generate the file <filename> with .C appended if argument doesn't end in .cxx or .C.
Double_t Sqrt(Double_t x)
void SetMaxStudy(Int_t n)
void SetMaxFunctions(Int_t n)
virtual void Close(Option_t *option="")
Close a file.