BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
TMath Namespace Reference

Classes

struct  Limits
 

Functions

Double_t Abs (Double_t d)
 
Float_t Abs (Float_t d)
 
Int_t Abs (Int_t d)
 
Long64_t Abs (Long64_t d)
 
Long_t Abs (Long_t d)
 
LongDouble_t Abs (LongDouble_t d)
 
Short_t Abs (Short_t d)
 
Double_t ACos (Double_t)
 
Double_t ACosH (Double_t)
 
Bool_t AreEqualAbs (Double_t af, Double_t bf, Double_t epsilon)
 
Bool_t AreEqualRel (Double_t af, Double_t bf, Double_t relPrec)
 
Double_t ASin (Double_t)
 
Double_t ASinH (Double_t)
 
Double_t ATan (Double_t)
 
Double_t ATan2 (Double_t, Double_t)
 
Double_t ATanH (Double_t)
 
Double_t BesselI (Int_t n, Double_t x)
 
Double_t BesselI0 (Double_t x)
 
Double_t BesselI1 (Double_t x)
 
Double_t BesselJ0 (Double_t x)
 
Double_t BesselJ1 (Double_t x)
 
Double_t BesselK (Int_t n, Double_t x)
 
Double_t BesselK0 (Double_t x)
 
Double_t BesselK1 (Double_t x)
 
Double_t BesselY0 (Double_t x)
 
Double_t BesselY1 (Double_t x)
 
Double_t Beta (Double_t p, Double_t q)
 
Double_t BetaCf (Double_t x, Double_t a, Double_t b)
 
Double_t BetaDist (Double_t x, Double_t p, Double_t q)
 
Double_t BetaDistI (Double_t x, Double_t p, Double_t q)
 
Double_t BetaIncomplete (Double_t x, Double_t a, Double_t b)
 
template<typename Iterator , typename Element >
Iterator BinarySearch (Iterator first, Iterator last, Element value)
 
template<typename T >
Long64_t BinarySearch (Long64_t n, const T **array, T value)
 
template<typename T >
Long64_t BinarySearch (Long64_t n, const T *array, T value)
 
Double_t Binomial (Int_t n, Int_t k)
 
Double_t BinomialI (Double_t p, Int_t n, Int_t k)
 
Double_t BreitWigner (Double_t x, Double_t mean=0, Double_t gamma=1)
 
void BubbleHigh (Int_t Narr, Double_t *arr1, Int_t *arr2)
 
void BubbleLow (Int_t Narr, Double_t *arr1, Int_t *arr2)
 
constexpr Double_t C ()
 
Double_t CauchyDist (Double_t x, Double_t t=0, Double_t s=1)
 
constexpr Double_t Ccgs ()
 
Double_t Ceil (Double_t x)
 
Int_t CeilNint (Double_t x)
 
Double_t ChisquareQuantile (Double_t p, Double_t ndf)
 
Double_t Cos (Double_t)
 
Double_t CosH (Double_t)
 
template<typename T >
T * Cross (const T v1[3], const T v2[3], T out[3])
 
constexpr Double_t CUncertainty ()
 
constexpr Double_t DegToRad ()
 
Double_t DiLog (Double_t x)
 
constexpr Double_t E ()
 
Double_t Erf (Double_t x)
 
Double_t Erfc (Double_t x)
 
Double_t ErfcInverse (Double_t x)
 
Double_t ErfInverse (Double_t x)
 
constexpr Double_t EulerGamma ()
 
Bool_t Even (Long_t a)
 
Double_t Exp (Double_t x)
 
Double_t Factorial (Int_t i)
 
Double_t FDist (Double_t F, Double_t N, Double_t M)
 
Double_t FDistI (Double_t F, Double_t N, Double_t M)
 
Int_t Finite (Double_t x)
 
Int_t Finite (Float_t x)
 
Double_t Floor (Double_t x)
 
Int_t FloorNint (Double_t x)
 
Double_t Freq (Double_t x)
 
constexpr Double_t G ()
 
Double_t Gamma (Double_t a, Double_t x)
 
Double_t Gamma (Double_t z)
 
