From 46b5849cfa7c6c594aca95e8b17cfc42b8a61247 Mon Sep 17 00:00:00 2001 From: williams <sarah.louise.williams@cern.ch> Date: Fri, 31 Jul 2020 16:24:00 +0100 Subject: [PATCH] further fixes for python3 --- .../Jet/JetRecConfig/python/JetDefinition.py | 11 ----------- .../MET/METReconstruction/Root/METSoftTermsTool.cxx | 1 - .../python/LegacyRunII/METAssocConfig.py | 2 +- .../{METCfg_Associator.py => METAssociatorCfg.py} | 4 ++-- .../python/{METCfg_Calo.py => METCalo_Cfg.py} | 0 .../python/{METCfg_Track.py => METTrack_Cfg.py} | 0 .../python/{METCfg_Truth.py => METTruth_Cfg.py} | 0 .../share/{METRecConfig.py => METRecCfg.py} | 2 +- 8 files changed, 4 insertions(+), 16 deletions(-) rename Reconstruction/MET/METReconstruction/python/{METCfg_Associator.py => METAssociatorCfg.py} (98%) rename Reconstruction/MET/METReconstruction/python/{METCfg_Calo.py => METCalo_Cfg.py} (100%) rename Reconstruction/MET/METReconstruction/python/{METCfg_Track.py => METTrack_Cfg.py} (100%) rename Reconstruction/MET/METReconstruction/python/{METCfg_Truth.py => METTruth_Cfg.py} (100%) rename Reconstruction/MET/METReconstruction/share/{METRecConfig.py => METRecCfg.py} (76%) diff --git a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py index 34e0c6ed84c..9c72b6063f8 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py @@ -13,19 +13,8 @@ __all__ = ["JetConstit", "JetGhost", "JetDefinition","xAODType"] from AthenaCommon import Logging jetlog = Logging.logging.getLogger('JetDefinition') -# Trigger xAODType.ObjectType dict entry loading -#import cppyy -#try: -# cppyy.loadDictionary('xAODBaseObjectTypeDict') -#except Exception: -# pass -#import ROOT -#from ROOT import xAODType -#xAODType.ObjectType - from xAODBase.xAODType import xAODType - # Code from JetRecUtils # define the convention that we write R truncating the decimal point # if R>=1, then we write R*10 diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx index 7feb3f0dbda..9364356484b 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx @@ -66,7 +66,6 @@ namespace met { //declareProperty( "InputPVKey", m_pv_inputkey = "PrimaryVertices" ); declareProperty( "VetoNegEClus", m_cl_vetoNegE = true ); declareProperty( "OnlyNegEClus", m_cl_onlyNegE = false ); - declareProperty( "PFOTool", m_pfotool ); } // Destructor diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py index d5db42f1f64..7eda937940e 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py @@ -224,7 +224,7 @@ def getMETAssocAlg(algName='METAssociation',configs={},tools=[],msglvl=INFO): print( prefix, 'Taking configurations from METRecoFlags') configs = metFlags.METAssocConfigs() print(configs) - for key,conf in configs.iteritems(): + for key,conf in six.iteritems(configs): print( prefix, 'Generate METAssocTool for MET_'+key) assoctool = getMETAssocTool(conf,msglvl) assocTools.append(assoctool) diff --git a/Reconstruction/MET/METReconstruction/python/METCfg_Associator.py b/Reconstruction/MET/METReconstruction/python/METAssociatorCfg.py similarity index 98% rename from Reconstruction/MET/METReconstruction/python/METCfg_Associator.py rename to Reconstruction/MET/METReconstruction/python/METAssociatorCfg.py index 845d2447946..a9e4721ee59 100644 --- a/Reconstruction/MET/METReconstruction/python/METCfg_Associator.py +++ b/Reconstruction/MET/METReconstruction/python/METAssociatorCfg.py @@ -1,13 +1,13 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration #from METReconstruction.METRecoFlags import metFlags -from METReconstruction.METAssocCfg import AssocConfig, METAssocConfig,getMETAssocTool,getMETAssocAlg +from METReconstruction.METAssocCfg import AssocConfig, METAssocConfig,getMETAssocAlg from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from METUtilities.METMakerConfig import getMETMakerAlg #attempt at migrating to the new configuration system -def METAssociator_Cfg(configFlags): +def METAssociatorCfg(configFlags): sequencename = "METAssociation" components = ComponentAccumulator() diff --git a/Reconstruction/MET/METReconstruction/python/METCfg_Calo.py b/Reconstruction/MET/METReconstruction/python/METCalo_Cfg.py similarity index 100% rename from Reconstruction/MET/METReconstruction/python/METCfg_Calo.py rename to Reconstruction/MET/METReconstruction/python/METCalo_Cfg.py diff --git a/Reconstruction/MET/METReconstruction/python/METCfg_Track.py b/Reconstruction/MET/METReconstruction/python/METTrack_Cfg.py similarity index 100% rename from Reconstruction/MET/METReconstruction/python/METCfg_Track.py rename to Reconstruction/MET/METReconstruction/python/METTrack_Cfg.py diff --git a/Reconstruction/MET/METReconstruction/python/METCfg_Truth.py b/Reconstruction/MET/METReconstruction/python/METTruth_Cfg.py similarity index 100% rename from Reconstruction/MET/METReconstruction/python/METCfg_Truth.py rename to Reconstruction/MET/METReconstruction/python/METTruth_Cfg.py diff --git a/Reconstruction/MET/METReconstruction/share/METRecConfig.py b/Reconstruction/MET/METReconstruction/share/METRecCfg.py similarity index 76% rename from Reconstruction/MET/METReconstruction/share/METRecConfig.py rename to Reconstruction/MET/METReconstruction/share/METRecCfg.py index d5373bb5084..48d7d456a61 100644 --- a/Reconstruction/MET/METReconstruction/share/METRecConfig.py +++ b/Reconstruction/MET/METReconstruction/share/METRecCfg.py @@ -1 +1 @@ -from AthenaCommon import Logging from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory if __name__=="__main__": # Setting needed for the ComponentAccumulator to do its thing from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=True # Set message levels from AthenaCommon import Constants msgLvl = "WARNING" from AthenaCommon.Logging import log log.setLevel(msgLvl) # Config flags steer the job at various levels from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.isMC = True ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ASG/mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1"] # Flags relating to multithreaded execution nthreads=0 ConfigFlags.Concurrency.NumThreads =nthreads if nthreads>0: ConfigFlags.Concurrency.NumThreads = 1 ConfigFlags.Concurrency.NumConcurrentEvents = 1 ConfigFlags.MET.UseTracks = True ConfigFlags.MET.DoPFlow = True if ConfigFlags.Beam.Type == 'cosmics' or ConfigFlags.Beam.Type == 'singlebeam':# used to have " or not rec.doInDet()" on the end ConfigFlags.MET.UseTracks = False ConfigFlags.MET.DoPFlow = False print("METReconstruction_jobOptions: detected cosmics/single-beam configuration -- switch off track-based MET reco") ConfigFlags.lock() # Get a ComponentAccumulator setting up the fundamental Athena job from AthenaConfiguration.MainServicesConfig import MainServicesCfg cfg=MainServicesCfg(ConfigFlags) # Add the components for reading in pool files from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) StoreGateSvc=CompFactory.StoreGateSvc cfg.addService(StoreGateSvc("DetectorStore")) #Setup up general geometry modelConfig=ComponentAccumulator() from AtlasGeoModel.GeoModelConfig import GeoModelCfg modelConfig=GeoModelCfg(ConfigFlags) cfg.merge(modelConfig) from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg cfg.merge(MagneticFieldSvcCfg(ConfigFlags)) from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg cfg.merge(TrackingGeometrySvcCfg(ConfigFlags)) from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg cfg.merge(MuonGeoModelCfg(ConfigFlags)) # Nowadays the jet calibration tool requires the EventInfo # to be decorated with lumi info, which is not in Run 2 AODs from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg cfg.merge(LuminosityCondAlgCfg(ConfigFlags)) from AthenaConfiguration.ComponentFactory import CompFactory muWriter = CompFactory.LumiBlockMuWriter("LumiBlockMuWriter",LumiDataKey="LuminosityCondData") cfg.addEventAlgo(muWriter,"AthAlgSeq") # Get Jet Inputs from JetRecConfig.StandardJetDefs import EMTopoOrigin, LCTopoOrigin, CHSPFlow from JetRecConfig import JetRecConfig for jetdef in [EMTopoOrigin,LCTopoOrigin,CHSPFlow]: cfg.merge(JetRecConfig.JetInputCfg( [jetdef], ConfigFlags)) # Need to rename the collections in the xAOD in order to avoid conflicts from SGComps.AddressRemappingConfig import InputRenameCfg cfg.merge(InputRenameCfg('xAOD::MissingETContainer','MET_Track','MET_Track_Old')) cfg.merge(InputRenameCfg('xAOD::MissingETAuxContainer','MET_TrackAux.','MET_Track_OldAux.')) cfg.merge(InputRenameCfg('xAOD::MissingETContainer','MET_EMTopo','MET_EMTopo_Old')) cfg.merge(InputRenameCfg('xAOD::MissingETAuxContainer','MET_EMTopoAux.','MET_EMTopo_OldAux.')) cfg.merge(InputRenameCfg('xAOD::MissingETContainer','MET_LocHadTopo','MET_LocHadTopo_Old')) cfg.merge(InputRenameCfg('xAOD::MissingETAuxContainer','MET_LocHadTopoAux.','MET_LocHadTopo_OldAux.')) from METReconstruction.METCfg_Track import METTrack_Cfg cfg.merge(METTrack_Cfg(ConfigFlags)) from METReconstruction.METCfg_Calo import METCalo_Cfg cfg.merge(METCalo_Cfg(ConfigFlags)) if ConfigFlags.Input.isMC: from METReconstruction.METCfg_Truth import METTruth_Cfg cfg.merge(METTruth_Cfg(ConfigFlags)) from METReconstruction.METCfg_Associator import METAssociator_Cfg cfg.merge(METAssociator_Cfg(ConfigFlags)) outputlist = ["EventInfo#*"] outputlist+=["xAOD::MissingETContainer#"+"MET_Track","xAOD::MissingETAuxContainer#"+"MET_Track"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_Track_Old","xAOD::MissingETAuxContainer#"+"MET_Track_Old"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_EMTopo","xAOD::MissingETAuxContainer#"+"MET_EMTopo"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_EMTopo_Old","xAOD::MissingETAuxContainer#"+"MET_EMTopo_Old"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_AntiKt4EMPFlow","xAOD::MissingETAuxContainer#"+"MET_AntiKt4EMPFlow"+"Aux."] from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg cfg.merge(OutputStreamCfg(ConfigFlags,"xAOD",ItemList=outputlist)) # Optionally, print the contents of the store every event cfg.getService("StoreGateSvc").Dump = False #print "Running final component accumulator" #cfg.printConfig() cfg.run(maxEvents=20) \ No newline at end of file +from AthenaCommon import Logging from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory if __name__=="__main__": # Setting needed for the ComponentAccumulator to do its thing from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=True # Set message levels from AthenaCommon import Constants msgLvl = "WARNING" from AthenaCommon.Logging import log log.setLevel(msgLvl) # Config flags steer the job at various levels from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.isMC = True ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ASG/mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1"] # Flags relating to multithreaded execution nthreads=0 ConfigFlags.Concurrency.NumThreads =nthreads if nthreads>0: ConfigFlags.Concurrency.NumThreads = 1 ConfigFlags.Concurrency.NumConcurrentEvents = 1 ConfigFlags.MET.UseTracks = True ConfigFlags.MET.DoPFlow = True if ConfigFlags.Beam.Type == 'cosmics' or ConfigFlags.Beam.Type == 'singlebeam':# used to have " or not rec.doInDet()" on the end ConfigFlags.MET.UseTracks = False ConfigFlags.MET.DoPFlow = False print("METReconstruction_jobOptions: detected cosmics/single-beam configuration -- switch off track-based MET reco") ConfigFlags.lock() # Get a ComponentAccumulator setting up the fundamental Athena job from AthenaConfiguration.MainServicesConfig import MainServicesCfg cfg=MainServicesCfg(ConfigFlags) # Add the components for reading in pool files from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) StoreGateSvc=CompFactory.StoreGateSvc cfg.addService(StoreGateSvc("DetectorStore")) #Setup up general geometry modelConfig=ComponentAccumulator() from AtlasGeoModel.GeoModelConfig import GeoModelCfg modelConfig=GeoModelCfg(ConfigFlags) cfg.merge(modelConfig) from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg cfg.merge(MagneticFieldSvcCfg(ConfigFlags)) from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg cfg.merge(TrackingGeometrySvcCfg(ConfigFlags)) from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg cfg.merge(MuonGeoModelCfg(ConfigFlags)) # Nowadays the jet calibration tool requires the EventInfo # to be decorated with lumi info, which is not in Run 2 AODs from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg cfg.merge(LuminosityCondAlgCfg(ConfigFlags)) from AthenaConfiguration.ComponentFactory import CompFactory muWriter = CompFactory.LumiBlockMuWriter("LumiBlockMuWriter",LumiDataKey="LuminosityCondData") cfg.addEventAlgo(muWriter,"AthAlgSeq") # Get Jet Inputs from JetRecConfig.StandardJetDefs import EMTopoOrigin, LCTopoOrigin, CHSPFlow from JetRecConfig import JetRecConfig for jetdef in [EMTopoOrigin,LCTopoOrigin,CHSPFlow]: cfg.merge(JetRecConfig.JetInputCfg( [jetdef], ConfigFlags)) # Need to rename the collections in the xAOD in order to avoid conflicts from SGComps.AddressRemappingConfig import InputRenameCfg cfg.merge(InputRenameCfg('xAOD::MissingETContainer','MET_Track','MET_Track_Old')) cfg.merge(InputRenameCfg('xAOD::MissingETAuxContainer','MET_TrackAux.','MET_Track_OldAux.')) cfg.merge(InputRenameCfg('xAOD::MissingETContainer','MET_EMTopo','MET_EMTopo_Old')) cfg.merge(InputRenameCfg('xAOD::MissingETAuxContainer','MET_EMTopoAux.','MET_EMTopo_OldAux.')) cfg.merge(InputRenameCfg('xAOD::MissingETContainer','MET_LocHadTopo','MET_LocHadTopo_Old')) cfg.merge(InputRenameCfg('xAOD::MissingETAuxContainer','MET_LocHadTopoAux.','MET_LocHadTopo_OldAux.')) from METReconstruction.METTrack_Cfg import METTrack_Cfg cfg.merge(METTrack_Cfg(ConfigFlags)) from METReconstruction.METCalo_Cfg import METCalo_Cfg cfg.merge(METCalo_Cfg(ConfigFlags)) if ConfigFlags.Input.isMC: from METReconstruction.METTruth_Cfg import METTruth_Cfg cfg.merge(METTruth_Cfg(ConfigFlags)) from METReconstruction.METAssociatorCfg import METAssociatorCfg cfg.merge(METAssociatorCfg(ConfigFlags)) outputlist = ["EventInfo#*"] outputlist+=["xAOD::MissingETContainer#"+"MET_Track","xAOD::MissingETAuxContainer#"+"MET_Track"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_Track_Old","xAOD::MissingETAuxContainer#"+"MET_Track_Old"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_EMTopo","xAOD::MissingETAuxContainer#"+"MET_EMTopo"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_EMTopo_Old","xAOD::MissingETAuxContainer#"+"MET_EMTopo_Old"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_AntiKt4EMPFlow","xAOD::MissingETAuxContainer#"+"MET_AntiKt4EMPFlow"+"Aux."] from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg cfg.merge(OutputStreamCfg(ConfigFlags,"xAOD",ItemList=outputlist)) # Optionally, print the contents of the store every event cfg.getService("StoreGateSvc").Dump = False #print "Running final component accumulator" #cfg.printConfig() cfg.run(maxEvents=20) \ No newline at end of file -- GitLab