ATLAS Offline Software
Loading...
Searching...
No Matches
python.TrigEgammaPrecisionElectronHypoTool Namespace Reference

Classes

class  TrigEgammaPrecisionElectronHypoToolConfig

Functions

 same (val, tool)
 createTrigEgammaPrecisionElectronHypoAlg (flags, name, sequenceOut)
 TrigEgammaPrecisionElectronHypoAlgCfg (flags, name, inputElectronCollection)
 _IncTool (flags, name, monGroups, cpart, tool=None)
 TrigEgammaPrecisionElectronHypoToolFromDict (flags, d, tool=None)
 TrigEgammaPrecisionElectronDNNSelectorCfg (flags, name='TrigEgammaPrecisionElectronDNNSelector', ConfigFilePath=None)
 TrigEgammaPrecisionElectronLHSelectorCfg (flags, name='TrigEgammaPrecisionElectronLHSelector', ConfigFilePath=None, ConfigFileNoPixPath=None, ConfigFileNoGSFPath=None, ConfigFileNoGSFNoPixPath=None)
 TrigEgammaPrecisionElectronCBSelectorCfg (flags, name='TrigEgammaPrecisionElectronCBSelector', ConfigFilePath=None)

Function Documentation

◆ _IncTool()

python.TrigEgammaPrecisionElectronHypoTool._IncTool ( flags,
name,
monGroups,
cpart,
tool = None )
protected

Definition at line 298 of file TrigEgammaPrecisionElectronHypoTool.py.

298def _IncTool(flags, name, monGroups, cpart, tool=None):
299 config = TrigEgammaPrecisionElectronHypoToolConfig(name, monGroups, cpart, tool=tool)
300 config.compile(flags)
301 return config.tool()
302
303
304

◆ createTrigEgammaPrecisionElectronHypoAlg()

python.TrigEgammaPrecisionElectronHypoTool.createTrigEgammaPrecisionElectronHypoAlg ( flags,
name,
sequenceOut )

Definition at line 16 of file TrigEgammaPrecisionElectronHypoTool.py.

