ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkG4Components
TrkG4UserActions
python
TrkG4UserActionsConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3
"""Define methods to configure TrkG4UserActions"""
4
5
def
MaterialStepRecorderCfg
(configFlags, name="G4UA::UserActionSvc.MaterialStepRecorderTool
", **kwargs):
6
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
7
from
AthenaConfiguration.ComponentFactory
import
CompFactory
8
result = ComponentAccumulator()
9
result.setPrivateTools(CompFactory.G4UA.MaterialStepRecorderTool(name, **kwargs))
10
return
result
11
12
13
def
MaterialStepRecorderUserActionSvcCfg
(configFlags, name="G4UA::MaterialStepRecorderUserActionSvc
", **kwargs):
14
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
15
from
AthenaConfiguration.ComponentFactory
import
CompFactory
16
17
result = ComponentAccumulator()
18
19
#Setting up the CA for the MaterialStepRecorder
20
actionAcc = ComponentAccumulator()
21
actions = []
22
actions += [actionAcc.popToolsAndMerge(
MaterialStepRecorderCfg
(configFlags))]
23
actionAcc.setPrivateTools(actions)
24
MaterialStepRecorderAction = result.popToolsAndMerge(actionAcc)
25
26
#Retrieving the default action list
27
from
G4AtlasServices.G4AtlasUserActionConfig
import
getDefaultActions
28
defaultActions = result.popToolsAndMerge(getDefaultActions(configFlags))
29
30
#Adding material recorder action to defaults
31
actionList = (defaultActions + MaterialStepRecorderAction)
32
33
kwargs.setdefault(
"UserActionTools"
,actionList)
34
result.addService(CompFactory.G4UA.UserActionSvc(name,**kwargs), primary =
True
)
35
36
return
result
37
38
def
MaterialStepRecorder
(configFlags, name="G4UA::ISFFullUserActionSvc
", **kwargs):
39
40
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
41
from
AthenaConfiguration.ComponentFactory
import
CompFactory
42
43
result = ComponentAccumulator()
44
#Setting up the CA
45
actionAcc = ComponentAccumulator()
46
actions = []
47
actions += [actionAcc.popToolsAndMerge(
MaterialStepRecorderCfg
(configFlags,**kwargs))]
48
actionAcc.setPrivateTools(actions)
49
MaterialStepRecorderAction = result.popToolsAndMerge(actionAcc)
50
51
actionList = MaterialStepRecorderAction
52
#We clear it here because UserActionsTools also wants kwargs, different
53
#from the tool above - probably this caq be improved...
54
kwargs_UATools = {}
55
kwargs_UATools.setdefault(
"UserActionTools"
,actionList)
56
result.addService(CompFactory.G4UA.UserActionSvc(name,**kwargs_UATools))
57
58
AthenaOutputStream=CompFactory.AthenaOutputStream
59
AthenaOutputStreamTool=CompFactory.AthenaOutputStreamTool
60
writingTool =
AthenaOutputStreamTool
(
"MaterialStepCollectionStreamTool"
,
61
TopLevelContainerName =
""
,
62
SubLevelBranchName =
"<type>/<key>"
)
63
64
outputStream =
AthenaOutputStream
(name =
"MaterialStepCollectionStream"
,
65
WritingTool = writingTool,
66
ItemList=[
'EventInfo#*'
,
'Trk::MaterialStepCollection#*'
],
67
MetadataItemList = [
"EventStreamInfo#MaterialStepCollectionStream"
,
"IOVMetaDataContainer#*"
],
68
OutputFile =
"MaterialStepCollection.root"
)
69
70
StoreGateSvc=CompFactory.StoreGateSvc
71
result.addService(
StoreGateSvc
(
"MetaDataStore"
))
72
outputStream.MetadataStore = result.getService(
"MetaDataStore"
)
73
74
MakeEventStreamInfo=CompFactory.MakeEventStreamInfo
75
streamInfoTool =
MakeEventStreamInfo
(
"MaterialStepCollectionStream_MakeEventStreamInfo"
)
76
streamInfoTool.Key =
"MaterialStepCollectionStream"
77
streamInfoTool.EventInfoKey =
"EventInfo"
78
outputStream.HelperTools.append(streamInfoTool)
79
80
result.addEventAlgo(outputStream)
81
82
return
result
83
84
def
GeantFollowerMSToolCfg
(configFlags, name="G4UA::GeantFollowerMSTool
", **kwargs):
85
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
86
from
AthenaConfiguration.ComponentFactory
import
CompFactory
87
88
THistSvc= CompFactory.THistSvc
89
result = ComponentAccumulator()
90
histsvc = THistSvc(name=
"THistSvc"
)
91
histsvc.Output = [
"val DATAFILE='GeantFollowing.root' OPT='RECREATE'"
]
92
result.addService(histsvc)
93
result.setPrivateTools(CompFactory.G4UA.GeantFollowerMSTool(name, **kwargs))
94
95
return
result
AthenaOutputStreamTool
This is the implementation of IAthenaOutputStreamTool.
Definition
AthenaOutputStreamTool.h:34
AthenaOutputStream
algorithm that marks for write data objects in SG
Definition
AthenaOutputStream.h:54
MakeEventStreamInfo
This class provides an algorithm to make the EventStreamInfo object and update it.
Definition
MakeEventStreamInfo.h:27
StoreGateSvc
The Athena Transient Store API.
Definition
StoreGateSvc.h:120
python.TrkG4UserActionsConfig.MaterialStepRecorderUserActionSvcCfg
MaterialStepRecorderUserActionSvcCfg(configFlags, name="G4UA::MaterialStepRecorderUserActionSvc", **kwargs)
Definition
TrkG4UserActionsConfig.py:13
python.TrkG4UserActionsConfig.MaterialStepRecorder
MaterialStepRecorder(configFlags, name="G4UA::ISFFullUserActionSvc", **kwargs)
Definition
TrkG4UserActionsConfig.py:38
python.TrkG4UserActionsConfig.MaterialStepRecorderCfg
MaterialStepRecorderCfg(configFlags, name="G4UA::UserActionSvc.MaterialStepRecorderTool", **kwargs)
Definition
TrkG4UserActionsConfig.py:5
python.TrkG4UserActionsConfig.GeantFollowerMSToolCfg
GeantFollowerMSToolCfg(configFlags, name="G4UA::GeantFollowerMSTool", **kwargs)
Definition
TrkG4UserActionsConfig.py:84
Generated on
for ATLAS Offline Software by
1.17.0