1 #ifndef art_Framework_Services_Optional_RandomNumberGenerator_h 2 #define art_Framework_Services_Optional_RandomNumberGenerator_h 129 #include "CLHEP/Random/RandomEngine.h" 145 class HepRandomEngine;
150 class ActivityRegistry;
152 class ScheduleContext;
168 static long constexpr maxCLHEPSeed{900000000};
169 static long constexpr useDefaultSeed{-1};
174 template <
typename T>
179 Name{
"defaultEngineKind"},
181 "The 'defaultEngineKind' parameter can be any of the following:\n\n" 186 " 'HepJamesRandom' (art default)\n" 187 " 'MixMaxRng' (CLHEP default)\n" 190 " 'Ranlux64Engine'\n" 196 Name{
"restoreStateLabel"},
198 "The 'restoreStateLabel' parameter specifies the input tag used\n" 199 "to restore the random number engine states, as stored in the\n" 200 "data product produced by the RandomNumberSaver module.\n"},
205 "The 'saveTo' and 'restoreFrom' parameters are filenames\n" 206 "that indicate where the engine states should be saved-to or\n" 207 "restored-from, respectively. Engine states are saved at the\n" 208 "end of an art job. This allows a user to (e.g.) send a Ctrl+C\n" 209 "signal during debugging, which will then save the engine states\n" 210 "to the specified file during a graceful shutdown. The user can\n" 211 "then restore the engine states from the file and rerun the job,\n" 212 "skipping to the appropriate event, but with the correct random\n" 218 Comment{
"Enable printout of random engine states for debugging."},
223 "Limit the number of printouts to the specified value.\n" 224 "This parameter can be specified only if 'debug' above is true."},
225 [
this] {
return debug(); },
241 return defaultEngineKind_;
248 CLHEP::HepRandomEngine& createEngine(
255 void validate_(
std::string const& user_specified_engine_kind,
256 long user_specified_seed) noexcept(
false);
261 std::vector<RNGsnapshot>
const& accessSnapshot_(
ScheduleID)
const;
266 void restoreFromFile_();
279 mutable std::recursive_mutex mutex_{};
297 bool engine_creation_is_okay_{
true};
303 std::map<std::string, std::shared_ptr<CLHEP::HepRandomEngine>> dict_{};
312 std::map<std::string, EngineSource> tracker_{};
316 std::map<std::string, std::string> kind_{};
319 std::vector<RNGsnapshot> snapshot_{};
std::string const restoreFromFilename_
ChannelGroupService::Name Name
PerScheduleContainer< ScheduleData > data_
std::string const & defaultEngineKind() const noexcept
#define DECLARE_ART_SERVICE(svc, scope)
std::string const saveToFilename_
CLHEP::HepRandomEngine base_engine_t
std::string const defaultEngineKind_
std::string const restoreStateLabel_