| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RndmGen.cpp
Go to the documentation of this file.
1 //====================================================================
2 // Random RndmGen class implementation
3 //--------------------------------------------------------------------
4 //
5 // Package : Gaudi/RndmGen ( The LHCb Offline System)
6 // Author : M.Frank
7 // History :
8 // +---------+----------------------------------------------+--------+
9 // | Date | Comment | Who |
10 // +---------+----------------------------------------------+--------+
11 // | 21/11/99| Initial version. | MF |
12 // +---------+----------------------------------------------+--------+
13 //====================================================================
14 #define GAUDI_RANDOMGENSVC_RNDMGEN_CPP
15
16 #include <cfloat>
17 #include "GaudiKernel/ISvcLocator.h"
18 #include "GaudiKernel/IRndmEngine.h"
19 #include "RndmGen.h"
20
22 RndmGen::RndmGen(IInterface* engine) : m_params(0), m_engine(0) {
23 if ( 0 != engine ) {
24 engine->queryInterface(IRndmEngine::interfaceID(), pp_cast<void>(&m_engine)).ignore();
25 }
26 }
27
29 RndmGen::~RndmGen() {
30 if ( m_engine ) m_engine->release();
31 m_engine = 0;
32 if ( m_params ) delete m_params;
33 m_params = 0;
34 }
35
37 StatusCode RndmGen::initialize(const IRndmGen::Param& par) {
38 m_params = par.clone();
39 return (0==m_engine) ? StatusCode::FAILURE : StatusCode::SUCCESS;
40 }
41
43 StatusCode RndmGen::finalize() {
44 return StatusCode::SUCCESS;
45 }
46
48 double RndmGen::shoot() const {
49 return DBL_MAX;
50 }
51
53 StatusCode RndmGen::shootArray( std::vector<double>& array, long howmany, long start) const {
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 }
64