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