CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PileupRandomNumberGenerator.h
Go to the documentation of this file.
1 #ifndef Mixing_Base_PileupRandomNumberGenerator_h
2 #define Mixing_Base_PileupRandomNumberGenerator_h
3 // -*- C++ -*-
4 //
5 // Package: Mixing/Base
6 // Class : PileupRandomNumberGenerator
7 //
16 //
17 // Original Author: Christopher Jones
18 // Created: Wed, 09 Nov 2022 17:53:22 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 #include <unordered_map>
24 
25 // user include files
29 
30 // forward declarations
31 
33 public:
34  PileupRandomNumberGenerator(std::vector<std::string> const& iModuleLabels);
35 
36  void setSeed(uint32_t iSeed);
37  void setEngine(CLHEP::HepRandomEngine const&);
38 
39  CLHEP::HepRandomEngine& getEngine(edm::StreamID const&) final;
40 
41  CLHEP::HepRandomEngine& getEngine(edm::LuminosityBlockIndex const&) final;
42 
43  std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(edm::LuminosityBlockIndex const&) final;
44 
45  std::uint32_t mySeed() const final { return m_seed; }
46 
47 private:
48  void preBeginLumi(edm::LuminosityBlock const& lumi) final;
49  void postEventRead(edm::Event const& event) final;
50 
51  void setLumiCache(edm::LuminosityBlockIndex, std::vector<RandomEngineState> const& iStates) final;
52  void setEventCache(edm::StreamID, std::vector<RandomEngineState> const& iStates) final;
53 
54  std::vector<RandomEngineState> const& getEventCache(edm::StreamID const&) const final;
55  std::vector<RandomEngineState> const& getLumiCache(edm::LuminosityBlockIndex const&) const final;
56 
57  void consumes(edm::ConsumesCollector&& iC) const final;
58 
60  void print(std::ostream& os) const final;
61 
62  static std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(CLHEP::HepRandomEngine const& existingEngine);
63 
64  const std::string& findPresentModule() const;
65 
66  std::unordered_map<std::string, std::unique_ptr<CLHEP::HepRandomEngine>> m_modulesToEngines;
67  uint32_t m_seed;
68 };
69 
70 #endif
CLHEP::HepRandomEngine & getEngine(edm::StreamID const &) final
Use this engine in event methods.
std::unique_ptr< CLHEP::HepRandomEngine > cloneEngine(edm::LuminosityBlockIndex const &) final
void setEventCache(edm::StreamID, std::vector< RandomEngineState > const &iStates) final
void consumes(edm::ConsumesCollector &&iC) const final
void print(std::ostream &os) const final
For debugging purposes only.
void setEngine(CLHEP::HepRandomEngine const &)
void setLumiCache(edm::LuminosityBlockIndex, std::vector< RandomEngineState > const &iStates) final
std::vector< RandomEngineState > const & getEventCache(edm::StreamID const &) const final
std::unordered_map< std::string, std::unique_ptr< CLHEP::HepRandomEngine > > m_modulesToEngines
std::uint32_t mySeed() const final
void preBeginLumi(edm::LuminosityBlock const &lumi) final
const std::string & findPresentModule() const
std::vector< RandomEngineState > const & getLumiCache(edm::LuminosityBlockIndex const &) const final
PileupRandomNumberGenerator(std::vector< std::string > const &iModuleLabels)
void postEventRead(edm::Event const &event) final
Definition: event.py:1