Double_t GammaDist (Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
 
Double_t Gaus (Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
 
constexpr Double_t Gcgs ()
 
template<typename Iterator >
Double_t GeomMean (Iterator first, Iterator last)
 
template<typename T >
Double_t GeomMean (Long64_t n, const T *a)
 
constexpr Double_t GhbarC ()
 
constexpr Double_t GhbarCUncertainty ()
 
constexpr Double_t Gn ()
 
constexpr Double_t GnUncertainty ()
 
constexpr Double_t GUncertainty ()
 
constexpr Double_t H ()
 
constexpr Double_t Hbar ()
 
constexpr Double_t Hbarcgs ()
 
constexpr Double_t HbarUncertainty ()
 
constexpr Double_t HC ()
 
constexpr Double_t HCcgs ()
 
constexpr Double_t Hcgs ()
 
constexpr Double_t HUncertainty ()
 
Double_t Hypot (Double_t x, Double_t y)
 
Long_t Hypot (Long_t x, Long_t y)
 
Double_t Infinity ()
 
constexpr Double_t InvPi ()
 
template<typename T >
Bool_t IsInside (T xp, T yp, Int_t np, T *x, T *y)
 
Bool_t IsNaN (Double_t x)
 
Bool_t IsNaN (Float_t x)
 
constexpr Double_t K ()
 
constexpr Double_t Kcgs ()
 
Double_t KolmogorovProb (Double_t z)
 
template<class Element , typename Size >
Element KOrdStat (Size n, const Element *a, Size k, Size *work=0)
 
constexpr Double_t KUncertainty ()
 
Double_t Landau (Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
 
Double_t LandauI (Double_t x)
 
Double_t LaplaceDist (Double_t x, Double_t alpha=0, Double_t beta=1)
 
Double_t LaplaceDistI (Double_t x, Double_t alpha=0, Double_t beta=1)
 
Double_t Ldexp (Double_t x, Int_t exp)
 
constexpr Double_t Ln10 ()
 
Double_t LnGamma (Double_t z)
 
template<typename Iterator >
Iterator LocMax (Iterator first, Iterator last)
 
template<typename T >
Long64_t LocMax (Long64_t n, const T *a)
 
template<typename Iterator >
Iterator LocMin (Iterator first, Iterator last)
 
template<typename T >
Long64_t LocMin (Long64_t n, const T *a)
 
Double_t Log (Double_t x)
 
Double_t Log10 (Double_t x)
 
Double_t Log2 (Double_t x)
 
constexpr Double_t LogE ()
 
Double_t LogNormal (Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
 
Double_t Max (Double_t a, Double_t b)
 
Float_t Max (Float_t a, Float_t b)
 
Int_t Max (Int_t a, Int_t b)
 
Long64_t Max (Long64_t a, Long64_t b)
 
Long_t Max (Long_t a, Long_t b)
 
Short_t Max (Short_t a, Short_t b)
 
UInt_t Max (UInt_t a, UInt_t b)
 
ULong64_t Max (ULong64_t a, ULong64_t b)
 
ULong_t Max (ULong_t a, ULong_t b)
 
UShort_t Max (UShort_t a, UShort_t b)
 
template<typename T >
MaxElement (Long64_t n, const T *a)
 
template<typename Iterator >
Double_t Mean (Iterator first, Iterator last)
 
template<typename Iterator , typename WeightIterator >
Double_t Mean (Iterator first, Iterator last, WeightIterator wfirst)
 
template<typename T >
Double_t Mean (Long64_t n, const T *a, const Double_t *w=0)
 
template<typename T >
Double_t Median (Long64_t n, const T *a, const Double_t *w=0, Long64_t *work=0)
 
Double_t Min (Double_t a, Double_t b)
 
Float_t Min (Float_t a, Float_t b)
 
Int_t Min (Int_t a, Int_t b)
 
Long64_t Min (Long64_t a, Long64_t b)
 
Long_t Min (Long_t a, Long_t b)
 
Short_t Min (Short_t a, Short_t b)
 
UInt_t Min (UInt_t a, UInt_t b)
 
ULong64_t Min (ULong64_t a, ULong64_t b)
 
ULong_t Min (ULong_t a, ULong_t b)
 
UShort_t Min (UShort_t a, UShort_t b)
 
template<typename T >
MinElement (Long64_t n, const T *a)
 
constexpr Double_t MWair ()
 
constexpr Double_t Na ()
 
constexpr Double_t NaUncertainty ()
 
Long_t NextPrime (Long_t x)
 
template<typename T >
Int_t Nint (T x)
 
template<typename T >
T * Normal2Plane (const T v1[3], const T v2[3], const T v3[3], T normal[3])
 
Double_t Normalize (Double_t v[3])
 
Float_t Normalize (Float_t v[3])
 
template<typename T >
NormCross (const T v1[3], const T v2[3], T out[3])
 
Double_t NormQuantile (Double_t p)
 
Bool_t Odd (Long_t a)
 
Bool_t Permute (Int_t n, Int_t *a)
 
constexpr Double_t Pi ()
 
constexpr Double_t PiOver2 ()
 
constexpr Double_t PiOver4 ()
 
Double_t Poisson (Double_t x, Double_t par)
 
Double_t PoissonI (Double_t x, Double_t par)
 
Double_t Power (Double_t x, Double_t y)
 
Double_t Power (Double_t x, Int_t y)
 
LongDouble_t Power (Long64_t x, Long64_t y)
 
LongDouble_t Power (LongDouble_t x, Long64_t y)
 
LongDouble_t Power (LongDouble_t x, LongDouble_t y)
 
Double_t Prob (Double_t chi2, Int_t ndf)
 
constexpr Double_t Qe ()
 
constexpr Double_t QeUncertainty ()
 
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 QuietNaN ()
 
constexpr Double_t R ()
 
constexpr Double_t RadToDeg ()
 
Double_t Range (Double_t lb, Double_t ub, Double_t x)
 
Int_t Range (Int_t lb, Int_t ub, Int_t x)
 
Long_t Range (Long_t lb, Long_t ub, Long_t x)
 
Short_t Range (Short_t lb, Short_t ub, Short_t x)
 
ULong_t Range (ULong_t lb, ULong_t ub, ULong_t x)
 
constexpr Double_t Rgair ()
 
template<typename Iterator >
Double_t RMS (Iterator first, Iterator last)
 
template<typename Iterator , typename WeightIterator >
Double_t RMS (Iterator first, Iterator last, WeightIterator wfirst)
 
template<typename T >
Double_t RMS (Long64_t n, const T *a, const Double_t *w=0)
 
Bool_t RootsCubic (const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c)
 
constexpr Double_t RUncertainty ()
 
constexpr Double_t Sigma ()
 
constexpr Double_t SigmaUncertainty ()
 
Double_t Sign (Double_t a, Double_t b)
 
Float_t Sign (Float_t a, Float_t b)
 
LongDouble_t Sign (LongDouble_t a, LongDouble_t b)
 
template<typename T1 , typename T2 >
T1 Sign (T1 a, T2 b)
 
Double_t SignalingNaN ()
 
Bool_t SignBit (Double_t a)
 
Bool_t SignBit (Float_t a)
 
template<typename Integer >
Bool_t SignBit (Integer a)
 
Bool_t SignBit (LongDouble_t a)
 
Double_t Sin (Double_t)
 
Double_t SinH (Double_t)
 
template<typename Element , typename Index >
void Sort (Index n, const Element *a, Index *index, Bool_t down=kTRUE)
 
template<typename Iterator , typename IndexIterator >
void SortItr (Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
 
Double_t Sq (Double_t x)
 
Double_t Sqrt (Double_t x)
 
constexpr Double_t Sqrt2 ()
 
template<typename Iterator >
Double_t StdDev (Iterator first, Iterator last)
 
template<typename Iterator , typename WeightIterator >
Double_t StdDev (Iterator first, Iterator last, WeightIterator wfirst)
 
template<typename T >
Double_t StdDev (Long64_t n, const T *a, const Double_t *w=0)
 
Double_t StruveH0 (Double_t x)
 
Double_t StruveH1 (Double_t x)
 
Double_t StruveL0 (Double_t x)
 
Double_t StruveL1 (Double_t x)
 
Double_t Student (Double_t T, Double_t ndf)
 
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 Tan (Double_t)
 
Double_t TanH (Double_t)
 
constexpr Double_t TwoPi ()
 
Double_t Vavilov (Double_t x, Double_t kappa, Double_t beta2)
 
Double_t VavilovI (Double_t x, Double_t kappa, Double_t beta2)
 
Double_t Voigt (Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
 

Function Documentation

◆ Abs() [1/7]

Double_t TMath::Abs ( Double_t  d)
inline

Definition at line 127 of file TMathBase.h.

128 { return std::abs(d); }

◆ Abs() [2/7]

Float_t TMath::Abs ( Float_t  d)
inline

Definition at line 124 of file TMathBase.h.

125 { return std::abs(d); }

◆ Abs() [3/7]

Int_t TMath::Abs ( Int_t  d)
inline

Definition at line 111 of file TMathBase.h.

112 { return std::abs(d); }

◆ Abs() [4/7]

Long64_t TMath::Abs ( Long64_t  d)
inline

Definition at line 117 of file TMathBase.h.

119 { return std::llabs(d); }
120 #else
121 { return (d >= 0) ? d : -d; }

◆ Abs() [5/7]

Long_t TMath::Abs ( Long_t  d)
inline

Definition at line 114 of file TMathBase.h.

115 { return std::labs(d); }

◆ Abs() [6/7]

LongDouble_t TMath::Abs ( LongDouble_t  d)
inline

Definition at line 130 of file TMathBase.h.

131 { return std::abs(d); }

Referenced by Sign().

◆ Abs() [7/7]

Short_t TMath::Abs ( Short_t  d)
inline

Definition at line 108 of file TMathBase.h.

109 { return (d >= 0) ? d : Short_t(-d); }
short Short_t
Definition: RtypesCore.h:35

Referenced by AreEqualAbs(), AreEqualRel(), and GeomMean().

◆ ACos()

Double_t TMath::ACos ( Double_t  x)
inline

Definition at line 509 of file TMath.h.

510  { if (x < -1.) return TMath::Pi();
511  if (x > 1.) return 0;
512  return std::acos(x);
513  }
constexpr Double_t Pi()
Definition: TMath.h:40

References Pi().

Here is the call graph for this function:

◆ ACosH()

Double_t TMath::ACosH ( Double_t  )

◆ AreEqualAbs()

Bool_t TMath::AreEqualAbs ( Double_t  af,
Double_t  bf,
Double_t  epsilon 
)
inline

Definition at line 318 of file TMath.h.

318  {
319  //return kTRUE if absolute difference between af and bf is less than epsilon
320  return TMath::Abs(af-bf) < epsilon;
321  }
Short_t Abs(Short_t d)
Definition: TMathBase.h:108

References Abs().

Here is the call graph for this function:

◆ AreEqualRel()

Bool_t TMath::AreEqualRel ( Double_t  af,
Double_t  bf,
Double_t  relPrec 
)
inline

Definition at line 322 of file TMath.h.

322  {
323  //return kTRUE if relative difference between af and bf is less than relPrec
324  return TMath::Abs(af - bf) <= 0.5 * relPrec * (TMath::Abs(af) + TMath::Abs(bf)) ||
325  TMath::Abs(af - bf) < Limits<Double_t>::Min(); // handle denormals
326  }
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:168

References Abs(), and TMath::Limits< T >::Min().

Here is the call graph for this function:

◆ ASin()

Double_t TMath::ASin ( Double_t  x)
inline

Definition at line 503 of file TMath.h.

504  { if (x < -1.) return -TMath::Pi()/2;
505  if (x > 1.) return TMath::Pi()/2;
506  return std::asin(x);
507  }

References Pi().

Here is the call graph for this function:

◆ ASinH()

Double_t TMath::ASinH ( Double_t  )

◆ ATan()

Double_t TMath::ATan ( Double_t  x)
inline

Definition at line 515 of file TMath.h.

516  { return std::atan(x); }

◆ ATan2()

Double_t TMath::ATan2 ( Double_t  y,
Double_t  x 
)
inline

Definition at line 518 of file TMath.h.

519  { if (x != 0) return std::atan2(y, x);
520  if (y == 0) return 0;
521  if (y > 0) return Pi()/2;
522  else return -Pi()/2;
523  }

References Pi().

Here is the call graph for this function:

◆ ATanH()

Double_t TMath::ATanH ( Double_t  )

◆ BesselI()

Double_t TMath::BesselI ( Int_t  n,
Double_t  x 
)

◆ BesselI0()

Double_t TMath::BesselI0 ( Double_t  x)

◆ BesselI1()

Double_t TMath::BesselI1 ( Double_t  x)

◆ BesselJ0()

Double_t TMath::BesselJ0 ( Double_t  x)

◆ BesselJ1()

Double_t TMath::BesselJ1 ( Double_t  x)

◆ BesselK()

Double_t TMath::BesselK ( Int_t  n,
Double_t  x 
)

◆ BesselK0()

Double_t TMath::BesselK0 ( Double_t  x)

◆ BesselK1()

Double_t TMath::BesselK1 ( Double_t  x)

◆ BesselY0()

Double_t TMath::BesselY0 ( Double_t  x)

◆ BesselY1()

Double_t TMath::BesselY1 ( Double_t  x)

◆ Beta()

Double_t TMath::Beta ( Double_t  p,
Double_t  q 
)

◆ BetaCf()

Double_t TMath::BetaCf ( Double_t  x,
Double_t  a,
Double_t  b 
)

◆ BetaDist()

Double_t TMath::BetaDist ( Double_t  x,
Double_t  p,
Double_t  q 
)

◆ BetaDistI()

Double_t TMath::BetaDistI ( Double_t  x,
Double_t  p,
Double_t  q 
)

◆ BetaIncomplete()

Double_t TMath::BetaIncomplete ( Double_t  x,
Double_t  a,
Double_t  b 
)

◆ BinarySearch() [1/3]

template<typename Iterator , typename Element >
Iterator TMath::BinarySearch ( Iterator  first,
Iterator  last,
Element  value 
)

Definition at line 888 of file TMath.h.

889 {
890  // Binary search in an array defined by its iterators.
891  //
892  // The values in the iterators range are supposed to be sorted
893  // prior to this call. If match is found, function returns
894  // position of element. If no match found, function gives nearest
895  // element smaller than value.
896 
897  Iterator pind;
898  pind = std::lower_bound(first, last, value);
899  if ( (pind != last) && (*pind == value) )
900  return pind;
901  else
902  return ( pind - 1);
903 }

◆ BinarySearch() [2/3]

template<typename T >
Long64_t TMath::BinarySearch ( Long64_t  n,
const T **  array,
value 
)

Definition at line 922 of file TMath.h.

923 {
924  // Binary search in an array of n values to locate value.
925  //
926  // Array is supposed to be sorted prior to this call.
927  // If match is found, function returns position of element.
928  // If no match found, function gives nearest element smaller than value.
929 
930  const T* pind;
931  pind = std::lower_bound(*array, *array + n, value);
932  if ( (pind != *array + n) && (*pind == value) )
933  return (pind - *array);
934  else
935  return ( pind - *array - 1);
936 }

◆ BinarySearch() [3/3]

template<typename T >
Long64_t TMath::BinarySearch ( Long64_t  n,
const T *  array,
value 
)

Definition at line 906 of file TMath.h.

907 {
908  // Binary search in an array of n values to locate value.
909  //
910  // Array is supposed to be sorted prior to this call.
911  // If match is found, function returns position of element.
912  // If no match found, function gives nearest element smaller than value.
913 
914  const T* pind;
915  pind = std::lower_bound(array, array + n, value);
916  if ( (pind != array + n) && (*pind == value) )
917  return (pind - array);
918  else
919  return ( pind - array - 1);
920 }

◆ Binomial()

Double_t TMath::Binomial ( Int_t  n,
Int_t  k 
)

◆ BinomialI()

Double_t TMath::BinomialI ( Double_t  p,
Int_t  n,
Int_t  k 
)

◆ BreitWigner()

Double_t TMath::BreitWigner ( Double_t  x,
Double_t  mean = 0,
Double_t  gamma = 1 
)

◆ BubbleHigh()

void TMath::BubbleHigh ( Int_t  Narr,
Double_t arr1,
Int_t arr2 
)

◆ BubbleLow()

void TMath::BubbleLow ( Int_t  Narr,
Double_t arr1,
Int_t arr2 
)

◆ C()

constexpr Double_t TMath::C ( )
constexpr

Definition at line 92 of file TMath.h.

93 {
94  return 2.99792458e8;
95 } // m s^-1

Referenced by Ccgs(), and HC().

◆ CauchyDist()

Double_t TMath::CauchyDist ( Double_t  x,
Double_t  t = 0,
Double_t  s = 1 
)

◆ Ccgs()

constexpr Double_t TMath::Ccgs ( )
constexpr

Definition at line 96 of file TMath.h.

97 {
98  return 100.0 * C();
99 } // cm s^-1
constexpr Double_t C()
Definition: TMath.h:92

References C().

Referenced by HCcgs().

Here is the call graph for this function:

◆ Ceil()

Double_t TMath::Ceil ( Double_t  x)
inline

Definition at line 531 of file TMath.h.

532  { return std::ceil(x); }

◆ CeilNint()

Int_t TMath::CeilNint ( Double_t  x)
inline

Definition at line 534 of file TMath.h.

535  { return TMath::Nint(ceil(x)); }
Int_t Nint(T x)
Definition: TMath.h:544

References Nint().

Here is the call graph for this function:

◆ ChisquareQuantile()

Double_t TMath::ChisquareQuantile ( Double_t  p,
Double_t  ndf 
)

◆ Cos()

Double_t TMath::Cos ( Double_t  x)
inline

Definition at line 488 of file TMath.h.

489  { return std::cos(x); }

◆ CosH()

Double_t TMath::CosH ( Double_t  x)
inline

Definition at line 497 of file TMath.h.

498  { return std::cosh(x); }

◆ Cross()

template<typename T >
T * TMath::Cross ( const T  v1[3],
const T  v2[3],
out[3] 
)

Definition at line 982 of file TMath.h.

983 {
984  // Calculate the Cross Product of two vectors:
985  // out = [v1 x v2]
986 
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];
990 
991  return out;
992 }

Referenced by NormCross().

◆ CUncertainty()

constexpr Double_t TMath::CUncertainty ( )
constexpr

Definition at line 100 of file TMath.h.

101 {
102  return 0.0;
103 } // exact

◆ DegToRad()

constexpr Double_t TMath::DegToRad ( )
constexpr

Definition at line 64 of file TMath.h.

65 {
66  return Pi() / 180.0;
67 }

References Pi().

Here is the call graph for this function:

◆ DiLog()

Double_t TMath::DiLog ( Double_t  x)

◆ E()

constexpr Double_t TMath::E ( )
constexpr

Definition at line 74 of file TMath.h.

75 {
76  return 2.71828182845904523536;
77 }

◆ Erf()

Double_t TMath::Erf ( Double_t  x)

◆ Erfc()

Double_t TMath::Erfc ( Double_t  x)

◆ ErfcInverse()

Double_t TMath::ErfcInverse ( Double_t  x)

◆ ErfInverse()

Double_t TMath::ErfInverse ( Double_t  x)

◆ EulerGamma()

constexpr Double_t TMath::EulerGamma ( )
constexpr

Definition at line 238 of file TMath.h.

239 {
240  return 0.577215664901532860606512090082402431042;
241 }

◆ Even()

Bool_t TMath::Even ( Long_t  a)
inline

Definition at line 100 of file TMathBase.h.

101  { return ! (a & 1); }

◆ Exp()

Double_t TMath::Exp ( Double_t  x)
inline

Definition at line 559 of file TMath.h.

560  { return std::exp(x); }

Referenced by GeomMean().

◆ Factorial()

Double_t TMath::Factorial ( Int_t  i)

◆ FDist()

Double_t TMath::FDist ( Double_t  F,
Double_t  N,
Double_t  M 
)

◆ FDistI()

Double_t TMath::FDistI ( Double_t  F,
Double_t  N,
Double_t  M 
)

◆ Finite() [1/2]

Int_t TMath::Finite ( Double_t  x)
inline

◆ Finite() [2/2]

Int_t TMath::Finite ( Float_t  x)
inline

◆ Floor()

Double_t TMath::Floor ( Double_t  x)
inline

Definition at line 537 of file TMath.h.

538  { return std::floor(x); }

◆ FloorNint()

Int_t TMath::FloorNint ( Double_t  x)
inline

Definition at line 540 of file TMath.h.

541  { return TMath::Nint(floor(x)); }

References Nint().

Here is the call graph for this function:

◆ Freq()

Double_t TMath::Freq ( Double_t  x)

◆ G()

constexpr Double_t TMath::G ( )
constexpr

Definition at line 106 of file TMath.h.

107 {
108  return 6.673e-11;
109 } // m^3 kg^-1 s^-2

Referenced by Gcgs().

◆ Gamma() [1/2]

Double_t TMath::Gamma ( Double_t  a,
Double_t  x 
)

◆ Gamma() [2/2]

Double_t TMath::Gamma ( Double_t  z)

◆ GammaDist()

Double_t TMath::GammaDist ( Double_t  x,
Double_t  gamma,
Double_t  mu = 0,
Double_t  beta = 1 
)

◆ Gaus()

Double_t TMath::Gaus ( Double_t  x,
Double_t  mean = 0,
Double_t  sigma = 1,
Bool_t  norm = kFALSE 
)

◆ Gcgs()

constexpr Double_t TMath::Gcgs ( )
constexpr

Definition at line 110 of file TMath.h.

111 {
112  return G() / 1000.0;
113 } // cm^3 g^-1 s^-2
constexpr Double_t G()
Definition: TMath.h:106

References G().

Here is the call graph for this function:

◆ GeomMean() [1/2]

template<typename Iterator >
Double_t TMath::GeomMean ( Iterator  first,
Iterator  last 
)

Definition at line 798 of file TMath.h.

799 {
800  // Return the geometric mean of an array defined by the iterators.
801  // geometric_mean = (Prod_i=0,n-1 |a[i]|)^1/n
802 
803  Double_t logsum = 0.;
804  Long64_t n = 0;
805  while ( first != last ) {
806  if (*first == 0) return 0.;
807  Double_t absa = (Double_t) TMath::Abs(*first);
808  logsum += TMath::Log(absa);
809  ++first;
810  ++n;
811  }
812 
813  return TMath::Exp(logsum/n);
814 }
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
Double_t Exp(Double_t x)
Definition: TMath.h:559
Double_t Log(Double_t x)
Definition: TMath.h:586

References Abs(), Exp(), and Log().

Here is the call graph for this function:

◆ GeomMean() [2/2]

template<typename T >
Double_t TMath::GeomMean ( Long64_t  n,
const T *  a 
)

Definition at line 817 of file TMath.h.

818 {
819  // Return the geometric mean of an array a of size n.
820  // geometric_mean = (Prod_i=0,n-1 |a[i]|)^1/n
821 
822  return TMath::GeomMean(a, a+n);
823 }
Double_t GeomMean(Long64_t n, const T *a)
Definition: TMath.h:817

◆ GhbarC()

constexpr Double_t TMath::GhbarC ( )
constexpr

Definition at line 120 of file TMath.h.

121 {
122  return 6.707e-39;
123 } // (GeV/c^2)^-2

◆ GhbarCUncertainty()

constexpr Double_t TMath::GhbarCUncertainty ( )
constexpr

Definition at line 124 of file TMath.h.

125 {
126  return 0.010e-39;
127 }

◆ Gn()

constexpr Double_t TMath::Gn ( )
constexpr

Definition at line 130 of file TMath.h.

131 {
132  return 9.80665;
133 } // m s^-2

◆ GnUncertainty()

constexpr Double_t TMath::GnUncertainty ( )
constexpr

Definition at line 134 of file TMath.h.

135 {
136  return 0.0;
137 } // exact

◆ GUncertainty()

constexpr Double_t TMath::GUncertainty ( )
constexpr

Definition at line 114 of file TMath.h.

115 {
116  return 0.010e-11;
117 }

◆ H()

◆ Hbar()

constexpr Double_t TMath::Hbar ( )
constexpr

Definition at line 154 of file TMath.h.

155 {
156  return 1.054571596e-34;
157 } // J s

Referenced by Hbarcgs().

◆ Hbarcgs()

constexpr Double_t TMath::Hbarcgs ( )
constexpr

Definition at line 158 of file TMath.h.

159 {
160  return 1.0e7 * Hbar();
161 } // erg s
constexpr Double_t Hbar()
Definition: TMath.h:154

References Hbar().

Here is the call graph for this function:

◆ HbarUncertainty()

constexpr Double_t TMath::HbarUncertainty ( )
constexpr

Definition at line 162 of file TMath.h.

163 {
164  return 0.000000082e-34;
165 }

◆ HC()

constexpr Double_t TMath::HC ( )
constexpr

Definition at line 168 of file TMath.h.

169 {
170  return H() * C();
171 } // J m
constexpr Double_t H()
Definition: TMath.h:140

References C(), and H().

Here is the call graph for this function:

◆ HCcgs()

constexpr Double_t TMath::HCcgs ( )
constexpr

Definition at line 172 of file TMath.h.

173 {
174  return Hcgs() * Ccgs();
175 } // erg cm
constexpr Double_t Ccgs()
Definition: TMath.h:96
constexpr Double_t Hcgs()
Definition: TMath.h:144

References Ccgs(), and Hcgs().

Here is the call graph for this function:

◆ Hcgs()

constexpr Double_t TMath::Hcgs ( )
constexpr

Definition at line 144 of file TMath.h.

145 {
146  return 1.0e7 * H();
147 } // erg s

References H().

Referenced by HCcgs().

Here is the call graph for this function:

◆ HUncertainty()

constexpr Double_t TMath::HUncertainty ( )
constexpr

Definition at line 148 of file TMath.h.

149 {
150  return 0.00000052e-34;
151 }

◆ Hypot() [1/2]

Double_t TMath::Hypot ( Double_t  x,
Double_t  y 
)

◆ Hypot() [2/2]

Long_t TMath::Hypot ( Long_t  x,
Long_t  y 
)

◆ Infinity()

Double_t TMath::Infinity ( )
inline

Definition at line 610 of file TMath.h.

610  {
611  // returns an infinity as defined by the IEEE standard
612  return std::numeric_limits<Double_t>::infinity();
613 }

◆ InvPi()

constexpr Double_t TMath::InvPi ( )
constexpr

Definition at line 56 of file TMath.h.

57 {
58  return 1.0 / Pi();
59 }

References Pi().

Here is the call graph for this function:

◆ IsInside()

template<typename T >
Bool_t TMath::IsInside ( xp,
yp,
Int_t  np,
T *  x,
T *  y 
)

Definition at line 1018 of file TMath.h.

1019 {
1020  // Function which returns kTRUE if point xp,yp lies inside the
1021  // polygon defined by the np points in arrays x and y, kFALSE otherwise.
1022  // Note that the polygon may be open or closed.
1023 
1024  Int_t i, j = np-1 ;
1025  Bool_t oddNodes = kFALSE;
1026 
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;
1031  }
1032  }
1033  j=i;
1034  }
1035 
1036  return oddNodes;
1037 }
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59

References kFALSE.

◆ IsNaN() [1/2]

Bool_t TMath::IsNaN ( Double_t  x)
inline

Definition at line 592 of file TMath.h.

592 { return std::isnan(x); }

◆ IsNaN() [2/2]

Bool_t TMath::IsNaN ( Float_t  x)
inline

Definition at line 593 of file TMath.h.

593 { return std::isnan(x); }

◆ K()

constexpr Double_t TMath::K ( )
constexpr

Definition at line 178 of file TMath.h.

179 {
180  return 1.3806503e-23;
181 } // J K^-1

Referenced by Kcgs(), R(), and RUncertainty().

◆ Kcgs()

constexpr Double_t TMath::Kcgs ( )
constexpr

Definition at line 182 of file TMath.h.

183 {
184  return 1.0e7 * K();
185 } // erg K^-1
constexpr Double_t K()
Definition: TMath.h:178

References K().

Here is the call graph for this function:

◆ KolmogorovProb()

Double_t TMath::KolmogorovProb ( Double_t  z)

◆ KOrdStat()

template<class Element , typename Size >
Element TMath::KOrdStat ( Size  n,
const Element *  a,
Size  k,
Size *  work = 0 
)

Definition at line 1129 of file TMath.h.

1130 {
1131  // Returns k_th order statistic of the array a of size n
1132  // (k_th smallest element out of n elements).
1133  //
1134  // C-convention is used for array indexing, so if you want
1135  // the second smallest element, call KOrdStat(n, a, 1).
1136  //
1137  // If work is supplied, it is used to store the sorting index and
1138  // assumed to be >= n. If work=0, local storage is used, either on
1139  // the stack if n < kWorkMax or on the heap for n >= kWorkMax.
1140  // Note that the work index array will not contain the sorted indices but
1141  // all indeces of the smaller element in arbitrary order in work[0,...,k-1] and
1142  // all indeces of the larger element in arbitrary order in work[k+1,..,n-1]
1143  // work[k] will contain instead the index of the returned element.
1144  //
1145  // Taken from "Numerical Recipes in C++" without the index array
1146  // implemented by Anna Khreshuk.
1147  //
1148  // See also the declarations at the top of this file
1149 
1150  const Int_t kWorkMax = 100;
1151 
1152  typedef Size Index;
1153 
1154  Bool_t isAllocated = kFALSE;
1155  Size i, ir, j, l, mid;
1156  Index arr;
1157  Index *ind;
1158  Index workLocal[kWorkMax];
1159  Index temp;
1160 
1161  if (work) {
1162  ind = work;
1163  } else {
1164  ind = workLocal;
1165  if (n > kWorkMax) {
1166  isAllocated = kTRUE;
1167  ind = new Index[n];
1168  }
1169  }
1170 
1171  for (Size ii=0; ii<n; ii++) {
1172  ind[ii]=ii;
1173  }
1174  Size rk = k;
1175  l=0;
1176  ir = n-1;
1177  for(;;) {
1178  if (ir<=l+1) { //active partition contains 1 or 2 elements
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]];
1182  if (isAllocated)
1183  delete [] ind;
1184  return tmp;
1185  } else {
1186  mid = (l+ir) >> 1; //choose median of left, center and right
1187  {temp = ind[mid]; ind[mid]=ind[l+1]; ind[l+1]=temp;}//elements as partitioning element arr.
1188  if (a[ind[l]]>a[ind[ir]]) //also rearrange so that a[l]<=a[l+1]
1189  {temp = ind[l]; ind[l]=ind[ir]; ind[ir]=temp;}
1190 
1191  if (a[ind[l+1]]>a[ind[ir]])
1192  {temp=ind[l+1]; ind[l+1]=ind[ir]; ind[ir]=temp;}
1193 
1194  if (a[ind[l]]>a[ind[l+1]])
1195  {temp = ind[l]; ind[l]=ind[l+1]; ind[l+1]=temp;}
1196 
1197  i=l+1; //initialize pointers for partitioning
1198  j=ir;
1199  arr = ind[l+1];
1200  for (;;){
1201  do i++; while (a[ind[i]]<a[arr]);
1202  do j--; while (a[ind[j]]>a[arr]);
1203  if (j<i) break; //pointers crossed, partitioning complete
1204  {temp=ind[i]; ind[i]=ind[j]; ind[j]=temp;}
1205  }
1206  ind[l+1]=ind[j];
1207  ind[j]=arr;
1208  if (j>=rk) ir = j-1; //keep active the partition that
1209  if (j<=rk) l=i; //contains the k_th element
1210  }
1211  }
1212 }
const Bool_t kTRUE
Definition: RtypesCore.h:87

References kFALSE, and kTRUE.

Referenced by Median().

◆ KUncertainty()

constexpr Double_t TMath::KUncertainty ( )
constexpr

Definition at line 186 of file TMath.h.

187 {
188  return 0.0000024e-23;
189 }

Referenced by RUncertainty().

◆ Landau()

Double_t TMath::Landau ( Double_t  x,
Double_t  mpv = 0,
Double_t  sigma = 1,
Bool_t  norm = kFALSE 
)

◆ LandauI()

Double_t TMath::LandauI ( Double_t  x)

◆ LaplaceDist()

Double_t TMath::LaplaceDist ( Double_t  x,
Double_t  alpha = 0,
Double_t  beta = 1 
)

◆ LaplaceDistI()

Double_t TMath::LaplaceDistI ( Double_t  x,
Double_t  alpha = 0,
Double_t  beta = 1 
)

◆ Ldexp()

Double_t TMath::Ldexp ( Double_t  x,
Int_t  exp 
)
inline

Definition at line 562 of file TMath.h.

563  { return ldexp(x, exp); }

◆ Ln10()

constexpr Double_t TMath::Ln10 ( )
constexpr

Definition at line 80 of file TMath.h.

81 {
82  return 2.30258509299404568402;
83 }

◆ LnGamma()

