CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
edm::RandomEngineSentry< T > Class Template Reference

#include <RandomEngineSentry.h>

Public Member Functions

CLHEP::HepRandomEngine const * randomEngine () const
 
CLHEP::HepRandomEngine *& randomEngine ()
 
 RandomEngineSentry (T *t, CLHEP::HepRandomEngine *engine)
 
 RandomEngineSentry (T *t, StreamID const &streamID)
 
 RandomEngineSentry (T *t, LuminosityBlockIndex const &lumi)
 
 ~RandomEngineSentry ()
 

Private Attributes

edm::propagate_const
< CLHEP::HepRandomEngine * > 
engine_
 
edm::propagate_const< T * > t_
 

Detailed Description

template<class T>
class edm::RandomEngineSentry< T >

Description:

Definition at line 27 of file RandomEngineSentry.h.

Constructor & Destructor Documentation

template<class T>
edm::RandomEngineSentry< T >::RandomEngineSentry ( T t,
CLHEP::HepRandomEngine *  engine 
)
inlineexplicit

Definition at line 30 of file RandomEngineSentry.h.

30  : t_(t), engine_(engine) {
31  if(t) {
32  t->setRandomEngine(engine);
33  }
34  }
edm::propagate_const< CLHEP::HepRandomEngine * > engine_
edm::propagate_const< T * > t_
template<class T>
edm::RandomEngineSentry< T >::RandomEngineSentry ( T t,
StreamID const &  streamID 
)
inlineexplicit

Definition at line 36 of file RandomEngineSentry.h.

References edm::RandomEngineSentry< T >::engine_, Exception, and edm::Service< T >::isAvailable().

36  : t_(t), engine_(nullptr) {
37  if(t) {
39  if (!rng.isAvailable()) {
40  throw cms::Exception("Configuration")
41  << "Attempt to get a random engine when the RandomNumberGeneratorService is not configured.\n"
42  "You must configure the service if you want an engine.\n";
43  }
44  engine_ = &rng->getEngine(streamID);
45  t->setRandomEngine(engine_);
46  }
47  }
edm::propagate_const< CLHEP::HepRandomEngine * > engine_
edm::propagate_const< T * > t_
template<class T>
edm::RandomEngineSentry< T >::RandomEngineSentry ( T t,
LuminosityBlockIndex const &  lumi 
)
inlineexplicit

Definition at line 49 of file RandomEngineSentry.h.

References edm::RandomEngineSentry< T >::engine_, Exception, and edm::Service< T >::isAvailable().

49  : t_(t), engine_(nullptr) {
50  if(t) {
52  if (!rng.isAvailable()) {
53  throw cms::Exception("Configuration")
54  << "Attempt to get a random engine when the RandomNumberGeneratorService is not configured.\n"
55  "You must configure the service if you want an engine.\n";
56  }
57  engine_ = &rng->getEngine(lumi);
58  t->setRandomEngine(engine_);
59  }
60  }
tuple lumi
Definition: fjr2json.py:35
edm::propagate_const< CLHEP::HepRandomEngine * > engine_
edm::propagate_const< T * > t_
template<class T>
edm::RandomEngineSentry< T >::~RandomEngineSentry ( )
inline

Definition at line 62 of file RandomEngineSentry.h.

References edm::RandomEngineSentry< T >::t_.

62 { if(t_) t_->setRandomEngine(nullptr); }
edm::propagate_const< T * > t_

Member Function Documentation

template<class T>
CLHEP::HepRandomEngine const* edm::RandomEngineSentry< T >::randomEngine ( ) const
inline

Definition at line 64 of file RandomEngineSentry.h.

References edm::RandomEngineSentry< T >::engine_, and edm::get_underlying_safe().

edm::propagate_const< CLHEP::HepRandomEngine * > engine_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
template<class T>
CLHEP::HepRandomEngine*& edm::RandomEngineSentry< T >::randomEngine ( )
inline

Definition at line 65 of file RandomEngineSentry.h.

References edm::RandomEngineSentry< T >::engine_, and edm::get_underlying_safe().

edm::propagate_const< CLHEP::HepRandomEngine * > engine_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)

Member Data Documentation

template<class T>
edm::propagate_const<CLHEP::HepRandomEngine*> edm::RandomEngineSentry< T >::engine_
private
template<class T>
edm::propagate_const<T*> edm::RandomEngineSentry< T >::t_
private