139def jetHIRecoSequenceCA(configFlags, clustersKey, towerKey, **jetRecoDict):
140 """This build the standard heavy ion style jet.
141
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.
144 Instead we
145 - construct a JetDefinition
146 - use lower-level function in JetRecConfig with this JetDefinition to get the necessary algs and build our sequence manually.
147
148 """
149 acc = ComponentAccumulator()
150
151 if jetRecoDict["ionopt"] == "noion":
152 raise ValueError("Jet reco for heavy ion called without a ion option!")
153
154 dataSource = "mc" if configFlags.Input.isMC else "data"
155
156 jetHIEvtShapeSequence, eventShapeKey, eventShapeMapTool = jetHIEventShapeSequenceCA(configFlags, clustersKey=clustersKey, towerKey=towerKey, **jetRecoDict)
157 acc.merge(jetHIEvtShapeSequence)
158
159 jetNamePrefix = JetRecoCommon.getHLTPrefix()
160 jetDef = JetRecoCommon.defineHIJets(jetRecoDict,clustersKey=clustersKey,prefix=jetNamePrefix,suffix="_Unsubtracted")
161 jetsFullName_Unsub = jetDef.fullname()
162
163
164 jet_collection_name = jetsFullName_Unsub.split(
'_')[1].
replace(
"Jets",
"")
165
166
167 pjgalg = CompFactory.PseudoJetAlgorithm(
168 "pjgalg_HI",
169 InputContainer = clustersKey,
170 OutputContainer = "PseudoJet"+clustersKey,
171 Label = "pjgHLTHI",
172 SkipNegativeEnergy = False,
173 TreatNegativeEnergyAsGhost=True
174 )
175 acc.addEventAlgo(pjgalg)
176 finalpjs = str(pjgalg.OutputContainer)
177
178
179 jetDef._internalAtt['finalPJContainer'] = finalpjs
180
181
182 from JetRec import JetOnlineMon
184
185
186 jetRecAlg = getHIJetRecAlg(jetDef, jetsFullName_Unsub, monTool=monTool)
187 acc.addEventAlgo(jetRecAlg)
188
189 associationName = "%s_DR8Assoc" % (clustersKey)
190
191 jetsInUnsub = jetsFullName_Unsub
192
193 JES_is_data=False
194 calib_seq='EtaJES'
195 if jetRecoDict["jetCalib"].endswith("IS") and (dataSource=="data"):
196 JES_is_data=True
197 calib_seq += "_Insitu"
198
199 target_jetReco = f'_for_{jetRecoDict["jetDefStr"]}'
200
201 SeedPtMin = 25000
202 vnharmonics = [2, 3, 4]
203 if jetRecoDict["ionopt"] == "ionp":
204 SeedPtMin = 8000
205 vnharmonics = []
206
207
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),
216 "Filter:5000"
217 ]
218
219 copySeed0Alg = getJetCopyAlg(jetsin=jetsInUnsub,jetsoutdef=jetDef_seed0,decorations=[],shallowcopy=False,shallowIO=False,monTool=monTool)
220 acc.addEventAlgo(copySeed0Alg)
221
222
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
227
228 HLTMakeSubtractionTool(configFlags, iter0.OutputEventShapeKey, Modulator=modulator0, EventShapeMapTool=eventShapeMapTool, Subtractor=subtractor0, label="HLTHIJetConstSub_iter0"+target_jetReco)
229
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))
233
234 GetConstituentsModifierToolHLT(configFlags, name="HIJetConstituentModifierTool", ClusterKey=cluster_key_iter0_deep, ApplyOriginCorrection=False, label="HLTHIJetJetConstMod_iter0"+target_jetReco)
235
236
237
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)
245
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
250
251 HLTMakeSubtractionTool(configFlags, iter1.OutputEventShapeKey, Modulator=modulator1, EventShapeMapTool=eventShapeMapTool, label="HLTHIJetConstSub_iter1"+target_jetReco)
252
253 acc.addEventAlgo(HLTRunTools([iter1], "jetalgHI_clusterSub_egamma"+target_jetReco))
254
255
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))
259
260 GetConstituentsModifierToolHLT(configFlags, name="HIJetConstituentModifierTool", ClusterKey=cluster_key_final_deep, ApplyOriginCorrection=False, label="HLTHIJetJetConstMod_iter1"+target_jetReco)
261
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)
270
271 jetsFinal = recordable(jetDef_final.fullname())
272
273 jetsOut = jetsFinal
274
275 return acc, jetsOut, jetDef_final
276
std::string replace(std::string s, const std::string &s2, const std::string &s3)
getMonTool_TrigJetAlgorithm(flags, path)