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