401#define RADDEG (180. / TMath::Pi())
402#define DEGRAD (TMath::Pi() / 180.)
411#define PARAM_MAXSTUDY 1
412#define PARAM_SEVERAL 2
413#define PARAM_RELERR 3
414#define PARAM_MAXTERMS 4
419static void mdfHelper(
int&,
double*,
double&,
double*,
int);
510:
TNamed(
"multidimfit",
"Multi-dimensional fit object"),
513fVariables(dimension*100),
514fMeanVariables(dimension),
515fMaxVariables(dimension),
516fMinVariables(dimension)
524 fSumSqAvgQuantity = 0;
526 fNVariables = dimension;
533 fMinRelativeError = 0.01;
534 fMaxPowers =
new Int_t[dimension];
538 fFunctionCodes =
nullptr;
542 fMaxPowersFinal =
new Int_t[dimension];
544 fPowerIndex =
nullptr;
555 fParameterisationCode = 0;
561 fCorrelationCoeff = 0;
562 fTestCorrelationCoeff = 0;
564 fHistograms =
nullptr;
571 fShowCorrelation =
kFALSE;
724 Warning(
"AddTestRow",
"variable %d (row: %d) too large: %f > %f",
727 Warning(
"AddTestRow",
"variable %d (row: %d) too small: %f < %f",
741 while ((
h = (TH1*)next()))
742 b->Add(
h,
h->GetName());
831 for (i = 0; i <
n; i++) {
834 for (j = 0; j <
m; j++)
924 returnValue += term*term;
927 returnValue =
sqrt(returnValue);
942 s += (epsilon + iv[i] - 1) / (epsilon +
fMaxPowers[i] - 1);
968 for (i = 3; i <= p; i++) {
971 p3 = ((2 * i - 3) * p2 *
x - (i - 2) * p1) / (i - 1);
973 p3 = 2 *
x * p2 - p1;
1029 sumSqR += res * res;
1031 ((TH1D*)
fHistograms->FindObject(
"res_test"))->Fill(res);
1039 TString opt(option);
1046 Warning(
"Fit",
"test sample is very small");
1049 Error(
"Fit",
"invalid option");
1056 Error(
"Fit",
"Cannot create Fitter");
1062 const Int_t maxArgs = 16;
1066 fFitter->ExecuteCommand(
"SET PRINT",arglist,args);
1072 startVal, startErr, 0, 0);
1078 fFitter->ExecuteCommand(
"MIGRAD",arglist,args);
1085 fFitter->GetParameter(i, namebuf,
1086 val,
err, low, high);
1131 Int_t numberFunctions = 0;
1151 control[numberFunctions-1] =
Int_t(1.0e+6*s);
1175 for (j = 0; j < i; j++)
1206 if (control[j] <=
x) {
1214 control[k] = control[i];
1216 order[k] = order[i];
1292 TString outName(filename);
1293 if (!outName.EndsWith(
".C") && !outName.EndsWith(
".cxx"))
1320 for (j = 0; j <= i; j++) {
1323 curvatureMatrix(i,j) +=
1325 curvatureMatrix(j,i) = curvatureMatrix(i,j);
1341 curvatureMatrix.NormByDiag(diag);
1343 TDecompChol chol(curvatureMatrix);
1344 if (!chol.Decompose())
1345 Error(
"MakeCoefficientErrors",
"curvature matrix is singular");
1346 chol.Invert(curvatureMatrix);
1348 curvatureMatrix.NormByDiag(diag);
1367 Int_t col = 0, row = 0;
1371 for (row = col - 1; row > -1;
row--) {
1373 for (i = row; i <= col ; i++)
1473 for (j = 0; j < i; j++) {
1598 TString opt(option);
1625 fHistograms->Add(
new TH1D(
"d_orig",
"Original Quantity",
1643 fHistograms->Add(
new TH1D(
"d_shifted",
"Shifted Quantity",
1666 "Computed residuals vs Quantity",
1680 "Computed residuals over training sample",
1689 "Distribution of residuals from test",
1870 std::cout <<
"Coeff SumSqRes Contrib Angle QM Func"
1871 <<
" Value W^2 Powers" << std::endl;
1876 if (dResidur == 0) {
1905 squareResidual -= dResidur;
1919 << std::setw(10) << std::setprecision(4) << squareResidual <<
" "
1920 << std::setw(10) << std::setprecision(4) << dResidur <<
" "
1921 << std::setw(7) << std::setprecision(3) <<
fMaxAngle <<
" "
1922 << std::setw(7) << std::setprecision(3) << s <<
" "
1923 << std::setw(5) << i <<
" "
1924 << std::setw(10) << std::setprecision(4)
1926 << std::setw(10) << std::setprecision(4)
1931 std::cout << std::endl;
1963 const char *classname,
1970 const char *cv_qual = isMethod ?
"" :
"static ";
1972 prefix.
Form(
"%s::", classname);
1974 std::ofstream outFile(filename,std::ios::out|std::ios::trunc);
1976 Error(
"MakeRealCode",
"couldn't open output file '%s'",filename);
1981 std::cout <<
"Writing on file \"" << filename <<
"\" ... " << std::flush;
1986 outFile <<
"// -*- mode: c++ -*-" << std::endl;
1988 outFile <<
"// " << std::endl
1989 <<
"// File " << filename
1990 <<
" generated by TMultiDimFit::MakeRealCode" << std::endl;
1993 outFile <<
"// on " << date.
AsString() << std::endl;
1995 outFile <<
"// ROOT version " <<
gROOT->GetVersion()
1996 << std::endl <<
"//" << std::endl;
1998 outFile <<
"// This file contains the function " << std::endl
1999 <<
"//" << std::endl
2000 <<
"// double " << prefix <<
"MDF(double *x); " << std::endl
2001 <<
"//" << std::endl
2002 <<
"// For evaluating the parameterization obtained" << std::endl
2003 <<
"// from TMultiDimFit and the point x" << std::endl
2004 <<
"// " << std::endl
2005 <<
"// See TMultiDimFit class documentation for more "
2006 <<
"information " << std::endl <<
"// " << std::endl;
2010 outFile <<
"#include \"" << classname <<
".h\"" << std::endl;
2015 outFile <<
"//" << std::endl
2016 <<
"// Static data variables" << std::endl
2017 <<
"//" << std::endl;
2018 outFile << cv_qual <<
"int " << prefix <<
"gNVariables = "
2020 outFile << cv_qual <<
"int " << prefix <<
"gNCoefficients = "
2022 outFile << cv_qual <<
"double " << prefix <<
"gDMean = "
2026 outFile <<
"// Assignment to mean vector." << std::endl;
2027 outFile << cv_qual <<
"double " << prefix
2028 <<
"gXMean[] = {" << std::endl;
2030 outFile << (i != 0 ?
", " :
" ") <<
fMeanVariables(i) << std::flush;
2031 outFile <<
" };" << std::endl << std::endl;
2034 outFile <<
"// Assignment to minimum vector." << std::endl;
2035 outFile << cv_qual <<
"double " << prefix
2036 <<
"gXMin[] = {" << std::endl;
2038 outFile << (i != 0 ?
", " :
" ") <<
fMinVariables(i) << std::flush;
2039 outFile <<
" };" << std::endl << std::endl;
2042 outFile <<
"// Assignment to maximum vector." << std::endl;
2043 outFile << cv_qual <<
"double " << prefix
2044 <<
"gXMax[] = {" << std::endl;
2046 outFile << (i != 0 ?
", " :
" ") <<
fMaxVariables(i) << std::flush;
2047 outFile <<
" };" << std::endl << std::endl;
2050 outFile <<
"// Assignment to coefficients vector." << std::endl;
2051 outFile << cv_qual <<
"double " << prefix
2052 <<
"gCoefficient[] = {" << std::flush;
2054 outFile << (i != 0 ?
"," :
"") << std::endl
2056 outFile << std::endl <<
" };" << std::endl << std::endl;
2059 outFile <<
"// Assignment to error coefficients vector." << std::endl;
2060 outFile << cv_qual <<
"double " << prefix
2061 <<
"gCoefficientRMS[] = {" << std::flush;
2063 outFile << (i != 0 ?
"," :
"") << std::endl
2065 outFile << std::endl <<
" };" << std::endl << std::endl;
2068 outFile <<
"// Assignment to powers vector." << std::endl
2069 <<
"// The powers are stored row-wise, that is" << std::endl
2070 <<
"// p_ij = " << prefix
2071 <<
"gPower[i * NVariables + j];" << std::endl;
2072 outFile << cv_qual <<
"int " << prefix
2073 <<
"gPower[] = {" << std::flush;
2076 if (j != 0) outFile << std::flush <<
" ";
2077 else outFile << std::endl <<
" ";
2083 outFile << std::endl <<
"};" << std::endl << std::endl;
2089 outFile <<
"// " << std::endl
2091 << (isMethod ?
"method " :
"function ")
2092 <<
" double " << prefix
2094 << std::endl <<
"// " << std::endl;
2095 outFile <<
"double " << prefix
2096 <<
"MDF(double *x) {" << std::endl
2097 <<
" double returnValue = " << prefix <<
"gDMean;" << std::endl
2098 <<
" int i = 0, j = 0, k = 0;" << std::endl
2099 <<
" for (i = 0; i < " << prefix <<
"gNCoefficients ; i++) {"
2101 <<
" // Evaluate the ith term in the expansion" << std::endl
2102 <<
" double term = " << prefix <<
"gCoefficient[i];"
2104 <<
" for (j = 0; j < " << prefix <<
"gNVariables; j++) {"
2106 <<
" // Evaluate the polynomial in the jth variable." << std::endl
2107 <<
" int power = "<< prefix <<
"gPower["
2108 << prefix <<
"gNVariables * i + j]; " << std::endl
2109 <<
" double p1 = 1, p2 = 0, p3 = 0, r = 0;" << std::endl
2110 <<
" double v = 1 + 2. / ("
2111 << prefix <<
"gXMax[j] - " << prefix
2112 <<
"gXMin[j]) * (x[j] - " << prefix <<
"gXMax[j]);" << std::endl
2113 <<
" // what is the power to use!" << std::endl
2114 <<
" switch(power) {" << std::endl
2115 <<
" case 1: r = 1; break; " << std::endl
2116 <<
" case 2: r = v; break; " << std::endl
2117 <<
" default: " << std::endl
2118 <<
" p2 = v; " << std::endl
2119 <<
" for (k = 3; k <= power; k++) { " << std::endl
2120 <<
" p3 = p2 * v;" << std::endl;
2122 outFile <<
" p3 = ((2 * k - 3) * p2 * v - (k - 2) * p1)"
2123 <<
" / (k - 1);" << std::endl;
2125 outFile <<
" p3 = 2 * v * p2 - p1; " << std::endl;
2126 outFile <<
" p1 = p2; p2 = p3; " << std::endl <<
" }" << std::endl
2127 <<
" r = p3;" << std::endl <<
" }" << std::endl
2128 <<
" // multiply this term by the poly in the jth var" << std::endl
2129 <<
" term *= r; " << std::endl <<
" }" << std::endl
2130 <<
" // Add this term to the final result" << std::endl
2131 <<
" returnValue += term;" << std::endl <<
" }" << std::endl
2132 <<
" return returnValue;" << std::endl <<
"}" << std::endl << std::endl;
2135 outFile <<
"// EOF for " << filename << std::endl;
2141 std::cout <<
"done" << std::endl;
2167 std::cout <<
"User parameters:" << std::endl
2168 <<
"----------------" << std::endl
2171 <<
" Max Terms: " <<
fMaxTerms << std::endl
2172 <<
" Power Limit Parameter: " <<
fPowerLimit << std::endl
2174 <<
" Max functions to study: " <<
fMaxStudy << std::endl
2175 <<
" Max angle (optional): " <<
fMaxAngle << std::endl
2176 <<
" Min angle: " <<
fMinAngle << std::endl
2178 <<
" Maximum Powers: " << std::flush;
2180 std::cout <<
" " <<
fMaxPowers[i] - 1 << std::flush;
2181 std::cout << std::endl << std::endl
2182 <<
" Parameterisation will be done using " << std::flush;
2184 std::cout <<
"Chebyshev polynomials" << std::endl;
2186 std::cout <<
"Legendre polynomials" << std::endl;
2188 std::cout <<
"Monomials" << std::endl;
2189 std::cout << std::endl;
2194 std::cout <<
"Sample statistics:" << std::endl
2195 <<
"------------------" << std::endl
2196 <<
" D" << std::flush;
2198 std::cout <<
" " << std::setw(10) << i+1 << std::flush;
2199 std::cout << std::endl <<
" Max: " << std::setw(10) << std::setprecision(7)
2202 std::cout <<
" " << std::setw(10) << std::setprecision(4)
2204 std::cout << std::endl <<
" Min: " << std::setw(10) << std::setprecision(7)
2207 std::cout <<
" " << std::setw(10) << std::setprecision(4)
2209 std::cout << std::endl <<
" Mean: " << std::setw(10) << std::setprecision(7)
2212 std::cout <<
" " << std::setw(10) << std::setprecision(4)
2214 std::cout << std::endl <<
" Function Sum Squares: " <<
fSumSqQuantity
2215 << std::endl << std::endl;
2219 std::cout <<
"Results of Parameterisation:" << std::endl
2220 <<
"----------------------------" << std::endl
2221 <<
" Total reduction of square residuals "
2223 <<
" Relative precision obtained: "
2225 <<
" Error obtained: "
2227 <<
" Multiple correlation coefficient: "
2229 <<
" Reduced Chi square over sample: "
2231 <<
" Maximum residual value: "
2233 <<
" Minimum residual value: "
2235 <<
" Estimated root mean square: "
2236 <<
fRMS << std::endl
2237 <<
" Maximum powers used: " << std::flush;
2240 std::cout << std::endl
2241 <<
" Function codes of candidate functions." << std::endl
2242 <<
" 1: considered,"
2243 <<
" 2: too little contribution,"
2244 <<
" 3: accepted." << std::flush;
2247 std::cout << std::endl <<
" " << std::flush;
2248 else if (i % 10 == 0)
2249 std::cout <<
" " << std::flush;
2252 std::cout << std::endl <<
" Loop over candidates stopped because " << std::flush;
2255 std::cout <<
"max allowed studies reached" << std::endl;
break;
2257 std::cout <<
"all candidates considered several times" << std::endl;
break;
2259 std::cout <<
"wanted relative error obtained" << std::endl;
break;
2261 std::cout <<
"max number of terms reached" << std::endl;
break;
2263 std::cout <<
"some unknown reason" << std::endl;
2266 std::cout << std::endl;
2270 std::cout <<
"Results of Fit:" << std::endl
2271 <<
"---------------" << std::endl
2272 <<
" Test sample size: "
2274 <<
" Multiple correlation coefficient: "
2276 <<
" Relative precision obtained: "
2278 <<
" Error obtained: "
2280 <<
" Reduced Chi square over sample: "
2285 std::cout << std::endl;
2290 std::cout <<
"Coefficients:" << std::endl
2291 <<
"-------------" << std::endl
2292 <<
" # Value Error Powers" << std::endl
2293 <<
" ---------------------------------------" << std::endl;
2295 std::cout <<
" " << std::setw(3) << i <<
" "
2299 std::cout <<
" " << std::setw(3)
2301 std::cout << std::endl;
2303 std::cout << std::endl;
2306 std::cout <<
"Correlation Matrix:" << std::endl
2307 <<
"-------------------";
2312 std::cout <<
"Parameterization:" << std::endl
2313 <<
"-----------------" << std::endl
2314 <<
" Normalised variables: " << std::endl;
2316 std::cout <<
"\ty_" << i <<
"\t= 1 + 2 * (x_" << i <<
" - "
2320 std::cout << std::endl
2323 std::cout <<
"y_" << i;
2326 std::cout <<
") = ";
2329 std::cout << std::endl <<
"\t" << (
fCoefficients(i) < 0 ?
"- " :
"+ ")
2337 case 2: std::cout <<
" * y_" << j;
break;
2340 case kLegendre: std::cout <<
" * L_" << p-1 <<
"(y_" << j <<
")";
break;
2341 case kChebyshev: std::cout <<
" * C_" << p-1 <<
"(y_" << j <<
")";
break;
2342 default: std::cout <<
" * y_" << j <<
"^" << p-1;
break;
2348 std::cout << std::endl;
2378 if (ang >= 90 || ang < 0) {
2379 Warning(
"SetMaxAngle",
"angle must be in [0,90)");
2394 if (ang > 90 || ang <= 0) {
2395 Warning(
"SetMinAngle",
"angle must be in [0,90)");
2499 double* coeffs,
int )
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
char Char_t
Character 1 byte (char).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char).
TMatrixTSym< Double_t > TMatrixDSym
TMatrixTRow< Double_t > TMatrixDRow
TMatrixTDiag_const< Double_t > TMatrixDDiag_const
void mdfHelper(int &, double *, double &chi2, double *coeffs, int)
Helper function for doing the minimisation of Chi2 using Minuit.
TVectorT< Double_t > TVectorD
Using a TBrowser one can browse all ROOT objects.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
const char * AsString() const
Return the date & time as a string (ctime() format).
Multidimensional Fits in ROOT.
void Print(Option_t *option="ps") const override
Print statistics etc. Options are P Parameters S Statistics C Coefficients R Result of parameterisati...
static TMultiDimFit * Instance()
TVectorD fCoefficients
Vector of the final coefficients.
Double_t fPrecision
Relative precision of param.
Byte_t fHistogramMask
Bit pattern of histograms used.
static TMultiDimFit * fgInstance
TMatrixD fOrthCurvatureMatrix
Model matrix.
Bool_t fShowCorrelation
print correlation matrix
Bool_t fIsUserFunction
Flag for user defined function.
Int_t fNVariables
Number of independent variables.
virtual void MakeNormalized()
Int_t fMaxResidualRow
Row giving max residual.
virtual void MakeHistograms(Option_t *option="A")
Double_t fMinQuantity
Min value of dependent quantity.
Double_t fSumSqQuantity
SumSquare of dependent quantity.
TVectorD fMaxVariables
max value of independent variables
Int_t fSampleSize
Size of training sample.
Double_t fSumSqAvgQuantity
Sum of squares away from mean.
Int_t fMaxTerms
Max terms expected in final expr.
virtual Double_t EvalControl(const Int_t *powers) const
Int_t * fPowers
[fMaxFuncNV] where fMaxFuncNV = fMaxFunctions*fNVariables
virtual Double_t Eval(const Double_t *x, const Double_t *coeff=nullptr) const
Int_t * fMaxPowers
[fNVariables] maximum powers
Int_t fMaxStudy
max functions to study
TVectorD fTestQuantity
Test sample, dependent quantity.
TVectorD fTestSqError
Test sample, Error in quantity.
Int_t fMaxFunctions
max number of functions
Int_t fBinVarY
Number of bin in dependent variables.
virtual void AddRow(const Double_t *x, Double_t D, Double_t E=0)
virtual void MakeMethod(const Char_t *className="MDF", Option_t *option="")
Double_t fTestError
Error from test.
Double_t fMinResidual
Min residual value.
void SetPowerLimit(Double_t limit=1e-3)
Set the user parameter for the function selection. The bigger the limit, the more functions are used....
TVectorD fSqError
Training sample, error in quantity.
TVectorD fQuantity
Training sample, dependent quantity.
TVectorD fTestVariables
Test sample, independent variables.
TVectorD fOrthCoefficients
The model coefficients.
Int_t fTestSampleSize
Size of test sample.
TVectorD fResiduals
Vector of the final residuals.
virtual Bool_t TestFunction(Double_t squareResidual, Double_t dResidur)
PRIVATE METHOD: Test whether the currently considered function contributes to the fit....
virtual void FindParameterization(Option_t *option="")
TVectorD fVariables
Training sample, independent variables.
Double_t fCorrelationCoeff
Multi Correlation coefficient.
void SetMaxPowers(const Int_t *powers)
Set the maximum power to be considered in the fit for each variable. See also class description.
Int_t * fMaxPowersFinal
[fNVariables] maximum powers from fit;
Int_t fMinResidualRow
Row giving min residual.
virtual void SetPowers(const Int_t *powers, Int_t terms)
Define a user function. The input array must be of the form (p11, ..., p1N, ... ,pL1,...
Double_t fMaxQuantity
Max value of dependent quantity.
virtual void MakeRealCode(const char *filename, const char *classname, Option_t *option="")
PRIVATE METHOD: This is the method that actually generates the code for the evaluation the parameteri...
Double_t fRMS
Root mean square of fit.
virtual void Fit(Option_t *option="")
TVirtualFitter * fFitter
! Fit object (MINUIT)
TMatrixD fFunctions
Functions evaluated over sample.
Int_t fParameterisationCode
Exit code of parameterisation.
Double_t fMaxAngle
Max angle for accepting new function.
Int_t fNCoefficients
Dimension of model coefficients.
Double_t fTestCorrelationCoeff
Multi Correlation coefficient.
Double_t fMinAngle
Min angle for accepting new function.
void SetMinRelativeError(Double_t error)
Set the acceptable relative error for when sum of square residuals is considered minimized....
Double_t fSumSqResidual
Sum of Square residuals.
TVectorD fMeanVariables
mean value of independent variables
virtual void MakeCoefficients()
virtual void MakeCandidates()
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 MakeCode(const char *functionName="MDF", Option_t *option="")
virtual Double_t EvalError(const Double_t *x, const Double_t *coeff=nullptr) const
Double_t fTestPrecision
Relative precision of test.
virtual void MakeParameterization()
TMatrixD fCorrelationMatrix
Correlation matrix.
virtual Double_t EvalFactor(Int_t p, Double_t x) const
Int_t * fPowerIndex
[fMaxTerms] Index of accepted powers
TMatrixD fOrthFunctions
As above, but orthogonalised.
virtual Double_t MakeChi2(const Double_t *coeff=nullptr)
void Clear(Option_t *option="") override
EMDFPolyType fPolyType
Type of polynomials to use.
void Browse(TBrowser *b) override
Browse object. May be overridden for another default action.
virtual Bool_t Select(const Int_t *iv)
Selection method. User can override this method for specialized selection of acceptable functions in ...
TList * fHistograms
List of histograms.
virtual void AddTestRow(const Double_t *x, Double_t D, Double_t E=0)
Double_t fChi2
Chi square of fit.
Double_t fMaxResidual
Max residual value.
Double_t fError
Error from parametrization.
Int_t fBinVarX
Number of bin in independent variables.
virtual Double_t MakeGramSchmidt(Int_t function)
void SetMinAngle(Double_t angle=1)
Set the min angle (in degrees) between a new candidate function and the subspace spanned by the previ...
TVectorD fMinVariables
min value of independent variables
TVectorD fOrthFunctionNorms
Norm of the evaluated functions.
Double_t fMeanQuantity
Mean of dependent quantity.
TVectorD fCoefficientsRMS
Vector of RMS of coefficients.
Double_t fPowerLimit
Control parameter.
virtual void MakeCoefficientErrors()
Int_t fMaxFuncNV
fMaxFunctions*fNVariables
virtual void MakeCorrelation()
Double_t fMinRelativeError
Min relative error accepted.
Int_t * fFunctionCodes
[fMaxFunctions] acceptance code
The TNamed class is the base class for all named ROOT classes.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void ToLower()
Change string to lower-case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static TVirtualFitter * Fitter(TObject *obj, Int_t maxpar=25)
Static function returning a pointer to the current fitter.
void(off) SmallVectorTemplateBase< T
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
constexpr Double_t E()
Base of natural log: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
static uint64_t sum(uint64_t i)