CMS 3D CMS Logo

ExternalRandomNumberGeneratorService.h
Go to the documentation of this file.
1 #ifndef FWCore_Services_ExternalRandomNumberGeneratorService_h
2 #define FWCore_Services_ExternalRandomNumberGeneratorService_h
3 
11 #include <cstdint>
12 #include <iosfwd>
13 #include <memory>
14 #include <vector>
15 
17 
18 namespace edm {
19 
21  public:
25 
26  void setState(std::vector<unsigned long> const&, long seed);
27  std::vector<unsigned long> getState() const;
28 
29  CLHEP::HepRandomEngine& getEngine(StreamID const&) final;
30  CLHEP::HepRandomEngine& getEngine(LuminosityBlockIndex const&) final;
31  std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(LuminosityBlockIndex const&) final;
32  std::uint32_t mySeed() const final;
33 
34  // The following functions should not be used by general users. They
35  // should only be called by Framework code designed to work with the
36  // service while it is saving the engine states or restoring them.
37  // The first two are called by the EventProcessor at special times.
38  // The next two are called by a dedicated producer module (RandomEngineStateProducer).
39 
40  void preBeginLumi(LuminosityBlock const& lumi) final;
41  void postEventRead(Event const& event) final;
42 
43  void setLumiCache(LuminosityBlockIndex, std::vector<RandomEngineState> const& iStates) final;
44  void setEventCache(StreamID, std::vector<RandomEngineState> const& iStates) final;
45 
46  std::vector<RandomEngineState> const& getEventCache(StreamID const&) const final;
47  std::vector<RandomEngineState> const& getLumiCache(LuminosityBlockIndex const&) const final;
48 
49  void consumes(ConsumesCollector&& iC) const final;
50 
52  void print(std::ostream& os) const final;
53 
54  private:
55  std::unique_ptr<CLHEP::HepRandomEngine> createFromState(std::vector<unsigned long> const&, long seed) const;
56 
57  std::unique_ptr<CLHEP::HepRandomEngine> engine_;
58  };
59 } // namespace edm
60 #endif
std::unique_ptr< CLHEP::HepRandomEngine > engine_
ExternalRandomNumberGeneratorService const & operator=(ExternalRandomNumberGeneratorService const &)=delete
void print(std::ostream &os) const final
For debugging purposes only.
std::vector< RandomEngineState > const & getLumiCache(LuminosityBlockIndex const &) const final
std::unique_ptr< CLHEP::HepRandomEngine > cloneEngine(LuminosityBlockIndex const &) final
void setState(std::vector< unsigned long > const &, long seed)
void setLumiCache(LuminosityBlockIndex, std::vector< RandomEngineState > const &iStates) final
CLHEP::HepRandomEngine & getEngine(StreamID const &) final
Use this engine in event methods.
std::vector< RandomEngineState > const & getEventCache(StreamID const &) const final
HLT enums.
std::unique_ptr< CLHEP::HepRandomEngine > createFromState(std::vector< unsigned long > const &, long seed) const
void setEventCache(StreamID, std::vector< RandomEngineState > const &iStates) final
Definition: event.py:1