The Gaudi Framework  v29r0 (ff2e7097)
RndmGenSvc.h
Go to the documentation of this file.
1 //====================================================================
2 // Random Generator service definition
3 //--------------------------------------------------------------------
4 //
5 // Package : Gaudi/RndmGen ( The LHCb Offline System)
6 // Author : M.Frank
7 //====================================================================
8 #ifndef GAUDI_RANDOMGENSVC_RNDMGENSVC_H
9 #define GAUDI_RANDOMGENSVC_RNDMGENSVC_H 1
10 
11 // STL include files
12 #include <vector>
13 
14 // Framework include files
16 #include "GaudiKernel/IRndmGen.h"
18 #include "GaudiKernel/ISerialize.h"
19 #include "GaudiKernel/Service.h"
20 
21 // Forward declarations
22 class IRndmGenFactory;
23 class IMessageSvc;
24 
49 class RndmGenSvc : public extends<Service, IRndmGenSvc, IRndmEngine, ISerialize>
50 {
51 private:
56 
57  Gaudi::Property<std::string> m_engineName{this, "Engine", "HepRndm::Engine<CLHEP::RanluxEngine>", "engine name"};
58 
59 public:
60  // inherits constructor from base class
61  using extends::extends;
62  ~RndmGenSvc() override = default;
63 
64 public:
66  StatusCode initialize() override;
68  StatusCode finalize() override;
70  StreamBuffer& serialize( StreamBuffer& str ) override;
73  StreamBuffer& serialize( StreamBuffer& str ) const override;
75  IRndmEngine* engine() override;
77  StatusCode generator( const IRndmGen::Param& par, IRndmGen*& refpGen ) override;
79  double rndm() const override;
86  StatusCode rndmArray( std::vector<double>& array, long howmany, long start = 0 ) const override;
88  StatusCode setSeeds( const std::vector<long>& seeds ) override;
90  StatusCode seeds( std::vector<long>& seeds ) const override;
91 };
92 
93 #endif // GAUDI_RANDOMGENSVC_RNDMGENSVC_H
StreamBuffer & serialize(StreamBuffer &str) override
IRndmGenSvc interface implementation.
Definition: RndmGenSvc.cpp:82
StatusCode initialize() override
Service override: initialization.
Definition: RndmGenSvc.cpp:34
Implementation of property with value of concrete type.
Definition: Property.h:319
StatusCode finalize() override
Service override: finalization.
Definition: RndmGenSvc.cpp:69
StatusCode start() override
Definition: Service.cpp:137
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
Definition of a interface for a generic random number generators.
Definition: IRndmGen.h:34
SmartIF< IRndmEngine > m_engine
Random number engine.
Definition: RndmGenSvc.h:53
Gaudi::Property< std::string > m_engineName
Definition: RndmGenSvc.h:57
~RndmGenSvc() override=default
Random Generator service definition.
Definition: RndmGenSvc.h:49
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
double rndm() const override
Single shot returning single random number.
Definition: RndmGenSvc.cpp:114
StatusCode generator(const IRndmGen::Param &par, IRndmGen *&refpGen) override
Retrieve a valid generator from the service.
Definition: RndmGenSvc.cpp:101
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:38
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
StatusCode setSeeds(const std::vector< long > &seeds) override
Allow to set new seeds.
Definition: RndmGenSvc.cpp:128
StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const override
Multiple shots returning vector with flat random numbers.
Definition: RndmGenSvc.cpp:122
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
StatusCode seeds(std::vector< long > &seeds) const override
Allow to get seeds.
Definition: RndmGenSvc.cpp:134
Definition of a interface for a generic random number generator giving randomly distributed numbers i...
Definition: IRndmEngine.h:19
IRndmEngine * engine() override
Retrieve engine.
Definition: RndmGenSvc.cpp:98
SmartIF< ISerialize > m_serialize
Serialization interface of random number engine.
Definition: RndmGenSvc.h:55