00001 /*************************************************************************** 00002 * 00003 * $Id: JamesRandom.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 * JamesRandom.h,v 1.6 1997/07/12 21:05:56 00011 * ----------------------------------------------------------------------- 00012 * HEP Random 00013 * --- HepJamesRandom --- 00014 * class header file 00015 * ----------------------------------------------------------------------- 00016 * This file is part of Geant4 (simulation toolkit for HEP). 00017 * 00018 * HepJamesRandom implements the algorithm by Marsaglia-Zaman RANMAR 00019 * described in "F.James, Comp. Phys. Comm. 60 (1990) 329" and implemented 00020 * in FORTRAN77 as part of the MATHLIB HEP library for pseudo-random 00021 * numbers generation. 00022 * This is the default random engine invoked by each distribution unless 00023 * the user sets a different one. 00024 * 00025 *************************************************************************** 00026 * 00027 * $Log: JamesRandom.h,v $ 00028 * Revision 1.1 1999/01/30 03:58:59 fisyak 00029 * Root Version of StarClassLibrary 00030 * 00031 * Revision 1.1 1999/01/23 00:27:33 ullrich 00032 * Initial Revision 00033 * 00034 **************************************************************************/ 00035 #ifndef HepJamesRandom_h 00036 #define HepJamesRandom_h 1 00037 00038 #include "RandomEngine.h" 00039 00040 class HepJamesRandom: public HepRandomEngine { 00041 00042 public: 00043 00044 HepJamesRandom(long seed = 19780503); 00045 ~HepJamesRandom(); 00046 // Constructor and destructor. 00047 00048 HepJamesRandom(const HepJamesRandom &p); 00049 // Copy constructor 00050 00051 HepJamesRandom & operator = (const HepJamesRandom &p); 00052 // Overloaded assignment operator, to retrieve the engine status. 00053 00054 HepDouble flat(); 00055 // Returns a pseudo random number between 0 and 1 00056 // (excluding the end points) 00057 00058 void flatArray (const HepInt size, HepDouble* vect); 00059 #ifndef ST_NO_TEMPLATE_DEF_ARGS 00060 void flatArray (vector<HepDouble>&); 00061 #else 00062 void flatArray (vector<HepDouble, allocator<HepDouble> >&); 00063 #endif 00064 // Fills the array "vect" of specified size with flat random values. 00065 00066 void setSeed(long seed, HepInt dum=0); 00067 // Sets the state of the algorithm according to seed. 00068 00069 void setSeeds(const long * seeds, HepInt dum=0); 00070 // Sets the state of the algorithm according to the zero terminated 00071 // array of seeds. Only the first seed is used. 00072 00073 void saveStatus() const; 00074 // Saves on file JamesRand.conf the current engine status. 00075 00076 void restoreStatus(); 00077 // Reads from file JamesRand.conf the last saved engine status 00078 // and restores it. 00079 00080 void showStatus() const; 00081 // Dumps the engine status on the screen. 00082 00083 private: 00084 00085 // Members defining the current status of the generator. 00086 HepDouble u[97]; 00087 HepDouble c, cd, cm; 00088 HepDouble *pi97, *pj97; 00089 00090 }; 00091 00092 #endif
1.5.9