ATLAS Offline Software
Loading...
Searching...
No Matches
python.HLT.Jet.JetRecoCommon Namespace Reference

Functions

 jetChainParts (chainParts)
 — Extracting jet chain parts —
 jetRecoDictToString (jetRecoDict)
 — General reco dict handling —
 extractRecoDict (chainParts)
 jetRecoDictFromString (jet_def_string)
 cloneAndUpdateJetRecoDict (jetRecoDict, **kwargs)
 jetDefToString (jetDef)
 — Interpreting JetDefinition
 jetCalibFromJetDef (jetDef)
 interpretRecoAlg (recoAlg)
 — General helpers —
 jetDefNeedsTracks (jetRecoDict)
 doTracking (jetRecoDict)
 doFSTracking (jetRecoDict)
 isPFlow (jetRecoDict)
 getFilterCut (recoAlg)
 addJetContextFlags (flags)
 getHLTPrefix ()
 — String getters —
 getClustersKey (recoDict)
 getJetCalibDefaultString (recoAlg, constitType, trkopt)
 getPrefilterCleaningString (prefilters_list)
 getCalibMods (flags, jetRecoDict, rhoKey="auto")
 — Modifier and decoration list getters —
 getModSpec (modname, modspec='')
 getDecorList (jetDef)
 defineJetConstit (jetRecoDict, clustersKey=None, pfoPrefix=None)
 Jet Object getters —
 defineJets (flags, jetRecoDict, clustersKey=None, prefix='', suffix='', pfoPrefix=None)
 defineReclusteredJets (jetRecoDict, smallRjets, inputlabel, prefix, suffix)
 defineGroomedJets (jetRecoDict, ungroomedDef)
 defineVRTrackJets (Rmax, Rmin, VRMassScale, Ptmin, prefix, suffix)
 defineHIJets (jetRecoDict, clustersKey=None, prefix='', suffix='')

Variables

 log = logging.getLogger(__name__)
dict etaRangeAbbrev
 Common jet eta ranges —
dict cleaningDict

Function Documentation

◆ addJetContextFlags()

addJetContextFlags ( flags)

Definition at line 194 of file JetRecoCommon.py.

194def addJetContextFlags(flags):
195
196 flags.addFlag("Jet.Context.notrk", lambda prevFlags : prevFlags.Jet.Context.default )
197
198
199 def _buildContextDic(prevFlags, trkopt):
200 # *****************
201 idFlags = prevFlags.Trigger.InDetTracking
202 (tracksname,verticesname) = {
203 'ftf': (idFlags.fullScan.tracks_FTF,
204 idFlags.fullScan.vertex),
205 'roiftf': (idFlags.jetSuper.tracks_FTF,
206 idFlags.jetSuper.vertex),
207 }[trkopt]
208
209 tvaname = f"JetTrackVtxAssoc_{trkopt}"
210 label = f"GhostTrack_{trkopt}"
211 ghosttracksname = f"PseudoJet{label}"
212
213 contextDic = prevFlags.Jet.Context.default.clone(
214 Tracks = tracksname,
215 Vertices = verticesname,
216 TVA = tvaname,
217 GhostTracks = ghosttracksname,
218 GhostTracksLabel = label ,
219 JetTracks = f'JetSelectedTracks_{trkopt}',
220 )
221 # also declare some JetInputExternal corresponding to trkopt
222 # This ensures the JetRecConfig helpers know about them.
223 # We declare simplistic JetInputExternal, without algoBuilder, because the rest of the trigger config is in charge of producing these containers.
224 from JetRecConfig.StandardJetConstits import stdInputExtDic
225 if tracksname not in stdInputExtDic:
226 from JetRecConfig.JetDefinition import JetInputExternal
227 from xAODBase.xAODType import xAODType
228 stdInputExtDic[tracksname] = JetInputExternal( tracksname, xAODType.TrackParticle )
229 stdInputExtDic[verticesname] = JetInputExternal( verticesname, xAODType.Vertex )
230
231
232 return contextDic
233
234
235
236 flags.addFlag("Jet.Context.ftf", lambda prevFlags : _buildContextDic(prevFlags,"ftf") )
237 flags.addFlag("Jet.Context.roiftf", lambda prevFlags : _buildContextDic(prevFlags,"roiftf") )
238
239
240
241

