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:
23 
24  void setState(std::vector<unsigned long> const&, long seed);
25  std::vector<unsigned long> getState() const;
26 
27  CLHEP::HepRandomEngine& getEngine(StreamID const&) final;
28  CLHEP::HepRandomEngine& getEngine(LuminosityBlockIndex const&) final;
29  std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(LuminosityBlockIndex const&) final;
30  std::uint32_t mySeed() const final;
31 
32  // The following functions should not be used by general users. They
33  // should only be called by Framework code designed to work with the
34  // service while it is saving the engine states or restoring them.
35  // The first two are called by the EventProcessor at special times.
36  // The next two are called by a dedicated producer module (RandomEngineStateProducer).
37 
38  void preBeginLumi(LuminosityBlock const& lumi) final;
39  void postEventRead(Event const& event) final;
40 
41  void setLumiCache(LuminosityBlockIndex, std::vector<RandomEngineState> const& iStates) final;
42  void setEventCache(StreamID, std::vector<RandomEngineState> const& iStates) final;
43 
44  std::vector<RandomEngineState> const& getEventCache(StreamID const&) const final;
45  std::vector<RandomEngineState> const& getLumiCache(LuminosityBlockIndex const&) const final;
46 
47  void consumes(ConsumesCollector&& iC) const final;
48 
50  void print(std::ostream& os) const final;
51 
52  private:
55 
56  std::unique_ptr<CLHEP::HepRandomEngine> createFromState(std::vector<unsigned long> const&, long seed) const;
57 
58  std::unique_ptr<CLHEP::HepRandomEngine> engine_;
59  };
60 } // namespace edm
61 #endif
std::unique_ptr< CLHEP::HepRandomEngine > engine_
ExternalRandomNumberGeneratorService const & operator=(ExternalRandomNumberGeneratorService const &)=delete
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 & getLumiCache(LuminosityBlockIndex const &) const final
void print(std::ostream &os) const final
For debugging purposes only.
std::unique_ptr< CLHEP::HepRandomEngine > createFromState(std::vector< unsigned long > const &, long seed) const
HLT enums.
std::vector< RandomEngineState > const & getEventCache(StreamID const &) const final
void setEventCache(StreamID, std::vector< RandomEngineState > const &iStates) final
Definition: event.py:1