The Gaudi Framework
master (57817a18)
Toggle main menu visibility
Loading...
Searching...
No Matches
RndmGenSvc.h
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
//====================================================================
12
// Random Generator service definition
13
//--------------------------------------------------------------------
14
//
15
// Package : Gaudi/RndmGen ( The LHCb Offline System)
16
// Author : M.Frank
17
//====================================================================
18
#pragma once
19
20
// STL include files
21
#include <vector>
22
23
// Framework include files
24
#include <
GaudiKernel/IRndmEngine.h
>
25
#include <
GaudiKernel/IRndmGen.h
>
26
#include <
GaudiKernel/IRndmGenSvc.h
>
27
#include <
GaudiKernel/ISerialize.h
>
28
#include <
GaudiKernel/Service.h
>
29
30
// Forward declarations
31
class
IRndmGenFactory;
32
class
IMessageSvc
;
33
58
class
RndmGenSvc
:
public
extends
<Service, IRndmGenSvc, IRndmEngine, ISerialize> {
59
private
:
61
mutable
SmartIF<IRndmEngine>
m_engine
;
63
mutable
SmartIF<ISerialize>
m_serialize
;
64
65
Gaudi::Property<std::string>
m_engineName
{
this
,
"Engine"
,
"HepRndm::Engine<CLHEP::RanluxEngine>"
,
"engine name"
};
66
Gaudi::Property<bool>
m_useThreadSafeEngine
{
this
,
"ThreadSafe"
,
true
,
"use thread safe engine"
};
67
68
public
:
69
// inherits constructor from base class
70
using
extends::extends;
71
72
public
:
74
StatusCode
initialize
()
override
;
76
StatusCode
finalize
()
override
;
79
StreamBuffer
&
serialize
(
StreamBuffer
& str )
override
;
81
StreamBuffer
&
serialize
(
StreamBuffer
& str )
const override
;
83
IRndmEngine
*
engine
()
override
;
85
StatusCode
generator
(
const
IRndmGen::Param
& par,
IRndmGen
*& refpGen )
override
;
87
double
rndm
()
const override
;
94
StatusCode
rndmArray
( std::vector<double>& array,
long
howmany,
long
start
= 0 )
const override
;
96
StatusCode
setSeeds
(
const
std::vector<long>&
seeds
)
override
;
98
StatusCode
seeds
( std::vector<long>&
seeds
)
const override
;
99
};
IRndmEngine.h
IRndmGen.h
IRndmGenSvc.h
ISerialize.h
Service.h
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition
IMessageSvc.h:34
IRndmEngine
Definition of a interface for a generic random number generator giving randomly distributed numbers i...
Definition
IRndmEngine.h:25
IRndmGen::Param
Definition
IRndmGen.h:45
IRndmGen
Definition of a interface for a generic random number generators.
Definition
IRndmGen.h:40
RndmGenSvc
Random Generator service definition.
Definition
RndmGenSvc.h:58
RndmGenSvc::serialize
StreamBuffer & serialize(StreamBuffer &str) override
IRndmGenSvc interface implementation.
Definition
RndmGenSvc.cpp:91
RndmGenSvc::initialize
StatusCode initialize() override
Service override: initialization.
Definition
RndmGenSvc.cpp:44
RndmGenSvc::m_useThreadSafeEngine
Gaudi::Property< bool > m_useThreadSafeEngine
Definition
RndmGenSvc.h:66
RndmGenSvc::rndm
double rndm() const override
Single shot returning single random number.
Definition
RndmGenSvc.cpp:120
RndmGenSvc::m_serialize
SmartIF< ISerialize > m_serialize
Serialization interface of random number engine.
Definition
RndmGenSvc.h:63
RndmGenSvc::seeds
StatusCode seeds(std::vector< long > &seeds) const override
Allow to get seeds.
Definition
RndmGenSvc.cpp:138
RndmGenSvc::generator
StatusCode generator(const IRndmGen::Param &par, IRndmGen *&refpGen) override
Retrieve a valid generator from the service.
Definition
RndmGenSvc.cpp:108
RndmGenSvc::setSeeds
StatusCode setSeeds(const std::vector< long > &seeds) override
Allow to set new seeds.
Definition
RndmGenSvc.cpp:133
RndmGenSvc::m_engine
SmartIF< IRndmEngine > m_engine
Random number engine.
Definition
RndmGenSvc.h:61
RndmGenSvc::engine
IRndmEngine * engine() override
Retrieve engine.
Definition
RndmGenSvc.cpp:105
RndmGenSvc::rndmArray
StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const override
Multiple shots returning vector with flat random numbers.
Definition
RndmGenSvc.cpp:128
RndmGenSvc::finalize
StatusCode finalize() override
Service override: finalization.
Definition
RndmGenSvc.cpp:79
RndmGenSvc::m_engineName
Gaudi::Property< std::string > m_engineName
Definition
RndmGenSvc.h:65
Service::start
StatusCode start() override
Definition
Service.cpp:187
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
StreamBuffer
The stream buffer is a small object collecting object data.
Definition
StreamBuffer.h:48
extends
Base class used to extend a class implementing other interfaces.
Definition
extends.h:19
GaudiSvc
src
RndmGenSvc
RndmGenSvc.h
Generated on
for The Gaudi Framework by
1.17.0