| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Rndm::Numbers Class Reference

Random number accessor This small class encapsulates the use of the random number generator. More...

#include <RndmGenerators.h>

Collaboration diagram for Rndm::Numbers:

[legend]
List of all members.

Public Member Functions

 Numbers ()
 Standard constructor.
 Numbers (const Numbers &copy)
 Copy constructor.
 Numbers (IRndmGenSvc *svc, const IRndmGen::Param &par)
 Initializing constructor.
virtual ~Numbers ()
 Standard destructor.
virtual StatusCode initialize (IRndmGenSvc *svc, const IRndmGen::Param &par)
 Initialization.
virtual StatusCode finalize ()
 Finalization.
 operator bool () const
 Check if the number supply is possible.
double operator() ()
 Operator () for the use within STL.
double pop ()
 Pop a new number from the buffer.
double shoot ()
 Pop a new number from the buffer.
StatusCode shootArray (std::vector< double > &array, long num, long start=0)
 Pop a new number from the buffer.

Protected Attributes

IRndmGenm_generator
 Pointer to random number generator.

Detailed Description

Random number accessor This small class encapsulates the use of the random number generator.

The sole pupose of this class is to hide the usage of the interface and make the whole thing more user friendly. The object is usable directly after creation.

The typical usage is: Rndm::Numbers numbers(); if ( numbers.initialize(rndmGenSvc, Rndm::Gauss(0.5,0.2)).isSuccess() ) { for ( int i = 0; i < 10; i++ ) { value = numbers(); ... } }

Definition at line 388 of file RndmGenerators.h.


Constructor & Destructor Documentation

Rndm::Numbers::Numbers (  ) 

Standard constructor.

Rndm::Numbers::Numbers ( const Numbers copy  ) 

Copy constructor.

Rndm::Numbers::Numbers ( IRndmGenSvc svc,
const IRndmGen::Param par 
)

Initializing constructor.

virtual Rndm::Numbers::~Numbers (  )  [virtual]

Standard destructor.


Member Function Documentation

virtual StatusCode Rndm::Numbers::initialize ( IRndmGenSvc svc,
const IRndmGen::Param par 
) [virtual]

Initialization.

virtual StatusCode Rndm::Numbers::finalize (  )  [virtual]

Finalization.

Rndm::Numbers::operator bool (  )  const [inline]

Check if the number supply is possible.

Definition at line 406 of file RndmGenerators.h.

00406                               {
00407       return m_generator != 0;
00408     }

double Rndm::Numbers::operator() (  )  [inline]

Operator () for the use within STL.

Definition at line 410 of file RndmGenerators.h.

00410                            {
00411       return this->shoot();
00412     }

double Rndm::Numbers::pop (  )  [inline]

Pop a new number from the buffer.

Definition at line 414 of file RndmGenerators.h.

00414                     {
00415       return this->shoot();
00416     }

double Rndm::Numbers::shoot (  )  [inline]

Pop a new number from the buffer.

Definition at line 418 of file RndmGenerators.h.

00418                       {
00419       if ( 0 != m_generator )   {
00420         return m_generator->shoot();
00421       }
00422       return -1;
00423     }

StatusCode Rndm::Numbers::shootArray ( std::vector< double > &  array,
long  num,
long  start = 0 
) [inline]

Pop a new number from the buffer.

Definition at line 425 of file RndmGenerators.h.

00425                                                                              {
00426       if ( 0 != m_generator )   {
00427         return m_generator->shootArray(array, num, start);
00428       }
00429       return StatusCode::FAILURE;
00430     }


Member Data Documentation

IRndmGen* Rndm::Numbers::m_generator [protected]

Pointer to random number generator.

Definition at line 391 of file RndmGenerators.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:21 2011 for GaudiKernel by doxygen 1.4.7