The Gaudi Framework  master (37c0b60a)
RndmGen.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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::finalize
StatusCode finalize() override
Finalize the generator.
Definition: RndmGen.cpp:41
std::generate_n
T generate_n(T... args)
std::vector< double >
RndmGen.h
IOTest.start
start
Definition: IOTest.py:110
std::unique_ptr::reset
T reset(T... args)
RndmGen::RndmGen
RndmGen(IInterface *engine)
Standard Constructor.
Definition: RndmGen.cpp:33
compareOutputFiles.par
par
Definition: compareOutputFiles.py:477
IRndmEngine.h
RndmGen::initialize
StatusCode initialize(const IRndmGen::Param &par) override
IRndmGen implementation
Definition: RndmGen.cpp:36
StatusCode
Definition: StatusCode.h:65
RndmGen::m_engine
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition: RndmGen.h:57
IRndmGen::Param
Definition: IRndmGen.h:49
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:37
std::begin
T begin(T... args)
IInterface
Definition: IInterface.h:239
RndmGen::m_params
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition: RndmGen.h:55
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
ISvcLocator.h
RndmGen::shootArray
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
std::next
T next(T... args)