diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index 33ef5fa13946fd3f9ac8b2e943858756a8ff64fc..c9251076c21a12ca39572e917bf2b728d10f324a 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -168,6 +168,11 @@ def _createCfgFlags(): return createPFConfigFlags() _addFlagsCategory(acf,"PF",__pflow, 'eflowRec') + def __met(): + from METReconstruction.METConfigFlags import createMETConfigFlags + return createMETConfigFlags() + _addFlagsCategory(acf,"MET",__met, 'METReconstruction') + def __btagging(): from BTagging.BTaggingConfigFlags import createBTaggingConfigFlags return createBTaggingConfigFlags() diff --git a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py index d867c74e834e2eb311b728b44745c9d807b004ee..3302a4a15e5e3a8eef22a8f67f62bfac30d83483 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetDefinition.py @@ -114,12 +114,7 @@ class JetConstit(object): # Jets could specify a filter e.g. pt cut or JVT?? modstring = "" if self.__modifiers: - for mod in self.__modifiers: - # Handle special case of topocluster state - if mod in ["EM","LC"]: - self.label += mod - else: - modstring += mod + modstring = "".join(self.__modifiers) self.label += labelnames[self.basetype] if self.basetype!=xAODType.Jet: @@ -127,6 +122,10 @@ class JetConstit(object): if self.basetype==xAODType.TruthParticle: self.label = self.label.replace("NoWZ","WZ") + if self.basetype==xAODType.CaloCluster: + self.label = self.label.replace("TopoEM","EMTopo") + self.label = self.label.replace("TopoLC","LCTopo") + containernames = { xAODType.CaloCluster: "TopoClusters", xAODType.ParticleFlow: "ParticleFlowObjects", diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index 0ff0b882a5b9b2fdf0ca6e5bb6a9296c2d17f349..0bbe9e1f80efd1effe755e2d3e54df674b3f8ab8 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -65,11 +65,11 @@ def JetRecCfg(jetdef, configFlags, jetnameprefix="",jetnamesuffix="", jetnameove # # To facilitate running in serial mode, we also prepare # the constituent PseudoJetGetter here (needed for rho) - inputcomps = JetInputCfg(deps["inputs"], configFlags, sequenceName=jetsfullname) + inputcomps = JetInputCfg(deps["inputs"], configFlags) constitpjalg = inputcomps.getPrimary() constitpjkey = constitpjalg.PJGetter.OutputContainer - components.merge(inputcomps) + components.merge(inputcomps,sequencename) pjs = [constitpjkey] # Schedule the ghost PseudoJetGetterAlgs @@ -235,13 +235,13 @@ def getEventShapeAlg( constit, constitpjkey, nameprefix="" ): # # This includes constituent modifications, track selection, copying of # input truth particles and event density calculations -def JetInputCfg(inputdeps, configFlags, sequenceName): +def JetInputCfg(inputdeps, configFlags): jetlog.info("Setting up jet inputs.") - components = ComponentAccumulator(sequenceName) + components = ComponentAccumulator() jetlog.info("Inspecting input file contents") filecontents = configFlags.Input.Collections - + constit = inputdeps[0] # Truth and track particle inputs are handled later if constit.basetype not in [xAODType.TruthParticle, xAODType.TrackParticle] and constit.inputname!=constit.rawname: diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx index 9d820fc86c2b174c87b255683ad92a822b629660..0116e12ed769f626df917ad963ce3ba7244d7e40 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx @@ -65,6 +65,7 @@ namespace met { METSoftTermsTool::METSoftTermsTool(const std::string& name) : AsgTool(name), METBuilderTool(name), + m_pfotool(this,""), m_st_objtype(0), m_pv_inputkey("PrimaryVertices"), m_caloClusterKey(""), diff --git a/Reconstruction/MET/METReconstruction/Root/METTrackFilterTool.cxx b/Reconstruction/MET/METReconstruction/Root/METTrackFilterTool.cxx index c9085f030b6549345d4a6ce5711d74d77bcead36..1ff086736c0f401066f65bb3293849f129a9864b 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTrackFilterTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTrackFilterTool.cxx @@ -61,6 +61,14 @@ namespace met { //////////////// METTrackFilterTool::METTrackFilterTool(const std::string& name) : AsgTool(name), + m_trkseltool(this,""), + m_trkToVertexTool(this,""), + m_trkIsolationTool(this,""), + m_caloIsolationTool(this,""), + m_mu_inputkey(""), + m_el_inputkey(""), + m_pv_input(""), + m_cl_inputkey(""), METRefinerTool(name) { declareProperty( "DoPVSel", m_trk_doPVsel = true ); diff --git a/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx index 4ce4a55be02854a0d2e9e3b82e7483a1a7ae1009..0ea1c561b3a619b7118b3e0a7111dc8450feb69d 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx @@ -46,6 +46,12 @@ namespace met { //////////////// METTruthAssociator::METTruthAssociator(const std::string& name) : AsgTool(name), + m_recoElKey(""), + m_recoJetKey(""), + m_recoMuKey(""), + m_recoGamKey(""), + m_recoTauKey(""), + m_truthEventKey(""), METAssociator(name) { diff --git a/Reconstruction/MET/METReconstruction/python/METCfg_Track.py b/Reconstruction/MET/METReconstruction/python/METCfg_Track.py new file mode 100644 index 0000000000000000000000000000000000000000..33ffaf49de5dfa42ee87224ef3fbdc525bfb38f2 --- /dev/null +++ b/Reconstruction/MET/METReconstruction/python/METCfg_Track.py @@ -0,0 +1,33 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from METReconstruction.METRecoCfg import BuildConfig, RefConfig, METConfig,clusterSigStates,getMETRecoAlg,getMETRecoTool +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaCommon import CfgMgr + + +def METTrack_Cfg(configFlags): + sequencename = "METReconstruction_Track" + + components = ComponentAccumulator() + from AthenaCommon.AlgSequence import AthSequencer + components.addSequence( AthSequencer(sequencename) ) + + cfg_trk = METConfig('Track',[BuildConfig('SoftTrk','Track')], + [RefConfig('TrackFilter','PVTrack')], + doTracks=configFlags.MET.UseTracks) + + cfg_trk.refiners['TrackFilter'].DoLepRecovery=True + cfg_trk.refiners['TrackFilter'].DoVxSep=configFlags.MET.UseTracks + cfg_trk.refiners['TrackFilter'].DoEoverPSel=True + recotool = getMETRecoTool(cfg_trk) + #recotool = CfgMgr.met__METRecoTool('MET_RecoTool_empty') + print "Printing recotool" + print recotool + print "MET track helper object defined!!!" + print cfg_trk + recoAlg=getMETRecoAlg(algName='METRecoAlg_Track',tools=[recotool]) + print "ALG defined" + print recoAlg + components.addEventAlgo(recoAlg, sequencename) + return components + diff --git a/Reconstruction/MET/METReconstruction/python/METConfigFlags.py b/Reconstruction/MET/METReconstruction/python/METConfigFlags.py new file mode 100644 index 0000000000000000000000000000000000000000..7d49987262b6b199d4fb8a0baad7abd42179f4e7 --- /dev/null +++ b/Reconstruction/MET/METReconstruction/python/METConfigFlags.py @@ -0,0 +1 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.AthConfigFlags import AthConfigFlags def createMETConfigFlags(): metConfigFlags=AthConfigFlags() metConfigFlags.addFlag("MET.UseTracks",True) metConfigFlags.addFlag("MET.DoPFlow",True) return metConfigFlags diff --git a/Reconstruction/MET/METReconstruction/python/METRecoCfg.py b/Reconstruction/MET/METReconstruction/python/METRecoCfg.py new file mode 100644 index 0000000000000000000000000000000000000000..5c02e426ef342d78946279ef5f32c945e743e03a --- /dev/null +++ b/Reconstruction/MET/METReconstruction/python/METRecoCfg.py @@ -0,0 +1,327 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon import CfgMgr + +################################################################################# +# Define some default values + +clusterSigStates = { + 'EMScale':0, + 'LocHad':1, + 'Mod':1 +} + +defaultSelection = { + 'Ele':'Medium', + 'Gamma':'Tight', +} + +defaultAuthor = { + 'Ele':17, + 'Gamma':20, +} + +defaultInputKey = { + 'Ele' :'Electrons', + 'Gamma' :'Photons', + 'Tau' :'TauJets', + 'Jet' :'AntiKt4EMTopoJets', + 'Muon' :'Muons', + 'SoftTrk' :'InDetTrackParticles', + 'SoftClus' :'CaloCalTopoClusters', + 'SoftPFlow':'JetETMissNeutralParticleFlowObjects', + 'PrimaryVx':'PrimaryVertices', + 'Truth' :'TruthEvents', + 'Calo' :'AllCalo', + 'LCOCSoftClus':'LCOriginTopoClusters', + 'EMOCSoftClus':'EMOriginTopoClusters', + } + +defaultOutputKey = { + 'Ele' :'RefEle', + 'Gamma' :'RefGamma', + 'Tau' :'RefTau', + 'Jet' :'RefJet', + 'Muon' :'Muons', + 'SoftTrk' :'SoftTrk', + 'SoftClus' :'SoftClus', + 'SoftPFlow':'SoftPFlow', + 'Total' :'Final', + 'Truth' :'Truth', + 'Calo' :'Calo' + } + +prefix = 'METRecoConfig: ' + +################################################################################# +# Configuration of builders + +class BuildConfig: + def __init__(self,objType='',outputKey='',inputKey=''): + self.objType = objType + self.outputKey = outputKey + self.inputKey = inputKey + +def getBuilder(config,suffix,doTracks,doCells,doTriggerMET,doOriginCorrClus): + tool = None + # Construct tool and set defaults for case-specific configuration + if config.objType == 'Ele': + tool = CfgMgr.met__METElectronTool('MET_ElectronTool_'+suffix) + tool.PIDSel = defaultSelection['Ele'] + tool.AuthorSel = defaultAuthor['Ele'] + tool.DoTracks = doTracks + if config.objType == 'Gamma': + tool = CfgMgr.met__METPhotonTool('MET_PhotonTool_'+suffix) + tool.PIDSel = defaultSelection['Gamma'] + tool.AuthorSel = defaultAuthor['Gamma'] + tool.DoTracks = doTracks + if config.objType == 'Tau': + tool = CfgMgr.met__METTauTool('MET_TauTool_'+suffix) + tool.DoTracks = doTracks + if config.objType == 'Jet': + tool = CfgMgr.met__METJetTool('MET_JetTool_'+suffix) + tool.DoTracks = doTracks + if "EMTopo" in suffix: + tool.SignalState = clusterSigStates['EMScale'] + else: + tool.SignalState = clusterSigStates['LocHad'] + if config.objType == 'Muon': + tool = CfgMgr.met__METMuonTool('MET_MuonTool_'+suffix) + if config.objType == 'SoftTrk': + tool = CfgMgr.met__METSoftTermsTool('MET_SoftTrkTool_'+suffix) + tool.InputComposition = 'Tracks' + if config.objType.endswith('SoftClus'): + tool = CfgMgr.met__METSoftTermsTool('MET_SoftClusTool_'+suffix) + tool.InputComposition = 'Clusters' + if doOriginCorrClus: + tool.SignalState = clusterSigStates['Mod'] + else: + tool.SignalState = clusterSigStates['LocHad'] + if config.objType == 'SoftPFlow': + tool = CfgMgr.met__METSoftTermsTool('MET_SoftPFlowTool_'+suffix) + tool.InputComposition = 'PFlow' + pfotool = CfgMgr.CP__RetrievePFOTool('MET_PFOTool_'+suffix) + tool.PFOTool = pfotool + if suffix == 'Truth': + tool = CfgMgr.met__METTruthTool('MET_TruthTool_'+config.objType) + tool.InputComposition = config.objType + config.inputKey = defaultInputKey['Truth'] + config.outputKey = config.objType + if suffix == 'Calo': + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + CaloNoiseCondAlg ('totalNoise') + tool = CfgMgr.met__METCaloRegionsTool('MET_CaloRegionsTool') + if doCells: + tool.UseCells = True + tool.DoTriggerMET = doTriggerMET + config.inputKey = defaultInputKey['Calo'] + else: + tool.UseCells = False + tool.DoTriggerMET = False + config.inputKey = defaultInputKey['SoftClus'] + config.outputKey = config.objType + + # set input/output key names + if config.inputKey == '': + tool.InputCollection = defaultInputKey[config.objType] + config.inputKey = tool.InputCollection + else: + tool.InputCollection = config.inputKey + if not suffix=='Calo': + if config.outputKey == '': + tool.MissingETKey = defaultOutputKey[config.objType] + config.outputKey = tool.MissingETKey + else: + tool.MissingETKey = config.outputKey + return tool + +################################################################################# +# Configuration of refiners + +class RefConfig: + def __init__(self,myType='',outputKey=''): + self.type = myType + self.outputKey = outputKey + +def getRefiner(config,suffix,trkseltool=None,trkvxtool=None,trkisotool=None,caloisotool=None): + tool = None + + if config.type == 'TrackFilter': + tool = CfgMgr.met__METTrackFilterTool('MET_TrackFilterTool_'+suffix) + tool.InputPVKey = defaultInputKey['PrimaryVx'] + tool.TrackSelectorTool=trkseltool + tool.TrackVxAssocTool=trkvxtool + # + tool.UseIsolationTools = False #True + tool.TrackIsolationTool = trkisotool + tool.CaloIsolationTool = caloisotool + from METReconstruction.METRecoFlags import metFlags + tool.DoPVSel = metFlags.UseTracks() + tool.DoVxSep = metFlags.UseTracks() + + if config.type == 'JetFilter': + tool = CfgMgr.met__METJetFilterTool('MET_JetFilterTool_'+suffix) + if config.type == 'MuonEloss': + tool = CfgMgr.met__METMuonElossTool('MET_MuonElossTool_'+suffix) + tool.MissingETKey = config.outputKey + return tool + +################################################################################# +# Region tools are a special case of refiners + +def getRegions(config,suffix): + if suffix == 'Truth': + config.outputKey = config.objType + tool = CfgMgr.met__METRegionsTool('MET_'+config.outputKey+'Regions_'+suffix) + tool.InputMETContainer = 'MET_'+suffix + tool.InputMETMap = 'METMap_'+suffix + tool.InputMETKey = config.outputKey + tool.RegionValues = [ 1.5, 3.2, 10 ] + return tool + +################################################################################# +# Top level MET configuration + +class METConfig: + def outputCollection(self): + return 'MET_'+self.suffix + # + def outputMap(self): + return 'METMap_'+self.suffix + # + def setupBuilders(self,buildconfigs): + print prefix, 'Setting up builders for MET config '+self.suffix + for config in buildconfigs: + if config.objType in self.builders: + print prefix, 'Config '+self.suffix+' already contains a builder of type '+config.objType + raise LookupError + else: + builder = getBuilder(config,self.suffix,self.doTracks,self.doCells, + self.doTriggerMET,self.doOriginCorrClus) + self.builders[config.objType] = builder + self.buildlist.append(builder) + print prefix, ' Added '+config.objType+' tool named '+builder.name() + # + def setupRefiners(self,refconfigs): + print prefix, 'Setting up refiners for MET config '+self.suffix + for config in refconfigs: + # need to enforce this? + if config.type in self.refiners: + print 'Config '+self.suffix+' already contains a refiner of type '+config.type + raise LookupError + else: + refiner = getRefiner(config=config,suffix=self.suffix, + trkseltool=self.trkseltool,trkvxtool=self.trkvxtool, + trkisotool=self.trkisotool,caloisotool=self.caloisotool) + self.refiners[config.type] = refiner + self.reflist.append(refiner) + print prefix, ' Added '+config.type+' tool named '+refiner.name() + # + def setupRegions(self,buildconfigs): + print prefix, 'Setting up regions for MET config '+self.suffix + for config in buildconfigs: + if config.objType in self.regions: + print prefix, 'Config '+self.suffix+' already contains a region tool of type '+config.objType + raise LookupError + else: + regions = getRegions(config,self.suffix) + self.regions[config.objType] = regions + self.reglist.append(regions) + print prefix, ' Added '+config.objType+' region tool named '+regions.name() + # + def __init__(self,suffix,buildconfigs=[],refconfigs=[], + doTracks=False,doSum=False,doRegions=False, + doCells=False,doTriggerMET=True,duplicateWarning=True, + doOriginCorrClus=False): + print prefix, 'Creating MET config \''+suffix+'\'' + self.suffix = suffix + self.doSum = doSum + self.doTracks = doTracks + self.doRegions = doRegions + self.doCells = doCells, + self.doOriginCorrClus = doOriginCorrClus + self.doTriggerMET = doTriggerMET + self.duplicateWarning = duplicateWarning + # + self.builders = {} + self.buildlist = [] # need an ordered list + # + self.refiners = {} + self.reflist = [] # need an ordered list + # + self.regions = {} + self.reglist = [] # need an ordered list + if doRegions: + self.setupRegions(buildconfigs) + # + self.trkseltool=CfgMgr.InDet__InDetTrackSelectionTool("IDTrkSel_MET", + CutLevel="TightPrimary", + maxZ0SinTheta=3, + maxD0=2, + minPt=500) + # + self.trkvxtool=CfgMgr.CP__LooseTrackVertexAssociationTool("LooseTrackVertexAssociationTool_MET") + #self.trkvxtool=CfgMgr.CP__TightTrackVertexAssociationTool("TightTrackVertexAssociationTool_MET", dzSinTheta_cut=3, doPV=False) + # + self.trkisotool = CfgMgr.xAOD__TrackIsolationTool("TrackIsolationTool_MET") + self.trkisotool.TrackSelectionTool = self.trkseltool # As configured above + # + from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool, Rec__ParticleCaloCellAssociationTool + from TrkExTools.AtlasExtrapolator import AtlasExtrapolator + CaloExtensionTool= Trk__ParticleCaloExtensionTool(Extrapolator = AtlasExtrapolator()) + CaloCellAssocTool = Rec__ParticleCaloCellAssociationTool(ParticleCaloExtensionTool = CaloExtensionTool) + self.caloisotool = CfgMgr.xAOD__CaloIsolationTool("CaloIsolationTool_MET", + saveOnlyRequestedCorrections=True, + addCaloExtensionDecoration=False, + ParticleCaloExtensionTool = CaloExtensionTool, + ParticleCaloCellAssociationTool = CaloCellAssocTool) + + self.setupBuilders(buildconfigs) + self.setupRefiners(refconfigs) + +# Set up a top-level tool with mostly defaults +def getMETRecoTool(topconfig): + recoTool = CfgMgr.met__METRecoTool('MET_RecoTool_'+topconfig.suffix, + METBuilders = topconfig.buildlist, + METRefiners = topconfig.reflist, + METContainer = topconfig.outputCollection(), + METComponentMap = topconfig.outputMap(), + WarnIfDuplicate = topconfig.duplicateWarning, + TimingDetail=0) + if topconfig.doSum: + recoTool.METFinalName = defaultOutputKey['Total'] + + return recoTool + +# Set up a METRecoTool that builds MET regions +def getRegionRecoTool(topconfig): + regTool = CfgMgr.met__METRecoTool('MET_RegionTool_'+topconfig.suffix, + METBuilders = [], + METRefiners = topconfig.reglist, + METContainer = topconfig.outputCollection()+'Regions', + METComponentMap = topconfig.outputMap()+'Regions', + WarnIfDuplicate = topconfig.duplicateWarning) + return regTool + +# Allow user to configure reco tools directly or get more default configurations +def getMETRecoAlg(algName='METReconstruction',configs={},tools=[]): + + recoTools = [] + recoTools += tools + print 'Setting up MET Reconstruction' + for key,conf in configs.iteritems(): + print prefix, 'Generate METRecoTool for MET_'+key + recotool = getMETRecoTool(conf) + print recotool + recoTools.append(recotool) + #metFlags.METRecoTools()[key] = recotool + if conf.doRegions: + regiontool = getRegionRecoTool(conf) + recoTools.append(regiontool) + print "Added region tool" + for tool in recoTools: + print prefix, 'Added METRecoTool \''+tool.name()+'\' to alg '+algName + + recoAlg = CfgMgr.met__METRecoAlg(name=algName, + RecoTools=recoTools) + return recoAlg 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 new file mode 100644 index 0000000000000000000000000000000000000000..e9054575246a8769cdee3093d3f674656d0c8d9d --- /dev/null +++ b/Reconstruction/MET/METReconstruction/share/METRecConfig.py @@ -0,0 +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 = "VERBOSE" 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 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 MainServicesThreadedCfg cfg=MainServicesThreadedCfg(ConfigFlags) # Add the components for reading in pool files from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) print "CHECKPOINT 1" from StoreGate.StoreGateConf import StoreGateSvc cfg.addService(StoreGateSvc("DetectorStore")) #Setup up general geometry from AtlasGeoModel.GeoModelConfig import GeoModelCfg cfg.merge(GeoModelCfg(ConfigFlags)) from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg cfg.merge(MagneticFieldSvcCfg(ConfigFlags)) from TrkDetDescrSvc.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg cfg.merge(TrackingGeometrySvcCfg(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 ) print "CHECKPOINT 2" from METReconstruction.METCfg_Track import METTrack_Cfg cfg4=METTrack_Cfg(ConfigFlags) cfg4.printConfig() cfg.merge(cfg4) # 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 # 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