ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRecConfig
python
JetRecoSteering.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
3
from
AthenaConfiguration.Enums
import
BeamType
4
from
JetRecConfig.StandardSmallRJets
import
AntiKt4EMPFlow, AntiKt4LCTopo, AntiKt4EMTopo, AntiKt4Truth
5
from
JetRecConfig.StandardLargeRJets
import
AntiKt10LCTopo_tau, AntiKt10UFOCSSKSoftDrop_trigger
6
from
JetRecConfig.JetRecConfig
import
JetRecCfg
7
8
def
addTruthPileupJetsToOutputCfg
(flags, toAOD=True, toESD=True):
9
result = ComponentAccumulator()
10
11
jetdefs = [
"InTimeAntiKt4TruthJets"
,
"OutOfTimeAntiKt4TruthJets"
]
12
13
jetList = []
14
for
jetdef
in
jetdefs:
15
if
f
"xAOD::JetContainer#{jetdef}"
in
flags.Input.TypedCollections:
16
jetList += [ f
"xAOD::JetContainer#{jetdef}"
,
17
f
"xAOD::AuxContainerBase!#{jetdef}Aux.-PseudoJet.-constituentLinks.-constituentWeights"
]
18
19
from
OutputStreamAthenaPool.OutputStreamConfig
import
addToESD, addToAOD
20
if
toESD:
21
result.merge(addToESD(flags, jetList))
22
if
toAOD:
23
result.merge(addToAOD(flags, jetList))
24
25
return
result
26
27
28
def
addJetsToOutputCfg
(flags,jetdefs, toAOD=True, toESD=True):
29
"""Write out the jet containers as defined by jetdefs (a list of JetDefinition).
30
31
In Run3 we don't write out jets in AOD : this function is left for convenience and testing purpose.
32
"""
33
result = ComponentAccumulator()
34
35
#--------------------------------------------------------------
36
# Build output container list.
37
#--------------------------------------------------------------
38
jetList = []
39
40
for
jetdef
in
jetdefs:
41
jetList += [ f
"xAOD::JetContainer#{jetdef.fullname()}"
,
42
f
"xAOD::JetAuxContainer#{jetdef.fullname()}Aux.-PseudoJet.-numConstit"
]
43
# Not sure if this trigger special AuxContainer is obsolete in Run3 ?
44
# if trigger:
45
# auxprefix = "Trig"
46
# jetAODList += [ f"xAOD::Jet{auxprefix}AuxContainer#{jetdef.fullname()}Aux." ,
47
48
# Store event shapes when jets are being stored to output
49
jetList += [
"xAOD::EventShape#Kt4EMPFlowEventShape"
,
50
"xAOD::EventShapeAuxInfo#Kt4EMPFlowEventShapeAux."
,
51
"xAOD::EventShape#Kt4EMPFlowNeutEventShape"
,
52
"xAOD::EventShapeAuxInfo#Kt4EMPFlowNeutEventShapeAux."
,
53
"xAOD::EventShape#Kt4EMTopoOriginEventShape"
,
54
"xAOD::EventShapeAuxInfo#Kt4EMTopoOriginEventShapeAux."
,
55
"xAOD::EventShape#Kt4LCTopoOriginEventShape"
,
56
"xAOD::EventShapeAuxInfo#Kt4LCTopoOriginEventShapeAux."
]
57
58
from
OutputStreamAthenaPool.OutputStreamConfig
import
addToESD, addToAOD
59
if
toESD:
60
result.merge(addToESD(flags, jetList))
61
if
toAOD:
62
result.merge(addToAOD(flags, jetList))
63
64
return
result
65
66
def
JetRecoSteeringCfg
(flags):
67
result = ComponentAccumulator()
68
69
# the Standard list of jets to run :
70
jetdefs = [AntiKt4Truth, AntiKt4EMTopo, AntiKt4EMPFlow, AntiKt4LCTopo, AntiKt10LCTopo_tau, AntiKt10UFOCSSKSoftDrop_trigger]
71
72
# We're in Reco job : propagate this info to the runIII jet config
73
# (see JetConfigFlags.py for motivations on this way of doing)
74
75
#--------------------------------------------------------------
76
# Create the jet algs from the jet definitions
77
#--------------------------------------------------------------
78
for
jd
in
jetdefs:
79
result.merge(JetRecCfg(flags, jd))
80
81
if
flags.Output.doWriteAOD
and
flags.Jet.WriteToAOD:
82
result.merge(
addJetsToOutputCfg
(flags, jetdefs, toAOD=
True
, toESD=
False
))
83
if
flags.Output.doWriteESD
and
flags.Jet.WriteToESD:
84
jetdefs.remove(AntiKt10UFOCSSKSoftDrop_trigger)
85
result.merge(
addJetsToOutputCfg
(flags, jetdefs, toAOD=
False
, toESD=
True
))
86
87
# Schedule specific EventShape to use newer jet calibrations when running DQ in RAWtoALL
88
if
flags.Beam.Type
is
not
BeamType.Cosmics:
89
from
JetRecConfig.JetRecConfig
import
getConstitPJGAlg
90
from
JetRecConfig.StandardJetConstits
import
stdConstitDic
as
cst
91
from
JetRecConfig.JetInputConfig
import
buildEventShapeAlg
92
result.addEventAlgo(getConstitPJGAlg(cst.GPFlow, suffix=
'Neut'
))
93
result.addEventAlgo(buildEventShapeAlg(cst.GPFlow,
''
, suffix =
'Neut'
))
94
95
return
result
96
97
def
JetRecoSteeringTest
(flags=None):
98
99
if
flags
is
None
:
100
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
101
flags = initConfigFlags()
102
103
from
AthenaConfiguration.TestDefaults
import
defaultTestFiles, defaultConditionsTags
104
flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
105
flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC
106
107
# We have to set the production step, which PFFlow muon linking uses for autoconfiguration.
108
from
AthenaConfiguration.Enums
import
ProductionStep
109
flags.Common.ProductionStep=ProductionStep.Derivation
110
111
flags.fillFromArgs()
112
flags.lock()
113
114
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
115
acc = MainServicesCfg(flags)
116
117
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
118
acc.merge(PoolReadCfg(flags))
119
120
# Setup calorimeter geometry, which is needed for jet reconstruction
121
from
LArGeoAlgsNV.LArGMConfig
import
LArGMCfg
122
acc.merge(LArGMCfg(flags))
123
124
from
TileGeoModel.TileGMConfig
import
TileGMCfg
125
acc.merge(TileGMCfg(flags))
126
127
acc.merge(
JetRecoSteeringCfg
(flags))
128
129
# We also need to build links between the newly
130
# created jet constituents (GlobalFE)
131
# and electrons,photons,muons and taus
132
from
eflowRec.PFCfg
import
PFGlobalFlowElementLinkingCfg
133
acc.merge(PFGlobalFlowElementLinkingCfg(flags))
134
135
acc.run()
136
137
if
__name__==
"__main__"
:
138
JetRecoSteeringTest
()
python.JetRecoSteering.JetRecoSteeringCfg
JetRecoSteeringCfg(flags)
Definition
JetRecoSteering.py:66
python.JetRecoSteering.addJetsToOutputCfg
addJetsToOutputCfg(flags, jetdefs, toAOD=True, toESD=True)
Definition
JetRecoSteering.py:28
python.JetRecoSteering.JetRecoSteeringTest
JetRecoSteeringTest(flags=None)
Definition
JetRecoSteering.py:97
python.JetRecoSteering.addTruthPileupJetsToOutputCfg
addTruthPileupJetsToOutputCfg(flags, toAOD=True, toESD=True)
Definition
JetRecoSteering.py:8
Generated on
for ATLAS Offline Software by
1.17.0