|
|
|||
File indexing completed on 2026-08-06 09:38:31
0001 // -*- C++ -*- 0002 // 0003 // StandardRandom.h is a part of ThePEG - Toolkit for HEP Event Generation 0004 // Copyright (C) 1999-2019 Leif Lonnblad 0005 // 0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details. 0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 0008 // 0009 #ifndef ThePEG_StandardRandom_H 0010 #define ThePEG_StandardRandom_H 0011 // This is the declaration of the StandardRandom class. 0012 0013 #include "RandomGenerator.h" 0014 #include "ThePEG/Persistency/PersistentOStream.h" 0015 #include "ThePEG/Persistency/PersistentIStream.h" 0016 0017 namespace ThePEG { 0018 0019 /** 0020 * StandardRandom inherits from the RandomGenerator class and is an 0021 * interface to the CLHEP::JamesRandom engine class. 0022 * 0023 * @see \ref StandardRandomInterfaces "The interfaces" 0024 * defined for StandardRandom. 0025 */ 0026 class StandardRandom: public RandomGenerator { 0027 0028 public: 0029 0030 /** @name Standard constructors and destructors. */ 0031 //@{ 0032 /** 0033 * Default constructor. 0034 */ 0035 StandardRandom() : u() { if ( theSeed != 0 ) setSeed(theSeed); } 0036 //@} 0037 0038 public: 0039 0040 /** 0041 * Reset the underlying random algorithm with the given seed. If the 0042 * \a seed is set to -1 a standard seed will be used. 0043 */ 0044 virtual void setSeed(long seed); 0045 0046 protected: 0047 0048 /** 0049 * Fill the cache with random numbers. 0050 */ 0051 virtual void fill(); 0052 0053 public: 0054 0055 0056 /** @name Functions used by the persistent I/O system. */ 0057 //@{ 0058 /** 0059 * Function used to write out object persistently. 0060 * @param os the persistent output stream written to. 0061 */ 0062 void persistentOutput(PersistentOStream & os) const; 0063 0064 /** 0065 * Function used to read in object persistently. 0066 * @param is the persistent input stream read from. 0067 * @param version the version number of the object when written. 0068 */ 0069 void persistentInput(PersistentIStream & is, int version); 0070 //@} 0071 0072 /** 0073 * Standard Init function used to initialize the interface. 0074 */ 0075 static void Init(); 0076 0077 protected: 0078 0079 /** @name Clone Methods. */ 0080 //@{ 0081 /** 0082 * Make a simple clone of this object. 0083 * @return a pointer to the new object. 0084 */ 0085 virtual IBPtr clone() const; 0086 0087 /** Make a clone of this object, possibly modifying the cloned object 0088 * to make it sane. 0089 * @return a pointer to the new object. 0090 */ 0091 virtual IBPtr fullclone() const; 0092 //@} 0093 0094 private: 0095 0096 /** 0097 * The internal state vector. 0098 */ 0099 array<double,97> u; 0100 0101 /** 0102 * Parameter for the internal state. 0103 */ 0104 double c; 0105 0106 /** 0107 * Parameter for the internal state. 0108 */ 0109 double cd; 0110 0111 /** 0112 * Parameter for the internal state. 0113 */ 0114 double cm; 0115 0116 /** 0117 * Index for the internal state. 0118 */ 0119 int i97; 0120 0121 /** 0122 * Index for the internal state. 0123 */ 0124 int j97; 0125 0126 private: 0127 0128 /** 0129 * Describe a concrete class with persistent data. 0130 */ 0131 static ClassDescription<StandardRandom> initStandardRandom; 0132 0133 /** 0134 * Private and non-existent assignment operator. 0135 */ 0136 StandardRandom & operator=(const StandardRandom &) = delete; 0137 0138 }; 0139 0140 /** @cond TRAITSPECIALIZATIONS */ 0141 0142 /** This template specialization informs ThePEG about the base classes 0143 * of StandardRandom. */ 0144 template <> 0145 struct BaseClassTrait<StandardRandom,1>: public ClassTraitsType { 0146 /** Typedef of the first base class of StandardRandom. */ 0147 typedef RandomGenerator NthBase; 0148 }; 0149 0150 /** This template specialization informs ThePEG about the name of the 0151 * StandardRandom class. */ 0152 template <> 0153 struct ClassTraits<StandardRandom>: public ClassTraitsBase<StandardRandom> { 0154 /** Return a platform-independent class name */ 0155 static string className() { return "ThePEG::StandardRandom"; } 0156 }; 0157 0158 /** @endcond */ 0159 0160 } 0161 0162 #endif /* ThePEG_StandardRandom_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|