Logo ROOT   6.14/05
Reference Guide
Classes | Functions
TMath Namespace Reference

TMath. More...

Classes

struct  Limits
 

Functions

Short_t Abs (Short_t d)
 
Int_t Abs (Int_t d)
 
Long_t Abs (Long_t d)
 
Long64_t Abs (Long64_t d)
 
Float_t Abs (Float_t d)
 
Double_t Abs (Double_t d)
 
LongDouble_t Abs (LongDouble_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)
 integer order modified Bessel function K_n(x) More...
 
Double_t BesselI1 (Double_t x)
 modified Bessel function K_0(x) More...
 
Double_t BesselJ0 (Double_t x)
 modified Bessel function K_1(x) More...
 
Double_t BesselJ1 (Double_t x)
 Bessel function J0(x) for any real x. More...
 
Double_t BesselK (Int_t n, Double_t x)
 integer order modified Bessel function I_n(x) More...
 
Double_t BesselK0 (Double_t x)
 modified Bessel function I_0(x) More...
 
Double_t BesselK1 (Double_t x)
 modified Bessel function I_1(x) More...
 
Double_t BesselY0 (Double_t x)
 Bessel function J1(x) for any real x. More...
 
Double_t BesselY1 (Double_t x)
 Bessel function Y0(x) for positive x. More...
 
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 T >
Long64_t BinarySearch (Long64_t n, const T *array, T value)
 Binary search in an array of n values to locate value. More...
 
template<typename T >
Long64_t BinarySearch (Long64_t n, const T **array, T value)
 Binary search in an array of n values to locate value. More...
 
template<typename Iterator , typename Element >
Iterator BinarySearch (Iterator first, Iterator last, Element value)
 Binary search in an array defined by its iterators. More...
 
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)
 Calculate a Breit Wigner function with mean and gamma. More...
 
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 ()
 Velocity of light in \( m s^{-1} \). More...
 
Double_t CauchyDist (Double_t x, Double_t t=0, Double_t s=1)
 
constexpr Double_t Ccgs ()
 \( cm s^{-1} \) More...
 
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])
 Calculate the Cross Product of two vectors: out = [v1 x v2]. More...
 
constexpr Double_t CUncertainty ()
 Speed of light uncertainty. More...
 
constexpr Double_t DegToRad ()
 Conversion from degree to radian:

\[ \frac{\pi}{180} \]

. More...

 
Double_t DiLog (Double_t x)
 Modified Struve functions of order 1. More...
 
constexpr Double_t E ()
 Base of natural log:

\[ e \]

. More...

 
Double_t Erf (Double_t x)
 Computation of the error function erf(x). More...
 
Double_t Erfc (Double_t x)
 Compute the complementary error function erfc(x). More...
 
Double_t ErfcInverse (Double_t x)
 returns the inverse of the complementary error function x must be 0<x<2 implement using the quantile of the normal distribution instead of ErfInverse for better numerical precision for large x More...
 
Double_t ErfInverse (Double_t x)
 returns the inverse error function x must be <-1<x<1 More...
 
constexpr Double_t EulerGamma ()
 Euler-Mascheroni Constant. More...
 
Bool_t Even (Long_t a)
 
Double_t Exp (Double_t x)
 
Double_t Factorial (Int_t i)
 Compute factorial(n). More...
 
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)
 Check if it is finite with a mask in order to be consistent in presence of fast math. More...
 
Int_t Finite (Float_t x)
 Check if it is finite with a mask in order to be consistent in presence of fast math. More...
 
Double_t Floor (Double_t x)
 
Int_t FloorNint (Double_t x)
 
Double_t Freq (Double_t x)
 Computation of the normal frequency function freq(x). More...
 
constexpr Double_t G ()
 Gravitational constant in: \( m^{3} kg^{-1} s^{-2} \). More...
 
Double_t GamCf (Double_t a, Double_t x)
 Computation of the incomplete gamma function P(a,x) via its continued fraction representation. More...
 
Double_t Gamma (Double_t z)
 Computation of gamma(z) for all z. More...
 
Double_t Gamma (Double_t a, Double_t x)
 Computation of the normalized lower incomplete gamma function P(a,x) as defined in the Handbook of Mathematical Functions by Abramowitz and Stegun, formula 6.5.1 on page 260 . More...
 
Double_t GammaDist (Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
 
Double_t GamSer (Double_t a, Double_t x)
 Computation of the incomplete gamma function P(a,x) via its series representation. More...
 
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. More...
 
constexpr Double_t Gcgs ()
 \( cm^{3} g^{-1} s^{-2} \) More...
 
template<typename T >
Double_t GeomMean (Long64_t n, const T *a)
 Return the geometric mean of an array a of size n. More...
 
template<typename Iterator >
Double_t GeomMean (Iterator first, Iterator last)
 Return the geometric mean of an array defined by the iterators. More...
 
constexpr Double_t GhbarC ()
 \( \frac{G}{\hbar C} \) in \( (GeV/c^{2})^{-2} \) More...
 
constexpr Double_t GhbarCUncertainty ()
 \( \frac{G}{\hbar C} \) uncertainty. More...
 
constexpr Double_t Gn ()
 Standard acceleration of gravity in \( m s^{-2} \). More...
 
constexpr Double_t GnUncertainty ()
 Standard acceleration of gravity uncertainty. More...
 
constexpr Double_t GUncertainty ()
 Gravitational constant uncertainty. More...
 
constexpr Double_t H ()
 Planck's constant in \( J s \)

\[ h \]

. More...

 
ULong_t Hash (const void *txt, Int_t ntxt)
 
ULong_t Hash (const char *str)
 Return a case-sensitive hash value (endian independent). More...
 
constexpr Double_t Hbar ()
 \( \hbar \) in \( J s \)

\[ \hbar = \frac{h}{2\pi} \]

More...
 
constexpr Double_t Hbarcgs ()
 \( erg s \) More...
 
constexpr Double_t HbarUncertainty ()
 \( \hbar \) uncertainty. More...
 
constexpr Double_t HC ()
 \( hc \) in \( J m \) More...
 
constexpr Double_t HCcgs ()
 \( erg cm \) More...
 
constexpr Double_t Hcgs ()
 \( erg s \) More...
 
constexpr Double_t HUncertainty ()
 Planck's constant uncertainty. More...
 
Double_t Hypot (Double_t x, Double_t y)
 
Long_t Hypot (Long_t x, Long_t y)
 
Double_t Infinity ()
 Returns an infinity as defined by the IEEE standard. More...
 
constexpr Double_t InvPi ()
 \( \frac{1.}{\pi}\) More...
 
template<typename 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 arrays x and y, kFALSE otherwise. More...
 
Bool_t IsNaN (Double_t x)
 
Bool_t IsNaN (Float_t x)
 
constexpr Double_t K ()
 Boltzmann's constant in \( J K^{-1} \)

\[ k \]

. More...

 
constexpr Double_t Kcgs ()
 \( erg K^{-1} \) More...
 
Double_t KolmogorovProb (Double_t z)
 
Double_t KolmogorovTest (Int_t na, const Double_t *a, Int_t nb, const Double_t *b, Option_t *option)
 
template<class Element , typename Size >
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). More...
 
