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

RandGaussQ.h

Go to the documentation of this file.
00001 // $Id: RandGaussQ.h,v 1.3.4.1 2005/03/18 22:26:48 garren Exp $
00002 // -*- C++ -*-
00003 //
00004 // -----------------------------------------------------------------------
00005 //                             HEP Random
00006 //                          --- RandGaussQ ---
00007 //                          class header file
00008 // -----------------------------------------------------------------------
00009 
00010 // Class defining methods RandGaussQ, which is derived from RandGauss.
00011 // The user interface is identical; but RandGaussQ is faster and a bit less
00012 // accurate.
00013 
00014 // =======================================================================
00015 // M. Fischler - Created: 24th Jan 2000
00016 // M Fischler      - put and get to/from streams 12/10/04
00017 //
00018 // =======================================================================
00019 
00020 #ifndef RandGaussQ_h
00021 #define RandGaussQ_h 1
00022 
00023 #include "CLHEP/Random/defs.h"
00024 #include "CLHEP/Random/RandGauss.h"
00025 
00026 namespace CLHEP {
00027 
00032 class RandGaussQ : public RandGauss {
00033 
00034 public:
00035 
00036   inline RandGaussQ ( HepRandomEngine& anEngine, double mean=0.0,
00037                                                 double stdDev=1.0 );
00038   inline RandGaussQ ( HepRandomEngine* anEngine, double mean=0.0,
00039                                                 double stdDev=1.0 );
00040   // These constructors should be used to instantiate a RandGaussQ
00041   // distribution object defining a local engine for it.
00042   // The static generator will be skipped using the non-static methods
00043   // defined below.
00044   // If the engine is passed by pointer the corresponding engine object
00045   // will be deleted by the RandGaussQ destructor.
00046   // If the engine is passed by reference the corresponding engine object
00047   // will not be deleted by the RandGaussQ destructor.
00048 
00049   // Destructor
00050   virtual ~RandGaussQ();
00051 
00052   //
00053   // Methods to generate Gaussian-distributed random deviates:
00054   //
00055   //   If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec while 
00056   //   RandGaussQ::fire() adds only .4 usec.
00057   //
00058 
00059   // Static methods to shoot random values using the static generator
00060 
00061   static  inline double shoot();
00062 
00063   static  inline double shoot( double mean, double stdDev );
00064 
00065   static  void shootArray ( const int size, double* vect,
00066                             double mean=0.0, double stdDev=1.0 );
00067 
00068   //  Static methods to shoot random values using a given engine
00069   //  by-passing the static generator.
00070 
00071   static  inline double shoot( HepRandomEngine* anotherEngine );
00072 
00073   static  inline double shoot( HepRandomEngine* anotherEngine, 
00074                                   double mean, double stdDev );
00075 
00076 
00077   static  void shootArray ( HepRandomEngine* anotherEngine, 
00078                             const int size,
00079                             double* vect, double mean=0.0,
00080                             double stdDev=1.0 );
00081 
00082   //  Instance methods using the localEngine to instead of the static 
00083   //  generator, and the default mean and stdDev established at construction
00084 
00085   inline double fire();
00086 
00087   inline double fire ( double mean, double stdDev );
00088   
00089   void fireArray  ( const int size, double* vect);
00090   void fireArray  ( const int size, double* vect,
00091                     double mean, double stdDev );
00092 
00093   virtual double operator()();
00094   virtual double operator()( double mean, double stdDev );
00095 
00096   // Save and restore to/from streams
00097   
00098   std::ostream & put ( std::ostream & os ) const;
00099   std::istream & get ( std::istream & is );
00100 
00101   std::string name() const;
00102   HepRandomEngine & engine();
00103 
00104   static std::string distributionName() {return "RandGaussQ";}  
00105   // Provides the name of this distribution class
00106   
00107 
00108 protected:
00109 
00110   static double transformQuick (double r);
00111   static double transformSmall (double r);
00112 
00113 private:
00114 
00115   // Private copy constructor. Defining it here disallows use.
00116   RandGaussQ(const RandGaussQ& d);
00117 
00118   // All the engine info, and the default mean and sigma, are in the RandGauss
00119   // base class.
00120 
00121 };
00122 
00123 }  // namespace CLHEP
00124 
00125 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00126 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00127 using namespace CLHEP;
00128 #endif
00129 
00130 #include "CLHEP/Random/RandGaussQ.icc"
00131 
00132 #endif

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