00001 // $Id: RandStudentT.h,v 1.10 2002/05/25 08:36:11 evc Exp $ 00002 // -*- C++ -*- 00003 // 00004 // ----------------------------------------------------------------------- 00005 // HEP Random 00006 // --- RandStudentT --- 00007 // class header file 00008 // ----------------------------------------------------------------------- 00009 00010 // Class defining methods for shooting Student's t- distributed random 00011 // values, given a number of degrees of freedom a (default=1.0). 00012 // Default values are used for operator()(). 00013 00014 // Valid input values are a > 0. When invalid values are presented, the 00015 // code silently returns DBL_MAX from <float.h> which is the same as 00016 // MAXDOUBLE in <values.h> on systems where the latter exists. 00017 00018 // ======================================================================= 00019 // John Marraffino - Created: Based on the C-Rand package 00020 // by Ernst Stadlober and Franz Niederl of the Technical 00021 // University of Graz, Austria : 12th May 1998 00022 // - Removed <values.h> because that won't work 00023 // on NT : 26th Jun 1998 00024 // Gabriele Cosmo - Fixed minor bug on inline definition for shoot() 00025 // methods. Created .icc file : 20th Aug 1998 00026 // - Removed useless methods and data: 5th Jan 1999 00027 // ======================================================================= 00028 00029 #ifndef RandStudentT_h 00030 #define RandStudentT_h 1 00031 00032 #include "CLHEP/Random/Random.h" 00033 00038 class RandStudentT : public HepRandom { 00039 00040 public: 00041 00042 inline RandStudentT ( HepRandomEngine& anEngine, double a=1.0 ); 00043 inline RandStudentT ( HepRandomEngine* anEngine, double a=1.0 ); 00044 // These constructors should be used to instantiate a RandStudentT 00045 // distribution object defining a local engine for it. 00046 // The static generator will be skipped using the non-static methods 00047 // defined below. 00048 // If the engine is passed by pointer the corresponding engine object 00049 // will be deleted by the RandStudentT destructor. 00050 // If the engine is passed by reference the corresponding engine object 00051 // will not be deleted by the RandStudentT destructor. 00052 00053 virtual ~RandStudentT(); 00054 // Destructor 00055 00056 // Static methods to shoot random values using the static generator 00057 00058 static inline double shoot(); 00059 00060 static double shoot( double a ); 00061 00062 static void shootArray ( const int size, double* vect, 00063 double a=1.0 ); 00064 00065 // Static methods to shoot random values using a given engine 00066 // by-passing the static generator. 00067 00068 static inline double shoot( HepRandomEngine* anEngine ); 00069 00070 static double shoot( HepRandomEngine* anEngine, 00071 double a ); 00072 00073 static void shootArray ( HepRandomEngine* anEngine, const int size, 00074 double* vect, double a=1.0 ); 00075 00076 // Methods using the localEngine to shoot random values, by-passing 00077 // the static generator. 00078 00079 inline double fire(); 00080 00081 double fire( double a ); 00082 00083 void fireArray ( const int size, double* vect ); 00084 void fireArray ( const int size, double* vect, double a ); 00085 double operator()(); 00086 double operator()( double a ); 00087 00088 private: 00089 00090 // Private copy constructor. Defining it here disallows use. 00091 RandStudentT(const RandStudentT& d); 00092 00093 HepRandomEngine* localEngine; 00094 bool deleteEngine; 00095 const double defaultA; 00096 00097 }; 00098 00099 #include "CLHEP/Random/RandStudentT.icc" 00100 00101 #endif