All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RndmEngine.cpp
Go to the documentation of this file.
1 //====================================================================
2 // Random Engine implementation
3 //--------------------------------------------------------------------
4 //
5 // Package : Gaudi/RndmGen ( The LHCb Offline System)
6 // Author : M.Frank
7 // History :
8 // +---------+----------------------------------------------+---------
9 // | Date | Comment | Who
10 // +---------+----------------------------------------------+---------
11 // | 29/10/99| Initial version | MF
12 // +---------+----------------------------------------------+---------
13 //
14 //====================================================================
15 #define GAUDI_RANDOMGENSVC_RndmEngine_CPP
16 
17 // STL include files
18 #include <cfloat>
19 
20 // Framework include files
26 #include "GaudiKernel/DataObject.h"
27 #include "GaudiKernel/MsgStream.h"
28 #include "RndmEngine.h"
29 
31 RndmEngine::RndmEngine(const std::string& name, ISvcLocator* loc)
32 : base_class(name, loc)
33 {
34 }
35 
38 }
39 
43  if ( status.isSuccess() ) {
44  status = setProperties();
45  if ( status.isSuccess() ) {
46  m_pIncidentSvc = serviceLocator()->service("IncidentSvc");
47  if (!m_pIncidentSvc.isValid()) {
48  status = StatusCode::FAILURE;
49  }
50  }
51  }
52  return status;
53 }
54 
57  m_pIncidentSvc = 0; // release
58  return Service::finalize();
59 }
60 
64  return str;
65 }
66 
69  return str;
70 }
71 
73 double RndmEngine::rndm() const {
74  return DBL_MAX;
75 }
76 
78 void RndmEngine::handle (const Incident& /* inc */ ) {
79 }
80 
87 StatusCode RndmEngine::rndmArray( std::vector<double>& array, long howmany, long start) const {
88  long cnt = start;
89  array.resize(start+howmany);
90  for ( long i = start, num = start+howmany; i < num; i++ ) {
91  array[cnt++] = rndm();
92  }
93  return StatusCode::SUCCESS;
94 }
95 
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
RndmEngine(const std::string &name, ISvcLocator *loc)
Standard Constructor.
Definition: RndmEngine.cpp:31
virtual StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const
Multiple shots returning vector with flat random numbers.
Definition: RndmEngine.cpp:87
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:40
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual double rndm() const
Single shot returning single random number.
Definition: RndmEngine.cpp:73
virtual void handle(const Incident &inc)
Inform that a new incident has occurred.
Definition: RndmEngine.cpp:78
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
SmartIF< IIncidentSvc > m_pIncidentSvc
Reference to the incident service.
Definition: RndmEngine.h:50
virtual StatusCode finalize()
Service override: finalization.
Definition: RndmEngine.cpp:56
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StreamBuffer & serialize(StreamBuffer &str)
Input serialization from stream buffer.
Definition: RndmEngine.cpp:63
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:371
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
virtual ~RndmEngine()
Standard Destructor.
Definition: RndmEngine.cpp:37
Base class for all Incidents (computing events).
Definition: Incident.h:16
Templated class to add the standard messaging functionalities.
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Definition: Service.cpp:158
virtual StatusCode initialize()
Service override: initialization.
Definition: RndmEngine.cpp:41
list i
Definition: ana.py:128
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
tuple start
Definition: IOTest.py:88
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336