ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
HLTCFComponents.CFSequence Class Reference

CFSequence class. More...

Inheritance diagram for HLTCFComponents.CFSequence:
Collaboration diagram for HLTCFComponents.CFSequence:

Public Member Functions

def __init__ (self, ChainStep, FilterAlg)
 
def setDecisions (self)
 
def connectCombo (self)
 
def mergeStepSequences (self, chainStep)
 
def findComboHypoAlg (self)
 
def __repr__ (self)
 

Public Attributes

 filterNode
 
 step
 
 ca
 
 seq
 
 stepReco
 
 decisions
 

Detailed Description

CFSequence class.

Class to describe the flow of decisions through ChainStep + filter with their connections (input, output)
A Filter can have more than one input/output if used in different chains, so this class stores and manages all of them (when doing the connect)

Definition at line 91 of file HLTCFComponents.py.

Constructor & Destructor Documentation

◆ __init__()

def HLTCFComponents.CFSequence.__init__ (   self,
  ChainStep,
  FilterAlg 
)

Definition at line 95 of file HLTCFComponents.py.

95  def __init__(self, ChainStep, FilterAlg):
96  log.debug(" *** Create CFSequence %s with Filter %s", ChainStep.name, FilterAlg.Alg.getName())
97  self.filterNode = FilterAlg
98  self.step = ChainStep
99 
100  self.ca = ComponentAccumulator()
101  #empty step: add the PassSequence, one instance only is appended to the tree
102  seqAndWithFilter = FilterAlg.Alg if ChainStep.isEmpty else seqAND(ChainStep.name)
103  self.ca.addSequence(seqAndWithFilter)
104  self.seq = seqAndWithFilter
105  if not ChainStep.isEmpty:
106  self.ca.addEventAlgo(FilterAlg.Alg, sequenceName=seqAndWithFilter.getName())
107  self.stepReco = parOR(ChainStep.name + CFNaming.RECO_POSTFIX)
108  # all reco algorithms from all the sequences in a parallel sequence
109  self.ca.addSequence(self.stepReco, parentName=seqAndWithFilter.getName())
110  log.debug("created parOR %s inside seqAND %s ", self.stepReco.getName(), seqAndWithFilter.getName())
111  self.mergeStepSequences(ChainStep)
112  # merge the Hypoalg (before the Combo)
113  for menuseq in ChainStep.sequences:
114  if not isinstance(menuseq, EmptyMenuSequence):
115  self.ca.merge(menuseq.hypoAcc, sequenceName=seqAndWithFilter.getName())
116 
117  self.connectCombo()
118  self.setDecisions()
119  if self.step.combo is not None:
120  self.ca.merge(self.step.combo.acc, sequenceName=seqAndWithFilter.getName())
121  log.debug("CFSequence.__init: created %s ",self)
122 
123 

Member Function Documentation

◆ __repr__()

def HLTCFComponents.CFSequence.__repr__ (   self)

Definition at line 164 of file HLTCFComponents.py.

164  def __repr__(self):
165  return "--- CFSequence ---\n + Filter: %s \n + decisions: %s\n + %s \n"%(\
166  self.filterNode.Alg.name, self.decisions, self.step)
167 
168 
169 
170 

◆ connectCombo()

def HLTCFComponents.CFSequence.connectCombo (   self)
connect Combo to Hypos

Definition at line 135 of file HLTCFComponents.py.

135  def connectCombo(self):
136  """ connect Combo to Hypos"""
137  if self.step.combo is None:
138  log.debug("CFSequence.connectCombo: no Combo found")
139  return
140 
141  for seq in self.step.sequences:
142  combo_input=seq.getOutputList()[0]
143  self.step.combo.addInput(combo_input)
144  inputs = self.step.combo.readInputList()
145  legindex = inputs.index(combo_input)
146  log.debug("CFSequence.connectCombo: adding input to %s: %s", self.step.combo.Alg.getName(), combo_input)
147  # inputs are the output decisions of the hypos of the sequences
148  combo_output=CFNaming.comboHypoOutputName (self.step.combo.Alg.getName(), legindex)
149  self.step.combo.addOutput(combo_output)
150  log.debug("CFSequence.connectCombo: adding output to %s: %s", self.step.combo.Alg.getName(), combo_output)
151 

◆ findComboHypoAlg()

def HLTCFComponents.CFSequence.findComboHypoAlg (   self)

Definition at line 161 of file HLTCFComponents.py.

161  def findComboHypoAlg(self):
162  return findAlgorithmByPredicate(self.seq, lambda alg: alg.name == self.step.Alg.name and isComboHypoAlg(alg))
163 

◆ mergeStepSequences()

def HLTCFComponents.CFSequence.mergeStepSequences (   self,
  chainStep 
)

Definition at line 152 of file HLTCFComponents.py.

152  def mergeStepSequences(self, chainStep):
153  for menuseq in chainStep.sequences:
154  try:
155  self.ca.merge(menuseq.ca, sequenceName=self.stepReco.getName())
156  except Exception as e:
157  log.error(f'Failed to merge into {self.stepReco.getName()}')
158  raise e
159 

◆ setDecisions()

def HLTCFComponents.CFSequence.setDecisions (   self)
Set the output decision of this CFSequence as the hypo outputdecision; In case of combo, takes the Combo outputs

Definition at line 124 of file HLTCFComponents.py.

124  def setDecisions(self):
125  """ Set the output decision of this CFSequence as the hypo outputdecision; In case of combo, takes the Combo outputs"""
126  self.decisions=[]
127  # empty steps:
128  if self.step.combo is None:
129  self.decisions.extend(self.filterNode.getOutputList())
130  else:
131  self.decisions.extend(self.step.combo.getOutputList())
132  log.debug("CFSequence: set out decisions: %s", self.decisions)
133 
134 

Member Data Documentation

◆ ca

HLTCFComponents.CFSequence.ca

Definition at line 100 of file HLTCFComponents.py.

◆ decisions

HLTCFComponents.CFSequence.decisions

Definition at line 126 of file HLTCFComponents.py.

◆ filterNode

HLTCFComponents.CFSequence.filterNode

Definition at line 97 of file HLTCFComponents.py.

◆ seq

HLTCFComponents.CFSequence.seq

Definition at line 104 of file HLTCFComponents.py.

◆ step

HLTCFComponents.CFSequence.step

Definition at line 98 of file HLTCFComponents.py.

◆ stepReco

HLTCFComponents.CFSequence.stepReco

Definition at line 107 of file HLTCFComponents.py.


The documentation for this class was generated from the following file:
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.CFElements.findAlgorithmByPredicate
def findAlgorithmByPredicate(startSequence, predicate, depth=1000000)
Definition: CFElements.py:126
dumpTruth.getName
getName
Definition: dumpTruth.py:34
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
python.JetAnalysisCommon.parOR
parOR
Definition: JetAnalysisCommon.py:271
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
ActsTrk::detail::MakeDerivedVariant::extend
constexpr std::variant< Args..., T > extend(const std::variant< Args... > &, const T &)
Definition: MakeDerivedVariant.h:17
HLTCFTools.isComboHypoAlg
def isComboHypoAlg(alg)
Definition: HLTCFTools.py:49
merge
Definition: merge.py:1