Double_t TMath::LnGamma ( Double_t  z)

◆ LocMax() [1/2]

template<typename Iterator >
Iterator TMath::LocMax ( Iterator  first,
Iterator  last 
)

Definition at line 705 of file TMath.h.

706 {
707  // Return index of array with the maximum element.
708  // If more than one element is maximum returns first found.
709 
710  return std::max_element(first, last);
711 }

◆ LocMax() [2/2]

template<typename T >
Long64_t TMath::LocMax ( Long64_t  n,
const T *  a 
)

Definition at line 686 of file TMath.h.

686  {
687  // Return index of array with the maximum element.
688  // If more than one element is maximum returns first found.
689 
690  // Implement here since it is faster (see comment in LocMin function)
691 
692  if (n <= 0 || !a) return -1;
693  T xmax = a[0];
694  Long64_t loc = 0;
695  for (Long64_t i = 1; i < n; i++) {
696  if (xmax < a[i]) {
697  xmax = a[i];
698  loc = i;
699  }
700  }
701  return loc;
702 }

◆ LocMin() [1/2]

template<typename Iterator >
Iterator TMath::LocMin ( Iterator  first,
Iterator  last 
)

Definition at line 679 of file TMath.h.

679  {
680  // Return index of array with the minimum element.
681  // If more than one element is minimum returns first found.
682  return std::min_element(first, last);
683 }

