Skip to content
Snippets Groups Projects
Commit 46b5849c authored by Sarah Louise Williams's avatar Sarah Louise Williams
Browse files

further fixes for python3

parent 95d4b3a3
No related branches found
No related tags found
No related merge requests found
...@@ -13,19 +13,8 @@ __all__ = ["JetConstit", "JetGhost", "JetDefinition","xAODType"] ...@@ -13,19 +13,8 @@ __all__ = ["JetConstit", "JetGhost", "JetDefinition","xAODType"]
from AthenaCommon import Logging from AthenaCommon import Logging
jetlog = Logging.logging.getLogger('JetDefinition') 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 from xAODBase.xAODType import xAODType
# Code from JetRecUtils # Code from JetRecUtils
# define the convention that we write R truncating the decimal point # define the convention that we write R truncating the decimal point
# if R>=1, then we write R*10 # if R>=1, then we write R*10
......
...@@ -66,7 +66,6 @@ namespace met { ...@@ -66,7 +66,6 @@ namespace met {
//declareProperty( "InputPVKey", m_pv_inputkey = "PrimaryVertices" ); //declareProperty( "InputPVKey", m_pv_inputkey = "PrimaryVertices" );
declareProperty( "VetoNegEClus", m_cl_vetoNegE = true ); declareProperty( "VetoNegEClus", m_cl_vetoNegE = true );
declareProperty( "OnlyNegEClus", m_cl_onlyNegE = false ); declareProperty( "OnlyNegEClus", m_cl_onlyNegE = false );
declareProperty( "PFOTool", m_pfotool );
} }
// Destructor // Destructor
......
...@@ -224,7 +224,7 @@ def getMETAssocAlg(algName='METAssociation',configs={},tools=[],msglvl=INFO): ...@@ -224,7 +224,7 @@ def getMETAssocAlg(algName='METAssociation',configs={},tools=[],msglvl=INFO):
print( prefix, 'Taking configurations from METRecoFlags') print( prefix, 'Taking configurations from METRecoFlags')
configs = metFlags.METAssocConfigs() configs = metFlags.METAssocConfigs()
print(configs) print(configs)
for key,conf in configs.iteritems(): for key,conf in six.iteritems(configs):
print( prefix, 'Generate METAssocTool for MET_'+key) print( prefix, 'Generate METAssocTool for MET_'+key)
assoctool = getMETAssocTool(conf,msglvl) assoctool = getMETAssocTool(conf,msglvl)
assocTools.append(assoctool) assocTools.append(assoctool)
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#from METReconstruction.METRecoFlags import metFlags #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 AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from METUtilities.METMakerConfig import getMETMakerAlg from METUtilities.METMakerConfig import getMETMakerAlg
#attempt at migrating to the new configuration system #attempt at migrating to the new configuration system
def METAssociator_Cfg(configFlags): def METAssociatorCfg(configFlags):
sequencename = "METAssociation" sequencename = "METAssociation"
components = ComponentAccumulator() components = ComponentAccumulator()
......
from AthenaCommon import Loggingfrom AthenaConfiguration.ComponentAccumulator import ComponentAccumulatorfrom 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) from AthenaCommon import Loggingfrom AthenaConfiguration.ComponentAccumulator import ComponentAccumulatorfrom 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 \ No newline at end of file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment