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 | Private Attributes | List of all members
python.ConfigAccumulator.ConfigAccumulator Class Reference
Collaboration diagram for python.ConfigAccumulator.ConfigAccumulator:

Public Member Functions

def __init__ (self, algSeq, dataType=None, isPhyslite=False, geometry=None, dsid=0, campaign=None, runNumber=None, autoconfigFromFlags=None, noSysSuffix=False, noSystematics=None, dataYear=0)
 
def noSystematics (self)
 
def autoconfigFlags (self)
 
def dataType (self)
 
def isPhyslite (self)
 
def geometry (self)
 
def dsid (self)
 
def campaign (self)
 
def runNumber (self)
 
def dataYear (self)
 
def generatorInfo (self)
 
def hltSummary (self)
 
def createAlgorithm (self, type, name, reentrant=False)
 
def createService (self, type, name)
 
def createPublicTool (self, type, name)
 
def addPrivateTool (self, propertyName, toolType)
 
def setSourceName (self, containerName, sourceName, *originalName=None, isMet=False)
 
def writeName (self, containerName, *isMet=None)
 
def readName (self, containerName)
 
def copyName (self, containerName)
 
def wantCopy (self, containerName)
 
def originalName (self, containerName)
 
def getContainerMeta (self, containerName, metaField, defaultValue=None, *failOnMiss=False)
 
def setContainerMeta (self, containerName, metaField, value, *allowOverwrite=False)
 
def isMetContainer (self, containerName)
 
def readNameAndSelection (self, containerName, *excludeFrom=None)
 
def nextPass (self)
 
def getPreselection (self, containerName, selectionName, *asList=False)
 
def getFullSelection (self, containerName, selectionName, *skipBase=False, excludeFrom=None)
 
def getSelectionCutFlow (self, containerName, selectionName)
 
def addEventCutFlow (self, selection, decorations)
 
def getEventCutFlow (self, selection)
 
def addSelection (self, containerName, selectionName, decoration, **kwargs)
 
def addOutputContainer (self, containerName, outputContainerName)
 
def checkOutputContainer (self, containerName)
 
def getOutputContainerOrigin (self, outputContainerName)
 
def addOutputVar (self, containerName, variableName, outputName, *noSys=False, enabled=True)
 
def getOutputVars (self, containerName)
 
def getSelectionNames (self, containerName, excludeFrom=None)
 

Public Attributes

 CA
 

Private Attributes

 _autoconfigFlags
 
 _dataType
 
 _isPhyslite
 
 _geometry
 
 _dsid
 
 _campaign
 
 _runNumber
 
 _dataYear
 
 _generatorInfo
 
 _algSeq
 
 _noSystematics
 
 _noSysSuffix
 
 _containerConfig
 
 _outputContainers
 
 _pass
 
 _algorithms
 
 _currentAlg
 
 _selectionNameExpr
 
 _eventcutflow
 
 _hltSummary
 

Detailed Description

a class that accumulates a configuration from blocks into an
algorithm sequence

This is used as argument to the ConfigurationBlock methods, which
need to be called in the correct order.  This class will track all
meta-information that needs to be communicated between blocks
during configuration, and also add the created algorithms to the
sequence.

Use/access of containers in the event store is handled via
references that this class hands out.  This happens in a separate
step before the algorithms are created, as the naming of
containers will depend on where in the chain the container is
used.

Definition at line 95 of file ConfigAccumulator.py.

Constructor & Destructor Documentation

◆ __init__()

def python.ConfigAccumulator.ConfigAccumulator.__init__ (   self,
  algSeq,
  dataType = None,
  isPhyslite = False,
  geometry = None,
  dsid = 0,
  campaign = None,
  runNumber = None,
  autoconfigFromFlags = None,
  noSysSuffix = False,
  noSystematics = None,
  dataYear = 0 
)

Definition at line 112 of file ConfigAccumulator.py.

