ATLAS Offline Software
AthRNGSvc.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*
3  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef RNGCOMPS_ATHRNGSVC_H
7 #define RNGCOMPS_ATHRNGSVC_H
8 
9 #include <unordered_map>
10 #include <vector>
11 #include <string>
12 #include <mutex>
13 #include <functional>
14 
17 
18 namespace ATHRNG {
19  class RNGWrapper;
20 }
21 namespace CLHEP{
22  class HepRandomEngine;
23 }
24 
33 class AthRNGSvc : public extends<AthService, IAthRNGSvc>
34 {
35 
36 public:
37 
39  AthRNGSvc(const std::string& name, ISvcLocator* svc);
40  virtual ~AthRNGSvc();
41 
43  StatusCode initialize() override final;
44 
46  virtual ATHRNG::RNGWrapper* getEngine(const INamedInterface* client,
47  const std::string& streamName="") override final;
48 
50  virtual void printEngineState(const INamedInterface* client,
51  const std::string& streamName = "") override final;
52 
53 private:
54 
56  std::string m_rngType;
57 
59  std::unordered_map<std::string, ATHRNG::RNGWrapper*> m_wrappers;
60 
62  typedef std::function<CLHEP::HepRandomEngine*(void)> factoryFunc;
64 
67 
68 };
69 
70 #endif
AthRNGSvc::AthRNGSvc
AthRNGSvc(const std::string &name, ISvcLocator *svc)
Standard constructor.
Definition: AthRNGSvc.cxx:15
ATHRNG
Definition: IAthRNGSvc.h:23
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
AthRNGSvc::getEngine
virtual ATHRNG::RNGWrapper * getEngine(const INamedInterface *client, const std::string &streamName="") override final
IAthRNGSvc method to retrieve the random number wrapper.
Definition: AthRNGSvc.cxx:49
AthRNGSvc::m_fact
factoryFunc m_fact
Definition: AthRNGSvc.h:63
rerun_display.client
client
Definition: rerun_display.py:31
AthRNGSvc
A service to manage multiple RNG streams in thread-safe way.
Definition: AthRNGSvc.h:34
AthRNGSvc::~AthRNGSvc
virtual ~AthRNGSvc()
Definition: AthRNGSvc.cxx:97
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
AthRNGSvc::initialize
StatusCode initialize() override final
Initialize the service.
Definition: AthRNGSvc.cxx:22
AthRNGSvc::m_rngType
std::string m_rngType
Random number engine type (e.g. dSFMT, ranecu)
Definition: AthRNGSvc.h:56
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
AthRNGSvc::factoryFunc
std::function< CLHEP::HepRandomEngine *(void)> factoryFunc
Factory function which constructs a HepRandomEngine.
Definition: AthRNGSvc.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
AthRNGSvc::m_wrappers
std::unordered_map< std::string, ATHRNG::RNGWrapper * > m_wrappers
The structure for storing the RNGWrappers.
Definition: AthRNGSvc.h:59
AthRNGSvc::m_mutex
std::mutex m_mutex
Mutex for protecting access to the wrapper structure.
Definition: AthRNGSvc.h:66
AthService.h
AthRNGSvc::printEngineState
virtual void printEngineState(const INamedInterface *client, const std::string &streamName="") override final
Print engine state.
Definition: AthRNGSvc.cxx:75
IAthRNGSvc.h