ATLAS Offline Software
TrackIsolationDecoratorConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 # Import the xAOD isolation parameters.
7 from xAODPrimitives.xAODIso import xAODIso as isoPar
8 deco_ptcones = [isoPar.ptcone40, isoPar.ptcone30]
9 deco_topoetcones = [isoPar.topoetcone40, isoPar.topoetcone20]
10 deco_prefix = 'MUON_'
11 
12 def TrackIsolationToolCfg(ConfigFlags,name= "TrackIsolationTool", **kwargs):
13 
14  acc = ComponentAccumulator()
15  from InDetConfig.InDetTrackSelectionToolConfig import InDetTrackSelectionTool_TrackTools_Cfg
16  kwargs.setdefault("TrackSelectionTool",acc.popToolsAndMerge(InDetTrackSelectionTool_TrackTools_Cfg(ConfigFlags,
17  maxZ0SinTheta = 3.,
18  minPt = 1000.,
19  CutLevel = "Loose")))
20 
21  TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(name, **kwargs)
22  acc.setPrivateTools(TrackIsoTool)
23  return acc
24 
25 
27  ConfigFlags, name="MuonTrackIsolationDecorator",
28  ttvaWP = "Nonprompt_All_MaxWeight", trackPt=500., **kwargs):
29 
30  result = ComponentAccumulator()
31  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
32  ttvaTool = result.popToolsAndMerge(
33  isoTTVAToolCfg(ConfigFlags, WorkingPoint=ttvaWP))
34  from InDetConfig.InDetTrackSelectionToolConfig import isoTrackSelectionToolCfg
35  trackSelTool = result.popToolsAndMerge(
36  isoTrackSelectionToolCfg(ConfigFlags, minPt=trackPt))
37 
38  wpName = "{WP}TTVA_pt{ptCut}".format(WP = ttvaWP, ptCut = trackPt)
39  kwargs.setdefault("customName", wpName)
40 
41  kwargs.setdefault("PtMin", 2500.)
42  from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
43  kwargs.setdefault("IsolationTool", result.popToolsAndMerge(
44  TrackIsolationToolCfg(ConfigFlags,
45  TTVATool=ttvaTool,
46  TrackSelectionTool=trackSelTool)))
47  theAlg = CompFactory.DerivationFramework.TrackIsolationDecorAlg(name = name, **kwargs)
48  result.addEventAlgo(theAlg, primary = True)
49  return result
50 
51 
52 def TrackCaloIsolationDecorAlgCfg(ConfigFlags, name = "MuonCaloIsolationDecorator", **kwargs):
53  from IsolationAlgs.IsoToolsConfig import MuonCaloIsolationToolCfg
54  result = ComponentAccumulator()
55  kwargs.setdefault("PtMin", 2500.)
56  kwargs.setdefault("IsolationTool", result.getPrimaryAndMerge(MuonCaloIsolationToolCfg(ConfigFlags,
57  saveOnlyRequestedCorrections=True)))
58  the_alg = CompFactory.DerivationFramework.CaloIsolationDecorAlg(name, **kwargs)
59  result.addEventAlgo(the_alg, primary=True)
60  return result
61 
62 def TrackPflowIsolationDecorAlgCfg(ConfigFlags, name = "MuonPflowIsolationDecorator", **kwargs):
63  from IsolationAlgs.IsoToolsConfig import MuonCaloIsolationToolCfg
64  result = ComponentAccumulator()
65  kwargs.setdefault("PtMin", 2500.)
66  kwargs.setdefault("IsolationTool", result.getPrimaryAndMerge(MuonCaloIsolationToolCfg(ConfigFlags,
67  saveOnlyRequestedCorrections=True)))
68  the_alg = CompFactory.DerivationFramework.PflowIsolationDecorAlg(name, **kwargs)
69  result.addEventAlgo(the_alg, primary=True)
70  return result
71 
72 
73 def TrackIsolationCfg(ConfigFlags, TrackCollection="InDetTrackParticles", TrackSelections = []):
74  result = ComponentAccumulator()
75  for WP in ['Nonprompt_All_MaxWeight', 'Tight']:
76  for trackPt in 500, 1000:
77  result.merge(MuonTrackIsolationDecorAlgCfg(ConfigFlags,
78  name = "TrackIsoDecorAlg{container}{WP}{Pt}".format(container = TrackCollection,
79  WP = WP, Pt = trackPt),
80  ttvaWP = WP,
81  trackPt = trackPt,
82  TrackCollection = TrackCollection,
83  TrackSelections = TrackSelections))
84  result.merge(TrackCaloIsolationDecorAlgCfg(ConfigFlags,
85  name = "CaloIsoDecorAlg{container}".format(container = TrackCollection),
86  TrackCollection = TrackCollection,
87  TrackSelections = TrackSelections))
88 
89  result.merge(TrackPflowIsolationDecorAlgCfg(ConfigFlags,
90  name = "PflowIsoDecorAlg{container}".format(container = TrackCollection),
91  TrackCollection = TrackCollection,
92  TrackSelections = TrackSelections))
93  return result
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
python.TrackIsolationDecoratorConfig.TrackCaloIsolationDecorAlgCfg
def TrackCaloIsolationDecorAlgCfg(ConfigFlags, name="MuonCaloIsolationDecorator", **kwargs)
Definition: TrackIsolationDecoratorConfig.py:52
IsoToolsConfig.MuonCaloIsolationToolCfg
def MuonCaloIsolationToolCfg(flags, **kwargs)
Definition: IsoToolsConfig.py:88
python.InDetTrackSelectionToolConfig.isoTrackSelectionToolCfg
def isoTrackSelectionToolCfg(flags, name="isoTrackSelectionTool", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:41
python.TrackIsolationDecoratorConfig.TrackPflowIsolationDecorAlgCfg
def TrackPflowIsolationDecorAlgCfg(ConfigFlags, name="MuonPflowIsolationDecorator", **kwargs)
Definition: TrackIsolationDecoratorConfig.py:62
python.InDetTrackSelectionToolConfig.InDetTrackSelectionTool_TrackTools_Cfg
def InDetTrackSelectionTool_TrackTools_Cfg(flags, name="InDetTrackSelectionTool", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:14
python.TrackIsolationDecoratorConfig.TrackIsolationToolCfg
def TrackIsolationToolCfg(ConfigFlags, name="TrackIsolationTool", **kwargs)
Definition: TrackIsolationDecoratorConfig.py:12
python.TrackIsolationDecoratorConfig.TrackIsolationCfg
def TrackIsolationCfg(ConfigFlags, TrackCollection="InDetTrackParticles", TrackSelections=[])
Definition: TrackIsolationDecoratorConfig.py:73
python.TrackIsolationDecoratorConfig.MuonTrackIsolationDecorAlgCfg
def MuonTrackIsolationDecorAlgCfg(ConfigFlags, name="MuonTrackIsolationDecorator", ttvaWP="Nonprompt_All_MaxWeight", trackPt=500., **kwargs)
Definition: TrackIsolationDecoratorConfig.py:26
TrackVertexAssociationToolConfig.isoTTVAToolCfg
def isoTTVAToolCfg(flags, name="ttvaToolForIso", **kwargs)
Definition: TrackVertexAssociationToolConfig.py:36