The Gaudi Framework  v33r0 (d5ea422b)
RndmEngine.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 //====================================================================
12 // Random Engine implementation
13 //--------------------------------------------------------------------
14 //
15 // Package : Gaudi/RndmGen ( The LHCb Offline System)
16 // Author : M.Frank
17 // History :
18 // +---------+----------------------------------------------+---------
19 // | Date | Comment | Who
20 // +---------+----------------------------------------------+---------
21 // | 29/10/99| Initial version | MF
22 // +---------+----------------------------------------------+---------
23 //
24 //====================================================================
25 #define GAUDI_RANDOMGENSVC_RndmEngine_CPP
26 
27 // STL include files
28 #include <cfloat>
29 
30 // Framework include files
31 #include "GaudiKernel/DataObject.h"
37 #include "GaudiKernel/MsgStream.h"
38 #include "RndmEngine.h"
39 
43  if ( status.isSuccess() ) status = setProperties();
44  return status;
45 }
46 
48 StreamBuffer& RndmEngine::serialize( StreamBuffer& str ) { return str; }
50 
52 StreamBuffer& RndmEngine::serialize( StreamBuffer& str ) const { return str; }
53 
55 double RndmEngine::rndm() const { return DBL_MAX; }
56 
64  array.resize( start + howmany );
65  std::generate_n( std::next( array.begin(), start ), howmany, [&]() { return this->rndm(); } );
66  return StatusCode::SUCCESS;
67 }
StatusCode initialize() override
Definition: Service.cpp:70
StreamBuffer & serialize(StreamBuffer &str) override
Input serialization from stream buffer.
Definition: RndmEngine.cpp:49
StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const override
Multiple shots returning vector with flat random numbers.
Definition: RndmEngine.cpp:63
StatusCode start() override
Definition: Service.cpp:139
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
double rndm() const override
Single shot returning single random number.
Definition: RndmEngine.cpp:55
def start
Definition: IOTest.py:108
T next(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
StatusCode initialize() override
Service override: initialization.
Definition: RndmEngine.cpp:41
T generate_n(T... args)
bool isSuccess() const
Definition: StatusCode.h:361
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:290
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.