Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stat.h
Go to the documentation of this file.
1 // $Id:$
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- HepStat ---
7 // Purely static class containing useful statistics methods
8 
9 // -----------------------------------------------------------------------
10 
11 // HepStat is a substitute for using a namespace.
12 // One would never instantiate a HepStat object;
13 // usage of any of these methods looks like --
14 //
15 // double x = HepStat::erf ( .1 );
16 //
17 // A user may wish to improve the readability of algortihm code which uses
18 // one method many times by lines like using HepStat::erf
19 //
20 // and later, x = erf(u); will work.
21 //
22 
23 // These methods are implemented in separate .cc files so that
24 // user code need pull in only the code that is necessary. Time
25 // (ROUGH estimates in cycles) and table footprint info is provided
26 // in this header.
27 
28 
29 // =======================================================================
30 // M. Fischler - Created: 1/25/00
31 //
32 // M. Fischler - Inserted flatToGaussian 1/25/00
33 // From code of an attempt to speed up RandGauss
34 // by use of tables and splines. The code was not
35 // significantly faster than Box-Mueller, so that
36 // algorithm is left as the RandGauss implementation.
37 // - Inserted inverseErf
38 // M. Fischler - Inserted gammln 2/4/00
39 // M. Fischler - Made constructor private; removed private destructor 4/17/00
40 // =======================================================================
41 
42 #ifndef HepStat_h
43 #define HepStat_h 1
44 
45 namespace CLHEP {
46 
51 class HepStat {
52 
53 private:
54  HepStat();
55  // You CANNOT instantiate a HepStat object.
56 
57 public:
58 
59  static double flatToGaussian (double r);
60  // This is defined by the satement that if e() provides a uniform random
61  // on (0,1) then flatToGaussian(e()) is distributed as a unit normal
62  // Gaussian. That is, flatToGaussian is the inverse of the c.d.f. of
63  // a Gaussian.
64  // Footprint: 30 K // Time: 150 cycles
65 
66  static double inverseErf (double t);
67  static double erf (double x);
68  // defined in flatToGaussian.cc
69 
70  static double erfQ (double x);
71  // Quicker, and with less footprint, than erf and gaussianCDF
72  // but only accurate to 7 digits.
73  // Footprint: 0 // Time:
74 
75  static double gammln (double x);
76  // ln (gamma(x))
77 
78 };
79 
80 } // namespace CLHEP
81 
82 #endif