The Gaudi Framework  v32r2 (46d42edc)
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 "RndmGen.h"
19 #include <algorithm>
20 #include <cfloat>
21 
23 RndmGen::RndmGen( IInterface* engine ) : m_engine{engine} {}
24 
27  m_params.reset( par.clone() );
29 }
30 
32 
35  if ( !m_engine ) return StatusCode::FAILURE;
36  array.resize( start + howmany );
37  std::generate_n( std::next( std::begin( array ), start ), howmany, [&]() { return this->shoot(); } );
38  return StatusCode::SUCCESS;
39 }
RndmGen(IInterface *engine)
Standard Constructor.
Definition: RndmGen.cpp:23
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
def start
Definition: IOTest.py:98
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:47
T next(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Definition of the basic interface.
Definition: IInterface.h:244
StatusCode initialize(const IRndmGen::Param &par) override
IRndmGen implementation.
Definition: RndmGen.cpp:26
T generate_n(T... args)
T reset(T... args)
StatusCode finalize() override
Finalize the generator.
Definition: RndmGen.cpp:31
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
StatusCode shootArray(std::vector< double > &array, long howmany, long start) const override
Multiple shots returning vector with random number according to specified distribution.
Definition: RndmGen.cpp:34
T begin(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition: RndmGen.h:45