ATLAS Offline Software
Loading...
Searching...
No Matches
JetHIConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
5from JetRecConfig import JetRecConfig
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8
9from TrigEDMConfig.TriggerEDM import recordable
10
11from . import JetRecoCommon
12from JetRecConfig.JetDefinition import JetModifier
13from JetRecConfig.JetRecConfig import getJetCopyAlg
14
15from AthenaCommon.Logging import logging
16logging.getLogger().info("JetHIConfig LOG: Importing %s",__name__)
17log = logging.getLogger(__name__)
18
19
20# For now all duplicated from jetHIRecoSequenceCA -- to be cleaned up by experts
21def HeavyIonJetRecoDataDeps(flags, **jetRecoDict):
22 # The template unsubtracted jet definition
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']}"
28
29 # Seed jets for subtraction
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()
35
36 # Add this to the standard modifiers as we use this repeatedly
37 stdJetModifiers.update(
38 # we give a function as PtMin : it will be evaluated when instantiating the tool (modspec will come alias usage like "Filter:10000" --> PtMin=100000)
39 HLTHIJetAssoc = JetModifier("HIJetDRAssociationTool","HIJetDRAssociation", ContainerKey=clustersKey, DeltaR=0.8, AssociationName=associationName),
40 )
41
42 # These mods are custom and used only here
43 jetDef_seed0.modifiers=[
44 "HLTHIJetAssoc",
45 JetModifier("HIJetMaxOverMeanTool","HIJetMaxOverMean"+target_jetReco, JetContainer = jetsFullName_seed0),
46 JetModifier("HIJetDiscriminatorTool","HIJetDiscriminator", MaxOverMeanCut = 4, MinimumETMaxCut=3000),
47 "Filter:5000"
48 ]
49
50 JES_is_data=False
51 calib_seq='EtaJES' #only do in situ for R=0.4 jets in data
52 if jetRecoDict["jetCalib"].endswith("IS") and not flags.Input.isMC:
53 JES_is_data=True
54 calib_seq += "_Insitu"
55
56 # Second seed
57 SeedPtMin = 25000
58 if jetRecoDict["ionopt"] == "ionp":
59 SeedPtMin = 8000
60
61 # Copy default jets: seed1
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)]
66
67 # Final subracted jets
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)]
74
75 jetDefDict = {
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),
80 }
81 return jetDefDict
82
83def jetHIEventShapeSequenceCA(configFlags, clustersKey, towerKey,**jetRecoDict):
84 acc = ComponentAccumulator()
85
86 #Import the map tool - it will have to harvest configuration along the path
87 eventShapeMapToolKey="HLTHIEventShapeMapTool"
88 theMapTool=CompFactory.HIEventShapeMapTool(eventShapeMapToolKey)
89
90 #Make new event shape at tower level
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
96
97 #Add filler tool
98 ESFiller=CompFactory.HIEventShapeFillerTool("WeightedFiller")
99 ESFiller.UseClusters=True
100
101 #Add weight tool to filler tool
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)
107
108 ESFiller.TowerWeightTool=TWTool
109 ESFiller.EventShapeMapTool=theMapTool
110 #Add to top sequence
111 ESAlg_W.HIEventShapeFillerTool=ESFiller
112 acc.addEventAlgo(ESAlg_W)
113
114 return acc, EventShapeKey, theMapTool
115
116
117# JetModifier dictionary
118from JetRecConfig.StandardJetMods import stdJetModifiers
119stdJetModifiers.update(
120 HLTHIJetCalib = JetModifier("JetCalibrationTool",
121 "HLTHICalibTool_{modspec}",
122 JetCollection=lambda _, modspec: modspec.split('___')[2] if len(modspec.split('___')) > 2 else "AntiKt4HI",
123 PrimaryVerticesContainerName="",
124 ConfigFile='JES_MC16_HI_Jan2021_5TeV.config',
125 CalibSequence=lambda _, modspec: modspec.split('___')[0],
126 IsData=lambda _, modspec: modspec.split('___')[1] == 'True'),
127 )
128
129stdJetModifiers.update(
130 HLTHIJetSeedCalib = JetModifier("JetCalibrationTool",
131 "HLTHISeedCalibTool_{modspec}",
132 JetCollection="AntiKt2HI",
133 PrimaryVerticesContainerName="",
134 ConfigFile='JES_MC16_HI_Jan2021_5TeV.config',
135 CalibSequence=lambda _, modspec: modspec.split('___')[0],
136 IsData=lambda _, modspec: modspec.split('___')[1] == 'True'),
137 )
138
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 #This is used for calibration and monitoring
164 jet_collection_name = jetsFullName_Unsub.split('_')[1].replace("Jets", "")
165
166 # Add the PseudoJetGetter alg to the sequence
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 # Set the name of the final PseudoJetContainer to be used as input :
179 jetDef._internalAtt['finalPJContainer'] = finalpjs
180
181
182 from JetRec import JetOnlineMon
183 monTool = JetOnlineMon.getMonTool_TrigJetAlgorithm(configFlags, "HLTJets/" + jet_collection_name + "/")
184
185 # Reconstruction
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' #only do in situ jets in data
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 # Copy unsubtracted jets: seed0
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 # First iteration!
223 iter0=HLTAddIteration(configFlags, jetsFullName_seed0, eventShapeKey, clustersKey, map_tool=eventShapeMapTool, assoc_name=associationName, suffix="iter0"+target_jetReco, harmonics = vnharmonics) # subtract UE from jets
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 # Copy default jets: seed1
237 # Second seed
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
277def HLTRunTools(toollist, algoName):
278
279 theAlg = CompFactory.JetAlgorithm(algoName)
280 theAlg.Tools = toollist
281
282 return theAlg
283
284def getHIJetRecAlg( jetdef, jetsName, monTool = None):
285 """Returns the configured HIJetRecAlg instance corresponding to jetdef
286
287 IMPORTANT : jetdef must have its dependencies solved (i.e. it must result from solveDependencies() )
288 """
289 pjContNames = jetdef._internalAtt['finalPJContainer']
290 jclust = CompFactory.JetClusterer(
291 "builder",
292 JetAlgorithm = jetdef.algorithm,
293 JetRadius = jetdef.radius,
294 PtMin = jetdef.ptmin,
295 InputPseudoJets = pjContNames,
296 GhostArea = 0.0,
297 JetInputType = int(jetdef.inputdef.jetinputtype),
298 RandomOption = 1,
299 )
300
301 mods = JetRecConfig.getJetModifierTools(jetdef)
302
303 jetname = jetsName
304 jra = CompFactory.JetRecAlg(
305 "jetrecalg_"+jetname,
306 Provider = jclust,
307 Modifiers = mods,
308 OutputContainer = jetname,
309 )
310 if monTool:
311 # this option can't be set in AnalysisBase -> set only if explicitly asked :
312 jra.MonTool = monTool
313
314 return jra
315
316# Same as AddIteration in Reconstruction/HeavyIonRec/HIJetRec/HIJetRecUtils.py but without jtm
317def HLTAddIteration(configFlags, seed_container,shape_name,clustersKey, **kwargs) :
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'
321 remodulate=True
322 if remodulate :
323 if 'modulator' in kwargs.keys() : mod_tool=kwargs['modulator']
324 else :
325 log.info( "In HLTAddIteration function, HIUEModulatorTool is created using HLTMakeModulatorTool with mod_shape_key = {}".format(mod_shape_key) )
326 mod_tool=HLTMakeModulatorTool(mod_shape_key,**kwargs)
327
328 if 'map_tool' in kwargs.keys() : map_tool=kwargs['map_tool']
329 else :
330 map_tool=CompFactory.HIEventShapeMapTool()
331
332 if 'sub_tool' in kwargs.keys() : sub_tool=kwargs['sub_tool']
333 else :
334 from HIJetRec.HIJetRecUtilsCA import getHIClusterGeoWeightFile
335 weightInputFile=getHIClusterGeoWeightFile(configFlags)
336
337 HIJetClusterSubtractorTool=CompFactory.HIJetClusterSubtractorTool
338 sub_tool=HIJetClusterSubtractorTool("HLTHIJetClusterSubtractor", ConfigDir='HIJetCorrection/', InputFile=weightInputFile)
339 sub_tool.UseSamplings=False
340
341 if 'assoc_name' in kwargs.keys() : assoc_name=kwargs['assoc_name']
342 else :
343 log.info( "In HLTAddIteration function, HIJetDRAssociationTool is created with clustersKey= {}".format(clustersKey) )
344 assoc=CompFactory.HIJetDRAssociationTool("HIJetDRAssociation")
345 assoc.ContainerKey=clustersKey
346 assoc.DeltaR=0.8
347 assoc.AssociationName="%s_DR8Assoc" % (clustersKey)
348 assoc_name=assoc.AssociationName
349
350 HIEventShapeJetIteration=CompFactory.HIEventShapeJetIteration
351 iter_tool=HIEventShapeJetIteration('HLTHIJetIteration_%s' % out_shape_name )
352
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
364
365 return iter_tool
366
367def HLTBuildHarmonicName(shape_key, **kwargs) :
368 tname=shape_key
369 if 'harmonics' in kwargs.keys() :
370 for n in kwargs['harmonics'] :
371 tname = str(tname) + str('_V%d' % n)
372 return tname
373
375 tname='NullUEModulator'
376 HIUEModulatorTool=CompFactory.HIUEModulatorTool
377 mod=HIUEModulatorTool(tname)
378 mod.EventShapeKey=''
379 for n in [2,3,4] : setattr(mod,'DoV%d' % n,False)
380 return mod
381
382def HLTMakeModulatorTool(mod_key, **kwargs):
383 harmonics = kwargs.pop('harmonics', [2, 3, 4])
384 tname = kwargs.pop('mod_name', 'Modulator_{}'.format(HLTBuildHarmonicName(mod_key, harmonics=harmonics)))
385
386 if 'suffix' in kwargs.keys():
387 tname += '_' + kwargs['suffix']
388
389 if len(harmonics) == 0:
390 return HLTGetNullModulator()
391
392 HIUEModulatorTool=CompFactory.HIUEModulatorTool
393 mod=HIUEModulatorTool(tname)
394 mod.EventShapeKey=mod_key
395
396 for n in [2,3,4] :
397 val=(n in harmonics)
398 attr_name='DoV%d' % n
399 setattr(mod,attr_name,val)
400
401 if 'label' in kwargs.keys():
402 label = kwargs['label']
403 stdJetModifiers[label] = JetModifier(
404 "HIUEModulatorTool",
405 tname,
406 DoV2 = mod.DoV2,
407 DoV3 = mod.DoV3,
408 DoV4 = mod.DoV4,
409 EventShapeKey=mod_key)
410
411 return mod
412
414 from HIJetRec.HIJetRecUtilsCA import getHIClusterGeoWeightFile
415 weightInputFile=getHIClusterGeoWeightFile(configFlags)
416
417 HIJetClusterSubtractorTool = CompFactory.HIJetClusterSubtractorTool
418 sub_tool = HIJetClusterSubtractorTool("HLTHIJetClusterSubtractor", ConfigDir='HIJetCorrection/', InputFile=weightInputFile)
419 sub_tool.UseSamplings = False
420
421 return sub_tool
422
423#same as MakeSubtractionTool in Reconstruction/HeavyIonRec/HIJetRec/HIJetRecUtils.py but without jtm
424def HLTMakeSubtractionTool(configFlags, shapeKey, moment_name='', momentOnly=False, **kwargs) :
425
426 alg_props = {
427 'EventShapeKey': shapeKey,
428 'Modulator': HLTGetNullModulator(),
429 'EventShapeMapTool': CompFactory.HIEventShapeMapTool(),
430 'Subtractor': HLTHIJetClusterSubtractorGetter(configFlags),
431 'MomentName': 'HLTJetSubtractedScale{}Momentum'.format(moment_name),
432 'SetMomentOnly': momentOnly,
433 'ApplyOriginCorrection': True,
434 }
435
436 suffix = shapeKey.toStringProperty()
437 if momentOnly is True:
438 suffix += '_' + moment_name
439
440 alg_props.update(kwargs)
441
442 label = alg_props.pop('label', None)
443
444 HIJetConstituentSubtractionTool = CompFactory.HIJetConstituentSubtractionTool
445 subtr = HIJetConstituentSubtractionTool("HLTHICS_" + suffix, **alg_props)
446
447 stdJetModifiers[label] = JetModifier(
448 "HIJetConstituentSubtractionTool",
449 "HLTHICS_HLTHIEventShapeWeighted_{modspec}",
450 Modulator=subtr.Modulator,
451 EventShapeMapTool=subtr.EventShapeMapTool,
452 Subtractor=subtr.Subtractor,
453 EventShapeKey=subtr.EventShapeKey,
454 MomentName=subtr.MomentName,
455 SetMomentOnly=subtr.SetMomentOnly,
456 ApplyOriginCorrection=True)
457
458 return subtr
459
460def HLTHIClusterGetter(dummyFlags, tower_key="CombinedTower", cell_key="AllCalo", cluster_key="HLT_HIClusters") :
461 """Function to equip HLT HI cluster builder from towers and cells, adds to output AOD stream"""
462
463 HIClusterMaker=CompFactory.HIClusterMaker
464 theAlg=HIClusterMaker()
465 theAlg.InputTowerKey=tower_key
466 theAlg.CaloCellContainerKey=cell_key
467 theAlg.OutputContainerKey=cluster_key
468
469 return theAlg
470
471
472def ApplySubtractionToClustersHLT(configFlags, **kwargs) :
473
474 alg_props = {
475 'EventShapeKey': "HLTHIEventShape_iter1",
476 'ClusterKey': "HLT_HIClusters",
477 'Modulator': HLTGetNullModulator(),
478 'EventShapeMapTool': CompFactory.HIEventShapeMapTool(),
479 'UpdateOnly': False,
480 'ApplyOriginCorrection': True,
481 'Subtractor': HLTHIJetClusterSubtractorGetter(configFlags),
482 'SetMoments': False,
483 }
484
485 alg_props.update(kwargs)
486
487 toolName = alg_props.pop('toolName', 'HIClusterSubtraction')
488
489 HIClusterSubtraction = CompFactory.HIClusterSubtraction
490 theAlg = HIClusterSubtraction(toolName, **alg_props)
491
492 return theAlg
493
494def GetConstituentsModifierToolHLT(configFlags, **kwargs) :
495 #For the cluster key, same exact logic as used for ApplySubtractionToClusters
496
497 alg_props = {
498 'ClusterKey': "HLT_HIClusters",
499 'ApplyOriginCorrection': True,
500 'Subtractor': HLTHIJetClusterSubtractorGetter(configFlags),
501 }
502
503 alg_props.update(kwargs)
504
505 toolName = alg_props.pop('name', 'HIJetConstituentModifierTool')
506 label = alg_props.pop('label', None)
507
508 HIJetConstituentModifierTool = CompFactory.HIJetConstituentModifierTool
509 cmod = HIJetConstituentModifierTool(toolName, **alg_props)
510
511 stdJetModifiers[label] = JetModifier(
512 "HIJetConstituentModifierTool",
513 "HLTHIJetConstituentModifierTool_{modspec}",
514 ClusterKey=cmod.ClusterKey,
515 Subtractor=cmod.Subtractor,
516 ApplyOriginCorrection=cmod.ApplyOriginCorrection)
517
518 return cmod
Algorithm to build HI-style clusters, which are essentially towers. Cluster energy is sum of cell ene...
Algorithm that applies background subtraction to clusters. The subtraction needs to be handled separa...
Concrete implementation of HIJetSubtractorToolBase. Class used by HIClusterSubtraction and HIJetConst...
JetModifier that actual does the background subtraction. This tool is the most important one applied ...
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
getMonTool_TrigJetAlgorithm(flags, path)
jetHIRecoSequenceCA(configFlags, clustersKey, towerKey, **jetRecoDict)
getHIJetRecAlg(jetdef, jetsName, monTool=None)
ApplySubtractionToClustersHLT(configFlags, **kwargs)
HeavyIonJetRecoDataDeps(flags, **jetRecoDict)
jetHIEventShapeSequenceCA(configFlags, clustersKey, towerKey, **jetRecoDict)
GetConstituentsModifierToolHLT(configFlags, **kwargs)
HLTHIClusterGetter(dummyFlags, tower_key="CombinedTower", cell_key="AllCalo", cluster_key="HLT_HIClusters")
HLTAddIteration(configFlags, seed_container, shape_name, clustersKey, **kwargs)
HLTMakeModulatorTool(mod_key, **kwargs)
HLTBuildHarmonicName(shape_key, **kwargs)
HLTHIJetClusterSubtractorGetter(configFlags)
HLTMakeSubtractionTool(configFlags, shapeKey, moment_name='', momentOnly=False, **kwargs)
HLTRunTools(toollist, algoName)