5 JetMomentToolsConfig: A helper module for configuring jet moment
6 tools, in support of JetRecConfig.JetModConfig.
10 IMPORTANT : all the getXYZTool(jetdef, modspec) functions are meant to be used as callback from the main JetRecConfig module
11 when we need to convert definitions of tools into the actual tools. At this point the functions are invoked as
13 Hence they have jetdef and modspec arguments even if not needed in every case.
16 from AthenaCommon
import Logging
17 jetmomentlog = Logging.logging.getLogger(
'JetMomentToolsConfig')
19 from AthenaConfiguration.ComponentFactory
import CompFactory
21 from xAODBase.xAODType
import xAODType
25 """returns a InDetTrackSelectionTool configured with the jet context corresponding to trkOpt
26 (technically wrapped inside a JetTrackSelectionTool)
30 from JetRecTools.JetRecToolsConfig
import getIDTrackSelectionTool
32 return CompFactory.JetTrackSelectionTool(
44 useUncalibConstits =
False
45 if jetdef.inputdef.basetype==xAODType.CaloCluster:
46 builtFromEMClusters = jetdef.inputdef.inputname
in [
"CaloCalTopoClusters",
"HLT_CaloTopoClustersFS"]
and jetdef.inputdef.modifiers==[
"EM"]
47 useUncalibConstits =
not builtFromEMClusters
48 elif (jetdef.inputdef.basetype==xAODType.ParticleFlow
or jetdef.inputdef.basetype==xAODType.FlowElement):
49 useUncalibConstits =
True
51 raise ValueError(
"EM scale momentum not defined for input type {}".
format(jetdef.inputdef.basetype))
53 emscalemom = CompFactory.JetEMScaleMomTool(
54 "emscalemom_{}".
format(jetdef.basename),
55 UseUncalibConstits = useUncalibConstits,
56 JetContainer = jetdef.fullname(),
74 cfourmom = CompFactory.JetConstitFourMomTool(
"constitfourmom_{0}".
format(jetdef.basename))
75 if "LCTopo" in jetdef.basename
or "EMTopo" in jetdef.basename:
76 cfourmom.JetScaleNames = [
"DetectorEtaPhi"]
77 if "HLT_" in jetdef.fullname():
78 cfourmom.AltConstitColls = [
""]
79 cfourmom.AltConstitScales = [0]
80 cfourmom.AltJetScales = [
"JetConstitScaleMomentum"]
82 clstate =
"CALIBRATED" if "LCTopo" in jetdef.basename
else "UNCALIBRATED"
83 cfourmom.AltConstitColls = [jetdef.inputdef.inputname]
84 cfourmom.AltConstitScales = [CaloClusterStates[clstate]]
85 cfourmom.AltJetScales = [
""]
88 elif "PFlow" in jetdef.basename
or "UFO" in jetdef.basename:
89 cfourmom.JetScaleNames = [
"DetectorEtaPhi"]
90 cfourmom.AltConstitColls = [
""]
91 cfourmom.AltConstitScales = [0]
92 cfourmom.AltJetScales = [
"JetConstitScaleMomentum"]
98 trkopt = modspec
or jetdef.context
99 trackingKeys = jetdef._cflags.Jet.Context[trkopt]
100 jvf = CompFactory.JetVertexFractionTool(
102 VertexContainer = trackingKeys[
"Vertices"],
103 AssociatedTracks = trackingKeys[
"GhostTracksLabel"],
104 TrackVertexAssociation = trackingKeys[
"TVA"],
105 TrackParticleContainer = trackingKeys[
"Tracks"],
107 SuppressInputDependence =
True,
108 UseOriginVertex = jetdef.byVertex
115 jvt = CompFactory.JetVertexTaggerTool(
117 VertexContainer = jetdef._cflags.Jet.Context[modspec
or jetdef.context][
"Vertices"],
118 SuppressInputDependence =
True,
119 UseOriginVertex = jetdef.byVertex
125 nnjvt = CompFactory.getComp(
"JetPileupTag::JetVertexNNTagger")(
127 VertexContainer = jetdef._cflags.Jet.Context[modspec
or jetdef.context][
"Vertices"],
128 SuppressInputDependence =
True
135 trkopt = modspec
or jetdef.context
136 trackingKeys = jetdef._cflags.Jet.Context[trkopt]
138 trackmoments = CompFactory.JetTrackMomentsTool(
140 VertexContainer = trackingKeys[
"Vertices"],
141 AssociatedTracks = trackingKeys[
"GhostTracksLabel"],
142 TrackVertexAssociation = trackingKeys[
"TVA"],
143 TrackMinPtCuts = [500, 1000],
145 DoPFlowMoments =
'PFlow' in jetdef.fullname()
or 'UFO' in jetdef.fullname() ,
150 trkopt = modspec
or jetdef.context
151 trackingKeys = jetdef._cflags.Jet.Context[trkopt]
154 tracksummoments = CompFactory.JetTrackSumMomentsTool(
156 VertexContainer = trackingKeys[
"Vertices"],
157 AssociatedTracks = trackingKeys[
"GhostTracksLabel"],
158 TrackVertexAssociation = trackingKeys[
"TVA"],
159 RequireTrackPV =
True,
160 TrackSelector = jettrackselloose
162 return tracksummoments
167 origin_setpv = CompFactory.JetOriginCorrectionTool(
169 VertexContainer = jetdef._cflags.Jet.Context[modspec
or jetdef.context][
"Vertices"],
170 OriginCorrectedName =
"",
178 from JetRecConfig.JetDefinition
import buildJetAlgName
180 truthJetAlg =
buildJetAlgName(jetdef.algorithm, jetdef.radius)+
'Truth'+
str(modspec)+
'Jets'
182 jetPtAssociation = CompFactory.JetPtAssociationTool(
'jetPtAssociation',
183 MatchingJetContainer = truthJetAlg,
184 AssociationName =
"GhostTruth")
186 return jetPtAssociation
190 trkopt = modspec
or jetdef.context
191 trackingKeys = jetdef._cflags.Jet.Context[trkopt]
193 qgtagging = CompFactory.JetQGTaggerVariableTool(
'qgtagging',
194 VertexContainer = trackingKeys[
"Vertices"],
195 TrackVertexAssociation = trackingKeys[
"TVA"],
204 from JetCalibTools
import JetCalibToolsConfig
205 calibString =
"AnalysisLatest:mc:JetArea_Residual_EtaJES"
206 if( modspec
and modspec ==
"CustomVtx" ) :
207 calibString =
"AnalysisLatest:mc:JetArea_Residual_EtaJES:Kt4EMPFlowCustomVtxEventShape:HggPrimaryVertices"
210 wPFOTool = CompFactory.getComp(
'CP::WeightPFOTool')(
"fJVT__wPFO")
212 trackingKeys = jetdef._cflags.Jet.Context[modspec
or jetdef.context]
214 fJVTTool = CompFactory.JetForwardPFlowJvtTool(
"fJVT",
215 verticesName = trackingKeys[
"Vertices"],
216 TrackVertexAssociation = trackingKeys[
"TVA"],
217 WeightPFOTool = wPFOTool,
218 JetCalibrationTool = jetCalibrationTool,
219 FEName = jetdef.inputdef.containername,
221 FjvtRawName =
"DFCommonJets_fJvt",
229 from JetCalibTools
import JetCalibToolsConfig
232 wPFOTool = CompFactory.getComp(
'CP::WeightPFOTool')(
"bJVT__wPFO")
234 trackingKeys = jetdef._cflags.Jet.Context[modspec
or jetdef.context]
236 bJVTTool = CompFactory.JetBalancePFlowJvtTool(
'bJVT',
237 verticesName = trackingKeys[
"Vertices"],
238 TrackVertexAssociation = trackingKeys[
"TVA"],
239 WeightPFOTool = wPFOTool,
240 JetCalibrationTool = jetCalibrationTool,
241 FEName = jetdef.inputdef.containername,
243 BjvtRawName =
'DFCommonJets_bJvt',