The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ConfigurableUser.py
Go to the documentation of this file.
1 
11 """
12 Example of usage of ConfigurableUser classes (for high level configuration).
13 """
14 from __future__ import print_function
15 
16 from Gaudi.Configuration import *
17 
18 
20  __slots__ = {"EvtMax": 1, "Read": "NONE", "Write": "NONE"}
21  __used_configurables__ = [ApplicationMgr]
22 
24  # Propagate the properties to all used configurables
25  # In this case the only effect is to set the ApplicationMgr EvtMax.
26  self.propagateProperties()
27 
28  read = self.getProp("Read")
29  if read == "NONE":
30  ApplicationMgr(EvtSel="NONE")
31  else:
32  log.warning(
33  "%s: Cannot handle value %r of property Read", self.name(), read
34  )
35 
36  write = self.getProp("Write")
37  if read == "NONE":
38  ApplicationMgr(HistogramPersistency="NONE")
39  else:
40  log.warning(
41  "%s: Cannot handle value %r of property Write", self.name(), write
42  )
43 
44 
46  __slots__ = {"OutputLevel": INFO}
47  __used_configurables__ = []
48 
50  MessageSvc().OutputLevel = self.getProp("OutputLevel")
51 
52 
54  __slots__ = {
55  "FullDebug": False,
56  "TopAlg": [],
57  }
58  __used_configurables__ = [ExampleCommon, ApplicationMgr]
59 
61  if self.getProp("FullDebug"):
62  ExampleCommon(OutputLevel=VERBOSE)
63  else:
64  ExampleCommon(OutputLevel=INFO)
65  # Propagate the properties to all used configurables
66  # In this case the only effect is to set the ApplicationMgr TopAlg.
67  self.propagateProperties()
68 
69 
71  """
72  Action printing the result of the configuration of the ApplicationMgr.
73  """
74  print("==== Configuration completed ====")
75  print(ApplicationMgr())
76 
77 
78 appendPostConfigAction(PostConfAction)
79 
80 ExampleApplication(TopAlg=["GaudiExamples::TimingAlg/Timing"], FullDebug=True)
81 ExampleIO(EvtMax=10)
GaudiKernel.Configurable.ConfigurableUser
Definition: Configurable.py:1359
ConfigurableUser.ExampleCommon
Definition: ConfigurableUser.py:45
GaudiKernel.Configurable.ConfigurableUser.propagateProperties
def propagateProperties(self, names=None, others=None, force=True)
Definition: Configurable.py:1515
GaudiKernel.Configurable.Configurable.getProp
def getProp(self, name)
Definition: Configurable.py:778
ConfigurableUser.ExampleIO
Definition: ConfigurableUser.py:19
ConfigurableUser.ExampleApplication.__apply_configuration__
def __apply_configuration__(self)
Definition: ConfigurableUser.py:60
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:810
ConfigurableUser.ExampleCommon.__apply_configuration__
def __apply_configuration__(self)
Definition: ConfigurableUser.py:49
GaudiKernel.Configurable.appendPostConfigAction
def appendPostConfigAction(function)
Definition: Configurable.py:1579
Gaudi.Configuration
Definition: Configuration.py:1
MessageSvc
Definition: MessageSvc.h:40
ConfigurableUser.ExampleApplication
Definition: ConfigurableUser.py:53
ConfigurableUser.PostConfAction
def PostConfAction()
Definition: ConfigurableUser.py:70
ApplicationMgr
Definition: ApplicationMgr.h:57
ConfigurableUser.ExampleIO.__apply_configuration__
def __apply_configuration__(self)
Definition: ConfigurableUser.py:23