16def createTrigEgammaPrecisionElectronHypoAlg(flags, name, sequenceOut):
17 acc = ComponentAccumulator()
18 monTool = GenericMonitoringTool(flags, "MonTool_"+name,
19 HistPath = 'PrecisionElectronHypo/'+name)
20
21 acc_ElectronCBSelectorTools = TrigEgammaPrecisionElectronCBSelectorCfg(flags)
22 acc_ElectronLHSelectorTools = TrigEgammaPrecisionElectronLHSelectorCfg(flags)
23 acc_ElectronDNNSelectorTools = TrigEgammaPrecisionElectronDNNSelectorCfg(flags)
24
25 acc.merge(acc_ElectronCBSelectorTools)
26 acc.merge(acc_ElectronLHSelectorTools)
27 acc.merge(acc_ElectronDNNSelectorTools)
28
29 thePrecisionElectronHypo = CompFactory.TrigEgammaPrecisionElectronHypoAlg(name)
30 thePrecisionElectronHypo.Electrons = str(sequenceOut)
31 thePrecisionElectronHypo.RunInView = True
32 thePrecisionElectronHypo.ElectronCBSelectorTools = acc_ElectronCBSelectorTools.getPublicTools()
33 thePrecisionElectronHypo.ElectronLHSelectorTools = acc_ElectronLHSelectorTools.getPublicTools()
34 thePrecisionElectronHypo.ElectronDNNSelectorTools = acc_ElectronDNNSelectorTools.getPublicTools()
35 thePrecisionElectronHypo.CBNames = ["medium", "loose", "mergedtight"] # just like the pidnames
36 thePrecisionElectronHypo.LHNames = ["lhtight", "lhmedium", "lhloose", "lhvloose",
37 "lhtight_nopix", "lhmedium_nopix","lhloose_nopix","lhvloose_nopix",
38 "lhtight_nogsf", "lhmedium_nogsf","lhloose_nogsf","lhvloose_nogsf",
39 "lhtight_nogsf_nopix", "lhmedium_nogsf_nopix","lhloose_nogsf_nopix","lhvloose_nogsf_nopix"] # just like the pidnames
40 thePrecisionElectronHypo.DNNNames = ["dnntight", "dnnmedium", "dnnloose"] # just like the pidnames
41 monTool.defineHistogram('TIME_exec', type='TH1F', path='EXPERT', title="Precision Electron Hypo Algtime; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
42 monTool.defineHistogram('TIME_LH_exec', type='TH1F', path='EXPERT', title="Precision Electron Hypo LH Algtime; time [ us ] ; Nruns", xbins=20, xmin=0.0, xmax=2000)
43 monTool.defineHistogram('TIME_DNN_exec', type='TH1F', path='EXPERT', title="Precision Electron Hypo DNN Algtime; time [ us ] ; Nruns", xbins=20, xmin=0.0, xmax=2000)
44
45 thePrecisionElectronHypo.MonTool=monTool
46
47 return thePrecisionElectronHypo, acc
48

◆ same()

python.TrigEgammaPrecisionElectronHypoTool.same ( val,
tool )

Definition at line 10 of file TrigEgammaPrecisionElectronHypoTool.py.

10def same( val , tool):
11 return [val]*( len( tool.EtaBins ) - 1 )
12
13#
14# Create the hypo alg with all selectors
15#

◆ TrigEgammaPrecisionElectronCBSelectorCfg()

python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronCBSelectorCfg ( flags,
name = 'TrigEgammaPrecisionElectronCBSelector',
ConfigFilePath = None )

Definition at line 401 of file TrigEgammaPrecisionElectronHypoTool.py.

401def TrigEgammaPrecisionElectronCBSelectorCfg(flags, name='TrigEgammaPrecisionElectronCBSelector', ConfigFilePath=None):
402 acc = ComponentAccumulator()
403 from ElectronPhotonSelectorTools.TrigEGammaPIDdefs import BitDefElectron
404 from ROOT import egammaPID
405
406 ElectronLooseHI = (0
407 | 1 << BitDefElectron.ClusterEtaRange_Electron
408 | 1 << BitDefElectron.ClusterHadronicLeakage_Electron
409 | 1 << BitDefElectron.ClusterMiddleEnergy_Electron
410 | 1 << BitDefElectron.ClusterMiddleEratio37_Electron
411 | 1 << BitDefElectron.ClusterMiddleWidth_Electron
412 | 1 << BitDefElectron.ClusterStripsWtot_Electron
413 )
414
415 ElectronMediumHI = (ElectronLooseHI
416 | 1 << BitDefElectron.ClusterMiddleEratio33_Electron
417 | 1 << BitDefElectron.ClusterBackEnergyFraction_Electron
418 | 1 << BitDefElectron.ClusterStripsEratio_Electron
419 | 1 << BitDefElectron.ClusterStripsDeltaEmax2_Electron
420 | 1 << BitDefElectron.ClusterStripsDeltaE_Electron
421 | 1 << BitDefElectron.ClusterStripsFracm_Electron
422 | 1 << BitDefElectron.ClusterStripsWeta1c_Electron
423 )
424
425 if not ConfigFilePath:
426 ConfigFilePath = flags.Trigger.egamma.electronHIPidVersion
427
428 SelectorNames = {
429 'medium': 'AsgElectronIsEMSelectorHIMedium',
430 'loose': 'AsgElectronIsEMSelectorHILoose',
431 'mergedtight' : 'AsgElectronIsEMSelectorMergedTight',
432 }
433
434 ElectronToolConfigFile = {
435 'medium': 'ElectronIsEMMediumSelectorCutDefs.conf',
436 'loose': 'ElectronIsEMLooseSelectorCutDefs.conf',
437 'mergedtight' : 'ElectronIsEMMergedTightSelectorCutDefs.conf',
438 }
439
440 ElectronMaskBits = {
441 'medium': ElectronMediumHI,
442 'loose': ElectronLooseHI,
443 'mergedtight' : egammaPID.ElectronTightHLT,
444 }
445
446 for sel, name in SelectorNames.items():
447 SelectorTool = CompFactory.AsgElectronIsEMSelector(name)
448 SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[sel]
449 SelectorTool.isEMMask = ElectronMaskBits[sel]
450 acc.addPublicTool(SelectorTool)
451
452 return acc

◆ TrigEgammaPrecisionElectronDNNSelectorCfg()

python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronDNNSelectorCfg ( flags,
name = 'TrigEgammaPrecisionElectronDNNSelector',
ConfigFilePath = None )

Definition at line 316 of file TrigEgammaPrecisionElectronHypoTool.py.

316def TrigEgammaPrecisionElectronDNNSelectorCfg(flags, name='TrigEgammaPrecisionElectronDNNSelector', ConfigFilePath=None):
317 acc = ComponentAccumulator()
318 # We should include the DNN here
319 if not ConfigFilePath:
320 ConfigFilePath = flags.Trigger.egamma.dnnVersion
321
322 SelectorNames = {
323 'dnntight' :'AsgElectronDNNTightSelector',
324 'dnnmedium' :'AsgElectronDNNMediumSelector',
325 'dnnloose' :'AsgElectronDNNLooseSelector',
326 }
327
328 ElectronToolConfigFile = {
329 'dnntight' :'ElectronDNNMulticlassTight.conf',
330 'dnnmedium' :'ElectronDNNMulticlassMedium.conf',
331 'dnnloose' :'ElectronDNNMulticlassLoose.conf',
332 }
333
334 for dnnname, name in SelectorNames.items():
335 SelectorTool = CompFactory.AsgElectronSelectorTool(name)
336 SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[dnnname]
337 SelectorTool.skipDeltaPoverP = True
338 acc.addPublicTool(SelectorTool)
339
340 return acc
341
342#
343# Electron LH Selectors
344#

◆ TrigEgammaPrecisionElectronHypoAlgCfg()

python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronHypoAlgCfg ( flags,
name,
inputElectronCollection )

Definition at line 49 of file TrigEgammaPrecisionElectronHypoTool.py.

49def TrigEgammaPrecisionElectronHypoAlgCfg(flags, name, inputElectronCollection ):
50 acc = ComponentAccumulator()
51 hypo_tuple = createTrigEgammaPrecisionElectronHypoAlg( flags, name, inputElectronCollection )
52 hypo_alg = hypo_tuple[0]
53 hypo_acc = hypo_tuple[1]
54 acc.addEventAlgo( hypo_alg )
55 acc.merge(hypo_acc)
56 return acc
57

◆ TrigEgammaPrecisionElectronHypoToolFromDict()

python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronHypoToolFromDict ( flags,
d,
tool = None )
Use menu decoded chain dictionary to configure the tool 

Definition at line 305 of file TrigEgammaPrecisionElectronHypoTool.py.

305def TrigEgammaPrecisionElectronHypoToolFromDict(flags, d , tool=None):
306 """ Use menu decoded chain dictionary to configure the tool """
307 cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Electron'))]
308 return _IncTool( flags, d['chainName'], d['monGroups'], cparts[0] , tool=tool )
309
310
311
312
313#
314# Electron DNN Selectors
315#

◆ TrigEgammaPrecisionElectronLHSelectorCfg()

python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronLHSelectorCfg ( flags,
name = 'TrigEgammaPrecisionElectronLHSelector',
ConfigFilePath = None,
ConfigFileNoPixPath = None,
ConfigFileNoGSFPath = None,
ConfigFileNoGSFNoPixPath = None )

Definition at line 345 of file TrigEgammaPrecisionElectronHypoTool.py.

345def TrigEgammaPrecisionElectronLHSelectorCfg(flags, name='TrigEgammaPrecisionElectronLHSelector', ConfigFilePath=None, ConfigFileNoPixPath=None, ConfigFileNoGSFPath=None, ConfigFileNoGSFNoPixPath=None):
346
347 # Configure the LH selectors
348 acc = ComponentAccumulator()
349
350 # Must be careful that order matches LHNames at the start of the file!
351 SelectorConfigFiles = {
352 'lhtight' : 'ElectronLikelihoodTightTriggerConfig',
353 'lhmedium' : 'ElectronLikelihoodMediumTriggerConfig',
354 'lhloose' : 'ElectronLikelihoodLooseTriggerConfig',
355 'lhvloose' : 'ElectronLikelihoodVeryLooseTriggerConfig'
356 }
357
358 VariationConfigInfos = {
359 '_default' : {},
360 '_nopix' : {},
361 '_nogsf' : {},
362 '_nogsf_nopix' : {}
363 }
364
365 VariationConfigInfos['_default']['postfix'] = ''
366 VariationConfigInfos['_nopix']['postfix'] = '_NoPix'
367 VariationConfigInfos['_nogsf']['postfix'] = ''
368 VariationConfigInfos['_nogsf_nopix']['postfix'] = '_NoPix'
369
370 VariationConfigInfos['_default']['path'] = ConfigFilePath if ConfigFilePath else flags.Trigger.egamma.electronPidVersion
371 VariationConfigInfos['_nopix']['path'] = ConfigFileNoPixPath if ConfigFileNoPixPath else flags.Trigger.egamma.electronNoPixPidVersion
372 VariationConfigInfos['_nogsf']['path'] = ConfigFileNoGSFPath if ConfigFileNoGSFPath else flags.Trigger.egamma.electronNoGSFPidVersion
373 VariationConfigInfos['_nogsf_nopix']['path'] = ConfigFileNoGSFNoPixPath if ConfigFileNoGSFNoPixPath else flags.Trigger.egamma.electronNoGSFNoPixPidVersion
374
375 from AthenaCommon.Logging import logging
376 log = logging.getLogger('TrigEgammaPrecisionElectronHypoTool')
377 log.debug( 'TrigEgammaPrecisionElectronLHSelectorCfg, order of LH tools:' )
378
379 for pidvar, config in VariationConfigInfos.items():
380 for pidname, configfilebase in SelectorConfigFiles.items():
381 fullpidname = pidname if pidvar == '_default' else pidname + pidvar
382 toolname = 'AsgElectronSelector_' + fullpidname
383 configfile = config['path'] + '/' + configfilebase + config['postfix'] + '.conf'
384 skipdeltapcheck = True if 'nogsf' in pidvar else False
385
386 log.debug( ' --> %s, config file: %s', fullpidname, configfile )
387
388 SelectorTool = CompFactory.AsgElectronLikelihoodTool(toolname)
389 SelectorTool.ConfigFile = configfile
390 SelectorTool.usePVContainer = False
391 SelectorTool.skipDeltaPoverP = skipdeltapcheck
392 acc.addPublicTool(SelectorTool)
393
394 return acc
395
396
397#
398# Electron CB Selectors
399#
400