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