constexpr Double_t KUncertainty ()
 Boltzmann's constant uncertainty. More...
 
Double_t Landau (Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
 The LANDAU function. More...
 
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 ()
 Natural log of 10 (to convert log to ln) More...
 
Double_t LnGamma (Double_t z)
 Computation of ln[gamma(z)] for all z. More...
 
template<typename T >
Long64_t LocMax (Long64_t n, const T *a)
 Return index of array with the maximum element. More...
 
template<typename Iterator >
Iterator LocMax (Iterator first, Iterator last)
 Return index of array with the maximum element. More...
 
template<typename T >
Long64_t LocMin (Long64_t n, const T *a)
 Return index of array with the minimum element. More...
 
template<typename Iterator >
Iterator LocMin (Iterator first, Iterator last)
 Return index of array with the minimum element. More...
 
Double_t Log (Double_t x)
 
Double_t Log10 (Double_t x)
 
Double_t Log2 (Double_t x)
 
constexpr Double_t LogE ()
 Base-10 log of e (to convert ln to log) More...
 
Double_t LogNormal (Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
 
Short_t Max (Short_t a, Short_t b)
 
UShort_t Max (UShort_t a, UShort_t b)
 
Int_t Max (Int_t a, Int_t b)
 
UInt_t Max (UInt_t a, UInt_t b)
 
Long_t Max (Long_t a, Long_t b)
 
ULong_t Max (ULong_t a, ULong_t b)
 
Long64_t Max (Long64_t a, Long64_t b)
 
ULong64_t Max (ULong64_t a, ULong64_t b)
 
Float_t Max (Float_t a, Float_t b)
 
Double_t Max (Double_t a, Double_t b)
 
template<typename T >
MaxElement (Long64_t n, const T *a)
 Return maximum of array a of length n. More...
 
template<typename T >
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. More...
 
template<typename Iterator >
Double_t Mean (Iterator first, Iterator last)
 Return the weighted mean of an array defined by the iterators. More...
 
template<typename Iterator , typename WeightIterator >
Double_t Mean (Iterator first, Iterator last, WeightIterator wfirst)
 Return the weighted mean of an array defined by the first and last iterators. More...
 
template<typename T >
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] . More...
 
Short_t Min (Short_t a, Short_t b)
 
UShort_t Min (UShort_t a, UShort_t b)
 
Int_t Min (Int_t a, Int_t b)
 
UInt_t Min (UInt_t a, UInt_t b)
 
Long_t Min (Long_t a, Long_t b)
 
ULong_t Min (ULong_t a, ULong_t b)
 
Long64_t Min (Long64_t a, Long64_t b)
 
ULong64_t Min (ULong64_t a, ULong64_t b)
 
Float_t Min (Float_t a, Float_t b)
 
Double_t Min (Double_t a, Double_t b)
 
template<typename T >
MinElement (Long64_t n, const T *a)
 Return minimum of array a of length n. More...
 
constexpr Double_t MWair ()
 Molecular weight of dry air 1976 US Standard Atmosphere in \( kg kmol^{-1} \) or \( gm mol^{-1} \) More...
 
constexpr Double_t Na ()
 Avogadro constant (Avogadro's Number) in \( mol^{-1} \). More...
 
constexpr Double_t NaUncertainty ()
 Avogadro constant (Avogadro's Number) uncertainty. More...
 
Long_t NextPrime (Long_t x)
 TMath Base functionsDefine the functions Min, Max, Abs, Sign, Range for all types. More...
 
template<typename T >
Int_t Nint (T x)
 Round to nearest integer. Rounds half integers to the nearest even integer. More...
 
template<typename T >
T * Normal2Plane (const T v1[3], const T v2[3], const T v3[3], T normal[3])
 Calculate a normal vector of a plane. More...
 
Float_t Normalize (Float_t v[3])
 Normalize a vector v in place. More...
 
Double_t Normalize (Double_t v[3])
 Normalize a vector v in place. More...
 
template<typename T >
NormCross (const T v1[3], const T v2[3], T out[3])
 Calculate the Normalized Cross Product of two vectors. More...
 
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 ()
 

\[ \pi\]

More...
 
constexpr Double_t PiOver2 ()
 

\[ \frac{\pi}{2} \]

More...
 
constexpr Double_t PiOver4 ()
 

\[ \frac{\pi}{4} \]

More...
 
Double_t Poisson (Double_t x, Double_t par)
 
Double_t PoissonI (Double_t x, Double_t par)
 
LongDouble_t Power (LongDouble_t x, LongDouble_t y)
 
LongDouble_t Power (LongDouble_t x, Long64_t y)
 
LongDouble_t Power (Long64_t x, Long64_t y)
 
Double_t Power (Double_t x, Double_t y)
 
Double_t Power (Double_t x, Int_t y)
 
Double_t Prob (Double_t chi2, Int_t ndf)
 
constexpr Double_t Qe ()
 Elementary charge in \( C \) . More...
 
constexpr Double_t QeUncertainty ()
 Elementary charge uncertainty. More...
 
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 ()
 Returns a quiet NaN as defined by IEEE 754 More...
 
constexpr Double_t R ()
 Universal gas constant ( \( Na K \)) in \( J K^{-1} mol^{-1} \) More...
 
constexpr Double_t RadToDeg ()
 Conversion from radian to degree:

\[ \frac{180}{\pi} \]

. More...

 
Short_t Range (Short_t lb, Short_t ub, Short_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)
 
ULong_t Range (ULong_t lb, ULong_t ub, ULong_t x)
 
Double_t Range (Double_t lb, Double_t ub, Double_t x)
 
constexpr Double_t Rgair ()
 Dry Air Gas Constant (R / MWair) in \( J kg^{-1} K^{-1} \) More...
 
template<typename T >
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. More...
 
template<typename Iterator >
Double_t RMS (Iterator first, Iterator last)
 Return the Standard Deviation of an array defined by the iterators. More...
 
template<typename Iterator , typename WeightIterator >
Double_t RMS (Iterator first, Iterator last, WeightIterator wfirst)
 Return the weighted Standard Deviation of an array defined by the iterators. More...
 
Bool_t RootsCubic (const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c)
 
constexpr Double_t RUncertainty ()
 Universal gas constant uncertainty. More...
 
constexpr Double_t Sigma ()
 Stefan-Boltzmann constant in \( W m^{-2} K^{-4}\)

\[ \sigma \]

. More...

 
constexpr Double_t SigmaUncertainty ()
 Stefan-Boltzmann constant uncertainty. More...
 
template<typename T1 , typename T2 >
T1 Sign (T1 a, T2 b)
 
Float_t Sign (Float_t a, Float_t b)
 
Double_t Sign (Double_t a, Double_t b)
 
LongDouble_t Sign (LongDouble_t a, LongDouble_t b)
 
Double_t SignalingNaN ()
 Returns a signaling NaN as defined by IEEE 754](http://en.wikipedia.org/wiki/NaN#Signaling_NaN) More...
 
template<typename Integer >
Bool_t SignBit (Integer a)
 
Bool_t SignBit (Float_t a)
 
Bool_t SignBit (Double_t 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)
 Sort the n elements of the array a of generic templated type Element. More...
 
template<typename Iterator , typename IndexIterator >
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. More...
 
Double_t Sq (Double_t x)
 
Double_t Sqrt (Double_t x)
 
constexpr Double_t Sqrt2 ()
 

\[ \sqrt{2} \]

More...
 
template<typename T >
Double_t StdDev (Long64_t n, const T *a, const Double_t *w=0)
 
template<typename Iterator >
Double_t StdDev (Iterator first, Iterator last)
 
template<typename Iterator , typename WeightIterator >
Double_t StdDev (Iterator first, Iterator last, WeightIterator wfirst)
 
Double_t StruveH0 (Double_t x)
 Bessel function Y1(x) for positive x. More...
 
Double_t StruveH1 (Double_t x)
 Struve functions of order 0. More...
 
Double_t StruveL0 (Double_t x)
 Struve functions of order 1. More...
 
Double_t StruveL1 (Double_t x)
 Modified Struve functions of order 0. More...
 
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 ()
 

\[ 2\pi\]

More...
 
Double_t Vavilov (Double_t x, Double_t kappa, Double_t beta2)
 
Double_t VavilovDenEval (Double_t rlam, Double_t *AC, Double_t *HC, Int_t itype)
 
Double_t VavilovI (Double_t x, Double_t kappa, Double_t beta2)
 
void VavilovSet (Double_t rkappa, Double_t beta2, Bool_t mode, Double_t *WCM, Double_t *AC, Double_t *HC, Int_t &itype, Int_t &npt)
 
Double_t Voigt (Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
 

Detailed Description

TMath.

Encapsulate most frequently used Math functions. NB. The basic functions Min, Max, Abs and Sign are defined in TMathBase.

Function Documentation

◆ Abs() [1/7]

Short_t TMath::Abs ( Short_t  d)
inline

Definition at line 108 of file TMathBase.h.

◆ Abs() [2/7]

Int_t TMath::Abs ( Int_t  d)
inline

Definition at line 111 of file TMathBase.h.

◆ Abs() [3/7]

Long_t TMath::Abs ( Long_t  d)
inline

Definition at line 114 of file TMathBase.h.

◆ Abs() [4/7]

Long64_t TMath::Abs ( Long64_t  d)
inline

Definition at line 117 of file TMathBase.h.

◆ Abs() [5/7]

Float_t TMath::Abs ( Float_t  d)
inline

Definition at line 124 of file TMathBase.h.

◆ Abs() [6/7]

Double_t TMath::Abs ( Double_t  d)
inline

Definition at line 127 of file TMathBase.h.

◆ Abs() [7/7]

LongDouble_t TMath::Abs ( LongDouble_t  d)
inline

Definition at line 130 of file TMathBase.h.

◆ ACos()

Double_t TMath::ACos ( Double_t  x)
inline

Definition at line 667 of file TMath.h.

◆ ACosH()

Double_t TMath::ACosH ( Double_t  x)

Definition at line 77 of file TMath.cxx.

◆ AreEqualAbs()

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

Definition at line 412 of file TMath.h.

◆ AreEqualRel()

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

Definition at line 416 of file TMath.h.

◆ ASin()

Double_t TMath::ASin ( Double_t  x)
inline

Definition at line 660 of file TMath.h.

◆ ASinH()

Double_t TMath::ASinH ( Double_t  x)

Definition at line 64 of file TMath.cxx.

◆ ATan()

Double_t TMath::ATan ( Double_t  x)
inline

Definition at line 674 of file TMath.h.

◆ ATan2()

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

Definition at line 678 of file TMath.h.

◆ ATanH()

Double_t TMath::ATanH ( Double_t  x)

Definition at line 90 of file TMath.cxx.

◆ BesselI()

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

◆ BesselI0()

Double_t TMath::BesselI0 ( Double_t  x)

integer order modified Bessel function K_n(x)

◆ BesselI1()

Double_t TMath::BesselI1 ( Double_t  x)

modified Bessel function K_0(x)

◆ BesselJ0()

Double_t TMath::BesselJ0 ( Double_t  x)

modified Bessel function K_1(x)

◆ BesselJ1()

Double_t TMath::BesselJ1 ( Double_t  x)

Bessel function J0(x) for any real x.

◆ BesselK()

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

integer order modified Bessel function I_n(x)

◆ BesselK0()

Double_t TMath::BesselK0 ( Double_t  x)

modified Bessel function I_0(x)

◆ BesselK1()

Double_t TMath::BesselK1 ( Double_t  x)

modified Bessel function I_1(x)

◆ BesselY0()

Double_t TMath::BesselY0 ( Double_t  x)

Bessel function J1(x) for any real x.

◆ BesselY1()

Double_t TMath::BesselY1 ( Double_t  x)

Bessel function Y0(x) for positive 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 T >
Long64_t TMath::BinarySearch ( Long64_t  n,
const T *  array,
value 
)

Binary search in an array of n values to locate value.

Array is supposed to be sorted prior to this call. If match is found, function returns position of element. If no match found, function gives nearest element smaller than value.

Definition at line 1221 of file TMath.h.

◆ BinarySearch() [2/3]

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

Binary search in an array of n values to locate value.

Array is supposed to be sorted prior to this call. If match is found, function returns position of element. If no match found, function gives nearest element smaller than value.

Definition at line 1237 of file TMath.h.

◆ BinarySearch() [3/3]

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

Binary search in an array defined by its iterators.

The values in the iterators range are supposed to be sorted prior to this call. If match is found, function returns position of element. If no match found, function gives nearest element smaller than value.

Definition at line 1205 of file TMath.h.

◆ 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 
)

Calculate a Breit Wigner function with mean and gamma.

Definition at line 437 of file TMath.cxx.

◆ 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 ( )

Velocity of light in \( m s^{-1} \).

Definition at line 118 of file TMath.h.

◆ CauchyDist()

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

◆ Ccgs()

constexpr Double_t TMath::Ccgs ( )

\( cm s^{-1} \)

Definition at line 125 of file TMath.h.

◆ Ceil()

Double_t TMath::Ceil ( Double_t  x)
inline

Definition at line 694 of file TMath.h.

◆ CeilNint()

Int_t TMath::CeilNint ( Double_t  x)
inline

Definition at line 698 of file TMath.h.

◆ ChisquareQuantile()

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

◆ Cos()

Double_t TMath::Cos ( Double_t  x)
inline

Definition at line 640 of file TMath.h.

◆ CosH()

Double_t TMath::CosH ( Double_t  x)
inline

Definition at line 652 of file TMath.h.

◆ Cross()

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

Calculate the Cross Product of two vectors: out = [v1 x v2].

Definition at line 1295 of file TMath.h.

◆ CUncertainty()

constexpr Double_t TMath::CUncertainty ( )

Speed of light uncertainty.

Definition at line 132 of file TMath.h.

◆ DegToRad()

constexpr Double_t TMath::DegToRad ( )

Conversion from degree to radian:

\[ \frac{\pi}{180} \]

.

Definition at line 82 of file TMath.h.

◆ DiLog()

Double_t TMath::DiLog ( Double_t  x)

Modified Struve functions of order 1.

The DiLogarithm function Code translated by R.Brun from CERNLIB DILOG function C332.

Definition at line 110 of file TMath.cxx.

◆ E()

constexpr Double_t TMath::E ( )

Base of natural log:

\[ e \]

.

Definition at line 97 of file TMath.h.

◆ Erf()

Double_t TMath::Erf ( Double_t  x)

Computation of the error function erf(x).

Erf(x) = (2/sqrt(pi)) Integral(exp(-t^2))dt between 0 and x

Definition at line 184 of file TMath.cxx.

◆ Erfc()

Double_t TMath::Erfc ( Double_t  x)

Compute the complementary error function erfc(x).

Erfc(x) = (2/sqrt(pi)) Integral(exp(-t^2))dt between x and infinity

Definition at line 194 of file TMath.cxx.

◆ ErfcInverse()

Double_t TMath::ErfcInverse ( Double_t  x)

returns the inverse of the complementary error function x must be 0<x<2 implement using the quantile of the normal distribution instead of ErfInverse for better numerical precision for large x

Definition at line 237 of file TMath.cxx.

◆ ErfInverse()

Double_t TMath::ErfInverse ( Double_t  x)

returns the inverse error function x must be <-1<x<1

Definition at line 203 of file TMath.cxx.

◆ EulerGamma()

constexpr Double_t TMath::EulerGamma ( )

Euler-Mascheroni Constant.

Definition at line 329 of file TMath.h.

◆ Even()

Bool_t TMath::Even ( Long_t  a)
inline

Definition at line 100 of file TMathBase.h.

◆ Exp()

Double_t TMath::Exp ( Double_t  x)
inline

Definition at line 726 of file TMath.h.

◆ Factorial()

Double_t TMath::Factorial ( Int_t  i)

Compute factorial(n).

Definition at line 247 of file TMath.cxx.

◆ 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

Check if it is finite with a mask in order to be consistent in presence of fast math.

Inspired from the CMSSW FWCore/Utilities package

Definition at line 770 of file TMath.h.

◆ Finite() [2/2]

Int_t TMath::Finite ( Float_t  x)
inline

Check if it is finite with a mask in order to be consistent in presence of fast math.

Inspired from the CMSSW FWCore/Utilities package

Definition at line 799 of file TMath.h.

◆ Floor()

Double_t TMath::Floor ( Double_t  x)
inline

Definition at line 702 of file TMath.h.

◆ FloorNint()

Int_t TMath::FloorNint ( Double_t  x)
inline

Definition at line 706 of file TMath.h.

◆ Freq()

Double_t TMath::Freq ( Double_t  x)

Computation of the normal frequency function freq(x).

Freq(x) = (1/sqrt(2pi)) Integral(exp(-t^2/2))dt between -infinity and x.

Translated from CERNLIB C300 by Rene Brun.

Definition at line 265 of file TMath.cxx.

◆ G()

constexpr Double_t TMath::G ( )

Gravitational constant in: \( m^{3} kg^{-1} s^{-2} \).

Definition at line 139 of file TMath.h.

◆ GamCf()

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

Computation of the incomplete gamma function P(a,x) via its continued fraction representation.

Author
NvE 14-nov-1998 UU-SAP Utrecht

Definition at line 375 of file TMath.cxx.

◆ Gamma() [1/2]

Double_t TMath::Gamma ( Double_t  z)

Computation of gamma(z) for all z.

C.Lanczos, SIAM Journal of Numerical Analysis B1 (1964), 86.

Definition at line 348 of file TMath.cxx.

◆ Gamma() [2/2]

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

Computation of the normalized lower incomplete gamma function P(a,x) as defined in the Handbook of Mathematical Functions by Abramowitz and Stegun, formula 6.5.1 on page 260 .

Its normalization is such that TMath::Gamma(a,+infinity) = 1 .

\[ P(a, x) = \frac{1}{\Gamma(a)} \int_{0}^{x} t^{a-1} e^{-t} dt \]

Author
NvE 14-nov-1998 UU-SAP Utrecht

Definition at line 364 of file TMath.cxx.

◆ GammaDist()

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

◆ GamSer()

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

Computation of the incomplete gamma function P(a,x) via its series representation.

Author
NvE 14-nov-1998 UU-SAP Utrecht

Definition at line 412 of file TMath.cxx.

◆ Gaus()

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

Calculate a gaussian function with mean and sigma.

If norm=kTRUE (default is kFALSE) the result is divided by sqrt(2*Pi)*sigma.

Definition at line 448 of file TMath.cxx.

◆ Gcgs()

constexpr Double_t TMath::Gcgs ( )

\( cm^{3} g^{-1} s^{-2} \)

Definition at line 146 of file TMath.h.

◆ GeomMean() [1/2]

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

Return the geometric mean of an array a of size n.

\[ GeomMean = (\prod_{i=0}^{n-1} |a[i]|)^{1/n} \]

Definition at line 1130 of file TMath.h.

◆ GeomMean() [2/2]

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

Return the geometric mean of an array defined by the iterators.

\[ GeomMean = (\prod_{i=0}^{n-1} |a[i]|)^{1/n} \]

Definition at line 1111 of file TMath.h.

◆ GhbarC()

constexpr Double_t TMath::GhbarC ( )

\( \frac{G}{\hbar C} \) in \( (GeV/c^{2})^{-2} \)

Definition at line 160 of file TMath.h.

◆ GhbarCUncertainty()

constexpr Double_t TMath::GhbarCUncertainty ( )

\( \frac{G}{\hbar C} \) uncertainty.

Definition at line 167 of file TMath.h.

◆ Gn()

constexpr Double_t TMath::Gn ( )

Standard acceleration of gravity in \( m s^{-2} \).

Definition at line 174 of file TMath.h.

◆ GnUncertainty()

constexpr Double_t TMath::GnUncertainty ( )

Standard acceleration of gravity uncertainty.

Definition at line 181 of file TMath.h.

◆ GUncertainty()

constexpr Double_t TMath::GUncertainty ( )

Gravitational constant uncertainty.

Definition at line 153 of file TMath.h.

◆ H()

constexpr Double_t TMath::H ( )

Planck's constant in \( J s \)

\[ h \]

.

Definition at line 189 of file TMath.h.

◆ Hash() [1/2]

ULong_t TMath::Hash ( const void txt,
Int_t  ntxt 
)

◆ Hash() [2/2]

ULong_t TMath::Hash ( const char *  str)

Return a case-sensitive hash value (endian independent).

Definition at line 525 of file TString.cxx.

◆ Hbar()

constexpr Double_t TMath::Hbar ( )

\( \hbar \) in \( J s \)

\[ \hbar = \frac{h}{2\pi} \]

Definition at line 211 of file TMath.h.

◆ Hbarcgs()

constexpr Double_t TMath::Hbarcgs ( )

\( erg s \)

Definition at line 218 of file TMath.h.

◆ HbarUncertainty()

constexpr Double_t TMath::HbarUncertainty ( )

\( \hbar \) uncertainty.

Definition at line 225 of file TMath.h.

◆ HC()

constexpr Double_t TMath::HC ( )

\( hc \) in \( J m \)

Definition at line 232 of file TMath.h.

◆ HCcgs()

constexpr Double_t TMath::HCcgs ( )

\( erg cm \)

Definition at line 239 of file TMath.h.

◆ Hcgs()

constexpr Double_t TMath::Hcgs ( )

\( erg s \)

Definition at line 196 of file TMath.h.

◆ HUncertainty()

constexpr Double_t TMath::HUncertainty ( )

Planck's constant uncertainty.

Definition at line 203 of file TMath.h.

◆ Hypot() [1/2]

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

Definition at line 57 of file TMath.cxx.

◆ Hypot() [2/2]

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

Definition at line 50 of file TMath.cxx.

◆ Infinity()

Double_t TMath::Infinity ( )
inline

Returns an infinity as defined by the IEEE standard.

Definition at line 913 of file TMath.h.

◆ InvPi()

constexpr Double_t TMath::InvPi ( )

\( \frac{1.}{\pi}\)

Definition at line 66 of file TMath.h.

◆ IsInside()

template<typename T >
Bool_t TMath::IsInside ( xp,
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 arrays x and y, kFALSE otherwise.

Note that the polygon may be open or closed.

Definition at line 1329 of file TMath.h.

◆ IsNaN() [1/2]

Bool_t TMath::IsNaN ( Double_t  x)
inline

Definition at line 891 of file TMath.h.

◆ IsNaN() [2/2]

Bool_t TMath::IsNaN ( Float_t  x)
inline

Definition at line 892 of file TMath.h.

◆ K()

constexpr Double_t TMath::K ( )

Boltzmann's constant in \( J K^{-1} \)

\[ k \]

.

Definition at line 247 of file TMath.h.

◆ Kcgs()

constexpr Double_t TMath::Kcgs ( )

\( erg K^{-1} \)

Definition at line 254 of file TMath.h.

◆ KolmogorovProb()

Double_t TMath::KolmogorovProb ( Double_t  z)

◆ KolmogorovTest()

Double_t TMath::KolmogorovTest ( Int_t  na,
const Double_t a,
Int_t  nb,
const Double_t b,
Option_t option 
)

◆ KOrdStat()

template<class Element , typename Size >
Element TMath::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).

C-convention is used for array indexing, so if you want the second smallest element, call KOrdStat(n, a, 1).

If work is supplied, it is used to store the sorting index and assumed to be >= n. If work=0, local storage is used, either on the stack if n < kWorkMax or on the heap for n >= kWorkMax. Note that the work index array will not contain the sorted indices but all indices of the smaller element in arbitrary order in work[0,...,k-1] and all indices of the larger element in arbitrary order in work[k+1,..,n-1] work[k] will contain instead the index of the returned element.

Taken from "Numerical Recipes in C++" without the index array implemented by Anna Khreshuk.

See also the declarations at the top of this file

Definition at line 1453 of file TMath.h.

◆ KUncertainty()

constexpr Double_t TMath::KUncertainty ( )

Boltzmann's constant uncertainty.

Definition at line 261 of file TMath.h.

◆ Landau()

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

The LANDAU function.

mu is a location parameter and correspond approximately to the most probable value and sigma is a scale parameter (not the sigma of the full distribution which is not defined) Note that for mu=0 and sigma=1 (default values) the exact location of the maximum of the distribution (most proper value) is at x = -0.22278 This function has been adapted from the CERNLIB routine G110 denlan. If norm=kTRUE (default is kFALSE) the result is divided by sigma

Definition at line 469 of file TMath.cxx.

◆ 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 730 of file TMath.h.

◆ Ln10()

constexpr Double_t TMath::Ln10 ( )

Natural log of 10 (to convert log to ln)

Definition at line 104 of file TMath.h.

◆ LnGamma()

Double_t TMath::LnGamma ( Double_t  z)

Computation of ln[gamma(z)] for all z.

C.Lanczos, SIAM Journal of Numerical Analysis B1 (1964), 86.

The accuracy of the result is better than 2e-10.

Author
NvE 14-nov-1998 UU-SAP Utrecht

Definition at line 486 of file TMath.cxx.

◆ LocMax() [1/2]

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

Return index of array with the maximum element.

If more than one element is maximum returns first found.

Implement here since it is faster (see comment in LocMin function)

Definition at line 999 of file TMath.h.

◆ LocMax() [2/2]

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

Return index of array with the maximum element.

If more than one element is maximum returns first found.

Definition at line 1016 of file TMath.h.

◆ LocMin() [1/2]

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

Return index of array with the minimum element.

If more than one element is minimum returns first found.

Implement here since this one is found to be faster (mainly on 64 bit machines) than stl generic implementation. When performing the comparison, the STL implementation needs to de-reference both the array iterator and the iterator pointing to the resulting minimum location

Definition at line 971 of file TMath.h.

◆ LocMin() [2/2]

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

Return index of array with the minimum element.

If more than one element is minimum returns first found.

Definition at line 988 of file TMath.h.

◆ Log()

Double_t TMath::Log ( Double_t  x)
inline

Definition at line 759 of file TMath.h.

◆ Log10()

Double_t TMath::Log10 ( Double_t  x)
inline

Definition at line 763 of file TMath.h.

◆ Log2()

Double_t TMath::Log2 ( Double_t  x)

Definition at line 101 of file TMath.cxx.

◆ LogE()

constexpr Double_t TMath::LogE ( )

Base-10 log of e (to convert ln to log)

Definition at line 111 of file TMath.h.

◆ LogNormal()

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

◆ Max() [1/10]

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

Definition at line 200 of file TMathBase.h.

◆ Max() [2/10]

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

Definition at line 203 of file TMathBase.h.

◆ Max() [3/10]

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

Definition at line 206 of file TMathBase.h.

◆ Max() [4/10]

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

Definition at line 209 of file TMathBase.h.

◆ Max() [5/10]

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

Definition at line 212 of file TMathBase.h.

◆ Max() [6/10]

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

Definition at line 215 of file TMathBase.h.

◆ Max() [7/10]

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

Definition at line 218 of file TMathBase.h.

◆ Max() [8/10]

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

Definition at line 221 of file TMathBase.h.

◆ Max() [9/10]

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

Definition at line 224 of file TMathBase.h.

◆ Max() [10/10]

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

Definition at line 227 of file TMathBase.h.

◆ MaxElement()

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

Return maximum of array a of length n.

Definition at line 958 of file TMath.h.

◆ Mean() [1/3]

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

Return the weighted mean of an array a with length n.

Definition at line 1098 of file TMath.h.

◆ Mean() [2/3]

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

Return the weighted mean of an array defined by the iterators.

Definition at line 1051 of file TMath.h.

◆ Mean() [3/3]

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

Return the weighted mean of an array defined by the first and last iterators.

The w iterator should point to the first element of a vector of weights of the same size as the main array.

Definition at line 1070 of file TMath.h.

◆ Median()

template<typename T >
Double_t TMath::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] .

Both arrays have a length of at least n . The median is a number obtained from the sorted array a through

median = (a[jl]+a[jh])/2. where (using also the sorted index on the array w)

sum_i=0,jl w[i] <= sumTot/2 sum_i=0,jh w[i] >= sumTot/2 sumTot = sum_i=0,n w[i]

If w=0, the algorithm defaults to the median definition where it is a number that divides the sorted sequence into 2 halves. When n is odd or n > 1000, the median is kth element k = (n + 1) / 2. when n is even and n < 1000the median is a mean of the elements k = n/2 and k = n/2 + 1.

If the weights are supplied (w not 0) all weights must be >= 0

If work is supplied, it is used to store the sorting index and assumed to be >= n . If work=0, local storage is used, either on the stack if n < kWorkMax or on the heap for n >= kWorkMax .

Definition at line 1367 of file TMath.h.

◆ Min() [1/10]

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

Definition at line 168 of file TMathBase.h.

◆ Min() [2/10]

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

Definition at line 171 of file TMathBase.h.

◆ Min() [3/10]

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

Definition at line 174 of file TMathBase.h.

◆ Min() [4/10]

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

Definition at line 177 of file TMathBase.h.

◆ Min() [5/10]

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

Definition at line 180 of file TMathBase.h.

◆ Min() [6/10]

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

Definition at line 183 of file TMathBase.h.

◆ Min() [7/10]

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

Definition at line 186 of file TMathBase.h.

◆ Min() [8/10]

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

Definition at line 189 of file TMathBase.h.

◆ Min() [9/10]

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

Definition at line 192 of file TMathBase.h.

◆ Min() [10/10]

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

Definition at line 195 of file TMathBase.h.

◆ MinElement()

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

Return minimum of array a of length n.

Definition at line 951 of file TMath.h.

◆ MWair()

constexpr Double_t TMath::MWair ( )

Molecular weight of dry air 1976 US Standard Atmosphere in \( kg kmol^{-1} \) or \( gm mol^{-1} \)

Definition at line 314 of file TMath.h.

◆ Na()

constexpr Double_t TMath::Na ( )

Avogadro constant (Avogadro's Number) in \( mol^{-1} \).

Definition at line 283 of file TMath.h.

◆ NaUncertainty()

constexpr Double_t TMath::NaUncertainty ( )

Avogadro constant (Avogadro's Number) uncertainty.

Definition at line 290 of file TMath.h.

◆ Nint()

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

Round to nearest integer. Rounds half integers to the nearest even integer.

Definition at line 712 of file TMath.h.

◆ Normal2Plane()

template<typename T >
T * TMath::Normal2Plane ( const T  p1[3],
const T  p2[3],
const T  p3[3],
normal[3] 
)

Calculate a normal vector of a plane.

Parameters
[in]p1,p2,p33 3D points belonged the plane to define it.
[out]normalPointer to 3D normal vector (normalized)

Definition at line 1309 of file TMath.h.

◆ Normalize() [1/2]

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

Normalize a vector v in place.

Returns the norm of the original vector.

Definition at line 495 of file TMath.cxx.

◆ Normalize() [2/2]

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

Normalize a vector v in place.

Returns the norm of the original vector. This implementation (thanks Kevin Lynch krlyn.nosp@m.ch@b.nosp@m.u.edu) is protected against possible overflows.

Definition at line 512 of file TMath.cxx.

◆ NormCross()

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

Calculate the Normalized Cross Product of two vectors.

Definition at line 943 of file TMath.h.

◆ 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.

◆ Permute()

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

◆ Pi()

constexpr Double_t TMath::Pi ( )

\[ \pi\]

Definition at line 38 of file TMath.h.

◆ PiOver2()

constexpr Double_t TMath::PiOver2 ( )

\[ \frac{\pi}{2} \]

Definition at line 52 of file TMath.h.

◆ PiOver4()

constexpr Double_t TMath::PiOver4 ( )

\[ \frac{\pi}{4} \]

Definition at line 59 of file TMath.h.

◆ 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]

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

Definition at line 734 of file TMath.h.

◆ Power() [2/5]

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

Definition at line 738 of file TMath.h.

◆ Power() [3/5]

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

Definition at line 742 of file TMath.h.

◆ Power() [4/5]

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

Definition at line 746 of file TMath.h.

◆ Power() [5/5]

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

Definition at line 750 of file TMath.h.

◆ Prob()

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

◆ Qe()

constexpr Double_t TMath::Qe ( )

Elementary charge in \( C \) .

Definition at line 336 of file TMath.h.

◆ QeUncertainty()

constexpr Double_t TMath::QeUncertainty ( )

Elementary charge uncertainty.

Definition at line 343 of file TMath.h.

◆ 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

Returns a quiet NaN as defined by IEEE 754

Definition at line 900 of file TMath.h.

◆ R()

constexpr Double_t TMath::R ( )

Universal gas constant ( \( Na K \)) in \( J K^{-1} mol^{-1} \)

Definition at line 299 of file TMath.h.

◆ RadToDeg()

constexpr Double_t TMath::RadToDeg ( )

Conversion from radian to degree:

\[ \frac{180}{\pi} \]

.

Definition at line 74 of file TMath.h.

◆ Range() [1/5]

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

Definition at line 232 of file TMathBase.h.

◆ 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.

◆ 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.

◆ Range() [4/5]

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

Definition at line 241 of file TMathBase.h.

◆ Range() [5/5]

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

Definition at line 244 of file TMathBase.h.

◆ Rgair()

constexpr Double_t TMath::Rgair ( )

Dry Air Gas Constant (R / MWair) in \( J kg^{-1} K^{-1} \)

Definition at line 322 of file TMath.h.

◆ RMS() [1/3]

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

Return the Standard Deviation of an array a with length n.

Note that this function returns the sigma(standard deviation) and not the root mean square of the array.

Definition at line 1192 of file TMath.h.

◆ RMS() [2/3]

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

Return the Standard Deviation of an array defined by the iterators.

Note that this function returns the sigma(standard deviation) and not the root mean square of the array.

Use the two pass algorithm, which is slower (! a factor of 2) but much more precise. Since we have a vector the 2 pass algorithm is still faster than the Welford algorithm. (See also ROOT-5545)

Definition at line 1144 of file TMath.h.

◆ RMS() [3/3]

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

Return the weighted Standard Deviation of an array defined by the iterators.

Note that this function returns the sigma(standard deviation) and not the root mean square of the array.

As in the unweighted case use the two pass algorithm

Definition at line 1168 of file TMath.h.

◆ 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 ( )

Universal gas constant uncertainty.

Definition at line 306 of file TMath.h.

◆ Sigma()

constexpr Double_t TMath::Sigma ( )

Stefan-Boltzmann constant in \( W m^{-2} K^{-4}\)

\[ \sigma \]

.

Definition at line 269 of file TMath.h.

◆ SigmaUncertainty()

constexpr Double_t TMath::SigmaUncertainty ( )

Stefan-Boltzmann constant uncertainty.

Definition at line 276 of file TMath.h.

◆ Sign() [1/4]

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

Definition at line 153 of file TMathBase.h.

◆ Sign() [2/4]

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

Definition at line 156 of file TMathBase.h.

◆ Sign() [3/4]

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

Definition at line 159 of file TMathBase.h.

◆ Sign() [4/4]

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

Definition at line 162 of file TMathBase.h.

◆ SignalingNaN()

Double_t TMath::SignalingNaN ( )
inline

Returns a signaling NaN as defined by IEEE 754](http://en.wikipedia.org/wiki/NaN#Signaling_NaN)

Definition at line 907 of file TMath.h.

◆ SignBit() [1/4]

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

Definition at line 137 of file TMathBase.h.

◆ SignBit() [2/4]

Bool_t TMath::SignBit ( Float_t  a)
inline

Definition at line 140 of file TMathBase.h.

◆ SignBit() [3/4]

Bool_t TMath::SignBit ( Double_t  a)
inline

Definition at line 143 of file TMathBase.h.

◆ SignBit() [4/4]

Bool_t TMath::SignBit ( LongDouble_t  a)
inline

Definition at line 146 of file TMathBase.h.

◆ Sin()

Double_t TMath::Sin ( Double_t  x)
inline

Definition at line 636 of file TMath.h.

◆ SinH()

Double_t TMath::SinH ( Double_t  x)
inline

Definition at line 648 of file TMath.h.

◆ Sort()

template<typename Element , typename Index >
void TMath::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.

In output the array index of type Index contains the indices of the sorted array. If down is false sort in increasing order (default is decreasing order).

NOTE that the array index must be created with a length >= n before calling this function. NOTE also that the size type for n must be the same type used for the index array (templated type Index)

Definition at line 1282 of file TMath.h.

◆ SortItr()

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

Sort the n1 elements of the Short_t array defined by its iterators.

In output the array index contains the indices of the sorted array. If down is false sort in increasing order (default is decreasing order).

NOTE that the array index must be created with a length bigger or equal than the main array before calling this function.

Definition at line 1256 of file TMath.h.

◆ Sq()

Double_t TMath::Sq ( Double_t  x)
inline

Definition at line 686 of file TMath.h.

◆ Sqrt()

Double_t TMath::Sqrt ( Double_t  x)
inline

Definition at line 690 of file TMath.h.

◆ Sqrt2()

constexpr Double_t TMath::Sqrt2 ( )

\[ \sqrt{2} \]

Definition at line 89 of file TMath.h.

◆ StdDev() [1/3]

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

Definition at line 527 of file TMath.h.

◆ StdDev() [2/3]

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

Definition at line 528 of file TMath.h.

◆ StdDev() [3/3]

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

Definition at line 529 of file TMath.h.

◆ StruveH0()

Double_t TMath::StruveH0 ( Double_t  x)

Bessel function Y1(x) for positive x.

◆ StruveH1()

Double_t TMath::StruveH1 ( Double_t  x)

Struve functions of order 0.

◆ StruveL0()

Double_t TMath::StruveL0 ( Double_t  x)

Struve functions of order 1.

◆ StruveL1()

Double_t TMath::StruveL1 ( Double_t  x)

Modified Struve functions of order 0.

◆ 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 644 of file TMath.h.

◆ TanH()

Double_t TMath::TanH ( Double_t  x)
inline

Definition at line 656 of file TMath.h.

◆ TwoPi()

constexpr Double_t TMath::TwoPi ( )

\[ 2\pi\]

Definition at line 45 of file TMath.h.

◆ Vavilov()

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

◆ VavilovDenEval()

Double_t TMath::VavilovDenEval ( Double_t  rlam,
Double_t AC,
Double_t HC,
Int_t  itype 
)

◆ VavilovI()

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

◆ VavilovSet()

void TMath::VavilovSet ( Double_t  rkappa,
Double_t  beta2,
Bool_t  mode,
Double_t WCM,
Double_t AC,
Double_t HC,
Int_t itype,
Int_t npt 
)

◆ Voigt()

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