Commit e681fe3a authored by Tulay Cuhadar Donszelmann's avatar Tulay Cuhadar Donszelmann Committed by Walter Lampl
Browse files

New configuration for the egammaTools and egammaCaloTools, and update configs...

New configuration for the egammaTools and egammaCaloTools, and update configs for ElectronPhotonSelectorTools
parent 158bdce1
......@@ -2,7 +2,7 @@
__doc__ = "Configure the AsgElectronIsEMSelector with the quality cuts and allow for (re-)setting of all provided cuts."
import logging
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
# Import the needed stuff specific to the ElectronPhotonSelectorTools
......@@ -10,12 +10,12 @@ from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElect
from ElectronPhotonSelectorTools.ElectronIsEMSelectorMapping import ElectronIsEMMap, electronPIDmenu
def AsgElectronIsEMSelectorsCfg(flags, name, quality, menu=electronPIDmenu.menuDC14):
def AsgElectronIsEMSelectorCfg(flags, name, quality, menu=electronPIDmenu.menuDC14):
acc = ComponentAccumulator()
mlog = logging.getLogger('AsgElectronIsEMSelectorsCfg')
mlog = logging.getLogger('AsgElectronIsEMSelector')
mlog.debug('Start configuration')
acc = ComponentAccumulator()
try:
ntuple = ElectronIsEMMap(quality, menu)
mlog.debug('ntuple: %s', ntuple)
......
......@@ -2,7 +2,7 @@
__doc__ = " Configure the AsgElectronLikelihoodTool with the quality cuts and allow for (re-)setting of all provided cuts."
import logging
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
# Import the needed stuff specific to the ElectronPhotonSelectorTools
......@@ -14,7 +14,8 @@ def AsgElectronLikelihoodToolCfg(flag, name, quality, menu=electronLHmenu.offlin
acc = ComponentAccumulator()
mlog = logging.getLogger('AsgElectronLikelihoodToolCfg')
mlog = logging.getLogger('AsgElectronLikelihoodTool')
mlog.debug('Start configuration')
try:
ntuple = ElectronLikelihoodMap(quality, menu)
......
......@@ -2,7 +2,7 @@
__doc__ = "Configure the AsgForwardElectronIsEMSelector with the quality cuts and allow for (re-)setting of all provided cuts."
import logging
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
# Import the needed stuff specific to the ElectronPhotonSelectorTools
......@@ -14,7 +14,8 @@ def AsgForwardElectronIsEMSelectorCfg(flags, name, quality, menu=forwardelectron
acc = ComponentAccumulator()
mlog = logging.getLogger('AsgForwardElectronIsEMSelectorCfg')
mlog = logging.getLogger('AsgForwardElectronIsEMSelector')
mlog.debug('Start configuration')
try:
ntuple = ForwardElectronIsEMMap(quality, menu)
......
......@@ -2,7 +2,7 @@
__doc__ = "Configure the AsgPhotonIsEMSelector with the quality cuts and allow for (re-)setting of all provided cuts."
import logging
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
# Import the needed stuff specific to the PhotonPhotonSelectorTools
......@@ -14,7 +14,8 @@ def AsgPhotonIsEMSelectorCfg(flags, name, quality, menu=photonPIDmenu.menuDC14):
acc = ComponentAccumulator()
mlog = logging.getLogger('AsgPhotonIsEMSelectorCfg')
mlog = logging.getLogger('AsgPhotonIsEMSelector')
mlog.debug('Start configuration')
try:
ntuple = PhotonIsEMMap(quality, menu)
......
......@@ -76,6 +76,7 @@ def createEgammaConfigFlags():
egcf.addFlag("Egamma.Keys.Output.ElectronsSuppAOD",
'-e033.-e011.-e333.-e335.-e337.-e377.-isEMLHLoose.-isEMLHTight.-isEMLHMedium.-isEMLoose.-isEMMultiLepton.-isEMMedium.-isEMTight')
egcf.addFlag("Egamma.Keys.Input.ForwardTopoClusters", 'CaloCalTopoClusters')
egcf.addFlag("Egamma.Keys.Output.ForwardElectrons", 'ForwardElectrons')
egcf.addFlag("Egamma.Keys.Output.ForwardElectronsSuppESD", '')
egcf.addFlag("Egamma.Keys.Output.ForwardElectronsSuppAOD",
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
import logging
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from egammaMVACalib.egammaMVACalibConf import egammaMVACalibTool, egammaMVASvc
from ROOT import xAOD
......@@ -10,15 +10,16 @@ cppyy.loadDictionary('xAODEgammaDict')
def TrigEgammaMVACalibCfg(flags, name="TrigEgammaMVASvc"):
acc = ComponentAccumulator()
mlog = logging.getLogger('TrigEgammaMVACalibConfig')
mlog.debug('Start configuration')
acc = ComponentAccumulator()
if flags.Trigger.egamma.calibMVAVersion is not None:
folder = flags.Trigger.egamma.calibMVAVersion
mlog.debug('MVA version: %s', folder)
else:
mlog.error("Trigger.egamma.calibMVAVersion not set")
raise KeyError("Trigger.egamma.calibMVAVersion not set")
mlog.debug('Cluster Correction version: %s', flags.Trigger.egamma.clusterCorrectionVersion)
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
import logging
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from egammaMVACalib.egammaMVACalibConf import egammaMVACalibTool, egammaMVASvc
from ROOT import xAOD
......@@ -10,15 +10,16 @@ cppyy.loadDictionary('xAODEgammaDict')
def egammaMVASvcCfg(flags, name="egammaMVASvc"):
acc = ComponentAccumulator()
mlog = logging.getLogger(name)
mlog.debug('Start configuration')
mlog = logging.getLogger('egammaMVACalibConfig')
acc = ComponentAccumulator()
if flags.Egamma.Calib.MVAVersion is not None:
folder = flags.Egamma.Calib.MVAVersion
mlog.debug('MVA version: %s', folder)
else:
mlog.error("Egamma.Calib.MVAVersion is not set")
raise KeyError("Egamma.Calib.MVAVersion is not set")
electronMVATool = egammaMVACalibTool(name="electronMVATool",
ParticleType=xAOD.EgammaParameters.electron,
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__ = "Configure the electron and photon selectors."
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from egammaTools.egammaToolsConf import EMPIDBuilder
from ROOT import egammaPID
import cppyy
cppyy.loadDictionary('ElectronPhotonSelectorToolsDict')
def EMPIDBuilderElectronCfg(flags, name='EMPIDBuilderElectron', **kwargs):
mlog = logging.getLogger(name)
mlog.debug('Start configuration')
acc = ComponentAccumulator()
# Electron Selectors
# Cut based
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)
kwargs["electronIsEMselectors"] = [LooseElectronSelectorAcc.popPrivateTools(),
MediumElectronSelectorAcc.popPrivateTools(),
TightElectronSelectorAcc.popPrivateTools()]
kwargs["electronIsEMselectorResultNames"] = ["Loose", "Medium", "Tight"]
acc.merge(LooseElectronSelectorAcc)
acc.merge(MediumElectronSelectorAcc)
acc.merge(TightElectronSelectorAcc)
# Likelihood
from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig import AsgElectronLikelihoodToolCfg
if "electronLHselectors" not in kwargs:
LooseLHSelectorAcc = AsgElectronLikelihoodToolCfg(flags, "LooseLHSelector", LikeEnum.Loose)
LooseLHSelectorAcc.primaryVertexContainer = "PrimaryVertices"
MediumLHSelectorAcc = AsgElectronLikelihoodToolCfg(flags, "MediumLHSelector", LikeEnum.Medium)
MediumLHSelectorAcc.primaryVertexContainer = "PrimaryVertices"
TightLHSelectorAcc = AsgElectronLikelihoodToolCfg(flags, "TightLHSelector", LikeEnum.Tight)
TightLHSelectorAcc.primaryVertexContainer = "PrimaryVertices"
kwargs["electronLHselectors"] = [LooseLHSelectorAcc.popPrivateTools(),
MediumLHSelectorAcc.popPrivateTools(),
TightLHSelectorAcc.popPrivateTools()]
kwargs["electronLHselectorResultNames"] = ["LHLoose", "LHMedium", "LHTight"]
acc.merge(LooseLHSelectorAcc)
acc.merge(MediumLHSelectorAcc)
acc.merge(TightLHSelectorAcc)
# Multi Lepton
from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronMultiLeptonSelector
if "genericIsEMselectors" not in kwargs:
MultiLeptonSelector = AsgElectronMultiLeptonSelector("MultiLeptonSelector")
kwargs["genericIsEMselectors"] = [MultiLeptonSelector]
kwargs["genericIsEMselectorResultNames"] = ["MultiLepton"]
tool = EMPIDBuilder(name, **kwargs)
acc.setPrivateTools(tool)
return acc
def EMPIDBuilderPhotonCfg(flags, name='EMPIDBuilderPhoton', **kwargs):
mlog = logging.getLogger(name)
mlog.debug('Start configuration')
acc = ComponentAccumulator()
# photon Selectors
from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import AsgPhotonIsEMSelectorCfg
LoosePhotonSelectorAcc = AsgPhotonIsEMSelectorCfg(flags, "LoosePhotonSelector", egammaPID.PhotonIDLoose)
TightPhotonSelectorAcc = AsgPhotonIsEMSelectorCfg(flags, "TightPhotonSelector", egammaPID.PhotonIDTight)
if "photonIsEMselectors" not in kwargs:
kwargs["photonIsEMselectors"] = [LoosePhotonSelectorAcc.popPrivateTools(),
TightPhotonSelectorAcc.popPrivateTools()]
kwargs["photonIsEMselectorResultNames"] = ["Loose", "Tight"]
acc.merge(LoosePhotonSelectorAcc)
acc.merge(TightPhotonSelectorAcc)
tool = EMPIDBuilder(name, **kwargs)
acc.setPrivateTools(tool)
return acc
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__ = "ToolFactory to instantiate all EMShowerBuilder with default configuration"
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon.Logging import logging
from egammaTools.egammaToolsConf import EMShowerBuilder
from egammaCaloTools.egammaCaloToolsConf import egammaIso, egammaShowerShape
from CaloIdentifier import SUBCALO
def EMShowerBuilderCfg(flags, name='EMShowerBuilder', **kwargs):
mlog = logging.getLogger(name)
mlog.debug('Start configuration')
acc = ComponentAccumulator()
kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault("CaloNums", [SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.TILE])
kwargs.setdefault("ShowerShapeTool", egammaShowerShape())
kwargs.setdefault("HadronicLeakageTool", egammaIso())
tool = EMShowerBuilder(name, **kwargs)
acc.setPrivateTools(tool)
return acc
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__ = "ToolFactory to instantiate EMTrackMatchBuilder with default configuration"
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from egammaTools.egammaToolsConf import EMTrackMatchBuilder
from egammaTrackTools.egammaTrackToolsConfig import EMExtrapolationToolsCacheCfg
def EMTrackMatchBuilderCfg(flags, name='EMTrackMatchBuilder', **kwargs):
mlog = logging.getLogger(name)
mlog.debug('Start configuration')
acc = ComponentAccumulator()
if "ExtrapolationTool" not in kwargs:
extrapcacheAcc = EMExtrapolationToolsCacheCfg(flags)
kwargs["ExtrapolationTool"] = extrapcacheAcc.popPrivateTools()
acc.merge(extrapcacheAcc)
kwargs.setdefault("TrackParticlesName", flags.Egamma.Keys.Output.GSFTrackParticles)
kwargs.setdefault("broadDeltaEta", 0.1) # candidate match is done in 2 times this so +- 0.2
kwargs.setdefault("broadDeltaPhi", 0.15) # candidate match is done in 2 times this so +- 0.3
kwargs.setdefault("useLastMeasurement", False) # important for GSF!!!
kwargs.setdefault("useCandidateMatch", True)
kwargs.setdefault("useScoring", True)
kwargs.setdefault("SecondPassRescale", True)
kwargs.setdefault("UseRescaleMetric", True)
kwargs.setdefault("isCosmics", flags.Beam.Type == "cosmics")
tool = EMTrackMatchBuilder(name, **kwargs)
acc.setPrivateTools(tool)
return acc
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
__doc__ = "Configure e/gamma object quality"
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from egammaTools.egammaToolsConf import egammaOQFlagsBuilder
from CaloTools.CaloToolsConf import CaloAffectedTool
def egammaOQFlagsBuilderCfg(flags, name='egammaOQFlagsBuilder', **kwargs):
mlog = logging.getLogger(name)
mlog.debug('Start configuration')
acc = ComponentAccumulator()
kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault("affectedTool", CaloAffectedTool())
tool = egammaOQFlagsBuilder(name, **kwargs)
acc.setPrivateTools(tool)
return acc
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