CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::RandomEngineSentry< T > Class Template Reference

#include <RandomEngineSentry.h>

Public Member Functions

CLHEP::HepRandomEngine *& randomEngine ()
 
CLHEP::HepRandomEngine const * randomEngine () const
 
 RandomEngineSentry (T *t, CLHEP::HepRandomEngine *engine)
 
 RandomEngineSentry (T *t, LuminosityBlockIndex const &lumi)
 
 RandomEngineSentry (T *t, StreamID const &streamID)
 
 ~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 28 of file RandomEngineSentry.h.

Constructor & Destructor Documentation

◆ RandomEngineSentry() [1/3]

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  }

References submitPVValidationJobs::t.

◆ RandomEngineSentry() [2/3]

template<class T>
edm::RandomEngineSentry< T >::RandomEngineSentry ( T t,
StreamID const &  streamID 
)
inlineexplicit

Definition at line 36 of file RandomEngineSentry.h.

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  }

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

◆ RandomEngineSentry() [3/3]

template<class T>
edm::RandomEngineSentry< T >::RandomEngineSentry ( T t,
LuminosityBlockIndex const &  lumi 
)
inlineexplicit

Definition at line 49 of file RandomEngineSentry.h.

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  }

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

◆ ~RandomEngineSentry()

template<class T>
edm::RandomEngineSentry< T >::~RandomEngineSentry ( )
inline

Definition at line 62 of file RandomEngineSentry.h.

62  {
63  if (t_)
64  t_->setRandomEngine(nullptr);
65  }

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

Member Function Documentation

◆ randomEngine() [1/2]

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

◆ randomEngine() [2/2]

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

Member Data Documentation

◆ engine_

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

◆ t_

template<class T>
edm::propagate_const<T*> edm::RandomEngineSentry< T >::t_
private
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
Service
edm::RandomEngineSentry::t_
edm::propagate_const< T * > t_
Definition: RandomEngineSentry.h:71
Exception
Definition: hltDiff.cc:246
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
lumi
Definition: LumiSectionData.h:20
edm::RandomEngineSentry::engine_
edm::propagate_const< CLHEP::HepRandomEngine * > engine_
Definition: RandomEngineSentry.h:72