ATLAS Offline Software
IsoToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = """Tool configuration to instantiate all
4  isolationTools with default configuration"""
5 
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.Enums import BeamType
9 
10 def TrackIsolationToolCfg(flags, **kwargs):
11  acc = ComponentAccumulator()
12 
13  if 'TrackSelectionTool' not in kwargs:
14  from InDetConfig.InDetTrackSelectionToolConfig import isoTrackSelectionToolCfg
15  kwargs['TrackSelectionTool'] = acc.popToolsAndMerge(isoTrackSelectionToolCfg(flags))
16  if 'TTVATool' not in kwargs:
17  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import isoTTVAToolCfg
18  kwargs['TTVATool'] = acc.popToolsAndMerge(isoTTVAToolCfg(flags))
19  if flags.Beam.Type is BeamType.Cosmics:
20  kwargs['VertexLocation'] = ''
21 
22  acc.setPrivateTools(CompFactory.xAOD.TrackIsolationTool(**kwargs))
23  return acc
24 
25 def CaloIsolationToolCfg(flags, **kwargs):
26  acc = ComponentAccumulator()
27 
28  if 'IsoLeakCorrectionTool' not in kwargs:
29  kwargs['IsoLeakCorrectionTool'] = CompFactory.CP.IsolationCorrectionTool(
30  name = 'LeakageCorrTool')
31 
32  if 'ClustersInConeTool' not in kwargs:
33  kwargs['ClustersInConeTool'] = CompFactory.xAOD.CaloClustersInConeTool(
34  name = 'MyCaloClustersInConeTool',
35  CaloClusterLocation = "CaloCalTopoClusters")
36 
37  if 'ParticleCaloExtensionTool' not in kwargs:
38  from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg
39  kwargs['ParticleCaloExtensionTool'] = acc.popToolsAndMerge(
41 
42  kwargs.setdefault('name','CaloIsolationTool')
43  kwargs.setdefault('ParticleCaloExtensionTool',None)
44  kwargs.setdefault('ParticleCaloCellAssociationTool',None)
45  kwargs.setdefault('isMC',flags.Input.isMC)
46 
47  acc.setPrivateTools(CompFactory.xAOD.CaloIsolationTool(**kwargs))
48  return acc
49 
50 def ElectronTrackIsolationToolCfg(flags, **kwargs):
51  kwargs.setdefault('name','ElectronTrackIsolationTool')
52  kwargs.setdefault('CoreTrackEtaRange',0.01)
53  return TrackIsolationToolCfg(flags,**kwargs)
54 
55 def EGammaCaloIsolationToolCfg(flags, **kwargs):
56  acc = ComponentAccumulator()
57 
58  if 'IsoLeakCorrectionTool' not in kwargs:
59  kwargs['IsoLeakCorrectionTool'] = CompFactory.CP.IsolationCorrectionTool(
60  name = 'LeakageCorrTool',
61  LogLogFitForLeakage = True)
62 
63  if 'CaloFillRectangularClusterTool' not in kwargs:
64  kwargs['CaloFillRectangularClusterTool'] = CompFactory.CaloFillRectangularCluster(
65  name="egamma_CaloFillRectangularCluster",
66  eta_size=5,
67  phi_size=7,
68  cells_name=flags.Egamma.Keys.Input.CaloCells)
69 
70  # default is to read calocaltopoclusters.
71  # In HI, if subtracted clusters, use them instead, and do not do pu correction
72  if flags.HeavyIon.Egamma.doSubtractedClusters:
73  kwargs['ClustersInConeTool'] = CompFactory.xAOD.CaloClustersInConeTool(
74  name="topoiso_CaloClustersInConeTool",
75  CaloClusterLocation=flags.Egamma.Keys.Input.TopoClusters)
76  # No pileup correction, and do not save it
77  kwargs['InitializeReadHandles'] = False
78  kwargs['saveOnlyRequestedCorrections'] = True
79 
80  kwargs.setdefault('name','egCaloIsolationTool')
81  kwargs.setdefault('ParticleCaloExtensionTool',None)
82  kwargs.setdefault('ParticleCaloCellAssociationTool',None)
83  kwargs.setdefault('isMC',flags.Input.isMC)
84 
85  acc.setPrivateTools(CompFactory.xAOD.CaloIsolationTool(**kwargs))
86  return acc
87 
88 def MuonCaloIsolationToolCfg(flags, **kwargs):
89  acc = ComponentAccumulator()
90 
91  if 'ParticleCaloExtensionTool' not in kwargs:
92  from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg
93  kwargs['ParticleCaloExtensionTool'] = acc.popToolsAndMerge(
95  if 'FlowElementsInConeTool' not in kwargs and flags.Reco.EnablePFlow:
96  kwargs['FlowElementsInConeTool'] = CompFactory.xAOD.FlowElementsInConeTool(
97  name='FlowElementsInConeTool')
98 
99  # default is to read calocaltopoclusters.
100  # In HI, if subtracted clusters, use them instead, and do not do pu correction
101  if flags.HeavyIon.Egamma.doSubtractedClusters:
102  ccict = CompFactory.xAOD.CaloClustersInConeTool(
103  name="topoiso_CaloClustersInConeTool",
104  CaloClusterLocation=flags.Egamma.Keys.Input.TopoClusters)
105  kwargs['ClustersInConeTool'] = ccict
106  # No pileup correction, and do not save it
107  kwargs['InitializeReadHandles'] = False
108  kwargs['saveOnlyRequestedCorrections'] = True
109 
110  kwargs.setdefault('ParticleCaloCellAssociationTool',None)
111  kwargs.setdefault('UseEtaDepPUCorr',False)
112  kwargs.setdefault('name','muonCaloIsolationTool')
113 
114  acc.setPrivateTools(CompFactory.xAOD.CaloIsolationTool(**kwargs))
115  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
IsoToolsConfig.ElectronTrackIsolationToolCfg
def ElectronTrackIsolationToolCfg(flags, **kwargs)
Definition: IsoToolsConfig.py:50
IsoToolsConfig.MuonCaloIsolationToolCfg
def MuonCaloIsolationToolCfg(flags, **kwargs)
Definition: IsoToolsConfig.py:88
python.InDetTrackSelectionToolConfig.isoTrackSelectionToolCfg
def isoTrackSelectionToolCfg(flags, name="isoTrackSelectionTool", **kwargs)
Definition: InDetTrackSelectionToolConfig.py:41
IsoToolsConfig.CaloIsolationToolCfg
def CaloIsolationToolCfg(flags, **kwargs)
Definition: IsoToolsConfig.py:25
IsoToolsConfig.TrackIsolationToolCfg
def TrackIsolationToolCfg(flags, **kwargs)
Definition: IsoToolsConfig.py:10
TrackToCaloConfig.ParticleCaloExtensionToolCfg
def ParticleCaloExtensionToolCfg(flags, name='ParticleCaloExtensionTool', **kwargs)
Definition: TrackToCaloConfig.py:10
TrackVertexAssociationToolConfig.isoTTVAToolCfg
def isoTTVAToolCfg(flags, name="ttvaToolForIso", **kwargs)
Definition: TrackVertexAssociationToolConfig.py:36
IsoToolsConfig.EGammaCaloIsolationToolCfg
def EGammaCaloIsolationToolCfg(flags, **kwargs)
Definition: IsoToolsConfig.py:55