◆ LocMin() [2/2]

template<typename T >
Long64_t TMath::LocMin ( Long64_t  n,
const T *  a 
)

Definition at line 657 of file TMath.h.

657  {
658  // Return index of array with the minimum element.
659  // If more than one element is minimum returns first found.
660 
661  // Implement here since this one is found to be faster (mainly on 64 bit machines)
662  // than stl generic implementation.
663  // When performing the comparison, the STL implementation needs to de-reference both the array iterator
664  // and the iterator pointing to the resulting minimum location
665 
666  if (n <= 0 || !a) return -1;
667  T xmin = a[0];
668  Long64_t loc = 0;
669  for (Long64_t i = 1; i < n; i++) {
670  if (xmin > a[i]) {
671  xmin = a[i];
672  loc = i;
673  }
674  }
675  return loc;
676 }

◆ Log()

Double_t TMath::Log ( Double_t  x)
inline

Definition at line 586 of file TMath.h.

587  { return log(x); }

Referenced by GeomMean().

◆ Log10()

Double_t TMath::Log10 ( Double_t  x)
inline

Definition at line 589 of file TMath.h.

590  { return log10(x); }

◆ Log2()

Double_t TMath::Log2 ( Double_t  x)

◆ LogE()

constexpr Double_t TMath::LogE ( )
constexpr

Definition at line 86 of file TMath.h.

87 {
88  return 0.43429448190325182765;
89 }

◆ LogNormal()

Double_t TMath::LogNormal ( Double_t  x,
Double_t  sigma,
Double_t  theta = 0,
Double_t  m = 1 
)

◆ Max() [1/10]

Double_t TMath::Max ( Double_t  a,
Double_t  b 
)
inline

Definition at line 227 of file TMathBase.h.

228  { return a >= b ? a : b; }

◆ Max() [2/10]

Float_t TMath::Max ( Float_t  a,
Float_t  b 
)
inline

Definition at line 224 of file TMathBase.h.

225  { return a >= b ? a : b; }

◆ Max() [3/10]

Int_t TMath::Max ( Int_t  a,
Int_t  b 
)
inline

Definition at line 206 of file TMathBase.h.

207  { return a >= b ? a : b; }

◆ Max() [4/10]

Long64_t TMath::Max ( Long64_t  a,
Long64_t  b 
)
inline

Definition at line 218 of file TMathBase.h.

219  { return a >= b ? a : b; }

◆ Max() [5/10]

Long_t TMath::Max ( Long_t  a,
Long_t  b 
)
inline

Definition at line 212 of file TMathBase.h.

213  { return a >= b ? a : b; }

◆ Max() [6/10]

Short_t TMath::Max ( Short_t  a,
Short_t  b 
)
inline

Definition at line 200 of file TMathBase.h.

201  { return a >= b ? a : b; }

◆ Max() [7/10]

UInt_t TMath::Max ( UInt_t  a,
UInt_t  b 
)
inline

Definition at line 209 of file TMathBase.h.

210  { return a >= b ? a : b; }

◆ Max() [8/10]

ULong64_t TMath::Max ( ULong64_t  a,
ULong64_t  b 
)
inline

Definition at line 221 of file TMathBase.h.

222  { return a >= b ? a : b; }

◆ Max() [9/10]

ULong_t TMath::Max ( ULong_t  a,
ULong_t  b 
)
inline

Definition at line 215 of file TMathBase.h.

216  { return a >= b ? a : b; }

◆ Max() [10/10]

UShort_t TMath::Max ( UShort_t  a,
UShort_t  b 
)
inline

Definition at line 203 of file TMathBase.h.

204  { return a >= b ? a : b; }

◆ MaxElement()

template<typename T >
T TMath::MaxElement ( Long64_t  n,
const T *  a 
)

Definition at line 650 of file TMath.h.

650  {
651  // Return maximum of array a of length n.
652 
653  return *std::max_element(a,a+n);
654 }

◆ Mean() [1/3]

template<typename Iterator >
Double_t TMath::Mean ( Iterator  first,
Iterator  last 
)

Definition at line 740 of file TMath.h.

741 {
742  // Return the weighted mean of an array defined by the iterators.
743 
744  Double_t sum = 0;
745  Double_t sumw = 0;
746  while ( first != last )
747  {
748  sum += *first;
749  sumw += 1;
750  first++;
751  }
752 
753  return sum/sumw;
754 }

◆ Mean() [2/3]

template<typename Iterator , typename WeightIterator >
Double_t TMath::Mean ( Iterator  first,
Iterator  last,
WeightIterator  wfirst 
)

Definition at line 757 of file TMath.h.

758 {
759  // Return the weighted mean of an array defined by the first and
760  // last iterators. The w iterator should point to the first element
761  // of a vector of weights of the same size as the main array.
762 
763  Double_t sum = 0;
764  Double_t sumw = 0;
765  int i = 0;
766  while ( first != last ) {
767  if ( *w < 0) {
768  ::Error("TMath::Mean","w[%d] = %.4e < 0 ?!",i,*w);
769  return 0;
770  }
771  sum += (*w) * (*first);
772  sumw += (*w) ;
773  ++w;
774  ++first;
775  ++i;
776  }
777  if (sumw <= 0) {
778  ::Error("TMath::Mean","sum of weights == 0 ?!");
779  return 0;
780  }
781 
782  return sum/sumw;
783 }
void Error(Ts &&... args)
Definition: TError.h:46

