|
def | __init__ (self, flags, monName) |
|
def | addAlgorithm (self, algClassOrObj, name=None, addFilterTools=[], *args, **kwargs) |
|
def | addGroup (self, alg, name, topPath='', defaultDuration='run') |
|
def | addArray (self, dimensions, alg, baseName, topPath='', defaultDuration='run') |
|
def | result (self) |
|
This class is for the Run 3-style configuration framework. It is intended to be instantiated once
per group of related monitoring algorithms.
Definition at line 15 of file AthMonitorCfgHelper.py.
◆ __init__()
def python.AthMonitorCfgHelper.AthMonitorCfgHelper.__init__ |
( |
|
self, |
|
|
|
flags, |
|
|
|
monName |
|
) |
| |
Create the configuration helper. Needs the job flags and the name of the set of
monitoring algorithms.
Arguments:
flags -- the configuration flag object
monName -- the name you want to assign the family of algorithms
Definition at line 20 of file AthMonitorCfgHelper.py.
22 Create the configuration helper. Needs the job flags and the name of the set of
23 monitoring algorithms.
26 flags -- the configuration flag object
27 monName -- the name you want to assign the family of algorithms
30 AthSequencer=CompFactory.AthSequencer
32 self.monName = monName
34 self.monSeq.StopOverride=
True
36 self.resobj.addSequence(self.monSeq)
37 if self.flags.DQ.useTrigger:
38 from .TriggerInterface
import TrigDecisionToolCfg
◆ addAlgorithm()
def python.AthMonitorCfgHelper.AthMonitorCfgHelper.addAlgorithm |
( |
|
self, |
|
|
|
algClassOrObj, |
|
|
|
name = None , |
|
|
|
addFilterTools = [] , |
|
|
* |
args, |
|
|
** |
kwargs |
|
) |
| |
Instantiate/add a monitoring algorithm
Arguments:
algClassOrObj -- the Configurable class object of the algorithm to create, or an instance
of the algorithm Configurable. The former is recommended. In the former case,
the name argument is required.
name -- the name of the algorithm to create. Required when passing a Configurable class object
as algClassOrObj. No effect if a Configurable instance is passed.
*args, **kwargs -- additional arguments will be forwarded to the Configurable constructor if
a Configurable class object is passed. No effect if a Configurable instance
is passed.
Returns:
algObj -- an algorithm Configurable object
Definition at line 41 of file AthMonitorCfgHelper.py.
41 def addAlgorithm(self, algClassOrObj, name = None, addFilterTools = [], *args, **kwargs):
43 Instantiate/add a monitoring algorithm
46 algClassOrObj -- the Configurable class object of the algorithm to create, or an instance
47 of the algorithm Configurable. The former is recommended. In the former case,
48 the name argument is required.
49 name -- the name of the algorithm to create. Required when passing a Configurable class object
50 as algClassOrObj. No effect if a Configurable instance is passed.
51 *args, **kwargs -- additional arguments will be forwarded to the Configurable constructor if
52 a Configurable class object is passed. No effect if a Configurable instance
56 algObj -- an algorithm Configurable object
58 from inspect
import isclass
59 if isclass(algClassOrObj):
61 raise TypeError(
'addAlgorithm with a class argument requires a name for the algorithm')
62 algObj = algClassOrObj(name, *args, **kwargs)
64 algObj = algClassOrObj
67 algObj.Environment = self.flags.DQ.Environment
68 algObj.DataType = self.flags.DQ.DataType.value
69 if self.flags.DQ.useTrigger:
70 algObj.TrigDecisionTool = self.resobj.getPublicTool(
"TrigDecisionTool")
72 if self.flags.DQ.enableLumiAccess:
73 algObj.EnableLumi =
True
74 from LumiBlockComps.LuminosityCondAlgConfig
import LuminosityCondAlgCfg
75 self.resobj.merge (LuminosityCondAlgCfg (self.flags))
76 if not self.flags.Input.isMC:
77 from LumiBlockComps.LBDurationCondAlgConfig
import LBDurationCondAlgCfg
78 from LumiBlockComps.TrigLiveFractionCondAlgConfig
import TrigLiveFractionCondAlgCfg
79 self.resobj.merge (LBDurationCondAlgCfg (self.flags))
80 self.resobj.merge (TrigLiveFractionCondAlgCfg (self.flags))
82 algObj.EnableLumi =
False
85 for obj
in addFilterTools:
87 if isinstance(obj, ComponentAccumulator):
88 filter = self.resobj.popToolsAndMerge(obj)
89 elif hasattr(obj,
'getGaudiType')
and obj.getGaudiType() ==
'AlgTool':
92 raise ValueError(f
'Object {obj} passed to addFilterTools is not a ComponentAccumulator or an AlgTool')
93 algObj.FilterTools += [filter]
96 self.resobj.addEventAlgo(algObj, sequenceName=self.monSeq.name)
◆ addArray()
def python.AthMonitorCfgHelper.AthMonitorCfgHelper.addArray |
( |
|
self, |
|
|
|
dimensions, |
|
|
|
alg, |
|
|
|
baseName, |
|
|
|
topPath = '' , |
|
|
|
defaultDuration = 'run' |
|
) |
| |
Add many groups to an algorithm
Arguments:
dimensions -- list holding the size in each dimension [n1,n2,n3,n4,...]
alg -- algorithm Configurable object
baseName -- base name of the group. postfixes are added by GMT Array initialize
topPath -- directory name in the output ROOT file under which histograms will be
produced
duration -- default time between histogram reset for all histograms in group
Returns:
tool -- a GenericMonitoringToolArray object. This is used to define histograms
associated with each group in the array.
Definition at line 125 of file AthMonitorCfgHelper.py.
125 def addArray(self, dimensions, alg, baseName, topPath='', defaultDuration='run'):
126 '''Add many groups to an algorithm
129 dimensions -- list holding the size in each dimension [n1,n2,n3,n4,...]
130 alg -- algorithm Configurable object
131 baseName -- base name of the group. postfixes are added by GMT Array initialize
132 topPath -- directory name in the output ROOT file under which histograms will be
134 duration -- default time between histogram reset for all histograms in group
137 tool -- a GenericMonitoringToolArray object. This is used to define histograms
138 associated with each group in the array.
141 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringArray
142 array = GenericMonitoringArray(self.flags, baseName, dimensions)
145 self.resobj.
merge(acc)
147 pathToSet = self.flags.DQ.FileKey+(
'/%s' % topPath
if topPath
else '')
148 if self.flags.Output.HISTFileName:
149 pathToSet =
'/' + pathToSet
150 array.broadcast(
'HistPath',pathToSet)
151 array.broadcast(
'UseCache',
True)
152 convention =
'ONLINE' if self.flags.Common.isOnline
else 'OFFLINE'
153 array.broadcast(
'convention', convention)
154 array.broadcast(
'defaultDuration',defaultDuration)
156 alg.GMTools += array.toolList()
◆ addGroup()
def python.AthMonitorCfgHelper.AthMonitorCfgHelper.addGroup |
( |
|
self, |
|
|
|
alg, |
|
|
|
name, |
|
|
|
topPath = '' , |
|
|
|
defaultDuration = 'run' |
|
) |
| |
Add a group to an algorithm
Technically, adding a GenericMonitoringTool instance. The name given here can be
used to retrieve the group from within the algorithm when calling the fill()
function. Note this is *not* the same thing as the Monitored::Group class. To
avoid replication of code, this calls the more general case, getArray with an 1D
array of length 1.
Arguments:
alg -- algorithm Configurable object (e.g. one returned from addAlgorithm)
name -- name of the group
topPath -- directory name in the output ROOT file under which histograms will be
produced
defaultDuration -- default time between histogram reset for all histograms in
group; can be overridden for each specific histogram
Returns:
tool -- a GenericMonitoringTool Configurable object. This can be used to define
histograms associated with that group (using defineHistogram).
Definition at line 99 of file AthMonitorCfgHelper.py.
99 def addGroup(self, alg, name, topPath='', defaultDuration='run'):
100 '''Add a group to an algorithm
102 Technically, adding a GenericMonitoringTool instance. The name given here can be
103 used to retrieve the group from within the algorithm when calling the fill()
104 function. Note this is *not* the same thing as the Monitored::Group class. To
105 avoid replication of code, this calls the more general case, getArray with an 1D
109 alg -- algorithm Configurable object (e.g. one returned from addAlgorithm)
110 name -- name of the group
111 topPath -- directory name in the output ROOT file under which histograms will be
113 defaultDuration -- default time between histogram reset for all histograms in
114 group; can be overridden for each specific histogram
117 tool -- a GenericMonitoringTool Configurable object. This can be used to define
118 histograms associated with that group (using defineHistogram).
120 if alg
is not None and name == alg.getName():
121 raise ValueError(f
"Cannot have a monitoring group with the same name as the parent algorithm ({name})")
122 array = self.addArray([1],alg,name,topPath=topPath,defaultDuration=defaultDuration)
◆ result()
def python.AthMonitorCfgHelper.AthMonitorCfgHelper.result |
( |
|
self | ) |
|
Finalize the creation of the set of monitoring algorithms.
Returns:
resobj -- a ComponentAccumulator
Definition at line 159 of file AthMonitorCfgHelper.py.
161 Finalize the creation of the set of monitoring algorithms.
164 resobj -- a ComponentAccumulator
◆ flags
python.AthMonitorCfgHelper.AthMonitorCfgHelper.flags |
◆ monName
python.AthMonitorCfgHelper.AthMonitorCfgHelper.monName |
◆ monSeq
python.AthMonitorCfgHelper.AthMonitorCfgHelper.monSeq |
◆ resobj
python.AthMonitorCfgHelper.AthMonitorCfgHelper.resobj |
The documentation for this class was generated from the following file: