ATLAS Offline Software
InDetMatchingConfig.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''@file InDetMatchingConfig.py
6 @author M. Aparo
7 @date 28-03-2024
8 @brief CA-based python configurations for matching tools in this package
9 '''
10 
11 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
12 from AthenaConfiguration.ComponentFactory import CompFactory
13 from AthenaCommon.Logging import logging
14 
15 
16 def DeltaRMatchingTool_trkTruthCfg( flags, name="DeltaRMatchingTool_trkTruth", **kwargs ):
17  '''
18  Tool for Track->Truth matching via DeltaR (and/or pT resolution)
19  '''
20  acc = ComponentAccumulator()
21 
22  kwargs.setdefault( "dRmax", flags.PhysVal.IDTPM.currentTrkAna.dRmax )
23  kwargs.setdefault( "pTResMax", flags.PhysVal.IDTPM.currentTrkAna.pTResMax )
24 
25  acc.setPrivateTools(
26  CompFactory.IDTPM.DeltaRMatchingTool_trkTruth( name, **kwargs ) )
27  return acc
28 
29 
30 def DeltaRMatchingTool_truthTrkCfg( flags, name="DeltaRMatchingTool_truthTrk", **kwargs ):
31  '''
32  Tool for Truth->Track matching via DeltaR (and/or pT resolution)
33  '''
34  acc = ComponentAccumulator()
35 
36  kwargs.setdefault( "dRmax", flags.PhysVal.IDTPM.currentTrkAna.dRmax )
37  kwargs.setdefault( "pTResMax", flags.PhysVal.IDTPM.currentTrkAna.pTResMax )
38 
39  acc.setPrivateTools(
40  CompFactory.IDTPM.DeltaRMatchingTool_truthTrk( name, **kwargs ) )
41  return acc
42 
43 
44 def DeltaRMatchingTool_trkCfg( flags, name="DeltaRMatchingTool_trk", **kwargs ):
45  '''
46  Tool for Track->Track matching via DeltaR (and/or pT resolution)
47  '''
48  acc = ComponentAccumulator()
49 
50  kwargs.setdefault( "dRmax", flags.PhysVal.IDTPM.currentTrkAna.dRmax )
51  kwargs.setdefault( "pTResMax", flags.PhysVal.IDTPM.currentTrkAna.pTResMax )
52 
53  acc.setPrivateTools(
54  CompFactory.IDTPM.DeltaRMatchingTool_trk( name, **kwargs ) )
55  return acc
56 
57 
58 def TrackTruthMatchingToolCfg( flags, name="TrackTruthMatchingTool", **kwargs ):
59  '''
60  Tool for Track->Truth matching via 'truthParticleLink' decorations
61  '''
62  acc = ComponentAccumulator()
63 
64  kwargs.setdefault( "MatchingTruthProb", flags.PhysVal.IDTPM.currentTrkAna.truthProbCut )
65 
66  acc.setPrivateTools(
67  CompFactory.IDTPM.TrackTruthMatchingTool( name, **kwargs ) )
68  return acc
69 
70 
71 def TruthTrackMatchingToolCfg( flags, name="TruthTrackMatchingTool", **kwargs ):
72  '''
73  Tool for Truth->Track matching via 'truthParticleLink' decorations
74  '''
75  acc = ComponentAccumulator()
76 
77  kwargs.setdefault( "MatchingTruthProb", flags.PhysVal.IDTPM.currentTrkAna.truthProbCut )
78 
79  acc.setPrivateTools(
80  CompFactory.IDTPM.TruthTrackMatchingTool( name, **kwargs ) )
81  return acc
82 
83 
84 def TrackMatchingToolCfg( flags, **kwargs ):
85  '''
86  CA-based configuration for the test-reference matching Tool
87  '''
88  log = logging.getLogger( "TrackMatchingToolCfg" )
89 
90 
91  if flags.PhysVal.IDTPM.currentTrkAna.MatchingType == "DeltaRMatch":
92 
93 
94  if "Truth" in flags.PhysVal.IDTPM.currentTrkAna.RefType :
96  flags, name = "DeltaRMatchingTool_trkTruth" +
97  flags.PhysVal.IDTPM.currentTrkAna.anaTag, **kwargs )
98 
99 
100  if "Truth" in flags.PhysVal.IDTPM.currentTrkAna.TestType :
102  flags, name = "DeltaRMatchingTool_truthTrk" +
103  flags.PhysVal.IDTPM.currentTrkAna.anaTag, **kwargs )
104 
105 
107  flags, name="DeltaRMatchingTool_trk" +
108  flags.PhysVal.IDTPM.currentTrkAna.anaTag, **kwargs )
109 
110 
111  if flags.PhysVal.IDTPM.currentTrkAna.MatchingType == "TruthMatch":
112 
113 
114  if "Truth" in flags.PhysVal.IDTPM.currentTrkAna.RefType :
116  flags, name="TrackTruthMatchingTool" +
117  flags.PhysVal.IDTPM.currentTrkAna.anaTag, **kwargs )
118 
119 
120  if "Truth" in flags.PhysVal.IDTPM.currentTrkAna.TestType :
122  flags, name="TruthTrackMatchingTool" +
123  flags.PhysVal.IDTPM.currentTrkAna.anaTag, **kwargs )
124 
125  log.warning( "TruthMatch via decorations not configurable if Test or Ref isn't Truth" )
126  log.warning( "Matching will not be executed for TrkAnalysis %s",
127  flags.PhysVal.IDTPM.currentTrkAna.anaTag )
128  return None
129 
130  log.warning( "Requested not supported matching type: %s",
131  flags.PhysVal.IDTPM.currentTrkAna.MatchingType )
132  log.warning( "Matching will not be executed for TrkAnalysis %s",
133  flags.PhysVal.IDTPM.currentTrkAna.anaTag )
134  return None
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
InDetMatchingConfig.TruthTrackMatchingToolCfg
def TruthTrackMatchingToolCfg(flags, name="TruthTrackMatchingTool", **kwargs)
Definition: InDetMatchingConfig.py:71
InDetMatchingConfig.TrackMatchingToolCfg
def TrackMatchingToolCfg(flags, **kwargs)
Definition: InDetMatchingConfig.py:84
InDetMatchingConfig.DeltaRMatchingTool_trkTruthCfg
def DeltaRMatchingTool_trkTruthCfg(flags, name="DeltaRMatchingTool_trkTruth", **kwargs)
Definition: InDetMatchingConfig.py:16
InDetMatchingConfig.DeltaRMatchingTool_truthTrkCfg
def DeltaRMatchingTool_truthTrkCfg(flags, name="DeltaRMatchingTool_truthTrk", **kwargs)
Definition: InDetMatchingConfig.py:30
InDetMatchingConfig.DeltaRMatchingTool_trkCfg
def DeltaRMatchingTool_trkCfg(flags, name="DeltaRMatchingTool_trk", **kwargs)
Definition: InDetMatchingConfig.py:44
InDetMatchingConfig.TrackTruthMatchingToolCfg
def TrackTruthMatchingToolCfg(flags, name="TrackTruthMatchingTool", **kwargs)
Definition: InDetMatchingConfig.py:58