ATLAS Offline Software
JetRecToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 
10 
11 from AthenaCommon import Logging
12 jrtlog = Logging.logging.getLogger('JetRecToolsConfig')
13 
14 from AthenaConfiguration.ComponentFactory import CompFactory
15 from JetRecConfig.JetRecConfig import isAnalysisRelease
16 
17 
18 
19 def getIDTrackSelectionTool(toolname, **toolProps):
20  """returns a InDetTrackSelectionTool configured with toolProps
21  (except in Analysis releases where some un-used (?) options are explicitely turned off)
22  """
23  idtracksel = CompFactory.getComp("InDet::InDetTrackSelectionTool")(toolname, **toolProps)
24 
25  if not isAnalysisRelease():
26  # thes options can not be set in AnalysisBase/AthAnalysis. (but not setting them is equivalent to set them to False)
27  idtracksel.UseTrkTrackTools = False
28  idtracksel.Extrapolator = ""
29  idtracksel.TrackSummaryTool = ""
30  return idtracksel
31 
32 def getTrackSelAlg(jetdef, trackSelOpt=False, DecorDeps=None):
33  if not DecorDeps:
34  DecorDeps = ["TTVA_AMVFWeights_forReco", "TTVA_AMVFVertices_forReco"]
35  trkProperties = jetdef._contextDic
36  trkOpt=jetdef.context
37 
38  trackToolProps = dict(**trkProperties["trackSelOptions"])
39 
40  if not trackSelOpt:
41  # track selection from trkOpt but OVERWRITING the CutLevel for e.g. ghosts (typically, only a pt>500MeV cut remains):
42  trackToolProps.update( CutLevel=trkProperties['GhostTrackCutLevel'] )
43  outContainerKey = "JetTracks"
44  trkOpt= trkOpt+'ghost' # just so it gives a different tool name below
45  else:
46  outContainerKey = "JetTracksQualityCuts"
47 
48  # build the selection alg
49  trkSelAlg = CompFactory.JetTrackSelectionAlg( f"trackselalg_{trkOpt}_{trkProperties[outContainerKey]}",
50  TrackSelector = getIDTrackSelectionTool(f"tracksel{trkOpt}",**trackToolProps),
51  InputContainer = trkProperties["Tracks"],
52  OutputContainer = trkProperties[outContainerKey],
53  DecorDeps = DecorDeps # Hardcoded for now... we might want to have this context-dependent ??
54  )
55 
56  return trkSelAlg
57 
58 
59 def getJetTrackVtxAlg( trkProperties, algname="jetTVA", **ttva_overide):
60  """ theSequence and ttva_overide are options used in trigger (HLT/Jet/JetTrackingConfig.py)"""
61  from TrackVertexAssociationTool.TrackVertexAssociationToolConfig import getTTVAToolForReco
62 
63  ttva_options = dict(
64  TrackContName = trkProperties["Tracks"],
65  HardScatterLinkDeco = ""
66  )
67  # allow client to overide options :
68  ttva_options.update(**ttva_overide)
69 
70  idtvassoc = getTTVAToolForReco( "jetTVatool", **ttva_options )
71 
72  alg = CompFactory.JetTrackVtxAssoAlg(algname,
73  TrackParticleContainer = trkProperties["Tracks"],
74  TrackVertexAssociation = trkProperties["TVA"],
75  VertexContainer = trkProperties["Vertices"],
76  TrackVertexAssoTool = idtvassoc
77  )
78  return alg
79 
80 
82  # PFlow objects matched to electrons/muons filtering algorithm
83  return CompFactory.JetPFlowSelectionAlg( "pflowselalg",
84  electronID = "LHMedium",
85  ChargedPFlowInputContainer = "JetETMissChargedParticleFlowObjects",
86  NeutralPFlowInputContainer = "JetETMissNeutralParticleFlowObjects",
87  ChargedPFlowOutputContainer = "GlobalPFlowChargedParticleFlowObjects",
88  NeutralPFlowOutputContainer = "GlobalPFlowNeutralParticleFlowObjects"
89  )
JetRecToolsConfig.getTrackSelAlg
def getTrackSelAlg(jetdef, trackSelOpt=False, DecorDeps=None)
Definition: JetRecToolsConfig.py:32
JetRecToolsConfig.getPFlowSelAlg
def getPFlowSelAlg()
Definition: JetRecToolsConfig.py:81
JetRecToolsConfig.getJetTrackVtxAlg
def getJetTrackVtxAlg(trkProperties, algname="jetTVA", **ttva_overide)
Definition: JetRecToolsConfig.py:59
ParticleJetToolsConfig.isAnalysisRelease
def isAnalysisRelease()
Definition: ParticleJetToolsConfig.py:19
TrackVertexAssociationToolConfig.getTTVAToolForReco
def getTTVAToolForReco(name="TTVATool", **kwargs)
Definition: TrackVertexAssociationToolConfig.py:6
JetRecToolsConfig.getIDTrackSelectionTool
def getIDTrackSelectionTool(toolname, **toolProps)
Definition: JetRecToolsConfig.py:19