References Error().

Here is the call graph for this function:

◆ Mean() [3/3]

template<typename T >
Double_t TMath::Mean ( Long64_t  n,
const T *  a,
const Double_t w = 0 
)

Definition at line 786 of file TMath.h.

787 {
788  // Return the weighted mean of an array a with length n.
789 
790  if (w) {
791  return TMath::Mean(a, a+n, w);
792  } else {
793  return TMath::Mean(a, a+n);
794  }
795 }
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:786

Referenced by RMS().

◆ Median()

template<typename T >
Double_t TMath::Median ( Long64_t  n,
const T *  a,
const Double_t w = 0,
Long64_t work = 0 
)

Definition at line 1039 of file TMath.h.

1040 {
1041  // Return the median of the array a where each entry i has weight w[i] .
1042  // Both arrays have a length of at least n . The median is a number obtained
1043  // from the sorted array a through
1044  //
1045  // median = (a[jl]+a[jh])/2. where (using also the sorted index on the array w)
1046  //
1047  // sum_i=0,jl w[i] <= sumTot/2
1048  // sum_i=0,jh w[i] >= sumTot/2
1049  // sumTot = sum_i=0,n w[i]
1050  //
1051  // If w=0, the algorithm defaults to the median definition where it is
1052  // a number that divides the sorted sequence into 2 halves.
1053  // When n is odd or n > 1000, the median is kth element k = (n + 1) / 2.
1054  // when n is even and n < 1000the median is a mean of the elements k = n/2 and k = n/2 + 1.
1055  //
1056  // If the weights are supplied (w not 0) all weights must be >= 0
1057  //
1058  // If work is supplied, it is used to store the sorting index and assumed to be
1059  // >= n . If work=0, local storage is used, either on the stack if n < kWorkMax
1060  // or on the heap for n >= kWorkMax .
1061 
1062  const Int_t kWorkMax = 100;
1063 
1064  if (n <= 0 || !a) return 0;
1065  Bool_t isAllocated = kFALSE;
1066  Double_t median;
1067  Long64_t *ind;
1068  Long64_t workLocal[kWorkMax];
1069 
1070  if (work) {
1071  ind = work;
1072  } else {
1073  ind = workLocal;
1074  if (n > kWorkMax) {
1075  isAllocated = kTRUE;
1076  ind = new Long64_t[n];
1077  }
1078  }
1079 
1080  if (w) {
1081  Double_t sumTot2 = 0;
1082  for (Int_t j = 0; j < n; j++) {
1083  if (w[j] < 0) {
1084  ::Error("TMath::Median","w[%d] = %.4e < 0 ?!",j,w[j]);
1085  if (isAllocated) delete [] ind;
1086  return 0;
1087  }
1088  sumTot2 += w[j];
1089  }
1090 
1091  sumTot2 /= 2.;
1092 
1093  Sort(n, a, ind, kFALSE);
1094 
1095  Double_t sum = 0.;
1096  Int_t jl;
1097  for (jl = 0; jl < n; jl++) {
1098  sum += w[ind[jl]];
1099  if (sum >= sumTot2) break;
1100  }
1101 
1102  Int_t jh;
1103  sum = 2.*sumTot2;
1104  for (jh = n-1; jh >= 0; jh--) {
1105  sum -= w[ind[jh]];
1106  if (sum <= sumTot2) break;
1107  }
1108 
1109  median = 0.5*(a[ind[jl]]+a[ind[jh]]);
1110 
1111  } else {
1112 
1113  if (n%2 == 1)
1114  median = KOrdStat(n, a,n/2, ind);
1115  else {
1116  median = 0.5*(KOrdStat(n, a, n/2 -1, ind)+KOrdStat(n, a, n/2, ind));
1117  }
1118  }
1119 
1120  if (isAllocated)
1121  delete [] ind;
1122  return median;
1123 }
Element KOrdStat(Size n, const Element *a, Size k, Size *work=0)
Definition: TMath.h:1129
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Definition: TMath.h:964

References Error(), kFALSE, KOrdStat(), kTRUE, and Sort().

Here is the call graph for this function:

◆ Min() [1/10]

Double_t TMath::Min ( Double_t  a,
Double_t  b 
)
inline

Definition at line 195 of file TMathBase.h.

196  { return a <= b ? a : b; }

◆ Min() [2/10]

Float_t TMath::Min ( Float_t  a,
Float_t  b 
)
inline

Definition at line 192 of file TMathBase.h.

193  { return a <= b ? a : b; }

◆ Min() [3/10]

Int_t TMath::Min ( Int_t  a,
Int_t  b 
)
inline

Definition at line 174 of file TMathBase.h.

175  { return a <= b ? a : b; }

◆ Min() [4/10]

Long64_t TMath::Min ( Long64_t  a,
Long64_t  b 
)
inline

Definition at line 186 of file TMathBase.h.

187  { return a <= b ? a : b; }

◆ Min() [5/10]

Long_t TMath::Min ( Long_t  a,
Long_t  b 
)
inline

Definition at line 180 of file TMathBase.h.

181  { return a <= b ? a : b; }

◆ Min() [6/10]

Short_t TMath::Min ( Short_t  a,
Short_t  b 
)
inline

Definition at line 168 of file TMathBase.h.

169  { return a <= b ? a : b; }

◆ Min() [7/10]

UInt_t TMath::Min ( UInt_t  a,
UInt_t  b 
)
inline

Definition at line 177 of file TMathBase.h.

178  { return a <= b ? a : b; }

◆ Min() [8/10]

ULong64_t TMath::Min ( ULong64_t  a,
ULong64_t  b 
)
inline

Definition at line 189 of file TMathBase.h.

190  { return a <= b ? a : b; }

◆ Min() [9/10]

ULong_t TMath::Min ( ULong_t  a,
ULong_t  b 
)
inline

Definition at line 183 of file TMathBase.h.

184  { return a <= b ? a : b; }

◆ Min() [10/10]

UShort_t TMath::Min ( UShort_t  a,
UShort_t  b 
)
inline

Definition at line 171 of file TMathBase.h.

172  { return a <= b ? a : b; }

◆ MinElement()

template<typename T >
T TMath::MinElement ( Long64_t  n,
const T *  a 
)

Definition at line 643 of file TMath.h.

643  {
644  // Return minimum of array a of length n.
645 
646  return *std::min_element(a,a+n);
647 }

◆ MWair()

constexpr Double_t TMath::MWair ( )
constexpr

Definition at line 225 of file TMath.h.

226 {
227  return 28.9644;
228 } // kg kmol^-1 (or gm mol^-1)

Referenced by Rgair().

◆ Na()

constexpr Double_t TMath::Na ( )
constexpr

Definition at line 202 of file TMath.h.

203 {
204  return 6.02214199e+23;
205 } // mol^-1

Referenced by R(), and RUncertainty().

◆ NaUncertainty()

constexpr Double_t TMath::NaUncertainty ( )
constexpr

Definition at line 206 of file TMath.h.

207 {
208  return 0.00000047e+23;
209 }

Referenced by RUncertainty().

◆ NextPrime()

Long_t TMath::NextPrime ( Long_t  x)

◆ Nint()

template<typename T >
Int_t TMath::Nint ( x)
inline

Definition at line 544 of file TMath.h.

545 {
546  // Round to nearest integer. Rounds half integers to the nearest
547  // even integer.
548  int i;
549  if (x >= 0) {
550  i = int(x + 0.5);
551  if ( i & 1 && x + 0.5 == T(i) ) i--;
552  } else {
553  i = int(x - 0.5);
554  if ( i & 1 && x - 0.5 == T(i) ) i++;
555  }
556  return i;
557 }

Referenced by CeilNint(), and FloorNint().

◆ Normal2Plane()

template<typename T >
T * TMath::Normal2Plane ( const T  v1[3],
const T  v2[3],
const T  v3[3],
normal[3] 
)

Definition at line 994 of file TMath.h.

995 {
996  // Calculate a normal vector of a plane.
997  //
998  // Input:
999  // Float_t *p1,*p2,*p3 - 3 3D points belonged the plane to define it.
1000  //
1001  // Return:
1002  // Pointer to 3D normal vector (normalized)
1003 
1004  T v1[3], v2[3];
1005 
1006  v1[0] = p2[0] - p1[0];
1007  v1[1] = p2[1] - p1[1];
1008  v1[2] = p2[2] - p1[2];
1009 
1010  v2[0] = p3[0] - p1[0];
1011  v2[1] = p3[1] - p1[1];
1012  v2[2] = p3[2] - p1[2];
1013 
1014  NormCross(v1,v2,normal);
1015  return normal;
1016 }
T NormCross(const T v1[3], const T v2[3], T out[3])
Definition: TMath.h:636

