The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
RndmGen Class Reference

Random Generator definition. More...

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

Inheritance diagram for RndmGen:
Collaboration diagram for RndmGen:

Public Member Functions

StatusCode initialize (const IRndmGen::Param &par) override
 IRndmGen implementation.
 
StatusCode finalize () override
 Finalize the generator.
 
const InterfaceIDtype () const override
 Random number generator type.
 
long ID () const override
 Random number generator ID.
 
const IRndmGen::Paramparameters () const override
 Access to random number generator parameters.
 
StatusCode shootArray (std::vector< double > &array, long howmany, long start) const override
 Multiple shots returning vector with random number according to specified distribution.
 
- Public Member Functions inherited from implements< IRndmGen >
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.
 
 implements ()=default
 Default constructor.
 
 implements (const implements &)
 Copy constructor (zero the reference count)
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count).
 
unsigned long addRef () const override
 Reference Interface instance.
 
unsigned long release () const override
 Release Interface instance.
 
unsigned long refCount () const override
 Current reference count.
 

Protected Member Functions

 RndmGen (IInterface *engine)
 Standard Constructor.
 
- Protected Member Functions inherited from implements< IRndmGen >
unsigned long decRef () const override
 

Protected Attributes

std::unique_ptr< IRndmGen::Paramm_params
 Generation parameters.
 
SmartIF< IRndmEnginem_engine
 Hosting service: Access must always be possible.
 
- Protected Attributes inherited from implements< IRndmGen >
std::atomic_ulong m_refCount
 Reference counter.
 

Additional Inherited Members

- Public Types inherited from implements< IRndmGen >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
using iids
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 

Detailed Description

Random Generator definition.

Description: Definition of a interface for a generic random number generators.

Dependencies:

  • Generic Service interface: Gaudi/Interfaces/IInterface.h

History :

+---------+----------------------------------------------+--------+
|    Date |                 Comment                      | Who    |
+---------+----------------------------------------------+--------+
| 21/11/99| Initial version.                             | MF     |
+---------+----------------------------------------------+--------+

Author: M.Frank Version: 1.0

Definition at line 50 of file RndmGen.h.

Constructor & Destructor Documentation

◆ RndmGen()

RndmGen::RndmGen ( IInterface * engine)
protected

Standard Constructor.

Definition at line 33 of file RndmGen.cpp.

33: m_engine{ engine } {}
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition RndmGen.h:56

Member Function Documentation

◆ finalize()

StatusCode RndmGen::finalize ( )
override

Finalize the generator.

Definition at line 41 of file RndmGen.cpp.

41{ return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition StatusCode.h:99

◆ ID()

long RndmGen::ID ( ) const
inlineoverride

Random number generator ID.

Definition at line 70 of file RndmGen.h.

70{ return long( this ); }

◆ initialize()

StatusCode RndmGen::initialize ( const IRndmGen::Param & par)
override

IRndmGen implementation.

Initialize the generator.

Initialize the generator

Definition at line 36 of file RndmGen.cpp.

36 {
37 m_params.reset( par.clone() );
39}
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition RndmGen.h:54
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ parameters()

const IRndmGen::Param * RndmGen::parameters ( ) const
inlineoverride

Access to random number generator parameters.

Definition at line 72 of file RndmGen.h.

72{ return m_params.get(); }

◆ shootArray()

StatusCode RndmGen::shootArray ( std::vector< double > & array,
long howmany,
long start ) const
override

Multiple shots returning vector with random number according to specified distribution.

Parameters
arrayArray containing random numbers
howmanyfill 'howmany' random numbers into array
start... starting at position start

Definition at line 44 of file RndmGen.cpp.

44 {
45 if ( !m_engine ) return StatusCode::FAILURE;
46 array.resize( start + howmany );
47 std::generate_n( std::next( std::begin( array ), start ), howmany, [&]() { return this->shoot(); } );
49}
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.

◆ type()

const InterfaceID & RndmGen::type ( ) const
inlineoverride

Random number generator type.

Definition at line 68 of file RndmGen.h.

68{ return ( m_params != 0 ) ? m_params->type() : IID_IRndmFlat; }

Member Data Documentation

◆ m_engine

SmartIF<IRndmEngine> RndmGen::m_engine
protected

Hosting service: Access must always be possible.

Definition at line 56 of file RndmGen.h.

◆ m_params

std::unique_ptr<IRndmGen::Param> RndmGen::m_params
protected

Generation parameters.

Definition at line 54 of file RndmGen.h.


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