CLHEP/Random/RandExponential.h

00001 // $Id: RandExponential.h,v 1.12 2002/04/12 15:02:44 evc Exp $
00002 // -*- C++ -*-
00003 //
00004 // -----------------------------------------------------------------------
00005 //                             HEP Random
00006 //                        --- RandExponential ---
00007 //                          class header file
00008 // -----------------------------------------------------------------------
00009 // This file is part of Geant4 (simulation toolkit for HEP).
00010 //
00011 // Class defining methods for shooting exponential distributed random
00012 // values, given a mean (default mean = 1).
00013 // Default mean is used for operator()().
00014 
00015 // =======================================================================
00016 // Gabriele Cosmo - Created: 5th September 1995
00017 //                - Added methods to shoot arrays: 28th July 1997
00018 // J.Marraffino   - Added default mean as attribute and
00019 //                  operator() with mean: 16th Feb 1998
00020 // =======================================================================
00021 
00022 #ifndef RandExponential_h
00023 #define RandExponential_h 1
00024 
00025 #include "CLHEP/Random/Random.h"
00026 
00031 class RandExponential : public HepRandom {
00032 
00033 public:
00034 
00035   inline RandExponential ( HepRandomEngine& anEngine, double mean=1.0 );
00036   inline RandExponential ( HepRandomEngine* anEngine, double mean=1.0 );
00037   // These constructors should be used to instantiate a RandExponential
00038   // distribution object defining a local engine for it.
00039   // The static generator will be skipped using the non-static methods
00040   // defined below.
00041   // If the engine is passed by pointer the corresponding engine object
00042   // will be deleted by the RandExponential destructor.
00043   // If the engine is passed by reference the corresponding engine object
00044   // will not be deleted by the RandExponential destructor.
00045 
00046   virtual ~RandExponential();
00047   // Destructor
00048 
00049   // Static methods to shoot random values using the static generator
00050 
00051   static  double shoot();
00052 
00053   static  double shoot( double mean );
00054 
00055   static  void shootArray ( const int size, double* vect,
00056                             double mean=1.0 );
00057 
00058   //  Static methods to shoot random values using a given engine
00059   //  by-passing the static generator.
00060 
00061   static  inline double shoot( HepRandomEngine* anEngine );
00062 
00063   static  inline double shoot( HepRandomEngine* anEngine, double mean );
00064 
00065   static  void shootArray ( HepRandomEngine* anEngine, const int size,
00066                             double* vect, double mean=1.0 );
00067 
00068   //  Methods using the localEngine to shoot random values, by-passing
00069   //  the static generator.
00070 
00071   inline double fire();
00072 
00073   inline double fire( double mean );
00074 
00075   void fireArray ( const int size, double* vect );
00076   void fireArray ( const int size, double* vect, double mean );
00077   
00078   double operator()();
00079   double operator()( double mean );
00080   
00081 private:
00082 
00083   // Private copy constructor. Defining it here disallows use.
00084   RandExponential(const RandExponential& d);
00085 
00086 
00087   HepRandomEngine* localEngine;
00088   bool deleteEngine;
00089   const double defaultMean;
00090 
00091 };
00092 
00093 #include "CLHEP/Random/RandExponential.icc"
00094 
00095 #endif

Class Library for High Energy Physics (version 1.8)