diff --git a/Reconstruction/MET/METReconstruction/python/METRecoConfig.py b/Reconstruction/MET/METReconstruction/python/METRecoConfig.py index 4b90746432a11c397a496480e043630f4f09f941..beba32e24421c0ff8564171a2bf87d39f522cfe6 100644 --- a/Reconstruction/MET/METReconstruction/python/METRecoConfig.py +++ b/Reconstruction/MET/METReconstruction/python/METRecoConfig.py @@ -102,8 +102,6 @@ def getBuilder(config,suffix,doTracks,doCells,doTriggerMET,doOriginCorrClus): tool.InputComposition = 'PFlow' pfotool = CfgMgr.CP__RetrievePFOTool('MET_PFOTool_'+suffix) from AthenaCommon.AppMgr import ToolSvc - if not hasattr(ToolSvc,pfotool.name()): - ToolSvc += pfotool tool.PFOTool = pfotool if suffix == 'Truth': tool = CfgMgr.met__METTruthTool('MET_TruthTool_'+config.objType) @@ -136,7 +134,6 @@ def getBuilder(config,suffix,doTracks,doCells,doTriggerMET,doOriginCorrClus): config.outputKey = tool.MissingETKey else: tool.MissingETKey = config.outputKey - from AthenaCommon.AppMgr import ToolSvc return tool ################################################################################# @@ -150,7 +147,6 @@ class RefConfig: def getRefiner(config,suffix,trkseltool=None,trkvxtool=None,trkisotool=None,caloisotool=None): tool = None - from AthenaCommon.AppMgr import ToolSvc if config.type == 'TrackFilter': tool = CfgMgr.met__METTrackFilterTool('MET_TrackFilterTool_'+suffix) tool.InputPVKey = defaultInputKey['PrimaryVx'] @@ -182,7 +178,6 @@ def getRegions(config,suffix): tool.InputMETMap = 'METMap_'+suffix tool.InputMETKey = config.outputKey tool.RegionValues = [ 1.5, 3.2, 10 ] - from AthenaCommon.AppMgr import ToolSvc return tool ################################################################################# @@ -260,7 +255,6 @@ class METConfig: if doRegions: self.setupRegions(buildconfigs) # - from AthenaCommon.AppMgr import ToolSvc self.trkseltool=CfgMgr.InDet__InDetTrackSelectionTool("IDTrkSel_MET", CutLevel="TightPrimary", maxZ0SinTheta=3, @@ -338,7 +332,6 @@ def getMETRecoAlg(algName='METReconstruction',configs={},tools=[]): regiontool = getRegionRecoTool(conf) recoTools.append(regiontool) - from AthenaCommon.AppMgr import ToolSvc for tool in recoTools: print prefix, 'Added METRecoTool \''+tool.name()+'\' to alg '+algName diff --git a/Reconstruction/MET/METReconstruction/share/METRecConfig.py b/Reconstruction/MET/METReconstruction/share/METRecConfig.py index 246142eab14a1e49b14bb5492fc8b169751c974b..8514a2ee01199165a170e0ad8cf8c32fd9a74a2d 100644 --- a/Reconstruction/MET/METReconstruction/share/METRecConfig.py +++ b/Reconstruction/MET/METReconstruction/share/METRecConfig.py @@ -1 +1 @@ -from AthenaCommon import Logging from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator 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 = "INFO" 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.lock() # Get a ComponentAccumulator setting up the fundamental Athena job from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg cfg=MainServicesThreadedCfg(ConfigFlags) # Add the components for reading in pool files from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) # Get Jet Inputs from JetRecConfig.StandardJetDefs import EMTopoOrigin, LCTopoOrigin, CHSPFlow from JetRecConfig import JetRecConfig jetcomps=ComponentAccumulator() cfg.merge( JetRecConfig.JetInputCfg( [EMTopoOrigin], ConfigFlags, "EMtopoConstituents")) cfg.merge( JetRecConfig.JetInputCfg( [LCTopoOrigin], ConfigFlags, "LCTopoConstituents")) cfg.merge( JetRecConfig.JetInputCfg( [CHSPFlow], ConfigFlags, "PFlowConstituents")) # Start by just trying to add in MET Reconstruction based on METReconstruction_jobOptions.py from METReconstruction.METRecoFlags import metFlags from AthenaCommon.BeamFlags import jobproperties from RecExConfig.RecFlags import rec if jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam' or not rec.doInDet(): metFlags.UseTracks.set_Value(False) metFlags.DoPFlow.set_Value(False) print "METReconstruction_jobOptions: detected cosmics/single-beam configuration -- switch off track-based MET reco" """ import METReconstruction.METConfig_Calo import METReconstruction.METConfig_Track if rec.doTruth(): import METReconstruction.METConfig_Truth from METReconstruction.METRecoConfig import getMETRecoAlg print "PICKING UP CHANGES" metAlg = getMETRecoAlg('METReconstruction') components_metAlg = ComponentAccumulator() from AthenaCommon.AlgSequence import AthSequencer components_metAlg.addSequence( AthSequencer('METReconstruction') ) #technically don't need a new sequence name for it components_metAlg.addEventAlgo(metAlg,'METReconstruction') cfg.merge(components_metAlg) # Set up default configurations import METReconstruction.METConfig_Associator from METReconstruction.METAssocConfig import getMETAssocAlg # Get the configuration directly from METRecoFlags # Can also provide a dict of configurations or list of RecoTools or both assocAlg = getMETAssocAlg('METAssociation') components_assocAlg = ComponentAccumulator() components_assocAlg.addSequence(AthSequencer('METAssociation') ) components_assocAlg.addEventAlgo(assocAlg,'METAssociation') cfg.merge(components_assocAlg) from METUtilities.METMakerConfig import getMETMakerAlg for key,conf in metFlags.METAssocConfigs().iteritems(): if not conf.doTruth: makerAlg = getMETMakerAlg(conf.suffix) components_makerAlg=ComponentAccumulator() components_makerAlg.addSequence(AthSequencer(conf.suffix) ) components_makerAlg.addEventAlgo(makerAlg,conf.suffix) cfg.merge(components_makerAlg) """ cfg.run(maxEvents=10) """ from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from METReconstruction.METRecoFlags import metFlags from AthenaCommon.BeamFlags import jobproperties from RecExConfig.RecFlags import rec if jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam' or not rec.doInDet(): metFlags.UseTracks.set_Value(False) metFlags.DoPFlow.set_Value(False) print "METReconstruction_jobOptions: detected cosmics/single-beam configuration -- switch off track-based MET reco" import METReconstruction.METConfig_Calo import METReconstruction.METConfig_Track if rec.doTruth(): import METReconstruction.METConfig_Truth from METReconstruction.METRecoConfig import getMETRecoAlg metAlg = getMETRecoAlg('METReconstruction') topSequence += metAlg # Set up default configurations import METReconstruction.METConfig_Associator from METReconstruction.METAssocConfig import getMETAssocAlg # Get the configuration directly from METRecoFlags # Can also provide a dict of configurations or list of RecoTools or both assocAlg = getMETAssocAlg('METAssociation') from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += assocAlg from METUtilities.METMakerConfig import getMETMakerAlg for key,conf in metFlags.METAssocConfigs().iteritems(): if not conf.doTruth: makerAlg = getMETMakerAlg(conf.suffix) topSequence += makerAlg """ \ No newline at end of file +from AthenaCommon import Logging from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator 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 = "INFO" 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.lock() # Get a ComponentAccumulator setting up the fundamental Athena job from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg cfg=MainServicesThreadedCfg(ConfigFlags) # Add the components for reading in pool files from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) # Get Jet Inputs from JetRecConfig.StandardJetDefs import EMTopoOrigin, LCTopoOrigin, CHSPFlow from JetRecConfig import JetRecConfig cfg1 = JetRecConfig.JetInputCfg( [EMTopoOrigin], ConfigFlags) cfg1.printConfig() cfg.merge( cfg1 ) cfg2 = JetRecConfig.JetInputCfg( [LCTopoOrigin], ConfigFlags) cfg2.printConfig() cfg.merge( cfg2 ) cfg3 = JetRecConfig.JetInputCfg( [CHSPFlow], ConfigFlags) cfg3.printConfig() cfg.merge( cfg3 ) # Start by just trying to add in MET Reconstruction based on METReconstruction_jobOptions.py from METReconstruction.METRecoFlags import metFlags # from AthenaCommon.BeamFlags import jobproperties NO LONGER ALLOWED # from RecExConfig.RecFlags import rec NO LONGER ALLOWED #NEED TO CHANGE THIS TO DEPEND ON ConfigFlags.Beam.Type => for now ignore """ if jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam' or not rec.doInDet(): metFlags.UseTracks.set_Value(False) metFlags.DoPFlow.set_Value(False) print "METReconstruction_jobOptions: detected cosmics/single-beam configuration -- switch off track-based MET reco" """ # TJ: Best to start each of these from scratch as a new CA module, # Can e.g. make files called METCaloConfig.py that just put the # old alg into a CA. # Rather than have N reco tools that get thrown into one alg later, # have each CA generate its own METRecoAlg and add this to the sequence. """ import METReconstruction.METConfig_Calo import METReconstruction.METConfig_Track if rec.doTruth(): import METReconstruction.METConfig_Truth from METReconstruction.METRecoConfig import getMETRecoAlg print "PICKING UP CHANGES" metAlg = getMETRecoAlg('METReconstruction') """ # Probably want to define one CA each for EMTopo, LCTopo and PFlow, # then have a higher level one that merges in all three, # then the top-level (i.e. this) can just pull in the all-associators CA """ components_metAlg = ComponentAccumulator() from AthenaCommon.AlgSequence import AthSequencer components_metAlg.addSequence( AthSequencer('METReconstruction') ) #technically don't need a new sequence name for it components_metAlg.addEventAlgo(metAlg,'METReconstruction') cfg.merge(components_metAlg) # Set up default configurations import METReconstruction.METConfig_Associator from METReconstruction.METAssocConfig import getMETAssocAlg # Get the configuration directly from METRecoFlags # Can also provide a dict of configurations or list of RecoTools or both assocAlg = getMETAssocAlg('METAssociation') components_assocAlg = ComponentAccumulator() components_assocAlg.addSequence(AthSequencer('METAssociation') ) components_assocAlg.addEventAlgo(assocAlg,'METAssociation') cfg.merge(components_assocAlg) from METUtilities.METMakerConfig import getMETMakerAlg for key,conf in metFlags.METAssocConfigs().iteritems(): if not conf.doTruth: makerAlg = getMETMakerAlg(conf.suffix) components_makerAlg=ComponentAccumulator() components_makerAlg.addSequence(AthSequencer(conf.suffix) ) components_makerAlg.addEventAlgo(makerAlg,conf.suffix) cfg.merge(components_makerAlg) """ print "Running final component accumulator" cfg.printConfig() cfg.run(maxEvents=10) \ No newline at end of file