|
||||
File indexing completed on 2025-01-18 09:54:38
0001 // $Id: RandStudentT.h,v 1.5 2010/06/16 17:24:53 garren Exp $ 0002 // -*- C++ -*- 0003 // 0004 // ----------------------------------------------------------------------- 0005 // HEP Random 0006 // --- RandStudentT --- 0007 // class header file 0008 // ----------------------------------------------------------------------- 0009 0010 // Class defining methods for shooting Student's t- distributed random 0011 // values, given a number of degrees of freedom a (default=1.0). 0012 // Default values are used for operator()(). 0013 0014 // Valid input values are a > 0. When invalid values are presented, the 0015 // code silently returns DBL_MAX from <float.h> which is the same as 0016 // MAXDOUBLE in <values.h> on systems where the latter exists. 0017 0018 // ======================================================================= 0019 // John Marraffino - Created: Based on the C-Rand package 0020 // by Ernst Stadlober and Franz Niederl of the Technical 0021 // University of Graz, Austria : 12th May 1998 0022 // - Removed <values.h> because that won't work 0023 // on NT : 26th Jun 1998 0024 // Gabriele Cosmo - Fixed minor bug on inline definition for shoot() 0025 // methods. Created .icc file : 20th Aug 1998 0026 // - Removed useless methods and data: 5th Jan 1999 0027 // M Fischler - put and get to/from streams 12/10/04 0028 // ======================================================================= 0029 0030 #ifndef RandStudentT_h 0031 #define RandStudentT_h 1 0032 0033 #include "CLHEP/Random/defs.h" 0034 #include "CLHEP/Random/Random.h" 0035 #include "CLHEP/Utility/memory.h" 0036 0037 namespace CLHEP { 0038 0039 /** 0040 * @author 0041 * @ingroup random 0042 */ 0043 class RandStudentT : public HepRandom { 0044 0045 public: 0046 0047 inline RandStudentT ( HepRandomEngine& anEngine, double a=1.0 ); 0048 inline RandStudentT ( HepRandomEngine* anEngine, double a=1.0 ); 0049 // These constructors should be used to instantiate a RandStudentT 0050 // distribution object defining a local engine for it. 0051 // The static generator will be skipped using the non-static methods 0052 // defined below. 0053 // If the engine is passed by pointer the corresponding engine object 0054 // will be deleted by the RandStudentT destructor. 0055 // If the engine is passed by reference the corresponding engine object 0056 // will not be deleted by the RandStudentT destructor. 0057 0058 virtual ~RandStudentT(); 0059 // Destructor 0060 0061 // Save and restore to/from streams 0062 0063 std::ostream & put ( std::ostream & os ) const; 0064 std::istream & get ( std::istream & is ); 0065 0066 // Static methods to shoot random values using the static generator 0067 0068 static inline double shoot(); 0069 0070 static double shoot( double a ); 0071 0072 static void shootArray ( const int size, double* vect, 0073 double a=1.0 ); 0074 0075 // Static methods to shoot random values using a given engine 0076 // by-passing the static generator. 0077 0078 static inline double shoot( HepRandomEngine* anEngine ); 0079 0080 static double shoot( HepRandomEngine* anEngine, 0081 double a ); 0082 0083 static void shootArray ( HepRandomEngine* anEngine, const int size, 0084 double* vect, double a=1.0 ); 0085 0086 // Methods using the localEngine to shoot random values, by-passing 0087 // the static generator. 0088 0089 inline double fire(); 0090 0091 double fire( double a ); 0092 0093 void fireArray ( const int size, double* vect ); 0094 void fireArray ( const int size, double* vect, double a ); 0095 double operator()(); 0096 double operator()( double a ); 0097 0098 std::string name() const; 0099 HepRandomEngine & engine(); 0100 0101 static std::string distributionName() {return "RandStudentT";} 0102 // Provides the name of this distribution class 0103 0104 0105 private: 0106 0107 std::shared_ptr<HepRandomEngine> localEngine; 0108 double defaultA; 0109 0110 }; 0111 0112 } // namespace CLHEP 0113 0114 #ifdef ENABLE_BACKWARDS_COMPATIBILITY 0115 // backwards compatibility will be enabled ONLY in CLHEP 1.9 0116 using namespace CLHEP; 0117 #endif 0118 0119 #include "CLHEP/Random/RandStudentT.icc" 0120 0121 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |