The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
HepRndm::Engine< TYPE > Class Template Reference

#include </builds/gaudi/Gaudi/GaudiSvc/src/RndmGenSvc/HepRndmEngine.h>

Inheritance diagram for HepRndm::Engine< TYPE >:
Collaboration diagram for HepRndm::Engine< TYPE >:

Public Member Functions

StatusCode initialize () override
 Initialize the Engine.
 
StatusCode finalize () override
 Finalize the Engine.
 
StatusCode setSeeds (const std::vector< long > &seed) override
 Set seeds.
 
StatusCode seeds (std::vector< long > &seed) const override
 Retrieve seeds.
 
 BaseEngine (const std::string &name, ISvcLocator *loc)
 Standard Constructor.
 
- Public Member Functions inherited from HepRndm::BaseEngine
 BaseEngine (const std::string &name, ISvcLocator *loc)
 
CLHEP::HepRandomEngine * hepEngine ()
 
const CLHEP::HepRandomEngine * hepEngine () const
 
double rndm () const override
 
StatusCode finalize () override
 
- Public Member Functions inherited from RndmEngine
double rndm () const override
 Single shot returning single random number.
 
StatusCode rndmArray (std::vector< double > &array, long howmany, long start=0) const override
 Multiple shots returning vector with flat random numbers.
 
StreamBufferserialize (StreamBuffer &str) override
 Input serialization from stream buffer.
 
StreamBufferserialize (StreamBuffer &str) const override
 Output serialization to stream buffer.
 
- Public Member Functions inherited from extends< Service, IRndmEngine, ISerialize >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 

Protected Attributes

Gaudi::Property< std::vector< long > > m_seeds { this, "Seeds", {}, "seed table" }
 
Gaudi::Property< int > m_col { this, "Column", 0 }
 
Gaudi::Property< int > m_row { this, "Row", 1 }
 
Gaudi::Property< int > m_lux { this, "Luxury", 3 }
 
Gaudi::Property< bool > m_useTable { this, "UseTable", false }
 
Gaudi::Property< bool > m_setSingleton { this, "SetSingleton", false }
 
- Protected Attributes inherited from HepRndm::BaseEngine
std::unique_ptr< CLHEP::HepRandomEngine > m_hepEngine
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.
 

Private Member Functions

std::unique_ptr< CLHEP::HepRandomEngine > createEngine () override
 Create new HepEngine....
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 
std::unique_ptr< CLHEP::HepRandomEngine > createEngine ()
 

Additional Inherited Members

- Public Types inherited from extends< Service, IRndmEngine, ISerialize >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 
- Protected Member Functions inherited from HepRndm::BaseEngine
void initEngine ()
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches.
 
MSG::Level resetMessaging ()
 Reinitialize internal states.
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
 

Detailed Description

template<class TYPE>
class HepRndm::Engine< TYPE >

Definition at line 34 of file HepRndmEngine.h.

Member Function Documentation

◆ BaseEngine()

template<class TYPE>
HepRndm::BaseEngine::BaseEngine ( const std::string & name,
ISvcLocator * loc )
inline

Standard Constructor.

Definition at line 43 of file HepRndmBaseEngine.h.

43: RndmEngine( name, loc ) {}
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333

