ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
MenuComponents.ComboHypoNode Class Reference
Inheritance diagram for MenuComponents.ComboHypoNode:
Collaboration diagram for MenuComponents.ComboHypoNode:

Public Member Functions

def __init__ (self, name, comboHypoCfg)
 
def __del__ (self)
 
def create (self, name)
 
def mapRawInputsToInputsIndex (self)
 
def addChain (self, chainDict)
 
def getChains (self)
 
def createComboHypoTools (self, flags, chainDict, comboToolConfs)
 
def addDefaultOutput (self)
 
def setPar (self, propname, value)
 
def resetPar (self, prop)
 
def getPar (self, prop)
 
def resetOutput (self)
 
def resetInput (self)
 
def addOutput (self, name)
 
def readOutputList (self)
 
def addInput (self, name)
 
def readInputList (self)
 
def __repr__ (self)
 
def getOutputList (self)
 
def getInputList (self)
 

Public Attributes

 prop1
 
 prop2
 
 comboHypoCfg
 
 acc
 
 outputProp
 
 inputProp
 
 name
 
 Alg
 
 inputs
 
 outputs
 

Detailed Description

AlgNode for Combo HypoAlgs

Definition at line 208 of file MenuComponents.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 210 of file MenuComponents.py.

210  def __init__(self, name, comboHypoCfg):
211  self.prop1 = "MultiplicitiesMap"
212  self.prop2 = "LegToInputCollectionMap"
213  self.comboHypoCfg = comboHypoCfg
214  self.acc = self.create( name )
215  thealgs= self.acc.getEventAlgos()
216  if thealgs is None:
217  log.error("ComboHypoNode: Combo alg %s not found", name)
218  if len(thealgs) != 1:
219  log.error("ComboHypoNode: Combo alg %s len is %d",name, len(thealgs))
220  Alg=thealgs[0]
221 
222  log.debug("ComboHypoNode init: Alg %s", name)
223  AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions')
224  self.resetInput()
225  self.resetOutput()
227  setattr(self.Alg, self.prop1, {})
228  setattr(self.Alg, self.prop2, {})
229 

◆ __del__()

def MenuComponents.ComboHypoNode.__del__ (   self)

Definition at line 230 of file MenuComponents.py.

230  def __del__(self):
231  self.acc.wasMerged()
232 

Member Function Documentation

◆ __repr__()

def MenuComponents.AlgNode.__repr__ (   self)
inherited

Reimplemented from MenuComponents.Node.

Reimplemented in MenuComponents.HypoAlgNode.

Definition at line 121 of file MenuComponents.py.

