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