Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:43

0001 #ifndef RandomEngine_RandomEngineState_h
0002 #define RandomEngine_RandomEngineState_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     RandomEngine
0006 // Class  :     RandomEngineState
0007 //
0008 /**\class RandomEngineState RandomEngineState.h SimDataFormats/RandomEngine/interface/RandomEngineState.h
0009 
0010  Description: Holds the state of a CLHEP random number engine
0011 and the label of the module it is associated with.
0012 
0013  Usage:  This should only be used by the Random Number Generator
0014 service.
0015 
0016 */
0017 //
0018 // Original Author:  W. David Dagenhart, Fermilab
0019 //         Created:  Tue Oct  3 09:56:36 CDT 2006
0020 //
0021 
0022 #include <vector>
0023 #include <string>
0024 #include <cstdint>
0025 
0026 class RandomEngineState {
0027 public:
0028   RandomEngineState();
0029 
0030   ~RandomEngineState();
0031 
0032   const std::string& getLabel() const { return label_; }
0033   const std::vector<uint32_t>& getState() const { return state_; }
0034   const std::vector<uint32_t>& getSeed() const { return seed_; }
0035 
0036   void setLabel(const std::string& value) { label_ = value; }
0037   void setState(const std::vector<uint32_t>& value) { state_ = value; }
0038   void setSeed(const std::vector<uint32_t>& value) { seed_ = value; }
0039 
0040   void clearSeedVector() { seed_.clear(); }
0041   void reserveSeedVector(std::vector<uint32_t>::size_type n) { seed_.reserve(n); }
0042   void push_back_seedVector(uint32_t v) { seed_.push_back(v); }
0043 
0044   void clearStateVector() { state_.clear(); }
0045   void reserveStateVector(std::vector<uint32_t>::size_type n) { state_.reserve(n); }
0046   void push_back_stateVector(uint32_t v) { state_.push_back(v); }
0047 
0048   bool operator<(RandomEngineState const& rhs) const { return label_ < rhs.label_; }
0049 
0050 private:
0051   std::string label_;
0052   std::vector<uint32_t> state_;
0053   std::vector<uint32_t> seed_;
0054 };
0055 
0056 #endif