ATLAS Offline Software
Loading...
Searching...
No Matches
MenuComponents.ComboHypoNode Class Reference
Inheritance diagram for MenuComponents.ComboHypoNode:
Collaboration diagram for MenuComponents.ComboHypoNode:

Public Member Functions

 __init__ (self, name, comboHypoCfg)
 __del__ (self)
 create (self, name)
 mapRawInputsToInputsIndex (self)
 addChain (self, chainDict)
 getChains (self)
 createComboHypoTools (self, flags, chainDict, comboToolConfs)
 setPar (self, propname, value)
 addOutput (self, name)
 readOutputList (self)
 addInput (self, name)
 readInputList (self)
 __repr__ (self)
 getOutputList (self)
 getInputList (self)

Public Attributes

 comboHypoCfg = comboHypoCfg
 acc = self.create( name )
 outputProp = outputProp
 inputProp = inputProp
tuple name = ("%sNode")%( Alg.getName() )
 Alg = Alg
list inputs = []
list outputs = []

Detailed Description

AlgNode for Combo HypoAlgs

Definition at line 178 of file MenuComponents.py.

Constructor & Destructor Documentation

◆ __init__()

MenuComponents.ComboHypoNode.__init__ ( self,
name,
comboHypoCfg )

Definition at line 180 of file MenuComponents.py.

180 def __init__(self, name, comboHypoCfg):
181 self.comboHypoCfg = comboHypoCfg
182 self.acc = self.create( name )
183 thealgs= self.acc.getEventAlgos()
184 if thealgs is None:
185 log.error("ComboHypoNode: Combo alg %s not found", name)
186 if len(thealgs) != 1:
187 log.error("ComboHypoNode: Combo alg %s len is %d",name, len(thealgs))
188 Alg=thealgs[0]
189
190 log.debug("ComboHypoNode init: Alg %s", name)
191 AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions')
192

◆ __del__()

MenuComponents.ComboHypoNode.__del__ ( self)

Definition at line 193 of file MenuComponents.py.

193 def __del__(self):
194 self.acc.wasMerged()
195

Member Function Documentation

◆ __repr__()

MenuComponents.AlgNode.__repr__ ( self)
inherited

Definition at line 98 of file MenuComponents.py.