112  def __init__ (self, algSeq, dataType=None, isPhyslite=False, geometry=None, dsid=0,
113  campaign=None, runNumber=None, autoconfigFromFlags=None, noSysSuffix=False,
114  noSystematics=None, dataYear=0):
115  self._autoconfigFlags = autoconfigFromFlags
116  if autoconfigFromFlags is not None:
117  if autoconfigFromFlags.Input.isMC:
118  if autoconfigFromFlags.Sim.ISF.Simulator.usesFastCaloSim():
119  dataType = DataType.FastSim
120  else:
121  dataType = DataType.FullSim
122  else:
123  dataType = DataType.Data
124  isPhyslite = 'StreamDAOD_PHYSLITE' in autoconfigFromFlags.Input.ProcessingTags
125  if geometry is None:
126  geometry = autoconfigFromFlags.GeoModel.Run
127  if dsid == 0 and dataType is not DataType.Data:
128  dsid = autoconfigFromFlags.Input.MCChannelNumber
129  if campaign is None:
130  campaign = autoconfigFromFlags.Input.MCCampaign
131  if runNumber is None:
132  runNumber = int(autoconfigFromFlags.Input.RunNumbers[0])
133  if dataYear == 0:
134  dataYear = autoconfigFromFlags.Input.DataYear
135  generatorInfo = autoconfigFromFlags.Input.GeneratorsInfo
136  from TrigDecisionTool.TrigDecisionToolHelpers import (
137  getRun3NavigationContainerFromInput_forAnalysisBase)
138  hltSummary = getRun3NavigationContainerFromInput_forAnalysisBase(autoconfigFromFlags)
139  else:
140  # legacy mappings of string arguments
141  if isinstance(dataType, str):
142  if dataType == 'mc':
143  dataType = DataType.FullSim
144  elif dataType == 'afii':
145  dataType = DataType.FastSim
146  else:
147  dataType = DataType(dataType)
148  generatorInfo = None
149  hltSummary = 'HLTNav_Summary_DAODSlimmed'
150  if runNumber is None:
151  runNumber = 284500
152  # allow possible string argument for `geometry` and convert it to enum
153  geometry = LHCPeriod(geometry)
154  if geometry is LHCPeriod.Run1:
155  raise ValueError ("invalid Run geometry: %s" % geometry.value)
156  # store also the data year for data
157  self._dataType = dataType
158  self._isPhyslite = isPhyslite
159  self._geometry = geometry
160  self._dsid = dsid
161  self._campaign = campaign
162  self._runNumber = runNumber
163  self._dataYear = dataYear
164  self._generatorInfo = generatorInfo
165  self._algSeq = algSeq
166  self._noSystematics = noSystematics
167  self._noSysSuffix = noSysSuffix
168  self._containerConfig = {}
169  self._outputContainers = {}
170  self._pass = 0
171  self._algorithms = {}
172  self._currentAlg = None
173  self._selectionNameExpr = re.compile ('[A-Za-z_][A-Za-z_0-9]+')
174  self.setSourceName ('EventInfo', 'EventInfo')
175  self._eventcutflow = {}
176  self._hltSummary = hltSummary
177 
178  # If we are in an Athena environment with ComponentAccumulator configuration
179  # then the AlgSequence, which is Gaudi.AthSequencer, does not support '+=',
180  # and we in any case want to produce an output ComponentAccumulator
181  self.CA = None
182  if DualUseConfig.useComponentAccumulator:
183  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
184  self.CA = ComponentAccumulator()
185  # if we have a component accumulator the user is not required to pass
186  # in a sequence, but if they do let's add it
187  if algSeq :
188  self.CA.addSequence(algSeq)
189 
190 

Member Function Documentation

◆ addEventCutFlow()

def python.ConfigAccumulator.ConfigAccumulator.addEventCutFlow (   self,
  selection,
  decorations 
)
register a new event cutflow, adding it to the dictionary with key 'selection'
and value 'decorations', a list of decorated selections

Definition at line 586 of file ConfigAccumulator.py.

586  def addEventCutFlow (self, selection, decorations) :
587 
588  """register a new event cutflow, adding it to the dictionary with key 'selection'
589  and value 'decorations', a list of decorated selections
590  """
591  if self._pass == 0:
592  if selection in self._eventcutflow.keys():
593  raise ValueError ('the event cutflow dictionary already contains an entry ' + selection)
594  else:
595  self._eventcutflow[selection] = decorations
596 
597 

◆ addOutputContainer()

def python.ConfigAccumulator.ConfigAccumulator.addOutputContainer (   self,
  containerName,
  outputContainerName 
)
register a copy of a container used in outputs

Definition at line 619 of file ConfigAccumulator.py.

619  def addOutputContainer (self, containerName, outputContainerName) :
620  """register a copy of a container used in outputs"""
621  if containerName not in self._containerConfig :
622  raise KeyError ("container unknown: " + containerName)
623  if outputContainerName in self._outputContainers :
624  raise KeyError ("duplicate output container name: " + outputContainerName)
625  self._outputContainers[outputContainerName] = containerName
626 
627 

◆ addOutputVar()

def python.ConfigAccumulator.ConfigAccumulator.addOutputVar (   self,
  containerName,
  variableName,
  outputName,
noSys = False,
  enabled = True 
)
add an output variable for the given container to the output

Definition at line 644 of file ConfigAccumulator.py.

644  def addOutputVar (self, containerName, variableName, outputName,
645  *, noSys=False, enabled=True) :
646  """add an output variable for the given container to the output
647  """
648 
649  if containerName not in self._containerConfig :
650  raise KeyError ("container unknown: " + containerName)
651  baseConfig = self._containerConfig[containerName].outputs
652  if outputName in baseConfig :
653  raise KeyError ("duplicate output variable name: " + outputName)
654  config = OutputConfig (containerName, variableName, noSys=noSys, enabled=enabled)
655  baseConfig[outputName] = config
656 
657 

◆ addPrivateTool()

def python.ConfigAccumulator.ConfigAccumulator.addPrivateTool (   self,
  propertyName,
  toolType 
)
add a private tool to the current algorithm

Definition at line 312 of file ConfigAccumulator.py.

312  def addPrivateTool (self, propertyName, toolType) :
313  """add a private tool to the current algorithm"""
314  if self._pass == 0 :
315  DualUseConfig.addPrivateTool (self._currentAlg, propertyName, toolType)
316 
317 

◆ addSelection()

def python.ConfigAccumulator.ConfigAccumulator.addSelection (   self,
  containerName,
  selectionName,
  decoration,
**  kwargs 
)
add another selection decoration to the selection of the given
name for the given container

Definition at line 606 of file ConfigAccumulator.py.

606  def addSelection (self, containerName, selectionName, decoration,
607  **kwargs) :
608  """add another selection decoration to the selection of the given
609  name for the given container"""
610  if selectionName != '' and not self._selectionNameExpr.fullmatch (selectionName) :
611  raise ValueError ('invalid selection name: ' + selectionName)
612  if containerName not in self._containerConfig :
613  self._containerConfig[containerName] = ContainerConfig (containerName, containerName, noSysSuffix=self._noSysSuffix)
614  config = self._containerConfig[containerName]
615  selection = SelectionConfig (selectionName, decoration, **kwargs)
616  config.selections.append (selection)
617 
618 

◆ autoconfigFlags()

def python.ConfigAccumulator.ConfigAccumulator.autoconfigFlags (   self)
auto configuration flags

Definition at line 195 of file ConfigAccumulator.py.

195  def autoconfigFlags (self) :
196  """auto configuration flags"""
197  return self._autoconfigFlags
198 

◆ campaign()

def python.ConfigAccumulator.ConfigAccumulator.campaign (   self)
the MC campaign we run on

Definition at line 215 of file ConfigAccumulator.py.

215  def campaign(self) :
216  """the MC campaign we run on"""
217  return self._campaign
218 

◆ checkOutputContainer()

def python.ConfigAccumulator.ConfigAccumulator.checkOutputContainer (   self,
  containerName 
)
check whether a given container has been registered in outputs

Definition at line 628 of file ConfigAccumulator.py.

628  def checkOutputContainer (self, containerName) :
629  """check whether a given container has been registered in outputs"""
630  return containerName in self._outputContainers.values()
631 
632 

◆ copyName()

def python.ConfigAccumulator.ConfigAccumulator.copyName (   self,
  containerName 
)
register that a copy of the container will be made and return
its name

Definition at line 364 of file ConfigAccumulator.py.

364  def copyName (self, containerName) :
365  """register that a copy of the container will be made and return
366  its name"""
367  if containerName not in self._containerConfig :
368  raise Exception ("unknown container: " + containerName)
369  self._containerConfig[containerName].index += 1
370  return self._containerConfig[containerName].currentName()
371 
372 

◆ createAlgorithm()

def python.ConfigAccumulator.ConfigAccumulator.createAlgorithm (   self,
  type,
  name,
  reentrant = False 
)
create a new algorithm and register it as the current algorithm

Definition at line 235 of file ConfigAccumulator.py.

235  def createAlgorithm (self, type, name, reentrant=False) :
236  """create a new algorithm and register it as the current algorithm"""
237  if self._pass == 0 :
238  if name in self._algorithms :
239  raise Exception ('duplicate algorithms: ' + name)
240  if reentrant:
241  alg = DualUseConfig.createReentrantAlgorithm (type, name)
242  else:
243  alg = DualUseConfig.createAlgorithm (type, name)
244 
245  if DualUseConfig.useComponentAccumulator:
246  if self._algSeq :
247  self.CA.addEventAlgo(alg,self._algSeq.name)
248  else :
249  self.CA.addEventAlgo(alg)
250  else:
251  self._algSeq += alg
252  self._algorithms[name] = alg
253  self._currentAlg = alg
254  return alg
255  else :
256  if name not in self._algorithms :
257  raise Exception ('unknown algorithm requested: ' + name)
258  self._currentAlg = self._algorithms[name]
259  if self.CA and self._currentAlg != self.CA.getEventAlgo(name) :
260  raise Exception ('change to algorithm object: ' + name)
261  return self._algorithms[name]
262 
263 

◆ createPublicTool()

def python.ConfigAccumulator.ConfigAccumulator.createPublicTool (   self,
  type,
  name 
)
create a new public tool and register it as the "current algorithm"

Definition at line 288 of file ConfigAccumulator.py.

288  def createPublicTool (self, type, name) :
289  '''create a new public tool and register it as the "current algorithm"'''
290  if self._pass == 0 :
291  if name in self._algorithms :
292  raise Exception ('duplicate public tool: ' + name)
293  tool = DualUseConfig.createPublicTool (type, name)
294  # Avoid importing AthenaCommon.AppMgr in a CA Athena job
295  # as it modifies Gaudi behaviour
296  if DualUseConfig.isAthena:
297  if DualUseConfig.useComponentAccumulator:
298  self.CA.addPublicTool(tool)
299  else:
300  # We're not, so let's remember this as a "normal" algorithm:
301  self._algSeq += tool
302  self._algorithms[name] = tool
303  self._currentAlg = tool
304  return tool
305  else :
306  if name not in self._algorithms :
307  raise Exception ('unknown public tool requested: ' + name)
308  self._currentAlg = self._algorithms[name]
309  return self._algorithms[name]
310 
311 

◆ createService()

def python.ConfigAccumulator.ConfigAccumulator.createService (   self,
  type,
  name 
)
create a new service and register it as the "current algorithm"

Definition at line 264 of file ConfigAccumulator.py.

264  def createService (self, type, name) :
265  '''create a new service and register it as the "current algorithm"'''
266  if self._pass == 0 :
267  if name in self._algorithms :
268  raise Exception ('duplicate service: ' + name)
269  service = DualUseConfig.createService (type, name)
270  # Avoid importing AthenaCommon.AppMgr in a CA Athena job
271  # as it modifies Gaudi behaviour
272  if DualUseConfig.isAthena:
273  if DualUseConfig.useComponentAccumulator:
274  self.CA.addService(service)
275  else:
276  # We're not, so let's remember this as a "normal" algorithm:
277  self._algSeq += service
278  self._algorithms[name] = service
279  self._currentAlg = service
280  return service
281  else :
282  if name not in self._algorithms :
283  raise Exception ('unknown service requested: ' + name)
284  self._currentAlg = self._algorithms[name]
285  return self._algorithms[name]
286 
287 

◆ dataType()

def python.ConfigAccumulator.ConfigAccumulator.dataType (   self)
the data type we run on (data, fullsim, fastsim)

Definition at line 199 of file ConfigAccumulator.py.

199  def dataType (self) :
200  """the data type we run on (data, fullsim, fastsim)"""
201  return self._dataType
202 

◆ dataYear()

def python.ConfigAccumulator.ConfigAccumulator.dataYear (   self)
for data, the corresponding year; for MC, zero

Definition at line 223 of file ConfigAccumulator.py.

223  def dataYear(self) :
224  """for data, the corresponding year; for MC, zero"""
225  return self._dataYear
226 

◆ dsid()

def python.ConfigAccumulator.ConfigAccumulator.dsid (   self)
the mcChannelNumber or DSID of the sample we run on

Definition at line 211 of file ConfigAccumulator.py.

211  def dsid(self) :
212  """the mcChannelNumber or DSID of the sample we run on"""
213  return self._dsid
214 

◆ generatorInfo()

def python.ConfigAccumulator.ConfigAccumulator.generatorInfo (   self)
the dictionary of MC generators and their versions for the sample we run on

Definition at line 227 of file ConfigAccumulator.py.

227  def generatorInfo(self) :
228  """the dictionary of MC generators and their versions for the sample we run on"""
229  return self._generatorInfo
230 

◆ geometry()

def python.ConfigAccumulator.ConfigAccumulator.geometry (   self)
the LHC Run period we run on

Definition at line 207 of file ConfigAccumulator.py.

207  def geometry (self) :
208  """the LHC Run period we run on"""
209  return self._geometry
210 

◆ getContainerMeta()

def python.ConfigAccumulator.ConfigAccumulator.getContainerMeta (   self,
  containerName,
  metaField,
  defaultValue = None,
failOnMiss = False 
)
get the meta information for the given container

This is used to pass down meta-information from the
configuration to the algorithms.

Definition at line 398 of file ConfigAccumulator.py.

398  def getContainerMeta (self, containerName, metaField, defaultValue=None, *, failOnMiss=False) :
399  """get the meta information for the given container
400 
401  This is used to pass down meta-information from the
402  configuration to the algorithms.
403  """
404  if containerName not in self._containerConfig :
405  raise Exception ("container unknown: " + containerName)
406  if metaField in self._containerConfig[containerName].meta :
407  return self._containerConfig[containerName].meta[metaField]
408  if failOnMiss :
409  raise Exception ('unknown meta-field' + metaField + ' on container ' + containerName)
410  return defaultValue
411 

◆ getEventCutFlow()

def python.ConfigAccumulator.ConfigAccumulator.getEventCutFlow (   self,
  selection 
)
get the list of decorated selections for an event cutflow,  corresponding to
key 'selection'

Definition at line 598 of file ConfigAccumulator.py.

598  def getEventCutFlow (self, selection) :
599 
600  """get the list of decorated selections for an event cutflow, corresponding to
601  key 'selection'
602  """
603  return self._eventcutflow[selection]
604 
605 

◆ getFullSelection()

def python.ConfigAccumulator.ConfigAccumulator.getFullSelection (   self,
  containerName,
  selectionName,
skipBase = False,
  excludeFrom = None 
)
get the selection string for the given selection on the given
container

This can handle both individual selections or selection
expressions (e.g. `loose||tight`) with the later being
properly expanded.  Either way the base selection (i.e. the
selection without a name) will always be applied on top.

containerName --- the container the selection is defined on
selectionName --- the name of the selection, or a selection
          expression based on multiple named selections
skipBase --- will avoid the base selection, and should normally
     not be used by the end-user.
excludeFrom --- a set of string names of selection sources to exclude
        e.g. to exclude OR selections from MET

Definition at line 491 of file ConfigAccumulator.py.

491  def getFullSelection (self, containerName, selectionName,
492  *, skipBase = False, excludeFrom = None) :
493 
494  """get the selection string for the given selection on the given
495  container
496 
497  This can handle both individual selections or selection
498  expressions (e.g. `loose||tight`) with the later being
499  properly expanded. Either way the base selection (i.e. the
500  selection without a name) will always be applied on top.
501 
502  containerName --- the container the selection is defined on
503  selectionName --- the name of the selection, or a selection
504  expression based on multiple named selections
505  skipBase --- will avoid the base selection, and should normally
506  not be used by the end-user.
507  excludeFrom --- a set of string names of selection sources to exclude
508  e.g. to exclude OR selections from MET
509  """
510  if containerName not in self._containerConfig :
511  return ""
512 
513  if excludeFrom is None :
514  excludeFrom = set()
515  elif not isinstance(excludeFrom, set) :
516  raise ValueError ('invalid excludeFrom argument (need set of strings): ' + str(excludeFrom))
517 
518  # Check if this is actually a selection expression,
519  # e.g. `A||B` and if so translate it into a complex expression
520  # for the user. I'm not trying to do any complex syntax
521  # recognition, but instead just produce an expression that the
522  # C++ parser ought to be able to read.
523  if selectionName != '' and \
524  not self._selectionNameExpr.fullmatch (selectionName) :
525  result = ''
526  while selectionName != '' :
527  match = self._selectionNameExpr.match (selectionName)
528  if not match :
529  result += selectionName[0]
530  selectionName = selectionName[1:]
531  else :
532  subname = match.group(0)
533  subresult = self.getFullSelection (containerName, subname, skipBase = True, excludeFrom=excludeFrom)
534  if subresult != '' :
535  result += '(' + subresult + ')'
536  else :
537  result += 'true'
538  selectionName = selectionName[len(subname):]
539  subresult = self.getFullSelection (containerName, '', excludeFrom=excludeFrom)
540  if subresult != '' :
541  result = subresult + '&&(' + result + ')'
542  return result
543 
544  config = self._containerConfig[containerName]
545  decorations = []
546  hasSelectionName = False
547  for selection in config.selections :
548  if ((selection.name == '' and not skipBase) or selection.name == selectionName) and (selection.comesFrom not in excludeFrom) :
549  decorations += [selection.decoration]
550  if selection.name == selectionName :
551  hasSelectionName = True
552  if not hasSelectionName and selectionName != '' :
553  raise KeyError ('invalid selection name: ' + containerName + '.' + selectionName)
554  return '&&'.join (decorations)
555 
556 

◆ getOutputContainerOrigin()

def python.ConfigAccumulator.ConfigAccumulator.getOutputContainerOrigin (   self,
  outputContainerName 
)
Get the name of the actual container, for which an output is registered

Definition at line 633 of file ConfigAccumulator.py.

633  def getOutputContainerOrigin (self, outputContainerName) :
634  """Get the name of the actual container, for which an output is registered"""
635  try:
636  return self._outputContainers[outputContainerName]
637  except KeyError:
638  try:
639  return self._containerConfig[outputContainerName].name
640  except KeyError:
641  raise KeyError ("output container unknown: " + outputContainerName)
642 
643 

◆ getOutputVars()

def python.ConfigAccumulator.ConfigAccumulator.getOutputVars (   self,
  containerName 
)
get the output variables for the given container

Definition at line 658 of file ConfigAccumulator.py.

658  def getOutputVars (self, containerName) :
659  """get the output variables for the given container"""
660  if containerName in self._outputContainers :
661  containerName = self._outputContainers[containerName]
662  if containerName not in self._containerConfig :
663  raise KeyError ("unknown container for output: " + containerName)
664  return self._containerConfig[containerName].outputs
665 
666 

◆ getPreselection()

def python.ConfigAccumulator.ConfigAccumulator.getPreselection (   self,
  containerName,
  selectionName,
asList = False 
)
get the preselection string for the given selection on the given
container

Definition at line 470 of file ConfigAccumulator.py.

470  def getPreselection (self, containerName, selectionName, *, asList = False) :
471 
472  """get the preselection string for the given selection on the given
473  container
474  """
475  if selectionName != '' and not self._selectionNameExpr.fullmatch (selectionName) :
476  raise ValueError ('invalid selection name: ' + selectionName)
477  if containerName not in self._containerConfig :
478  return ""
479  config = self._containerConfig[containerName]
480  decorations = []
481  for selection in config.selections :
482  if (selection.name == '' or selection.name == selectionName) and \
483  selection.preselection :
484  decorations += [selection.decoration]
485  if asList :
486  return decorations
487  else :
488  return '&&'.join (decorations)
489 
490 

◆ getSelectionCutFlow()

def python.ConfigAccumulator.ConfigAccumulator.getSelectionCutFlow (   self,
  containerName,
  selectionName 
)
get the individual selections as a list for producing the cutflow for
the given selection on the given container

This can only handle individual selections, not selection
expressions (e.g. `loose||tight`).

Definition at line 557 of file ConfigAccumulator.py.

557  def getSelectionCutFlow (self, containerName, selectionName) :
558 
559  """get the individual selections as a list for producing the cutflow for
560  the given selection on the given container
561 
562  This can only handle individual selections, not selection
563  expressions (e.g. `loose||tight`).
564 
565  """
566  if containerName not in self._containerConfig :
567  return []
568 
569  # Check if this is actually a selection expression,
570  # e.g. `A||B` and if so translate it into a complex expression
571  # for the user. I'm not trying to do any complex syntax
572  # recognition, but instead just produce an expression that the
573  # C++ parser ought to be able to read.
574  if selectionName != '' and \
575  not self._selectionNameExpr.fullmatch (selectionName) :
576  raise ValueError ('not allowed to do cutflow on selection expression: ' + selectionName)
577 
578  config = self._containerConfig[containerName]
579  decorations = []
580  for selection in config.selections :
581  if (selection.name == '' or selection.name == selectionName) :
582  decorations += [selection.decoration]
583  return decorations
584 
585 

◆ getSelectionNames()

def python.ConfigAccumulator.ConfigAccumulator.getSelectionNames (   self,
  containerName,
  excludeFrom = None 
)
Retrieve set of unique selections defined for a given container

Definition at line 667 of file ConfigAccumulator.py.

667  def getSelectionNames (self, containerName, excludeFrom = None) :
668  """Retrieve set of unique selections defined for a given container"""
669  if containerName not in self._containerConfig :
670  return []
671  if excludeFrom is None:
672  excludeFrom = set()
673  elif not isinstance(excludeFrom, set) :
674  raise ValueError ('invalid excludeFrom argument (need set of strings): ' + str(excludeFrom))
675 
676  config = self._containerConfig[containerName]
677  # because cuts are registered individually, selection names can repeat themselves
678  # but we are interested in unique names only
679  selectionNames = set()
680  for selection in config.selections:
681  if selection.comesFrom in excludeFrom:
682  continue
683  # skip flags which should be disabled in output
684  if selection.writeToOutput:
685  selectionNames.add(selection.name)
686  return selectionNames

◆ hltSummary()

def python.ConfigAccumulator.ConfigAccumulator.hltSummary (   self)
the HLTSummary configuration to be used for the trigger decision tool

Definition at line 231 of file ConfigAccumulator.py.

231  def hltSummary(self) :
232  """the HLTSummary configuration to be used for the trigger decision tool"""
233  return self._hltSummary
234 

◆ isMetContainer()

def python.ConfigAccumulator.ConfigAccumulator.isMetContainer (   self,
  containerName 
)
whether the given container is registered as a MET container

This is mostly/exclusively used for determining whether to
write out the whole container or just a single MET term.

Definition at line 424 of file ConfigAccumulator.py.

424  def isMetContainer (self, containerName) :
425  """whether the given container is registered as a MET container
426 
427  This is mostly/exclusively used for determining whether to
428  write out the whole container or just a single MET term.
429  """
430  if containerName not in self._containerConfig :
431  raise Exception ("container unknown: " + containerName)
432  return self._containerConfig[containerName].isMet
433 
434 

◆ isPhyslite()

def python.ConfigAccumulator.ConfigAccumulator.isPhyslite (   self)
whether we run on PHYSLITE

Definition at line 203 of file ConfigAccumulator.py.

203  def isPhyslite (self) :
204  """whether we run on PHYSLITE"""
205  return self._isPhyslite
206 

◆ nextPass()

def python.ConfigAccumulator.ConfigAccumulator.nextPass (   self)
switch to the next configuration pass

Configuration happens in two steps, with all the blocks processed
twice.  This switches from the first to the second pass.

Definition at line 455 of file ConfigAccumulator.py.

455  def nextPass (self) :
456  """switch to the next configuration pass
457 
458  Configuration happens in two steps, with all the blocks processed
459  twice. This switches from the first to the second pass.
460  """
461  if self._pass != 0 :
462  raise Exception ("already performed final pass")
463  for name in self._containerConfig :
464  self._containerConfig[name].nextPass ()
465  self._pass = 1
466  self._currentAlg = None
467  self._outputContainers = {}
468 
469 

◆ noSystematics()

def python.ConfigAccumulator.ConfigAccumulator.noSystematics (   self)
noSystematics flag used by CommonServices block

Definition at line 191 of file ConfigAccumulator.py.

191  def noSystematics (self) :
192  """noSystematics flag used by CommonServices block"""
193  return self._noSystematics
194 

◆ originalName()

def python.ConfigAccumulator.ConfigAccumulator.originalName (   self,
  containerName 
)
get the "original" name of the given container

This is mostly/exclusively used for jet containers, so that
subsequent configurations know which jet container they
operate on.

Definition at line 384 of file ConfigAccumulator.py.

384  def originalName (self, containerName) :
385  """get the "original" name of the given container
386 
387  This is mostly/exclusively used for jet containers, so that
388  subsequent configurations know which jet container they
389  operate on.
390  """
391  if containerName not in self._containerConfig :
392  raise Exception ("container unknown: " + containerName)
393  result = self._containerConfig[containerName].originalName
394  if result is None :
395  raise Exception ("no original name for: " + containerName)
396  return result
397 

◆ readName()

def python.ConfigAccumulator.ConfigAccumulator.readName (   self,
  containerName 
)
get the name of the "current copy" of the given container

As extra copies get created during processing this will track
the correct name of the current copy.  Optionally one can pass
in the name of the container before the first copy.

Definition at line 352 of file ConfigAccumulator.py.

352  def readName (self, containerName) :
353  """get the name of the "current copy" of the given container
354 
355  As extra copies get created during processing this will track
356  the correct name of the current copy. Optionally one can pass
357  in the name of the container before the first copy.
358  """
359  if containerName not in self._containerConfig :
360  raise Exception ("no source container for: " + containerName)
361  return self._containerConfig[containerName].currentName()
362 
363 

◆ readNameAndSelection()

def python.ConfigAccumulator.ConfigAccumulator.readNameAndSelection (   self,
  containerName,
excludeFrom = None 
)
get the name of the "current copy" of the given container, and the
selection string

This is mostly meant for MET and OR for whom the actual object
selection is relevant, and which as such allow to pass in the
working point as "ObjectName.WorkingPoint".

Definition at line 435 of file ConfigAccumulator.py.

435  def readNameAndSelection (self, containerName, *, excludeFrom = None) :
436  """get the name of the "current copy" of the given container, and the
437  selection string
438 
439  This is mostly meant for MET and OR for whom the actual object
440  selection is relevant, and which as such allow to pass in the
441  working point as "ObjectName.WorkingPoint".
442  """
443  split = containerName.split (".")
444  if len(split) == 1 :
445  objectName = split[0]
446  selectionName = ''
447  elif len(split) == 2 :
448  objectName = split[0]
449  selectionName = split[1]
450  else :
451  raise Exception ('invalid object selection name: ' + containerName)
452  return self.readName (objectName), self.getFullSelection (objectName, selectionName, excludeFrom=excludeFrom)
453 
454 

◆ runNumber()

def python.ConfigAccumulator.ConfigAccumulator.runNumber (   self)
the MC runNumber

Definition at line 219 of file ConfigAccumulator.py.

219  def runNumber(self) :
220  """the MC runNumber"""
221  return self._runNumber
222 

◆ setContainerMeta()

def python.ConfigAccumulator.ConfigAccumulator.setContainerMeta (   self,
  containerName,
  metaField,
  value,
allowOverwrite = False 
)
set the meta information for the given container

This is used to pass down meta-information from the
configuration to the algorithms.

Definition at line 412 of file ConfigAccumulator.py.

412  def setContainerMeta (self, containerName, metaField, value, *, allowOverwrite=False) :
413  """set the meta information for the given container
414 
415  This is used to pass down meta-information from the
416  configuration to the algorithms.
417  """
418  if containerName not in self._containerConfig :
419  raise Exception ("container unknown: " + containerName)
420  if not allowOverwrite and metaField in self._containerConfig[containerName].meta :
421  raise Exception ('duplicate meta-field' + metaField + ' on container ' + containerName)
422  self._containerConfig[containerName].meta[metaField] = value
423 

◆ setSourceName()

def python.ConfigAccumulator.ConfigAccumulator.setSourceName (   self,
  containerName,
  sourceName,
originalName = None,
  isMet = False 
)
set the (default) name of the source/original container

This is essentially meant to allow using e.g. the muon
configuration and the user not having to manually specify that
they want to use the Muons/AnalysisMuons container from the
input file.

In addition it allows to set the original name of the
container (which may be different from the source name), which
is mostly/exclusively used for jet containers, so that
subsequent configurations know which jet container they
operate on.

Definition at line 318 of file ConfigAccumulator.py.

318  def setSourceName (self, containerName, sourceName,
319  *, originalName = None, isMet = False) :
320  """set the (default) name of the source/original container
321 
322  This is essentially meant to allow using e.g. the muon
323  configuration and the user not having to manually specify that
324  they want to use the Muons/AnalysisMuons container from the
325  input file.
326 
327  In addition it allows to set the original name of the
328  container (which may be different from the source name), which
329  is mostly/exclusively used for jet containers, so that
330  subsequent configurations know which jet container they
331  operate on.
332  """
333  if containerName not in self._containerConfig :
334  self._containerConfig[containerName] = ContainerConfig (containerName, sourceName, noSysSuffix = self._noSysSuffix, originalName = originalName, isMet = isMet)
335 
336 

◆ wantCopy()

def python.ConfigAccumulator.ConfigAccumulator.wantCopy (   self,
  containerName 
)
ask whether we want/need a copy of the container

This usually only happens if no copy of the container has been
made yet and the copy is needed to allow modifications, etc.

Definition at line 373 of file ConfigAccumulator.py.

373  def wantCopy (self, containerName) :
374  """ask whether we want/need a copy of the container
375 
376  This usually only happens if no copy of the container has been
377  made yet and the copy is needed to allow modifications, etc.
378  """
379  if containerName not in self._containerConfig :
380  raise Exception ("no source container for: " + containerName)
381  return self._containerConfig[containerName].index == 0
382 
383 

◆ writeName()

def python.ConfigAccumulator.ConfigAccumulator.writeName (   self,
  containerName,
isMet = None 
)
register that the given container will be made and return
its name

Definition at line 337 of file ConfigAccumulator.py.

