23 jetNamePrefix = JetRecoCommon.getHLTPrefix()
24 clustersKey = JetRecoCommon.getClustersKey(jetRecoDict)
25 jetDef_unsub = JetRecoCommon.defineHIJets(jetRecoDict,clustersKey=clustersKey,prefix=jetNamePrefix,suffix=
"_Unsubtracted")
26 jetDef_unsub._internalAtt[
'finalPJContainer'] =
"PseudoJet"+clustersKey
27 target_jetReco = f
"_for_{jetRecoDict['jetDefStr']}"
30 associationName =
"%s_DR8Assoc" % (clustersKey)
31 jetDef_seed0 = jetDef_unsub.clone()
32 jetDef_seed0.suffix = jetDef_unsub.suffix.replace(
"Unsubtracted",
"seed0"+target_jetReco)
33 jetDef_seed0.radius = 0.2
34 jetsFullName_seed0 = jetDef_seed0.fullname()
37 stdJetModifiers.update(
39 HLTHIJetAssoc = JetModifier(
"HIJetDRAssociationTool",
"HIJetDRAssociation", ContainerKey=clustersKey, DeltaR=0.8, AssociationName=associationName),
43 jetDef_seed0.modifiers=[
45 JetModifier(
"HIJetMaxOverMeanTool",
"HIJetMaxOverMean"+target_jetReco, JetContainer = jetsFullName_seed0),
46 JetModifier(
"HIJetDiscriminatorTool",
"HIJetDiscriminator", MaxOverMeanCut = 4, MinimumETMaxCut=3000),
52 if jetRecoDict[
"jetCalib"].endswith(
"IS")
and not flags.Input.isMC:
54 calib_seq +=
"_Insitu"
58 if jetRecoDict[
"ionopt"] ==
"ionp":
62 jetDef_seed1 = jetDef_unsub.clone()
63 jetDef_seed1.suffix = jetDef_seed0.suffix.replace(
"_seed0",
"_seed1")
64 jetDef_seed1.radius = 0.2
65 jetDef_seed1.modifiers=[
"HLTHIJetAssoc",
"HLTHIJetConstSub_iter0:iter0",
"HLTHIJetSeedCalib:{}___{}".format(calib_seq, JES_is_data),
"Filter:{}".format(SeedPtMin)]
68 RecoOutputPtMin = 20000
69 if jetRecoDict[
"ionopt"] ==
"ionp":
70 RecoOutputPtMin = 10000
71 jetDef_final = jetDef_unsub.clone()
72 jetDef_final.suffix = jetDef_unsub.suffix.replace(
"_Unsubtracted",
"")
73 jetDef_final.modifiers=[
"HLTHIJetConstSub_iter1:iter1",
"HLTHIJetJetConstMod_iter1",
"HLTHIJetCalib:{}___{}".format(calib_seq, JES_is_data),
"Sort",
"Filter:{}".format(RecoOutputPtMin)]
76 "unsub": (jetDef_unsub.fullname(), jetDef_unsub),
77 "seed0": (jetDef_seed0.fullname(), jetDef_seed0),
78 "seed1": (jetDef_seed1.fullname(), jetDef_seed1),
79 "final": (jetDef_final.fullname(), jetDef_final),
84 acc = ComponentAccumulator()
87 eventShapeMapToolKey=
"HLTHIEventShapeMapTool"
88 theMapTool=CompFactory.HIEventShapeMapTool(eventShapeMapToolKey)
91 EventShapeKey=
'HLTHIEventShapeWeighted'
92 ESAlg_W=CompFactory.HIEventShapeMaker(
"ESAlg_W")
93 ESAlg_W.OutputContainerKey=EventShapeKey
94 ESAlg_W.InputTowerKey=clustersKey
95 ESAlg_W.NaviTowerKey=towerKey
98 ESFiller=CompFactory.HIEventShapeFillerTool(
"WeightedFiller")
99 ESFiller.UseClusters=
True
102 TWTool=CompFactory.HITowerWeightTool()
103 TWTool.ApplyCorrection={
"ion":
True,
"ionp":
False}.
get(jetRecoDict[
"ionopt"])
104 TWTool.ConfigDir=
'HIJetCorrection/'
105 from HIJetRec.HIJetRecUtilsCA
import getHIClusterGeoWeightFile
106 TWTool.InputFile=getHIClusterGeoWeightFile(configFlags)
108 ESFiller.TowerWeightTool=TWTool
109 ESFiller.EventShapeMapTool=theMapTool
111 ESAlg_W.HIEventShapeFillerTool=ESFiller
112 acc.addEventAlgo(ESAlg_W)
114 return acc, EventShapeKey, theMapTool
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.
149 acc = ComponentAccumulator()
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
318 out_shape_name=shape_name
319 if 'suffix' in kwargs.keys() : out_shape_name+=
'_' + kwargs[
'suffix']
320 mod_shape_key=out_shape_name+
'_Modulate'
323 if 'modulator' in kwargs.keys() : mod_tool=kwargs[
'modulator']
325 log.info(
"In HLTAddIteration function, HIUEModulatorTool is created using HLTMakeModulatorTool with mod_shape_key = {}".format(mod_shape_key) )
328 if 'map_tool' in kwargs.keys() : map_tool=kwargs[
'map_tool']
330 map_tool=CompFactory.HIEventShapeMapTool()
332 if 'sub_tool' in kwargs.keys() : sub_tool=kwargs[
'sub_tool']
334 from HIJetRec.HIJetRecUtilsCA
import getHIClusterGeoWeightFile
335 weightInputFile=getHIClusterGeoWeightFile(configFlags)
337 HIJetClusterSubtractorTool=CompFactory.HIJetClusterSubtractorTool
339 sub_tool.UseSamplings=
False
341 if 'assoc_name' in kwargs.keys() : assoc_name=kwargs[
'assoc_name']
343 log.info(
"In HLTAddIteration function, HIJetDRAssociationTool is created with clustersKey= {}".format(clustersKey) )
344 assoc=CompFactory.HIJetDRAssociationTool(
"HIJetDRAssociation")
345 assoc.ContainerKey=clustersKey
347 assoc.AssociationName=
"%s_DR8Assoc" % (clustersKey)
348 assoc_name=assoc.AssociationName
350 HIEventShapeJetIteration=CompFactory.HIEventShapeJetIteration
353 iter_tool.InputEventShapeKey=shape_name
354 iter_tool.OutputEventShapeKey=out_shape_name
355 iter_tool.AssociationKey=assoc_name
356 iter_tool.CaloJetSeedContainerKey=seed_container
357 iter_tool.Subtractor=sub_tool
358 iter_tool.ModulationScheme=1
359 iter_tool.RemodulateUE=
True
360 iter_tool.Modulator=mod_tool
361 iter_tool.ShallowCopy=
False
362 iter_tool.ModulationEventShapeKey=mod_shape_key
363 iter_tool.EventShapeMapTool=map_tool