3 __doc__ =
"Configure the electron and photon selectors."
5 from AthenaCommon.Logging
import logging
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
8 from ElectronPhotonSelectorTools.EgammaPIDdefs
import egammaPID
13 mlog = logging.getLogger(name)
14 mlog.debug(
'Start configuration')
20 from ROOT
import LikeEnum
21 from ElectronPhotonSelectorTools.AsgElectronIsEMSelectorsConfig
import (
22 AsgElectronIsEMSelectorCfg)
23 if "electronIsEMselectors" not in kwargs:
25 flags,
"LooseElectronSelector", egammaPID.ElectronIDLoosePP)
27 flags,
"MediumElectronSelector", egammaPID.ElectronIDMediumPP)
29 flags,
"TightElectronSelector", egammaPID.ElectronIDTightPP)
31 kwargs[
"electronIsEMselectors"] = [
32 LooseElectronSelectorAcc.popPrivateTools(),
33 MediumElectronSelectorAcc.popPrivateTools(),
34 TightElectronSelectorAcc.popPrivateTools()]
35 kwargs[
"electronIsEMselectorResultNames"] = [
36 "Loose",
"Medium",
"Tight"]
37 acc.merge(LooseElectronSelectorAcc)
38 acc.merge(MediumElectronSelectorAcc)
39 acc.merge(TightElectronSelectorAcc)
42 from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig
import (
43 AsgElectronLikelihoodToolCfg)
44 if "electronLHselectors" not in kwargs:
46 flags,
"LooseLHSelector", LikeEnum.Loose)
47 LooseLHSelectorAcc.primaryVertexContainer =
"PrimaryVertices"
49 flags,
"MediumLHSelector", LikeEnum.Medium)
50 MediumLHSelectorAcc.primaryVertexContainer =
"PrimaryVertices"
52 flags,
"TightLHSelector", LikeEnum.Tight)
53 TightLHSelectorAcc.primaryVertexContainer =
"PrimaryVertices"
54 kwargs[
"electronLHselectors"] = [LooseLHSelectorAcc.popPrivateTools(),
55 MediumLHSelectorAcc.popPrivateTools(),
56 TightLHSelectorAcc.popPrivateTools()]
57 kwargs[
"electronLHselectorResultNames"] = [
58 "LHLoose",
"LHMedium",
"LHTight"]
59 acc.merge(LooseLHSelectorAcc)
60 acc.merge(MediumLHSelectorAcc)
61 acc.merge(TightLHSelectorAcc)
63 tool = CompFactory.EMPIDBuilder(name, **kwargs)
65 acc.setPrivateTools(tool)
71 mlog = logging.getLogger(name)
72 mlog.debug(
'Start configuration')
77 from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig
import (
78 AsgPhotonIsEMSelectorCfg)
80 flags,
"LoosePhotonSelector", egammaPID.PhotonIDLoose)
82 flags,
"TightPhotonSelector", egammaPID.PhotonIDTight)
84 if "photonIsEMselectors" not in kwargs:
85 kwargs[
"photonIsEMselectors"] = [
86 LoosePhotonSelectorAcc.popPrivateTools(),
87 TightPhotonSelectorAcc.popPrivateTools()]
88 kwargs[
"photonIsEMselectorResultNames"] = [
"Loose",
"Tight"]
90 acc.merge(LoosePhotonSelectorAcc)
91 acc.merge(TightPhotonSelectorAcc)
93 tool = CompFactory.EMPIDBuilder(name, **kwargs)
94 acc.setPrivateTools(tool)
98 if __name__ ==
"__main__":
100 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
101 from AthenaConfiguration.ComponentAccumulator
import printProperties
102 from AthenaConfiguration.TestDefaults
import defaultTestFiles
104 flags.Input.Files = defaultTestFiles.RDO_RUN2
110 mlog = logging.getLogger(
"EMPIDBuilderConfigTest")
111 mlog.info(
"Configuring EMPIDBuilderElectron: ")
116 mlog.info(
"Configuring EMPIDBuilderPhoton: ")
122 f =
open(
"empidbuilder.pkl",
"wb")