◆ createEngine() [1/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< DualRand >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 143 of file HepRndmEngines.cpp.

143 {
145 }
Gaudi::Property< std::vector< long > > m_seeds
Gaudi::Property< int > m_row
Gaudi::Property< int > m_col
Gaudi::Property< bool > m_useTable

◆ createEngine() [2/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< TripleRand >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 148 of file HepRndmEngines.cpp.

◆ createEngine() [3/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< DRand48Engine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 153 of file HepRndmEngines.cpp.

◆ createEngine() [4/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< Hurd160Engine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 158 of file HepRndmEngines.cpp.

◆ createEngine() [5/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< Hurd288Engine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 163 of file HepRndmEngines.cpp.

◆ createEngine() [6/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< RanecuEngine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 168 of file HepRndmEngines.cpp.

◆ createEngine() [7/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< RanshiEngine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 173 of file HepRndmEngines.cpp.

◆ createEngine() [8/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< RanluxEngine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 178 of file HepRndmEngines.cpp.

178 {
181 }
Gaudi::Property< int > m_lux

◆ createEngine() [9/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< Ranlux64Engine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 184 of file HepRndmEngines.cpp.

◆ createEngine() [10/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< MTwistEngine >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 190 of file HepRndmEngines.cpp.

◆ createEngine() [11/12]

std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< HepJamesRandom >::createEngine ( )
privatevirtual

Implements HepRndm::BaseEngine.

Definition at line 195 of file HepRndmEngines.cpp.

◆ createEngine() [12/12]

template<class TYPE>
std::unique_ptr< CLHEP::HepRandomEngine > HepRndm::Engine< TYPE >::createEngine ( )
overrideprivatevirtual

Create new HepEngine....

Implements HepRndm::BaseEngine.

◆ finalize()

template<class TYPE>
StatusCode HepRndm::Engine< TYPE >::finalize ( )
override

Finalize the Engine.

Definition at line 105 of file HepRndmEngines.cpp.

105 {
106 m_seeds.value().clear();
107 return BaseEngine::finalize();
108 }
StatusCode finalize() override

◆ initialize()

template<class TYPE>
StatusCode HepRndm::Engine< TYPE >::initialize ( )
override

Initialize the Engine.

Definition at line 67 of file HepRndmEngines.cpp.

67 {
68 auto& seeds = m_seeds.value();
70 if ( m_seeds.size() == 0 ) {
71 // Default seeds
72 long theSeed = 1234567;
73 seeds.push_back( theSeed );
74 seeds.push_back( 0 );
75 }
76 if ( status.isSuccess() ) {
77 initEngine();
78 info() << "Generator engine type:" << System::typeinfoName( typeid( *hepEngine() ) ) << endmsg;
79 if ( m_useTable ) {
80 if ( m_row > 214 || m_col > 1 ) {
81 error() << "Generator engine seed table has dimension [215][2], you gave:"
82 << " Row=" << m_row << " Column:" << m_col << endmsg;
84 } else {
85 info() << "Generator engine seeds from table."
86 << " Row=" << m_row << " Column:" << m_col << endmsg;
87 }
88 }
89 info() << "Current Seed:" << hepEngine()->getSeed();
90 info() << " Luxury:" << m_lux.value();
91 info() << endmsg;
92 // Use the default static engine if required (e.g. for GEANT4)
93 if ( m_setSingleton ) {
95 info() << "This is the GEANT4 engine!" << endmsg;
96 }
97 return status;
98 }
99 error() << "Cannot initialze random engine of type:" << System::typeinfoName( typeid( TYPE ) ) << endmsg;
100 return status;
101 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
CLHEP::HepRandomEngine * hepEngine()
Gaudi::Property< bool > m_setSingleton
StatusCode seeds(std::vector< long > &seed) const override
Retrieve seeds.
StatusCode initialize() override
Definition Service.cpp:118
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:260

◆ seeds()

template<class TYPE>
StatusCode HepRndm::Engine< TYPE >::seeds ( std::vector< long > & seed) const
override

Retrieve seeds.

Definition at line 126 of file HepRndmEngines.cpp.

126 {
127 /*
128 const long *s = hepEngine()->getSeeds();
129 for ( size_t i = 0; i < NUMBER_OF_SEEDS; i++ ) {
130 seed.push_back(s[i]);
131 if ( m_seeds.size() > i )
132 m_seeds[i] = s[i];
133 else
134 m_seeds.push_back(s[i]);
135 }
136 */
137 seed.push_back( hepEngine()->getSeed() );
138 return StatusCode::SUCCESS;
139 }

◆ setSeeds()

template<class TYPE>
StatusCode HepRndm::Engine< TYPE >::setSeeds ( const std::vector< long > & seed)
override

Set seeds.

Definition at line 112 of file HepRndmEngines.cpp.

112 {
113 auto& seeds = m_seeds.value();
114 seeds.clear();
115 std::copy( seed.begin(), seed.end(), std::back_inserter( seeds ) );
116 if ( !seeds.empty() ) {
117 if ( seeds.back() != 0 ) { seeds.push_back( 0 ); }
118 hepEngine()->setSeeds( &seeds[0], m_lux );
119 return StatusCode::SUCCESS;
120 }
121 return StatusCode::FAILURE;
122 }

Member Data Documentation

◆ m_col

template<class TYPE>
Gaudi::Property<int> HepRndm::Engine< TYPE >::m_col { this, "Column", 0 }
protected

Definition at line 38 of file HepRndmEngine.h.

38{ this, "Column", 0 };

◆ m_lux

template<class TYPE>
Gaudi::Property<int> HepRndm::Engine< TYPE >::m_lux { this, "Luxury", 3 }
protected

Definition at line 40 of file HepRndmEngine.h.

40{ this, "Luxury", 3 };

◆ m_row

template<class TYPE>
Gaudi::Property<int> HepRndm::Engine< TYPE >::m_row { this, "Row", 1 }
protected

Definition at line 39 of file HepRndmEngine.h.

39{ this, "Row", 1 };

◆ m_seeds

template<class TYPE>
Gaudi::Property<std::vector<long> > HepRndm::Engine< TYPE >::m_seeds { this, "Seeds", {}, "seed table" }
mutableprotected

Definition at line 36 of file HepRndmEngine.h.

36{ this, "Seeds", {}, "seed table" };

◆ m_setSingleton

template<class TYPE>
Gaudi::Property<bool> HepRndm::Engine< TYPE >::m_setSingleton { this, "SetSingleton", false }
protected

Definition at line 42 of file HepRndmEngine.h.

42{ this, "SetSingleton", false };

◆ m_useTable

template<class TYPE>
Gaudi::Property<bool> HepRndm::Engine< TYPE >::m_useTable { this, "UseTable", false }
protected

Definition at line 41 of file HepRndmEngine.h.

41{ this, "UseTable", false };

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