121  def __repr__(self):
122  return "Alg::%s [%s] -> [%s]"%(self.Alg.getName(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
123 
124 

◆ addChain()

def MenuComponents.ComboHypoNode.addChain (   self,
  chainDict 
)

Definition at line 254 of file MenuComponents.py.

254  def addChain(self, chainDict):
255  chainName = chainDict['chainName']
256  chainMult = chainDict['chainMultiplicities']
257  legsToInputCollections = self.mapRawInputsToInputsIndex()
258  if len(chainMult) != len(legsToInputCollections):
259  log.error("ComboHypoNode for Alg:{} with addChain for:{} Chain multiplicity:{} Per leg input collection index:{}."
260  .format(self.Alg.name, chainName, tuple(chainMult), tuple(legsToInputCollections)))
261  log.error("The size of the multiplicies vector must be the same size as the per leg input collection vector.")
262  log.error("The ComboHypo needs to know which input DecisionContainers contain the DecisionObjects to be used for each leg.")
263  log.error("Check why ComboHypoNode.addInput(...) was not called exactly once per leg.")
264  raise Exception("[createDataFlow] Error in ComboHypoNode.addChain. Cannot proceed.")
265 
266  cval1 = getattr(self.Alg, self.prop1) # check necessary to see if chain was added already?
267  cval2 = getattr(self.Alg, self.prop2)
268  if type(cval1) is dict or isinstance(cval1, GaudiConfig2.semantics._DictHelper):
269  if chainName in cval1.keys():
270  log.error("ERROR in configuration: ComboAlg %s has already been configured for chain %s", self.Alg.name, chainName)
271  raise Exception("[createDataFlow] Error in ComboHypoNode.addChain. Cannot proceed.")
272  else:
273  cval1[chainName] = chainMult
274  cval2[chainName] = legsToInputCollections
275  else:
276  cval1 = {chainName : chainMult}
277  cval2 = {chainName : legsToInputCollections}
278 
279  setattr(self.Alg, self.prop1, cval1)
280  setattr(self.Alg, self.prop2, cval2)
281 
282 

◆ addDefaultOutput()

def MenuComponents.AlgNode.addDefaultOutput (   self)
inherited

Definition at line 60 of file MenuComponents.py.

60  def addDefaultOutput(self):
61  if self.outputProp != '':
62  self.addOutput(("%s_%s"%(self.Alg.getName(),self.outputProp)))
63 

◆ addInput()

def MenuComponents.AlgNode.addInput (   self,
  name 
)
inherited

Reimplemented from MenuComponents.Node.

Definition at line 104 of file MenuComponents.py.

104  def addInput(self, name):
105  inputs = self.readInputList()
106  if name in inputs:
107  log.debug("Input DH not added in %s: %s already set!", self.Alg.getName(), name)
108  else:
109  if self.inputProp != '':
110  self.setPar(self.inputProp, name)
111  else:
112  log.debug("no InputProp set for input of %s", self.Alg.getName())
113  Node.addInput(self, name)
114  return len(self.readInputList())
115 

◆ addOutput()

def MenuComponents.AlgNode.addOutput (   self,
  name 
)
inherited

Reimplemented from MenuComponents.Node.

Reimplemented in MenuComponents.HypoAlgNode.

Definition at line 88 of file MenuComponents.py.

88  def addOutput(self, name):
89  outputs = self.readOutputList()
90  if name in outputs:
91  log.debug("Output DH not added in %s: %s already set!", self.Alg.getName(), name)
92  else:
93  if self.outputProp != '':
94  self.setPar(self.outputProp, name)
95  else:
96  log.debug("no outputProp set for output of %s", self.Alg.getName())
97  Node.addOutput(self, name)
98 

◆ create()

def MenuComponents.ComboHypoNode.create (   self,
  name 
)

Definition at line 233 of file MenuComponents.py.

233  def create (self, name):
234  log.debug("ComboHypoNode.create %s",name)
235  return self.comboHypoCfg(name=name)
236 

◆ createComboHypoTools()

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

Definition at line 288 of file MenuComponents.py.

288  def createComboHypoTools(self, flags, chainDict, comboToolConfs):
289  """Create the ComboHypoTools and add them to the main alg"""
290  if not len(comboToolConfs):
291  return
292  confs = [ HypoToolConf( tool ) for tool in comboToolConfs ]
293  log.debug("ComboHypoNode.createComboHypoTools for chain %s, Alg %s with %d tools", chainDict["chainName"],self.Alg.getName(), len(comboToolConfs))
294  for conf in confs:
295  log.debug("ComboHypoNode.createComboHypoTools adding %s", conf)
296  tools = self.Alg.ComboHypoTools
297  self.Alg.ComboHypoTools = tools + [ conf.confAndCreate( flags, chainDict ) ]
298 
299 

◆ getChains()

def MenuComponents.ComboHypoNode.getChains (   self)

Definition at line 283 of file MenuComponents.py.

283  def getChains(self):
284  cval = getattr(self.Alg, self.prop1)
285  return cval.keys()
286 
287 

◆ getInputList()

def MenuComponents.Node.getInputList (   self)
inherited

Definition at line 45 of file MenuComponents.py.

45  def getInputList(self):
46  return self.inputs
47 

◆ getOutputList()

def MenuComponents.Node.getOutputList (   self)
inherited

Definition at line 42 of file MenuComponents.py.

42  def getOutputList(self):
43  return self.outputs
44 

◆ getPar()

def MenuComponents.AlgNode.getPar (   self,
  prop 
)
inherited

Definition at line 79 of file MenuComponents.py.

79  def getPar(self, prop):
80  return getattr(self.Alg, prop)
81 

◆ mapRawInputsToInputsIndex()

def MenuComponents.ComboHypoNode.mapRawInputsToInputsIndex (   self)

Definition at line 246 of file MenuComponents.py.

246  def mapRawInputsToInputsIndex(self):
247  mapping = []
248  theInputs = self.readInputList() #only unique inputs
249  for rawInput in self.inputs: # all inputs
250  mapping.append( theInputs.index(rawInput) )
251  return mapping
252 
253 

◆ readInputList()

def MenuComponents.AlgNode.readInputList (   self)
inherited

Definition at line 116 of file MenuComponents.py.

116  def readInputList(self):
117  cval = self.getPar(self.inputProp)
118  return (cval if isinstance(cval, MutableSequence) else
119  ([str(cval)] if cval else []))
120 

◆ readOutputList()

def MenuComponents.AlgNode.readOutputList (   self)
inherited

Definition at line 99 of file MenuComponents.py.

99  def readOutputList(self):
100  cval = self.getPar(self.outputProp)
101  return (cval if isinstance(cval, MutableSequence) else
102  ([str(cval)] if cval else []))
103 

◆ resetInput()

def MenuComponents.AlgNode.resetInput (   self)
inherited

Definition at line 85 of file MenuComponents.py.

85  def resetInput(self):
86  self.resetPar(self.inputProp)
87 

◆ resetOutput()

def MenuComponents.AlgNode.resetOutput (   self)
inherited

Definition at line 82 of file MenuComponents.py.

82  def resetOutput(self):
83  self.resetPar(self.outputProp)
84 

◆ resetPar()

def MenuComponents.AlgNode.resetPar (   self,
  prop 
)
inherited

Definition at line 72 of file MenuComponents.py.

72  def resetPar(self, prop):
73  cval = getattr(self.Alg, prop)
74  if isinstance(cval, MutableSequence):
75  return setattr(self.Alg, prop, [])
76  else:
77  return setattr(self.Alg, prop, "")
78 

◆ setPar()

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

Definition at line 64 of file MenuComponents.py.

64  def setPar(self, propname, value):
65  cval = getattr( self.Alg, propname)
66  if isinstance(cval, MutableSequence):
67  cval.append(value)
68  return setattr(self.Alg, propname, cval)
69  else:
70  return setattr(self.Alg, propname, value)
71 

Member Data Documentation

◆ acc

MenuComponents.ComboHypoNode.acc

Definition at line 214 of file MenuComponents.py.

◆ Alg

MenuComponents.Node.Alg
inherited

Definition at line 32 of file MenuComponents.py.

◆ comboHypoCfg

MenuComponents.ComboHypoNode.comboHypoCfg

Definition at line 213 of file MenuComponents.py.

◆ inputProp

MenuComponents.AlgNode.inputProp
inherited

Definition at line 58 of file MenuComponents.py.

◆ inputs

MenuComponents.Node.inputs
inherited

Definition at line 33 of file MenuComponents.py.

◆ name

MenuComponents.Node.name
inherited

Definition at line 31 of file MenuComponents.py.

◆ outputProp

MenuComponents.AlgNode.outputProp
inherited

Definition at line 57 of file MenuComponents.py.

◆ outputs

MenuComponents.Node.outputs
inherited

Definition at line 34 of file MenuComponents.py.

◆ prop1

MenuComponents.ComboHypoNode.prop1

Definition at line 211 of file MenuComponents.py.

◆ prop2

MenuComponents.ComboHypoNode.prop2

Definition at line 212 of file MenuComponents.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
detail::addInput
void addInput(T &c, const Primitive &input, A a=defaultAccessor< T >)
Definition: PrimitiveHelpers.h:49
python.TrigConfigSvcUtils.getChains
def getChains(connection, smk)
Definition: TrigConfigSvcUtils.py:592
dumpTruth.getName
getName
Definition: dumpTruth.py:34
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.AthDsoLogger.__del__
def __del__(self)
Definition: AthDsoLogger.py:82
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
str
Definition: BTagTrackIpAccessor.cxx:11