42 return 3.14159265358979323846;
70 return 1.4142135623730950488016887242097;
76 return 2.71828182845904523536;
82 return 2.30258509299404568402;
88 return 0.43429448190325182765;
142 return 6.62606876e-34;
150 return 0.00000052e-34;
156 return 1.054571596e-34;
160 return 1.0e7 *
Hbar();
164 return 0.000000082e-34;
180 return 1.3806503e-23;
188 return 0.0000024e-23;
204 return 6.02214199e+23;
208 return 0.00000047e+23;
234 return (1000.0 *
R()) /
MWair();
240 return 0.577215664901532860606512090082402431042;
246 return 1.602176462e-19;
250 return 0.000000063e-19;
282 template <
typename T>
307 template <
typename T>
309 inline static T
Min();
310 inline static T
Max();
338 template <
typename Iterator> Iterator
LocMin(Iterator first, Iterator last);
340 template <
typename Iterator> Iterator
LocMax(Iterator first, Iterator last);
345 template <
typename Iterator,
typename Element> Iterator
BinarySearch(Iterator first, Iterator last, Element value);
352 template <
typename Element,
typename Index>
354 template <
typename Iterator,
typename IndexIterator>
374 template <
typename T> T *
Cross(
const T v1[3],
const T v2[3], T out[3]);
380 template <
typename T>
inline T
NormCross(
const T v1[3],
const T v2[3],T out[3]);
383 template <
typename T> T *
Normal2Plane(
const T v1[3],
const T v2[3],
const T v3[3], T normal[3]);
428 template <
typename Iterator>
Double_t Mean(Iterator first, Iterator last);
429 template <
typename Iterator,
typename WeightIterator>
Double_t Mean(Iterator first, Iterator last, WeightIterator wfirst);
432 template <
typename Iterator>
Double_t GeomMean(Iterator first, Iterator last);
435 template <
typename Iterator>
Double_t RMS(Iterator first, Iterator last);
436 template <
typename Iterator,
typename WeightIterator>
Double_t RMS(Iterator first, Iterator last, WeightIterator wfirst);
439 template <
typename Iterator>
Double_t StdDev(Iterator first, Iterator last) {
return RMS<Iterator>(first,last); }
440 template <
typename Iterator,
typename WeightIterator>
Double_t StdDev(Iterator first, Iterator last, WeightIterator wfirst) {
return RMS<Iterator,WeightIterator>(first,last,wfirst); }
445 template <
class Element,
typename Size> Element
KOrdStat(Size n,
const Element *a, Size k, Size *work = 0);
486 {
return std::sin(x); }
489 {
return std::cos(x); }
492 {
return std::tan(x); }
495 {
return std::sinh(x); }
498 {
return std::cosh(x); }
501 {
return std::tanh(x); }
511 if (x > 1.)
return 0;
516 {
return std::atan(x); }
519 {
if (x != 0)
return std::atan2(y, x);
520 if (y == 0)
return 0;
521 if (y > 0)
return Pi()/2;
529 {
return std::sqrt(x); }
532 {
return std::ceil(x); }
538 {
return std::floor(x); }
551 if ( i & 1 && x + 0.5 == T(i) ) i--;
554 if ( i & 1 && x - 0.5 == T(i) ) i++;
560 {
return std::exp(x); }
563 {
return ldexp(x, exp); }
566 {
return std::pow(x,y); }
572 {
return std::pow(x,y); }
575 {
return std::pow(x, y); }
579 return std::pow(x, y);
600 return std::numeric_limits<Double_t>::quiet_NaN();
607 return std::numeric_limits<Double_t>::signaling_NaN();
612 return std::numeric_limits<Double_t>::infinity();
618 return (std::numeric_limits<T>::min)();
624 return (std::numeric_limits<T>::max)();
630 return std::numeric_limits<T>::epsilon();
642 template <
typename T>
646 return *std::min_element(a,a+n);
649 template <
typename T>
653 return *std::max_element(a,a+n);
656 template <
typename T>
666 if (n <= 0 || !a)
return -1;
678 template <
typename Iterator>
682 return std::min_element(first, last);
685 template <
typename T>
692 if (n <= 0 || !a)
return -1;
704 template <
typename Iterator>
710 return std::max_element(first, last);
718 template<
typename Index>
731 template<
typename Index>
739 template <
typename Iterator>
746 while ( first != last )
756 template <
typename Iterator,
typename WeightIterator>
766 while ( first != last ) {
768 ::Error(
"TMath::Mean",
"w[%d] = %.4e < 0 ?!",i,*w);
771 sum += (*w) * (*first);
778 ::Error(
"TMath::Mean",
"sum of weights == 0 ?!");
785 template <
typename T>
797 template <
typename Iterator>
805 while ( first != last ) {
806 if (*first == 0)
return 0.;
816 template <
typename T>
825 template <
typename Iterator>
840 while ( first != last ) {
842 tot += (x - mean)*(x - mean);
850 template <
typename Iterator,
typename WeightIterator>
863 while ( first != last ) {
866 sumw2 += (*w) * (*w);
867 tot += (*w) * (x - mean)*(x - mean);
877 template <
typename T>
887 template <
typename Iterator,
typename Element>
898 pind = std::lower_bound(first, last, value);
899 if ( (pind != last) && (*pind == value) )
915 pind = std::lower_bound(array, array + n, value);
916 if ( (pind != array + n) && (*pind == value) )
917 return (pind - array);
919 return ( pind - array - 1);
931 pind = std::lower_bound(*array, *array + n, value);
932 if ( (pind != *array + n) && (*pind == value) )
933 return (pind - *array);
935 return ( pind - *array - 1);
938 template <
typename Iterator,
typename IndexIterator>
951 IndexIterator cindex = index;
952 for ( Iterator cfirst = first; cfirst != last; ++cfirst )
964 template <
typename Element,
typename Index>
void TMath::Sort(Index n,
const Element* a, Index* index,
Bool_t down)
975 for(Index i = 0; i < n; i++) { index[i] = i; }
982 template <
typename T> T *
TMath::Cross(
const T v1[3],
const T v2[3], T out[3])
987 out[0] = v1[1] * v2[2] - v1[2] * v2[1];
988 out[1] = v1[2] * v2[0] - v1[0] * v2[2];
989 out[2] = v1[0] * v2[1] - v1[1] * v2[0];
1006 v1[0] = p2[0] - p1[0];
1007 v1[1] = p2[1] - p1[1];
1008 v1[2] = p2[2] - p1[2];
1010 v2[0] = p3[0] - p1[0];
1011 v2[1] = p3[1] - p1[1];
1012 v2[2] = p3[2] - p1[2];
1027 for (i=0; i<np; i++) {
1028 if ((y[i]<yp && y[j]>=yp) || (y[j]<yp && y[i]>=yp)) {
1029 if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])<xp) {
1030 oddNodes = !oddNodes;
1062 const Int_t kWorkMax = 100;
1064 if (n <= 0 || !a)
return 0;
1075 isAllocated =
kTRUE;
1082 for (
Int_t j = 0; j < n; j++) {
1084 ::Error(
"TMath::Median",
"w[%d] = %.4e < 0 ?!",j,w[j]);
1085 if (isAllocated)
delete [] ind;
1097 for (jl = 0; jl < n; jl++) {
1099 if (sum >= sumTot2)
break;
1104 for (jh = n-1; jh >= 0; jh--) {
1106 if (sum <= sumTot2)
break;
1109 median = 0.5*(a[ind[jl]]+a[ind[jh]]);
1128 template <
class Element,
typename Size>
1150 const Int_t kWorkMax = 100;
1155 Size i, ir, j, l, mid;
1158 Index workLocal[kWorkMax];
1166 isAllocated =
kTRUE;
1171 for (Size ii=0; ii<n; ii++) {
1179 if (ir == l+1 && a[ind[ir]]<a[ind[l]])
1180 {temp = ind[l]; ind[l]=ind[ir]; ind[ir]=temp;}
1181 Element tmp = a[ind[rk]];
1187 {temp = ind[mid]; ind[mid]=ind[l+1]; ind[l+1]=temp;}
1188 if (a[ind[l]]>a[ind[ir]])
1189 {temp = ind[l]; ind[l]=ind[ir]; ind[ir]=temp;}
1191 if (a[ind[l+1]]>a[ind[ir]])
1192 {temp=ind[l+1]; ind[l+1]=ind[ir]; ind[ir]=temp;}
1194 if (a[ind[l]]>a[ind[l+1]])
1195 {temp = ind[l]; ind[l]=ind[l+1]; ind[l+1]=temp;}
1201 do i++;
while (a[ind[i]]<a[arr]);
1202 do j--;
while (a[ind[j]]>a[arr]);
1204 {temp=ind[i]; ind[i]=ind[j]; ind[j]=temp;}
1208 if (j>=rk) ir = j-1;
void Error(Ts &&... args)
double beta(double z, double w)
Double_t FDistI(Double_t F, Double_t N, Double_t M)
Double_t GeomMean(Long64_t n, const T *a)
Double_t LogNormal(Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Double_t DiLog(Double_t x)
Double_t BetaDist(Double_t x, Double_t p, Double_t q)
Double_t BesselI(Int_t n, Double_t x)
Element KOrdStat(Size n, const Element *a, Size k, Size *work=0)
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
constexpr Double_t GUncertainty()
Double_t Factorial(Int_t i)
constexpr Double_t GhbarCUncertainty()
Long64_t LocMin(Long64_t n, const T *a)
constexpr Double_t Ccgs()
constexpr Double_t SigmaUncertainty()
Double_t BinomialI(Double_t p, Int_t n, Int_t k)
Double_t Vavilov(Double_t x, Double_t kappa, Double_t beta2)
Double_t Binomial(Int_t n, Int_t k)
Float_t Normalize(Float_t v[3])
constexpr Double_t NaUncertainty()
Double_t Prob(Double_t chi2, Int_t ndf)
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
Double_t Log2(Double_t x)
Double_t BesselK1(Double_t x)
void BubbleHigh(Int_t Narr, Double_t *arr1, Int_t *arr2)
Double_t BesselI1(Double_t x)
void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
Bool_t Permute(Int_t n, Int_t *a)
Double_t Floor(Double_t x)
Double_t PoissonI(Double_t x, Double_t par)
Double_t CauchyDist(Double_t x, Double_t t=0, Double_t s=1)
Double_t StruveL1(Double_t x)
Double_t LaplaceDistI(Double_t x, Double_t alpha=0, Double_t beta=1)
Double_t Normalize(Double_t v[3])
constexpr Double_t QeUncertainty()
Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1)
constexpr Double_t Sqrt2()
constexpr Double_t KUncertainty()
constexpr Double_t Hbarcgs()
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
Double_t Voigt(Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
Double_t Student(Double_t T, Double_t ndf)
constexpr Double_t CUncertainty()
Double_t Ceil(Double_t x)
constexpr Double_t PiOver2()
constexpr Double_t HCcgs()
T MinElement(Long64_t n, const T *a)
Double_t BetaDistI(Double_t x, Double_t p, Double_t q)
T NormCross(const T v1[3], const T v2[3], T out[3])
Int_t FloorNint(Double_t x)
Double_t BesselK0(Double_t x)
Double_t BesselY0(Double_t x)
constexpr Double_t RUncertainty()
Double_t BetaCf(Double_t x, Double_t a, Double_t b)
Long64_t LocMax(Long64_t n, const T *a)
Double_t ErfInverse(Double_t x)
Double_t LaplaceDist(Double_t x, Double_t alpha=0, Double_t beta=1)
constexpr Double_t GnUncertainty()
constexpr Double_t Hcgs()
Double_t ATan2(Double_t, Double_t)
constexpr Double_t HUncertainty()
constexpr Double_t DegToRad()
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Double_t Erfc(Double_t x)
Double_t VavilovI(Double_t x, Double_t kappa, Double_t beta2)
constexpr Double_t Sigma()
Double_t Beta(Double_t p, Double_t q)
constexpr Double_t Kcgs()
Double_t Poisson(Double_t x, Double_t par)
Double_t Sqrt(Double_t x)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Int_t CeilNint(Double_t x)
Double_t Ldexp(Double_t x, Int_t exp)
Double_t BesselJ0(Double_t x)
constexpr Double_t LogE()
Double_t Gamma(Double_t z)
constexpr Double_t MWair()
constexpr Double_t Gcgs()
Double_t StruveL0(Double_t x)
Double_t NormQuantile(Double_t p)
constexpr Double_t Ln10()
Double_t Hypot(Double_t x, Double_t y)
constexpr Double_t EulerGamma()
constexpr Double_t PiOver4()
Double_t StruveH0(Double_t x)
Double_t LnGamma(Double_t z)
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)
Double_t KolmogorovProb(Double_t z)
constexpr Double_t InvPi()
Bool_t RootsCubic(const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c)
Double_t ChisquareQuantile(Double_t p, Double_t ndf)
Double_t FDist(Double_t F, Double_t N, Double_t M)
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
T * Cross(const T v1[3], const T v2[3], T out[3])
void BubbleLow(Int_t Narr, Double_t *arr1, Int_t *arr2)
Double_t BesselK(Int_t n, Double_t x)
Double_t Median(Long64_t n, const T *a, const Double_t *w=0, Long64_t *work=0)
T MaxElement(Long64_t n, const T *a)
Double_t BesselJ1(Double_t x)
Double_t BetaIncomplete(Double_t x, Double_t a, Double_t b)
constexpr Double_t Rgair()
constexpr Double_t Hbar()
Double_t StruveH1(Double_t x)
Double_t Freq(Double_t x)
Double_t LandauI(Double_t x)
Long64_t BinarySearch(Long64_t n, const T *array, T value)
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)
constexpr Double_t RadToDeg()
Double_t BesselI0(Double_t x)
Double_t Log10(Double_t x)
Double_t StudentI(Double_t T, Double_t ndf)
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
Double_t BesselY1(Double_t x)
Double_t StdDev(Long64_t n, const T *a, const Double_t *w=0)
Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
constexpr Double_t GhbarC()
constexpr Double_t TwoPi()
constexpr Double_t HbarUncertainty()
Double_t ErfcInverse(Double_t x)
bool operator()(Index i1, Index i2)
bool operator()(Index i1, Index i2)