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

RandExponential.h

Go to the documentation of this file.
00001 // $Id: RandExponential.h,v 1.3.4.1 2005/03/18 22:26:48 garren 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 // M Fischler      - put and get to/from streams 12/10/04
00021 // =======================================================================
00022 
00023 #ifndef RandExponential_h
00024 #define RandExponential_h 1
00025 
00026 #include "CLHEP/Random/defs.h"
00027 #include "CLHEP/Random/Random.h"
00028 
00029 namespace CLHEP {
00030 
00035 class RandExponential : public HepRandom {
00036 
00037 public:
00038 
00039   inline RandExponential ( HepRandomEngine& anEngine, double mean=1.0 );
00040   inline RandExponential ( HepRandomEngine* anEngine, double mean=1.0 );
00041   // These constructors should be used to instantiate a RandExponential
00042   // distribution object defining a local engine for it.
00043   // The static generator will be skipped using the non-static methods
00044   // defined below.
00045   // If the engine is passed by pointer the corresponding engine object
00046   // will be deleted by the RandExponential destructor.
00047   // If the engine is passed by reference the corresponding engine object
00048   // will not be deleted by the RandExponential destructor.
00049 
00050   virtual ~RandExponential();
00051   // Destructor
00052 
00053   // Static methods to shoot random values using the static generator
00054 
00055   static  double shoot();
00056 
00057   static  double shoot( double mean );
00058 
00059   static  void shootArray ( const int size, double* vect,
00060                             double mean=1.0 );
00061 
00062   //  Static methods to shoot random values using a given engine
00063   //  by-passing the static generator.
00064 
00065   static  inline double shoot( HepRandomEngine* anEngine );
00066 
00067   static  inline double shoot( HepRandomEngine* anEngine, double mean );
00068 
00069   static  void shootArray ( HepRandomEngine* anEngine, const int size,
00070                             double* vect, double mean=1.0 );
00071 
00072   //  Methods using the localEngine to shoot random values, by-passing
00073   //  the static generator.
00074 
00075   inline double fire();
00076 
00077   inline double fire( double mean );
00078 
00079   void fireArray ( const int size, double* vect );
00080   void fireArray ( const int size, double* vect, double mean );
00081   
00082   double operator()();
00083   double operator()( double mean );
00084 
00085   // Save and restore to/from streams
00086   
00087   std::ostream & put ( std::ostream & os ) const;
00088   std::istream & get ( std::istream & is );
00089 
00090   std::string name() const;
00091   HepRandomEngine & engine();
00092 
00093   static std::string distributionName() {return "RandExponential";}  
00094   // Provides the name of this distribution class
00095   
00096 private:
00097 
00098   // Private copy constructor. Defining it here disallows use.
00099   RandExponential(const RandExponential& d);
00100 
00101 
00102   HepRandomEngine* localEngine;
00103   bool deleteEngine;
00104   double defaultMean;
00105 
00106 };
00107 
00108 }  // namespace CLHEP
00109 
00110 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
00111 //  backwards compatibility will be enabled ONLY in CLHEP 1.9
00112 using namespace CLHEP;
00113 #endif
00114 
00115 #include "CLHEP/Random/RandExponential.icc"
00116 
00117 #endif

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