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

Private Attributes

CLHEP::HepRandomEngine * engine_
 
Tt_
 

Detailed Description

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

Description:

Definition at line 26 of file RandomEngineSentry.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file RandomEngineSentry.h.

29  : t_(t), engine_(engine) {
30  if(t) {
31  t->setRandomEngine(engine);
32  }
33  }
tuple t
Definition: tree.py:139
CLHEP::HepRandomEngine * engine_
template<class T>
edm::RandomEngineSentry< T >::RandomEngineSentry ( T t,
StreamID const &  streamID 
)
inlineexplicit

Definition at line 35 of file RandomEngineSentry.h.

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

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

Definition at line 48 of file RandomEngineSentry.h.

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

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

Definition at line 61 of file RandomEngineSentry.h.

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

61 { if(t_) t_->setRandomEngine(nullptr); }

Member Function Documentation

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

Definition at line 63 of file RandomEngineSentry.h.

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

63 { return engine_; }
CLHEP::HepRandomEngine * engine_

Member Data Documentation

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