The Gaudi Framework
master (181af51f)
Loading...
Searching...
No Matches
ConfigurableUser.py
Go to the documentation of this file.
1
11
"""
12
Example of usage of ConfigurableUser classes (for high level configuration).
13
"""
14
15
from
Gaudi.Configuration
import
*
16
17
18
class
ExampleIO
(
ConfigurableUser
):
19
__slots__ = {
"EvtMax"
: 1,
"Read"
:
"NONE"
,
"Write"
:
"NONE"
}
20
__used_configurables__ = [ApplicationMgr]
21
22
def
__apply_configuration__
(self):
23
# Propagate the properties to all used configurables
24
# In this case the only effect is to set the ApplicationMgr EvtMax.
25
self.
propagateProperties
()
26
27
read = self.
getProp
(
"Read"
)
28
if
read ==
"NONE"
:
29
ApplicationMgr
(EvtSel=
"NONE"
)
30
else
:
31
log.warning(
32
"%s: Cannot handle value %r of property Read"
, self.
name
(), read
33
)
34
35
write = self.
getProp
(
"Write"
)
36
if
read ==
"NONE"
:
37
ApplicationMgr
(HistogramPersistency=
"NONE"
)
38
else
:
39
log.warning(
40
"%s: Cannot handle value %r of property Write"
, self.
name
(), write
41
)
42
43
44
class
ExampleCommon
(
ConfigurableUser
):
45
__slots__ = {
"OutputLevel"
: INFO}
46
__used_configurables__ = []
47
48
def
__apply_configuration__
(self):
49
MessageSvc
().OutputLevel = self.
getProp
(
"OutputLevel"
)
50
51
52
class
ExampleApplication
(
ConfigurableUser
):
53
__slots__ = {
54
"FullDebug"
:
False
,
55
"TopAlg"
: [],
56
}
57
__used_configurables__ = [ExampleCommon, ApplicationMgr]
58
59
def
__apply_configuration__
(self):
60
if
self.
getProp
(
"FullDebug"
):
61
ExampleCommon
(OutputLevel=VERBOSE)
62
else
:
63
ExampleCommon
(OutputLevel=INFO)
64
# Propagate the properties to all used configurables
65
# In this case the only effect is to set the ApplicationMgr TopAlg.
66
self.
propagateProperties
()
67
68
69
def
PostConfAction
():
70
"""
71
Action printing the result of the configuration of the ApplicationMgr.
72
"""
73
print(
"==== Configuration completed ===="
)
74
print(
ApplicationMgr
())
75
76
77
appendPostConfigAction
(PostConfAction)
78
79
ExampleApplication
(TopAlg=[
"GaudiTestSuite::TimingAlg/Timing"
], FullDebug=
True
)
80
ExampleIO
(EvtMax=10)
ApplicationMgr
The Application Manager class.
Definition
ApplicationMgr.h:54
ConfigurableUser.ExampleApplication
Definition
ConfigurableUser.py:52
ConfigurableUser.ExampleApplication.__apply_configuration__
__apply_configuration__(self)
Definition
ConfigurableUser.py:59
ConfigurableUser.ExampleCommon
Definition
ConfigurableUser.py:44
ConfigurableUser.ExampleCommon.__apply_configuration__
__apply_configuration__(self)
Definition
ConfigurableUser.py:48
ConfigurableUser.ExampleIO
Definition
ConfigurableUser.py:18
ConfigurableUser.ExampleIO.__apply_configuration__
__apply_configuration__(self)
Definition
ConfigurableUser.py:22
GaudiKernel.Configurable.Configurable.getProp
getProp(self, name)
Definition
Configurable.py:772
GaudiKernel.Configurable.Configurable.name
name(self)
Definition
Configurable.py:804
GaudiKernel.Configurable.ConfigurableUser
Definition
Configurable.py:1360
GaudiKernel.Configurable.ConfigurableUser.propagateProperties
propagateProperties(self, names=None, others=None, force=True)
Definition
Configurable.py:1516
MessageSvc
Definition
MessageSvc.h:35
ConfigurableUser.PostConfAction
PostConfAction()
Definition
ConfigurableUser.py:69
Gaudi.Configuration
Definition
Configuration.py:1
GaudiKernel.Configurable.appendPostConfigAction
appendPostConfigAction(function)
Definition
Configurable.py:1580
GaudiTestSuite
options
ConfigurableUser.py
Generated on Wed Oct 8 2025 09:53:38 for The Gaudi Framework by
1.13.1