The Gaudi Framework  master (b9786168)
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
28#include <GaudiKernel/Service.h>
29
30// Forward declarations
31class IRndmGenFactory;
32class IMessageSvc;
33
58class RndmGenSvc : public extends<Service, IRndmGenSvc, IRndmEngine, ISerialize> {
59private:
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
68public:
69 // inherits constructor from base class
70 using extends::extends;
71
72public:
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};
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
The IMessage is the interface implemented by the message service.
Definition IMessageSvc.h:34
Definition of a interface for a generic random number generator giving randomly distributed numbers i...
Definition IRndmEngine.h:25
Definition of a interface for a generic random number generators.
Definition IRndmGen.h:40
Random Generator service definition.
Definition RndmGenSvc.h:58
StreamBuffer & serialize(StreamBuffer &str) override
IRndmGenSvc interface implementation.
StatusCode initialize() override
Service override: initialization.
Gaudi::Property< bool > m_useThreadSafeEngine
Definition RndmGenSvc.h:66
double rndm() const override
Single shot returning single random number.
SmartIF< ISerialize > m_serialize
Serialization interface of random number engine.
Definition RndmGenSvc.h:63
StatusCode seeds(std::vector< long > &seeds) const override
Allow to get seeds.
StatusCode generator(const IRndmGen::Param &par, IRndmGen *&refpGen) override
Retrieve a valid generator from the service.
StatusCode setSeeds(const std::vector< long > &seeds) override
Allow to set new seeds.
SmartIF< IRndmEngine > m_engine
Random number engine.
Definition RndmGenSvc.h:61
IRndmEngine * engine() override
Retrieve engine.
StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const override
Multiple shots returning vector with flat random numbers.
StatusCode finalize() override
Service override: finalization.
Gaudi::Property< std::string > m_engineName
Definition RndmGenSvc.h:65
StatusCode start() override
Definition Service.cpp:187
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
The stream buffer is a small object collecting object data.
Base class used to extend a class implementing other interfaces.
Definition extends.h:19