The Gaudi Framework  v30r3 (a5ef0a68)
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"
27 #include "GaudiKernel/MsgStream.h"
28 #include "RndmEngine.h"
29 
32 {
34  if ( status.isSuccess() ) status = setProperties();
35  return status;
36 }
37 
39 StreamBuffer& RndmEngine::serialize( StreamBuffer& str ) { return str; }
41 
43 StreamBuffer& RndmEngine::serialize( StreamBuffer& str ) const { return str; }
44 
46 double RndmEngine::rndm() const { return DBL_MAX; }
47 
55 {
56  array.resize( start + howmany );
57  std::generate_n( std::next( array.begin(), start ), howmany, [&]() { return this->rndm(); } );
58  return StatusCode::SUCCESS;
59 }
StatusCode initialize() override
Definition: Service.cpp:63
StreamBuffer & serialize(StreamBuffer &str) override
Input serialization from stream buffer.
Definition: RndmEngine.cpp:40
StatusCode start() override
Definition: Service.cpp:136
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
bool isSuccess() const
Definition: StatusCode.h:287
T resize(T...args)
T next(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode initialize() override
Service override: initialization.
Definition: RndmEngine.cpp:31
T generate_n(T...args)
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:294
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
T begin(T...args)
StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const override
Multiple shots returning vector with flat random numbers.
Definition: RndmEngine.cpp:54
double rndm() const override
Single shot returning single random number.
Definition: RndmEngine.cpp:46