The Gaudi Framework  v33r1 (b1225454)
RndmGen.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 RndmGen class implementation
13 //--------------------------------------------------------------------
14 //
15 // Package : Gaudi/RndmGen ( The LHCb Offline System)
16 // Author : M.Frank
17 // History :
18 // +---------+----------------------------------------------+--------+
19 // | Date | Comment | Who |
20 // +---------+----------------------------------------------+--------+
21 // | 21/11/99| Initial version. | MF |
22 // +---------+----------------------------------------------+--------+
23 //====================================================================
24 #define GAUDI_RANDOMGENSVC_RNDMGEN_CPP
25 
26 #include "RndmGen.h"
29 #include <algorithm>
30 #include <cfloat>
31 
33 RndmGen::RndmGen( IInterface* engine ) : m_engine{engine} {}
34 
37  m_params.reset( par.clone() );
39 }
40 
42 
45  if ( !m_engine ) return StatusCode::FAILURE;
46  array.resize( start + howmany );
47  std::generate_n( std::next( std::begin( array ), start ), howmany, [&]() { return this->shoot(); } );
48  return StatusCode::SUCCESS;
49 }
RndmGen(IInterface *engine)
Standard Constructor.
Definition: RndmGen.cpp:33
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
def start
Definition: IOTest.py:108
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:57
T next(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
Definition of the basic interface.
Definition: IInterface.h:254
StatusCode initialize(const IRndmGen::Param &par) override
IRndmGen implementation.
Definition: RndmGen.cpp:36
T generate_n(T... args)
T reset(T... args)
StatusCode finalize() override
Finalize the generator.
Definition: RndmGen.cpp:41
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:44
T begin(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:101
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition: RndmGen.h:55