From 18aec75c9da8f9bb7bdec7fa5e9efb9635e9d2bf Mon Sep 17 00:00:00 2001 From: Walter Lampl <walter.lampl@cern.ch> Date: Mon, 17 Sep 2018 15:28:48 +0000 Subject: [PATCH] Programmatic python Flags from Tomasz --- .../CaloRec/python/CaloCellMakerConfig.py | 2 +- .../CaloRec/python/CaloTopoClusterConfig.py | 8 +-- .../CaloTools/python/CaloNoiseToolConfig.py | 14 ++--- .../python/AllConfigFlags.py | 54 +++++++++++++------ .../python/AthConfigFlags.py | 12 +++-- .../python/testAllConfigFlags.py | 6 +-- .../AthenaPoolCnvSvc/python/PoolReadConfig.py | 2 +- Database/IOVDbSvc/python/IOVDbAutoCfgFlags.py | 4 +- Database/IOVDbSvc/python/IOVDbSvcConfig.py | 8 +-- .../AtlasGeoModel/python/GeoModelConfig.py | 2 +- .../python/ByteStreamConfig.py | 6 +-- .../LArBadChannelTool/CMakeLists.txt | 6 +++ .../python/LArBadChannelConfig.py | 12 ++--- .../LArCabling/python/LArCablingConfig.py | 2 +- .../LArCellRec/python/LArCellBuilderConfig.py | 8 +-- .../LArCellRec/python/LArConfigFlags.py | 12 ++--- .../LArGeoAlgsNV/python/LArGMConfig.py | 4 +- .../L1Decoder/python/L1DecoderConfig.py | 6 +-- .../L1Decoder/python/L1MuonConfig.py | 2 +- .../python/ElectronMenuConfig.py | 11 ++-- .../python/PhotonMenuConfig.py | 7 ++- .../TrigUpgradeTest/share/newJOtest.py | 9 ++-- .../TriggerJobOpts/python/TriggerConfig.py | 4 +- .../python/TriggerConfigFlags.py | 4 +- 24 files changed, 117 insertions(+), 88 deletions(-) diff --git a/Calorimeter/CaloRec/python/CaloCellMakerConfig.py b/Calorimeter/CaloRec/python/CaloCellMakerConfig.py index 01f35296ad0..7d35c0ad382 100644 --- a/Calorimeter/CaloRec/python/CaloCellMakerConfig.py +++ b/Calorimeter/CaloRec/python/CaloCellMakerConfig.py @@ -38,7 +38,7 @@ if __name__=="__main__": from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.set("global.InputFiles",["myRDO.pool.root"]) + ConfigFlags.Input.Files=["myRDO.pool.root",] ConfigFlags.lock() cfg=ComponentAccumulator() diff --git a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py index 4d22be69453..ea98ef8a097 100644 --- a/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py +++ b/Calorimeter/CaloRec/python/CaloTopoClusterConfig.py @@ -59,7 +59,7 @@ def CaloTopoClusterCfg(configFlags): TopoMaker.SeedCutsInAbsE = True TopoMaker.ClusterEtorAbsEtCut = 0.0*MeV # use 2-gaussian or single gaussian noise for TileCal - TopoMaker.TwoGaussianNoise = configFlags.get("Calo.TopoCluster.doTwoGaussianNoise") + TopoMaker.TwoGaussianNoise = configFlags.Calo.TopoCluster.doTwoGaussianNoise TopoSplitter = CaloTopoClusterSplitter("TopoSplitter") # cells from the following samplings will be able to form local @@ -81,7 +81,7 @@ def CaloTopoClusterCfg(configFlags): "FCAL1","FCAL2"] TopoSplitter.ShareBorderCells = True TopoSplitter.RestrictHECIWandFCalNeighbors = False - TopoSplitter.WeightingOfNegClusters = configFlags.get("Calo.TopoCluster.doTreatEnergyCutAsAbsolute") + TopoSplitter.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute # # the following options are not set, since these are the default # values @@ -110,8 +110,8 @@ if __name__=="__main__": log.setLevel(DEBUG) - ConfigFlags.set("global.isMC",False) - ConfigFlags.set("global.InputFiles",["myESD.pool.root"]) + ConfigFlags.Input.isMC = False + ConfigFlags.Input.Files = ["myESD.pool.root"] ConfigFlags.lock() cfg=ComponentAccumulator() diff --git a/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py b/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py index c3fe4f10e23..7a2b3ac6143 100644 --- a/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py +++ b/Calorimeter/CaloTools/python/CaloNoiseToolConfig.py @@ -8,14 +8,14 @@ def CaloNoiseToolCfg(configFlags): log = logging.getLogger(__name__) result=ComponentAccumulator() - isMC=configFlags.get("global.isMC") - fixedLumi=configFlags.get("Calo.Noise.fixedLumiForNoise") - useCaloLumi=configFlags.get("Calo.Noise.useCaloNoiseLumi") + isMC=configFlags.Input.isMC + fixedLumi=configFlags.Calo.Noise.fixedLumiForNoise + useCaloLumi=configFlags.Calo.Noise.useCaloNoiseLumi caloNoiseToolDB=CaloNoiseToolDB("CaloNoiseTool") - if configFlags.get("global.isOnline"): + if configFlags.Common.isOnline: #online mode: folder = "/CALO/Noise/CellNoise" result.merge(addFolders(configFlags,inputFlags,folder,'CALO_ONL')) @@ -50,9 +50,9 @@ def CaloNoiseToolCfg(configFlags): caloNoiseToolDB.LumiFolderName = lumiFolder caloNoiseToolDB.Luminosity=-1. else: - estimatedLumi=configFlags.get("global.estimatedLuminosity") + estimatedLumi=configFlags.Beam.estimatedLuminosity caloNoiseToolDB.Luminosity=estimatedLumi/1e+33 - log.info(" Luminosity (in 10**33) units used for pileup noise from global flags: %f", caloNoiseToolDB.Luminosity) + log.info(" Luminosity (in 10**33) units used for pileup noise from Beam flags: %f", caloNoiseToolDB.Luminosity) folders = (("CALO_OFL","/CALO/Ofl/Noise/CellNoise"), @@ -82,7 +82,7 @@ def CaloNoiseToolCfg(configFlags): ("TILE_OFL","/TILE/OFL02/NOISE/CELL") ] - if configFlags.get("IOVDb.DatabaseInstance")=="COMP200": + if configFlags.IOVDb.DatabaseInstance=="COMP200": folders.append(("CALO_OFL","/CALO/Ofl/Noise/CellNoise")), #Fixme: Add rescaling of noise based on HV! diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index 608f1e5ace7..af3b04f5ceb 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -9,26 +9,46 @@ def _createCfgFlags(): acf=AthConfigFlags() #Global Flags: +#They are becoming, please use the specific flags below. + # acf.addFlag('global.InputFiles',["_ATHENA_GENERIC_INPUTFILE_NAME_",]) + # acf.addFlag('global.isOnline',False) + # acf.addFlag('global.GeoLayout',"atlas") + # acf.addFlag('global.ProjectName',lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("Project","data17_13TeV")) + # acf.addFlag('global.isMC',lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("isMC",None)) + # acf.addFlag('global.BunchSpacing',25) # Bunch spacing in ns + # acf.addFlag("global.NumberOfCollisions",0) #"Number of collisions per beam crossing. Should be 2.3*(L/10**33)*(bunchSpacing/25 ns) + # acf.addFlag("global.BeamType",'collisions') # "Specify data taking type: 'collisions' (default), 'singlebeam','cosmics'") + # acf.addFlag("global.BeamEnergy",lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("BeamEnergy",7*TeV)) + # acf.addFlag("global.estimatedLuminosity",lambda prevFlags : 1E33*(prevFlags.get("global.NumberOfCollisions")/2.3)* \ + # (25./prevFlags.get("global.BunchSpacing"))) + # acf.addFlag("global.RunNumber",lambda prevFlags : list(GetFileMD(prevFlags.get("global.InputFiles")).get("RunNumber",None))) + +# Replacement for global flags +# people please comment here + acf.addFlag('Input.Files', ["_ATHENA_GENERIC_INPUTFILE_NAME_",] ) + acf.addFlag('Input.isMC', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("isMC",None)) + acf.addFlag('Input.RunNumber', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("RunNumber",None))) + acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("Project","data17_13TeV") ) + + + acf.addFlag('Common.isOnline', False ) # Job runs in an online environment (access only to resources available at P1) - acf.addFlag('global.InputFiles',["_ATHENA_GENERIC_INPUTFILE_NAME_",]) - acf.addFlag('global.isOnline',False) - acf.addFlag('global.GeoLayout',"atlas") - acf.addFlag('global.ProjectName',lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("Project","data17_13TeV")) - acf.addFlag('global.isMC',lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("isMC",None)) - acf.addFlag('global.BunchSpacing',25) # Bunch spacing in ns - acf.addFlag("global.NumberOfCollisions",0) #"Number of collisions per beam crossing. Should be 2.3*(L/10**33)*(bunchSpacing/25 ns) - acf.addFlag("global.BeamType",'collisions') # "Specify data taking type: 'collisions' (default), 'singlebeam','cosmics'") - acf.addFlag("global.BeamEnergy",lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("BeamEnergy",7*TeV)) - acf.addFlag("global.estimatedLuminosity",lambda prevFlags : 1E33*(prevFlags.get("global.NumberOfCollisions")/2.3)* \ - (25./prevFlags.get("global.BunchSpacing"))) - acf.addFlag("global.RunNumber",lambda prevFlags : list(GetFileMD(prevFlags.get("global.InputFiles")).get("RunNumber",None))) + # replace global.Beam* + acf.addFlag('Beam.BunchSpacing', 25) + acf.addFlag("Beam.NumberOfCollisions",0) + acf.addFlag('Beam.Type', 'collisions') + acf.addFlag('Beam.Energy', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get('BeamEnergy',7*TeV)) + acf.addFlag('Beam.estimatedLuminosity', lambda prevFlags : ( 1E33*(prevFlags.Beam.NumberOfCollisions)/2.3 ) *\ + (25./prevFlags.Beam.BunchSpacing)) + #Geo Model Flags: - acf.addFlag("GeoModel.AtlasVersion",lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("Geometry","ATLAS-R2-2016-01-00-01")) + acf.addFlag('GeoModel.Layout', 'atlas') # replaces global.GeoLayout + acf.addFlag("GeoModel.AtlasVersion", lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("Geometry","ATLAS-R2-2016-01-00-01")) #IOVDbSvc Flags: - acf.addFlag("IOVDb.GlobalTag",lambda prevFlags : GetFileMD(prevFlags.get("global.InputFiles")).get("ConditionsTag","CONDBR2-BLKPA-2017-05")) + acf.addFlag("IOVDb.GlobalTag",lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("ConditionsTag","CONDBR2-BLKPA-2017-05")) from IOVDbSvc.IOVDbAutoCfgFlags import getDatabaseInstanceDefault acf.addFlag("IOVDb.DatabaseInstance",getDatabaseInstanceDefault) @@ -52,7 +72,6 @@ def _createCfgFlags(): from TriggerJobOpts.TriggerConfigFlags import createTriggerFlags acf.join( createTriggerFlags() ) - return acf @@ -63,9 +82,10 @@ del _createCfgFlags if __name__=="__main__": import sys if len(sys.argv)>1: - ConfigFlags.set("global.InputFiles",sys.argv[1:]) + ConfigFlags.Input.Files = sys.argv[1:] else: - ConfigFlags.set("global.InputFiles",[ "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1",]) + ConfigFlags.Input.Files = [ "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1",] + ConfigFlags.initAll() ConfigFlags.dump() diff --git a/Control/AthenaConfiguration/python/AthConfigFlags.py b/Control/AthenaConfiguration/python/AthConfigFlags.py index d16e648e011..a53d85e8259 100644 --- a/Control/AthenaConfiguration/python/AthConfigFlags.py +++ b/Control/AthenaConfiguration/python/AthConfigFlags.py @@ -1,7 +1,7 @@ # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from copy import deepcopy - +from AthenaCommon.Logging import logging class CfgFlag(object): __slots__ = ['_value','_setDef'] @@ -67,7 +67,10 @@ class FlagAddress(object): class AthConfigFlags(object): + def __init__(self,inputflags=None): + self._msg = logging.getLogger('AthConfigFlags') + if inputflags: self._flagdict=inputflags else: @@ -91,7 +94,8 @@ class AthConfigFlags(object): return name in self._flagdict def set(self,name,value): - # add obsoletness message here + import warnings + warnings.warn("The flags should be set with programatic syntax: flag."+name, stacklevel=2 ) self._set(name,value) def _set(self,name,value): @@ -108,9 +112,11 @@ class AthConfigFlags(object): raise KeyError(errString) def get(self,name): - # add obsoltness message here + import warnings + warnings.warn("The flags should be red with programatic syntax: flag."+name, stacklevel=2 ) return self._get(name) + def _get(self,name): try: return self._flagdict[name].get(self) diff --git a/Control/AthenaConfiguration/python/testAllConfigFlags.py b/Control/AthenaConfiguration/python/testAllConfigFlags.py index b273dac31a2..d5360d3cc94 100644 --- a/Control/AthenaConfiguration/python/testAllConfigFlags.py +++ b/Control/AthenaConfiguration/python/testAllConfigFlags.py @@ -5,8 +5,8 @@ acf.addFlag("flag2",2) acf.addFlag("flag3", lambda prev: prev.get("flag2")*2 ) acf.addFlag("flag7", lambda prev: prev.get("flag1")+27) -print acf.get("flag1") -print acf.get("flag3") +print acf.flag1 +print acf.flag3 #acf.addFlag("flag4", lambda prev: prev.get("flag5")*2 ) #acf.addFlag("flag5", lambda prev: prev.get("flag4")*2 ) @@ -25,7 +25,7 @@ print "Initial flag container" acf.dump() acfPrime=acf.clone() -acfPrime.set("flag3",42) +acfPrime.flag3 = 42 print "Cloned flag container" acfPrime.dump() diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py index 9c31cf4acf3..02b2ba2e322 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py @@ -6,7 +6,7 @@ def PoolReadCfg(configFlags): athena services required for POOL file reading """ - filenames=configFlags("global.InputFiles") + filenames=configFlags.Input.Files result=ComponentAccumulator() diff --git a/Database/IOVDbSvc/python/IOVDbAutoCfgFlags.py b/Database/IOVDbSvc/python/IOVDbAutoCfgFlags.py index b6350759dee..e367b78185b 100644 --- a/Database/IOVDbSvc/python/IOVDbAutoCfgFlags.py +++ b/Database/IOVDbSvc/python/IOVDbAutoCfgFlags.py @@ -1,12 +1,12 @@ def getDatabaseInstanceDefault(prevFlags): - isMC=prevFlags.get("global.isMC") + isMC=prevFlags.Input.isMC if (isMC): return "OFLP200" # real-data - projectName=prevFlags.get("global.ProjectName") + projectName=prevFlags.Input.ProjectName try: year=int(projectName[4:6]); except: diff --git a/Database/IOVDbSvc/python/IOVDbSvcConfig.py b/Database/IOVDbSvc/python/IOVDbSvcConfig.py index 2cf7568a56b..df76c44879b 100644 --- a/Database/IOVDbSvc/python/IOVDbSvcConfig.py +++ b/Database/IOVDbSvc/python/IOVDbSvcConfig.py @@ -29,11 +29,11 @@ def IOVDbSvcCfg(configFlags): #m_h_metaDataTool("IOVDbMetaDataTool"), #m_h_tagInfoMgr("TagInfoMgr", name), - isMC=configFlags.get("global.isMC") + isMC=configFlags.Input.isMC # Set up IOVDbSvc iovDbSvc=IOVDbSvc() - dbname=configFlags.get("IOVDb.DatabaseInstance") + dbname=configFlags.IOVDb.DatabaseInstance localfile="sqlite://;schema=mycool.db;dbname=" iovDbSvc.dbConnection=localfile+dbname @@ -44,7 +44,7 @@ def IOVDbSvcCfg(configFlags): iovDbSvc.CacheAlign=3 - iovDbSvc.GlobalTag=configFlags.get("IOVDb.GlobalTag") + iovDbSvc.GlobalTag=configFlags.IOVDb.GlobalTag result.addService(iovDbSvc) @@ -97,7 +97,7 @@ def addFolders(configFlags,folderstrings,detDb=None,className=None): if detDb is not None: - dbname=configFlags.get("IOVDb.DatabaseInstance") + dbname=configFlags.IOVDb.DatabaseInstance if not detDb in _dblist.keys(): raise ConfigurationError("Error, db shorthand %s not known") dbstr="<db>"+_dblist[detDb]+"/"+dbname+"</db>" diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py index 743a4bc4747..10e3608c901 100644 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py @@ -1,7 +1,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator def GeoModelCfg(configFlags): - version=configFlags.get("GeoModel.AtlasVersion") + version=configFlags.GeoModel.AtlasVersion from AthenaCommon.AppMgr import release_metadata rel_metadata = release_metadata() diff --git a/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py b/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py index 4da7c633c0f..16e981c9285 100644 --- a/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py +++ b/Event/ByteStreamCnvSvc/python/ByteStreamConfig.py @@ -9,7 +9,7 @@ def TrigBSReadCfg( inputFlags ): """ Creates accumulator for BS reading """ - filenames = inputFlags.get("global.InputFiles") + filenames = inputFlags.Input.Files acc = ComponentAccumulator() @@ -103,7 +103,7 @@ def TrigBSReadCfg( inputFlags ): - if inputFlags.get( "global.isMC" ) == False: + if inputFlags.Input.isMC == False: bsCnvSvc.GetDetectorMask=True # still need to figure out how conditions are setup in new system #from IOVDbSvc.CondDB import conddb @@ -115,7 +115,7 @@ def TrigBSReadCfg( inputFlags ): if __name__ == "__main__": from AthenaConfiguration.ConfigFlags import ConfigFlagContainer flags = ConfigFlagContainer() - flags.set("global.InputFiles", ["dummy.data"]) + flags.Input.Files = ["dummy.data"] acc = TrigBSReadCfg( flags ) acc.store( file( "test.pkl", "w" ) ) diff --git a/LArCalorimeter/LArBadChannelTool/CMakeLists.txt b/LArCalorimeter/LArBadChannelTool/CMakeLists.txt index 069bc40be5a..d1ca42efc5b 100644 --- a/LArCalorimeter/LArBadChannelTool/CMakeLists.txt +++ b/LArCalorimeter/LArBadChannelTool/CMakeLists.txt @@ -44,6 +44,12 @@ atlas_add_dictionary( BadChanDict INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${COOL_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} CaloConditions CaloIdentifier AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities Identifier GaudiKernel LArIdentifier LArRecConditions LArCablingLib LArBadChannelToolLib ) + +atlas_add_test( LArBadChannelConfigTest + SCRIPT python -m LArBadChannelTool.LArBadChannelConfig + POST_EXEC_SCRIPT nopost.sh ) + + # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/LArCalorimeter/LArBadChannelTool/python/LArBadChannelConfig.py b/LArCalorimeter/LArBadChannelTool/python/LArBadChannelConfig.py index ef1f1001f02..a53ac5a8e06 100644 --- a/LArCalorimeter/LArBadChannelTool/python/LArBadChannelConfig.py +++ b/LArCalorimeter/LArBadChannelTool/python/LArBadChannelConfig.py @@ -7,13 +7,13 @@ def LArBadChannelCfg(configFlags): result=LArOnOffIdMappingCfg(configFlags)[0] - if configFlags.get("global.isOnline") or configFlags.get("global.isMC"): + if configFlags.Common.isOnline or configFlags.Input.isMC: foldername="/LAR/BadChannels/BadChannels" else: foldername="/LAR/BadChannelsOfl/BadChannels" pass - if configFlags.get("global.isOnline"): + if configFlags.Common.isOnline: dbname="LAR" else: dbname="LAR_OFL" @@ -28,13 +28,13 @@ def LArBadChannelCfg(configFlags): def LArBadFebCfg(configFlags): result=ComponentAccumulator() - if configFlags.get("global.isOnline") or configFlags.get("global.isMC"): + if configFlags.Common.isOnline or configFlags.Input.isMC: foldername="/LAR/BadChannels/MissingFEBs" else: foldername="/LAR/BadChannelsOfl/MissingFEBs" pass - if configFlags.get("global.isOnline"): + if configFlags.Common.isOnline: dbname="LAR" else: dbname="LAR_OFL" @@ -61,8 +61,8 @@ if __name__=="__main__": Configurable.configurableRun3Behavior=1 log.setLevel(DEBUG) - ConfigFlags.set("global.isMC",False) - ConfigFlags.set("global.InputFiles",["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data"]) + ConfigFlags.Input.isMC = False + ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data"] ConfigFlags.lock() cfg=ComponentAccumulator() diff --git a/LArCalorimeter/LArCabling/python/LArCablingConfig.py b/LArCalorimeter/LArCabling/python/LArCablingConfig.py index 4df3f1846dc..79cdaa28e1c 100644 --- a/LArCalorimeter/LArCabling/python/LArCablingConfig.py +++ b/LArCalorimeter/LArCabling/python/LArCablingConfig.py @@ -13,7 +13,7 @@ def _larCablingCfg(configFlags,algo,folder): "/LAR/Identifier/CalibIdMap":"LARIdentifierCalibIdMap-012" } - if configFlags.get("global.isMC"): + if configFlags.Input.isMC: db='LAR_OFL' if folder in tagsperFolder: ft=tagsperFolder[folder] diff --git a/LArCalorimeter/LArCellRec/python/LArCellBuilderConfig.py b/LArCalorimeter/LArCellRec/python/LArCellBuilderConfig.py index 877c338b8f1..9ba36ba02a0 100644 --- a/LArCalorimeter/LArCellRec/python/LArCellBuilderConfig.py +++ b/LArCalorimeter/LArCellRec/python/LArCellBuilderConfig.py @@ -18,19 +18,19 @@ def LArCellCorrectorCfg(configFlags): correctionTools=[] - if configFlags.get("LAr.RawChannelSource")=="both": + if configFlags.LAr.RawChannelSource=="both": theMerger=LArCellMerger(RawChannelsName="LArRawChannels_FromDigits") correctionTools.append(theMerger) - if configFlags.get("LAr.doCellNoiseMasking") or configFlags.get("LAr.doCellSporadicNoiseMasking"): + if configFlags.LAr.doCellNoiseMasking or configFlags.LAr.doCellSporadicNoiseMasking: from LArBadChannelTool.LArBadChannelConfig import LArBadChannelMaskerCfg theNoiseMasker=LArCellNoiseMaskingTool() - if configFlags.get("LAr.doCellNoiseMasking"): + if configFlags.LAr.doCellNoiseMasking: acc,cellNoiseMaskingTool= LArBadChannelMaskerCfg(configFlags,problemsToMask=["highNoiseHG","highNoiseMG","highNoiseLG","deadReadout","deadPhys"],ToolName="CellNoiseMask") result.merge(acc) theNoiseMasker.MaskingTool=cellNoiseMaskingTool pass - if configFlags.get("LAr.doCellSporadicNoiseMasking"): + if configFlags.LAr.doCellSporadicNoiseMasking: acc,sporadicNoiseMaskingTool=LArBadChannelMaskerCfg(configFlags,problemsToMask=["sporadicBurstNoise",],ToolName="SporadicNoiseMask") result.merge(acc) theNoiseMasker.MaskingSporadicTool=sporadicNoiseMaskingTool diff --git a/LArCalorimeter/LArCellRec/python/LArConfigFlags.py b/LArCalorimeter/LArCellRec/python/LArConfigFlags.py index b408df9c8ac..aa70e8b6ef3 100644 --- a/LArCalorimeter/LArCellRec/python/LArConfigFlags.py +++ b/LArCalorimeter/LArCellRec/python/LArConfigFlags.py @@ -6,9 +6,9 @@ from AthenaConfiguration.AthConfigFlags import AthConfigFlags def createLArConfigFlags(): lcf=AthConfigFlags() - lcf.addFlag("LAr.doAlign",lambda prevFlags : prevFlags.get("global.GeoLayout")=="atlas") - lcf.addFlag("LAr.doHVCorr",lambda prevFlags : not prevFlags.get("global.isMC")) - lcf.addFlag("LAr.doCellEmMisCalib",lambda prevFlags : prevFlags.get("global.isMC")) + lcf.addFlag("LAr.doAlign",lambda prevFlags : prevFlags.GeoModel.Layout=="atlas") + lcf.addFlag("LAr.doHVCorr",lambda prevFlags : not prevFlags.Input.isMC) + lcf.addFlag("LAr.doCellEmMisCalib",lambda prevFlags : prevFlags.Input.isMC) lcf.addFlag("LAr.RawChannelSource",_determineRawChannelSource) #sensible value are "input": read from the input-file, bytestream or RDO) @@ -26,15 +26,15 @@ def _getLArRunInfo(prevFlags): global _lArRunInfo #Model-level cache of lar run info if _lArRunInfo is None: from LArConditionsCommon.LArRunFormat import getLArFormatForRun - runnbr=prevFlags.get("global.RunNumber")[0] #If more than one run, assume config for first run in valid for all runs - dbStr="COOLONL_LAR/"+prevFlags.get("IOVDb.DatabaseInstance") + runnbr=prevFlags.Input.RunNumber[0] #If more than one run, assume config for first run is valid for all runs + dbStr="COOLONL_LAR/"+prevFlags.IOVDb.DatabaseInstance _lArRunInfo=getLArFormatForRun(run=runnbr,connstring=dbStr) print "Got LArRunInfo for run ",runnbr return _lArRunInfo def _determineRawChannelSource(prevFlags): - if (prevFlags.get("global.isMC")): + if (prevFlags.Input.isMC): return "input" lri=_getLArRunInfo(prevFlags) diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py index 58bf13fd062..5f8484e73d0 100644 --- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py +++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py @@ -6,7 +6,7 @@ def LArGMCfg(configFlags): result,gms=GeoModelCfg(configFlags) - doAlignment=configFlags("LAr.doAlign") + doAlignment=configFlags.LAr.doAlign from LArGeoAlgsNV.LArGeoAlgsNVConf import LArDetectorToolNV gms.DetectorTools += [ LArDetectorToolNV(ApplyAlignments=doAlignment) ] @@ -14,7 +14,7 @@ def LArGMCfg(configFlags): result.addService(gms) if doAlignment: - if configFlags.get("global.isMC"): + if configFlags.Input.isMC: #Monte Carlo case: result.merge(addFolders(configFlags,["/LAR/Align","/LAR/LArCellPositionShift"],"LAR_OFL")[0]) else: diff --git a/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py b/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py index 0ccc6c84513..655bb229ef5 100644 --- a/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py +++ b/Trigger/TrigSteer/L1Decoder/python/L1DecoderConfig.py @@ -13,7 +13,7 @@ def L1DecoderCfg(flags): acc = ComponentAccumulator() decoderAlg = L1Decoder() - decoderAlg.ctpUnpacker = CTPUnpackingTool( ForceEnableAllChains = flags.get("Trigger.L1Decoder.forceEnableAllChains"), + decoderAlg.ctpUnpacker = CTPUnpackingTool( ForceEnableAllChains = flags.Trigger.L1Decoder.forceEnableAllChains, MonTool = CTPUnpackingMonitoring(512, 200) ) @@ -41,8 +41,8 @@ if __name__ == "__main__": Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.set("Trigger.L1Decoder.forceEnableAllChains",True) - ConfigFlags.set('global.InputFiles',["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",]) + ConfigFlags.Trigger.L1Decoder.forceEnableAllChains= True + ConfigFlags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",] ConfigFlags.lock() acc, alg = L1DecoderCfg( ConfigFlags ) acc.addEventAlgo(alg) diff --git a/Trigger/TrigSteer/L1Decoder/python/L1MuonConfig.py b/Trigger/TrigSteer/L1Decoder/python/L1MuonConfig.py index 53e6354355a..aafb4271c61 100644 --- a/Trigger/TrigSteer/L1Decoder/python/L1MuonConfig.py +++ b/Trigger/TrigSteer/L1Decoder/python/L1MuonConfig.py @@ -96,7 +96,7 @@ if __name__ == '__main__': Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.set('global.InputFiles',["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",]) + ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",] ConfigFlags.lock() from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py index 794d3e853e2..f67c94668ea 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py @@ -11,13 +11,13 @@ def CaloLUMIBCIDToolCfg( flags, name='CaloLumiBCIDToolDefault' ): from CaloTools.CaloToolsConf import CaloLumiBCIDTool from IOVDbSvc.IOVDbSvcConfig import addFolders - if flags.get('global.isMC') == False: + if flags.Input.isMC == False: from LumiBlockComps.LuminosityToolDefault import LuminosityToolDefault theLumiTool = LuminosityToolDefault() acc.addPublicTool( theLumiTool ) - if flags.get('global.isOnline'): + if flags.Common.isOnline: acc.merge(addFolders(flags, ['/LAR/LArPileup/LArPileupShape<key>LArShape32</key>', '/LAR/LArPileup/LArPileupAverage'], 'LAR_ONL')) else: @@ -290,7 +290,7 @@ def l2ElectronCaloStepCfg( flags, chains ): def generateElectronsCfg( flags ): acc = ComponentAccumulator() - electronChains = [ f.split()[0] for f in flags.get("Trigger.menu.electrons") + flags.get("Trigger.menu.electronsNoID") ] + electronChains = [ f.split()[0] for f in flags.Trigger.menu.electrons + flags.Trigger.menu.electronsNoID ] if not electronChains: return None,None @@ -321,9 +321,8 @@ if __name__ == '__main__': Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.set( "global.InputFiles", - ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] ) - ConfigFlags.set( "Trigger.menu.electrons", ["HLT_e5_etcut L1_EM3", "HLT_e10_etcut L1_EM3"] ) + ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] + ConfigFlags.Trigger.menu.electrons = ["HLT_e5_etcut L1_EM3", "HLT_e10_etcut L1_EM3"] ConfigFlags.lock() acc = ComponentAccumulator() diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py index efd076da632..553681fe348 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py @@ -94,7 +94,7 @@ def l2PhotonRecoStepCfg( flags, chains, inputSequence ): def generatePhotonsCfg( flags ): acc = ComponentAccumulator() - photonChains = [ f.split()[0] for f in flags.get("Trigger.menu.photons") ] + photonChains = [ f.split()[0] for f in flags.Trigger.menu.photons ] if not photonChains: return None,None @@ -112,9 +112,8 @@ if __name__ == "__main__": Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.set( "global.InputFiles", - ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] ) - ConfigFlags.set( "Trigger.menu.photons", ["HLT_g5_etcut L1_EM3", "HLT_g10_etcut L1_EM3"] ) + ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] + ConfigFlags.Trigger.menu.photons = ["HLT_g5_etcut L1_EM3", "HLT_g10_etcut L1_EM3"] ConfigFlags.lock() acc, sequences = generatePhotonsCfg( ConfigFlags ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py index c5affc171f0..ce324e7b5d1 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/newJOtest.py @@ -15,12 +15,11 @@ Configurable.configurableRun3Behavior=1 flags = ConfigFlags -flags.set( "global.isMC", False ) -flags.set( "global.InputFiles", - ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] ) +flags.Input.isMC = False +flags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] -flags.set( "Trigger.LVL1ConfigFile", "LVL1config_Physics_pp_v7.xml" ) -flags.set( "Trigger.L1Decoder.forceEnableAllChains", True) +flags.Trigger.LVL1ConfigFile = "LVL1config_Physics_pp_v7.xml" +flags.Trigger.L1Decoder.forceEnableAllChains = True flags.lock() diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index 8a8a844c20a..1bbe7e5ea2f 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -140,8 +140,8 @@ if __name__ == "__main__": Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.set("Trigger.L1Decoder.forceEnableAllChains",True) - ConfigFlags.set('global.InputFiles',["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",]) + ConfigFlags.Trigger.L1Decoder.forceEnableAllChains = True + ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",] ConfigFlags.lock() acc = triggerRunCfg( ConfigFlags, lambda x: (ComponentAccumulator(), seqAND("whatever") ) ) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py index 2c17a6132ca..7bcc0ddb9f1 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py @@ -6,7 +6,7 @@ def createTriggerFlags(): flags = AthConfigFlags() # enables L1 simulation - flags.addFlag('Trigger.doLVL1', lambda prevFlags: prevFlags.get('global.isMC')) + flags.addFlag('Trigger.doLVL1', lambda prevFlags: prevFlags.Input.isMC) # enables L1 topological trigger simulation flags.addFlag('Trigger.doL1Topo', True ) @@ -172,6 +172,6 @@ import unittest class __YearDependentFlagTest(unittest.TestCase): def runTest(self): flags = createTriggerFlags() - flags.set('Trigger.run2Config', '2017') + flags.Trigger.run2Config='2017' self.assertEqual(flags.Trigger.egamma.clusterCorrectionVersion, "v12phiflip_noecorrnogap", " dependent flag setting does not work") flags.dump() -- GitLab