The Gaudi Framework  master (37c0b60a)
RndmGenSvc.h
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 Generator service definition
13 //--------------------------------------------------------------------
14 //
15 // Package : Gaudi/RndmGen ( The LHCb Offline System)
16 // Author : M.Frank
17 //====================================================================
18 #ifndef GAUDI_RANDOMGENSVC_RNDMGENSVC_H
19 #define GAUDI_RANDOMGENSVC_RNDMGENSVC_H 1
20 
21 // STL include files
22 #include <vector>
23 
24 // Framework include files
26 #include <GaudiKernel/IRndmGen.h>
28 #include <GaudiKernel/ISerialize.h>
29 #include <GaudiKernel/Service.h>
30 
31 // Forward declarations
32 class IRndmGenFactory;
33 class IMessageSvc;
34 
59 class RndmGenSvc : public extends<Service, IRndmGenSvc, IRndmEngine, ISerialize> {
60 private:
65 
66  Gaudi::Property<std::string> m_engineName{ this, "Engine", "HepRndm::Engine<CLHEP::RanluxEngine>", "engine name" };
67 
68 public:
69  // inherits constructor from base class
70  using extends::extends;
71 
72 public:
74  StatusCode initialize() override;
76  StatusCode finalize() override;
78  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 };
100 
101 #endif // GAUDI_RANDOMGENSVC_RNDMGENSVC_H
IMessageSvc
Definition: IMessageSvc.h:47
Service::start
StatusCode start() override
Definition: Service.cpp:187
std::vector< double >
IRndmGenSvc.h
IRndmEngine
Definition: IRndmEngine.h:29
RndmGenSvc::m_engine
SmartIF< IRndmEngine > m_engine
Random number engine.
Definition: RndmGenSvc.h:62
StreamBuffer
Definition: StreamBuffer.h:52
RndmGenSvc::initialize
StatusCode initialize() override
Service override: initialization.
Definition: RndmGenSvc.cpp:44
compareOutputFiles.par
par
Definition: compareOutputFiles.py:477
RndmGenSvc::m_serialize
SmartIF< ISerialize > m_serialize
Serialization interface of random number engine.
Definition: RndmGenSvc.h:64
IRndmEngine.h
RndmGenSvc::finalize
StatusCode finalize() override
Service override: finalization.
Definition: RndmGenSvc.cpp:75
IRndmGen.h
StatusCode
Definition: StatusCode.h:65
RndmGenSvc::generator
StatusCode generator(const IRndmGen::Param &par, IRndmGen *&refpGen) override
Retrieve a valid generator from the service.
Definition: RndmGenSvc.cpp:104
ISerialize.h
RndmGenSvc::m_engineName
Gaudi::Property< std::string > m_engineName
Definition: RndmGenSvc.h:66
IRndmGen::Param
Definition: IRndmGen.h:49
SmartIF< IRndmEngine >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
RndmGenSvc::setSeeds
StatusCode setSeeds(const std::vector< long > &seeds) override
Allow to set new seeds.
Definition: RndmGenSvc.cpp:129
Service.h
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:124
IRndmGen
Definition: IRndmGen.h:44
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:37
RndmGenSvc::rndm
double rndm() const override
Single shot returning single random number.
Definition: RndmGenSvc.cpp:116
RndmGenSvc::serialize
StreamBuffer & serialize(StreamBuffer &str) override
IRndmGenSvc interface implementation
Definition: RndmGenSvc.cpp:87
RndmGenSvc::seeds
StatusCode seeds(std::vector< long > &seeds) const override
Allow to get seeds.
Definition: RndmGenSvc.cpp:134
RndmGenSvc
Random Generator service definition.
Definition: RndmGenSvc.h:59
Gaudi::Property< std::string >
RndmGenSvc::engine
IRndmEngine * engine() override
Retrieve engine.
Definition: RndmGenSvc.cpp:101