The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
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
}
GaudiException.h
IRndmGen.h
IRndmGenSvc.h
RndmGenerators.h
SmartIF.h
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
IRndmGen::Param
Definition
IRndmGen.h:45
Rndm::Numbers::initialize
virtual StatusCode initialize(const SmartIF< IRndmGenSvc > &svc, const IRndmGen::Param &par)
Initialization.
Definition
RndmGenerators.cpp:27
Rndm::Numbers::~Numbers
virtual ~Numbers()
Standard destructor.
Definition
RndmGenerators.cpp:24
Rndm::Numbers::finalize
virtual StatusCode finalize()
Finalization.
Definition
RndmGenerators.cpp:33
Rndm::Numbers::Numbers
Numbers()=default
Standard constructor.
Rndm::Numbers::m_generator
SmartIF< IRndmGen > m_generator
Pointer to random number generator.
Definition
RndmGenerators.h:357
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition
SmartIF.h:28
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::isSuccess
bool isSuccess() const
Definition
StatusCode.h:302
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
GaudiKernel
src
Lib
RndmGenerators.cpp
Generated on
for The Gaudi Framework by
1.17.0