140 """This build the standard heavy ion style jet.
142 This is similar to JetRecConfig.getJetDefAlgs(). However due to how the alg flow is organized in the
143 chain steps, we can't use this function directly.
145 - construct a JetDefinition
146 - use lower-level function in JetRecConfig with this JetDefinition to get the necessary algs and build our sequence manually.
151 if jetRecoDict[
"ionopt"] ==
"noion":
152 raise ValueError(
"Jet reco for heavy ion called without a ion option!")
154 dataSource =
"mc" if configFlags.Input.isMC
else "data"
156 jetHIEvtShapeSequence, eventShapeKey, eventShapeMapTool =
jetHIEventShapeSequenceCA(configFlags, clustersKey=clustersKey, towerKey=towerKey, **jetRecoDict)
157 acc.merge(jetHIEvtShapeSequence)
159 jetNamePrefix = JetRecoCommon.getHLTPrefix()
160 jetDef = JetRecoCommon.defineHIJets(jetRecoDict,clustersKey=clustersKey,prefix=jetNamePrefix,suffix=
"_Unsubtracted")
161 jetsFullName_Unsub = jetDef.fullname()
164 jet_collection_name = jetsFullName_Unsub.split(
'_')[1].
replace(
"Jets",
"")
167 pjgalg = CompFactory.PseudoJetAlgorithm(
169 InputContainer = clustersKey,
170 OutputContainer =
"PseudoJet"+clustersKey,
172 SkipNegativeEnergy =
False,
173 TreatNegativeEnergyAsGhost=
True
175 acc.addEventAlgo(pjgalg)
176 finalpjs =
str(pjgalg.OutputContainer)
179 jetDef._internalAtt[
'finalPJContainer'] = finalpjs
182 from JetRec
import JetOnlineMon
186 jetRecAlg =
getHIJetRecAlg(jetDef, jetsFullName_Unsub, monTool=monTool)
187 acc.addEventAlgo(jetRecAlg)
189 associationName =
"%s_DR8Assoc" % (clustersKey)
191 jetsInUnsub = jetsFullName_Unsub
195 if jetRecoDict[
"jetCalib"].endswith(
"IS")
and (dataSource==
"data"):
197 calib_seq +=
"_Insitu"
199 target_jetReco = f
'_for_{jetRecoDict["jetDefStr"]}'
202 vnharmonics = [2,3,4]
203 if jetRecoDict[
"ionopt"] ==
"ionp":
208 jetDef_seed0 = jetDef.clone()
209 jetDef_seed0.suffix = jetDef.suffix.replace(
"Unsubtracted",
"seed0"+target_jetReco)
210 jetDef_seed0.radius = 0.2
211 jetsFullName_seed0 = jetDef_seed0.fullname()
212 jetDef_seed0.modifiers=[
213 JetModifier(
"HIJetDRAssociationTool",
"HIJetDRAssociation", ContainerKey=clustersKey, DeltaR=0.8, AssociationName=associationName),
214 JetModifier(
"HIJetMaxOverMeanTool",
"HIJetMaxOverMean"+target_jetReco, JetContainer = jetsFullName_seed0),
215 JetModifier(
"HIJetDiscriminatorTool",
"HIJetDiscriminator", MaxOverMeanCut = 4, MinimumETMaxCut=3000),
219 copySeed0Alg =
getJetCopyAlg(jetsin=jetsInUnsub,jetsoutdef=jetDef_seed0,decorations=[],shallowcopy=
False,shallowIO=
False,monTool=monTool)
220 acc.addEventAlgo(copySeed0Alg)
223 iter0=
HLTAddIteration(configFlags, jetsFullName_seed0, eventShapeKey, clustersKey, map_tool=eventShapeMapTool, assoc_name=associationName, suffix=
"iter0"+target_jetReco, harmonics = vnharmonics)
224 acc.addEventAlgo(
HLTRunTools([iter0],
"jetalgHI_iter0"+target_jetReco))
225 modulator0=iter0.Modulator
226 subtractor0=iter0.Subtractor
228 HLTMakeSubtractionTool(configFlags, iter0.OutputEventShapeKey, Modulator=modulator0, EventShapeMapTool=eventShapeMapTool, Subtractor=subtractor0, label=
"HLTHIJetConstSub_iter0"+target_jetReco)
230 cluster_key_iter0_deep=clustersKey+
"_iter0_temp"+target_jetReco
231 happy_iter0_Tool =
ApplySubtractionToClustersHLT(configFlags, EventShapeKey=
"HLTHIEventShapeWeighted_iter0"+target_jetReco, ClusterKey=clustersKey, OutClusterKey=cluster_key_iter0_deep, Modulator=modulator0, EventShapeMapTool=eventShapeMapTool, Subtractor=subtractor0, SetMoments=
False, ApplyOriginCorrection=
False)
232 acc.addEventAlgo(
HLTRunTools([happy_iter0_Tool],
"jetalgHI_clusterSub_iter0"+target_jetReco))
234 GetConstituentsModifierToolHLT(configFlags, name=
"HIJetConstituentModifierTool", ClusterKey=cluster_key_iter0_deep, ApplyOriginCorrection=
False, label=
"HLTHIJetJetConstMod_iter0"+target_jetReco)
238 jetDef_seed1 = jetDef.clone()
239 jetDef_seed1.suffix = jetDef_seed0.suffix.replace(
"_seed0",
"_seed1")
240 jetDef_seed1.radius = 0.2
241 jetDef_seed1.modifiers=[
"HLTHIJetAssoc", f
"HLTHIJetConstSub_iter0{target_jetReco}:iter0",
"HLTHIJetSeedCalib:{}___{}".
format(calib_seq, JES_is_data),
"Filter:{}".
format(SeedPtMin)]
242 jetsFullName_seed1 = jetDef_seed1.fullname()
243 copySeed1Alg =
getJetCopyAlg(jetsin=jetsInUnsub,jetsoutdef=jetDef_seed1,decorations=[],shallowcopy=
False,shallowIO=
False,monTool=monTool)
244 acc.addEventAlgo(copySeed1Alg)
246 iter1=
HLTAddIteration(configFlags, jetsFullName_seed1, eventShapeKey, clustersKey, map_tool=eventShapeMapTool, assoc_name=associationName, sub_tool=subtractor0, suffix=
"iter1"+target_jetReco, harmonics = vnharmonics)
247 iter1.OutputEventShapeKey=
"HLTHIEventShape_iter1"+target_jetReco
248 modulator1=iter1.Modulator
249 subtractor1=iter1.Subtractor
251 HLTMakeSubtractionTool(configFlags, iter1.OutputEventShapeKey, Modulator=modulator1, EventShapeMapTool=eventShapeMapTool, label=
"HLTHIJetConstSub_iter1"+target_jetReco)
253 acc.addEventAlgo(
HLTRunTools([iter1],
"jetalgHI_clusterSub_egamma"+target_jetReco))
256 cluster_key_final_deep=clustersKey+
"_final"+target_jetReco
257 subToClusterTool =
ApplySubtractionToClustersHLT(configFlags, EventShapeKey=
"HLTHIEventShape_iter1"+target_jetReco, ClusterKey=clustersKey, OutClusterKey=cluster_key_final_deep, Modulator=modulator1, EventShapeMapTool=eventShapeMapTool, Subtractor=subtractor1, SetMoments=
False, ApplyOriginCorrection=
False)
258 acc.addEventAlgo(
HLTRunTools([subToClusterTool],
"jetalgHI_clusterSub"+target_jetReco))
260 GetConstituentsModifierToolHLT(configFlags, name=
"HIJetConstituentModifierTool", ClusterKey=cluster_key_final_deep, ApplyOriginCorrection=
False, label=
"HLTHIJetJetConstMod_iter1"+target_jetReco)
262 RecoOutputPtMin = 20000
263 if jetRecoDict[
"ionopt"] ==
"ionp":
264 RecoOutputPtMin = 10000
265 jetDef_final = jetDef.clone()
266 jetDef_final.suffix = jetDef.suffix.replace(
"_Unsubtracted",
"")
267 jetDef_final.modifiers=[f
"HLTHIJetConstSub_iter1{target_jetReco}:iter1",
"HLTHIJetJetConstMod_iter1"+target_jetReco,
"HLTHIJetCalib:{}___{}___{}".
format(calib_seq, JES_is_data, jet_collection_name),
"Sort",
"Filter:{}".
format(RecoOutputPtMin)]
268 copyAlg_final=
getJetCopyAlg(jetsin=jetsInUnsub,jetsoutdef=jetDef_final,decorations=[],shallowcopy=
False,shallowIO=
False,monTool=monTool)
269 acc.addEventAlgo(copyAlg_final)
271 jetsFinal =
recordable(jetDef_final.fullname())
275 return acc, jetsOut, jetDef_final