3 This module defines the standard 'jet contexts'.
4 A jet context is a set of options (mainly related to Tracks) shared by several
5 components (modifier tools, input tools/algs, ...).
7 Other contexts are expected to be defined, for example in the trigger to deal with oher track collection, or for
8 analysis having non-default PV0 choices.
10 Setting a context to a JetDefinition ensures identical properties are consistently set across the components configured by the JetDefinition.
12 Contexts are defined as dictionaries and are centralized under the AthConfigFlags used to configure the jobs under 'flags.Jet.Context'.
14 from JetRecConfig.Utilities
import ldict
15 from AthenaConfiguration.Enums
import LHCPeriod
16 from PyUtils.moduleExists
import moduleExists
18 from AthenaConfiguration.AthConfigFlags
import AthConfigFlags
21 flags = AthConfigFlags()
25 Tracks =
"InDetTrackParticles",
26 JetTracks =
"JetSelectedTracks",
27 JetTracksQualityCuts =
"JetSelectedTracks_trackSelOpt",
28 Vertices =
"PrimaryVertices",
29 TVA =
"JetTrackVtxAssoc",
30 GhostTracks =
"PseudoJetGhostTrack",
31 GhostTracksLabel =
"GhostTrack",
32 EventDensity =
"EventDensity",
33 GhostTrackCutLevel =
'NoCut',
37 trackSelOptions = ldict( CutLevel =
"Loose", minPt=500, maxAbsEta=2.5 ),
40 flags.addFlag(
"Jet.Context.Run3" , run3context)
42 flags.addFlag(
"Jet.Context.Run4" , run3context.clone(
43 trackSelOptions = run3context[
"trackSelOptions"].
clone(maxAbsEta=4.0)
45 flags.addFlag(
"Jet.Context.HL_LHC", flags.Jet.Context.Run4)
49 def _defaultFlag(prevFlags):
51 run = prevFlags.GeoModel.Run
52 except (ValueError, RuntimeError) :
55 return prevFlags.Jet.Context.Run3
if run <= LHCPeriod.Run3
else prevFlags.Jet.Context.Run4
56 flags.addFlag(
"Jet.Context.default", _defaultFlag)
63 flags.addFlag(
"Jet.Context.EleRM" , run3context.clone(
64 Tracks =
"InDetTrackParticles_EleRM",
65 TVA =
"JetTrackVtxAssoc_EleRM",
66 JetTracks =
"JetSelectedTracks_EleRM",
67 GhostTracks =
"PseudoJetGhostTrack_EleRM",
68 EventDensity =
"EleRM_EventDensity",
75 flags.addFlag(
"Jet.Context.CommonTrackKeys",[
"Tracks",
"Vertices",
"TVA",
"GhostTracks",
"GhostTracksLabel",
"JetTracks",
"JetTracksQualityCuts"],)
81 from TriggerMenuMT.HLT.Jet.JetRecoCommon
import addJetContextFlags
87 from DerivationFrameworkHiggs.HIGG1D1CustomJetsConfig
import addJetContextFlags
93 from DerivationFrameworkPhys.GNNVertexConfig
import addJetContextFlags
101 """Some properties might depend on the context for which jets are configured.
102 This function returns a helper function which gives the value of the property propName according to the jet context.
104 def getProp(jetdef, spec):
105 contextDic = jetdef._contextDic
106 if isinstance(spec, str):
108 contextDic = jetdef._cflags.Jet.Context[spec
or jetdef.context]
109 return contextDic[propName]
113 """Some prerequisites might depend on the context for which jets are configured.
114 This function returns a helper function which gives a list of input prerequisites according to 'inputKey' in the current jetdef.context.
116 def getPrereqs(jetdef):
117 return f
"input:{prefix}{jetdef._contextDic[inputKey]}{suffix}"