CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // $Id: Stat.h,v 1.3 2003/10/23 21:29:51 garren 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/Random/defs.h" 00046 00047 namespace CLHEP { 00048 00053 class HepStat { 00054 00055 private: 00056 HepStat(); 00057 // You CANNOT instantiate a HepStat object. 00058 00059 public: 00060 00061 static double flatToGaussian (double r); 00062 // This is defined by the satement that if e() provides a uniform random 00063 // on (0,1) then flatToGaussian(e()) is distributed as a unit normal 00064 // Gaussian. That is, flatToGaussian is the inverse of the c.d.f. of 00065 // a Gaussian. 00066 // Footprint: 30 K // Time: 150 cycles 00067 00068 static double inverseErf (double t); 00069 static double erf (double x); 00070 // defined in flatToGaussian.cc 00071 00072 static double erfQ (double x); 00073 // Quicker, and with less footprint, than erf and gaussianCDF 00074 // but only accurate to 7 digits. 00075 // Footprint: 0 // Time: 00076 00077 static double gammln (double x); 00078 // ln (gamma(x)) 00079 00080 }; 00081 00082 } // namespace CLHEP 00083 00084 #ifdef ENABLE_BACKWARDS_COMPATIBILITY 00085 // backwards compatibility will be enabled ONLY in CLHEP 1.9 00086 using namespace CLHEP; 00087 #endif 00088 00089 #endif