98 def __repr__(self):
99 return "Alg::%s [%s] -> [%s]"%(self.Alg.getName(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
100
101
STL class.

◆ addChain()

MenuComponents.ComboHypoNode.addChain ( self,
chainDict )

Definition at line 217 of file MenuComponents.py.

217 def addChain(self, chainDict):
218 chainName = chainDict['chainName']
219 chainMult = chainDict['chainMultiplicities']
220 legsToInputCollections = self.mapRawInputsToInputsIndex()
221 if len(chainMult) != len(legsToInputCollections):
222 log.error("ComboHypoNode for Alg:{} with addChain for:{} Chain multiplicity:{} Per leg input collection index:{}."
223 .format(self.Alg.name, chainName, tuple(chainMult), tuple(legsToInputCollections)))
224 log.error("The size of the multiplicies vector must be the same size as the per leg input collection vector.")
225 log.error("The ComboHypo needs to know which input DecisionContainers contain the DecisionObjects to be used for each leg.")
226 log.error("Check why ComboHypoNode.addInput(...) was not called exactly once per leg.")
227 raise Exception("[createDataFlow] Error in ComboHypoNode.addChain. Cannot proceed.")
228
229 if chainName in self.Alg.MultiplicitiesMap:
230 log.error("ComboAlg %s has already been configured for chain %s", self.Alg.name, chainName)
231 raise Exception("[createDataFlow] Error in ComboHypoNode.addChain. Cannot proceed.")
232 else:
233 self.Alg.MultiplicitiesMap[chainName] = chainMult
234 self.Alg.LegToInputCollectionMap[chainName] = legsToInputCollections
235
236

◆ addInput()

MenuComponents.AlgNode.addInput ( self,
name )
inherited

Reimplemented from MenuComponents.Node.

Definition at line 81 of file MenuComponents.py.

81 def addInput(self, name):
82 inputs = self.readInputList()
83 if name in inputs:
84 log.debug("Input DH not added in %s: %s already set!", self.Alg.getName(), name)
85 else:
86 if self.inputProp != '':
87 self.setPar(self.inputProp, name)
88 else:
89 log.debug("no InputProp set for input of %s", self.Alg.getName())
90 Node.addInput(self, name)
91 return len(self.readInputList())
92

◆ addOutput()

MenuComponents.AlgNode.addOutput ( self,
name )
inherited

Reimplemented from MenuComponents.Node.

Reimplemented in MenuComponents.HypoAlgNode.

Definition at line 65 of file MenuComponents.py.

65 def addOutput(self, name):
66 outputs = self.readOutputList()
67 if name in outputs:
68 log.debug("Output DH not added in %s: %s already set!", self.Alg.getName(), name)
69 else:
70 if self.outputProp != '':
71 self.setPar(self.outputProp, name)
72 else:
73 log.debug("no outputProp set for output of %s", self.Alg.getName())
74 Node.addOutput(self, name)
75

◆ create()

MenuComponents.ComboHypoNode.create ( self,
name )

Definition at line 196 of file MenuComponents.py.

196 def create (self, name):
197 log.debug("ComboHypoNode.create %s",name)
198 return self.comboHypoCfg(name=name)
199

◆ createComboHypoTools()

MenuComponents.ComboHypoNode.createComboHypoTools ( self,
flags,
chainDict,
comboToolConfs )
Create the ComboHypoTools and add them to the main alg

Definition at line 241 of file MenuComponents.py.

241 def createComboHypoTools(self, flags, chainDict, comboToolConfs):
242 """Create the ComboHypoTools and add them to the main alg"""
243 if len(comboToolConfs)==0:
244 return
245 log.debug("ComboHypoNode.createComboHypoTools for chain %s, Alg %s with %d tools",
246 chainDict["chainName"], self.Alg.getName(), len(comboToolConfs))
247 for tool in comboToolConfs:
248 conf = HypoToolConf( tool )
249 log.debug("ComboHypoNode.createComboHypoTools adding %s", conf)
250 self.Alg.ComboHypoTools.append(conf.confAndCreate( flags, chainDict ))
251
252

◆ getChains()

MenuComponents.ComboHypoNode.getChains ( self)

Definition at line 237 of file MenuComponents.py.

237 def getChains(self):
238 return self.Alg.MultiplicitiesMap.keys()
239
240

◆ getInputList()

MenuComponents.Node.getInputList ( self)
inherited

Definition at line 42 of file MenuComponents.py.

42 def getInputList(self):
43 return self.inputs
44

◆ getOutputList()

MenuComponents.Node.getOutputList ( self)
inherited

Definition at line 39 of file MenuComponents.py.

39 def getOutputList(self):
40 return self.outputs
41

◆ mapRawInputsToInputsIndex()

MenuComponents.ComboHypoNode.mapRawInputsToInputsIndex ( self)

Definition at line 209 of file MenuComponents.py.

209 def mapRawInputsToInputsIndex(self):
210 mapping = []
211 theInputs = self.readInputList() #only unique inputs
212 for rawInput in self.inputs: # all inputs
213 mapping.append( theInputs.index(rawInput) )
214 return mapping
215
216

◆ readInputList()

MenuComponents.AlgNode.readInputList ( self)
inherited

Definition at line 93 of file MenuComponents.py.

93 def readInputList(self):
94 cval = getattr(self.Alg, self.inputProp)
95 return (cval if isinstance(cval, MutableSequence) else
96 ([str(cval)] if cval else []))
97

◆ readOutputList()

MenuComponents.AlgNode.readOutputList ( self)
inherited

Definition at line 76 of file MenuComponents.py.

76 def readOutputList(self):
77 cval = getattr(self.Alg, self.outputProp)
78 return (cval if isinstance(cval, MutableSequence) else
79 ([str(cval)] if cval else []))
80

◆ setPar()

MenuComponents.AlgNode.setPar ( self,
propname,
value )
inherited

Definition at line 57 of file MenuComponents.py.

57 def setPar(self, propname, value):
58 cval = getattr( self.Alg, propname)
59 if isinstance(cval, MutableSequence):
60 cval.append(value)
61 return setattr(self.Alg, propname, cval)
62 else:
63 return setattr(self.Alg, propname, value)
64

Member Data Documentation

◆ acc

MenuComponents.ComboHypoNode.acc = self.create( name )

Definition at line 182 of file MenuComponents.py.

◆ Alg

MenuComponents.Node.Alg = Alg
inherited

Definition at line 29 of file MenuComponents.py.

◆ comboHypoCfg

MenuComponents.ComboHypoNode.comboHypoCfg = comboHypoCfg

Definition at line 181 of file MenuComponents.py.

◆ inputProp

MenuComponents.AlgNode.inputProp = inputProp
inherited

Definition at line 55 of file MenuComponents.py.

◆ inputs

list MenuComponents.Node.inputs = []
inherited

Definition at line 30 of file MenuComponents.py.

◆ name

tuple MenuComponents.Node.name = ("%sNode")%( Alg.getName() )
inherited

Definition at line 28 of file MenuComponents.py.

◆ outputProp

MenuComponents.AlgNode.outputProp = outputProp
inherited

Definition at line 54 of file MenuComponents.py.

◆ outputs

list MenuComponents.Node.outputs = []
inherited

Definition at line 31 of file MenuComponents.py.


The documentation for this class was generated from the following file: