CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RandStudentT.h

Go to the documentation of this file.
00001 // $Id: RandStudentT.h,v 1.3.4.1 2005/03/18 22:26:48 garren 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 // M Fischler      - put and get to/from streams 12/10/04
00028 // =======================================================================
00029 
00030 #ifndef RandStudentT_h
00031 #define RandStudentT_h 1
00032 
00033 #include "CLHEP/Random/defs.h"
00034 #include "CLHEP/Random/Random.h"
00035 
00036 namespace CLHEP {
00037 
00042 class RandStudentT : public HepRandom {
00043 
00044 public:
00045 
00046   inline RandStudentT ( HepRandomEngine& anEngine, double a=1.0 );
00047   inline RandStudentT ( HepRandomEngine* anEngine, double a=1.0 );
00048   // These constructors should be used to instantiate a RandStudentT
00049   // distribution object defining a local engine for it.
00050   // The static generator will be skipped using the non-static methods
00051   // defined below.
00052   // If the engine is passed by pointer the corresponding engine object
00053   // will be deleted by the RandStudentT destructor.
00054   // If the engine is passed by reference the corresponding engine object
00055   // will not be deleted by the RandStudentT destructor.
00056 
00057   virtual ~RandStudentT();
00058   // Destructor
00059 
00060   // Save and restore to/from streams
00061   
00062   std::ostream & put ( std::ostream & os ) const;
00063   std::istream & get ( std::istream & is );
00064 
00065   // Static methods to shoot random values using the static generator
00066 
00067   static  inline double shoot();
00068 
00069   static  double shoot( double a );
00070 
00071   static  void shootArray ( const int size, double* vect,
00072                             double a=1.0 );
00073 
00074   //  Static methods to shoot random values using a given engine
00075   //  by-passing the static generator.
00076 
00077   static  inline double shoot( HepRandomEngine* anEngine );
00078 
00079   static  double shoot( HepRandomEngine* anEngine, 
00080                            double a );
00081 
00082   static  void shootArray ( HepRandomEngine* anEngine, const int size,
00083                             double* vect, double a=1.0 );
00084 
00085   //  Methods using the localEngine to shoot random values, by-passing
00086   //  the static generator.
00087 
00088   inline double fire();
00089 
00090   double fire( double a );
00091   
00092   void fireArray ( const int size, double* vect );
00093   void fireArray ( const int size, double* vect, double a );
00094   double operator()();
00095   double operator()( double a );
00096 
00097   std::string name() const;
00098   HepRandomEngine & engine();
00099 
00100   static std::string distributionName() {return "RandStudentT";}  
00101   // Provides the name of this distribution class
00102 
00103 
00104 private:
00105 
00106   // Private copy constructor. Defining it here disallows use.
00107   RandStudentT(const RandStudentT& d);
00108 
00109   HepRandomEngine* localEngine;
00110   bool deleteEngine;
00111   double defaultA;
00112 
00113 };
00114 
00115 }  // namespace CLHEP
00116 
00117 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00118 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00119 using namespace CLHEP;
00120 #endif
00121 
00122 #include "CLHEP/Random/RandStudentT.icc"
00123 
00124 #endif

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7