ATLAS Offline Software
Loading...
Searching...
No Matches
RngCompsConfig.py
Go to the documentation of this file.
1"""Define functions to construct random number services
2
3Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4"""
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7
8
9AtDSFMTGenSvc,AtRanluxGenSvc,AtRndmGenSvc,AthRNGSvc=\
10CompFactory.getComps("AtDSFMTGenSvc","AtRanluxGenSvc","AtRndmGenSvc","AthRNGSvc")
11
12# Translate between names in AthRNGSvc and elsewhere
13AthEngines = {
14 "dSFMT" : "AtDSFMTGenSvc",
15 "Ranlux64" : "AtRanluxGenSvc",
16 "Ranecu" : "AtRndmGenSvc",
17}
18
19def dSFMT(seed, name="AtDSFMTGenSvc"):
20 """Return a ComponentAccumulator containing an AtDSFMTGenSvc with seed"""
21 acc = ComponentAccumulator()
22 service = AtDSFMTGenSvc(name)
23 service.Seeds.append(seed)
24 acc.addService(service, primary=True)
25 return acc
26
27def Ranlux64(seed, name="AtRanluxGenSvc"):
28 """Return a ComponentAccumulator containing an AtRanluxGenSvc with seed"""
29 acc = ComponentAccumulator()
30 service = AtRanluxGenSvc(name)
31 service.Seeds.append(seed)
32 acc.addService(service, primary=True)
33 return acc
34
35def Ranecu(seed, name="AtRndmGenSvc"):
36 """Return a ComponentAccumulator containing an AtRndmGenSvc with seed"""
37 acc = ComponentAccumulator()
38 service = AtRndmGenSvc(name)
39 service.Seeds.append(seed)
40 acc.addService(service, primary=True)
41 return acc
42
43def RNG(engine="dSFMT", name="AthRNGSvc"):
44 """Return a ComponentAccumulator containing an AthRNGSvc"""
45 acc = ComponentAccumulator()
46 service = AthRNGSvc(name)
47 service.EngineType = engine
48 acc.addService(service, primary=True)
49 return acc
50
51def AthRNGSvcCfg(flags, name="AthRNGSvc"):
52 """Return a ComponentAccumulator containing an AthRNGSvc"""
53 acc = ComponentAccumulator()
54 service = AthRNGSvc(name)
55 service.EngineType = flags.Random.Engine
56 acc.addService(service, primary=True)
57 return acc
58
A random number engine manager, based on dSFMT.
The default ATLAS random number engine manager, based on Ranlux64.
A random number engine manager, based on Ranecu.
A service to manage multiple RNG streams in thread-safe way.
Definition AthRNGSvc.h:34
AthRNGSvcCfg(flags, name="AthRNGSvc")
Ranlux64(seed, name="AtRanluxGenSvc")
Ranecu(seed, name="AtRndmGenSvc")
RNG(engine="dSFMT", name="AthRNGSvc")
dSFMT(seed, name="AtDSFMTGenSvc")