| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# RndmGen Class Reference

`#include <RndmGen.h>`

Inheritance diagram for RndmGen:

[legend]
Collaboration diagram for RndmGen:

[legend]

List of all members.

## 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.

## Public Member Functions
unsigned long | addRef ()
| IInterface implementation.
unsigned long | release ()
| Decrease reference count.
StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)
| Query interface.
virtual StatusCode | initialize (const IRndmGen::Param &par)
| IRndmGen implementation.
virtual StatusCode | finalize ()
| Initialize the generator.
virtual const InterfaceID & | type () const
| Random number generator type.
virtual long | ID () const
| Random number generator ID.
virtual const IRndmGen::Param * | parameters () const
| Access to random number generator parameters.
virtual double | shoot () const
| Single shot returning single random number according to specified distribution.
virtual StatusCode | shootArray (std::vector< double > &array, long howmany, long start) const
| Multiple shots returning vector with random number according to specified distribution.
## Protected Member Functions
| RndmGen (IInterface *engine)
| Standard Constructor.
virtual | ~RndmGen ()
| Standard Destructor.
## Protected Attributes
IRndmGen::Param * | m_params
| Generation parameters.
IRndmEngine * | m_engine
| Hosting service: Access must always be possible.
## Private Attributes
unsigned long | m_refCount
| Reference count.

## Constructor & Destructor Documentation

RndmGen::RndmGen | ( | IInterface * | engine | ) | `[protected]`

Standard Constructor.

Definition at line 22 of file RndmGen.cpp.

    00022                                    : m_refCount(0), m_params(0), m_engine(0)   {
    00023   if ( 0 != engine )  {
    00024     engine->queryInterface(IID_IRndmEngine, pp_cast<void>(&m_engine)).ignore();
    00025   }
    00026 }

RndmGen::~RndmGen | ( |  | ) | `[protected, virtual]`

Standard Destructor.

Definition at line 29 of file RndmGen.cpp.

    00029                     {
    00030   if ( m_engine ) m_engine->release();
    00031   m_engine = 0;
    00032   if ( m_params ) delete m_params;
    00033   m_params = 0;
    00034 }

## Member Function Documentation

unsigned long RndmGen::addRef | ( |  | ) | `[inline, virtual]`

IInterface implementation.

Increase reference count

Implements IInterface.

Definition at line 59 of file RndmGen.h.

    00059                             {
    00060     return ++m_refCount;
    00061   }

unsigned long RndmGen::release | ( |  | ) | `[inline, virtual]`

Decrease reference count.

Implements IInterface.

Definition at line 64 of file RndmGen.h.

    00064                             {
    00065     unsigned long cnt = --m_refCount;
    00066     if ( cnt <= 0 )   {
    00067       delete this;
    00068     }
    00069     return cnt;
    00070   }

StatusCode RndmGen::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvInterface |
| ) |  |  | `[virtual]`

Query interface.

Implements IInterface.

Definition at line 37 of file RndmGen.cpp.

    00037                                                                                 {
    00038   if ( IID_IRndmGen == riid )   {
    00039     *ppvInterface = (IRndmGen*)this;
    00040   }
    00041   else if ( IID_IInterface == riid )   {
    00042     *ppvInterface = (IInterface*)this;
    00043   }
    00044   else  {
    00045     return StatusCode::FAILURE;
    00046   }
    00047   addRef();
    00048   return StatusCode::SUCCESS;
    00049 }

StatusCode RndmGen::initialize | ( | const IRndmGen::Param & | par | ) | `[virtual]`

IRndmGen implementation.

Initialize the generator.

Initialize the generator

Implements IRndmGen.

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

Definition at line 52 of file RndmGen.cpp.

    00052                                                          {
    00053   m_params = par.clone();
    00054   return (0==m_engine) ? StatusCode::FAILURE : StatusCode::SUCCESS;
    00055 }

StatusCode RndmGen::finalize | ( | void |  | ) | `[virtual]`

Initialize the generator.

Initialize the RndmGen.

Implements IRndmGen.

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

Definition at line 58 of file RndmGen.cpp.

    00058                                {
    00059   return StatusCode::SUCCESS;
    00060 }

virtual const InterfaceID& RndmGen::type | ( |  | ) | const`[inline, virtual]`

Random number generator type.

Implements IRndmGen.

Definition at line 80 of file RndmGen.h.

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

virtual long RndmGen::ID | ( |  | ) | const`[inline, virtual]`

Random number generator ID.

Implements IRndmGen.

Definition at line 84 of file RndmGen.h.

    00084                              {
    00085     return long(this);
    00086   }

virtual const IRndmGen::Param* RndmGen::parameters | ( |  | ) | const`[inline, virtual]`

Access to random number generator parameters.

Implements IRndmGen.

Definition at line 88 of file RndmGen.h.

    00088                                                      {
    00089     return m_params;
    00090   }

double RndmGen::shoot | ( |  | ) | const`[virtual]`

Single shot returning single random number according to specified distribution.

Implements IRndmGen.

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

Definition at line 63 of file RndmGen.cpp.

    00063                               {
    00064   return DBL_MAX;
    00065 }

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:

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

Implements IRndmGen.

Definition at line 68 of file RndmGen.cpp.

    00068                                                                                         {
    00069   if ( 0 != m_engine )    {
    00070     long cnt = start;
    00071     array.resize(start+howmany);
    00072     for ( long i = start, num = start+howmany; i < num; i++ )     {
    00073       array[cnt++] = shoot();
    00074     }
    00075     return StatusCode::SUCCESS;
    00076   }
    00077   return StatusCode::FAILURE;
    00078 }

## Member Data Documentation

unsigned long RndmGen::m_refCount`[private]`

Reference count.

Definition at line 43 of file RndmGen.h.

IRndmGen::Param* RndmGen::m_params`[protected]`

Generation parameters.

Definition at line 47 of file RndmGen.h.

IRndmEngine* RndmGen::m_engine`[protected]`

Hosting service: Access must always be possible.

Definition at line 49 of file RndmGen.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiSvc/src/RndmGenSvc/RndmGen.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiSvc/src/RndmGenSvc/RndmGen.cpp