337  def writeName (self, containerName, *, isMet=None) :
338  """register that the given container will be made and return
339  its name"""
340  if containerName not in self._containerConfig :
341  self._containerConfig[containerName] = ContainerConfig (containerName, sourceName = None, noSysSuffix = self._noSysSuffix)
342  if self._containerConfig[containerName].sourceName is not None :
343  raise Exception ("trying to write container configured for input: " + containerName)
344  if self._containerConfig[containerName].index != 0 :
345  raise Exception ("trying to write container twice: " + containerName)
346  self._containerConfig[containerName].index += 1
347  if isMet is not None :
348  self._containerConfig[containerName].isMet = isMet
349  return self._containerConfig[containerName].currentName()
350 
351 

Member Data Documentation

◆ _algorithms

python.ConfigAccumulator.ConfigAccumulator._algorithms
private

Definition at line 169 of file ConfigAccumulator.py.

◆ _algSeq

python.ConfigAccumulator.ConfigAccumulator._algSeq
private

Definition at line 163 of file ConfigAccumulator.py.

◆ _autoconfigFlags

python.ConfigAccumulator.ConfigAccumulator._autoconfigFlags
private

Definition at line 113 of file ConfigAccumulator.py.

◆ _campaign

python.ConfigAccumulator.ConfigAccumulator._campaign
private

Definition at line 159 of file ConfigAccumulator.py.

◆ _containerConfig

python.ConfigAccumulator.ConfigAccumulator._containerConfig
private

Definition at line 166 of file ConfigAccumulator.py.

◆ _currentAlg

python.ConfigAccumulator.ConfigAccumulator._currentAlg
private

Definition at line 170 of file ConfigAccumulator.py.

◆ _dataType

python.ConfigAccumulator.ConfigAccumulator._dataType
private

Definition at line 155 of file ConfigAccumulator.py.

◆ _dataYear

python.ConfigAccumulator.ConfigAccumulator._dataYear
private

Definition at line 161 of file ConfigAccumulator.py.

◆ _dsid

python.ConfigAccumulator.ConfigAccumulator._dsid
private

Definition at line 158 of file ConfigAccumulator.py.

◆ _eventcutflow

python.ConfigAccumulator.ConfigAccumulator._eventcutflow
private

Definition at line 173 of file ConfigAccumulator.py.

◆ _generatorInfo

python.ConfigAccumulator.ConfigAccumulator._generatorInfo
private

Definition at line 162 of file ConfigAccumulator.py.

◆ _geometry

python.ConfigAccumulator.ConfigAccumulator._geometry
private

Definition at line 157 of file ConfigAccumulator.py.

◆ _hltSummary

python.ConfigAccumulator.ConfigAccumulator._hltSummary
private

Definition at line 174 of file ConfigAccumulator.py.

◆ _isPhyslite

python.ConfigAccumulator.ConfigAccumulator._isPhyslite
private

Definition at line 156 of file ConfigAccumulator.py.

◆ _noSysSuffix

python.ConfigAccumulator.ConfigAccumulator._noSysSuffix
private

Definition at line 165 of file ConfigAccumulator.py.

◆ _noSystematics

python.ConfigAccumulator.ConfigAccumulator._noSystematics
private

Definition at line 164 of file ConfigAccumulator.py.

◆ _outputContainers

python.ConfigAccumulator.ConfigAccumulator._outputContainers
private

Definition at line 167 of file ConfigAccumulator.py.

◆ _pass

python.ConfigAccumulator.ConfigAccumulator._pass
private

Definition at line 168 of file ConfigAccumulator.py.

◆ _runNumber

python.ConfigAccumulator.ConfigAccumulator._runNumber
private

Definition at line 160 of file ConfigAccumulator.py.

◆ _selectionNameExpr

python.ConfigAccumulator.ConfigAccumulator._selectionNameExpr
private

Definition at line 171 of file ConfigAccumulator.py.

◆ CA

python.ConfigAccumulator.ConfigAccumulator.CA

Definition at line 179 of file ConfigAccumulator.py.


The documentation for this class was generated from the following file:
python.TrigDecisionToolHelpers.getRun3NavigationContainerFromInput_forAnalysisBase
def getRun3NavigationContainerFromInput_forAnalysisBase(flags)
Definition: TrigDecisionToolHelpers.py:22
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.DualUseConfig.createPublicTool
def createPublicTool(typeName, toolName)
Definition: DualUseConfig.py:84
python.DualUseConfig.addPrivateTool
def addPrivateTool(alg, toolName, typeName)
Definition: DualUseConfig.py:180
downloadSingle.dataType
string dataType
Definition: downloadSingle.py:18
python.DualUseConfig.createService
def createService(typeName, serviceName, sequence=None)
Definition: DualUseConfig.py:127
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
python.DualUseConfig.createAlgorithm
def createAlgorithm(typeName, instanceName)
Definition: DualUseConfig.py:56
Generate_dsid_ranseed.dsid
dsid
Definition: Generate_dsid_ranseed.py:6
LArG4GenerateShowerLib.geometry
geometry
Definition: LArG4GenerateShowerLib.py:19
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
dqt_zlumi_pandas.campaign
campaign
Definition: dqt_zlumi_pandas.py:40
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798