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