4 A set of config-time tests to be run on the HLT top sequence
8 from AthenaCommon.CFElements
import isSequence
9 from TriggerJobOpts.TriggerConfig
import collectViewMakers
12 """ Make lists of algorithms that run in views, and those that don't """
18 for node
in inputNodes:
24 if node.getName()
in viewNodes.keys():
28 newViewAlgs, dummy =
findViewAlgs( node.getChildren(), {} )
29 viewAlgs += newViewAlgs
32 viewNodes[ node.getName() ] =
True
36 newAlgs, newViewAlgs =
findViewAlgs( node.getChildren(), viewNodes )
38 viewAlgs += newViewAlgs
42 allAlgs += [ node.getName() ]
44 return allAlgs, viewAlgs
47 def checkVDV( inputNodes, ancestorNames, allEVCAs ):
48 """ Try to make sure each VDV has a correctly-configred EVCA upstream """
50 for node
in inputNodes:
53 if "AthViews__ViewDataVerifier" in type( node ).__name__:
57 for name
in ancestorNames:
59 if name
in allEVCAs.keys():
62 parentAllowed = hasattr( allEVCAs[ name ],
"RequireParentView" )
and allEVCAs[ name ].RequireParentView
63 eventLevelAllowed = hasattr( allEVCAs[ name ],
"ViewFallThrough" )
and allEVCAs[ name ].ViewFallThrough
64 if not ( parentAllowed
or eventLevelAllowed ):
65 raise RuntimeError(
"ViewDataVerifier alg " +
node.name() +
" has upstream EventViewCreatorAlgorithm " + allEVCAs[ name ].
name() +
" with no external data" )
70 raise RuntimeError(
"ViewDataVerifier alg " +
node.name() +
" has no corresponding upstream EventViewCreatorAlgorithm" )
73 if "EventViewCreatorAlgorithm" in type( node ).__name__:
76 if node.ViewNodeName
in allEVCAs.keys():
78 raise RuntimeError(
"Found duplicate view node name " + node.ViewNodeName +
" configured for EVCAs " +
node.name() +
" and " + allEVCAs[ node.ViewNodeName ].
name() )
79 allEVCAs[ node.ViewNodeName ] = node
81 if not hasattr(node,
"RoITool"):
82 raise RuntimeError(
"Node name " +
node.name() +
" was not supplied with a RoITool" )
91 """ Run all config tests """
97 for viewMaker
in viewMakers:
98 viewNodes[ viewMaker.ViewNodeName ] =
False
99 originalLength = len( viewNodes )
102 wholeEventAlgs, viewAlgs =
findViewAlgs( inputSequence.getChildren(), viewNodes )
105 if len( viewNodes ) != originalLength:
106 raise RuntimeError(
"Something went wrong with view config inspection" )
107 for viewNode
in viewNodes.keys():
108 if not viewNodes[ viewNode ]:
109 raise RuntimeError(
"EventView CF node " + viewNode +
" was not found attached to the test sequence" )
112 for viewAlgName
in viewAlgs:
113 if viewAlgName
in wholeEventAlgs:
114 from AthenaCommon.AlgSequence
import dumpSequence
116 raise RuntimeError( viewAlgName +
" is attached to an EventView node, but also runs in the whole event context" )
120 checkVDV( inputSequence.getChildren(), [inputSequence.name()], allEVCAs )
123 if len( allEVCAs ) != originalLength:
124 raise RuntimeError(
"EventView creator alg search found different results in structured search (" +
str(originalLength) +
") versus naive search (" +
str( len( allEVCAs ) ) +
"). Implies menu structure error" )