ATLAS Offline Software
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, calibMode=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 calibMode (self, containerName)
 
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 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 94 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 111 of file ConfigAccumulator.py.

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

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 572 of file ConfigAccumulator.py.

572  def addEventCutFlow (self, selection, decorations) :
573 
574  """register a new event cutflow, adding it to the dictionary with key 'selection'
575  and value 'decorations', a list of decorated selections
576  """
577  if self._pass == 0:
578  if selection in self._eventcutflow.keys():
579  raise ValueError ('the event cutflow dictionary already contains an entry ' + selection)
580  else:
581  self._eventcutflow[selection] = decorations
582 
583 

◆ addOutputContainer()

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

Definition at line 605 of file ConfigAccumulator.py.

605  def addOutputContainer (self, containerName, outputContainerName) :
606  """register a copy of a container used in outputs"""
607  if containerName not in self._containerConfig :
608  raise KeyError ("container unknown: " + containerName)
609  if outputContainerName in self._outputContainers :
610  raise KeyError ("duplicate output container name: " + outputContainerName)
611  self._outputContainers[outputContainerName] = containerName
612 
613 

◆ 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 625 of file ConfigAccumulator.py.

625  def addOutputVar (self, containerName, variableName, outputName,
626  *, noSys=False, enabled=True) :
627  """add an output variable for the given container to the output
628  """
629 
630  if containerName not in self._containerConfig :
631  raise KeyError ("container unknown: " + containerName)
632  baseConfig = self._containerConfig[containerName].outputs
633  if outputName in baseConfig :
634  raise KeyError ("duplicate output variable name: " + outputName)
635  config = OutputConfig (containerName, variableName, noSys=noSys, enabled=enabled)
636  baseConfig[outputName] = config
637 
638 

◆ addPrivateTool()

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

Definition at line 311 of file ConfigAccumulator.py.

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

◆ 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 592 of file ConfigAccumulator.py.

592  def addSelection (self, containerName, selectionName, decoration,
593  **kwargs) :
594  """add another selection decoration to the selection of the given
595  name for the given container"""
596  if selectionName != '' and not self._selectionNameExpr.fullmatch (selectionName) :
597  raise ValueError ('invalid selection name: ' + selectionName)
598  if containerName not in self._containerConfig :
599  self._containerConfig[containerName] = ContainerConfig (containerName, containerName, noSysSuffix=self._noSysSuffix)
600  config = self._containerConfig[containerName]
601  selection = SelectionConfig (selectionName, decoration, **kwargs)
602  config.selections.append (selection)
603 
604 

◆ autoconfigFlags()

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

Definition at line 194 of file ConfigAccumulator.py.

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

◆ calibMode()

def python.ConfigAccumulator.ConfigAccumulator.calibMode (   self,
  containerName 
)
get the calibration mode of the given container

Definition at line 400 of file ConfigAccumulator.py.

400  def calibMode (self, containerName) :
401  """get the calibration mode of the given container
402  """
403  if containerName not in self._containerConfig :
404  raise Exception ("container unknown: " + containerName)
405  result = self._containerConfig[containerName].calibMode
406  if result is None :
407  raise Exception ("no calibration mode for: " + containerName)
408  return result
409 

◆ campaign()

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

Definition at line 214 of file ConfigAccumulator.py.

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

◆ 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 366 of file ConfigAccumulator.py.

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

◆ 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 234 of file ConfigAccumulator.py.

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

◆ createPublicTool()

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

Definition at line 287 of file ConfigAccumulator.py.

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

◆ createService()

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

Definition at line 263 of file ConfigAccumulator.py.

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

◆ dataType()

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

Definition at line 198 of file ConfigAccumulator.py.

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

◆ dataYear()

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

Definition at line 222 of file ConfigAccumulator.py.

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

◆ dsid()

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

Definition at line 210 of file ConfigAccumulator.py.

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

◆ generatorInfo()

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

Definition at line 226 of file ConfigAccumulator.py.

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

◆ geometry()

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

Definition at line 206 of file ConfigAccumulator.py.

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

◆ 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 584 of file ConfigAccumulator.py.

584  def getEventCutFlow (self, selection) :
585 
586  """get the list of decorated selections for an event cutflow, corresponding to
587  key 'selection'
588  """
589  return self._eventcutflow[selection]
590 
591 

◆ 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 477 of file ConfigAccumulator.py.

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

◆ getOutputContainerOrigin()

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

Definition at line 614 of file ConfigAccumulator.py.

614  def getOutputContainerOrigin (self, outputContainerName) :
615  """Get the name of the actual container, for which an output is registered"""
616  try:
617  return self._outputContainers[outputContainerName]
618  except KeyError:
619  try:
620  return self._containerConfig[outputContainerName].name
621  except KeyError:
622  raise KeyError ("output container unknown: " + outputContainerName)
623 
624 

◆ getOutputVars()

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

Definition at line 639 of file ConfigAccumulator.py.

639  def getOutputVars (self, containerName) :
640  """get the output variables for the given container"""
641  if containerName in self._outputContainers :
642  containerName = self._outputContainers[containerName]
643  if containerName not in self._containerConfig :
644  raise KeyError ("unknown container for output: " + containerName)
645  return self._containerConfig[containerName].outputs
646 
647 

◆ 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 456 of file ConfigAccumulator.py.

456  def getPreselection (self, containerName, selectionName, *, asList = False) :
457 
458  """get the preselection string for the given selection on the given
459  container
460  """
461  if selectionName != '' and not self._selectionNameExpr.fullmatch (selectionName) :
462  raise ValueError ('invalid selection name: ' + selectionName)
463  if containerName not in self._containerConfig :
464  return ""
465  config = self._containerConfig[containerName]
466  decorations = []
467  for selection in config.selections :
468  if (selection.name == '' or selection.name == selectionName) and \
469  selection.preselection :
470  decorations += [selection.decoration]
471  if asList :
472  return decorations
473  else :
474  return '&&'.join (decorations)
475 
476 

◆ 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 543 of file ConfigAccumulator.py.

543  def getSelectionCutFlow (self, containerName, selectionName) :
544 
545  """get the individual selections as a list for producing the cutflow for
546  the given selection on the given container
547 
548  This can only handle individual selections, not selection
549  expressions (e.g. `loose||tight`).
550 
551  """
552  if containerName not in self._containerConfig :
553  return []
554 
555  # Check if this is actually a selection expression,
556  # e.g. `A||B` and if so translate it into a complex expression
557  # for the user. I'm not trying to do any complex syntax
558  # recognition, but instead just produce an expression that the
559  # C++ parser ought to be able to read.
560  if selectionName != '' and \
561  not self._selectionNameExpr.fullmatch (selectionName) :
562  raise ValueError ('not allowed to do cutflow on selection expression: ' + selectionName)
563 
564  config = self._containerConfig[containerName]
565  decorations = []
566  for selection in config.selections :
567  if (selection.name == '' or selection.name == selectionName) :
568  decorations += [selection.decoration]
569  return decorations
570 
571 

◆ getSelectionNames()

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

Definition at line 648 of file ConfigAccumulator.py.

648  def getSelectionNames (self, containerName, excludeFrom = None) :
649  """Retrieve set of unique selections defined for a given container"""
650  if containerName not in self._containerConfig :
651  return []
652  if excludeFrom is None:
653  excludeFrom = set()
654  elif not isinstance(excludeFrom, set) :
655  raise ValueError ('invalid excludeFrom argument (need set of strings): ' + str(excludeFrom))
656 
657  config = self._containerConfig[containerName]
658  # because cuts are registered individually, selection names can repeat themselves
659  # but we are interested in unique names only
660  selectionNames = set()
661  for selection in config.selections:
662  if selection.comesFrom in excludeFrom:
663  continue
664  # skip flags which should be disabled in output
665  if selection.writeToOutput:
666  selectionNames.add(selection.name)
667  return selectionNames

◆ hltSummary()

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

Definition at line 230 of file ConfigAccumulator.py.

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

◆ 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 410 of file ConfigAccumulator.py.

410  def isMetContainer (self, containerName) :
411  """whether the given container is registered as a MET container
412 
413  This is mostly/exclusively used for determining whether to
414  write out the whole container or just a single MET term.
415  """
416  if containerName not in self._containerConfig :
417  raise Exception ("container unknown: " + containerName)
418  return self._containerConfig[containerName].isMet
419 
420 

◆ isPhyslite()

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

Definition at line 202 of file ConfigAccumulator.py.

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

◆ 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 441 of file ConfigAccumulator.py.

441  def nextPass (self) :
442  """switch to the next configuration pass
443 
444  Configuration happens in two steps, with all the blocks processed
445  twice. This switches from the first to the second pass.
446  """
447  if self._pass != 0 :
448  raise Exception ("already performed final pass")
449  for name in self._containerConfig :
450  self._containerConfig[name].nextPass ()
451  self._pass = 1
452  self._currentAlg = None
453  self._outputContainers = {}
454 
455 

◆ noSystematics()

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

Definition at line 190 of file ConfigAccumulator.py.

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

◆ 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 386 of file ConfigAccumulator.py.

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

◆ 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 354 of file ConfigAccumulator.py.

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