◆ cloneAndUpdateJetRecoDict()

cloneAndUpdateJetRecoDict ( jetRecoDict,
** kwargs )

Definition at line 105 of file JetRecoCommon.py.

105def cloneAndUpdateJetRecoDict(jetRecoDict,**kwargs):
106 newJetRecoDict = copy.copy(jetRecoDict)
107 newJetRecoDict.update(dict(**kwargs))
108 newJetRecoDict["jetDefStr"] = jetRecoDictToString(newJetRecoDict)
109 return newJetRecoDict
110

◆ defineGroomedJets()

defineGroomedJets ( jetRecoDict,
ungroomedDef )

Definition at line 497 of file JetRecoCommon.py.

497def defineGroomedJets(jetRecoDict,ungroomedDef):#,ungroomedJetsName):
498 from JetRecConfig.JetGrooming import JetTrimming, JetSoftDrop
499 groomAlg = jetRecoDict["recoAlg"][3:] if 'sd' in jetRecoDict["recoAlg"] else jetRecoDict["recoAlg"][-1]
500 suffix = "_"+ jetRecoDict["jetCalib"]
501 if jetDefNeedsTracks(jetRecoDict):
502 suffix += "_"+jetRecoDict["trkopt"]
503
504 groomDef = {
505 "sd":JetSoftDrop(ungroomedDef,ZCut=0.1,Beta=1.0,suffix=suffix,context=jetRecoDict['trkopt']),
506 "t" :JetTrimming(ungroomedDef,RClus=0.2,PtFrac=0.04,suffix=suffix,context=jetRecoDict['trkopt']),
507 }[groomAlg]
508 return groomDef
509
510#Jet Definition for VR track jets

◆ defineHIJets()

defineHIJets ( jetRecoDict,
clustersKey = None,
prefix = '',
suffix = '' )

Definition at line 517 of file JetRecoCommon.py.

517def defineHIJets(jetRecoDict,clustersKey=None,prefix='',suffix=''):
518 minpt = {2:7000, 3:7000, 4:7000, 6:7000, 10:50000}
519 jetalg, jetradius, jetextra = interpretRecoAlg(jetRecoDict["recoAlg"])
520 actualradius = float(jetradius)/10
521 context = "hip" if jetRecoDict["ionopt"] == "ionp" else "hi"
522 constitMods = [] # modifiers
523 jetConstit = []
524 jetConstit = JetInputConstitSeq( "HLT_HIConstit",xAODType.CaloCluster, constitMods, inputname=clustersKey, outputname=clustersKey,label='HI')
525 from JetRecConfig.StandardJetConstits import stdConstitDic
526 stdConstitDic.setdefault(jetConstit.name, jetConstit)
527
528 jetDef = JetDefinition( "AntiKt", actualradius, jetConstit, ptmin=minpt[jetradius], prefix=prefix, suffix=suffix, context = context)
529 return jetDef

◆ defineJetConstit()

defineJetConstit ( jetRecoDict,
clustersKey = None,
pfoPrefix = None )

Jet Object getters —

Definition at line 404 of file JetRecoCommon.py.

404def defineJetConstit(jetRecoDict,clustersKey=None,pfoPrefix=None):
405 constitMods = []
406 # Get the details of the constituent definition:
407 # type, mods and the input container name
408
409 if jetRecoDict["constitType"] == "pf":
410 if pfoPrefix is None:
411 raise RuntimeError("JetRecoCommon: Cannot define PF jets without pfo prefix!")
412
413 constitMods = ["CorrectPFO"]
414 # apply constituent pileup suppression
415 if "vs" in jetRecoDict["constitMod"]:
416 constitMods.append("Vor")
417 if "cs" in jetRecoDict["constitMod"]:
418 constitMods.append("CS")
419 if "sk" in jetRecoDict["constitMod"]:
420 constitMods.append("SK")
421 constitMods += ["CHS"]
422
423 inputPFO = pfoPrefix+"ParticleFlowObjects"
424 modstring = ''.join(constitMods[1:-1])
425 if modstring == '':
426 modstring='CHS'
427
428 inputxAODType = xAODType.FlowElement
429 if not constitMods:
430 jetConstit = JetInputConstitSeq( "HLT_EMPFlow", inputxAODType, constitMods, inputname=inputPFO, outputname=pfoPrefix+"CHSParticleFlowObjects", label="EMPFlow", jetinputtype="EMPFlow")
431 else:
432 jetConstit = JetInputConstitSeq( "HLT_EMPFlow"+modstring, inputxAODType, constitMods, inputname=inputPFO, outputname=pfoPrefix+modstring+"ParticleFlowObjects",label='EMPFlow'+(modstring if modstring!='CHS' else ''), jetinputtype="EMPFlow" )
433
434
435 if jetRecoDict["constitType"] == "tc":
436 # apply constituent pileup suppression
437 if "vs" in jetRecoDict["constitMod"]:
438 constitMods.append("Vor")
439 if "cs" in jetRecoDict["constitMod"]:
440 constitMods.append("CS")
441 if "sk" in jetRecoDict["constitMod"]:
442 constitMods.append("SK")
443 # build a modifier identifier :
444 modstring = ''.join(constitMods)
445 # prepend the cluster calib state :
446 if jetRecoDict["clusterCalib"] == "em":
447 constitMods = ["EM"] + constitMods
448 elif jetRecoDict["clusterCalib"] == "lcw":
449 constitMods = ["LC"] + constitMods
450 else:
451 log.error("cluster calib state not recognised : %s",jetRecoDict["clusterCalib"])
452 if not clustersKey:
453 raise ValueError("cluster key must be provided for topocluster jets.")
454
455
456 if not constitMods:
457 jetConstit = JetInputConstitSeq( "HLT_EMTopo",xAODType.CaloCluster, constitMods, inputname=clustersKey, outputname=clustersKey+modstring,label='EMTopo'+modstring)
458 else:
459 jetConstit = JetInputConstitSeq( "HLT_"+constitMods[0]+"Topo",xAODType.CaloCluster, constitMods, inputname=clustersKey, outputname=clustersKey+modstring,label=constitMods[0]+'Topo'+modstring)
460
461 # declare our new JetInputConstitSeq in the standard dictionary
462 from JetRecConfig.StandardJetConstits import stdConstitDic
463 stdConstitDic.setdefault(jetConstit.name, jetConstit)
464
465 return jetConstit
466
467
468# Arbitrary min pt for fastjet, set to be low enough for MHT(?)
469# Could/should adjust higher for large-R

◆ defineJets()

defineJets ( flags,
jetRecoDict,
clustersKey = None,
prefix = '',
suffix = '',
pfoPrefix = None )

Definition at line 470 of file JetRecoCommon.py.

470def defineJets(flags,jetRecoDict,clustersKey=None,prefix='',suffix='',pfoPrefix=None):
471 minpt = {
472 "default": {
473 4: 7000,
474 10: 50000 },
475 "lowpt": { # used for HI UPC jet reco, ATR-28158
476 4: 4000,
477 10: 50000 }
478 }
479
480 filter_type = "lowpt" if flags.Trigger.Jet.LowPtFilter else "default"
481 jetalg, jetradius, jetextra = interpretRecoAlg(jetRecoDict["recoAlg"])
482 actualradius = float(jetradius)/10
483 jetConstit = defineJetConstit(jetRecoDict,clustersKey,pfoPrefix)
484
485 suffix="_"+jetRecoDict["jetCalib"]+'_'*(suffix.strip()!='')+suffix
486 if jetDefNeedsTracks(jetRecoDict):
487 suffix += "_"+jetRecoDict["trkopt"]
488
489 jetDef = JetDefinition( "AntiKt", actualradius, jetConstit, ptmin=minpt[filter_type][jetradius], prefix=prefix, suffix=suffix, context=jetRecoDict["trkopt"])
490 return jetDef
491

◆ defineReclusteredJets()

defineReclusteredJets ( jetRecoDict,
smallRjets,
inputlabel,
prefix,
suffix )

Definition at line 492 of file JetRecoCommon.py.

492def defineReclusteredJets(jetRecoDict,smallRjets,inputlabel,prefix,suffix):
493 rcJetConstit = JetInputConstit("RCJet", xAODType.Jet, smallRjets, label=inputlabel+'RC', lock=True)
494 rcJetDef = JetDefinition( "AntiKt", 1.0, rcJetConstit, prefix=prefix, suffix=suffix, context=jetRecoDict['trkopt'])
495 return rcJetDef
496

◆ defineVRTrackJets()

defineVRTrackJets ( Rmax,
Rmin,
VRMassScale,
Ptmin,
prefix,
suffix )

Definition at line 511 of file JetRecoCommon.py.

511def defineVRTrackJets(Rmax, Rmin, VRMassScale, Ptmin, prefix, suffix):
512 jetconstit = JetInputConstit("PV0Track", xAODType.TrackParticle, "PV0JetSelectedTracks_ftf")
513 VRTrackJetDef = JetDefinition("AntiKt", Rmax, jetconstit, ptmin=Ptmin, VRMinR=Rmin, VRMassSc=VRMassScale, prefix=prefix, suffix=suffix, lock=True)
514 return VRTrackJetDef
515
516

◆ doFSTracking()

doFSTracking ( jetRecoDict)

Definition at line 180 of file JetRecoCommon.py.

180def doFSTracking(jetRecoDict):
181 return jetRecoDict["trkopt"]=="ftf"
182
183# Check if constituent type is pflow. Concurrently check that the tracking option is valid.

◆ doTracking()

doTracking ( jetRecoDict)

Definition at line 177 of file JetRecoCommon.py.

177def doTracking(jetRecoDict):
178 return jetRecoDict["trkopt"]!="notrk"
179# Check if full scan track reconstruction is enabled

◆ extractRecoDict()

extractRecoDict ( chainParts)

Definition at line 56 of file JetRecoCommon.py.

56def extractRecoDict(chainParts):
57 # interpret the reco configuration only
58 # eventually should just be a subdict in the chainDict
59 recoDict = {}
60 for p in chainParts:
61 for k in recoKeys:
62 # Look for our key in the chain part
63 if k in p:
64 # found the key, check for consistency with other chain parts of this chain
65 if k in recoDict and p[k] != recoDict[k]:
66 raise RuntimeError('Inconsistent reco setting for %s' % k)
67 # copy this entry to the reco dictionary
68 recoDict[k] = p[k]
69
70 # set proper jetCalib key in default case
71 if recoDict['jetCalib'] == "default":
72 recoDict['jetCalib'] = getJetCalibDefaultString(recoDict['recoAlg'],recoDict['constitType'],recoDict['trkopt'])
73
74 recoDict['jetDefStr'] = jetRecoDictToString(recoDict)
75
76 return recoDict
77
78# Inverse of the above, essentially only for CF tests

◆ getCalibMods()

getCalibMods ( flags,
jetRecoDict,
rhoKey = "auto" )

— Modifier and decoration list getters —

Definition at line 298 of file JetRecoCommon.py.

298def getCalibMods(flags,jetRecoDict,rhoKey="auto"):
299
300 # Minimum modifier set for calibration w/o track GSC
301 # Should eventually build in more mods, depend on track info etc
302 jetalg = jetRecoDict["recoAlg"]
303 if jetRecoDict["jetCalib"] == "nojcalib" or jetalg=="a10r":
304 calibMods = []
305 else:
306 dotracking = doTracking(jetRecoDict)
307 if not dotracking and "gsc" in jetRecoDict["jetCalib"]:
308 raise ValueError("Track GSC requested but no track source provided!")
309
310 if not dotracking and "subres" in jetRecoDict["jetCalib"]:
311 raise ValueError("Pileup residual calibration requested but no track source provided!")
312
313 if jetRecoDict["constitType"] == "tc":
314 calibKey = flags.Trigger.Jet.emtopoCalibKey
315 calibContext,calibSeq = {
316 ("a4","subjes"): (calibKey,"JetArea_EtaJES_GSC"), # Calo GSC only ( + insitu in data)
317 ("a4","subjesIS"): (calibKey,"JetArea_EtaJES_GSC"), # Calo GSC only (no insitu)
318 ("a4","subjesgscIS"): (calibKey,"JetArea_EtaJES_GSC"), # Calo+Trk GSC ( + insitu in data)
319 ("a4","subresjesgscIS"): (calibKey,"JetArea_Residual_EtaJES_GSC"), # pu residual + calo+trk GSC ( + insitu in data)
320 ("a4","subjesgsc"): (calibKey,"JetArea_EtaJES_GSC"), # Calo+Trk GSC (no insitu)
321 ("a4","subresjesgsc"): (calibKey,"JetArea_Residual_EtaJES_GSC"), # pu residual + calo+trk GSC (no insitu)
322 ("a10","subjes"): ("TrigUngroomed","JetArea_EtaJES"),
323 ("a10t","jes"): ("TrigTrimmed","EtaJES_JMS"),
324 }[(jetRecoDict["recoAlg"],jetRecoDict["jetCalib"])]
325
326 pvname = ""
327 gscDepth = "EM3"
328 if "gsc" in jetRecoDict["jetCalib"]:
329 gscDepth = "trackWIDTH"
330 pvname = flags.Trigger.InDetTracking.fullScan.vertex_jet
331
332 elif jetRecoDict["constitType"] == "pf":
333 gscDepth = "auto"
334 if 'sd' in jetRecoDict["recoAlg"]:
335 calibContext = flags.Trigger.Jet.pflowLJCalibKey # large-R pflow
336 calibSeq = "EtaJES_JMS"
337 else:
338 calibKey = flags.Trigger.Jet.pflowCalibKey # small-R pflow
339 gscDepth = "trackWIDTH"
340 if "gsc" not in jetRecoDict["jetCalib"]:
341 gscDepth = "EM3" # calo-only GSC
342 calibContext,calibSeq = {
343 ("a4","jes"): (calibKey,"EtaJES_GSC"), # w/o jet area sub, w/o pu residual + calo GSC only (no insitu)
344 ("a4","subjesgsc"): (calibKey,"JetArea_EtaJES_GSC"), # w/o pu residual + calo+trk GSC
345 ("a4","subresjesgsc"): (calibKey,"JetArea_Residual_EtaJES_GSC"), # pu residual + calo+trk GSC
346 ("a4","subjesgscIS"): (calibKey,"JetArea_EtaJES_GSC"), # w/o pu residual + calo+trk GSC
347 ("a4","subresjesgscIS"): (calibKey,"JetArea_Residual_EtaJES_GSC"), # pu residual + calo+trk GSC
348 }[(jetRecoDict["recoAlg"],jetRecoDict["jetCalib"])]
349 pvname = flags.Trigger.InDetTracking.fullScan.vertex_jet
350 if jetRecoDict["jetCalib"].endswith("IS") and (not flags.Input.isMC):
351 calibSeq += "_Insitu"
352
353 dataSource = "mc" if flags.Input.isMC else "data"
354 calibSpec = ":".join( [calibContext, dataSource, calibSeq, rhoKey, pvname, gscDepth] )
355
356 if jetalg=="a4":
357 calibMods = ["EMScaleMom",
358 "ConstitFourMom_copy",
359 "CaloEnergies", # Needed for GSC
360 "Calib:"+calibSpec]
361 else:
362 calibMods = ["ConstitFourMom_copy",
363 "Calib:"+calibSpec]
364
365 return calibMods
366
367# Make generating the list a bit more comprehensible
368# TODO document where and how this is used.

◆ getClustersKey()

getClustersKey ( recoDict)

Definition at line 249 of file JetRecoCommon.py.

249def getClustersKey(recoDict):
250 if recoDict['ionopt'] in ['ion', 'ionp']:
251 return "HLT_HICaloClustersFS"
252 clusterCalib = recoDict["clusterCalib"]
253 if clusterCalib == "em":
254 from ..CommonSequences.FullScanDefs import em_clusters
255 return em_clusters
256 elif clusterCalib == "lcw":
257 from ..CommonSequences.FullScanDefs import lc_clusters
258 return lc_clusters
259 else:
260 raise ValueError("Invalid value for calib: '{}'".format(clusterCalib))
261

◆ getDecorList()

getDecorList ( jetDef)

Definition at line 373 of file JetRecoCommon.py.

373def getDecorList(jetDef):
374 # Basic jet info provided by the jet builder
375 decorlist = []
376
377 # return empty list for non-calibrated jets
378 if jetCalibFromJetDef(jetDef) == 'nojcalib': return decorlist
379
380 decorlist += [ 'AlgorithmType', 'InputType',
381 'ActiveArea', 'ActiveArea4vec_eta', 'ActiveArea4vec_m',
382 'ActiveArea4vec_phi', 'ActiveArea4vec_pt',
383 'EMFrac','HECFrac','EnergyPerSampling','N90Constituents','constit','Tile0Frac']
384
385 if jetDef.context == 'ftf':
386 decorlist += ["GhostTrack_ftf",
387 "NumTrkPt500","NumTrkPt1000",
388 "SumPtTrkPt500","SumPtTrkPt1000",
389 "TrackWidthPt1000",
390 "JVFCorr", "JvtRpt", "Jvt",
391 'NNJvtTrkAugV1','NNJvtTrkAugV1Pass', 'RPtTrkPt500', 'DTrackWidthPt1000', 'DNumTrkPt1000', 'DRPtTrkPt500', 'SumPtTrkOrderedTrackWidthPt1000', 'SumPtTrkOrderedNumTrkPt1000']
392 if 'PFlow' in jetDef.basename:
393 decorlist += ["SumPtChargedPFOPt500"]
394 return decorlist
395
396

◆ getFilterCut()

getFilterCut ( recoAlg)

Definition at line 191 of file JetRecoCommon.py.

191def getFilterCut(recoAlg):
192 return {"a2":4000, "a4":4000, "a10":50000, "a10r": 50000, "a10t":50000, "a10sd":50000}[recoAlg]
193

◆ getHLTPrefix()

getHLTPrefix ( )

— String getters —

Definition at line 245 of file JetRecoCommon.py.

245def getHLTPrefix():
246 prefix = "HLT_"
247 return prefix
248

◆ getJetCalibDefaultString()

getJetCalibDefaultString ( recoAlg,
constitType,
trkopt )

Definition at line 262 of file JetRecoCommon.py.

262def getJetCalibDefaultString(recoAlg, constitType, trkopt):
263 if recoAlg == 'a4' or recoAlg == 'a2':
264 if constitType == 'tc':
265 return 'subresjesgscIS' if trkopt == 'ftf' else 'subjesIS'
266 elif constitType == 'pf':
267 return 'subresjesgscIS'
268 elif recoAlg == 'a10':
269 return 'subjes'
270 elif recoAlg == 'a10t':
271 return 'jes'
272 elif recoAlg == 'a10sd':
273 return 'jes'
274 elif recoAlg == 'a10r':
275 return 'subjesIS' # calibration for the small-R jets used to reconstruct the reclustered jets
276 else:
277 raise RuntimeError(f'No default calibration is defined for {recoAlg}, {constitType}, {trkopt}')
278

◆ getModSpec()

getModSpec ( modname,
modspec = '' )

Definition at line 369 of file JetRecoCommon.py.

369def getModSpec(modname,modspec=''):
370 return (TriggerJetMods.stdJetModifiers[modname],str(modspec))
371
372# Get list of jet attributes to be calculated for jet

◆ getPrefilterCleaningString()

getPrefilterCleaningString ( prefilters_list)

Definition at line 284 of file JetRecoCommon.py.

284def getPrefilterCleaningString(prefilters_list):
285 found_cleanings= [ci for ck, ci in cleaningDict.items() if ck in prefilters_list]
286 if len(found_cleanings) <= 1: # Only one supported cleaning decoration at the moment
287 return 'noCleaning' if len(found_cleanings) == 0 else found_cleanings[0]
288 else:
289 raise RuntimeError(
290 'Multijet jet cleanings found in jet trigger reco dictionary {}. Multiple jet cleanings are currently unsupported'.format(found_cleanings))
291
292

◆ interpretRecoAlg()

interpretRecoAlg ( recoAlg)

— General helpers —

Definition at line 165 of file JetRecoCommon.py.

165def interpretRecoAlg(recoAlg):
166 import re
167 jetalg, jetradius, jetextra = re.split(r'(\d+)',recoAlg)
168 return jetalg, int(jetradius), jetextra
169
170# Check if jet definition needs tracks or if it should be agnostic of the tracking choice

◆ isPFlow()

isPFlow ( jetRecoDict)

Definition at line 184 of file JetRecoCommon.py.

184def isPFlow(jetRecoDict):
185 isPFlow = jetRecoDict["constitType"] == "pf"
186 if isPFlow and not doFSTracking(jetRecoDict):
187 raise ValueError("This is a PFlow chain but an incompatible tracking option is given!")
188 return isPFlow
189
190# return the min jet pT in MeV for the configured recoAlg

◆ jetCalibFromJetDef()

jetCalibFromJetDef ( jetDef)

Definition at line 151 of file JetRecoCommon.py.

151def jetCalibFromJetDef(jetDef):
152 jetCalib = jetDef.suffix[1:]
153 if jetCalib.endswith('_ftf'):
154 jetCalib = jetCalib[:-4]
155 return jetCalib
156

◆ jetChainParts()

jetChainParts ( chainParts)

— Extracting jet chain parts —

Definition at line 34 of file JetRecoCommon.py.

34def jetChainParts(chainParts):
35 jChainParts = []
36 for p in chainParts:
37 if p['trigType'] == 'j':
38 jChainParts.append(p)
39 return jChainParts
40

◆ jetDefNeedsTracks()

jetDefNeedsTracks ( jetRecoDict)

Definition at line 171 of file JetRecoCommon.py.

171def jetDefNeedsTracks(jetRecoDict):
172 # For tc_a10, tc_a10t and tc_a10sd, we will be agnostic of tracking (no suffix will be added)
173 # For everything else (constitType=pf or dependence on small-R jets) we need to be aware of what tracking was used
174 return jetRecoDict["trkopt"]!="notrk" and (jetRecoDict["constitType"]!="tc" or jetRecoDict["recoAlg"] in ['a2','a4','a10'])
175
176# Check if track reconstruction is enabled

◆ jetDefToString()

jetDefToString ( jetDef)

— Interpreting JetDefinition

Definition at line 117 of file JetRecoCommon.py.

117def jetDefToString(jetDef):
118 _jetDef = jetDef
119 poststr = ''
120 if isinstance(jetDef,GroomingDefinition):
121 _jetDef = jetDef.ungroomeddef
122 # We don't support multiple configurations of a given grooming
123 if jetDef.groomSpecAsStr().startswith('Trimmed'):
124 poststr = 't'
125 elif jetDef.groomSpecAsStr().startswith('SoftDrop'):
126 poststr = 'sd'
127 else:
128 raise ValueError('Unsupported grooming type for HLT')
129 elif jetDef.inputdef.jetinputtype == JetInputType.Jet:
130 # Reclustered
131 poststr = 'r'
132
133 algstr = f'{str.lower(_jetDef.algorithm[0])}{formatRvalue(_jetDef._radius)}{poststr}'
134 constitdef = _jetDef.inputdef
135 if constitdef.label == 'HI':
136 constitstr = "ion" if _jetDef.context == "hi" else "ionp"
137 else:
138 clusterCalib = 'lcw' if 'LC' in constitdef.label else 'em'
139 constittype = 'pf' if 'PFlow' in constitdef.label else 'tc'
140 constitmods = ''
141 if isinstance(constitdef,JetInputConstitSeq):
142 ignore = ['EM','LC','CHS','CorrectPFO']
143 for mod in constitdef.modifiers:
144 if mod not in ignore:
145 constitmods += str.lower(mod)
146 constitstr = f'{constitmods}{constittype}_{clusterCalib}'
147 jetdefstr = f'{algstr}_{constitstr}{jetDef.suffix}'
148
149 return jetdefstr
150

◆ jetRecoDictFromString()

jetRecoDictFromString ( jet_def_string)

Definition at line 79 of file JetRecoCommon.py.

79def jetRecoDictFromString(jet_def_string):
80
81 # Translate the definition string into an approximation
82 # of the "recoParts" in the jet chainParts.
83 jetRecoDict = {}
84 from TriggerMenuMT.HLT.Menu.SignatureDicts import JetChainParts,JetChainParts_Default
85 for key in recoKeys:
86 keyFound = False
87 tmp_key = key
88 for part in jet_def_string.split('_'):
89 if part in JetChainParts[tmp_key]:
90 jetRecoDict[key] = part
91 keyFound = True
92 if not keyFound:
93 jetRecoDict[key] = JetChainParts_Default[key]
94
95 # set proper jetCalib key in default case
96 if jetRecoDict['jetCalib'] == "default":
97 jetRecoDict['jetCalib'] = getJetCalibDefaultString(jetRecoDict['recoAlg'],jetRecoDict['constitType'],jetRecoDict['trkopt'])
98
99 jetRecoDict['jetDefStr'] = jetRecoDictToString(jetRecoDict)
100
101 return jetRecoDict
102
103# Assist with grooming and reclustering workflows, we need to
104# ensure that the name is updated consistently

◆ jetRecoDictToString()

jetRecoDictToString ( jetRecoDict)

— General reco dict handling —

Definition at line 45 of file JetRecoCommon.py.

45def jetRecoDictToString(jetRecoDict):
46 if jetRecoDict['ionopt'] in ['ion', 'ionp']:
47 # Unique settings for heavy ions
48 # other values will be default
49 return jetRecoDict['recoAlg'] + "_" + jetRecoDict['ionopt']
50 strtemp = "{recoAlg}_{constitMod}{constitType}_{clusterCalib}_{jetCalib}"
51 if doTracking(jetRecoDict):
52 strtemp += "_{trkopt}"
53 return strtemp.format(**jetRecoDict)
54
55# Extract the jet reco dict from the chainDict

Variable Documentation

◆ cleaningDict

dict python.HLT.Jet.JetRecoCommon.cleaningDict
Initial value:
= {
'CLEANlb': 'LooseBad',
'CLEANllp': 'LooseBadLLP',
}

Definition at line 279 of file JetRecoCommon.py.

◆ etaRangeAbbrev

dict python.HLT.Jet.JetRecoCommon.etaRangeAbbrev
Initial value:
= {
"j":"0eta320", # default
"a":"0eta490",
"c":"0eta240",
"C":"0eta210",
"f":"320eta490"
}

Common jet eta ranges —

Definition at line 23 of file JetRecoCommon.py.

◆ log

python.HLT.Jet.JetRecoCommon.log = logging.getLogger(__name__)

Definition at line 19 of file JetRecoCommon.py.