ATLAS Offline Software
Loading...
Searching...
No Matches
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
11from AthenaCommon import Logging
12jrtlog = Logging.logging.getLogger('JetRecToolsConfig')
13
14from AthenaConfiguration.ComponentFactory import CompFactory
15from JetRecConfig.JetRecConfig import isAnalysisRelease
16
17
18
19def 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
32def 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
59def 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 )
getJetTrackVtxAlg(trkProperties, algname="jetTVA", **ttva_overide)
getIDTrackSelectionTool(toolname, **toolProps)
getTrackSelAlg(jetdef, trackSelOpt=False, DecorDeps=None)