References NormCross().

Here is the call graph for this function:

◆ Normalize() [1/2]

Double_t TMath::Normalize ( Double_t  v[3])

Referenced by NormCross().

◆ Normalize() [2/2]

Float_t TMath::Normalize ( Float_t  v[3])

◆ NormCross()

template<typename T >
T TMath::NormCross ( const T  v1[3],
const T  v2[3],
out[3] 
)
inline

Definition at line 636 of file TMath.h.

637 {
638  // Calculate the Normalized Cross Product of two vectors
639  return Normalize(Cross(v1,v2,out));
640 }
Double_t Normalize(Double_t v[3])
T * Cross(const T v1[3], const T v2[3], T out[3])
Definition: TMath.h:982

References Cross(), and Normalize().

Referenced by Normal2Plane().

Here is the call graph for this function:

◆ NormQuantile()

Double_t TMath::NormQuantile ( Double_t  p)

◆ Odd()

Bool_t TMath::Odd ( Long_t  a)
inline

Definition at line 103 of file TMathBase.h.

104  { return (a & 1); }

◆ Permute()

Bool_t TMath::Permute ( Int_t  n,
Int_t a 
)

◆ Pi()

constexpr Double_t TMath::Pi ( )
constexpr

Definition at line 40 of file TMath.h.

41 {
42  return 3.14159265358979323846;
43 }

Referenced by ACos(), ASin(), ATan2(), DegToRad(), InvPi(), PiOver2(), PiOver4(), RadToDeg(), and TwoPi().

◆ PiOver2()

constexpr Double_t TMath::PiOver2 ( )
constexpr

Definition at line 48 of file TMath.h.

49 {
50  return Pi() / 2.0;
51 }

References Pi().

Here is the call graph for this function:

◆ PiOver4()

constexpr Double_t TMath::PiOver4 ( )
constexpr

Definition at line 52 of file TMath.h.

53 {
54  return Pi() / 4.0;
55 }

References Pi().

Here is the call graph for this function:

◆ Poisson()

Double_t TMath::Poisson ( Double_t  x,
Double_t  par 
)

◆ PoissonI()

Double_t TMath::PoissonI ( Double_t  x,
Double_t  par 
)

◆ Power() [1/5]

Double_t TMath::Power ( Double_t  x,
Double_t  y 
)
inline

Definition at line 574 of file TMath.h.

575  { return std::pow(x, y); }

◆ Power() [2/5]

Double_t TMath::Power ( Double_t  x,
Int_t  y 
)
inline

Definition at line 577 of file TMath.h.

577  {
578 #ifdef R__ANSISTREAM
579  return std::pow(x, y);
580 #else
581  return std::pow(x, (Double_t) y);
582 #endif
583 }

◆ Power() [3/5]

LongDouble_t TMath::Power ( Long64_t  x,
Long64_t  y 
)
inline

Definition at line 571 of file TMath.h.

572  { return std::pow(x,y); }

◆ Power() [4/5]

LongDouble_t TMath::Power ( LongDouble_t  x,
Long64_t  y 
)
inline

Definition at line 568 of file TMath.h.

569  { return std::pow(x,(LongDouble_t)y); }
long double LongDouble_t
Definition: RtypesCore.h:57

◆ Power() [5/5]

LongDouble_t TMath::Power ( LongDouble_t  x,
LongDouble_t  y 
)
inline

Definition at line 565 of file TMath.h.

566  { return std::pow(x,y); }

◆ Prob()

Double_t TMath::Prob ( Double_t  chi2,
Int_t  ndf 
)

◆ Qe()

constexpr Double_t TMath::Qe ( )
constexpr

Definition at line 244 of file TMath.h.

245 {
246  return 1.602176462e-19;
247 } // C

◆ QeUncertainty()

constexpr Double_t TMath::QeUncertainty ( )
constexpr

Definition at line 248 of file TMath.h.

249 {
250  return 0.000000063e-19;
251 }

◆ Quantiles()

void TMath::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 
)

◆ QuietNaN()

Double_t TMath::QuietNaN ( )
inline

Definition at line 597 of file TMath.h.

597  {
598  // returns a quiet NaN as defined by IEEE 754
599  // see http://en.wikipedia.org/wiki/NaN#Quiet_NaN
600  return std::numeric_limits<Double_t>::quiet_NaN();
601 }

◆ R()

constexpr Double_t TMath::R ( )
constexpr

◆ RadToDeg()

constexpr Double_t TMath::RadToDeg ( )
constexpr

Definition at line 60 of file TMath.h.

61 {
62  return 180.0 / Pi();
63 }

References Pi().

Here is the call graph for this function:

◆ Range() [1/5]

Double_t TMath::Range ( Double_t  lb,
Double_t  ub,
Double_t  x 
)
inline

Definition at line 244 of file TMathBase.h.

245  { return x < lb ? lb : (x > ub ? ub : x); }

◆ Range() [2/5]

Int_t TMath::Range ( Int_t  lb,
Int_t  ub,
Int_t  x 
)
inline

Definition at line 235 of file TMathBase.h.

236  { return x < lb ? lb : (x > ub ? ub : x); }

◆ Range() [3/5]

Long_t TMath::Range ( Long_t  lb,
Long_t  ub,
Long_t  x 
)
inline

Definition at line 238 of file TMathBase.h.

239  { return x < lb ? lb : (x > ub ? ub : x); }

◆ Range() [4/5]

Short_t TMath::Range ( Short_t  lb,
Short_t  ub,
Short_t  x 
)
inline

Definition at line 232 of file TMathBase.h.

233  { return x < lb ? lb : (x > ub ? ub : x); }

◆ Range() [5/5]

ULong_t TMath::Range ( ULong_t  lb,
ULong_t  ub,
ULong_t  x 
)
inline

Definition at line 241 of file TMathBase.h.

242  { return x < lb ? lb : (x > ub ? ub : x); }

◆ Rgair()

constexpr Double_t TMath::Rgair ( )
constexpr

Definition at line 232 of file TMath.h.

233 {
234  return (1000.0 * R()) / MWair();
235 } // J kg^-1 K^-1
constexpr Double_t MWair()
Definition: TMath.h:225
constexpr Double_t R()
Definition: TMath.h:213

References MWair(), and R().

Here is the call graph for this function:

◆ RMS() [1/3]

template<typename Iterator >
Double_t TMath::RMS ( Iterator  first,
Iterator  last 
)

Definition at line 826 of file TMath.h.

827 {
828  // Return the Standard Deviation of an array defined by the iterators.
829  // Note that this function returns the sigma(standard deviation) and
830  // not the root mean square of the array.
831 
832  // Use the two pass algorithm, which is slower (! a factor of 2) but much more
833  // precise. Since we have a vector the 2 pass algorithm is still faster than the
834  // Welford algorithm. (See also ROOT-5545)
835 
836  Double_t n = 0;
837 
838  Double_t tot = 0;
839  Double_t mean = TMath::Mean(first,last);
840  while ( first != last ) {
841  Double_t x = Double_t(*first);
842  tot += (x - mean)*(x - mean);
843  ++first;
844  ++n;
845  }
846  Double_t rms = (n > 1) ? TMath::Sqrt(tot/(n-1)) : 0.0;
847  return rms;
848 }
Double_t Sqrt(Double_t x)
Definition: TMath.h:528

References Mean(), and Sqrt().

Here is the call graph for this function:

◆ RMS() [2/3]

template<typename Iterator , typename WeightIterator >
Double_t TMath::RMS ( Iterator  first,
Iterator  last,
WeightIterator  wfirst 
)

Definition at line 851 of file TMath.h.

852 {
853  // Return the weighted Standard Deviation of an array defined by the iterators.
854  // Note that this function returns the sigma(standard deviation) and
855  // not the root mean square of the array.
856 
857  // As in the unweighted case use the two pass algorithm
858 
859  Double_t tot = 0;
860  Double_t sumw = 0;
861  Double_t sumw2 = 0;
862  Double_t mean = TMath::Mean(first,last,w);
863  while ( first != last ) {
864  Double_t x = Double_t(*first);
865  sumw += *w;
866  sumw2 += (*w) * (*w);
867  tot += (*w) * (x - mean)*(x - mean);
868  ++first;
869  ++w;
870  }
871  // use the correction neff/(neff -1) for the unbiased formula
872  Double_t rms = TMath::Sqrt(tot * sumw/ (sumw*sumw - sumw2) );
873  return rms;
874 }

References Mean(), and Sqrt().

Here is the call graph for this function:

◆ RMS() [3/3]

template<typename T >
Double_t TMath::RMS ( Long64_t  n,
const T *  a,
const Double_t w = 0 
)

Definition at line 878 of file TMath.h.

