Commit 48669fca authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

Further clean up e/gamma selector config. Remove unneeded usages of cppyy

parent 1a6faa74
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
##=============================================================================
## Name: ForwardElectronIsEMSelectorMapping.py
# =============================================================================
# Name: ForwardElectronIsEMSelectorMapping.py
#
# Author: Tulay Cuhadar Donszelmann, Jovan Mitrevski
# Created: Dec 2011
##
## Author: Tulay Cuhadar Donszelmann, Jovan Mitrevski
## Created: Dec 2011
##
## Description: Find mapping of mask and function for ID quality
##=============================================================================
# Description: Find mapping of mask and function for ID quality
# =============================================================================
import cppyy
cppyy.include("ElectronPhotonSelectorTools/egammaPIDdefs.h")
from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID
#
import ElectronPhotonSelectorTools.ForwardElectronIsEMLooseSelectorCutDefs as ForwardElectronIsEMLooseSelectorCutDefs
import ElectronPhotonSelectorTools.ForwardElectronIsEMTightSelectorCutDefs as ForwardElectronIsEMTightSelectorCutDefs
import ElectronPhotonSelectorTools.ForwardElectronIsEMMediumSelectorCutDefs as ForwardElectronIsEMMediumSelectorCutDefs
from ROOT import egammaPID
class forwardelectronPIDmenu:
menuMC15 = 0
import ElectronPhotonSelectorTools.ForwardElectronIsEMLooseSelectorCutDefs as ForwardElectronIsEMLooseSelectorCutDefs
import ElectronPhotonSelectorTools.ForwardElectronIsEMMediumSelectorCutDefs as ForwardElectronIsEMMediumSelectorCutDefs
import ElectronPhotonSelectorTools.ForwardElectronIsEMTightSelectorCutDefs as ForwardElectronIsEMTightSelectorCutDefs
# format - key: (mask, function)
ForwardElectronIsEMMapMC15 = {
egammaPID.ForwardElectronIDLoose: ( egammaPID.ID_ForwardElectron, ForwardElectronIsEMLooseSelectorCutDefs.ForwardElectronIsEMLooseSelectorConfigMC15 ),
egammaPID.ForwardElectronIDMedium: ( egammaPID.ID_ForwardElectron, ForwardElectronIsEMMediumSelectorCutDefs.ForwardElectronIsEMMediumSelectorConfigMC15 ),
egammaPID.ForwardElectronIDTight: ( egammaPID.ID_ForwardElectron, ForwardElectronIsEMTightSelectorCutDefs.ForwardElectronIsEMTightSelectorConfigMC15 ),
egammaPID.NoIDCut: ( 0, ForwardElectronIsEMLooseSelectorCutDefs.ForwardElectronIsEMLooseSelectorConfigMC15 )
}
egammaPID.ForwardElectronIDLoose: (
egammaPID.ID_ForwardElectron,
ForwardElectronIsEMLooseSelectorCutDefs.ForwardElectronIsEMLooseSelectorConfigMC15),
egammaPID.ForwardElectronIDMedium: (
egammaPID.ID_ForwardElectron,
ForwardElectronIsEMMediumSelectorCutDefs.ForwardElectronIsEMMediumSelectorConfigMC15),
egammaPID.ForwardElectronIDTight: (
egammaPID.ID_ForwardElectron,
ForwardElectronIsEMTightSelectorCutDefs.ForwardElectronIsEMTightSelectorConfigMC15),
egammaPID.NoIDCut: (
0,
ForwardElectronIsEMLooseSelectorCutDefs.ForwardElectronIsEMLooseSelectorConfigMC15)
}
def ForwardElectronIsEMMap(quality, menu):
......@@ -37,4 +43,3 @@ def ForwardElectronIsEMMap(quality, menu):
return ForwardElectronIsEMMapMC15[quality]
else:
raise ValueError("Requested menu is undefined: %d" % menu)
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from ROOT import egammaPID
from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID
from ElectronPhotonSelectorTools.AsgForwardElectronIsEMSelectorsConfig import (
AsgForwardElectronIsEMSelectorCfg)
import cppyy
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
......@@ -11,8 +10,6 @@ from egammaTools.egammaOQFlagsBuilderConfig import egammaOQFlagsBuilderCfg
EMFourMomBuilder = CompFactory.EMFourMomBuilder
egammaForwardBuilder = CompFactory.egammaForwardBuilder
cppyy.load_library('libElectronPhotonSelectorToolsDict')
def egammaForwardBuilderCfg(flags, name='egammaForwardElectron', **kwargs):
......
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# default configuration of the EMPIDBuilder
from ROOT import LikeEnum
from ROOT import egammaPID
from ElectronPhotonSelectorTools.LikelihoodEnums import LikeEnum
from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID
from AthenaCommon.Logging import logging
# import base class
from egammaTools.egammaToolsConf import EMPIDBuilder
# Eventually we need to get rid of this
#import cppyy
#cppyy.load_library('libElectronPhotonSelectorToolsDict')
class EMPIDBuilderElectronBase (EMPIDBuilder):
__slots__ = ()
......@@ -45,7 +41,6 @@ class EMPIDBuilderElectronBase (EMPIDBuilder):
"TightLHSelector", LikeEnum.Tight)
TightLHSelector.primaryVertexContainer = "PrimaryVertices"
self.electronIsEMselectors = [
LooseElectronSelector,
MediumElectronSelector,
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
__doc__ = "Configure the electron and photon selectors."
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
EMPIDBuilder=CompFactory.EMPIDBuilder
from ROOT import egammaPID
import cppyy
cppyy.load_library('libElectronPhotonSelectorToolsDict')
from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID
EMPIDBuilder = CompFactory.EMPIDBuilder
def EMPIDBuilderElectronCfg(flags, name='EMPIDBuilderElectron', **kwargs):
......@@ -23,14 +21,18 @@ def EMPIDBuilderElectronCfg(flags, name='EMPIDBuilderElectron', **kwargs):
from ROOT import LikeEnum
from ElectronPhotonSelectorTools.AsgElectronIsEMSelectorsConfig import AsgElectronIsEMSelectorCfg
if "electronIsEMselectors" not in kwargs:
LooseElectronSelectorAcc = AsgElectronIsEMSelectorCfg(flags, "LooseElectronSelector", egammaPID.ElectronIDLoosePP)
MediumElectronSelectorAcc = AsgElectronIsEMSelectorCfg(flags, "MediumElectronSelector", egammaPID.ElectronIDMediumPP)
TightElectronSelectorAcc = AsgElectronIsEMSelectorCfg(flags, "TightElectronSelector", egammaPID.ElectronIDTightPP)
LooseElectronSelectorAcc = AsgElectronIsEMSelectorCfg(
flags, "LooseElectronSelector", egammaPID.ElectronIDLoosePP)
MediumElectronSelectorAcc = AsgElectronIsEMSelectorCfg(
flags, "MediumElectronSelector", egammaPID.ElectronIDMediumPP)
TightElectronSelectorAcc = AsgElectronIsEMSelectorCfg(
flags, "TightElectronSelector", egammaPID.ElectronIDTightPP)
kwargs["electronIsEMselectors"] = [LooseElectronSelectorAcc.popPrivateTools(),
MediumElectronSelectorAcc.popPrivateTools(),
TightElectronSelectorAcc.popPrivateTools()]
kwargs["electronIsEMselectorResultNames"] = ["Loose", "Medium", "Tight"]
kwargs["electronIsEMselectorResultNames"] = [
"Loose", "Medium", "Tight"]
acc.merge(LooseElectronSelectorAcc)
acc.merge(MediumElectronSelectorAcc)
acc.merge(TightElectronSelectorAcc)
......@@ -38,16 +40,20 @@ def EMPIDBuilderElectronCfg(flags, name='EMPIDBuilderElectron', **kwargs):
# Likelihood
from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig import AsgElectronLikelihoodToolCfg
if "electronLHselectors" not in kwargs:
LooseLHSelectorAcc = AsgElectronLikelihoodToolCfg(flags, "LooseLHSelector", LikeEnum.Loose)
LooseLHSelectorAcc = AsgElectronLikelihoodToolCfg(
flags, "LooseLHSelector", LikeEnum.Loose)
LooseLHSelectorAcc.primaryVertexContainer = "PrimaryVertices"
MediumLHSelectorAcc = AsgElectronLikelihoodToolCfg(flags, "MediumLHSelector", LikeEnum.Medium)
MediumLHSelectorAcc = AsgElectronLikelihoodToolCfg(
flags, "MediumLHSelector", LikeEnum.Medium)
MediumLHSelectorAcc.primaryVertexContainer = "PrimaryVertices"
TightLHSelectorAcc = AsgElectronLikelihoodToolCfg(flags, "TightLHSelector", LikeEnum.Tight)
TightLHSelectorAcc = AsgElectronLikelihoodToolCfg(
flags, "TightLHSelector", LikeEnum.Tight)
TightLHSelectorAcc.primaryVertexContainer = "PrimaryVertices"
kwargs["electronLHselectors"] = [LooseLHSelectorAcc.popPrivateTools(),
MediumLHSelectorAcc.popPrivateTools(),
TightLHSelectorAcc.popPrivateTools()]
kwargs["electronLHselectorResultNames"] = ["LHLoose", "LHMedium", "LHTight"]
kwargs["electronLHselectorResultNames"] = [
"LHLoose", "LHMedium", "LHTight"]
acc.merge(LooseLHSelectorAcc)
acc.merge(MediumLHSelectorAcc)
acc.merge(TightLHSelectorAcc)
......@@ -67,8 +73,10 @@ def EMPIDBuilderPhotonCfg(flags, name='EMPIDBuilderPhoton', **kwargs):
# photon Selectors
from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import AsgPhotonIsEMSelectorCfg
LoosePhotonSelectorAcc = AsgPhotonIsEMSelectorCfg(flags, "LoosePhotonSelector", egammaPID.PhotonIDLoose)
TightPhotonSelectorAcc = AsgPhotonIsEMSelectorCfg(flags, "TightPhotonSelector", egammaPID.PhotonIDTight)
LoosePhotonSelectorAcc = AsgPhotonIsEMSelectorCfg(
flags, "LoosePhotonSelector", egammaPID.PhotonIDLoose)
TightPhotonSelectorAcc = AsgPhotonIsEMSelectorCfg(
flags, "TightPhotonSelector", egammaPID.PhotonIDTight)
if "photonIsEMselectors" not in kwargs:
kwargs["photonIsEMselectors"] = [LoosePhotonSelectorAcc.popPrivateTools(),
......
......@@ -5,7 +5,7 @@ all egammaTools with default configuration"""
__author__ = "Bruno Lenzi"
from ROOT import egammaPID
from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID
from ElectronPhotonSelectorTools.ConfiguredAsgForwardElectronIsEMSelectors \
import ConfiguredAsgForwardElectronIsEMSelector
from .EMPIDBuilderBase import EMPIDBuilderPhotonBase
......@@ -144,9 +144,6 @@ PhotonPIDBuilder = ToolFactory(
# ForwardElectron Selectors
## Eventually we want to get rid of cppyy here
#cppyy.load_library('libElectronPhotonSelectorToolsDict')
LooseForwardElectronSelector = ToolFactory(
ConfiguredAsgForwardElectronIsEMSelector,
name="LooseForwardElectronSelector",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment