ATLAS Offline Software
AsgPhotonIsEMSelectorsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = """Configure the AsgPhotonIsEMSelector with the quality cuts
4  and allow for (re-)setting of all provided cuts."""
5 
6 from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import (
7  PhotonIsEMMap, photonPIDmenu)
8 from TriggerMenuMT.HLT.Photon.TriggerPhotonIsEMSelectorMapping import (
9  TriggerPhotonIsEMMap, triggerPhotonPIDmenu)
10 from AthenaCommon.Logging import logging
11 from AthenaConfiguration.ComponentFactory import CompFactory
12 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
13 
14 
16  name,
17  quality,
18  menu=photonPIDmenu.menuCurrentCuts,
19  trigger = False):
20 
21  mlog = logging.getLogger('AsgPhotonIsEMSelector')
22  mlog.debug('Start configuration')
23  acc = ComponentAccumulator()
24  AsgPhotonIsEMSelector = CompFactory.AsgPhotonIsEMSelector
25 
26  try:
27  if trigger:
28  menu = triggerPhotonPIDmenu.menuCurrentCuts
29  ntuple = TriggerPhotonIsEMMap(quality, menu)
30  else:
31  ntuple = PhotonIsEMMap(quality, menu)
32  mlog.debug('ntuple: %s', ntuple)
33  except KeyError:
34  mlog.error("Photon quality not found."
35  "Please use an egammaIDQuality"
36  "(ElectronPhotonSelectorTools/egammaPIDdefs.h)."
37  "This function only supports standard photon IDs,"
38  "and not electron IDs or forward IDs")
39  raise
40 
41  # Create and instance of the tool
42  tool = AsgPhotonIsEMSelector(name)
43 
44  # # Call the function and configure it with the standard configuration
45  ntuple[1](tool)
46  tool.isEMMask = ntuple[0]
47 
48  mlog.debug('isEMMask: %x', tool.isEMMask)
49 
50  acc.setPrivateTools(tool)
51  return acc
52 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.PhotonIsEMSelectorMapping.PhotonIsEMMap
def PhotonIsEMMap(quality, menu)
Definition: PhotonIsEMSelectorMapping.py:74
TriggerPhotonIsEMSelectorMapping.TriggerPhotonIsEMMap
def TriggerPhotonIsEMMap(quality, menu)
Definition: TriggerPhotonIsEMSelectorMapping.py:37
python.AsgPhotonIsEMSelectorsConfig.AsgPhotonIsEMSelectorCfg
def AsgPhotonIsEMSelectorCfg(flags, name, quality, menu=photonPIDmenu.menuCurrentCuts, trigger=False)
Definition: AsgPhotonIsEMSelectorsConfig.py:15
AsgPhotonIsEMSelector
Photon isEM selector.
Definition: AsgPhotonIsEMSelector.h:41