| The Gaudi Framework v32r1 (f65d50dc)

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
21 #include "GaudiKernel/DataObject.h"
22 #include "GaudiKernel/IDataProviderSvc.h"
23 #include "GaudiKernel/IIncidentSvc.h"
24 #include "GaudiKernel/IMessageSvc.h"
25 #include "GaudiKernel/IOpaqueAddress.h"
26 #include "GaudiKernel/ISvcLocator.h"
27 #include "GaudiKernel/MsgStream.h"
28 #include "RndmEngine.h"
29
31 StatusCode RndmEngine::initialize() {
32 StatusCode status = Service::initialize();
33 if ( status.isSuccess() ) status = setProperties();
34 return status;
35 }
36
38 StreamBuffer& RndmEngine::serialize( StreamBuffer& str ) { return str; }
40
42 StreamBuffer& RndmEngine::serialize( StreamBuffer& str ) const { return str; }
43
45 double RndmEngine::rndm() const { return DBL_MAX; }
46
53 StatusCode RndmEngine::rndmArray( std::vector<double>& array, long howmany, long start ) const {
54 array.resize( start + howmany );
55 std::generate_n( std::next( array.begin(), start ), howmany, [&]() { return this->rndm(); } );
56 return StatusCode::SUCCESS;
57 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:60
RndmEngine::serialize
StreamBuffer & serialize(StreamBuffer &str) override
Input serialization from stream buffer.
Definition: RndmEngine.cpp:39
RndmEngine::rndmArray
StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const override
Multiple shots returning vector with flat random numbers.
Definition: RndmEngine.cpp:53
MsgStream.h
Service::start
StatusCode start() override
Definition: Service.cpp:129
StreamBuffer
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
RndmEngine::rndm
double rndm() const override
Single shot returning single random number.
Definition: RndmEngine.cpp:45
IOTest.start
def start
Definition: IOTest.py:97
IDataProviderSvc.h
IIncidentSvc.h
std::next
T next(T... args)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
RndmEngine::initialize
StatusCode initialize() override
Service override: initialization.
Definition: RndmEngine.cpp:31
std::generate_n
T generate_n(T... args)
IMessageSvc.h
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
Service::setProperties
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:280
IOpaqueAddress.h
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:27
std::vector< double >
RndmEngine.h
ISvcLocator.h
DataObject.h