All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RndmGen Class Reference

Random Generator definition. More...

#include <src/RndmGenSvc/RndmGen.h>

Inheritance diagram for RndmGen:
Collaboration diagram for RndmGen:

Public Member Functions

virtual StatusCode initialize (const IRndmGen::Param &par)
 IRndmGen implementation. More...
 
virtual StatusCode finalize ()
 Initialize the generator. More...
 
virtual const InterfaceIDtype () const
 Random number generator type. More...
 
virtual long ID () const
 Random number generator ID. More...
 
virtual const IRndmGen::Paramparameters () const
 Access to random number generator parameters. More...
 
virtual double shoot () const
 Single shot returning single random number according to specified distribution. More...
 
virtual StatusCode shootArray (std::vector< double > &array, long howmany, long start) const
 Multiple shots returning vector with random number according to specified distribution. More...
 
- Public Member Functions inherited from extend_interfaces1< IRndmGen >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IRndmGen
 DeclareInterfaceID (IRndmGen, 2, 0)
 InterfaceID. More...
 
virtual ~IRndmGen ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 

Protected Member Functions

 RndmGen (IInterface *engine)
 Standard Constructor. More...
 
virtual ~RndmGen ()
 Standard Destructor. More...
 

Protected Attributes

IRndmGen::Paramm_params
 Generation parameters. More...
 
IRndmEnginem_engine
 Hosting service: Access must always be possible. More...
 

Additional Inherited Members

- Public Types inherited from implements1< IRndmGen >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IRndmGen
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces1< IRndmGen >
typedef IRndmGen::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. 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 39 of file RndmGen.h.

Constructor & Destructor Documentation

RndmGen::RndmGen ( IInterface engine)
protected

Standard Constructor.

Definition at line 22 of file RndmGen.cpp.

22  : m_params(0), m_engine(0) {
23  if ( 0 != engine ) {
24  engine->queryInterface(IRndmEngine::interfaceID(), pp_cast<void>(&m_engine)).ignore();
25  }
26 }
IRndmGen::Param * m_params
Generation parameters.
Definition: RndmGen.h:43
IRndmEngine * m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:45
void ignore() const
Definition: StatusCode.h:107
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
RndmGen::~RndmGen ( )
protectedvirtual

Standard Destructor.

Definition at line 29 of file RndmGen.cpp.

29  {
30  if ( m_engine ) m_engine->release();
31  m_engine = 0;
32  if ( m_params ) delete m_params;
33  m_params = 0;
34 }
IRndmGen::Param * m_params
Generation parameters.
Definition: RndmGen.h:43
IRndmEngine * m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:45
virtual unsigned long release()=0
Release Interface instance.

Member Function Documentation

StatusCode RndmGen::finalize ( )
virtual

Initialize the generator.

Initialize the RndmGen.

Implements IRndmGen.

Reimplemented in HepRndm::Generator< Rndm::DefinedPdf >.

Definition at line 43 of file RndmGen.cpp.

43  {
44  return StatusCode::SUCCESS;
45 }
virtual long RndmGen::ID ( ) const
inlinevirtual

Random number generator ID.

Implements IRndmGen.

Definition at line 64 of file RndmGen.h.

64  {
65  return long(this);
66  }
StatusCode RndmGen::initialize ( const IRndmGen::Param par)
virtual

IRndmGen implementation.

Initialize the generator.

Initialize the generator

Implements IRndmGen.

Reimplemented in HepRndm::Generator< Rndm::DefinedPdf >, and HepRndm::Generator< TYPE >.

Definition at line 37 of file RndmGen.cpp.

37  {
38  m_params = par.clone();
40 }
virtual Param * clone() const =0
Clone parameters.
IRndmGen::Param * m_params
Generation parameters.
Definition: RndmGen.h:43
IRndmEngine * m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:45
virtual const IRndmGen::Param* RndmGen::parameters ( ) const
inlinevirtual

Access to random number generator parameters.

Implements IRndmGen.

Definition at line 68 of file RndmGen.h.

68  {
69  return m_params;
70  }
IRndmGen::Param * m_params
Generation parameters.
Definition: RndmGen.h:43
StatusCode RndmGen::shootArray ( std::vector< double > &  array,
long  howmany,
long  start 
) const
virtual

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

Implements IRndmGen.

Definition at line 53 of file RndmGen.cpp.

53  {
54  if ( 0 != m_engine ) {
55  long cnt = start;
56  array.resize(start+howmany);
57  for ( long i = start, num = start+howmany; i < num; i++ ) {
58  array[cnt++] = shoot();
59  }
60  return StatusCode::SUCCESS;
61  }
62  return StatusCode::FAILURE;
63 }
IRndmEngine * m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:45
virtual double shoot() const
Single shot returning single random number according to specified distribution.
Definition: RndmGen.cpp:48
list i
Definition: ana.py:128
tuple start
Definition: IOTest.py:88
virtual const InterfaceID& RndmGen::type ( ) const
inlinevirtual

Random number generator type.

Implements IRndmGen.

Definition at line 60 of file RndmGen.h.

60  {
61  return (m_params != 0) ? m_params->type() : IID_IRndmFlat;
62  }
IRndmGen::Param * m_params
Generation parameters.
Definition: RndmGen.h:43
virtual const InterfaceID & type() const
Parameter's type.
Definition: IRndmGen.h:51

Member Data Documentation

IRndmEngine* RndmGen::m_engine
protected

Hosting service: Access must always be possible.

Definition at line 45 of file RndmGen.h.

IRndmGen::Param* RndmGen::m_params
protected

Generation parameters.

Definition at line 43 of file RndmGen.h.


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