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

RandGaussT.h

Go to the documentation of this file.
00001 // $Id: RandGaussT.h,v 1.3.4.1 2005/03/18 22:26:48 garren Exp $
00002 // -*- C++ -*-
00003 //
00004 // -----------------------------------------------------------------------
00005 //                             HEP Random
00006 //                          --- RandGaussT ---
00007 //                          class header file
00008 // -----------------------------------------------------------------------
00009 
00010 // Class defining methods RandGaussT, which is derived from RandGauss.
00011 // The user interface is identical.  
00012 // RandGaussT ---
00013 //   Always uses exactly one flat random from the engine
00014 //   Is stateless so that saveEngineStatus works even if invoked knowing
00015 //   only that the distribution is a HepRandom.  (RandGauss is not stateless.)
00016 //   Is accurate to more than 12 decimal places in all cases, and more so 
00017 //   near the end points.
00018 //   Runs about as fast as RandGauss.
00019 // RandGaussT utilizes HepStat::flatToGaussian(r), so its effective footprint
00020 // (for the tables used) is almost 30K bytes.
00021 
00022 // =======================================================================
00023 // M. Fischler          Created 2/2/00
00024 // M Fischler      - put and get to/from streams 12/10/04
00025 //
00026 // =======================================================================
00027 
00028 #ifndef RandGaussT_h
00029 #define RandGaussT_h 1
00030 
00031 #include "CLHEP/Random/defs.h"
00032 #include "CLHEP/Random/RandGauss.h"
00033 #include "CLHEP/Random/Stat.h"
00034 
00035 namespace CLHEP {
00036 
00041 class RandGaussT : public RandGauss {
00042 
00043 public:
00044 
00045   inline RandGaussT ( HepRandomEngine& anEngine, double mean=0.0,
00046                                                 double stdDev=1.0 );
00047   inline RandGaussT ( HepRandomEngine* anEngine, double mean=0.0,
00048                                                 double stdDev=1.0 );
00049   // These constructors should be used to instantiate a RandGaussT
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 RandGaussT destructor.
00055   // If the engine is passed by reference the corresponding engine object
00056   // will not be deleted by the RandGaussT destructor.
00057 
00058   // Destructor
00059   virtual ~RandGaussT();
00060 
00061   //
00062   // Methods to generate Gaussian-distributed random deviates:
00063   //
00064   //   If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec;
00065   //   RandGaussT::fire() similarly adds 1 usec.
00066   //
00067 
00068   // Static methods to shoot random values using the static generator
00069 
00070   static  inline double shoot();
00071 
00072   static  inline double shoot( double mean, double stdDev );
00073 
00074   static  void shootArray ( const int size, double* vect,
00075                             double mean=0.0, double stdDev=1.0 );
00076 
00077   //  Static methods to shoot random values using a given engine
00078   //  by-passing the static generator.
00079 
00080   static  inline double shoot( HepRandomEngine* anotherEngine );
00081 
00082   static  inline double shoot( HepRandomEngine* anotherEngine, 
00083                                   double mean, double stdDev );
00084 
00085 
00086   static  void shootArray ( HepRandomEngine* anotherEngine, 
00087                             const int size,
00088                             double* vect, double mean=0.0,
00089                             double stdDev=1.0 );
00090 
00091   //  Instance methods using the localEngine to instead of the static 
00092   //  generator, and the default mean and stdDev established at construction
00093 
00094   inline double fire();
00095 
00096   inline double fire ( double mean, double stdDev );
00097   
00098   void fireArray  ( const int size, double* vect);
00099   void fireArray  ( const int size, double* vect,
00100                     double mean, double stdDev );
00101 
00102   virtual double operator()();
00103   virtual double operator()( double mean, double stdDev );
00104 
00105   // Save and restore to/from streams
00106   
00107   std::ostream & put ( std::ostream & os ) const;
00108   std::istream & get ( std::istream & is );
00109 
00110   std::string name() const;
00111   HepRandomEngine & engine();
00112 
00113   static std::string distributionName() {return "RandGaussT";}  
00114   // Provides the name of this distribution class
00115   
00116 
00117 protected:
00118 
00119 private:
00120 
00121   // Private copy constructor. Defining it here disallows use.
00122   RandGaussT(const RandGaussT& d);
00123 
00124   // All the engine info, and the default mean and sigma, are in the RandGauss
00125   // base class.
00126 
00127 };
00128 
00129 }  // namespace CLHEP
00130 
00131 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00132 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00133 using namespace CLHEP;
00134 #endif
00135 
00136 #include "CLHEP/Random/RandGaussT.icc"
00137 
00138 #endif

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