40 return 3.14159265358979323846;
91 return 1.4142135623730950488016887242097;
99 return 2.71828182845904523536;
106 return 2.30258509299404568402;
113 return 0.43429448190325182765;
191 return 6.62606876e-34;
205 return 0.00000052e-34;
213 return 1.054571596e-34;
220 return 1.0e7 *
Hbar();
227 return 0.000000082e-34;
249 return 1.3806503e-23;
263 return 0.0000024e-23;
285 return 6.02214199e+23;
292 return 0.00000047e+23;
324 return (1000.0 *
R()) /
MWair();
331 return 0.577215664901532860606512090082402431042;
338 return 1.602176462e-19;
345 return 0.000000063e-19;
376 template <
typename T>
401 template <
typename T>
403 inline static T Min();
404 inline static T Max();
431 template <
typename Iterator> Iterator
LocMin(Iterator
first, Iterator last);
433 template <
typename Iterator> Iterator
LocMax(Iterator first, Iterator last);
438 template <
typename Iterator,
typename Element> Iterator
BinarySearch(Iterator first, Iterator last, Element value);
445 template <
typename Element,
typename Index>
447 template <
typename Iterator,
typename IndexIterator>
466 template <
typename T>
T *
Cross(
const T v1[3],
const T v2[3],
T out[3]);
472 template <
typename T>
inline T NormCross(
const T v1[3],
const T v2[3],
T out[3]);
475 template <
typename T>
T *
Normal2Plane(
const T v1[3],
const T v2[3],
const T v3[3],
T normal[3]);
517 template <
typename Iterator>
Double_t Mean(Iterator first, Iterator last);
518 template <
typename Iterator,
typename WeightIterator>
Double_t Mean(Iterator first, Iterator last, WeightIterator wfirst);
521 template <
typename Iterator>
Double_t GeomMean(Iterator first, Iterator last);
524 template <
typename Iterator>
Double_t RMS(Iterator first, Iterator last);
525 template <
typename Iterator,
typename WeightIterator>
Double_t RMS(Iterator first, Iterator last, WeightIterator wfirst);
528 template <
typename Iterator>
Double_t StdDev(Iterator first, Iterator last) {
return RMS<Iterator>(first,last); }
529 template <
typename Iterator,
typename WeightIterator>
Double_t StdDev(Iterator first, Iterator last, WeightIterator wfirst) {
return RMS<Iterator,WeightIterator>(first,last,wfirst); }
534 template <
class Element,
typename Size> Element
KOrdStat(
Size n,
const Element *a,
Size k,
Size *work = 0);
578 #if defined(R__WIN32) && !defined(__CINT__) 580 # define finite _finite 583 #if defined(R__AIX) || defined(R__SOLARIS_CC50) || \ 584 defined(R__HPUX11) || defined(R__GLIBC) || \ 585 (defined(R__MACOSX) ) 588 # ifdef R__SOLARIS_CC50 589 extern "C" {
int finite(
double); }
602 extern double sin(
double);
603 extern double cos(
double);
604 extern double tan(
double);
605 extern double sinh(
double);
606 extern double cosh(
double);
607 extern double tanh(
double);
608 extern double asin(
double);
609 extern double acos(
double);
610 extern double atan(
double);
611 extern double atan2(
double,
double);
612 extern double sqrt(
double);
613 extern double exp(
double);
614 extern double pow(
double,
double);
615 extern double log(
double);
616 extern double log10(
double);
618 # if !defined(finite) 619 extern int finite(
double);
622 extern int isnan(
double);
624 extern double ldexp(
double,
int);
625 extern double ceil(
double);
626 extern double floor(
double);
628 _CRTIMP
double ldexp(
double,
int);
629 _CRTIMP
double ceil(
double);
630 _CRTIMP
double floor(
double);
669 if (x > 1.)
return 0;
679 {
if (x != 0)
return atan2(y, x);
680 if (y == 0)
return 0;
681 if (y > 0)
return Pi()/2;
717 if ( i & 1 && x + 0.5 ==
T(i) ) i--;
720 if ( i & 1 && x - 0.5 ==
T(i) ) i++;
731 {
return ldexp(x, exp); }
747 {
return pow(x, y); }
771 #if defined(R__FAST_MATH) 774 const unsigned long long mask = 0x7FF0000000000000LL;
775 union {
unsigned long long l;
double d;}
v;
777 return (
v.l&mask)!=mask;
780 # if defined(R__HPUX11) 781 {
return isfinite(x); }
782 # elif defined(R__MACOSX) 785 {
return isfinite(x); }
788 {
return std::isfinite(x); }
800 #if defined(R__FAST_MATH) 803 const unsigned int mask = 0x7f800000;
804 union {
unsigned int l;
float d;}
v;
806 return (
v.l&mask)!=mask;
809 {
return std::isfinite(x); }
817 #if defined (R__FAST_MATH) 844 } ieee_double_shape_type;
846 #define EXTRACT_WORDS(ix0,ix1,d) \ 848 ieee_double_shape_type ew_u; \ 850 (ix0) = ew_u.parts.msw; \ 851 (ix1) = ew_u.parts.lsw; \ 858 EXTRACT_WORDS(hx, lx, x);
862 return (hx == 0x7ff00000) && (lx != 0);
868 } ieee_float_shape_type;
870 #define GET_FLOAT_WORD(i,d) \ 872 ieee_float_shape_type gf_u; \ 880 GET_FLOAT_WORD (wx, x);
882 return (
Bool_t)(wx > 0x7f800000);
885 #endif // End R__FAST_MATH 887 #if defined(R__FAST_MATH) 902 return std::numeric_limits<Double_t>::quiet_NaN();
908 return std::numeric_limits<Double_t>::signaling_NaN();
914 return std::numeric_limits<Double_t>::infinity();
921 return (std::numeric_limits<T>::min)();
928 return (std::numeric_limits<T>::max)();
950 template <
typename T>
952 return *std::min_element(a,a+n);
957 template <
typename T>
959 return *std::max_element(a,a+n);
970 template <
typename T>
972 if (n <= 0 || !a)
return -1;
987 template <
typename Iterator>
990 return std::min_element(first, last);
998 template <
typename T>
1000 if (n <= 0 || !a)
return -1;
1015 template <
typename Iterator>
1019 return std::max_element(first, last);
1022 template<
typename T>
1027 template<
typename Index>
1029 return *(fData + i1) > *(fData + i2);
1035 template<
typename T>
1040 template<
typename Index>
1042 return *(fData + i1) < *(fData + i2);
1050 template <
typename Iterator>
1055 while ( first != last )
1069 template <
typename Iterator,
typename WeightIterator>
1076 while ( first != last ) {
1078 ::Error(
"TMath::Mean",
"w[%d] = %.4e < 0 ?!",i,*w);
1081 sum += (*w) * (*first);
1088 ::Error(
"TMath::Mean",
"sum of weights == 0 ?!");
1097 template <
typename T>
1110 template <
typename Iterator>
1115 while ( first != last ) {
1116 if (*first == 0)
return 0.;
1129 template <
typename T>
1143 template <
typename Iterator>
1151 while ( first != last ) {
1153 tot += (x - mean)*(x - mean);
1167 template <
typename Iterator,
typename WeightIterator>
1174 while ( first != last ) {
1177 sumw2 += (*w) * (*w);
1178 tot += (*w) * (x - mean)*(x - mean);
1191 template <
typename T>
1204 template <
typename Iterator,
typename Element>
1208 pind = std::lower_bound(first, last, value);
1209 if ( (pind != last) && (*pind == value) )
1224 pind = std::lower_bound(array, array + n, value);
1225 if ( (pind != array + n) && (*pind == value) )
1226 return (pind - array);
1228 return ( pind - array - 1);
1240 pind = std::lower_bound(*array, *array + n, value);
1241 if ( (pind != *array + n) && (*pind == value) )
1242 return (pind - *array);
1244 return ( pind - *array - 1);
1255 template <
typename Iterator,
typename IndexIterator>
1260 IndexIterator cindex = index;
1261 for ( Iterator cfirst = first; cfirst != last; ++cfirst )
1285 for(
Index i = 0; i <
n; i++) { index[i] = i; }
1297 out[0] = v1[1] * v2[2] - v1[2] * v2[1];
1298 out[1] = v1[2] * v2[0] - v1[0] * v2[2];
1299 out[2] = v1[0] * v2[1] - v1[1] * v2[0];
1313 v1[0] = p2[0] - p1[0];
1314 v1[1] = p2[1] - p1[1];
1315 v1[2] = p2[2] - p1[2];
1317 v2[0] = p3[0] - p1[0];
1318 v2[1] = p3[1] - p1[1];
1319 v2[2] = p3[2] - p1[2];
1334 for (i=0; i<np; i++) {
1335 if ((y[i]<yp && y[j]>=yp) || (y[j]<yp && y[i]>=yp)) {
1336 if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])<xp) {
1337 oddNodes = !oddNodes;
1370 const Int_t kWorkMax = 100;
1372 if (n <= 0 || !a)
return 0;
1383 isAllocated =
kTRUE;
1390 for (
Int_t j = 0; j <
n; j++) {
1392 ::Error(
"TMath::Median",
"w[%d] = %.4e < 0 ?!",j,w[j]);
1393 if (isAllocated)
delete [] ind;
1405 for (jl = 0; jl <
n; jl++) {
1407 if (sum >= sumTot2)
break;
1412 for (jh = n-1; jh >= 0; jh--) {
1414 if (sum <= sumTot2)
break;
1417 median = 0.5*(a[ind[jl]]+a[ind[jh]]);
1452 template <
class Element,
typename Size>
1456 const Int_t kWorkMax = 100;
1464 Index workLocal[kWorkMax];
1472 isAllocated =
kTRUE;
1477 for (
Size ii=0; ii<
n; ii++) {
1485 if (ir == l+1 && a[ind[ir]]<a[ind[l]])
1486 {temp = ind[
l]; ind[
l]=ind[ir]; ind[ir]=temp;}
1487 Element tmp = a[ind[rk]];
1493 {temp = ind[
mid]; ind[
mid]=ind[l+1]; ind[l+1]=temp;}
1494 if (a[ind[l]]>a[ind[ir]])
1495 {temp = ind[
l]; ind[
l]=ind[ir]; ind[ir]=temp;}
1497 if (a[ind[l+1]]>a[ind[ir]])
1498 {temp=ind[l+1]; ind[l+1]=ind[ir]; ind[ir]=temp;}
1500 if (a[ind[l]]>a[ind[l+1]])
1501 {temp = ind[
l]; ind[
l]=ind[l+1]; ind[l+1]=temp;}
1507 do i++;
while (a[ind[i]]<a[arr]);
1508 do j--;
while (a[ind[j]]>a[arr]);
1510 {temp=ind[i]; ind[i]=ind[j]; ind[j]=temp;}
1514 if (j>=rk) ir = j-1;
constexpr Double_t H()
Planck's constant in .
Double_t BesselI(Int_t n, Double_t x)
constexpr Double_t QeUncertainty()
Elementary charge uncertainty.
constexpr Double_t HC()
in
Double_t FDist(Double_t F, Double_t N, Double_t M)
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
The LANDAU function.
Double_t ErfInverse(Double_t x)
returns the inverse error function x must be <-1<x<1
static long int sum(long int i)
Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1)
Calculate a Breit Wigner function with mean and gamma.
constexpr Double_t K()
Boltzmann's constant in .
Double_t FDistI(Double_t F, Double_t N, Double_t M)
Double_t PoissonI(Double_t x, Double_t par)
Double_t Floor(Double_t x)
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t mid
Long64_t LocMax(Long64_t n, const T *a)
Return index of array with the maximum element.
bool operator()(Index i1, Index i2)
static double p3(double t, double a, double b, double c, double d)
Namespace for new ROOT classes and functions.
constexpr Double_t Sqrt2()
Double_t KolmogorovProb(Double_t z)
constexpr Double_t Hcgs()
constexpr Double_t TwoPi()
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754
Double_t LaplaceDistI(Double_t x, Double_t alpha=0, Double_t beta=1)
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
Double_t NormQuantile(Double_t p)
Double_t BetaDist(Double_t x, Double_t p, Double_t q)
Double_t LaplaceDist(Double_t x, Double_t alpha=0, Double_t beta=1)
constexpr Double_t Rgair()
Dry Air Gas Constant (R / MWair) in
Double_t Log2(Double_t x)
Double_t StruveH1(Double_t x)
Struve functions of order 0.
constexpr Double_t SigmaUncertainty()
Stefan-Boltzmann constant uncertainty.
void BubbleHigh(Int_t Narr, Double_t *arr1, Int_t *arr2)
Int_t FloorNint(Double_t x)
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
constexpr Double_t InvPi()
Double_t GeomMean(Long64_t n, const T *a)
Return the geometric mean of an array a of size n.
Double_t BesselJ1(Double_t x)
Bessel function J0(x) for any real x.
Double_t Prob(Double_t chi2, Int_t ndf)
Double_t StudentI(Double_t T, Double_t ndf)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
double beta(double x, double y)
Calculates the beta function.
Double_t Ldexp(Double_t x, Int_t exp)
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculate a normal vector of a plane.
constexpr Double_t Gn()
Standard acceleration of gravity in .
constexpr Double_t Ln10()
Natural log of 10 (to convert log to ln)
constexpr Double_t Hbarcgs()
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
Return the Standard Deviation of an array a with length n.
T NormCross(const T v1[3], const T v2[3], T out[3])
Calculate the Normalized Cross Product of two vectors.
Double_t BesselY1(Double_t x)
Bessel function Y0(x) for positive x.
Double_t ChisquareQuantile(Double_t p, Double_t ndf)
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=0, Int_t type=7)
Double_t Log10(Double_t x)
Double_t BesselI1(Double_t x)
modified Bessel function K_0(x)
static double p2(double t, double a, double b, double c)
Double_t Freq(Double_t x)
Computation of the normal frequency function freq(x).
constexpr Double_t GhbarCUncertainty()
uncertainty.
constexpr Double_t HCcgs()
double pow(double, double)
bool operator()(Index i1, Index i2)
constexpr Double_t DegToRad()
Conversion from degree to radian: .
constexpr Double_t MWair()
Molecular weight of dry air 1976 US Standard Atmosphere in or
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
constexpr Double_t Ccgs()
Int_t Finite(Double_t x)
Check if it is finite with a mask in order to be consistent in presence of fast math.
constexpr Double_t PiOver4()
Double_t ATan2(Double_t, Double_t)
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in array...
Double_t Infinity()
Returns an infinity as defined by the IEEE standard.
void BubbleLow(Int_t Narr, Double_t *arr1, Int_t *arr2)
void Error(const char *location, const char *msgfmt,...)
Double_t Erfc(Double_t x)
Compute the complementary error function erfc(x).
constexpr Double_t GnUncertainty()
Standard acceleration of gravity uncertainty.
Double_t DiLog(Double_t x)
Modified Struve functions of order 1.
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
constexpr Double_t Qe()
Elementary charge in .
constexpr Double_t G()
Gravitational constant in: .
Double_t VavilovI(Double_t x, Double_t kappa, Double_t beta2)
Double_t BesselY0(Double_t x)
Bessel function J1(x) for any real x.
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Double_t BetaDistI(Double_t x, Double_t p, Double_t q)
constexpr Double_t NaUncertainty()
Avogadro constant (Avogadro's Number) uncertainty.
constexpr Double_t RUncertainty()
Universal gas constant uncertainty.
Double_t StruveL1(Double_t x)
Modified Struve functions of order 0.
Double_t Voigt(Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
Bool_t Permute(Int_t n, Int_t *a)
Double_t StruveL0(Double_t x)
Struve functions of order 1.
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Return the weighted mean of an array a with length n.
Double_t KolmogorovTest(Int_t na, const Double_t *a, Int_t nb, const Double_t *b, Option_t *option)
Double_t Binomial(Int_t n, Int_t k)
Double_t LandauI(Double_t x)
Double_t BesselJ0(Double_t x)
modified Bessel function K_1(x)
static double p1(double t, double a, double b)
Double_t ErfcInverse(Double_t x)
returns the inverse of the complementary error function x must be 0<x<2 implement using the quantile ...
Double_t SignalingNaN()
Returns a signaling NaN as defined by IEEE 754](http://en.wikipedia.org/wiki/NaN#Signaling_NaN) ...
T * Cross(const T v1[3], const T v2[3], T out[3])
Calculate the Cross Product of two vectors: out = [v1 x v2].
ULong_t Hash(const void *txt, Int_t ntxt)
constexpr Double_t Na()
Avogadro constant (Avogadro's Number) in .
constexpr Double_t HUncertainty()
Planck's constant uncertainty.
constexpr Double_t GUncertainty()
Gravitational constant uncertainty.
static T Min()
Returns maximum representation for type T.
constexpr Double_t E()
Base of natural log: .
Double_t Poisson(Double_t x, Double_t par)
Double_t Student(Double_t T, Double_t ndf)
Double_t Beta(Double_t p, Double_t q)
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
Double_t BesselI0(Double_t x)
integer order modified Bessel function K_n(x)
Double_t BesselK(Int_t n, Double_t x)
integer order modified Bessel function I_n(x)
constexpr Double_t HbarUncertainty()
uncertainty.
Double_t StdDev(Long64_t n, const T *a, const Double_t *w=0)
RooCmdArg Index(RooCategory &icat)
Double_t StruveH0(Double_t x)
Bessel function Y1(x) for positive x.
double atan2(double, double)
Double_t Median(Long64_t n, const T *a, const Double_t *w=0, Long64_t *work=0)
Return the median of the array a where each entry i has weight w[i] .
T MaxElement(Long64_t n, const T *a)
Return maximum of array a of length n.
static constexpr double s
Double_t Hypot(Double_t x, Double_t y)
constexpr Double_t C()
Velocity of light in .
constexpr Double_t Hbar()
in
Namespace for new Math classes and functions.
Double_t BesselK0(Double_t x)
modified Bessel function I_0(x)
Double_t BinomialI(Double_t p, Int_t n, Int_t k)
constexpr Double_t EulerGamma()
Euler-Mascheroni Constant.
you should not use this method at all Int_t Int_t z
constexpr Double_t Kcgs()
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
constexpr Double_t CUncertainty()
Speed of light uncertainty.
Double_t BetaCf(Double_t x, Double_t a, Double_t b)
Element KOrdStat(Size n, const Element *a, Size k, Size *work=0)
Returns k_th order statistic of the array a of size n (k_th smallest element out of n elements)...
Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
Double_t Factorial(Int_t i)
Compute factorial(n).
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Double_t Ceil(Double_t x)
constexpr Double_t LogE()
Base-10 log of e (to convert ln to log)
Double_t BesselK1(Double_t x)
modified Bessel function I_1(x)
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.
constexpr Double_t Gcgs()
Double_t LogNormal(Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
constexpr Double_t Sigma()
Stefan-Boltzmann constant in .
constexpr Double_t GhbarC()
in
Bool_t RootsCubic(const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c)
Double_t Sqrt(Double_t x)
Double_t BetaIncomplete(Double_t x, Double_t a, Double_t b)
Long64_t LocMin(Long64_t n, const T *a)
Return index of array with the minimum element.
static T Max()
Returns minimum double representation.
Double_t CauchyDist(Double_t x, Double_t t=0, Double_t s=1)
constexpr Double_t R()
Universal gas constant ( ) in
static T Epsilon()
Returns minimum double representation.
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Int_t CeilNint(Double_t x)
constexpr Double_t PiOver2()
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
double ldexp(double, int)
void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
Sort the n1 elements of the Short_t array defined by its iterators.
Double_t Vavilov(Double_t x, Double_t kappa, Double_t beta2)
constexpr Double_t KUncertainty()
Boltzmann's constant uncertainty.
T MinElement(Long64_t n, const T *a)
Return minimum of array a of length n.