EngineCreator.h
Go to the documentation of this file.
1 
2 #ifndef art_Framework_Core_detail_EngineCreator_h
3 #define art_Framework_Core_detail_EngineCreator_h
4 
5 // ======================================================================
6 // EngineCreator - enable a derived class to access the
7 // RandomNumberGenerator::createEngine()
8 //
9 // MT-TODO:
10 //
11 // Once we adopt multiple module types (legacy, one, per-schedule,
12 // and global), then the steps that are necessary for creating
13 // engines will depend on the given module type. If a user
14 // specifies:
15 //
16 // createEngine(1237);
17 //
18 // then N instances of the specified engine should be created, one
19 // for each of N schedules, regardless of the module type.
20 //
21 // A decision must be made if each instance should receive the same
22 // seed, or different ones. I suspect they should be different so
23 // as to avoid undesirable over-sampling of fluctuations.
24 // ======================================================================
25 
29 
30 namespace art::detail {
31  class EngineCreator {
33 
34  public:
35  // --- CLHEP engine characteristics:
36  using base_engine_t = CLHEP::HepRandomEngine;
38  using seed_t = long;
40 
41  explicit EngineCreator(std::string const& label, ScheduleID sid);
42 
45  std::string const& kind_of_engine_to_make);
47  std::string const& kind_of_engine_to_make,
48  label_t const& engine_label);
49 
50  private:
52  void requireValid(); // Can remove once default c'tor is gone.
54  ScheduleID const sid_{};
55  }; // EngineCreator
56 }
57 
58 #endif /* art_Framework_Core_detail_EngineCreator_h */
59 
60 // Local Variables:
61 // mode: c++
62 // End:
EngineCreator(std::string const &label, ScheduleID sid)
base_engine_t & createEngine(seed_t seed)
std::string string
Definition: nybbler.cc:12
RNGsnapshot::label_t label_t
Definition: EngineCreator.h:37
std::vector< CLHEP_t > engine_state_t
Definition: RNGsnapshot.h:20
std::string const moduleLabel_
Definition: EngineCreator.h:53
CLHEP::HepRandomEngine base_engine_t
Definition: EngineCreator.h:36
std::string label_t
Definition: RNGsnapshot.h:25
RNGsnapshot::engine_state_t engine_state_t
Definition: EngineCreator.h:39
static ServiceHandle< RandomNumberGenerator > & rng()