Skip to content
Snippets Groups Projects

CPAlgorithms: add flag autoconfiguration to ConfigAccumulator

Merged Baptiste Ravina requested to merge ravinab/athena:config_metadata into main
Files
17
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
import AnaAlgorithm.DualUseConfig as DualUseConfig
from AthenaConfiguration.Enums import LHCPeriod
from AthenaConfiguration.Enums import LHCPeriod, FlagEnum
import re
@@ -12,6 +12,11 @@ def mapUserName (name) :
return name + "_%SYS%"
class DataType(FlagEnum):
"""holds the various data types as an enum"""
Data = 'data'
FullSim = 'mc'
FastSim = 'afii'
class SelectionConfig :
"""all the data for a given selection that has been registered
@@ -96,16 +101,28 @@ class ConfigAccumulator :
used.
"""
def __init__ (self, dataType, algSeq, isPhyslite=False, geometry=LHCPeriod.Run2):
if dataType not in ["data", "mc", "afii"] :
raise ValueError ("invalid data type: " + dataType)
# allow possible string argument for `geometry` and convert it to enum
geometry = LHCPeriod(geometry)
if geometry not in [LHCPeriod.Run2, LHCPeriod.Run3] :
raise ValueError ("invalid Run geometry: %s" % geometry.value)
def __init__ (self, dataType, algSeq, isPhyslite=False, geometry=LHCPeriod.Run2, dsid=0, autoconfigFromFlags=None):
if autoconfigFromFlags is not None:
if autoconfigFromFlags.Input.isMC:
if autoconfigFromFlags.Sim.ISF.Simulator.usesFastCaloSim():
dataType = DataType.FastSim
else:
dataType = DataType.FullSim
else:
dataType = DataType.Data
isPhyslite = 'StreamDAOD_PHYSLITE' in autoconfigFromFlags.Input.ProcessingTags
geometry = autoconfigFromFlags.GeoModel.Run
dsid = autoconfigFromFlags.Input.MCChannelNumber
else:
dataType = DataType(dataType)
# allow possible string argument for `geometry` and convert it to enum
geometry = LHCPeriod(geometry)
if geometry not in [LHCPeriod.Run2, LHCPeriod.Run3] :
raise ValueError ("invalid Run geometry: %s" % geometry.value)
self._dataType = dataType
self._isPhyslite = isPhyslite
self._geometry = geometry
self._dsid = dsid
self._algSeq = algSeq
self._containerConfig = {}
self._outputContainers = {}
@@ -139,6 +156,10 @@ class ConfigAccumulator :
"""the LHC Run period we run on"""
return self._geometry
def dsid(self) :
"""the mcChannelNumber or DSID of the sample we run on"""
return self._dsid
def createAlgorithm (self, type, name, reentrant=False) :
"""create a new algorithm and register it as the current algorithm"""
if self._pass == 0 :
Loading