The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
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
33RndmGen::RndmGen( IInterface* engine ) : m_engine{ engine } {}
34
40
42
44StatusCode RndmGen::shootArray( std::vector<double>& array, long howmany, long start ) const {
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(); } );
49}
Definition of the basic interface.
Definition IInterface.h:225
SmartIF< IRndmEngine > m_engine
Hosting service: Access must always be possible.
Definition RndmGen.h:56
RndmGen(IInterface *engine)
Standard Constructor.
Definition RndmGen.cpp:33
StatusCode finalize() override
Finalize the generator.
Definition RndmGen.cpp:41
std::unique_ptr< IRndmGen::Param > m_params
Generation parameters.
Definition RndmGen.h:54
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
StatusCode initialize(const IRndmGen::Param &par) override
IRndmGen implementation.
Definition RndmGen.cpp:36
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100