879 {
880  // Return the Standard Deviation of an array a with length n.
881  // Note that this function returns the sigma(standard deviation) and
882  // not the root mean square of the array.
883 
884  return (w) ? TMath::RMS(a, a+n, w) : TMath::RMS(a, a+n);
885 }
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:878
Double_t RMS(Iterator first, Iterator last, WeightIterator wfirst)
Definition: TMath.h:851

◆ RootsCubic()

Bool_t TMath::RootsCubic ( const Double_t  coef[4],
Double_t a,
Double_t b,
Double_t c 
)

◆ RUncertainty()

constexpr Double_t TMath::RUncertainty ( )
constexpr

Definition at line 217 of file TMath.h.

218 {
219  return R() * ((KUncertainty() / K()) + (NaUncertainty() / Na()));
220 }
constexpr Double_t NaUncertainty()
Definition: TMath.h:206
constexpr Double_t KUncertainty()
Definition: TMath.h:186

References K(), KUncertainty(), Na(), NaUncertainty(), and R().

Here is the call graph for this function:

◆ Sigma()

constexpr Double_t TMath::Sigma ( )
constexpr

Definition at line 192 of file TMath.h.

193 {
194  return 5.6704e-8;
195 } // W m^-2 K^-4

◆ SigmaUncertainty()

constexpr Double_t TMath::SigmaUncertainty ( )
constexpr

Definition at line 196 of file TMath.h.

197 {
198  return 0.000040e-8;
199 }

◆ Sign() [1/4]

Double_t TMath::Sign ( Double_t  a,
Double_t  b 
)
inline

Definition at line 159 of file TMathBase.h.

160  { return std::copysign(a,b); }

◆ Sign() [2/4]

Float_t TMath::Sign ( Float_t  a,
Float_t  b 
)
inline

Definition at line 156 of file TMathBase.h.

157  { return std::copysign(a,b); }

◆ Sign() [3/4]

LongDouble_t TMath::Sign ( LongDouble_t  a,
LongDouble_t  b 
)
inline

Definition at line 162 of file TMathBase.h.

163  { return std::copysign(a,b); }

◆ Sign() [4/4]

template<typename T1 , typename T2 >
T1 TMath::Sign ( T1  a,
T2  b 
)
inline

Definition at line 153 of file TMathBase.h.

154  { return (SignBit(b)) ? - Abs(a) : Abs(a); }
LongDouble_t Abs(LongDouble_t d)
Definition: TMathBase.h:130
Bool_t SignBit(LongDouble_t a)
Definition: TMathBase.h:146

References Abs(), and SignBit().

Here is the call graph for this function:

◆ SignalingNaN()

Double_t TMath::SignalingNaN ( )
inline

Definition at line 604 of file TMath.h.

604  {
605  // returns a signaling NaN as defined by IEEE 754
606  // see http://en.wikipedia.org/wiki/NaN#Signaling_NaN
607  return std::numeric_limits<Double_t>::signaling_NaN();
608 }

◆ SignBit() [1/4]

Bool_t TMath::SignBit ( Double_t  a)
inline

Definition at line 143 of file TMathBase.h.

144  { return std::signbit(a); }

◆ SignBit() [2/4]

Bool_t TMath::SignBit ( Float_t  a)
inline

Definition at line 140 of file TMathBase.h.

141  { return std::signbit(a); }

◆ SignBit() [3/4]

template<typename Integer >
Bool_t TMath::SignBit ( Integer  a)
inline

Definition at line 137 of file TMathBase.h.

138  { return (a < 0); }

◆ SignBit() [4/4]

Bool_t TMath::SignBit ( LongDouble_t  a)
inline

Definition at line 146 of file TMathBase.h.

147  { return std::signbit(a); }

Referenced by Sign().

◆ Sin()

Double_t TMath::Sin ( Double_t  x)
inline

Definition at line 485 of file TMath.h.

486  { return std::sin(x); }

◆ SinH()

Double_t TMath::SinH ( Double_t  x)
inline

Definition at line 494 of file TMath.h.

495  { return std::sinh(x); }

◆ Sort()

template<typename Element , typename Index >
void TMath::Sort ( Index  n,
const Element *  a,
Index *  index,
Bool_t  down = kTRUE 
)

Definition at line 964 of file TMath.h.

965 {
966  // Sort the n elements of the array a of generic templated type Element.
967  // In output the array index of type Index contains the indices of the sorted array.
968  // If down is false sort in increasing order (default is decreasing order).
969 
970  // NOTE that the array index must be created with a length >= n
971  // before calling this function.
972  // NOTE also that the size type for n must be the same type used for the index array
973  // (templated type Index)
974 
975  for(Index i = 0; i < n; i++) { index[i] = i; }
976  if ( down )
977  std::sort(index, index + n, CompareDesc<const Element*>(a) );
978  else
979  std::sort(index, index + n, CompareAsc<const Element*>(a) );
980 }

Referenced by Median().

◆ SortItr()

template<typename Iterator , typename IndexIterator >
void TMath::SortItr ( Iterator  first,
Iterator  last,
IndexIterator  index,
Bool_t  down = kTRUE 
)

Definition at line 939 of file TMath.h.

940 {
941  // Sort the n1 elements of the Short_t array defined by its
942  // iterators. In output the array index contains the indices of
943  // the sorted array. If down is false sort in increasing order
944  // (default is decreasing order).
945 
946  // NOTE that the array index must be created with a length bigger
947  // or equal than the main array before calling this function.
948 
949  int i = 0;
950 
951  IndexIterator cindex = index;
952  for ( Iterator cfirst = first; cfirst != last; ++cfirst )
953  {
954  *cindex = i++;
955  ++cindex;
956  }
957 
958  if ( down )
959  std::sort(index, cindex, CompareDesc<Iterator>(first) );
960  else
961  std::sort(index, cindex, CompareAsc<Iterator>(first) );
962 }

◆ Sq()

Double_t TMath::Sq ( Double_t  x)
inline

Definition at line 525 of file TMath.h.

526  { return x*x; }

◆ Sqrt()

Double_t TMath::Sqrt ( Double_t  x)
inline

Definition at line 528 of file TMath.h.

529  { return std::sqrt(x); }

Referenced by RMS().

◆ Sqrt2()

constexpr Double_t TMath::Sqrt2 ( )
constexpr

Definition at line 68 of file TMath.h.

69 {
70  return 1.4142135623730950488016887242097;
71 }

◆ StdDev() [1/3]

template<typename Iterator >
Double_t TMath::StdDev ( Iterator  first,
Iterator  last 
)

Definition at line 439 of file TMath.h.

439 { return RMS<Iterator>(first,last); }

◆ StdDev() [2/3]

template<typename Iterator , typename WeightIterator >
Double_t TMath::StdDev ( Iterator  first,
Iterator  last,
WeightIterator  wfirst 
)

Definition at line 440 of file TMath.h.

440 { return RMS<Iterator,WeightIterator>(first,last,wfirst); }

◆ StdDev() [3/3]

template<typename T >
Double_t TMath::StdDev ( Long64_t  n,
const T *  a,
const Double_t w = 0 
)

Definition at line 438 of file TMath.h.

438 { return RMS<T>(n,a,w); }

◆ StruveH0()

Double_t TMath::StruveH0 ( Double_t  x)

◆ StruveH1()

Double_t TMath::StruveH1 ( Double_t  x)

◆ StruveL0()

Double_t TMath::StruveL0 ( Double_t  x)

◆ StruveL1()

Double_t TMath::StruveL1 ( Double_t  x)

◆ Student()

Double_t TMath::Student ( Double_t  T,
Double_t  ndf 
)

◆ StudentI()

Double_t TMath::StudentI ( Double_t  T,
Double_t  ndf 
)

◆ StudentQuantile()

Double_t TMath::StudentQuantile ( Double_t  p,
Double_t  ndf,
Bool_t  lower_tail = kTRUE 
)

◆ Tan()

Double_t TMath::Tan ( Double_t  x)
inline

Definition at line 491 of file TMath.h.

492  { return std::tan(x); }

◆ TanH()

Double_t TMath::TanH ( Double_t  x)
inline

Definition at line 500 of file TMath.h.

501  { return std::tanh(x); }

◆ TwoPi()

constexpr Double_t TMath::TwoPi ( )
constexpr

Definition at line 44 of file TMath.h.

45 {
46  return 2.0 * Pi();
47 }

References Pi().

Here is the call graph for this function:

◆ Vavilov()

Double_t TMath::Vavilov ( Double_t  x,
Double_t  kappa,
Double_t  beta2 
)

◆ VavilovI()

Double_t TMath::VavilovI ( Double_t  x,
Double_t  kappa,
Double_t  beta2 
)

◆ Voigt()

Double_t TMath::Voigt ( Double_t  x,
Double_t  sigma,
Double_t  lg,
Int_t  r = 4 
)