LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::RandomNumberGenerator Class Reference

#include "RandomNumberGenerator.h"

Classes

struct  Config
 
struct  ScheduleData
 

Public Types

enum  init_t { VIA_SEED = 1, VIA_FILE, VIA_PRODUCT }
 
using base_engine_t = CLHEP::HepRandomEngine
 
using seed_t = long
 
using engine_state_t = RNGsnapshot::engine_state_t
 
using label_t = RNGsnapshot::label_t
 
using eptr_t = std::shared_ptr< base_engine_t >
 
using dict_t = std::map< label_t, eptr_t >
 
using tracker_t = std::map< label_t, init_t >
 
using kind_t = std::map< label_t, std::string >
 
using snapshot_t = std::vector< RNGsnapshot >
 
using Parameters = ServiceTable< Config >
 

Public Member Functions

 RandomNumberGenerator (Parameters const &, art::ActivityRegistry &)
 
base_engine_tgetEngine () const
 
base_engine_tgetEngine (label_t const &engine_label) const
 

Private Member Functions

 RandomNumberGenerator (RandomNumberGenerator const &)=delete
 
RandomNumberGeneratoroperator= (RandomNumberGenerator const &)=delete
 
base_engine_tcreateEngine (ScheduleID schedule_id, seed_t seed)
 
base_engine_tcreateEngine (ScheduleID schedule_id, seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (ScheduleID schedule_id, seed_t seed, std::string kind_of_engine_to_make, label_t const &engine_label)
 
base_engine_tgetEngine (ScheduleID schedule_id, label_t const &engine_label={}) const
 
void expandToNSchedules (std::size_t const n)
 
void takeSnapshot_ (ScheduleID scheduleID)
 
void restoreSnapshot_ (ScheduleID scheduleID, art::Event const &)
 
snapshot_t const & accessSnapshot_ (ScheduleID const schedule_id) const
 
void saveToFile_ ()
 
void restoreFromFile_ ()
 
void print_ () const
 
bool invariant_holds_ (ScheduleID::size_type scheduleID)
 
void preProcessEvent (art::Event const &)
 
void postProcessEvent (art::Event const &)
 
void postBeginJob ()
 
void postEndJob ()
 

Private Attributes

bool engine_creation_is_okay_ {true}
 
std::vector< ScheduleDatadata_
 
label_t const restoreStateLabel_
 
std::string const saveToFilename_
 
std::string const restoreFromFilename_
 
unsigned const nPrint_
 
bool const debug_
 

Friends

class EngineCreator
 
class EventProcessor
 
class RandomNumberSaver
 
class test::ConcurrentEngineRetrieval
 

Detailed Description

Definition at line 196 of file RandomNumberGenerator.h.

Member Typedef Documentation

using art::RandomNumberGenerator::base_engine_t = CLHEP::HepRandomEngine

Definition at line 208 of file RandomNumberGenerator.h.

Definition at line 216 of file RandomNumberGenerator.h.

Definition at line 215 of file RandomNumberGenerator.h.

using art::RandomNumberGenerator::kind_t = std::map<label_t, std::string>

Definition at line 218 of file RandomNumberGenerator.h.

Definition at line 209 of file RandomNumberGenerator.h.

Definition at line 219 of file RandomNumberGenerator.h.

Definition at line 217 of file RandomNumberGenerator.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

art::RandomNumberGenerator::RandomNumberGenerator ( RandomNumberGenerator const &  )
privatedelete
art::RandomNumberGenerator::RandomNumberGenerator ( Parameters const &  ,
art::ActivityRegistry  
)

Member Function Documentation

snapshot_t const& art::RandomNumberGenerator::accessSnapshot_ ( ScheduleID const  schedule_id) const
inlineprivate

Definition at line 269 of file RandomNumberGenerator.h.

References art::ScheduleID::id().

Referenced by art::RandomNumberSaver::produce().

270  {
271  return data_[schedule_id.id()].snapshot_;
272  }
std::vector< ScheduleData > data_
base_engine_t& art::RandomNumberGenerator::createEngine ( ScheduleID  schedule_id,
seed_t  seed 
)
private
base_engine_t& art::RandomNumberGenerator::createEngine ( ScheduleID  schedule_id,
seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
private
base_engine_t& art::RandomNumberGenerator::createEngine ( ScheduleID  schedule_id,
seed_t  seed,
std::string  kind_of_engine_to_make,
label_t const &  engine_label 
)
private
void art::RandomNumberGenerator::expandToNSchedules ( std::size_t const  n)
inlineprivate

Definition at line 260 of file RandomNumberGenerator.h.

261  {
262  data_.resize(n);
263  }
std::vector< ScheduleData > data_
Char_t n[5]
base_engine_t& art::RandomNumberGenerator::getEngine ( label_t const &  engine_label) const
base_engine_t& art::RandomNumberGenerator::getEngine ( ScheduleID  schedule_id,
label_t const &  engine_label = {} 
) const
private
bool art::RandomNumberGenerator::invariant_holds_ ( ScheduleID::size_type  scheduleID)
private
RandomNumberGenerator& art::RandomNumberGenerator::operator= ( RandomNumberGenerator const &  )
privatedelete
void art::RandomNumberGenerator::postBeginJob ( )
private
void art::RandomNumberGenerator::postEndJob ( )
private
void art::RandomNumberGenerator::postProcessEvent ( art::Event const &  )
private
void art::RandomNumberGenerator::preProcessEvent ( art::Event const &  )
private
void art::RandomNumberGenerator::print_ ( ) const
private
void art::RandomNumberGenerator::restoreFromFile_ ( )
private
void art::RandomNumberGenerator::restoreSnapshot_ ( ScheduleID  scheduleID,
art::Event const &   
)
private
void art::RandomNumberGenerator::saveToFile_ ( )
private
void art::RandomNumberGenerator::takeSnapshot_ ( ScheduleID  scheduleID)
private

Friends And Related Function Documentation

friend class EngineCreator
friend

Definition at line 197 of file RandomNumberGenerator.h.

friend class EventProcessor
friend

Definition at line 198 of file RandomNumberGenerator.h.

friend class RandomNumberSaver
friend

Definition at line 199 of file RandomNumberGenerator.h.

friend class test::ConcurrentEngineRetrieval
friend

Definition at line 200 of file RandomNumberGenerator.h.

Member Data Documentation

std::vector<ScheduleData> art::RandomNumberGenerator::data_
private

Definition at line 302 of file RandomNumberGenerator.h.

bool const art::RandomNumberGenerator::debug_
private

Definition at line 313 of file RandomNumberGenerator.h.

bool art::RandomNumberGenerator::engine_creation_is_okay_ {true}
private

Definition at line 290 of file RandomNumberGenerator.h.

unsigned const art::RandomNumberGenerator::nPrint_
private

Definition at line 312 of file RandomNumberGenerator.h.

std::string const art::RandomNumberGenerator::restoreFromFilename_
private

Definition at line 309 of file RandomNumberGenerator.h.

label_t const art::RandomNumberGenerator::restoreStateLabel_
private

Definition at line 305 of file RandomNumberGenerator.h.

std::string const art::RandomNumberGenerator::saveToFilename_
private

Definition at line 308 of file RandomNumberGenerator.h.


The documentation for this class was generated from the following file: