The Gaudi Framework
master (d98a2936)
RndmGenerators.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 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
#include <
GaudiKernel/GaudiException.h
>
12
#include <
GaudiKernel/IRndmGen.h
>
13
#include <
GaudiKernel/IRndmGenSvc.h
>
14
#include <
GaudiKernel/RndmGenerators.h
>
15
#include <
GaudiKernel/SmartIF.h
>
16
17
// Construct and initialize the generator
18
Rndm::Numbers::Numbers
(
const
SmartIF<IRndmGenSvc>
& svc,
const
IRndmGen::Param
&
par
) {
19
StatusCode
status =
initialize
( svc,
par
);
20
if
( !status.
isSuccess
() ) {
throw
GaudiException
(
"Initialization failed !"
,
"Rndm::Numbers"
, status ); }
21
}
22
23
// Standard destructor
24
Rndm::Numbers::~Numbers
() { finalize().ignore(); }
25
26
// Initialize the generator
27
StatusCode
Rndm::Numbers::initialize
(
const
SmartIF<IRndmGenSvc>
& svc,
const
IRndmGen::Param
&
par
) {
28
if
( svc && !m_generator ) m_generator = svc->generator(
par
);
29
return
m_generator ?
StatusCode::SUCCESS
:
StatusCode::FAILURE
;
30
}
31
32
// Initialize the generator
33
StatusCode
Rndm::Numbers::finalize
() {
34
if
( m_generator ) {
35
m_generator->finalize().
ignore
();
36
m_generator.reset();
37
}
38
return
StatusCode::SUCCESS
;
39
}
RndmGenerators.h
StatusCode::isSuccess
bool isSuccess() const
Definition:
StatusCode.h:314
GaudiException.h
GaudiException
Definition:
GaudiException.h:29
IRndmGenSvc.h
compareOutputFiles.par
par
Definition:
compareOutputFiles.py:477
SmartIF.h
IRndmGen.h
StatusCode
Definition:
StatusCode.h:64
Rndm::Numbers::finalize
virtual StatusCode finalize()
Finalization.
Definition:
RndmGenerators.cpp:33
IRndmGen::Param
Definition:
IRndmGen.h:45
SmartIF< IRndmGenSvc >
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition:
StatusCode.h:139
Rndm::Numbers::initialize
virtual StatusCode initialize(const SmartIF< IRndmGenSvc > &svc, const IRndmGen::Param &par)
Initialization.
Definition:
RndmGenerators.cpp:27
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:99
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:100
Rndm::Numbers::~Numbers
virtual ~Numbers()
Standard destructor.
Definition:
RndmGenerators.cpp:24
Rndm::Numbers::Numbers
Numbers()=default
Standard constructor.
GaudiKernel
src
Lib
RndmGenerators.cpp
Generated on Wed Aug 13 2025 09:05:05 for The Gaudi Framework by
1.8.18