26void makeData(
double*
x,
double&
d,
double&
e)
29 double upp[5] = { 10, 10, 10, 10, 1 };
30 double low[5] = { 0, 0, 0, 0, .1 };
31 for (
int i = 0;
i < 4;
i++)
46 double GoodCoeffsNoFit[] = {
71 double GoodCoeffs[] = {
120 int nc =
fit->GetNCoefficients();
121 int nv =
fit->GetNVariables();
122 const int *powers =
fit->GetPowers();
123 const int *pindex =
fit->GetPowerIndex();
124 if (nc != 21)
return 1;
127 for (
int i=0;
i<nc;
i++) {
132 if (
TMath::Abs((*coeffs)[
i] - GoodCoeffsNoFit[
i]) > 5
e-5)
return 2;
134 for (
int j=0;j<nv;j++) {
135 if (powers[pindex[
i]*nv+j] != GoodPower[k])
return 3;
141 gROOT->ProcessLine(
".L MDF.C");
143 double refMDF = (doFit) ? 43.95 : 43.98;
148 std::intptr_t iret =
gROOT->ProcessLine(
" double xvalues[] = {5,5,5,5}; double result=MDF(xvalues); &result;");
149 double rMDF = * ( (
double*)iret);
156int multidimfit(
bool doFit =
true)
159 std::cout <<
"*************************************************" << std::endl;
160 std::cout <<
"* Multidimensional Fit *" << std::endl;
161 std::cout <<
"* *" << std::endl;
162 std::cout <<
"* By Christian Holm <cholm@nbi.dk> 14/10/00 *" << std::endl;
163 std::cout <<
"*************************************************" << std::endl;
164 std::cout << std::endl;
180 int mPowers[] = { 6 , 6, 6, 6 };
181 fit->SetMaxPowers(mPowers);
182 fit->SetMaxFunctions(1000);
183 fit->SetMaxStudy(1000);
184 fit->SetMaxTerms(30);
185 fit->SetPowerLimit(1);
186 fit->SetMinAngle(10);
187 fit->SetMaxAngle(10);
188 fit->SetMinRelativeError(.01);
197 printf(
"======================================\n");
201 for (
i = 0;
i < nData ;
i++) {
214 fit->MakeHistograms();
217 fit->FindParameterization();
224 double *xMax =
new double[nVars];
225 double *xMin =
new double[nVars];
226 for (
i = 0;
i < nVars;
i++) {
227 xMax[
i] = (*
fit->GetMaxVariables())(
i);
228 xMin[
i] = (*
fit->GetMinVariables())(
i);
231 nData =
fit->GetNCoefficients() * 100;
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 compare = CompareResults(fit, doFit);
270 printf(
"\nmultidimfit .............................................. OK\n");
272 printf(
"\nmultidimfit .............................................. fails case %d\n",compare);
R__EXTERN TRandom * gRandom
TVectorT< Double_t > TVectorD
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Multidimensional Fits in ROOT.
This is the base class for the ROOT Random number generators.
fit(model, train_loader, val_loader, num_epochs, batch_size, optimizer, criterion, save_best, scheduler)
Double_t Sqrt(Double_t x)
Returns the square root of x.
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Comparing floating points.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.