From f65e3907da09e2949ec610f8f9a3261ed67b5ae4 Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Thu, 8 Feb 2007 17:26:57 +0000 Subject: [PATCH] moved to new math directory. git-svn-id: http://root.cern.ch/svn/root/trunk@17792 27541ba8-7e3a-0410-8455-c3a389f83636 --- base/inc/TComplex.h | 190 ----------------- base/inc/TMath.h | 499 -------------------------------------------- base/inc/TRandom.h | 64 ------ base/inc/TRandom1.h | 72 ------- base/inc/TRandom2.h | 48 ----- base/inc/TRandom3.h | 48 ----- 6 files changed, 921 deletions(-) delete mode 100644 base/inc/TComplex.h delete mode 100644 base/inc/TMath.h delete mode 100644 base/inc/TRandom.h delete mode 100644 base/inc/TRandom1.h delete mode 100644 base/inc/TRandom2.h delete mode 100644 base/inc/TRandom3.h diff --git a/base/inc/TComplex.h b/base/inc/TComplex.h deleted file mode 100644 index fbb5ee486e2..00000000000 --- a/base/inc/TComplex.h +++ /dev/null @@ -1,190 +0,0 @@ -// @(#)root/base:$Name: $:$Id: TComplex.h,v 1.6 2005/12/24 17:06:27 rdm Exp $ -// Author: Federico Carminati 22/04/2004 - -/************************************************************************* - * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TComplex -#define ROOT_TComplex - -////////////////////////////////////////////////////////////////////////// -// // -// TComplex // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_Riosfwd -#include "Riosfwd.h" -#endif -#ifndef ROOT_TMath -#include "TMath.h" -#endif - - -class TComplex { - -protected: - Double_t fRe; // real part - Double_t fIm; // imaginary part - -public: - // ctors and dtors - TComplex(): fRe(0), fIm(0) {} - TComplex(Double_t re, Double_t im=0, Bool_t polar=kFALSE); - virtual ~TComplex() {} - - // constants - static TComplex I() {return TComplex(0,1);} - static TComplex One() {return TComplex(1,0);} - - // getters and setters - Double_t Re() const {return fRe;} - Double_t Im() const {return fIm;} - Double_t Rho() const {return TMath::Sqrt(fRe*fRe+fIm*fIm);} - Double_t Rho2() const {return fRe*fRe+fIm*fIm;} - Double_t Theta() const {return (fIm||fRe)?TMath::ATan2(fIm,fRe):0;} - TComplex operator()(Double_t x, Double_t y, Bool_t polar=kFALSE) - { if (polar) { fRe = x*TMath::Cos(y); fIm = x*TMath::Sin(y); } - else { fRe = x; fIm = y; } return *this; } - - // Simple operators complex - complex - TComplex operator *(const TComplex & c) const - {return TComplex(fRe*c.fRe-fIm*c.fIm,fRe*c.fIm+fIm*c.fRe);} - TComplex operator +(const TComplex & c) const - {return TComplex(fRe+c.fRe, fIm+c.fIm);} - TComplex operator /(const TComplex & c) const - {return TComplex(fRe*c.fRe+fIm*c.fIm,-fRe*c.fIm+fIm*c.fRe)/c.Rho2();} - TComplex operator -(const TComplex & c) const - {return TComplex(fRe-c.fRe, fIm-c.fIm);} - - TComplex operator *=(const TComplex & c) - {return ((*this) = (*this) * c);} - TComplex operator +=(const TComplex & c) - {return ((*this) = (*this) + c);} - TComplex operator /=(const TComplex & c) - {return ((*this) = (*this) / c);} - TComplex operator -=(const TComplex & c) - {return ((*this) = (*this) - c);} - - TComplex operator -() - {return TComplex(-fRe,-fIm);} - TComplex operator +() - {return *this;} - - // Simple operators complex - double - TComplex operator *(Double_t c) const - {return TComplex(fRe*c,fIm*c);} - TComplex operator +(Double_t c) const - {return TComplex(fRe+c, fIm);} - TComplex operator /(Double_t c) const - {return TComplex(fRe/c,fIm/c);} - TComplex operator -(Double_t c) const - {return TComplex(fRe-c, fIm);} - - // Simple operators double - complex - friend TComplex operator *(Double_t d, const TComplex & c) - {return TComplex(d*c.fRe,d*c.fIm);} - friend TComplex operator +(Double_t d, const TComplex & c) - {return TComplex(d+c.fRe, c.fIm);} - friend TComplex operator /(Double_t d, const TComplex & c) - {return TComplex(d*c.fRe,-d*c.fIm)/c.Rho2();} - friend TComplex operator -(Double_t d, const TComplex & c) - {return TComplex(d-c.fRe, -c.fIm);} - - // Convertors - operator Double_t () const {return fRe;} - operator Float_t () const {return static_cast<Float_t>(fRe);} - operator Int_t () const {return static_cast<Int_t>(fRe);} - - // TMath:: extensions - static TComplex Sqrt(const TComplex &c) - {return TComplex(TMath::Sqrt(c.Rho()),0.5*c.Theta(),kTRUE);} - - static TComplex Exp(const TComplex &c) - {return TComplex(TMath::Exp(c.fRe),c.fIm,kTRUE);} - static TComplex Log(const TComplex &c) - {return TComplex(0.5*TMath::Log(c.Rho2()),c.Theta());} - static TComplex Log2(const TComplex &c) - {return Log(c)/TMath::Log(2);} - static TComplex Log10(const TComplex &c) - {return Log(c)/TMath::Log(10);} - - static TComplex Sin(const TComplex &c) - {return TComplex(TMath::Sin(c.fRe)*TMath::CosH(c.fIm), - TMath::Cos(c.fRe)*TMath::SinH(c.fIm));} - static TComplex Cos(const TComplex &c) - {return TComplex(TMath::Cos(c.fRe)*TMath::CosH(c.fIm), - -TMath::Sin(c.fRe)*TMath::SinH(c.fIm));} - static TComplex Tan(const TComplex &c) - {TComplex cc=Cos(c); return Sin(c)*Conjugate(cc)/cc.Rho2();} - - static TComplex ASin(const TComplex &c) - {return -I()*Log(I()*c+TMath::Sign(1.,c.Im())*Sqrt(1.-c*c));} - static TComplex ACos(const TComplex &c) - {return -I()*Log(c+TMath::Sign(1.,c.Im())*Sqrt(c*c-1.));} - static TComplex ATan(const TComplex &c) - {return -0.5*I()*Log((1.+I()*c)/(1.-I()*c));} - - static TComplex SinH(const TComplex &c) - {return TComplex(TMath::SinH(c.fRe)*TMath::Cos(c.fIm), - TMath::CosH(c.fRe)*TMath::Sin(c.fIm));} - static TComplex CosH(const TComplex &c) - {return TComplex(TMath::CosH(c.fRe)*TMath::Cos(c.fIm), - TMath::SinH(c.fRe)*TMath::Sin(c.fIm));} - static TComplex TanH(const TComplex &c) - {TComplex cc=CosH(c); return SinH(c)*Conjugate(cc)/cc.Rho2();} - - static TComplex ASinH(const TComplex &c) - {return Log(c+TMath::Sign(1.,c.Im())*Sqrt(c*c+1.));} - static TComplex ACosH(const TComplex &c) - {return Log(c+TMath::Sign(1.,c.Im())*Sqrt(c*c-1.));} - static TComplex ATanH(const TComplex &c) - {return 0.5*Log((1.+c)/(1.-c));} - - static Double_t Abs(const TComplex &c) - {return c.Rho();} - - static TComplex Power(const TComplex& x, const TComplex& y) - {Double_t lrho=TMath::Log(x.Rho()); - Double_t theta=x.Theta(); - return TComplex(TMath::Exp(lrho*y.Re()-theta*y.Im()), - lrho*y.Im()+theta*y.Re(),kTRUE);} - static TComplex Power(const TComplex& x, Double_t y) - {return TComplex(TMath::Power(x.Rho(),y),x.Theta()*y,kTRUE);} - static TComplex Power(Double_t x, const TComplex& y) - {Double_t lrho=TMath::Log(TMath::Abs(x)); - Double_t theta=(x>0)?0:TMath::Pi(); - return TComplex(TMath::Exp(lrho*y.Re()-theta*y.Im()), - lrho*y.Im()+theta*y.Re(),kTRUE);} - static TComplex Power(const TComplex& x, Int_t y) - {return TComplex(TMath::Power(x.Rho(),y),x.Theta()*y,kTRUE);} - - static Int_t Finite(const TComplex& c) - {return TMath::Min(TMath::Finite(c.Re()),TMath::Finite(c.Im()));} - static Int_t IsNaN(const TComplex& c) - {return TMath::Max(TMath::IsNaN(c.Re()),TMath::IsNaN(c.Im()));} - - static TComplex Min(const TComplex &a, const TComplex &b) - {return a.Rho()<=b.Rho()?a:b;} - static TComplex Max(const TComplex &a, const TComplex &b) - {return a.Rho()>=b.Rho()?a:b;} - static TComplex Normalize(const TComplex &c) - {return TComplex(1.,c.Theta(),kTRUE);} - static TComplex Conjugate(const TComplex &c) - {return TComplex(c.Re(),-c.Im());} - static TComplex Range(const TComplex &lb, const TComplex &ub, const TComplex &c) - {return Max(lb,Min(c,ub));} - - // I/O - friend ostream& operator<<(ostream& out, const TComplex& c); - friend istream& operator>>(istream& in, TComplex& c); - - ClassDef(TComplex,1) //Complex Class -}; - -#endif diff --git a/base/inc/TMath.h b/base/inc/TMath.h deleted file mode 100644 index 205ac9cc31c..00000000000 --- a/base/inc/TMath.h +++ /dev/null @@ -1,499 +0,0 @@ -// @(#)root/base:$Name: $:$Id: TMath.h,v 1.71 2007/01/15 14:27:07 brun Exp $ -// Authors: Rene Brun, Anna Kreshuk, Eddy Offermann, Fons Rademakers 29/07/95 - -/************************************************************************* - * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TMath -#define ROOT_TMath - - -////////////////////////////////////////////////////////////////////////// -// // -// TMath // -// // -// Encapsulate most frequently used Math functions. // -// NB. The basic functions Min, Max, Abs, Sign and Range are defined // -// in TMathBase. // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_Rtypes -#include "Rtypes.h" -#endif -#ifndef ROOT_TMathBase -#include "TMathBase.h" -#endif - -namespace TMath { - - // Fundamental constants - inline Double_t Pi() { return 3.14159265358979323846; } - inline Double_t TwoPi() { return 2.0 * Pi(); } - inline Double_t PiOver2() { return Pi() / 2.0; } - inline Double_t PiOver4() { return Pi() / 4.0; } - inline Double_t InvPi() { return 1.0 / Pi(); } - inline Double_t RadToDeg() { return 180.0 / Pi(); } - inline Double_t DegToRad() { return Pi() / 180.0; } - - // e (base of natural log) - inline Double_t E() { return 2.71828182845904523536; } - - // natural log of 10 (to convert log to ln) - inline Double_t Ln10() { return 2.30258509299404568402; } - - // base-10 log of e (to convert ln to log) - inline Double_t LogE() { return 0.43429448190325182765; } - - // velocity of light - inline Double_t C() { return 2.99792458e8; } // m s^-1 - inline Double_t Ccgs() { return 100.0 * C(); } // cm s^-1 - inline Double_t CUncertainty() { return 0.0; } // exact - - // gravitational constant - inline Double_t G() { return 6.673e-11; } // m^3 kg^-1 s^-2 - inline Double_t Gcgs() { return G() / 1000.0; } // cm^3 g^-1 s^-2 - inline Double_t GUncertainty() { return 0.010e-11; } - - // G over h-bar C - inline Double_t GhbarC() { return 6.707e-39; } // (GeV/c^2)^-2 - inline Double_t GhbarCUncertainty() { return 0.010e-39; } - - // standard acceleration of gravity - inline Double_t Gn() { return 9.80665; } // m s^-2 - inline Double_t GnUncertainty() { return 0.0; } // exact - - // Planck's constant - inline Double_t H() { return 6.62606876e-34; } // J s - inline Double_t Hcgs() { return 1.0e7 * H(); } // erg s - inline Double_t HUncertainty() { return 0.00000052e-34; } - - // h-bar (h over 2 pi) - inline Double_t Hbar() { return 1.054571596e-34; } // J s - inline Double_t Hbarcgs() { return 1.0e7 * Hbar(); } // erg s - inline Double_t HbarUncertainty() { return 0.000000082e-34; } - - // hc (h * c) - inline Double_t HC() { return H() * C(); } // J m - inline Double_t HCcgs() { return Hcgs() * Ccgs(); } // erg cm - - // Boltzmann's constant - inline Double_t K() { return 1.3806503e-23; } // J K^-1 - inline Double_t Kcgs() { return 1.0e7 * K(); } // erg K^-1 - inline Double_t KUncertainty() { return 0.0000024e-23; } - - // Stefan-Boltzmann constant - inline Double_t Sigma() { return 5.6704e-8; } // W m^-2 K^-4 - inline Double_t SigmaUncertainty() { return 0.000040e-8; } - - // Avogadro constant (Avogadro's Number) - inline Double_t Na() { return 6.02214199e+23; } // mol^-1 - inline Double_t NaUncertainty() { return 0.00000047e+23; } - - // universal gas constant (Na * K) - // http://scienceworld.wolfram.com/physics/UniversalGasConstant.html - inline Double_t R() { return K() * Na(); } // J K^-1 mol^-1 - inline Double_t RUncertainty() { return R()*((KUncertainty()/K()) + (NaUncertainty()/Na())); } - - // Molecular weight of dry air - // 1976 US Standard Atmosphere, - // also see http://atmos.nmsu.edu/jsdap/encyclopediawork.html - inline Double_t MWair() { return 28.9644; } // kg kmol^-1 (or gm mol^-1) - - // Dry Air Gas Constant (R / MWair) - // http://atmos.nmsu.edu/education_and_outreach/encyclopedia/gas_constant.htm - inline Double_t Rgair() { return (1000.0 * R()) / MWair(); } // J kg^-1 K^-1 - - // Elementary charge - inline Double_t Qe() { return 1.602176462e-19; } // C - inline Double_t QeUncertainty() { return 0.000000063e-19; } - - // Trigo - inline Double_t Sin(Double_t); - inline Double_t Cos(Double_t); - inline Double_t Tan(Double_t); - inline Double_t SinH(Double_t); - inline Double_t CosH(Double_t); - inline Double_t TanH(Double_t); - inline Double_t ASin(Double_t); - inline Double_t ACos(Double_t); - inline Double_t ATan(Double_t); - inline Double_t ATan2(Double_t, Double_t); - Double_t ASinH(Double_t); - Double_t ACosH(Double_t); - Double_t ATanH(Double_t); - Double_t Hypot(Double_t x, Double_t y); - - // Misc - inline Double_t Sqrt(Double_t x); - inline Double_t Ceil(Double_t x); - inline Int_t CeilNint(Double_t x); - inline Double_t Floor(Double_t x); - inline Int_t FloorNint(Double_t x); - inline Double_t Exp(Double_t x); - inline Double_t Ldexp(Double_t x, Int_t exp); - Double_t Factorial(Int_t i); - inline Double_t Power(Double_t x, Double_t y); - inline Double_t Log(Double_t x); - Double_t Log2(Double_t x); - inline Double_t Log10(Double_t x); - Int_t Nint(Float_t x); - Int_t Nint(Double_t x); - inline Int_t Finite(Double_t x); - inline Int_t IsNaN(Double_t x); - - // Some integer math - Long_t Hypot(Long_t x, Long_t y); // sqrt(px*px + py*py) - - // Min, Max of an array - Short_t MinElement(Long64_t n, const Short_t *a); - Int_t MinElement(Long64_t n, const Int_t *a); - Float_t MinElement(Long64_t n, const Float_t *a); - Double_t MinElement(Long64_t n, const Double_t *a); - Long_t MinElement(Long64_t n, const Long_t *a); - Long64_t MinElement(Long64_t n, const Long64_t *a); - Short_t MaxElement(Long64_t n, const Short_t *a); - Int_t MaxElement(Long64_t n, const Int_t *a); - Float_t MaxElement(Long64_t n, const Float_t *a); - Double_t MaxElement(Long64_t n, const Double_t *a); - Long_t MaxElement(Long64_t n, const Long_t *a); - Long64_t MaxElement(Long64_t n, const Long64_t *a); - - // Locate Min, Max element number in an array - Long64_t LocMin(Long64_t n, const Short_t *a); - Long64_t LocMin(Long64_t n, const Int_t *a); - Long64_t LocMin(Long64_t n, const Float_t *a); - Long64_t LocMin(Long64_t n, const Double_t *a); - Long64_t LocMin(Long64_t n, const Long_t *a); - Long64_t LocMin(Long64_t n, const Long64_t *a); - Long64_t LocMax(Long64_t n, const Short_t *a); - Long64_t LocMax(Long64_t n, const Int_t *a); - Long64_t LocMax(Long64_t n, const Float_t *a); - Long64_t LocMax(Long64_t n, const Double_t *a); - Long64_t LocMax(Long64_t n, const Long_t *a); - Long64_t LocMax(Long64_t n, const Long64_t *a); - - //Mean, Geometric Mean, Median, RMS - Double_t Mean(Long64_t n, const Short_t *a, const Double_t *w=0); - Double_t Mean(Long64_t n, const Int_t *a, const Double_t *w=0); - Double_t Mean(Long64_t n, const Float_t *a, const Double_t *w=0); - Double_t Mean(Long64_t n, const Double_t *a,const Double_t *w=0); - Double_t Mean(Long64_t n, const Long_t *a, const Double_t *w=0); - Double_t Mean(Long64_t n, const Long64_t *a,const Double_t *w=0); - Double_t GeomMean(Long64_t n, const Short_t *a); - Double_t GeomMean(Long64_t n, const Int_t *a); - Double_t GeomMean(Long64_t n, const Float_t *a); - Double_t GeomMean(Long64_t n, const Double_t *a); - Double_t GeomMean(Long64_t n, const Long_t *a); - Double_t GeomMean(Long64_t n, const Long64_t *a); - - Double_t RMS(Long64_t n, const Short_t *a); - Double_t RMS(Long64_t n, const Int_t *a); - Double_t RMS(Long64_t n, const Float_t *a); - Double_t RMS(Long64_t n, const Double_t *a); - Double_t RMS(Long64_t n, const Long_t *a); - Double_t RMS(Long64_t n, const Long64_t *a); - - template <class Element, class Index, class Size> Double_t MedianImp(Size n, const Element *a, const Double_t *w=0, Index *work=0); - Double_t Median(Long64_t n, const Short_t *a, const Double_t *w=0, Long64_t *work=0); - Double_t Median(Long64_t n, const Int_t *a, const Double_t *w=0, Long64_t *work=0); - Double_t Median(Long64_t n, const Float_t *a, const Double_t *w=0, Long64_t *work=0); - Double_t Median(Long64_t n, const Double_t *a, const Double_t *w=0, Long64_t *work=0); - Double_t Median(Long64_t n, const Long_t *a, const Double_t *w=0, Long64_t *work=0); - Double_t Median(Long64_t n, const Long64_t *a, const Double_t *w=0, Long64_t *work=0); - - //k-th order statistic - template <class Element, class Index, class Size> Element KOrdStatImp(Size n, const Element *a, Size k, Index *work = 0); - Short_t KOrdStat(Long64_t n, const Short_t *a, Long64_t k, Long64_t *work=0); - Int_t KOrdStat(Long64_t n, const Int_t *a, Long64_t k, Long64_t *work=0); - Float_t KOrdStat(Long64_t n, const Float_t *a, Long64_t k, Long64_t *work=0); - Double_t KOrdStat(Long64_t n, const Double_t *a, Long64_t k, Long64_t *work=0); - Double_t KOrdStat(Long64_t n, const Double_t *a, Long64_t k, Int_t *work); - Long64_t KOrdStat(Long64_t n, const Long_t *a, Long64_t k, Long64_t *work=0); - Long64_t KOrdStat(Long64_t n, const Long64_t *a, Long64_t k, Long64_t *work=0); - - //Sample quantiles - 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); - - // Range - inline Short_t Range(Short_t lb, Short_t ub, Short_t x); - inline Int_t Range(Int_t lb, Int_t ub, Int_t x); - inline Long_t Range(Long_t lb, Long_t ub, Long_t x); - inline ULong_t Range(ULong_t lb, ULong_t ub, ULong_t x); - inline Double_t Range(Double_t lb, Double_t ub, Double_t x); - - // Binary search - Long64_t BinarySearch(Long64_t n, const Short_t *array, Short_t value); - Long64_t BinarySearch(Long64_t n, const Short_t **array, Short_t value); - Long64_t BinarySearch(Long64_t n, const Int_t *array, Int_t value); - Long64_t BinarySearch(Long64_t n, const Int_t **array, Int_t value); - Long64_t BinarySearch(Long64_t n, const Float_t *array, Float_t value); - Long64_t BinarySearch(Long64_t n, const Float_t **array, Float_t value); - Long64_t BinarySearch(Long64_t n, const Double_t *array, Double_t value); - Long64_t BinarySearch(Long64_t n, const Double_t **array, Double_t value); - Long64_t BinarySearch(Long64_t n, const Long_t *array, Long_t value); - Long64_t BinarySearch(Long64_t n, const Long_t **array, Long_t value); - Long64_t BinarySearch(Long64_t n, const Long64_t *array, Long64_t value); - Long64_t BinarySearch(Long64_t n, const Long64_t **array, Long64_t value); - - // Hashing - ULong_t Hash(const void *txt, Int_t ntxt); - ULong_t Hash(const char *str); - - // IsInside - Bool_t IsInside(Int_t xp, Int_t yp, Int_t np, Int_t *x, Int_t *y); - Bool_t IsInside(Float_t xp, Float_t yp, Int_t np, Float_t *x, Float_t *y); - Bool_t IsInside(Double_t xp, Double_t yp, Int_t np, Double_t *x, Double_t *y); - - // Sorting - template <class Element, class Index, class Size> void SortImp(Size n, const Element*, Index* index, Bool_t down=kTRUE); - void Sort(Int_t n, const Short_t *a, Int_t *index, Bool_t down=kTRUE); - void Sort(Int_t n, const Int_t *a, Int_t *index, Bool_t down=kTRUE); - void Sort(Int_t n, const Float_t *a, Int_t *index, Bool_t down=kTRUE); - void Sort(Int_t n, const Double_t *a, Int_t *index, Bool_t down=kTRUE); - void Sort(Int_t n, const Long_t *a, Int_t *index, Bool_t down=kTRUE); - void Sort(Int_t n, const Long64_t *a, Int_t *index, Bool_t down=kTRUE); - void Sort(Long64_t n, const Short_t *a, Long64_t *index, Bool_t down=kTRUE); - void Sort(Long64_t n, const Int_t *a, Long64_t *index, Bool_t down=kTRUE); - void Sort(Long64_t n, const Float_t *a, Long64_t *index, Bool_t down=kTRUE); - void Sort(Long64_t n, const Double_t *a, Long64_t *index, Bool_t down=kTRUE); - void Sort(Long64_t n, const Long_t *a, Long64_t *index, Bool_t down=kTRUE); - void Sort(Long64_t n, const Long64_t *a, Long64_t *index, Bool_t down=kTRUE); - void BubbleHigh(Int_t Narr, Double_t *arr1, Int_t *arr2); - void BubbleLow (Int_t Narr, Double_t *arr1, Int_t *arr2); - - // Advanced - Float_t *Cross(const Float_t v1[3],const Float_t v2[3],Float_t out[3]); // Calculate the Cross Product of two vectors - Double_t *Cross(const Double_t v1[3],const Double_t v2[3],Double_t out[3]); // Calculate the Cross Product of two vectors - Float_t Normalize(Float_t v[3]); // Normalize a vector - Double_t Normalize(Double_t v[3]); // Normalize a vector - inline Float_t NormCross(const Float_t v1[3],const Float_t v2[3],Float_t out[3]); // Calculate the Normalized Cross Product of two vectors - inline Double_t NormCross(const Double_t v1[3],const Double_t v2[3],Double_t out[3]); // Calculate the Normalized Cross Product of two vectors - Float_t *Normal2Plane(const Float_t v1[3],const Float_t v2[3],const Float_t v3[3], Float_t normal[3]); // Calculate a normal vector of a plane - Double_t *Normal2Plane(const Double_t v1[3],const Double_t v2[3],const Double_t v3[3], Double_t normal[3]); // Calculate a normal vector of a plane - Bool_t RootsCubic(const Double_t coef[4],Double_t &a, Double_t &b, Double_t &c); - - Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1); - Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE); - Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE); - Double_t Voigt(Double_t x, Double_t sigma, Double_t lg, Int_t R = 4); - - // Bessel functions - Double_t BesselI(Int_t n,Double_t x); // integer order modified Bessel function I_n(x) - Double_t BesselK(Int_t n,Double_t x); // integer order modified Bessel function K_n(x) - Double_t BesselI0(Double_t x); // modified Bessel function I_0(x) - Double_t BesselK0(Double_t x); // modified Bessel function K_0(x) - Double_t BesselI1(Double_t x); // modified Bessel function I_1(x) - Double_t BesselK1(Double_t x); // modified Bessel function K_1(x) - Double_t BesselJ0(Double_t x); // Bessel function J0(x) for any real x - Double_t BesselJ1(Double_t x); // Bessel function J1(x) for any real x - Double_t BesselY0(Double_t x); // Bessel function Y0(x) for positive x - Double_t BesselY1(Double_t x); // Bessel function Y1(x) for positive x - Double_t StruveH0(Double_t x); // Struve functions of order 0 - Double_t StruveH1(Double_t x); // Struve functions of order 1 - Double_t StruveL0(Double_t x); // Modified Struve functions of order 0 - Double_t StruveL1(Double_t x); // Modified Struve functions of order 1 - - // Statistics - 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); - Double_t Binomial(Int_t n,Int_t k); // Calculate the binomial coefficient n over k - Double_t BinomialI(Double_t p, Int_t n, Int_t k); - Double_t CauchyDist(Double_t x, Double_t t=0, Double_t s=1); - Double_t ChisquareQuantile(Double_t p, Double_t ndf); - Double_t DiLog(Double_t x); - Double_t Erf(Double_t x); - Double_t ErfInverse(Double_t x); - Double_t Erfc(Double_t x); - inline Double_t ErfcInverse(Double_t x) {return TMath::ErfInverse(1-x);} - Double_t FDist(Double_t F, Double_t N, Double_t M); - Double_t FDistI(Double_t F, Double_t N, Double_t M); - Double_t Freq(Double_t x); - Double_t Gamma(Double_t z); - Double_t Gamma(Double_t a,Double_t x); - Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1); - 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); - 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 LnGamma(Double_t z); - Double_t LogNormal(Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1); - Double_t NormQuantile(Double_t p); - Bool_t Permute(Int_t n, Int_t *a); // Find permutations - Double_t Poisson(Double_t x, Double_t par); - Double_t PoissonI(Double_t x, Double_t par); - Double_t Prob(Double_t chi2,Int_t ndf); - 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 Vavilov(Double_t x, Double_t kappa, Double_t beta2); - Double_t VavilovI(Double_t x, Double_t kappa, Double_t beta2); -} - - -//---- Trig and other functions ------------------------------------------------ - -#include <float.h> - -#if defined(R__WIN32) && !defined(__CINT__) -# ifndef finite -# define finite _finite -# define isnan _isnan -# endif -#endif -#if defined(R__AIX) || defined(R__SOLARIS_CC50) || \ - defined(R__HPUX11) || defined(R__GLIBC) || \ - (defined(R__MACOSX) && defined(__INTEL_COMPILER)) -// math functions are defined inline so we have to include them here -# include <math.h> -# ifdef R__SOLARIS_CC50 - extern "C" { int finite(double); } -# endif -# if defined(R__GLIBC) && defined(__STRICT_ANSI__) -# ifndef finite -# define finite __finite -# endif -# ifndef isnan -# define isnan __isnan -# endif -# endif -#else -// don't want to include complete <math.h> -extern "C" { - extern double sin(double); - extern double cos(double); - extern double tan(double); - extern double sinh(double); - extern double cosh(double); - extern double tanh(double); - extern double asin(double); - extern double acos(double); - extern double atan(double); - extern double atan2(double, double); - extern double sqrt(double); - extern double exp(double); - extern double pow(double, double); - extern double log(double); - extern double log10(double); -#ifndef R__WIN32 -# if !defined(finite) - extern int finite(double); -# endif -# if !defined(isnan) - extern int isnan(double); -# endif - extern double ldexp(double, int); - extern double ceil(double); - extern double floor(double); -#else - _CRTIMP double ldexp(double, int); - _CRTIMP double ceil(double); - _CRTIMP double floor(double); -#endif -} -#endif - -inline Double_t TMath::Sin(Double_t x) - { return sin(x); } - -inline Double_t TMath::Cos(Double_t x) - { return cos(x); } - -inline Double_t TMath::Tan(Double_t x) - { return tan(x); } - -inline Double_t TMath::SinH(Double_t x) - { return sinh(x); } - -inline Double_t TMath::CosH(Double_t x) - { return cosh(x); } - -inline Double_t TMath::TanH(Double_t x) - { return tanh(x); } - -inline Double_t TMath::ASin(Double_t x) - { if (x < -1.) return -TMath::Pi()/2; - if (x > 1.) return TMath::Pi()/2; - return asin(x); - } - -inline Double_t TMath::ACos(Double_t x) - { if (x < -1.) return TMath::Pi(); - if (x > 1.) return 0; - return acos(x); - } - -inline Double_t TMath::ATan(Double_t x) - { return atan(x); } - -inline Double_t TMath::ATan2(Double_t y, Double_t x) - { if (x != 0) return atan2(y, x); - if (y == 0) return 0; - if (y > 0) return Pi()/2; - else return -Pi()/2; - } - -inline Double_t TMath::Sqrt(Double_t x) - { return sqrt(x); } - -inline Double_t TMath::Ceil(Double_t x) - { return ceil(x); } - -inline Int_t TMath::CeilNint(Double_t x) - { return TMath::Nint(ceil(x)); } - -inline Double_t TMath::Floor(Double_t x) - { return floor(x); } - -inline Int_t TMath::FloorNint(Double_t x) - { return TMath::Nint(floor(x)); } - -inline Double_t TMath::Exp(Double_t x) - { return exp(x); } - -inline Double_t TMath::Ldexp(Double_t x, Int_t exp) - { return ldexp(x, exp); } - -inline Double_t TMath::Power(Double_t x, Double_t y) - { return pow(x, y); } - -inline Double_t TMath::Log(Double_t x) - { return log(x); } - -inline Double_t TMath::Log10(Double_t x) - { return log10(x); } - -inline Int_t TMath::Finite(Double_t x) -#ifdef R__HPUX11 - { return isfinite(x); } -#else - { return finite(x); } -#endif - -inline Int_t TMath::IsNaN(Double_t x) - { return isnan(x); } - -//-------- Advanced ------------- - -inline Float_t TMath::NormCross(const Float_t v1[3],const Float_t v2[3],Float_t out[3]) -{ - // Calculate the Normalized Cross Product of two vectors - return Normalize(Cross(v1,v2,out)); -} - -inline Double_t TMath::NormCross(const Double_t v1[3],const Double_t v2[3],Double_t out[3]) -{ - // Calculate the Normalized Cross Product of two vectors - return Normalize(Cross(v1,v2,out)); -} - -#endif diff --git a/base/inc/TRandom.h b/base/inc/TRandom.h deleted file mode 100644 index ad486425053..00000000000 --- a/base/inc/TRandom.h +++ /dev/null @@ -1,64 +0,0 @@ -// @(#)root/base:$Name: $:$Id: TRandom.h,v 1.8 2006/05/06 08:25:15 brun Exp $ -// Author: Rene Brun 15/12/95 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TRandom -#define ROOT_TRandom - - - -////////////////////////////////////////////////////////////////////////// -// // -// TRandom // -// // -// Simple prototype random number generator class (periodicity = 10**9) // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_TNamed -#include "TNamed.h" -#endif - -class TRandom : public TNamed { - -protected: - UInt_t fSeed; //Random number generator seed - -public: - TRandom(UInt_t seed=65539); - virtual ~TRandom(); - virtual Int_t Binomial(Int_t ntot, Double_t prob); - virtual Double_t BreitWigner(Double_t mean=0, Double_t gamma=1); - virtual void Circle(Double_t &x, Double_t &y, Double_t r); - virtual Double_t Exp(Double_t tau); - virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1); - virtual UInt_t GetSeed() {return fSeed;} - virtual UInt_t Integer(UInt_t imax); - virtual Double_t Landau(Double_t mean=0, Double_t sigma=1); - virtual Int_t Poisson(Double_t mean); - virtual Double_t PoissonD(Double_t mean); - virtual void Rannor(Float_t &a, Float_t &b); - virtual void Rannor(Double_t &a, Double_t &b); - virtual void ReadRandom(const char *filename); - virtual void SetSeed(UInt_t seed=65539); - virtual Double_t Rndm(Int_t i=0); - virtual void RndmArray(Int_t n, Float_t *array); - virtual void RndmArray(Int_t n, Double_t *array); - virtual void Sphere(Double_t &x, Double_t &y, Double_t &z, Double_t r); - virtual Double_t Uniform(Double_t x1=1); - virtual Double_t Uniform(Double_t x1, Double_t x2); - virtual void WriteRandom(const char *filename); - - ClassDef(TRandom,1) //Simple Random number generator (periodicity = 10**9) -}; - -R__EXTERN TRandom *gRandom; - -#endif diff --git a/base/inc/TRandom1.h b/base/inc/TRandom1.h deleted file mode 100644 index 96fc304d80d..00000000000 --- a/base/inc/TRandom1.h +++ /dev/null @@ -1,72 +0,0 @@ -// @(#)root/base:$Name: $:$Id: TRandom1.h,v 1.1 2006/05/04 13:06:15 brun Exp $ -// Author: Rene Brun 04/03/99 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TRandom1 -#define ROOT_TRandom1 - - - -////////////////////////////////////////////////////////////////////////// -// // -// TRandom1 // -// // -// Ranlux random number generator class (periodicity > 10**14) // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_TRandom -#include "TRandom.h" -#endif - -class TRandom1 : public TRandom { - -protected: - Int_t fNskip; - Int_t fLuxury; - Int_t fIlag; - Int_t fJlag; - Int_t fCount24; - Float_t fFloatSeedTable[24]; - Float_t fCarry; - const Int_t fIntModulus; - static Int_t fgNumEngines; - static Int_t fgMaxIndex; - const UInt_t *fTheSeeds; - const Double_t fMantissaBit24; - const Double_t fMantissaBit12; - -public: - TRandom1(); - TRandom1(UInt_t seed, Int_t lux = 3 ); - TRandom1(Int_t rowIndex, Int_t colIndex, Int_t lux ); - virtual ~TRandom1(); - virtual Int_t GetLuxury() const {return fLuxury;} - // Gets the current seed. - const UInt_t *GetTheSeeds() const {return fTheSeeds;} - // Gets the current array of seeds. - static void GetTableSeeds(UInt_t* seeds, Int_t index); - // Gets back seed values stored in the table, given the index. - virtual Double_t Rndm(Int_t i=0); - virtual void RndmArray(Int_t size, Float_t *vect); - virtual void RndmArray(Int_t size, Double_t *vect); - virtual void SetSeed2(UInt_t seed, Int_t lux=3); - // Sets the state of the algorithm according to seed. - virtual void SetSeeds(const UInt_t * seeds, Int_t lux=3); - // Sets the state of the algorithm according to the zero terminated - // array of seeds. Only the first seed is used. - virtual void SetSeed(UInt_t seed); - - ClassDef(TRandom1,1) //Ranlux Random number generators with periodicity > 10**14 -}; - -R__EXTERN TRandom *gRandom; - -#endif diff --git a/base/inc/TRandom2.h b/base/inc/TRandom2.h deleted file mode 100644 index 5cbf19bb89b..00000000000 --- a/base/inc/TRandom2.h +++ /dev/null @@ -1,48 +0,0 @@ -// @(#)root/base:$Name: $:$Id: TRandom2.h,v 1.4 2006/05/17 17:32:40 brun Exp $ -// Author: Rene Brun 04/03/99 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TRandom2 -#define ROOT_TRandom2 - - - -////////////////////////////////////////////////////////////////////////// -// // -// TRandom2 // -// // -// random number generator class (periodicity > 10**26) // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_TRandom -#include "TRandom.h" -#endif - -class TRandom2 : public TRandom { - -protected: - UInt_t fSeed1; //Random number generator seed 1 - UInt_t fSeed2; //Random number generator seed 2 - -public: - TRandom2(UInt_t seed=1); - virtual ~TRandom2(); - virtual Double_t Rndm(Int_t i=0); - virtual void RndmArray(Int_t n, Float_t *array); - virtual void RndmArray(Int_t n, Double_t *array); - virtual void SetSeed(UInt_t seed=0); - - ClassDef(TRandom2,1) //Random number generator with periodicity of 10**26 -}; - -R__EXTERN TRandom *gRandom; - -#endif diff --git a/base/inc/TRandom3.h b/base/inc/TRandom3.h deleted file mode 100644 index 2ecde22d6d7..00000000000 --- a/base/inc/TRandom3.h +++ /dev/null @@ -1,48 +0,0 @@ -// @(#)root/base:$Name: $:$Id: TRandom3.h,v 1.4 2003/01/26 21:03:16 brun Exp $ -// Author: Peter Malzacher 31/08/99 - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TRandom3 -#define ROOT_TRandom3 - - - -////////////////////////////////////////////////////////////////////////// -// // -// TRandom3 // -// // -// random number generator class: Mersenne Twistor // -// // -////////////////////////////////////////////////////////////////////////// - -#ifndef ROOT_TRandom -#include "TRandom.h" -#endif - -class TRandom3 : public TRandom { - -private: - UInt_t fMt[624]; - Int_t fCount624; - -public: - TRandom3(UInt_t seed=4357); - virtual ~TRandom3(); - virtual Double_t Rndm(Int_t i=0); - virtual void RndmArray(Int_t n, Float_t *array); - virtual void RndmArray(Int_t n, Double_t *array); - virtual void SetSeed(UInt_t seed=0); - - ClassDef(TRandom3,2) //Random number generator: Mersenne Twistor -}; - -R__EXTERN TRandom *gRandom; - -#endif -- GitLab