00001 // $Id: Stat.h,v 1.5 2002/04/12 15:02:45 evc Exp $ 00002 // -*- C++ -*- 00003 // 00004 // ----------------------------------------------------------------------- 00005 // HEP Random 00006 // --- HepStat --- 00007 // Purely static class containing useful statistics methods 00008 00009 // ----------------------------------------------------------------------- 00010 00011 // HepStat is a substitute for using a namespace. 00012 // One would never instantiate a HepStat object; 00013 // usage of any of these methods looks like -- 00014 // 00015 // double x = HepStat::erf ( .1 ); 00016 // 00017 // A user may wish to improve the readability of algortihm code which uses 00018 // one method many times by lines like using HepStat::erf 00019 // 00020 // and later, x = erf(u); will work. 00021 // 00022 00023 // These methods are implemented in separate .cc files so that 00024 // user code need pull in only the code that is necessary. Time 00025 // (ROUGH estimates in cycles) and table footprint info is provided 00026 // in this header. 00027 00028 00029 // ======================================================================= 00030 // M. Fischler - Created: 1/25/00 00031 // 00032 // M. Fischler - Inserted flatToGaussian 1/25/00 00033 // From code of an attempt to speed up RandGauss 00034 // by use of tables and splines. The code was not 00035 // significantly faster than Box-Mueller, so that 00036 // algorithm is left as the RandGauss implementation. 00037 // - Inserted inverseErf 00038 // M. Fischler - Inserted gammln 2/4/00 00039 // M. Fischler - Made constructor private; removed private destructor 4/17/00 00040 // ======================================================================= 00041 00042 #ifndef HepStat_h 00043 #define HepStat_h 1 00044 00045 #include "CLHEP/config/CLHEP.h" 00046 00051 class HepStat { 00052 00053 private: 00054 HepStat(); 00055 // You CANNOT instantiate a HepStat object. 00056 00057 public: 00058 00059 static double flatToGaussian (double r); 00060 // This is defined by the satement that if e() provides a uniform random 00061 // on (0,1) then flatToGaussian(e()) is distributed as a unit normal 00062 // Gaussian. That is, flatToGaussian is the inverse of the c.d.f. of 00063 // a Gaussian. 00064 // Footprint: 30 K // Time: 150 cycles 00065 00066 static double inverseErf (double t); 00067 static double erf (double x); 00068 // defined in flatToGaussian.cc 00069 00070 static double erfQ (double x); 00071 // Quicker, and with less footprint, than erf and gaussianCDF 00072 // but only accurate to 7 digits. 00073 // Footprint: 0 // Time: 00074 00075 static double gammln (double x); 00076 // ln (gamma(x)) 00077 00078 }; 00079 00080 #endif