00001 #ifndef FWCore_Utilities_RandomNumberGenerator_h 00002 #define FWCore_Utilities_RandomNumberGenerator_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Utilities 00006 // Class : RandomNumberGenerator 00007 // 00040 // 00041 // Original Author: Chris Jones, W. David Dagenhart 00042 // Created: Tue Mar 7 09:30:28 EST 2006 00043 // 00044 00045 #include <vector> 00046 #include <string> 00047 00048 namespace CLHEP { 00049 class HepRandomEngine; 00050 } 00051 00052 namespace edm { 00053 00054 class Event; 00055 00056 class RandomNumberGenerator 00057 { 00058 00059 public: 00060 00061 RandomNumberGenerator() {} 00062 virtual ~RandomNumberGenerator(); 00063 00064 virtual CLHEP::HepRandomEngine& getEngine() const = 0; 00065 00066 virtual uint32_t mySeed() const = 0; 00067 00068 // The following functions should not be used by general users. They 00069 // should only be called by code designed to work with the service while 00070 // it is saving the engine state to an event or restoring it from an event. 00071 // The first 3 are called by a dedicated producer module (RandomEngineStateProducer). 00072 // The other two by the InputSource base class. 00073 00074 virtual const std::vector<std::string>& getCachedLabels() const = 0; 00075 virtual const std::vector<std::vector<uint32_t> >& getCachedStates() const = 0; 00076 virtual const std::vector<std::vector<uint32_t> >& getCachedSeeds() const = 0; 00077 00078 virtual void snapShot() = 0; 00079 virtual void restoreState(const Event& event) = 0; 00080 00081 // For debugging purposes only 00082 virtual void print() = 0; 00083 virtual void saveEngineState(const std::string& fileName) = 0; 00084 virtual void restoreEngineState(const std::string& fileName) = 0; 00085 00086 private: 00087 00088 RandomNumberGenerator(const RandomNumberGenerator&); // stop default 00089 const RandomNumberGenerator& operator=(const RandomNumberGenerator&); // stop default 00090 }; 00091 } 00092 #endif