CLHEP VERSION 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.5 2010/06/16 17:24:53 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 #include "CLHEP/Utility/memory.h"
00036 
00037 namespace CLHEP {
00038 
00043 class RandStudentT : public HepRandom {
00044 
00045 public:
00046 
00047   inline RandStudentT ( HepRandomEngine& anEngine, double a=1.0 );
00048   inline RandStudentT ( HepRandomEngine* anEngine, double a=1.0 );
00049   // These constructors should be used to instantiate a RandStudentT
00050   // distribution object defining a local engine for it.
00051   // The static generator will be skipped using the non-static methods
00052   // defined below.
00053   // If the engine is passed by pointer the corresponding engine object
00054   // will be deleted by the RandStudentT destructor.
00055   // If the engine is passed by reference the corresponding engine object
00056   // will not be deleted by the RandStudentT destructor.
00057 
00058   virtual ~RandStudentT();
00059   // Destructor
00060 
00061   // Save and restore to/from streams
00062   
00063   std::ostream & put ( std::ostream & os ) const;
00064   std::istream & get ( std::istream & is );
00065 
00066   // Static methods to shoot random values using the static generator
00067 
00068   static  inline double shoot();
00069 
00070   static  double shoot( double a );
00071 
00072   static  void shootArray ( const int size, double* vect,
00073                             double a=1.0 );
00074 
00075   //  Static methods to shoot random values using a given engine
00076   //  by-passing the static generator.
00077 
00078   static  inline double shoot( HepRandomEngine* anEngine );
00079 
00080   static  double shoot( HepRandomEngine* anEngine, 
00081                            double a );
00082 
00083   static  void shootArray ( HepRandomEngine* anEngine, const int size,
00084                             double* vect, double a=1.0 );
00085 
00086   //  Methods using the localEngine to shoot random values, by-passing
00087   //  the static generator.
00088 
00089   inline double fire();
00090 
00091   double fire( double a );
00092   
00093   void fireArray ( const int size, double* vect );
00094   void fireArray ( const int size, double* vect, double a );
00095   double operator()();
00096   double operator()( double a );
00097 
00098   std::string name() const;
00099   HepRandomEngine & engine();
00100 
00101   static std::string distributionName() {return "RandStudentT";}  
00102   // Provides the name of this distribution class
00103 
00104 
00105 private:
00106 
00107   shared_ptr<HepRandomEngine> localEngine;
00108   double defaultA;
00109 
00110 };
00111 
00112 }  // namespace CLHEP
00113 
00114 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00115 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00116 using namespace CLHEP;
00117 #endif
00118 
00119 #include "CLHEP/Random/RandStudentT.icc"
00120 
00121 #endif

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7