00001 /*************************************************************************** 00002 * 00003 * $Id: RandEngine.h,v 1.1 1999/01/30 03:58:59 fisyak Exp $ 00004 * 00005 * Author: Gabriele Cosmo - Created: 5th September 1995 00006 * modified for SCL bl 00007 *************************************************************************** 00008 * 00009 * Description: 00010 * RandEngine.h,v 1.3 1997/07/12 21:05:57 00011 * 00012 * ----------------------------------------------------------------------- 00013 * HEP Random 00014 * --- RandEngine --- 00015 * class header file 00016 * ----------------------------------------------------------------------- 00017 * This file is part of Geant4 (simulation toolkit for HEP). 00018 * 00019 * Random engine using rand() and srand() functions from C standard 00020 * library to implement the flat() basic distribution and for setting 00021 * seeds. 00022 * 00023 *************************************************************************** 00024 * 00025 * $Log: RandEngine.h,v $ 00026 * Revision 1.1 1999/01/30 03:58:59 fisyak 00027 * Root Version of StarClassLibrary 00028 * 00029 * Revision 1.1 1999/01/23 00:27:36 ullrich 00030 * Initial Revision 00031 * 00032 **************************************************************************/ 00033 #ifndef RandEngine_h 00034 #define RandEngine_h 1 00035 00036 #include "RandomEngine.h" 00037 00038 class RandEngine : public HepRandomEngine { 00039 00040 public: 00041 00042 RandEngine(long seed = 19780503); 00043 ~RandEngine(); 00044 // Constructor and destructor 00045 00046 RandEngine(const RandEngine &p); 00047 // Copy constructor 00048 00049 RandEngine & operator = (const RandEngine &p); 00050 // Overloaded assignment operator, to retrieve the engine status. 00051 00052 HepDouble flat(); 00053 // It returns a pseudo random number between 0 and 1, 00054 // according to the standard stdlib random function rand() 00055 // but excluding the end points. 00056 00057 void flatArray (const HepInt size, HepDouble* vect); 00058 #ifndef ST_NO_TEMPLATE_DEF_ARGS 00059 void flatArray (vector<HepDouble>&); 00060 #else 00061 void flatArray (vector<HepDouble, allocator<HepDouble> >&); 00062 #endif 00063 // Fills the array "vect" of specified size with flat random values. 00064 00065 void setSeed(long seed, HepInt dum=0); 00066 // Sets the state of the algorithm according to seed. 00067 00068 void setSeeds(const long * seeds, HepInt dum=0); 00069 // Sets the state of the algorithm according to the zero terminated 00070 // array of seeds. Only the first seed is used. 00071 00072 void saveStatus() const; 00073 // Saves on file Rand.conf the current engine status. 00074 00075 void restoreStatus(); 00076 // Reads from file Rand.conf the last saved engine status 00077 // and restores it. 00078 00079 void showStatus() const; 00080 // Dumps the engine status on the screen. 00081 00082 private: 00083 00084 const HepDouble mx; 00085 long seq; 00086 00087 }; 00088 00089 #endif
1.5.9