| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RndmGen Class Reference

Random Generator definition. More...

`#include <src/RndmGenSvc/RndmGen.h>`

Inheritance diagram for RndmGen:
[legend]
Collaboration diagram for RndmGen:
[legend]

## Public Member Functions
StatusCode | initialize (const IRndmGen::Param &par) override
| IRndmGen implementation. More...
StatusCode | finalize () override
| Finalize the generator. More...
const InterfaceID & | type () const override
| Random number generator type. More...
long | ID () const override
| Random number generator ID. More...
const IRndmGen::Param * | parameters () const override
| Access to random number generator parameters. More...
StatusCode | shootArray (std::vector< double > &array, long howmany, long start) const override
| Multiple shots returning vector with random number according to specified distribution. More...
Public Member Functions inherited from implements< IRndmGen >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| implements ()=default
| Default constructor. More...
| implements (const implements &)
| Copy constructor (zero the reference count) More...
implements & | operator= (const implements &)
| Assignment operator (do not touch the reference count). More...
| ~implements () override=default
| Virtual destructor. More...
unsigned long | addRef () override
| Reference Interface instance. More...
unsigned long | release () override
| Release Interface instance. More...
unsigned long | refCount () const override
| Current reference count. More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Member Functions
| RndmGen (IInterface *engine)
| Standard Constructor. More...
| ~RndmGen () override=default
| Standard Destructor. More...

## Protected Attributes
std::unique_ptr< IRndmGen::Param > | m_params
| Generation parameters. More...
SmartIF< IRndmEngine > | m_engine
| Hosting service: Access must always be possible. More...
Protected Attributes inherited from implements< IRndmGen >
std::atomic_ulong | m_refCount
| Reference counter. More...

## Additional Inherited Members
Public Types inherited from implements< IRndmGen >
using | base_class = implements< Interfaces... >
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
using | iids = typename extend_interfaces_base::ext_iids
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## 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 41 of file RndmGen.h.

## Constructor & Destructor Documentation

RndmGen::RndmGen | ( | IInterface * | engine | ) |
| protected

Standard Constructor.

Definition at line 23 of file RndmGen.cpp.

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

RndmGen::~RndmGen | ( |  | ) |
| override protected default

Standard Destructor.

## Member Function Documentation

StatusCode RndmGen::finalize | ( |  | ) |
| override

Finalize the generator.

Definition at line 33 of file RndmGen.cpp.

33 {
34 return StatusCode::SUCCESS;
35 }
StatusCode::SUCCESS
Definition: StatusCode.h:30

long RndmGen::ID | ( |  | ) | const
| inline override

Random number generator ID.

Definition at line 66 of file RndmGen.h.

66 {
67 return long(this);
68 }

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

IRndmGen implementation.

Initialize the generator.

Initialize the generator

Definition at line 28 of file RndmGen.cpp.

28 {
29 m_params.reset(par.clone());
30 return m_engine ? StatusCode::SUCCESS : StatusCode::FAILURE;
31 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
IRndmGen::Param::clone
virtual Param * clone() const =0
Clone parameters.
RndmGen::m_engine
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:47
std::unique_ptr::reset
T reset(T...args)
RndmGen::m_params
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition: RndmGen.h:45

const IRndmGen::Param* RndmGen::parameters | ( |  | ) | const
| inline override

Access to random number generator parameters.

Definition at line 70 of file RndmGen.h.

70 {
71 return m_params.get();
72 }
std::unique_ptr::get
T get(T...args)
RndmGen::m_params
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition: RndmGen.h:45

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

  array | Array containing random numbers
  howmany | fill 'howmany' random numbers into array
  start | ... starting at position start

Definition at line 38 of file RndmGen.cpp.

38 {
39 if ( !m_engine ) return StatusCode::FAILURE;
40 array.resize(start+howmany);
41 std::generate_n( std::next( std::begin(array), start ), howmany, [&](){ return this->shoot(); } );
42 return StatusCode::SUCCESS;
43 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
std::vector::resize
T resize(T...args)
RndmGen::m_engine
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:47
std::next
T next(T...args)
std::generate_n
T generate_n(T...args)
IOTest.start
start
Definition: IOTest.py:88
std::begin
T begin(T...args)

const InterfaceID& RndmGen::type | ( |  | ) | const
| inline override

Random number generator type.

Definition at line 62 of file RndmGen.h.

62 {
63 return (m_params != 0) ? m_params->type() : IID_IRndmFlat;
64 }
IRndmGen::Param::type
virtual const InterfaceID & type() const
Parameter&#39;s type.
Definition: IRndmGen.h:50
RndmGen::m_params
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition: RndmGen.h:45

## Member Data Documentation

SmartIF<IRndmEngine> RndmGen::m_engine
| protected

Hosting service: Access must always be possible.

Definition at line 47 of file RndmGen.h.

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

Generation parameters.

Definition at line 45 of file RndmGen.h.

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

- GaudiSvc/src/RndmGenSvc/RndmGen.h
- GaudiSvc/src/RndmGenSvc/RndmGen.cpp