Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:38

0001 // $Id: RandGaussQ.h,v 1.5 2010/06/16 17:24:53 garren Exp $
0002 // -*- C++ -*-
0003 //
0004 // -----------------------------------------------------------------------
0005 //                             HEP Random
0006 //                          --- RandGaussQ ---
0007 //                          class header file
0008 // -----------------------------------------------------------------------
0009 
0010 // Class defining methods RandGaussQ, which is derived from RandGauss.
0011 // The user interface is identical; but RandGaussQ is faster and a bit less
0012 // accurate.
0013 
0014 // =======================================================================
0015 // M. Fischler - Created: 24th Jan 2000
0016 // M Fischler      - put and get to/from streams 12/10/04
0017 //
0018 // =======================================================================
0019 
0020 #ifndef RandGaussQ_h
0021 #define RandGaussQ_h 1
0022 
0023 #include "CLHEP/Random/defs.h"
0024 #include "CLHEP/Random/RandGauss.h"
0025 
0026 namespace CLHEP {
0027 
0028 /**
0029  * @author
0030  * @ingroup random
0031  */
0032 class RandGaussQ : public RandGauss {
0033 
0034 public:
0035 
0036   inline RandGaussQ ( HepRandomEngine& anEngine, double mean=0.0,
0037                                                 double stdDev=1.0 );
0038   inline RandGaussQ ( HepRandomEngine* anEngine, double mean=0.0,
0039                                                 double stdDev=1.0 );
0040   // These constructors should be used to instantiate a RandGaussQ
0041   // distribution object defining a local engine for it.
0042   // The static generator will be skipped using the non-static methods
0043   // defined below.
0044   // If the engine is passed by pointer the corresponding engine object
0045   // will be deleted by the RandGaussQ destructor.
0046   // If the engine is passed by reference the corresponding engine object
0047   // will not be deleted by the RandGaussQ destructor.
0048 
0049   // Destructor
0050   virtual ~RandGaussQ();
0051 
0052   //
0053   // Methods to generate Gaussian-distributed random deviates:
0054   //
0055   //   If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec while 
0056   //   RandGaussQ::fire() adds only .4 usec.
0057   //
0058 
0059   // Static methods to shoot random values using the static generator
0060 
0061   static  inline double shoot();
0062 
0063   static  inline double shoot( double mean, double stdDev );
0064 
0065   static  void shootArray ( const int size, double* vect,
0066                             double mean=0.0, double stdDev=1.0 );
0067 
0068   //  Static methods to shoot random values using a given engine
0069   //  by-passing the static generator.
0070 
0071   static  inline double shoot( HepRandomEngine* anotherEngine );
0072 
0073   static  inline double shoot( HepRandomEngine* anotherEngine, 
0074                                   double mean, double stdDev );
0075 
0076 
0077   static  void shootArray ( HepRandomEngine* anotherEngine, 
0078                 const int size,
0079                             double* vect, double mean=0.0,
0080                             double stdDev=1.0 );
0081 
0082   //  Instance methods using the localEngine to instead of the static 
0083   //  generator, and the default mean and stdDev established at construction
0084 
0085   inline double fire();
0086 
0087   inline double fire ( double mean, double stdDev );
0088   
0089   void fireArray  ( const int size, double* vect);
0090   void fireArray  ( const int size, double* vect,
0091                     double mean, double stdDev );
0092 
0093   virtual double operator()();
0094   virtual double operator()( double mean, double stdDev );
0095 
0096   // Save and restore to/from streams
0097   
0098   std::ostream & put ( std::ostream & os ) const;
0099   std::istream & get ( std::istream & is );
0100 
0101   std::string name() const;
0102   HepRandomEngine & engine();
0103 
0104   static std::string distributionName() {return "RandGaussQ";}  
0105   // Provides the name of this distribution class
0106   
0107 
0108 protected:
0109 
0110   static double transformQuick (double r);
0111   static double transformSmall (double r);
0112 
0113 private:
0114 
0115   // All the engine info, and the default mean and sigma, are in the RandGauss
0116   // base class.
0117 
0118 };
0119 
0120 }  // namespace CLHEP
0121 
0122 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0123 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
0124 using namespace CLHEP;
0125 #endif
0126 
0127 #include "CLHEP/Random/RandGaussQ.icc"
0128 
0129 #endif