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

Nearly fully working example with the new configuration system

parent 6524fe03
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!35036METReconstruction: First attempt at preparing the MET Reconstruction code for the run III configuration system
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from __future__ import print_function
from AthenaCommon import CfgMgr
from GaudiKernel.Constants import INFO
import six
#################################################################################
# Define some default values
clusterSigStates = {
'EMScale':0,
'LocHad':1,
'Mod':1
}
defaultInputKey = {
'Ele' :'Electrons',
'Gamma' :'Photons',
'Tau' :'TauJets',
'LCJet' :'AntiKt4LCTopoJets',
'EMJet' :'AntiKt4EMTopoJets',
'PFlowJet' :'AntiKt4EMPFlowJets',
'Muon' :'Muons',
'Soft' :'',
'Clusters' :'CaloCalTopoClusters',
'Tracks' :'InDetTrackParticles',
'PFlowObj' :'CHSParticleFlowObjects',
'PrimVxColl':'PrimaryVertices',
'Truth' :'TruthEvents',
}
prefix = 'METAssocConfig: '
#################################################################################
# Configuration of builders
class AssocConfig:
def __init__(self,objType='',inputKey=''):
self.objType = objType
self.inputKey = inputKey
def getAssociator(config,suffix,doPFlow=False,
trkseltool=None,trkisotool=None,caloisotool=None,
modConstKey="",
modClusColls={}):
tool = None
import cppyy
try: cppyy.loadDictionary('METReconstructionDict')
except: pass
doModClus = (modConstKey!="" and not doPFlow)
if doModClus:
modLCClus = modClusColls['LC{0}Clusters'.format(modConstKey)]
modEMClus = modClusColls['EM{0}Clusters'.format(modConstKey)]
from AthenaCommon.AppMgr import ToolSvc
# Construct tool and set defaults for case-specific configuration
if config.objType == 'Ele':
from ROOT import met
tool = CfgMgr.met__METElectronAssociator('MET_ElectronAssociator_'+suffix,TCMatchMethod=met.ClusterLink)
if config.objType == 'Gamma':
from ROOT import met
tool = CfgMgr.met__METPhotonAssociator('MET_PhotonAssociator_'+suffix,TCMatchMethod=met.ClusterLink)
if config.objType == 'Tau':
tool = CfgMgr.met__METTauAssociator('MET_TauAssociator_'+suffix)
if config.objType == 'LCJet':
tool = CfgMgr.met__METJetAssocTool('MET_LCJetAssocTool_'+suffix)
if config.objType == 'EMJet':
tool = CfgMgr.met__METJetAssocTool('MET_EMJetAssocTool_'+suffix)
if config.objType == 'PFlowJet':
tool = CfgMgr.met__METJetAssocTool('MET_PFlowJetAssocTool_'+suffix)
if config.objType == 'Muon':
tool = CfgMgr.met__METMuonAssociator('MET_MuonAssociator_'+suffix)
if config.objType == 'Soft':
tool = CfgMgr.met__METSoftAssociator('MET_SoftAssociator_'+suffix)
tool.DecorateSoftConst = True
if doModClus:
tool.LCModClusterKey = modLCClus
tool.EMModClusterKey = modEMClus
if config.objType == 'Truth':
tool = CfgMgr.met__METTruthAssociator('MET_TruthAssociator_'+suffix)
tool.RecoJetKey = config.inputKey
if doPFlow:
tool.PFlow = True
tool.PFlowColl = modConstKey if modConstKey!="" else defaultInputKey["PFlowObj"]
else:
tool.UseModifiedClus = doModClus
# set input/output key names
if config.inputKey == '':
tool.InputCollection = defaultInputKey[config.objType]
config.inputKey = tool.InputCollection
else:
tool.InputCollection = config.inputKey
if doModClus:
tool.ClusColl = modLCClus
if 'EMTopo' in suffix: tool.ClusColl = modEMClus
tool.TrkColl = defaultInputKey['Tracks']
from METReconstruction.METRecoFlags import metFlags
tool.UseTracks = metFlags.UseTracks()
#
tool.TrackSelectorTool = trkseltool
#
tool.TrackIsolationTool = trkisotool
tool.CaloIsolationTool = caloisotool
#if not hasattr(ToolSvc,tool.name()):
# ToolSvc += tool
return tool
#################################################################################
# Top level MET configuration
class METAssocConfig:
def outputCollections(self):
if doTruth: return 'MET_Core_'+self.suffix
else: return 'MET_Core_'+self.suffix,'MET_Reference_'+self.suffix
#
def outputMap(self):
return 'METAssoc_'+self.suffix
return 'METAssoc_'+self.suffix
#
def setupAssociators(self,buildconfigs):
print (prefix, 'Setting up associators for MET config '+self.suffix)
for config in buildconfigs:
if config.objType in self.associators:
print (prefix, 'Config '+self.suffix+' already contains a associator of type '+config.objType)
raise LookupError
else:
associator = getAssociator(config=config,suffix=self.suffix,
doPFlow=self.doPFlow,
trkseltool=self.trkseltool,
trkisotool=self.trkisotool,
caloisotool=self.caloisotool,
modConstKey=self.modConstKey,
modClusColls=self.modClusColls)
from METReconstruction.METRecoFlags import metFlags
if config.objType == 'Soft' and metFlags.DecorateSoftConst:
print ("activate soft term decoration")
associator.DecorateSoftConst = True
self.associators[config.objType] = associator
self.assoclist.append(associator)
print (prefix, ' Added '+config.objType+' tool named '+associator.name())
#
def __init__(self,suffix,buildconfigs=[],
doPFlow=False,doTruth=False,
trksel=None,
modConstKey="",
modClusColls={}
):
# Set some sensible defaults
modConstKey_tmp = modConstKey
modClusColls_tmp = modClusColls
if doPFlow:
if modConstKey_tmp == "": modConstKey_tmp = "CHSParticleFlowObjects"
else:
if modConstKey_tmp == "": modConstKey_tmp = "OriginCorr"
if modClusColls_tmp == {}: modClusColls_tmp = {'LCOriginCorrClusters':'LCOriginTopoClusters',
'EMOriginCorrClusters':'EMOriginTopoClusters'}
if doTruth:
print (prefix, 'Creating MET TruthAssoc config \''+suffix+'\'')
else:
print (prefix, 'Creating MET Assoc config \''+suffix+'\'')
self.suffix = suffix
self.doPFlow = doPFlow
self.modConstKey=modConstKey_tmp
self.modClusColls=modClusColls_tmp
self.doTruth = doTruth
from AthenaCommon.AppMgr import ToolSvc
if trksel:
self.trkseltool = trksel
else:
self.trkseltool=CfgMgr.InDet__InDetTrackSelectionTool("IDTrkSel_METAssoc",
CutLevel="TightPrimary",
maxZ0SinTheta=3,
maxD0=2,
minPt=500)
#if not hasattr(ToolSvc,self.trkseltool.name()):
# ToolSvc += self.trkseltool
self.trkisotool = CfgMgr.xAOD__TrackIsolationTool("TrackIsolationTool_MET")
self.trkisotool.TrackSelectionTool = self.trkseltool # As configured above
#if not hasattr(ToolSvc,self.trkisotool.name()):
# ToolSvc += self.trkisotool
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)
#if not hasattr(ToolSvc,self.caloisotool.name()):
# ToolSvc += self.caloisotool
self.associators = {}
self.assoclist = [] # need an ordered list
#
self.setupAssociators(buildconfigs)
# Set up a top-level tool with mostly defaults
def getMETAssocTool(topconfig,msglvl=INFO):
assocTool = None
from METReconstruction.METRecoFlags import metFlags
if topconfig.doTruth:
assocTool = CfgMgr.met__METAssociationTool('MET_TruthAssociationTool_'+topconfig.suffix,
METAssociators = topconfig.assoclist,
METSuffix = topconfig.suffix)
else:
tcstate = clusterSigStates['LocHad']
if 'EMTopo' in topconfig.suffix: tcstate = clusterSigStates['EMScale']
if topconfig.modConstKey!="":
tcstate = clusterSigStates['Mod']
assocTool = CfgMgr.met__METAssociationTool('MET_AssociationTool_'+topconfig.suffix,
METAssociators = topconfig.assoclist,
METSuffix = topconfig.suffix,
TCSignalState=tcstate,
TimingDetail=0,
OutputLevel=msglvl)
if metFlags.AllowOverwrite:
assocTool.AllowOverwrite = True
return assocTool
# Allow user to configure reco tools directly or get more default configurations
def getMETAssocAlg(algName='METAssociation',configs={},tools=[],msglvl=INFO):
assocTools = []
assocTools += tools
from METReconstruction.METRecoFlags import metFlags
if configs=={} and tools==[]:
print (prefix, 'Taking configurations from METRecoFlags')
configs = metFlags.METAssocConfigs()
print (configs)
for key,conf in six.iteritems(configs):
print (prefix, 'Generate METAssocTool for MET_'+key)
assoctool = getMETAssocTool(conf,msglvl)
assocTools.append(assoctool)
#metFlags.METAssocTools()[key] = assoctool
for tool in assocTools:
print (prefix, 'Added METAssocTool \''+tool.name()+'\' to alg '+algName)
assocAlg = CfgMgr.met__METRecoAlg(name=algName,
RecoTools=assocTools)
# assocAlg.OutputLevel=DEBUG
return assocAlg
# 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 AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon import CfgMgr
from METUtilities.METMakerConfig import getMETMakerAlg
#attempt at migrating to the new configuration system
def METAssociator_Cfg(configFlags):
sequencename = "METAssociation"
components = ComponentAccumulator()
from AthenaCommon.AlgSequence import AthSequencer
components.addSequence( AthSequencer(sequencename) )
modConstKey = ""
modClusColls = {}
if configFlags.MET.UseTracks:
modConstKey="OriginCorr"
modClusColls={
'LCOriginCorrClusters':'LCOriginTopoClusters',
'EMOriginCorrClusters':'EMOriginTopoClusters'
}
############################################################################
# AntiKt4LCTopo
JetType = 'LCJet'
associators = [AssocConfig(JetType),
AssocConfig('Muon'),
AssocConfig('Ele'),
AssocConfig('Gamma'),
AssocConfig('Tau'),
AssocConfig('Soft')]
cfg_akt4lc = METAssocConfig('AntiKt4LCTopo',
associators,
doPFlow=False,
modConstKey=modConstKey,
modClusColls=modClusColls
)
assoctool_akt4lc = getMETAssocTool(cfg_akt4lc)
assocAlg_akt4lc = getMETAssocAlg(algName='METAssociation_LCJets',tools=[assoctool_akt4lc])
components.addEventAlgo(assocAlg_akt4lc,sequencename)
makerAlg_akt4lc= getMETMakerAlg('AntiKt4LCTopo')
components.addEventAlgo(makerAlg_akt4lc,'METAssociation')
#metFlags.METAssocConfigs()[cfg_akt4lc.suffix] = cfg_akt4lc
#metFlags.METAssocOutputList().append(cfg_akt4lc.suffix)
############################################################################
# AntiKt4EMTopo
JetType = 'EMJet'
associators = [AssocConfig(JetType),
AssocConfig('Muon'),
AssocConfig('Ele'),
AssocConfig('Gamma'),
AssocConfig('Tau'),
AssocConfig('Soft')]
cfg_akt4em = METAssocConfig('AntiKt4EMTopo',
associators,
doPFlow=False,
modConstKey=modConstKey,
modClusColls=modClusColls
)
assoctool_akt4em = getMETAssocTool(cfg_akt4em)
assocAlg_akt4em = getMETAssocAlg(algName='METAssociation_EMJets',tools=[assoctool_akt4em])
components.addEventAlgo(assocAlg_akt4em,sequencename)
makerAlg_akt4em= getMETMakerAlg('AntiKt4EMTopo')
components.addEventAlgo(makerAlg_akt4em,'METAssociation')
#metFlags.METAssocConfigs()[cfg_akt4em.suffix] = cfg_akt4em
#metFlags.METAssocOutputList().append(cfg_akt4em.suffix)
############################################################################
# PFlow
if configFlags.MET.DoPFlow and configFlags.MET.UseTracks:
JetType = 'PFlowJet'
associators = [AssocConfig(JetType),
AssocConfig('Muon'),
AssocConfig('Ele'),
AssocConfig('Gamma'),
AssocConfig('Tau'),
AssocConfig('Soft')]
cfg_akt4pf = METAssocConfig('AntiKt4EMPFlow',
associators,
doPFlow=True
)
assoctool_akt4pf = getMETAssocTool(cfg_akt4pf)
#metFlags.METAssocConfigs()[cfg_akt4pf.suffix] = cfg_akt4pf
#metFlags.METAssocOutputList().append(cfg_akt4pf.suffix)
assocAlg_akt4pf = getMETAssocAlg(algName='METAssociation_PFlowJets',tools=[assoctool_akt4pf])
components.addEventAlgo(assocAlg_akt4em,sequencename)
makerAlg_akt4pf= getMETMakerAlg('AntiKt4EMPFlow')
components.addEventAlgo(makerAlg_akt4pf,'METAssociation')
return components
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#from METReconstruction.METRecoFlags import metFlags
from METReconstruction.METRecoCfg import BuildConfig, RefConfig, METConfig,clusterSigStates,getMETRecoTool,getMETRecoAlg
from METReconstruction.METRecoCfg import BuildConfig, RefConfig, METConfig,clusterSigStates,getMETRecoTool,getMETRecoAlg,getRegionRecoTool
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon import CfgMgr
def METCalo_Cfg(configFlags):
sequencename = "METReconstruction_Calo_New"
sequencename = "METReconstruction_Calo"
components = ComponentAccumulator()
from AthenaCommon.AlgSequence import AthSequencer
......@@ -16,7 +16,7 @@ def METCalo_Cfg(configFlags):
############################################################################
# EMTopo
cfg_emt = METConfig('EMTopo_New',[BuildConfig('SoftClus','EMTopo')],
cfg_emt = METConfig('EMTopo',[BuildConfig('SoftClus','EMTopo')],
doRegions=True,
doOriginCorrClus=False
)
......@@ -32,7 +32,7 @@ def METCalo_Cfg(configFlags):
############################################################################
# LocHadTopo
cfg_lht = METConfig('LocHadTopo_New',[BuildConfig('SoftClus','LocHadTopo')],
cfg_lht = METConfig('LocHadTopo',[BuildConfig('SoftClus','LocHadTopo')],
doRegions=True,
doOriginCorrClus=False
)
......@@ -46,8 +46,8 @@ def METCalo_Cfg(configFlags):
############################################################################
# Calo regions
"""
cfg_calo = METConfig('Calo_New',
cfg_calo = METConfig('Calo',
[BuildConfig('CaloReg')],
doCells=True
)
......@@ -55,12 +55,13 @@ def METCalo_Cfg(configFlags):
#metFlags.METConfigs()[cfg_calo.suffix] = cfg_calo
#metFlags.METOutputList().append(cfg_calo.suffix)
recotool_caloreg= getMETRecoTool(cfg_calo)
regiontool_calo= getRegionRecoTool(cfg_calo)
recotools.append(recotool_caloreg)
recotools.append(regiontool_calo)
#SO FAR THIS WON'T RUN, AND GIVES A KEY ERROR:
#File "/usera/sarahw/testareas/PostPHD/METDec2019/build/x86_64-centos7-gcc8-opt/python/METReconstruction/METRecoCfg.py", line 126, in getBuilder
#tool.InputCollection = defaultInputKey[config.objType]
#KeyError: 'CaloReg'
"""
recoAlg_calo = getMETRecoAlg(algName='METRecoAlg_Calo',tools=recotools)
components.addEventAlgo(recoAlg_calo,sequencename)
return components
......@@ -6,13 +6,13 @@ from AthenaCommon import CfgMgr
def METTrack_Cfg(configFlags):
sequencename = "METReconstruction_Track_New"
sequencename = "METReconstruction_Track"
components = ComponentAccumulator()
from AthenaCommon.AlgSequence import AthSequencer
components.addSequence( AthSequencer(sequencename) )
cfg_trk = METConfig('Track_new',[BuildConfig('SoftTrk','Track')],
cfg_trk = METConfig('Track',[BuildConfig('SoftTrk','Track')],
[RefConfig('TrackFilter','PVTrack')],
doTracks=configFlags.MET.UseTracks)
......
from AthenaCommon import Loggingfrom 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 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 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 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)) # Get Jet Inputs from JetRecConfig.StandardJetDefs import EMTopoOrigin, LCTopoOrigin, CHSPFlow from JetRecConfig import JetRecConfig cfg1 = JetRecConfig.JetInputCfg( [EMTopoOrigin], ConfigFlags) cfg.merge( cfg1 ) cfg2 = JetRecConfig.JetInputCfg( [LCTopoOrigin], ConfigFlags) cfg.merge( cfg2 ) cfg3 = JetRecConfig.JetInputCfg( [CHSPFlow], ConfigFlags) cfg.merge( cfg3 ) from METReconstruction.METCfg_Track import METTrack_Cfg cfg4=METTrack_Cfg(ConfigFlags) cfg.merge(cfg4) from METReconstruction.METCfg_Calo import METCalo_Cfg cfg5=METCalo_Cfg(ConfigFlags) cfg.merge(cfg5) # 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) """ outputlist = ["EventInfo#*"] """ originaljets = ["AntiKt4EMPFlowJets","AntiKt4EMTopoJets"] for jetcoll in originaljets: outputlist += ["xAOD::JetContainer#"+jetcoll,"xAOD::JetAuxContainer#"+jetcoll+"Aux."] """ outputlist+=["xAOD::MissingETContainer#"+"MET_Track_new","xAOD::MissingETAuxContainer#"+"MET_Track_new"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_Track","xAOD::MissingETAuxContainer#"+"MET_Track"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_EMTopo_New","xAOD::MissingETAuxContainer#"+"MET_EMTopo_New"+"Aux."] outputlist+=["xAOD::MissingETContainer#"+"MET_EMTopo","xAOD::MissingETAuxContainer#"+"MET_EMTopo"+"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 = True print "Running final component accumulator" cfg.printConfig() cfg.run(maxEvents=20)
\ No newline at end of file
from AthenaCommon import Loggingfrom 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 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 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 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)) # Get Jet Inputs from JetRecConfig.StandardJetDefs import EMTopoOrigin, LCTopoOrigin, CHSPFlow from JetRecConfig import JetRecConfig cfg1 = JetRecConfig.JetInputCfg( [EMTopoOrigin], ConfigFlags) cfg.merge( cfg1 ) cfg2 = JetRecConfig.JetInputCfg( [LCTopoOrigin], ConfigFlags) cfg.merge( cfg2 ) cfg3 = JetRecConfig.JetInputCfg( [CHSPFlow], ConfigFlags) cfg.merge( cfg3 ) # Need to rename the collections in the xAOD in order to avoid conflicts from SGComps.AddressRemappingConfig import InputRenameCfg remap_track=InputRenameCfg('xAOD::MissingETContainer','MET_Track','MET_Track_Old') remap_trackaux=InputRenameCfg('xAOD::MissingETAuxContainer','MET_TrackAux.','MET_Track_OldAux.') cfg.merge(remap_track) cfg.merge(remap_trackaux) remap_emt=InputRenameCfg('xAOD::MissingETContainer','MET_EMTopo','MET_EMTopo_Old') remap_emtaux=InputRenameCfg('xAOD::MissingETAuxContainer','MET_EMTopoAux.','MET_EMTopo_OldAux.') cfg.merge(remap_emt) cfg.merge(remap_emtaux) remap_lht=InputRenameCfg('xAOD::MissingETContainer','MET_LocHadTopo','MET_LocHadTopo_Old') remap_lhtaux=InputRenameCfg('xAOD::MissingETAuxContainer','MET_LocHadTopoAux.','MET_LocHadTopo_OldAux.') cfg.merge(remap_lht) cfg.merge(remap_lhtaux) from METReconstruction.METCfg_Track import METTrack_Cfg cfg4=METTrack_Cfg(ConfigFlags) cfg.merge(cfg4) from METReconstruction.METCfg_Calo import METCalo_Cfg cfg5=METCalo_Cfg(ConfigFlags) cfg.merge(cfg5) from METReconstruction.METCfg_Associator import METAssociator_Cfg cfg6=METAssociator_Cfg(ConfigFlags) cfg.merge(cfg6) # 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) """ outputlist = ["EventInfo#*"] """ originaljets = ["AntiKt4EMPFlowJets","AntiKt4EMTopoJets"] for jetcoll in originaljets: outputlist += ["xAOD::JetContainer#"+jetcoll,"xAOD::JetAuxContainer#"+jetcoll+"Aux."] """ 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 = True print "Running final component accumulator" cfg.printConfig() cfg.run(maxEvents=20) StoreGateSvc.Dump=True
\ 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