00001 // -*- C++ -*- 00002 // 00003 // StandardRandom.h is a part of ThePEG - Toolkit for HEP Event Generation 00004 // Copyright (C) 1999-2007 Leif Lonnblad 00005 // 00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details. 00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 00008 // 00009 #ifndef ThePEG_StandardRandom_H 00010 #define ThePEG_StandardRandom_H 00011 // This is the declaration of the StandardRandom class. 00012 00013 #include "RandomGenerator.h" 00014 #include "ThePEG/Persistency/PersistentOStream.h" 00015 #include "ThePEG/Persistency/PersistentIStream.h" 00016 00017 namespace ThePEG { 00018 00026 class StandardRandom: public RandomGenerator { 00027 00028 public: 00029 00035 StandardRandom() : u(97) { if ( theSeed != 0 ) setSeed(theSeed); } 00037 00038 public: 00039 00044 virtual void setSeed(long seed); 00045 00046 protected: 00047 00051 virtual void fill(); 00052 00053 public: 00054 00055 00062 void persistentOutput(PersistentOStream & os) const; 00063 00069 void persistentInput(PersistentIStream & is, int version); 00071 00075 static void Init(); 00076 00077 protected: 00078 00085 virtual IBPtr clone() const; 00086 00091 virtual IBPtr fullclone() const; 00093 00094 private: 00095 00099 vector<double> u; 00100 00104 double c; 00105 00109 double cd; 00110 00114 double cm; 00115 00119 int i97; 00120 00124 int j97; 00125 00126 private: 00127 00131 static ClassDescription<StandardRandom> initStandardRandom; 00132 00136 StandardRandom & operator=(const StandardRandom &); 00137 00138 }; 00139 00144 template <> 00145 struct BaseClassTrait<StandardRandom,1>: public ClassTraitsType { 00147 typedef RandomGenerator NthBase; 00148 }; 00149 00152 template <> 00153 struct ClassTraits<StandardRandom>: public ClassTraitsBase<StandardRandom> { 00155 static string className() { return "ThePEG::StandardRandom"; } 00156 }; 00157 00160 } 00161 00162 #endif /* ThePEG_StandardRandom_H */