ATLAS Offline Software
Classes | Functions
python.TrigEgammaPrecisionElectronHypoTool Namespace Reference

Classes

class  TrigEgammaPrecisionElectronHypoToolConfig
 

Functions

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

Function Documentation

◆ _IncTool()

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

Definition at line 287 of file TrigEgammaPrecisionElectronHypoTool.py.

287 def _IncTool(flags, name, monGroups, cpart, tool=None):
288  config = TrigEgammaPrecisionElectronHypoToolConfig(name, monGroups, cpart, tool=tool)
289  config.compile(flags)
290  return config.tool()
291 
292 
293 

◆ createTrigEgammaPrecisionElectronHypoAlg()

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

Definition at line 17 of file TrigEgammaPrecisionElectronHypoTool.py.

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

◆ same()

def python.TrigEgammaPrecisionElectronHypoTool.same (   val,
  tool 
)

Definition at line 11 of file TrigEgammaPrecisionElectronHypoTool.py.

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

◆ TrigEgammaPrecisionElectronCBSelectorCfg()

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

Definition at line 392 of file TrigEgammaPrecisionElectronHypoTool.py.

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

◆ TrigEgammaPrecisionElectronDNNSelectorCfg()

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

Definition at line 305 of file TrigEgammaPrecisionElectronHypoTool.py.

305 def TrigEgammaPrecisionElectronDNNSelectorCfg(flags, name='TrigEgammaPrecisionElectronDNNSelector', ConfigFilePath=None):
306  acc = ComponentAccumulator()
307  # We should include the DNN here
308  if not ConfigFilePath:
309  ConfigFilePath = flags.Trigger.egamma.dnnVersion
310 
311  import collections.abc
312  SelectorNames = collections.OrderedDict({
313  'dnntight' :'AsgElectronDNNTightSelector',
314  'dnnmedium' :'AsgElectronDNNMediumSelector',
315  'dnnloose' :'AsgElectronDNNLooseSelector',
316  })
317 
318  ElectronToolConfigFile = collections.OrderedDict({
319  'dnntight' :'ElectronDNNMulticlassTight.conf',
320  'dnnmedium' :'ElectronDNNMulticlassMedium.conf',
321  'dnnloose' :'ElectronDNNMulticlassLoose.conf',
322  })
323 
324  for dnnname, name in SelectorNames.items():
325  SelectorTool = CompFactory.AsgElectronSelectorTool(name)
326  SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[dnnname]
327  SelectorTool.skipDeltaPoverP = True
328  acc.addPublicTool(SelectorTool)
329 
330  return acc
331 
332 #
333 # Electron LH Selectors
334 #

◆ TrigEgammaPrecisionElectronHypoAlgCfg()

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

Definition at line 50 of file TrigEgammaPrecisionElectronHypoTool.py.

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

◆ TrigEgammaPrecisionElectronHypoToolFromDict()

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

Definition at line 294 of file TrigEgammaPrecisionElectronHypoTool.py.

294 def TrigEgammaPrecisionElectronHypoToolFromDict(flags, d , tool=None):
295  """ Use menu decoded chain dictionary to configure the tool """
296  cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Electron'))]
297  return _IncTool( flags, d['chainName'], d['monGroups'], cparts[0] , tool=tool )
298 
299 
300 
301 
302 #
303 # Electron DNN Selectors
304 #

◆ TrigEgammaPrecisionElectronLHSelectorCfg()

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

Definition at line 335 of file TrigEgammaPrecisionElectronHypoTool.py.

