Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 210 of file MenuComponents.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 212 of file MenuComponents.py.

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

◆ __del__()

def MenuComponents.ComboHypoNode.__del__ (   self)

Definition at line 232 of file MenuComponents.py.

232  def __del__(self):
233  self.acc.wasMerged()
234 

Member Function Documentation

◆ __repr__()

def MenuComponents.AlgNode.__repr__ (   self)
inherited

Reimplemented from MenuComponents.Node.

Reimplemented in MenuComponents.HypoAlgNode.

Definition at line 123 of file MenuComponents.py.

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

◆ addChain()

def MenuComponents.ComboHypoNode.addChain (   self,
  chainDict 
)

Definition at line 256 of file MenuComponents.py.

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

◆ addDefaultOutput()

def MenuComponents.AlgNode.addDefaultOutput (   self)
inherited

Definition at line 62 of file MenuComponents.py.

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

◆ addInput()

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

Reimplemented from MenuComponents.Node.

Definition at line 106 of file MenuComponents.py.

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

◆ addOutput()

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

Reimplemented from MenuComponents.Node.

Reimplemented in MenuComponents.HypoAlgNode.

Definition at line 90 of file MenuComponents.py.

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

◆ create()

def MenuComponents.ComboHypoNode.create (   self,
  name 
)

Definition at line 235 of file MenuComponents.py.

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

◆ createComboHypoTools()

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

Definition at line 290 of file MenuComponents.py.

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

◆ getChains()

def MenuComponents.ComboHypoNode.getChains (   self)

Definition at line 285 of file MenuComponents.py.

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

◆ getInputList()

def MenuComponents.Node.getInputList (   self)
inherited

Definition at line 47 of file MenuComponents.py.

47  def getInputList(self):
48  return self.inputs
49 

◆ getOutputList()

def MenuComponents.Node.getOutputList (   self)
inherited

Definition at line 44 of file MenuComponents.py.

44  def getOutputList(self):
45  return self.outputs
46 

◆ getPar()

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

Definition at line 81 of file MenuComponents.py.

81  def getPar(self, prop):
82  return getattr(self.Alg, prop)
83 

◆ mapRawInputsToInputsIndex()

def MenuComponents.ComboHypoNode.mapRawInputsToInputsIndex (   self)

Definition at line 248 of file MenuComponents.py.

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

◆ readInputList()

def MenuComponents.AlgNode.readInputList (   self)
inherited

Definition at line 118 of file MenuComponents.py.

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

◆ readOutputList()

def MenuComponents.AlgNode.readOutputList (   self)
inherited

Definition at line 101 of file MenuComponents.py.

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

◆ resetInput()

def MenuComponents.AlgNode.resetInput (   self)
inherited

Definition at line 87 of file MenuComponents.py.

87  def resetInput(self):
88  self.resetPar(self.inputProp)
89 

◆ resetOutput()

def MenuComponents.AlgNode.resetOutput (   self)
inherited

Definition at line 84 of file MenuComponents.py.

84  def resetOutput(self):
85  self.resetPar(self.outputProp)
86 

◆ resetPar()

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

Definition at line 74 of file MenuComponents.py.

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

◆ setPar()

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

Definition at line 66 of file MenuComponents.py.

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

Member Data Documentation

◆ acc

MenuComponents.ComboHypoNode.acc

Definition at line 216 of file MenuComponents.py.

◆ Alg

MenuComponents.Node.Alg
inherited

Definition at line 34 of file MenuComponents.py.

◆ comboHypoCfg

MenuComponents.ComboHypoNode.comboHypoCfg

Definition at line 215 of file MenuComponents.py.

◆ inputProp

MenuComponents.AlgNode.inputProp
inherited

Definition at line 60 of file MenuComponents.py.

◆ inputs

MenuComponents.Node.inputs
inherited

Definition at line 35 of file MenuComponents.py.

◆ name

MenuComponents.Node.name
inherited

Definition at line 33 of file MenuComponents.py.

◆ outputProp

MenuComponents.AlgNode.outputProp
inherited

Definition at line 59 of file MenuComponents.py.

◆ outputs

MenuComponents.Node.outputs
inherited

Definition at line 36 of file MenuComponents.py.

◆ prop1

MenuComponents.ComboHypoNode.prop1

Definition at line 213 of file MenuComponents.py.

◆ prop2

MenuComponents.ComboHypoNode.prop2

Definition at line 214 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:50
python.TrigConfigSvcUtils.getChains
def getChains(connection, smk)
Definition: TrigConfigSvcUtils.py:592
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
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
str
Definition: BTagTrackIpAccessor.cxx:11