Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RandStudentT.h
Go to the documentation of this file.
1 // $Id:$
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandStudentT ---
7 // class header file
8 // -----------------------------------------------------------------------
9 
10 // Class defining methods for shooting Student's t- distributed random
11 // values, given a number of degrees of freedom a (default=1.0).
12 // Default values are used for operator()().
13 
14 // Valid input values are a > 0. When invalid values are presented, the
15 // code silently returns DBL_MAX from <float.h> which is the same as
16 // MAXDOUBLE in <values.h> on systems where the latter exists.
17 
18 // =======================================================================
19 // John Marraffino - Created: Based on the C-Rand package
20 // by Ernst Stadlober and Franz Niederl of the Technical
21 // University of Graz, Austria : 12th May 1998
22 // - Removed <values.h> because that won't work
23 // on NT : 26th Jun 1998
24 // Gabriele Cosmo - Fixed minor bug on inline definition for shoot()
25 // methods. Created .icc file : 20th Aug 1998
26 // - Removed useless methods and data: 5th Jan 1999
27 // M Fischler - put and get to/from streams 12/10/04
28 // =======================================================================
29 
30 #ifndef RandStudentT_h
31 #define RandStudentT_h 1
32 
33 #include "CLHEP/Random/Random.h"
34 #include "CLHEP/Utility/memory.h"
35 
36 namespace CLHEP {
37 
42 class RandStudentT : public HepRandom {
43 
44 public:
45 
46  inline RandStudentT ( HepRandomEngine& anEngine, double a=1.0 );
47  inline RandStudentT ( HepRandomEngine* anEngine, double a=1.0 );
48  // These constructors should be used to instantiate a RandStudentT
49  // distribution object defining a local engine for it.
50  // The static generator will be skipped using the non-static methods
51  // defined below.
52  // If the engine is passed by pointer the corresponding engine object
53  // will be deleted by the RandStudentT destructor.
54  // If the engine is passed by reference the corresponding engine object
55  // will not be deleted by the RandStudentT destructor.
56 
57  virtual ~RandStudentT();
58  // Destructor
59 
60  // Save and restore to/from streams
61 
62  std::ostream & put ( std::ostream & os ) const;
63  std::istream & get ( std::istream & is );
64 
65  // Static methods to shoot random values using the static generator
66 
67  static inline double shoot();
68 
69  static double shoot( double a );
70 
71  static void shootArray ( const int size, double* vect,
72  double a=1.0 );
73 
74  // Static methods to shoot random values using a given engine
75  // by-passing the static generator.
76 
77  static inline double shoot( HepRandomEngine* anEngine );
78 
79  static double shoot( HepRandomEngine* anEngine,
80  double a );
81 
82  static void shootArray ( HepRandomEngine* anEngine, const int size,
83  double* vect, double a=1.0 );
84 
85  // Methods using the localEngine to shoot random values, by-passing
86  // the static generator.
87 
88  inline double fire();
89 
90  double fire( double a );
91 
92  void fireArray ( const int size, double* vect );
93  void fireArray ( const int size, double* vect, double a );
94  double operator()();
95  double operator()( double a );
96 
97  std::string name() const;
99 
100  static std::string distributionName() {return "RandStudentT";}
101  // Provides the name of this distribution class
102 
103 
104 private:
105 
106  std::shared_ptr<HepRandomEngine> localEngine;
107  double defaultA;
108 
109 };
110 
111 } // namespace CLHEP
112 
113 #include "CLHEP/Random/RandStudentT.icc"
114 
115 #endif
void fireArray(const int size, double *vect)
std::string name() const
Definition: RandStudentT.cc:27
static std::string distributionName()
Definition: RandStudentT.h:100
virtual ~RandStudentT()
Definition: RandStudentT.cc:30
static double shoot()
RandStudentT(HepRandomEngine &anEngine, double a=1.0)
static void shootArray(const int size, double *vect, double a=1.0)
Definition: RandStudentT.cc:83
std::ostream & put(std::ostream &os) const
HepRandomEngine & engine()
Definition: RandStudentT.cc:28