ATLAS Offline Software
Loading...
Searching...
No Matches
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
18namespace ATHRNG {
19 class RNGWrapper;
20}
21namespace CLHEP{
22 class HepRandomEngine;
23}
24
33class AthRNGSvc : public extends<AthService, IAthRNGSvc>
34{
35
36public:
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
53private:
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
66 std::mutex m_mutex;
67
68};
69
70#endif
A wrapper class for event-slot-local random engines.
Definition RNGWrapper.h:56
std::function< CLHEP::HepRandomEngine *(void)> factoryFunc
Factory function which constructs a HepRandomEngine.
Definition AthRNGSvc.h:62
virtual void printEngineState(const INamedInterface *client, const std::string &streamName="") override final
Print engine state.
Definition AthRNGSvc.cxx:75
std::mutex m_mutex
Mutex for protecting access to the wrapper structure.
Definition AthRNGSvc.h:66
AthRNGSvc(const std::string &name, ISvcLocator *svc)
Standard constructor.
Definition AthRNGSvc.cxx:15
std::unordered_map< std::string, ATHRNG::RNGWrapper * > m_wrappers
The structure for storing the RNGWrappers.
Definition AthRNGSvc.h:59
factoryFunc m_fact
Definition AthRNGSvc.h:63
std::string m_rngType
Random number engine type (e.g. dSFMT, ranecu)
Definition AthRNGSvc.h:56
virtual ~AthRNGSvc()
Definition AthRNGSvc.cxx:97
StatusCode initialize() override final
Initialize the service.
Definition AthRNGSvc.cxx:22
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