22 Double_t upp[5] = { 10, 10, 10, 10, 1 };
23 Double_t low[5] = { 0, 0, 0, 0, .1 };
24 for (
int i = 0; i < 4; i++)
25 x[i] = (upp[i] - low[i]) *
gRandom->
Rndm() + low[i];
27 d = x[0] *
TMath::Sqrt(x[1] * x[1] + x[2] * x[2] + x[3] * x[3]);
39 double GoodCoeffsNoFit[] = {
64 double GoodCoeffs[] = {
117 if (nc != 21)
return 1;
120 for (
Int_t i=0;i<nc;i++) {
125 if (
TMath::Abs((*coeffs)[i] - GoodCoeffsNoFit[i]) > 5e-5)
return 2;
127 for (
Int_t j=0;j<nv;j++) {
128 if (powers[pindex[i]*nv+j] != GoodPower[k])
return 3;
134 gROOT->ProcessLine(
".L MDF.C");
141 Long_t iret =
gROOT->ProcessLine(
" Double_t x[] = {5,5,5,5}; double result=MDF(x); &result;");
144 if (
TMath::Abs(rMDF -refMDF) > 1e-2)
return 4;
152 cout <<
"*************************************************" << endl;
153 cout <<
"* Multidimensional Fit *" << endl;
154 cout <<
"* *" << endl;
155 cout <<
"* By Christian Holm <cholm@nbi.dk> 14/10/00 *" << endl;
156 cout <<
"*************************************************" << endl;
173 Int_t mPowers[] = { 6 , 6, 6, 6 };
190 printf(
"======================================\n");
194 for (i = 0; i < nData ; i++) {
219 for (i = 0; i < nVars; i++) {
228 for (i = 0; i < nData ; i++) {
232 for (j = 0; j < nVars; j++)
233 if (x[j] < xMin[j] || x[j] > xMax[j])
263 printf(
"\nmultidimfit .............................................. OK\n");
265 printf(
"\nmultidimfit .............................................. fails case %d\n",compare);
const TVectorD * GetCoefficients() const
Int_t multidimfit(bool doFit=true)
void doFit(int n, const char *fitter)
const TVectorD * GetMaxVariables() const
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
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.
void makeData(Double_t *x, Double_t &d, Double_t &e)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual void Print(Option_t *option="ps") const
Print statistics etc.
void SetMaxPowers(const Int_t *powers)
Set the maximum power to be considered in the fit for each variable.
int compare(double v1, double v2, const std::string &name="", double scale=1.0)
Int_t GetNVariables() const
Int_t GetNCoefficients() 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.
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...
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.
void SetMaxTerms(Int_t terms)
const TVectorD * GetMinVariables() const
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
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.
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.
const Int_t * GetPowers() const
void SetMinRelativeError(Double_t error)
Set the acceptable relative error for when sum of square residuals is considered minimized.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
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.
int CompareResults(TMultiDimFit *fit, bool doFit)
Double_t Sqrt(Double_t x)
static void output(int code)
void SetMaxStudy(Int_t n)
void SetMaxFunctions(Int_t n)
Int_t * GetPowerIndex() const
virtual void Close(Option_t *option="")
Close a file.