ATLAS Offline Software
Loading...
Searching...
No Matches
StandardJetConstits.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3"""
4 StandardJetConstits: A module containing standard definitions for jet inputs : external container and
5 constituents.
6 These can be copied and modified by users who want something a bit
7 different from what is provided.
8
9 Author: TJ Khoo, P-A Delsart
10
11
12"""
13
14
15from .JetDefinition import xAODType, JetInputConstitSeq, JetInputExternal, JetConstitModifier, JetInputConstit
16from .StandardJetContext import inputsFromContext, propFromContext
17from .JetRecConfig import isAnalysisRelease
18from AthenaConfiguration.Enums import BeamType
19from JetRecConfig.JetRecCommon import isMC
20
21
22# Prepare dictionnaries to hold all of our standard definitions.
23# They will be filled from the lists below
24from .Utilities import ldict
25stdInputExtDic = ldict()
26stdConstitDic = ldict()
27stdContitModifDic = ldict()
28
29
30# This module contains the helper functions needed to instantiate the input container external
31# to Jet domain
32import JetRecConfig.JetInputConfig as inputcfg
33import JetRecConfig.JetRecConfig as jrcfg
34try:
35 import JetRecTools.JetRecToolsConfig as jrtcfg
36except ModuleNotFoundError:
37 # In some releases JetRecTools is not existing
38 pass
39
40try:
41 import TrackCaloClusterRecTools.TrackCaloClusterConfig as tcccfg
42except ModuleNotFoundError:
43 # In some releases TrackCaloClusterRecTools is not existing
44 pass
45
46def standardReco(input):
47 """Returns a helper function which invokes the standard reco configuration for the container 'input'
48 (where input is external to the jet domain).
49
50 We group the definition of functions here rather than separately, so that we can change them
51 automatically to a void function in case we're in an Analysis release and we can not import upstream packages.
52
53 """
54
55 doNothingFunc = lambda *l:None # noqa: E731
56 if isAnalysisRelease():
57 return doNothingFunc
58
59
60 if input=='CaloClusters':
61 def f(jetdef,spec):
62 from CaloRec.CaloRecoConfig import CaloRecoCfg
63 flags = jetdef._cflags
64 return CaloRecoCfg(flags) if flags.Jet.doUpstreamDependencies else None
65 elif input=='Tracks':
66 def f(jetdef,spec):
67 from InDetConfig.TrackRecoConfig import InDetTrackRecoCfg
68 flags = jetdef._cflags
69 return InDetTrackRecoCfg(flags) if flags.Jet.doUpstreamDependencies else None
70 elif input=="Muons":
71 def f(jetdef,spec):
72 from MuonConfig.MuonReconstructionConfig import MuonReconstructionCfg
73 flags = jetdef._cflags
74 return MuonReconstructionCfg(flags) if flags.Jet.doUpstreamDependencies else None
75 elif input=="PFlow":
76 def f(jetdef,spec):
77 if not jetdef._cflags.Jet.doUpstreamDependencies:
78 return None
79 from eflowRec.PFRun3Config import PFCfg
80 return PFCfg(jetdef._cflags)
81 elif input=="DressedWZ":
82 def f(jetdef,spec):
83 from DerivationFrameworkMCTruth.MCTruthCommonConfig import PreJetMCTruthAugmentationsCfg
84 return PreJetMCTruthAugmentationsCfg(jetdef._cflags,decorationDressing='dressedPhoton')
85 else:
86 f = doNothingFunc
87
88 return f
89
90
92
93# Functions to check if upstream containers should exist. These are
94# implemented as lambda functions in the simpler cases.
95
97 warning = "Tracking is disabled and no InDetTrackParticles in input"
98 if "InDetTrackParticles" in flags.Input.Collections:
99 return True, warning
100 if isAnalysisRelease():
101 # we can't check reco flags in analysis release (and would not
102 # be building tracks anyway)
103 return False, warning
104 return flags.Reco.EnableTracking, warning
105
107 warning = "Muon reco is disabled"
108 if "MuonSegments" in flags.Input.Collections:
109 return True, warning
110 if isAnalysisRelease():
111 # reco flags don't exist in analysis release
112 return False, warning
113 return flags.Reco.EnableCombinedMuon, warning
114
116 warning = "UnAssociated muon segments not present"
117 if "UnAssocMuonSegments" in flags.Input.Collections:
118 return True, warning
119 if flags.Input.RunNumbers[0] < 410000:
120 # Unassociated containers only exist from Run 3 and mc23 onwards
121 return False, warning
122 if isAnalysisRelease():
123 # reco flags don't exist in analysis release
124 return False, warning
125 return flags.Reco.EnableCombinedMuon, warning
126
128 warning = "Large radius tracking did not run"
129 if "InDetLargeD0TrackParticles" in flags.Input.Collections:
130 # the conditions here weren't the same as above: apparently we
131 # require _both_ the input condition _and_ the tracking
132 # flag. I don't know if this is what we want but it keeps with
133 # the existing behavior.
134 #
135 # Again, the isAnalysisRelease function is needed to short
136 # circuit the flag check, since flags.Tracking doesn't exist
137 # in analysis releases.
138 if isAnalysisRelease() or flags.Tracking.doLargeD0:
139 return True, warning
140 return False, warning
141
143 def f(flags,spec):
144 from CaloRec.CaloClusterMLCalibAlgLiteConfig import CaloClusterMLCalibAlgLiteCfg
145 return CaloClusterMLCalibAlgLiteCfg(flags._cflags)
146 return f
148 def f(jetdef,spec):
149 if isAnalysisRelease():
150 return None
151 from CaloRec.CaloClusterTritonConfig import CaloClusterTritonAlgCfg
152 return CaloClusterTritonAlgCfg(jetdef._cflags)
153 return f
155 def f(flags,spec):
156 from eflowRec.PFRun3Config import PFOClusterMLCorrectionAlgorithmBuilder
157 return PFOClusterMLCorrectionAlgorithmBuilder(flags._cflags, spec)
158 return f
159
160
161
162_stdInputList = [
163 # Format is :
164 # JetInputExternal( containername , containerType, ...optionnal parameters... )
165 # When defined, algoBuilder is a function returning the actual alg building the input.
166 # it will be called as : algoBuilder(jetdef, spec) where jetdef is the parent JetDefinition
167
168 # *****************************
169 # ML calibrated clusters
170 JetInputExternal("CaloCalTopoClusters", xAODType.CaloCluster, algoBuilder= standardReco("CaloClusters")),
171
172 JetInputExternal("CaloCalTopoClustersML", xAODType.CaloCluster, algoBuilder= getCaloClusterEnergyMLCalibAlgBuilder(), prereqs = ["input:CaloCalTopoClusters"]),
173
174 JetInputExternal("CaloCalTopoClustersGNN", xAODType.CaloCluster, algoBuilder= getCaloClusterTritonAlgBuilder(), prereqs = ["input:CaloCalTopoClusters"]),
175
176 JetInputExternal("HLT_TopoCaloClustersFS", xAODType.CaloCluster ),
177
178 # *****************************
179 JetInputExternal("JetETMissParticleFlowObjects", xAODType.FlowElement, algoBuilder = standardReco("PFlow"),
180 prereqs = [inputsFromContext("Tracks"), "input:CaloCalTopoClusters"],
181 ),
182
183 JetInputExternal("GlobalParticleFlowObjects", xAODType.FlowElement,
184 algoBuilder = inputcfg.buildPFlowSel,
185 prereqs = ["input:JetETMissParticleFlowObjects", ],
186 ),
187
188 JetInputExternal("GlobalClusterMLCorrectedParticleFlowObjects", xAODType.FlowElement, algoBuilder = getPFOClusterMLCorrectionAlgorithmBuilder(),
189 prereqs = ["input:GlobalParticleFlowObjects", "input:CaloCalTopoClusters", "input:CaloCalTopoClustersML"],
190 ),
191
192 JetInputExternal("GlobalParticleFlowObjects_noElectrons", xAODType.FlowElement,
193 algoBuilder = inputcfg.buildPFlowSel_noElectrons,
194 prereqs = ["input:JetETMissParticleFlowObjects", ],
195 ),
196
197 JetInputExternal("GlobalParticleFlowObjects_noMuons", xAODType.FlowElement,
198 algoBuilder = inputcfg.buildPFlowSel_noMuons,
199 prereqs = ["input:JetETMissParticleFlowObjects", ],
200 ),
201
202 JetInputExternal("GlobalParticleFlowObjects_noLeptons", xAODType.FlowElement,
203 algoBuilder = inputcfg.buildPFlowSel_noLeptons,
204 prereqs = ["input:JetETMissParticleFlowObjects", ],
205 ),
206
207 #Same as GlobalParticleFlowObjects but with charged and neutrals linked to muons included.
208 JetInputExternal("GlobalParticleFlowObjects_inclMuons", xAODType.FlowElement,
209 algoBuilder = inputcfg.buildPFlowSel_inclMuons,
210 prereqs = ["input:JetETMissParticleFlowObjects", ],
211 ),
212
213 JetInputExternal("GlobalParticleFlowObjects_tauSeedEleRM", xAODType.FlowElement,
214 algoBuilder = inputcfg.buildPFlowSel_tauSeedEleRM,
215 prereqs = ["input:JetETMissParticleFlowObjects", ],
216 ),
217
218 # *****************************
219 JetInputExternal("InDetTrackParticles", xAODType.TrackParticle,
220 algoBuilder = standardReco("Tracks"),
221 filterfn = _trackParticleInputsExist
222 ),
223 # alternative ID tracks for AntiKt4LCTopo_EleRM jets used for the electron removed tau reconstruction
224 JetInputExternal("InDetTrackParticles_EleRM", xAODType.TrackParticle),
225
226 JetInputExternal("PrimaryVertices", xAODType.Vertex,
227 prereqs = [inputsFromContext("Tracks")],
228 filterfn = lambda flags : (flags.Beam.Type == BeamType.Collisions, f"No vertexing with {flags.Beam.Type}"), # should be changed when a reliable "EnableVertexing" flag exists
229 ),
230 # No quality criteria are applied to the tracks, used for ghosts for example
231 JetInputExternal("JetSelectedTracks", xAODType.TrackParticle,
232 prereqs= [ inputsFromContext("Tracks") ], # in std context, this is InDetTrackParticles (see StandardJetContext)
233 algoBuilder = lambda jdef,_ : jrtcfg.getTrackSelAlg(jdef, trackSelOpt=False )
234 ),
235 # alternative JetSelected tracks for AntiKt4LCTopo_EleRM jets used for the electron removed tau reconstruction
236 JetInputExternal("JetSelectedTracks_EleRM", xAODType.TrackParticle,
237 prereqs= [ inputsFromContext("Tracks") ], # in std context, this is InDetTrackParticles (see StandardJetContext)
238 algoBuilder = lambda jdef,_ : jrtcfg.getTrackSelAlg(jdef, trackSelOpt=False )
239 ),
240 # alternative ID tracks for ftf (FS HLT tracking)
241 JetInputExternal("JetSelectedTracks_ftf", xAODType.TrackParticle,
242 prereqs= [ inputsFromContext("Tracks") ], # in std context, this is InDetTrackParticles (see StandardJetContext)
243 algoBuilder = lambda jdef,_ : jrtcfg.getTrackSelAlg(jdef, trackSelOpt=False )
244 ),
245 # alternative ID tracks for roiftf (jet super-RoI HLT tracking)
246 JetInputExternal("JetSelectedTracks_roiftf", xAODType.TrackParticle,
247 prereqs= [ inputsFromContext("Tracks") ], # in std context, this is InDetTrackParticles (see StandardJetContext)
248 algoBuilder = lambda jdef,_ : jrtcfg.getTrackSelAlg(jdef, trackSelOpt=False )
249 ),
250
251 # Apply quality criteria defined via trackSelOptions in jdef.context (used e.g. for track-jets)
252 JetInputExternal("JetSelectedTracks_trackSelOpt", xAODType.TrackParticle,
253 prereqs= [ inputsFromContext("Tracks") ], # in std context, this is InDetTrackParticles (see StandardJetContext)
254 algoBuilder = lambda jdef,_ : jrtcfg.getTrackSelAlg(jdef, trackSelOpt=True )
255 ),
256 JetInputExternal("JetTrackUsedInFitDeco", xAODType.TrackParticle,
257 prereqs= [ inputsFromContext("Tracks") , # in std context, this is InDetTrackParticles (see StandardJetContext)
258 inputsFromContext("Vertices")],
259 algoBuilder = inputcfg.buildJetTrackUsedInFitDeco
260 ),
261 JetInputExternal("JetTrackVtxAssoc", xAODType.TrackParticle,
262 algoBuilder =
263 lambda jdef, _ : jrtcfg.getJetTrackVtxAlg(
264 jdef._contextDic,
265 algname="jetTVA" if jdef.context in ["HL_LHC", "default", "notrk", ""] else f"jetTVA_{jdef.context}",
266 WorkingPoint="Nonprompt_All_MaxWeight"
267 ),
268 # previous default for ttva : WorkingPoint="Custom", d0_cut= 2.0, dzSinTheta_cut= 2.0
269 prereqs = ["input:JetTrackUsedInFitDeco", inputsFromContext("Vertices")],
270 ),
271 # alternative JetTrackVtxAssoc for AntiKt4LCTopo_EleRM jets used for the electron removed tau reconstruction
272 JetInputExternal("JetTrackVtxAssoc_EleRM", xAODType.TrackParticle,
273 algoBuilder = lambda jdef,_ : jrtcfg.getJetTrackVtxAlg(jdef._contextDic, algname="jetTVA_" + jdef.context, WorkingPoint="Nonprompt_All_MaxWeight"),
274 # previous default for ttva : WorkingPoint="Custom", d0_cut= 2.0, dzSinTheta_cut= 2.0
275 prereqs = ["input:JetTrackUsedInFitDeco", inputsFromContext("Vertices") ]
276 ),
277 JetInputExternal("JetTrackVtxAssoc_ftf", xAODType.TrackParticle,
278 algoBuilder = lambda jdef,_ : jrtcfg.getJetTrackVtxAlg(jdef._contextDic, algname="jetTVA_" + jdef.context, WorkingPoint="Nonprompt_All_MaxWeight"),
279 # previous default for ttva : WorkingPoint="Custom", d0_cut= 2.0, dzSinTheta_cut= 2.0
280 prereqs = ["input:JetTrackUsedInFitDeco", inputsFromContext("Vertices") ]
281 ),
282 JetInputExternal("JetTrackVtxAssoc_roiftf", xAODType.TrackParticle,
283 algoBuilder = lambda jdef,_ : jrtcfg.getJetTrackVtxAlg(jdef._contextDic, algname="jetTVA_" + jdef.context, WorkingPoint="Nonprompt_All_MaxWeight"),
284 # previous default for ttva : WorkingPoint="Custom", d0_cut= 2.0, dzSinTheta_cut= 2.0
285 prereqs = ["input:JetTrackUsedInFitDeco", inputsFromContext("Vertices") ]
286 ),
287 # *****************************
288 JetInputExternal("EventDensity", "EventShape", algoBuilder = inputcfg.buildEventShapeAlg,
289 containername = lambda jetdef, specs : (specs or "")+"Kt4"+jetdef.inputdef.label+"EventShape",
290 prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name] # this will force the input to be build *before* the EventDensity alg.
291 ),
292
293 # EventDensity calculated from neutral objects only
294 JetInputExternal("EventDensityNeut", "EventShape",
295 algoBuilder = lambda jetdef,_: inputcfg.buildEventShapeAlg(jetdef, '', suffix='Neut'),
296 containername = lambda jetdef, specs : (specs or "")+"Kt4"+jetdef.inputdef.label+"NeutEventShape",
297 prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name+'_Neut']
298 ),
299
300 # alternative EventDensity for AntiKt4LCTopo_EleRM jets used for the electron removed tau reconstruction
301 JetInputExternal("EleRM_EventDensity", "EventShape", algoBuilder = inputcfg.buildEventShapeAlg,
302 containername = lambda jetdef, specs : (specs or "")+"Kt4"+jetdef.inputdef.label+"EventShape",
303 prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name],
304 specs = "EleRM_"
305 ),
306 JetInputExternal("HLT_EventDensity", "EventShape", algoBuilder = inputcfg.buildEventShapeAlg,
307 containername = lambda jetdef, specs : (specs or "")+"Kt4"+jetdef.inputdef.label+"EventShape",
308 prereqs = lambda jetdef : ["input:"+jetdef.inputdef.name], # this will force the input to be build *before* the EventDensity alg.
309 specs = 'HLT_'
310 ),
311
312 # *****************************
313 JetInputExternal("MuonSegments", "MuonSegment", algoBuilder=standardReco("Muons"),
314 prereqs = [inputsFromContext("Tracks")], # most likely wrong : what exactly do we need to build muon segments ?? (and not necessarily full muons ...)
315 filterfn = _muonSegmentInputsExist
316 ),
317
318 JetInputExternal("UnAssocMuonSegments", "UnAssocMuonSegment", algoBuilder=standardReco("Muons"),
319 prereqs = [inputsFromContext("Tracks")],
320 filterfn = _unassocMuonSegmentInputsExist
321 ),
322
323
324 # *****************************
325 # Truth particles from the hard scatter vertex prior to Geant4 simulation.
326 # Neutrinos and muons are omitted; all other stable particles are included.
327 JetInputExternal("JetInputTruthParticles", xAODType.TruthParticle,
328 algoBuilder = inputcfg.buildJetInputTruth, filterfn=isMC ),
329
330 # Truth particles from the hard scatter vertex prior to Geant4 simulation.
331 # Prompt electrons, muons and neutrinos are excluded, all other stable particles
332 # are included, in particular leptons and neutrinos from hadron decays.
333 JetInputExternal("JetInputTruthParticlesNoWZ", xAODType.TruthParticle,
334 algoBuilder = inputcfg.buildJetInputTruth, filterfn=isMC,specs="NoWZ"),
335
336 # Truth particles from the hard scatter vertex prior to Geant4 simulation.
337 # Similar configuration as for JetInputTruthParticlesNoWZ but with slightly
338 # different photon dressing option
339 JetInputExternal("JetInputTruthParticlesDressedWZ", xAODType.TruthParticle,
340 prereqs = ["input:DressedObjects"],
341 algoBuilder = inputcfg.buildJetInputTruth, filterfn=isMC,specs="DressedWZ"),
342
343 # If jets are reconstructed standalone, the dressing decoration needs to be added
344 JetInputExternal("DressedObjects", "DressedObjects", algoBuilder = standardReco("DressedWZ")),
345
346 # Truth particles from the hard scatter vertex prior to Geant4 simulation.
347 # Only charged truth particles are used
348 JetInputExternal("JetInputTruthParticlesCharged", xAODType.TruthParticle,
349 algoBuilder = inputcfg.buildJetInputTruth, filterfn=isMC,specs="Charged"),
350
351
352 #**************
353 # TEMPORARY : special inputs for EVTGEN jobs (as long as gen-level and reco-level definitions are not harmonized)
354 JetInputExternal("JetInputTruthParticlesGEN", xAODType.TruthParticle,
355 algoBuilder = inputcfg.buildJetInputTruthGEN, filterfn=isMC ),
356
357 JetInputExternal("JetInputTruthParticlesGENNoWZ", xAODType.TruthParticle,
358 algoBuilder = inputcfg.buildJetInputTruthGEN, filterfn=isMC,specs="NoWZ"),
359 #**************
360
361
362 JetInputExternal("PV0JetSelectedTracks", xAODType.TrackParticle,
363 prereqs=["input:JetSelectedTracks_trackSelOpt", "input:JetTrackUsedInFitDeco"],
364 algoBuilder = inputcfg.buildPV0TrackSel ),
365
366
367 JetInputExternal("UFOCSSK", xAODType.FlowElement,
368 # in analysis releases, or if we have UFOCSSK in inputs don't declare unneeded dependencies which could fail the config.
369 prereqs =lambda parentjdef : [] if (isAnalysisRelease() or 'UFOCSSK' in parentjdef._cflags.Input.Collections ) else ['input:GPFlowCSSK'],
370 filterfn = lambda flag : ( (not isAnalysisRelease() or 'UFOCSSK' in flag.Input.Collections), "Can't build UFO in Analysis projects and not UFOCSSK in input") ,
371 algoBuilder = lambda jdef,_ : tcccfg.runUFOReconstruction(jdef._cflags, stdConstitDic['GPFlowCSSK'])
372 ),
373
374 JetInputExternal("UFOCSSK_noElectrons", xAODType.FlowElement,
375 prereqs =lambda parentjdef : [] if (isAnalysisRelease() or 'UFOCSSK_noElectrons' in parentjdef._cflags.Input.Collections ) else ['input:GPFlowCSSK_noElectrons'],
376 filterfn = lambda flag : ( (not isAnalysisRelease() or 'UFOCSSK_noElectrons' in flag.Input.Collections), "Can't build UFO in Analysis projects and not UFOCSSK in input") ,
377 algoBuilder = lambda jdef,_ : tcccfg.runUFOReconstruction(jdef._cflags, stdConstitDic['GPFlowCSSK_noElectrons'])
378 ),
379
380 JetInputExternal("UFOCSSK_noMuons", xAODType.FlowElement,
381 prereqs =lambda parentjdef : [] if (isAnalysisRelease() or 'UFOCSSK_noMuons' in parentjdef._cflags.Input.Collections ) else ['input:GPFlowCSSK_noMuons'],
382 filterfn = lambda flag : ( (not isAnalysisRelease() or 'UFOCSSK_noMuons' in flag.Input.Collections), "Can't build UFO in Analysis projects and not UFOCSSK in input") ,
383 algoBuilder = lambda jdef,_ : tcccfg.runUFOReconstruction(jdef._cflags, stdConstitDic['GPFlowCSSK_noMuons'])
384 ),
385
386 JetInputExternal("UFOCSSK_noLeptons", xAODType.FlowElement,
387 # in analysis releases, or if we have UFOCSSK in inputs don't declare unneeded dependencies which could fail the config.
388 prereqs =lambda parentjdef : [] if (isAnalysisRelease() or 'UFOCSSK_noLeptons' in parentjdef._cflags.Input.Collections ) else ['input:GPFlowCSSK_noLeptons'],
389 filterfn = lambda flag : ( (not isAnalysisRelease() or 'UFOCSSK_noLeptons' in flag.Input.Collections), "Can't build UFO in Analysis projects and not UFOCSSK in input") ,
390 algoBuilder = lambda jdef,_ : tcccfg.runUFOReconstruction(jdef._cflags, stdConstitDic['GPFlowCSSK_noLeptons'])
391 ),
392
393 #Same as UFOCSSK but with charged and neutrals linked to muons included.
394 JetInputExternal("UFOCSSK_inclMuons", xAODType.FlowElement,
395 prereqs =lambda parentjdef : [] if (isAnalysisRelease() or 'UFOCSSK_inclMuons' in parentjdef._cflags.Input.Collections ) else ['input:GPFlowCSSK_inclMuons'],
396 filterfn = lambda flag : ( (not isAnalysisRelease() or 'UFOCSSK_inclMuons' in flag.Input.Collections), "Can't build UFO in Analysis projects and not UFOCSSK in input") ,
397 algoBuilder = lambda jdef,_ : tcccfg.runUFOReconstruction(jdef._cflags, stdConstitDic['GPFlowCSSK_inclMuons'])
398 ),
399
400 JetInputExternal("UFO", xAODType.FlowElement,
401 prereqs = ['input:GPFlow'],
402 algoBuilder = lambda jdef,_ : tcccfg.runUFOReconstruction(jdef._cflags, stdConstitDic['GPFlow'])
403 ),
404
405 # PseudoJet algorithm for PFlow objects, filtering out charged objects
406 # Needed as input for the Kt4EMPFlowNeutEventShape algorithm
407 JetInputExternal("GPFlow_Neut", xAODType.FlowElement,
408 prereqs = ['input:GPFlow'],
409 algoBuilder = lambda jdef,_ : jrcfg.getConstitPJGAlg(stdConstitDic['GPFlow'], suffix='Neut'),
410 ),
411
412]
413
414
415_truthFlavours = ["BHadronsInitial", "BHadronsFinal", "BQuarksFinal",
416 "CHadronsInitial", "CHadronsFinal", "CQuarksFinal",
417 "TausFinal",
418 "WBosons", "ZBosons", "HBosons", "TQuarksFinal",
419 "Partons",]
420for label in _truthFlavours:
421 # re-use the main truth input definition :
422 _stdInputList.append( JetInputExternal("TruthLabel"+label, xAODType.TruthParticle,
423 algoBuilder = inputcfg.buildLabelledTruth,
424 filterfn=isMC, specs = label ) )
425
426
427
428# Fill the stdInputExtDic from the above list
429for ji in _stdInputList:
430 ji._locked = True # lock the definitions so we have unmutable references !
431 stdInputExtDic[ji.name] = ji
432
433
434
435
436
437
438
439
440
443_stdSeqList = [
444 # Format is typically :
445 # JetInputConstitSeq( name , input_cont_type, list_of_modifiers, inputcontainer, outputcontainer )
446 # or
447 # JetInputConstit( name, input_cont_type, containername)
448 # see JetDefinition.py for details.
449
450 # *****************************
451 # Cluster constituents : the first one is a relic used for isolation, and might disappear soon
452 JetInputConstitSeq("EMTopo", xAODType.CaloCluster, ["EM"],
453 "CaloCalTopoClusters", "EMTopoClusters", jetinputtype="EMTopo",
454 ),
455 JetInputConstitSeq("LCTopo", xAODType.CaloCluster, ["LC"],
456 "CaloCalTopoClusters", "LCTopoClusters", jetinputtype="LCTopo",
457 ),
458 JetInputConstitSeq("EMTopoOrigin", xAODType.CaloCluster, ["EM","Origin"],
459 "CaloCalTopoClusters", "EMOriginTopoClusters", jetinputtype="EMTopo",
460 ),
461 JetInputConstitSeq("MLTopoOrigin", xAODType.CaloCluster, ["ML","Origin"],
462 "CaloCalTopoClusters", "MLOriginTopoClusters", jetinputtype="EMTopo",
463 ),
464 JetInputConstitSeq("GNNTopoOrigin", xAODType.CaloCluster, ["GNN","Origin"],
465 "CaloCalTopoClusters", "GNNOriginTopoClusters", jetinputtype="EMTopo",
466 ),
467 JetInputConstitSeq("LCTopoOrigin",xAODType.CaloCluster, ["LC","Origin"],
468 "CaloCalTopoClusters", "LCOriginTopoClusters", jetinputtype="LCTopo",
469 ),
470 # alternative LCTopoOrigin for AntiKt4LCTopo_EleRM jets used for the electron removed tau reconstruction
471 JetInputConstitSeq("LCTopoOrigin_EleRM",xAODType.CaloCluster, ["LC","Origin"],
472 "CaloCalTopoClusters_EleRM", "LCOriginTopoClusters_EleRM", jetinputtype="LCTopo",
473 ),
474 JetInputConstitSeq("LCTopoCSSK", xAODType.CaloCluster, ["LC","Origin","CS","SK"],
475 "CaloCalTopoClusters", "LCOriginTopoCSSK", jetinputtype="LCTopo",
476 ),
477
478
479 # *****************************
480 # EM-scale particle flow objects with charged hadron subtraction
481 # For now we don't specify a scale, as only one works well, but
482 # this could be incorporated into the naming scheme and config
483 JetInputConstitSeq("EMPFlow", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'JetETMissParticleFlowObjects', 'CHSParticleFlowObjects'),
484
485 # EM-scale particle flow objects with correction to ML cluster scale, with charged hadron subtraction
486 JetInputConstitSeq("GPFlowML", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalClusterMLCorrectedParticleFlowObjects', 'CHSGlobalClusterMLCorrectedParticleFlowObjects', label = 'EMPFlowML',),
487
488 # GPFlow are the same than EMPFlow except they have pflow linked to elec or muons filtered out.
489 JetInputConstitSeq("GPFlow", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects', 'CHSGParticleFlowObjects',
490 label='EMPFlow'),
491
492 JetInputConstitSeq("GPFlow_noElectrons", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects_noElectrons', 'CHSGParticleFlowObjects_noElectrons',
493 label='EMPFlow_noElectrons'),
494
495 JetInputConstitSeq("GPFlow_noMuons", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects_noMuons', 'CHSGParticleFlowObjects_noMuons',
496 label='EMPFlow_noMuons'),
497
498 JetInputConstitSeq("GPFlow_noLeptons", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects_noLeptons', 'CHSGParticleFlowObjects_noLeptons',
499 label='EMPFlow_noLeptons'),
500
501 #Same as GPFlow but with charged and neutrals linked to muons included.
502 JetInputConstitSeq("GPFlow_inclMuons", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects_inclMuons', 'CHSGParticleFlowObjects_inclMuons',
503 label='EMPFlow_inclMuons'),
504
505 #GPFlow with tau seed electrons removed
506 JetInputConstitSeq("GPFlow_tauSeedEleRM", xAODType.FlowElement,["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects_tauSeedEleRM', 'CHSGParticleFlowObjects_tauSeedEleRM',
507 label='EMPFlow_tauSeedEleRM'),
508
509 # Particle Flow Objects with several neutral PFO copies for by-vertex reconstruction
510 JetInputConstitSeq("GPFlowByVtx", xAODType.FlowElement, ["CorrectPFO", "CHS"] , 'GlobalParticleFlowObjects', 'CHSByVtxGParticleFlowObjects',
511 label='EMPFlowByVertex', byVertex=True),
512
513 # Particle Flow Objects with Constituent Subtraction + SoftKiller
514 JetInputConstitSeq("EMPFlowCSSK", xAODType.FlowElement,["CorrectPFO", "CS","SK", "CHS"] ,
515 'JetETMissParticleFlowObjects', 'CSSKParticleFlowObjects', jetinputtype="EMPFlow"),
516
517 JetInputConstitSeq("GPFlowCSSK", xAODType.FlowElement,["CorrectPFO", "CS","SK", "CHS"] ,
518 'GlobalParticleFlowObjects', 'CSSKGParticleFlowObjects', jetinputtype="EMPFlow", label='EMPFlowCSSK'),
519
520 JetInputConstitSeq("GPFlowCSSK_noElectrons", xAODType.FlowElement,["CorrectPFO", "CS","SK", "CHS"] ,
521 'GlobalParticleFlowObjects_noElectrons', 'CSSKGParticleFlowObjects_noElectrons', jetinputtype="EMPFlow", label='EMPFlowCSSK_noElectrons'),
522
523 JetInputConstitSeq("GPFlowCSSK_noMuons", xAODType.FlowElement,["CorrectPFO", "CS","SK", "CHS"] ,
524 'GlobalParticleFlowObjects_noMuons', 'CSSKGParticleFlowObjects_noMuons', jetinputtype="EMPFlow", label='EMPFlowCSSK_noMuons'),
525
526 JetInputConstitSeq("GPFlowCSSK_noLeptons", xAODType.FlowElement,["CorrectPFO", "CS","SK", "CHS"] ,
527 'GlobalParticleFlowObjects_noLeptons', 'CSSKGParticleFlowObjects_noLeptons', jetinputtype="EMPFlow", label='EMPFlowCSSK_noLeptons'),
528
529 #Same as GPFlowCSSK but with charged and neutrals linked to muons included.
530 JetInputConstitSeq("GPFlowCSSK_inclMuons", xAODType.FlowElement,["CorrectPFO", "CS","SK", "CHS"] ,
531 'GlobalParticleFlowObjects_inclMuons', 'CSSKGParticleFlowObjects_inclMuons', jetinputtype="EMPFlow", label='EMPFlowCSSK_inclMuons'),
532
533 JetInputConstit("UFOCSSK", xAODType.FlowElement, "UFOCSSK" ),
534
535 JetInputConstit("UFOCSSK_noElectrons", xAODType.FlowElement, "UFOCSSK_noElectrons" ),
536
537 JetInputConstit("UFOCSSK_noMuons", xAODType.FlowElement, "UFOCSSK_noMuons" ),
538
539 JetInputConstit("UFOCSSK_noLeptons", xAODType.FlowElement, "UFOCSSK_noLeptons" ),
540
541 #Same as UFOCSSK but with charged and neutrals linked to muons included.
542 JetInputConstit("UFOCSSK_inclMuons", xAODType.FlowElement, "UFOCSSK_inclMuons" ),
543
544 JetInputConstit("UFO", xAODType.FlowElement, "UFO" ),
545
546 # *****************************
547 # Tower (used only as ghosts atm)
548 JetInputConstit("Tower", xAODType.CaloCluster, "CaloCalFwdTopoTowers",
549 filterfn = lambda flags : ("CaloCalFwdTopoTowers" in flags.Input.Collections, "Towers as ghosts disabled as CaloCalFwdTopoTowers are not in the input")),
550
551 # *****************************
552 # Track constituents (e.g. ghosts, no quality criteria, no TTVA)
553 JetInputConstit("Track", xAODType.TrackParticle, inputsFromContext("JetTracks")),
554 # Track constituents (e.g. track-jets, trackSelOptions quality criteria, TTVA)
555 JetInputConstit("PV0Track", xAODType.TrackParticle, inputsFromContext("JetTracks", prefix="PV0")),
556
557 # LRT. Only used as ghosts
558 JetInputConstit("TrackLRT", xAODType.TrackParticle, "InDetLargeD0TrackParticles",
559 filterfn = _largeRTracksExist),
560
561 # *****************************
562 # Muon segments. Only used as ghosts
563 JetInputConstit("MuonSegment", "MuonSegment", "MuonSegments", ),
564 # In Run 3, the MuonSegment container is split into associated and unassociated segments
565 JetInputConstit("UnAssocMuonSegment", "UnAssocMuonSegment", "UnAssocMuonSegments", ),
566
567 # *****************************
568 # VR track jets as ghosts for large-R jets
569 # this could work :
570 #JetInputConstit("AntiKtVR30Rmax4Rmin02PV0TrackJet", xAODType.Jet, "AntiKtVR30Rmax4Rmin02PV0TrackJets"),
571 # BUT a better solution is to call
572 # registerAsInputConstit(AntiKtVR30Rmax4Rmin02PV0Track)
573 # at the place where the jetdef 'AntiKtVR30Rmax4Rmin02PV0Track' is defined : see StandardSmallRJets.py
574
575 # *****************************
576 # Truth particles (see JetInputExternal declarations above for more details)
577 JetInputConstit("Truth", xAODType.TruthParticle, "JetInputTruthParticles" ),
578
579 JetInputConstit("TruthWZ", xAODType.TruthParticle, "JetInputTruthParticlesNoWZ", jetinputtype="TruthWZ"),
580
581 JetInputConstit("TruthDressedWZ", xAODType.TruthParticle, "JetInputTruthParticlesDressedWZ", jetinputtype="TruthDressedWZ"),
582
583 JetInputConstit("TruthCharged", xAODType.TruthParticle, "JetInputTruthParticlesCharged", jetinputtype="TruthCharged"),
584
585 #**************
586 # TEMPORARY : special inputs for EVTGEN jobs (as long as gen-level and reco-level definitions are not harmonized)
587 JetInputConstit("TruthGEN", xAODType.TruthParticle, "JetInputTruthParticlesGEN" , label="Truth"),
588
589 JetInputConstit("TruthGENWZ", xAODType.TruthParticle, "JetInputTruthParticlesGENNoWZ", jetinputtype="TruthWZ", label="TruthWZ"),
590
591]
592
593# define JetInputConstit for each flavour type :
594for label in _truthFlavours:
595 _stdSeqList.append( JetInputConstit(label, xAODType.TruthParticle, "TruthLabel"+label ) )
596
597# Fill the stdConstitDic from the above list
598for jc in _stdSeqList:
599 jc._locked = True
600 stdConstitDic[jc.name] = jc
601
602
603
604
606
608 """One Property of the CorrectPFO constit modifier is a tool.
609 we use this function as a placeholder, allowing to delay the instantiation of this property tool
610 to the time the modifier itself is instantiated.
611 """
612 from AthenaConfiguration.ComponentFactory import CompFactory
613 return CompFactory.getComp("CP::WeightPFOTool")("weightPFO")
614
615
616vtxKey = "PrimaryVertices"
617tvaKey = "JetTrackVtxAssoc"
618_stdModList = [
619 # Format is :
620 # JetConstitModifier( name , toolType, dictionnary_of_tool_properties )
621 # (see JetDefinition.py for more details)
622
623 JetConstitModifier("Origin", "CaloClusterConstituentsOrigin", prereqs=[inputsFromContext("Vertices")]),
624 JetConstitModifier("EM", "ClusterAtEMScaleTool", ),
625 JetConstitModifier("ML", "ClusterAtMLScaleTool", prereqs=["input:CaloCalTopoClustersML"]),
626 JetConstitModifier("GNN", "ClusterAtMLScaleTool", prereqs=["input:CaloCalTopoClustersGNN"],
627 properties=dict(ClusterMLCorrectedEnergyDecorationKey="CaloCalTopoClusters.GNNCalibratedEnergy",
628 ClusterMLCorrectedEnergyDecorationType="double")),
629 JetConstitModifier("LC", "", ),
630 # Particle flow
631 JetConstitModifier("CorrectPFO", "CorrectPFOTool",
632 # get the track properties from the context with wich jet will be configured with propFromContext
633 # See StandardJetContext.py for the default values.
634 prereqs=[inputsFromContext("Vertices")],
635 properties=dict(VertexContainerKey=propFromContext("Vertices"),
636 WeightPFOTool= _getWeightPFOToolDefault,
637 DoByVertex = lambda jdef, _: jdef.byVertex) ),
638 JetConstitModifier("CHS", "ChargedHadronSubtractionTool",
639 # get the track properties from the context with wich jet will be configured with propFromContext
640 # See StandardJetContext.py for the default values.
641 # Note : Jet trigger still needs an older CHS config, hence the cheks to jetdef.context below...
642 # When jet trigger migrate and follow the offline settings all this can be simplified.
643 prereqs= lambda parentjdef : [inputsFromContext("Vertices"),] + ( [inputsFromContext("TVA")] if parentjdef.context=='default' else []) ,
644 properties=dict(VertexContainerKey=propFromContext("Vertices"),
645 TrackVertexAssociation=propFromContext("TVA"),
646 UseTrackToVertexTool= lambda jdef,_: jdef.context in ['default', 'HL_LHC'],
647 DoByVertex = lambda jdef, _: jdef.byVertex
648 )),
649
650 # Pileup suppression
651 JetConstitModifier("Vor", "VoronoiWeightTool", properties=dict(doSpread=False, nSigma=0) ),
652 JetConstitModifier("CS", "ConstituentSubtractorTool", properties=dict(MaxEta=4.5 ) ),
653 JetConstitModifier("SK", "SoftKillerWeightTool",),
654
655]
656
657# Fill the stdContitModifDic from the above list
658for ji in _stdModList:
659 ji._locked = True
660 stdContitModifDic[ji.name] = ji
Definition PFCfg.py:1
_getWeightPFOToolDefault(*l)
List of standard constituent modifiers.
_trackParticleInputsExist(flags)
List of standard input sources for jets.