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 88 of file HLTCFComponents.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 92 of file HLTCFComponents.py.

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

Member Function Documentation

◆ __repr__()

def HLTCFComponents.CFSequence.__repr__ (   self)

Definition at line 161 of file HLTCFComponents.py.

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

◆ connectCombo()

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

Definition at line 132 of file HLTCFComponents.py.

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

◆ findComboHypoAlg()

def HLTCFComponents.CFSequence.findComboHypoAlg (   self)

Definition at line 158 of file HLTCFComponents.py.

158  def findComboHypoAlg(self):
159  return findAlgorithmByPredicate(self.seq, lambda alg: alg.name == self.step.Alg.name and isComboHypoAlg(alg))
160 

◆ mergeStepSequences()

def HLTCFComponents.CFSequence.mergeStepSequences (   self,
  chainStep 
)

Definition at line 149 of file HLTCFComponents.py.

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

◆ 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 121 of file HLTCFComponents.py.

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

Member Data Documentation

◆ ca

HLTCFComponents.CFSequence.ca

Definition at line 97 of file HLTCFComponents.py.

◆ decisions

HLTCFComponents.CFSequence.decisions

Definition at line 123 of file HLTCFComponents.py.

◆ filterNode

HLTCFComponents.CFSequence.filterNode

Definition at line 94 of file HLTCFComponents.py.

◆ seq

HLTCFComponents.CFSequence.seq

Definition at line 101 of file HLTCFComponents.py.

◆ step

HLTCFComponents.CFSequence.step

Definition at line 95 of file HLTCFComponents.py.

◆ stepReco

HLTCFComponents.CFSequence.stepReco

Definition at line 104 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:102
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