ATLAS Offline Software
Loading...
Searching...
No Matches
python.StandardJetContext Namespace Reference

Functions

 createJetContextFlags ()
 propFromContext (propName)
 inputsFromContext (inputKey, prefix="", suffix="")

Detailed Description

This module defines the standard 'jet contexts'. 
A jet context is a set of options (mainly related to Tracks) shared by several 
components (modifier tools, input tools/algs, ...).

Other contexts are expected to be defined, for example in the trigger to deal with oher track collection, or for 
analysis having non-default PV0 choices.

Setting a context to a JetDefinition ensures identical properties are  consistently set across the components configured by the JetDefinition. 

Contexts are defined as dictionaries and are centralized under the AthConfigFlags used to configure the jobs under 'flags.Jet.Context'.

Function Documentation

◆ createJetContextFlags()

python.StandardJetContext.createJetContextFlags ( )

Definition at line 20 of file StandardJetContext.py.

20def createJetContextFlags():
21 flags = AthConfigFlags()
22
23 #***********************
24 run3context=ldict(
25 Tracks = "InDetTrackParticles",
26 JetTracks = "JetSelectedTracks", #used for e.g. ghost tracks (no track quality criteria applied)
27 JetTracksQualityCuts = "JetSelectedTracks_trackSelOpt", #used for track-jets (trackSelOpt quality criteria applied)
28 Vertices = "PrimaryVertices",
29 TVA = "JetTrackVtxAssoc",
30 GhostTracks = "PseudoJetGhostTrack",
31 GhostTracksLabel = "GhostTrack",
32 EventDensity = "EventDensity",
33 GhostTrackCutLevel = 'NoCut', # The track selection level for ghost-associated tracks. This is different from the cutlevel we apply when performing actual calculations such as JVT or tack moments.
34
35 # options passed to InDet::InDetTrackSelectionTool.
36 # Note : these are the standard options used for track calculations. Tracks selected for ghost-associaton have CutLevel=NoCut by default : see ghostTrackCutLevel above
37 trackSelOptions = ldict( CutLevel = "Loose", minPt=500, maxAbsEta=2.5 ),
38 )
39
40 flags.addFlag("Jet.Context.Run3" , run3context)
41 #***********************
42 flags.addFlag("Jet.Context.Run4" , run3context.clone(
43 trackSelOptions = run3context["trackSelOptions"].clone(maxAbsEta=4.0) # set range of track selection up to eta=4
44 ))
45 flags.addFlag("Jet.Context.HL_LHC", flags.Jet.Context.Run4)
46
47 #***********************
48 # The default context is Run3 or Run4 according to other global flags :
49 def _defaultFlag(prevFlags):
50 try:
51 run = prevFlags.GeoModel.Run
52 except (ValueError, RuntimeError) : # several exceptions can be thrown... catch any of them
53 # No GeoModel.Run -> we are in a Truth job, return an empty context.
54 return {}
55 return prevFlags.Jet.Context.Run3 if run <= LHCPeriod.Run3 else prevFlags.Jet.Context.Run4
56 flags.addFlag("Jet.Context.default", _defaultFlag)
57
58
59
60
61 #***********************
62 # Alternative context for AntiKt4LCTopo_EleRM jets used for the electron removed tau reconstruction
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",
69 ))
70
71
72 #**********************************
73 # This is not a jet context, but the list of keys related to track (Used in trigger config).
74 # We store it under Context since it is a related central place.
75 flags.addFlag("Jet.Context.CommonTrackKeys",["Tracks", "Vertices", "TVA", "GhostTracks", "GhostTracksLabel", "JetTracks", "JetTracksQualityCuts"],)
76
77
78 # ****************
79 # Add Jet trigger context :
80 if moduleExists("TriggerMenuMT"):
81 from TriggerMenuMT.HLT.Jet.JetRecoCommon import addJetContextFlags
82 addJetContextFlags(flags)
83
84 # ****************
85 # Add HIGG1D1 context :
86 if moduleExists("DerivationFrameworkHiggs"):
87 from DerivationFrameworkHiggs.HIGG1D1CustomJetsConfig import addJetContextFlags
88 addJetContextFlags(flags)
89
90 # ****************
91 # Add PHYS context :
92 if moduleExists("DerivationFrameworkPhys"):
93 from DerivationFrameworkPhys.GNNVertexConfig import addJetContextFlags
94 addJetContextFlags(flags)
95
96 return flags
97
98
99

◆ inputsFromContext()

python.StandardJetContext.inputsFromContext ( inputKey,
prefix = "",
suffix = "" )
Some prerequisites might depend on the context for which jets are configured.
This function returns a helper function which gives a list of input prerequisites according to 'inputKey' in the current jetdef.context.    

Definition at line 112 of file StandardJetContext.py.

112def inputsFromContext(inputKey, prefix="", suffix=""):
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.
115 """
116 def getPrereqs(jetdef):
117 return f"input:{prefix}{jetdef._contextDic[inputKey]}{suffix}"
118 return getPrereqs

◆ propFromContext()

python.StandardJetContext.propFromContext ( propName)
Some properties might depend on the context for which jets are configured.
This function returns a helper function which gives the value of the property propName according to the jet context.    

Definition at line 100 of file StandardJetContext.py.

100def propFromContext(propName):
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.
103 """
104 def getProp(jetdef, spec):
105 contextDic = jetdef._contextDic
106 if isinstance(spec, str):
107 # user may have passed explicitly a str : allow to force an other context if jetdef.context if non void
108 contextDic = jetdef._cflags.Jet.Context[spec or jetdef.context]
109 return contextDic[propName]
110 return getProp
111