CLHEP/Random/RandGaussQ.h

00001 // $Id: RandGaussQ.h,v 1.5 2002/04/12 15:02:44 evc 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 //
00017 // =======================================================================
00018 
00019 #ifndef RandGaussQ_h
00020 #define RandGaussQ_h 1
00021 
00022 #include "CLHEP/Random/RandGauss.h"
00023 
00028 class RandGaussQ : public RandGauss {
00029 
00030 public:
00031 
00032   inline RandGaussQ ( HepRandomEngine& anEngine, double mean=0.0,
00033                                                 double stdDev=1.0 );
00034   inline RandGaussQ ( HepRandomEngine* anEngine, double mean=0.0,
00035                                                 double stdDev=1.0 );
00036   // These constructors should be used to instantiate a RandGaussQ
00037   // distribution object defining a local engine for it.
00038   // The static generator will be skipped using the non-static methods
00039   // defined below.
00040   // If the engine is passed by pointer the corresponding engine object
00041   // will be deleted by the RandGaussQ destructor.
00042   // If the engine is passed by reference the corresponding engine object
00043   // will not be deleted by the RandGaussQ destructor.
00044 
00045   // Destructor
00046   virtual ~RandGaussQ();
00047 
00048   //
00049   // Methods to generate Gaussian-distributed random deviates:
00050   //
00051   //   If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec while 
00052   //   RandGaussQ::fire() adds only .4 usec.
00053   //
00054 
00055   // Static methods to shoot random values using the static generator
00056 
00057   static  inline double shoot();
00058 
00059   static  inline double shoot( double mean, double stdDev );
00060 
00061   static  void shootArray ( const int size, double* vect,
00062                             double mean=0.0, double stdDev=1.0 );
00063 
00064   //  Static methods to shoot random values using a given engine
00065   //  by-passing the static generator.
00066 
00067   static  inline double shoot( HepRandomEngine* anotherEngine );
00068 
00069   static  inline double shoot( HepRandomEngine* anotherEngine, 
00070                                   double mean, double stdDev );
00071 
00072 
00073   static  void shootArray ( HepRandomEngine* anotherEngine, 
00074                             const int size,
00075                             double* vect, double mean=0.0,
00076                             double stdDev=1.0 );
00077 
00078   //  Instance methods using the localEngine to instead of the static 
00079   //  generator, and the default mean and stdDev established at construction
00080 
00081   inline double fire();
00082 
00083   inline double fire ( double mean, double stdDev );
00084   
00085   void fireArray  ( const int size, double* vect);
00086   void fireArray  ( const int size, double* vect,
00087                     double mean, double stdDev );
00088 
00089   virtual double operator()();
00090   virtual double operator()( double mean, double stdDev );
00091 
00092 protected:
00093 
00094   static double transformQuick (double r);
00095   static double transformSmall (double r);
00096 
00097 private:
00098 
00099   // Private copy constructor. Defining it here disallows use.
00100   RandGaussQ(const RandGaussQ& d);
00101 
00102   // All the engine info, and the default mean and sigma, are in the RandGauss
00103   // base class.
00104 
00105 };
00106 
00107 #include "CLHEP/Random/RandGaussQ.icc"
00108 
00109 #endif

Class Library for High Energy Physics (version 1.8)