◆ 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 421 of file ConfigAccumulator.py.

421  def readNameAndSelection (self, containerName, *, excludeFrom = None) :
422  """get the name of the "current copy" of the given container, and the
423  selection string
424 
425  This is mostly meant for MET and OR for whom the actual object
426  selection is relevant, and which as such allow to pass in the
427  working point as "ObjectName.WorkingPoint".
428  """
429  split = containerName.split (".")
430  if len(split) == 1 :
431  objectName = split[0]
432  selectionName = ''
433  elif len(split) == 2 :
434  objectName = split[0]
435  selectionName = split[1]
436  else :
437  raise Exception ('invalid object selection name: ' + containerName)
438  return self.readName (objectName), self.getFullSelection (objectName, selectionName, excludeFrom=excludeFrom)
439 
440 

◆ runNumber()

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

Definition at line 218 of file ConfigAccumulator.py.

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

◆ setSourceName()

def python.ConfigAccumulator.ConfigAccumulator.setSourceName (   self,
  containerName,
  sourceName,
originalName = None,
  calibMode = 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.

CalibMode can also be configured to pass it down to some algs which use this
information to be configured, like the METSignificance

Definition at line 317 of file ConfigAccumulator.py.

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

◆ 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 375 of file ConfigAccumulator.py.

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

◆ 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 339 of file ConfigAccumulator.py.

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

Member Data Documentation

◆ _algorithms

python.ConfigAccumulator.ConfigAccumulator._algorithms
private

Definition at line 168 of file ConfigAccumulator.py.

◆ _algSeq

python.ConfigAccumulator.ConfigAccumulator._algSeq
private

Definition at line 162 of file ConfigAccumulator.py.

◆ _autoconfigFlags

python.ConfigAccumulator.ConfigAccumulator._autoconfigFlags
private

Definition at line 112 of file ConfigAccumulator.py.

◆ _campaign

python.ConfigAccumulator.ConfigAccumulator._campaign
private

Definition at line 158 of file ConfigAccumulator.py.

◆ _containerConfig

python.ConfigAccumulator.ConfigAccumulator._containerConfig
private

Definition at line 165 of file ConfigAccumulator.py.

◆ _currentAlg

python.ConfigAccumulator.ConfigAccumulator._currentAlg
private

Definition at line 169 of file ConfigAccumulator.py.

◆ _dataType

python.ConfigAccumulator.ConfigAccumulator._dataType
private

Definition at line 154 of file ConfigAccumulator.py.

◆ _dataYear

python.ConfigAccumulator.ConfigAccumulator._dataYear
private

Definition at line 160 of file ConfigAccumulator.py.

◆ _dsid

python.ConfigAccumulator.ConfigAccumulator._dsid
private

Definition at line 157 of file ConfigAccumulator.py.

◆ _eventcutflow

python.ConfigAccumulator.ConfigAccumulator._eventcutflow
private

Definition at line 172 of file ConfigAccumulator.py.

◆ _generatorInfo

python.ConfigAccumulator.ConfigAccumulator._generatorInfo
private

Definition at line 161 of file ConfigAccumulator.py.

◆ _geometry

python.ConfigAccumulator.ConfigAccumulator._geometry
private

Definition at line 156 of file ConfigAccumulator.py.

◆ _hltSummary

python.ConfigAccumulator.ConfigAccumulator._hltSummary
private

Definition at line 173 of file ConfigAccumulator.py.

◆ _isPhyslite

python.ConfigAccumulator.ConfigAccumulator._isPhyslite
private

Definition at line 155 of file ConfigAccumulator.py.

◆ _noSysSuffix

python.ConfigAccumulator.ConfigAccumulator._noSysSuffix
private

Definition at line 164 of file ConfigAccumulator.py.

◆ _noSystematics

python.ConfigAccumulator.ConfigAccumulator._noSystematics
private

Definition at line 163 of file ConfigAccumulator.py.

◆ _outputContainers

python.ConfigAccumulator.ConfigAccumulator._outputContainers
private

Definition at line 166 of file ConfigAccumulator.py.

◆ _pass

python.ConfigAccumulator.ConfigAccumulator._pass
private

Definition at line 167 of file ConfigAccumulator.py.

◆ _runNumber

python.ConfigAccumulator.ConfigAccumulator._runNumber
private

Definition at line 159 of file ConfigAccumulator.py.

◆ _selectionNameExpr

python.ConfigAccumulator.ConfigAccumulator._selectionNameExpr
private

Definition at line 170 of file ConfigAccumulator.py.

◆ CA

python.ConfigAccumulator.ConfigAccumulator.CA

Definition at line 178 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
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
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.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
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798