335 def TrigEgammaPrecisionElectronLHSelectorCfg(flags, name='TrigEgammaPrecisionElectronLHSelector', ConfigFilePath=None, ConfigFileNoPixPath=None, ConfigFileNoGSFPath=None, ConfigFileNoGSFNoPixPath=None):
336 
337  # Configure the LH selectors
338  acc = ComponentAccumulator()
339 
340  # Must be careful that order matches LHNames at the start of the file!
341  import collections.abc
342  SelectorConfigFiles = collections.OrderedDict({
343  'lhtight' : 'ElectronLikelihoodTightTriggerConfig',
344  'lhmedium' : 'ElectronLikelihoodMediumTriggerConfig',
345  'lhloose' : 'ElectronLikelihoodLooseTriggerConfig',
346  'lhvloose' : 'ElectronLikelihoodVeryLooseTriggerConfig'
347  })
348 
349  VariationConfigInfos = collections.OrderedDict({
350  '_default' : {},
351  '_nopix' : {},
352  '_nogsf' : {},
353  '_nogsf_nopix' : {}
354  })
355 
356  VariationConfigInfos['_default']['postfix'] = ''
357  VariationConfigInfos['_nopix']['postfix'] = '_NoPix'
358  VariationConfigInfos['_nogsf']['postfix'] = ''
359  VariationConfigInfos['_nogsf_nopix']['postfix'] = '_NoPix'
360 
361  VariationConfigInfos['_default']['path'] = ConfigFilePath if ConfigFilePath else flags.Trigger.egamma.electronPidVersion
362  VariationConfigInfos['_nopix']['path'] = ConfigFileNoPixPath if ConfigFileNoPixPath else flags.Trigger.egamma.electronNoPixPidVersion
363  VariationConfigInfos['_nogsf']['path'] = ConfigFileNoGSFPath if ConfigFileNoGSFPath else flags.Trigger.egamma.electronNoGSFPidVersion
364  VariationConfigInfos['_nogsf_nopix']['path'] = ConfigFileNoGSFNoPixPath if ConfigFileNoGSFNoPixPath else flags.Trigger.egamma.electronNoGSFNoPixPidVersion
365 
366  from AthenaCommon.Logging import logging
367  log = logging.getLogger('TrigEgammaPrecisionElectronHypoTool')
368  log.debug( 'TrigEgammaPrecisionElectronLHSelectorCfg, order of LH tools:' )
369 
370  for pidvar, config in VariationConfigInfos.items():
371  for pidname, configfilebase in SelectorConfigFiles.items():
372  fullpidname = pidname if pidvar == '_default' else pidname + pidvar
373  toolname = 'AsgElectronSelector_' + fullpidname
374  configfile = config['path'] + '/' + configfilebase + config['postfix'] + '.conf'
375  skipdeltapcheck = True if 'nogsf' in pidvar else False
376 
377  log.debug( ' --> %s, config file: %s', fullpidname, configfile )
378 
379  SelectorTool = CompFactory.AsgElectronLikelihoodTool(toolname)
380  SelectorTool.ConfigFile = configfile
381  SelectorTool.usePVContainer = False
382  SelectorTool.skipDeltaPoverP = skipdeltapcheck
383  acc.addPublicTool(SelectorTool)
384 
385  return acc
386 
387 
388 #
389 # Electron CB Selectors
390 #
391 
python.TrigEgammaPrecisionElectronHypoTool.same
def same(val, tool)
Definition: TrigEgammaPrecisionElectronHypoTool.py:11
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrigEgammaPrecisionElectronHypoTool.createTrigEgammaPrecisionElectronHypoAlg
def createTrigEgammaPrecisionElectronHypoAlg(flags, name, sequenceOut)
Definition: TrigEgammaPrecisionElectronHypoTool.py:17
GenericMonitoringTool
Definition: GenericMonitoringTool.h:53
python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronHypoAlgCfg
def TrigEgammaPrecisionElectronHypoAlgCfg(flags, name, inputElectronCollection)
Definition: TrigEgammaPrecisionElectronHypoTool.py:50
python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronLHSelectorCfg
def TrigEgammaPrecisionElectronLHSelectorCfg(flags, name='TrigEgammaPrecisionElectronLHSelector', ConfigFilePath=None, ConfigFileNoPixPath=None, ConfigFileNoGSFPath=None, ConfigFileNoGSFNoPixPath=None)
Definition: TrigEgammaPrecisionElectronHypoTool.py:335
python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronDNNSelectorCfg
def TrigEgammaPrecisionElectronDNNSelectorCfg(flags, name='TrigEgammaPrecisionElectronDNNSelector', ConfigFilePath=None)
Definition: TrigEgammaPrecisionElectronHypoTool.py:305
python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronHypoToolFromDict
def TrigEgammaPrecisionElectronHypoToolFromDict(flags, d, tool=None)
Definition: TrigEgammaPrecisionElectronHypoTool.py:294
python.TrigEgammaPrecisionElectronHypoTool._IncTool
def _IncTool(flags, name, monGroups, cpart, tool=None)
Definition: TrigEgammaPrecisionElectronHypoTool.py:287
python.TrigEgammaPrecisionElectronHypoTool.TrigEgammaPrecisionElectronCBSelectorCfg
def TrigEgammaPrecisionElectronCBSelectorCfg(flags, name='TrigEgammaPrecisionElectronCBSelector', ConfigFilePath=None)
Definition: TrigEgammaPrecisionElectronHypoTool.py:392
str
Definition: BTagTrackIpAccessor.cxx:11