Commit f392c034 authored by Tomasz Bold's avatar Tomasz Bold Committed by Frank Winklmeier
Browse files

configure HLT precision electrons step in newJO

parent e92d450f
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentFactory import CompFactory
......@@ -36,5 +36,5 @@ def TrigEgammaMVACalibCfg(flags, name="TrigEgammaMVASvc"):
ElectronTool=TrigElectronMVATool,
UnconvertedPhotonTool=TrigPhotonMVATool)
acc.addService(TrigEgammaMVASvc)
acc.addService(TrigEgammaMVASvc, primary=True)
return acc
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentFactory import CompFactory
......@@ -35,7 +35,7 @@ def egammaMVASvcCfg(flags, name="egammaMVASvc"):
UnconvertedPhotonTool=unconvertedPhotonMVATool,
ConvertedPhotonTool=convertedPhotonMVATool)
acc.addService(egMVASvc)
acc.addService(egMVASvc, primary=True)
return acc
......
# 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 cluster correction"
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentFactory import CompFactory
import GaudiKernel.GaudiHandles as GaudiHandles
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
egammaSwTool=CompFactory.egammaSwTool
import six
def _configureClusterCorrections(swTool, flags):
#TODO move out generators for these tools to CaloClustercorrections package
def ToolConstantsAlgCfg(flags, prefix, version):
acc = ComponentAccumulator()
version = f'-{version}' if version != '' else ''
folder = f'CaloSwClusterCorrections.{prefix}{version}'
cond = CompFactory.ToolConstantsCondAlg(f'ToolConstantsCondAlg_CaloSwClusterCorrections_{prefix}{version}',
DetStoreKey = folder,
ToolConstantsKey = folder) # this is realy the folder name
acc.addCondAlgo(cond)
# depending on the flags configure one of the input sources
if flags.Calo.ClusterCorrection.defaultSource == 'pool':
from EventSelectorAthenaPool.CondProxyProviderConfig import CondProxyProviderCfg
from CaloClusterCorrection.poolfiles import poolfiles
fileID = poolfiles.get("caloswcorr_pool") #TODO figure out how this relates to CalibVersion flag
acc.merge (CondProxyProviderCfg (flags, [fileID]))
#TODO prepare tools when reading from COOL and JO
return acc
def CaloScaleClusterCfg(flags, prefix, clusterType, suffix, version):
acc = ComponentAccumulator()
tool = CompFactory.CaloScaleCluster(f'{prefix}_{version}_{clusterType}{suffix}',
DBHandleKey = f'CaloSwClusterCorrections.{prefix}-{version}',
prefix = clusterType.split('_')[0]+'.')
acc.setPrivateTools(tool)
acc.merge( ToolConstantsAlgCfg(flags, prefix, version))
return acc
def CaloSwEtaoff_v3Cfg(flags, prefix, clusterType, suffix, version):
acc = ComponentAccumulator()
prefix1,prefix2 = prefix.split('_')
tool = CompFactory.CaloSwEtaoff_v3(f'{prefix1}{prefix2}_{version}_{clusterType}{suffix}',
DBHandleKey = f'CaloSwClusterCorrections.{prefix1}-{version}',
prefix = clusterType.split('_')[0]+prefix.split('_')[1]+'.')
acc.setPrivateTools(tool)
acc.merge( ToolConstantsAlgCfg(flags, prefix1, version))
return acc
def CaloSwPhioff_v2Cfg(flags, prefix, clusterType, suffix, version):
acc = ComponentAccumulator()
prefix1,prefix2 = prefix.split('_')
tool = CompFactory.CaloSwPhioff_v2(f'{prefix1}{prefix2}_{version}_{clusterType}{suffix}',
DBHandleKey = f'CaloSwClusterCorrections.{prefix1}-{version}',
prefix = clusterType.split('_')[0]+prefix.split('_')[1]+'.')
acc.setPrivateTools(tool)
acc.merge( ToolConstantsAlgCfg(flags, prefix1, version))
return acc
def CaloClusterUpdateCfg(flags, prefix, clusterType, suffix, version):
acc = ComponentAccumulator()
tool = CompFactory.CaloClusterUpdate(f'{prefix}_{clusterType}{suffix}',
DBHandleKey = f'CaloSwClusterCorrections.larupdate',
prefix = clusterType.split('_')[0]+'.')
acc.setPrivateTools(tool)
acc.merge(ToolConstantsAlgCfg(flags, prefix, ''))
return acc
def CaloSwTimeCfg(flags, prefix, clusterType, suffix, version):
acc = ComponentAccumulator()
tool = CompFactory.CaloSwTime(f'{prefix}_{clusterType}{suffix}',
order = 801 )#TODO figure out how to pick this number
acc.setPrivateTools(tool)
return acc
def CaloClusterBadChannelListCfg(flags, prefix, clusterType, suffix, version):
acc = ComponentAccumulator()
tool = CompFactory.CaloClusterBadChannelList(f'{prefix}_{clusterType}{suffix}',
badChannelTool = CompFactory.CaloBadChanTool(),
order = 820) #TODO figure out how to get this number
acc.setPrivateTools(tool)
return acc
def CaloSwCorrecionsCfg(flags, clusterType, suffix='EGCluster', toolsGen=[]):
"""
Configures multiple correction tools following the same pattern
The toolsGen is expected to be list of tuples with: function generating accumulator with the tool, prefix to pass to the function, version to pass to the function
All these private tools are then repackaged into new acc.
"""
acc = ComponentAccumulator()
algTools = []
for gen, prefix, ver in toolsGen:
toolAcc = gen(flags, prefix=prefix, clusterType=clusterType, suffix=suffix, version=ver)
if toolAcc:
algTools.append(acc.popToolsAndMerge(toolAcc))
acc.setPrivateTools(algTools)
return acc
def _desiredCorrections(flags, clusterType, suffix):
# generator # prefix #version
return CaloSwCorrecionsCfg(flags,
clusterType=clusterType,
suffix=suffix,
toolsGen=[
(CaloScaleClusterCfg, 'rfac', 'v5'),
(CaloSwEtaoff_v3Cfg, 'etaoff_b1', 'v5'),
(CaloSwEtaoff_v3Cfg, 'etaoff_e1', 'v5'),
(CaloSwEtaoff_v3Cfg, 'etaoff_b2', 'v5'),
(CaloSwEtaoff_v3Cfg, 'etaoff_e2', 'v5'),
(CaloSwPhioff_v2Cfg, 'phioff_b2', 'v5data'),
(CaloSwPhioff_v2Cfg, 'phioff_e2', 'v5data'),
(CaloClusterUpdateCfg, 'larupdate', ''),
(CaloSwTimeCfg, 'time', ''),
(CaloClusterBadChannelListCfg, 'listBadChannels', '')
])
def _configureClusterCorrections(flags, swTool):
"Add attributes ClusterCorrectionToolsXX to egammaSwTool object"
from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1, \
etaoff_b2, etaoff_e2, phioff_b2, phioff_e2, update, time, listBadChannel
from CaloRec.CaloRecMakers import _process_tools
acc= ComponentAccumulator()
from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrectionsCfg#, rfac, etaoff_b1, etaoff_e1, \
# etaoff_b2, etaoff_e2, phioff_b2, phioff_e2, update, time, listBadChannel
clusterTypes = dict(
Ele35='ele35', Ele55='ele55', Ele37='ele37',
Gam35='gam35_unconv', Gam55='gam55_unconv', Gam37='gam37_unconv',
Econv35='gam35_conv', Econv55='gam55_conv', Econv37='gam37_conv'
)
for attrName, clName in six.iteritems (clusterTypes):
x = 'ClusterCorrectionTools' + attrName
if not hasattr(swTool, x) or getattr(swTool, x):
continue
y = make_CaloSwCorrections(clName, suffix='EG',
version=flags.Egamma.Calib.ClusterCorrectionVersion,
cells_name=flags.Egamma.Keys.Input.CaloCells)
setattr(swTool, x, _process_tools(swTool, y))
#TODO expers check if this logic here is correct (i.e. we configure either one or the other)
if not flags.Egamma.doSuperclusters:
for attrName, clName in clusterTypes.items():
attrName = 'ClusterCorrectionTools' + attrName
if not hasattr(swTool, attrName):
continue
toolAcc = make_CaloSwCorrectionsCfg(flags, clName, suffix='EG',
version=flags.Egamma.Calib.ClusterCorrectionVersion,
cells_name=flags.Egamma.Keys.Input.CaloCells)
tool = toolAcc.popPrivateTools()
acc.merge(toolAcc)
setattr( swTool, attrName, GaudiHandles.PrivateToolHandleArray(tool) )
# Super cluster position only corrections
if flags.Egamma.doSuperclusters:
for attrName, clName in six.iteritems (clusterTypes):
n = 'ClusterCorrectionToolsSuperCluster' + attrName
if not hasattr(swTool, n) or getattr(swTool, n):
for attrName, clName in clusterTypes.items():
attrName = 'ClusterCorrectionToolsSuperCluster' + attrName
if not hasattr(swTool, attrName):
continue
toolsAcc = _desiredCorrections(flags, clusterType=clName, suffix='EGSuperCluster')
#TODO once debugged we may restore the old way of doing the config
# toolsAcc = make_CaloSwCorrectionsCfg(flags, clName, suffix='EGSuperCluster',
# corrlist=[[rfac, 'v5'], [etaoff_b1, 'v5'], [etaoff_e1, 'v5'],
# [etaoff_b2, 'v5'], [etaoff_e2, 'v5'], [phioff_b2, 'v5data'],
# [phioff_e2, 'v5data'], [update], [time], [listBadChannel]],
# cells_name=flags.Egamma.Keys.Input.CaloCells) #TODO hack to assure we use COOL for data
tools = acc.popToolsAndMerge(toolsAcc)
setattr( swTool, attrName, GaudiHandles.PrivateToolHandleArray(tools) )
setattr(swTool, n, _process_tools(swTool,
make_CaloSwCorrections(clName, suffix='EGSuperCluster',
corrlist=[[rfac, 'v5'], [etaoff_b1, 'v5'], [etaoff_e1, 'v5'],
[etaoff_b2, 'v5'], [etaoff_e2, 'v5'], [phioff_b2, 'v5data'],
[phioff_e2, 'v5data'], [update], [time], [listBadChannel]],
cells_name=flags.Egamma.Keys.Input.CaloCells)))
return acc
def egammaSwToolCfg(flags, name='egammaSwTool', **kwargs):
......@@ -52,10 +176,26 @@ def egammaSwToolCfg(flags, name='egammaSwTool', **kwargs):
acc = ComponentAccumulator()
egswtool = egammaSwTool(name, **kwargs)
egswtool = CompFactory.egammaSwTool(name, **kwargs)
# For now, the correction is called, but this might change.
_configureClusterCorrections(egswtool, flags)
utilsAcc = _configureClusterCorrections(flags, egswtool)
acc.merge(utilsAcc)
acc.setPrivateTools(egswtool)
return acc
if __name__ == '__main__':
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = 1
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
flags.Input.Files = defaultTestFiles.RAW
flags.lock()
acc = _desiredCorrections(flags, 'ele37')
acc.printConfig(withDetails=True, summariseProps=True)
acc.popPrivateTools()
acc.wasMerged()
......@@ -30,7 +30,7 @@ def EMExtrapolationToolsCfg(flags, **kwargs):
if "PerigeeCaloExtensionTool" not in kwargs:
perigeeCaloExtrapAcc = ParticleCaloExtensionToolCfg(
flags,
name="PerigeeCaloExtensionTool",
name="EMParticleCaloExtensionTool",
Extrapolator=kwargs["Extrapolator"],
ParticleType="electron",
StartFromPerigee=True)
......@@ -41,7 +41,7 @@ def EMExtrapolationToolsCfg(flags, **kwargs):
if "LastCaloExtensionTool" not in kwargs:
lastCaloExtrapAcc = ParticleCaloExtensionToolCfg(
flags,
name="LastCaloExtensionTool",
name="EMLastCaloExtensionTool",
ParticleType="electron",
Extrapolator=kwargs["Extrapolator"])
......
......@@ -7,6 +7,7 @@ from AthenaCommon.SystemOfUnits import GeV
def same( val , tool):
return [val]*( len( tool.EtaBins ) - 1 )
from AthenaConfiguration.ComponentFactory import CompFactory
#
# Create the hypo alg with all selectors
......@@ -19,9 +20,7 @@ def createTrigEgammaPrecisionElectronHypoAlg(name, sequenceOut, do_idperf):
from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import createTrigEgammaPrecisionElectronCBSelectors
from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import createTrigEgammaPrecisionElectronLHSelectors
from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import createTrigEgammaPrecisionElectronDNNSelectors
from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoAlg
thePrecisionElectronHypo = TrigEgammaPrecisionElectronHypoAlg(name)
thePrecisionElectronHypo = CompFactory.TrigEgammaPrecisionElectronHypoAlg(name)
thePrecisionElectronHypo.Electrons = sequenceOut
thePrecisionElectronHypo.Do_idperf = do_idperf
thePrecisionElectronHypo.RunInView = True
......@@ -43,7 +42,12 @@ def createTrigEgammaPrecisionElectronHypoAlg(name, sequenceOut, do_idperf):
return thePrecisionElectronHypo
def TrigEgammaPrecisionElectronHypoAlgCfg(flags, name, inputElectronCollection, doIDperf ):
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
acc = ComponentAccumulator()
acc.addEventAlgo( createTrigEgammaPrecisionElectronHypoAlg( name, inputElectronCollection, do_idperf=doIDperf ))
acc.addService( CompFactory.AthONNX.ONNXRuntimeSvc())
return acc
class TrigEgammaPrecisionElectronHypoToolConfig:
......@@ -102,8 +106,8 @@ class TrigEgammaPrecisionElectronHypoToolConfig:
self.__lhInfo = cpart['lhInfo']
if not tool:
from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoTool
tool = TrigEgammaPrecisionElectronHypoTool( name )
from AthenaConfiguration.ComponentFactory import CompFactory
tool = CompFactory.TrigEgammaPrecisionElectronHypoTool( name )
tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47]
tool.ETthr = same( self.__threshold*GeV, tool )
......
......@@ -43,6 +43,7 @@ flags.Scheduler.ShowDataDeps = True
flags.Scheduler.ShowDataFlow = True
flags.Scheduler.ShowControlFlow = True
flags.Scheduler.EnableVerboseViews = True
flags.Calo.ClusterCorrection.defaultSource = 'pool' # temporary, until a complete support for the cool, pool, jo is present
flags.Exec.MaxEvents = 50
# TODO this two should be resolved in a smarter way (i.e. required passing the tag from the driver test, however now, parsing of string with - fails)
......
......@@ -6,15 +6,15 @@
from TrigEDMConfig.TriggerEDMRun3 import recordable
from AthenaCommon.Logging import logging
from AthenaCommon import CfgMgr
from AthenaConfiguration.ComponentFactory import CompFactory
from ROOT import egammaPID
from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector
# Add ONNX into app service mgr
from AthOnnxruntimeService.AthOnnxruntimeServiceConf import AthONNX__ONNXRuntimeSvc
from AthenaCommon.AppMgr import ServiceMgr
ServiceMgr += AthONNX__ONNXRuntimeSvc()
# Add ONNX into app service mgr (in rec-ex common style), but only in Run 2 conf style
from AthenaCommon.Configurable import Configurable
if not Configurable.configurableRun3Behavior:
from AthOnnxruntimeService.AthOnnxruntimeServiceConf import AthONNX__ONNXRuntimeSvc
from AthenaCommon.AppMgr import ServiceMgr
ServiceMgr += AthONNX__ONNXRuntimeSvc()
log = logging.getLogger(__name__)
......@@ -73,7 +73,7 @@ def createTrigEgammaPrecisionElectronDNNSelectors(ConfigFilePath=None):
selectors = []
log.debug('Configuring electron DNN' )
for dnnname, name in SelectorNames.items():
SelectorTool = CfgMgr.AsgElectronSelectorTool(name)
SelectorTool = CompFactory.AsgElectronSelectorTool(name)
SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[dnnname]
SelectorTool.skipDeltaPoverP = True
selectors.append(SelectorTool)
......@@ -116,7 +116,7 @@ def createTrigEgammaPrecisionElectronLHSelectors(ConfigFilePath=None):
selectors = []
log.debug('Configuring electron PID' )
for pidname, name in SelectorNames.items():
SelectorTool = CfgMgr.AsgElectronLikelihoodTool(name)
SelectorTool = CompFactory.AsgElectronLikelihoodTool(name)
SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[pidname]
SelectorTool.usePVContainer = False
SelectorTool.skipDeltaPoverP = True
......@@ -174,7 +174,7 @@ def createTrigEgammaPrecisionElectronCBSelectors(ConfigFilePath=None):
selectors = []
for sel, name in SelectorNames.items():
SelectorTool = CfgMgr.AsgElectronIsEMSelector(name)
SelectorTool = CompFactory.AsgElectronIsEMSelector(name)
SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[sel]
SelectorTool.isEMMask = ElectronMaskBits[sel]
selectors.append(SelectorTool)
......@@ -186,6 +186,7 @@ def createTrigEgammaPrecisionElectronCBSelectors(ConfigFilePath=None):
# Photon IsEM selectors
#
def createTrigEgammaPrecisionPhotonSelectors(ConfigFilePath=None):
from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector
if not ConfigFilePath:
ConfigFilePath = 'ElectronPhotonSelectorTools/trigger/'+TrigEgammaKeys.pidVersion
......@@ -231,7 +232,6 @@ def createTrigEgammaPrecisionPhotonSelectors(ConfigFilePath=None):
def createTrigEgammaFastCaloSelectors(ConfigFilePath=None):
from RingerSelectorTools.RingerSelectorToolsConf import Ringer__AsgRingerSelectorTool
import collections
from AthenaCommon.Logging import logging
log = logging.getLogger(__name__)
......@@ -261,7 +261,7 @@ def createTrigEgammaFastCaloSelectors(ConfigFilePath=None):
selectors = []
for pidname , name in SelectorNames.items():
log.debug('Configuring electron ringer PID for %s', pidname)
SelectorTool=Ringer__AsgRingerSelectorTool(name)
SelectorTool=CompFactory.Ringer__AsgRingerSelectorTool(name)
SelectorTool.ConfigFiles = [ (ConfigFilePath+'/'+path) for path in ToolConfigFile[pidname] ]
selectors.append(SelectorTool)
return selectors
......@@ -273,7 +273,6 @@ def createTrigEgammaFastCaloSelectors(ConfigFilePath=None):
#
def createTrigEgammaFastElectronSelectors(ConfigFilePath=None):
from RingerSelectorTools.RingerSelectorToolsConf import Ringer__AsgRingerSelectorTool
import collections
from AthenaCommon.Logging import logging
log = logging.getLogger(__name__)
......@@ -301,7 +300,7 @@ def createTrigEgammaFastElectronSelectors(ConfigFilePath=None):
selectors = []
for pidname , name in SelectorNames.items():
log.debug('Configuring electron ringer PID for %s', pidname)
SelectorTool=Ringer__AsgRingerSelectorTool(name)
SelectorTool=CompFactory.Ringer__AsgRingerSelectorTool(name)
SelectorTool.ConfigFiles = [ (ConfigFilePath+'/'+path) for path in ToolConfigFile[pidname] ]
selectors.append(SelectorTool)
return selectors
......@@ -312,7 +311,6 @@ def createTrigEgammaFastElectronSelectors(ConfigFilePath=None):
#
def createTrigEgammaFastPhotonSelectors(ConfigFilePath=None):
from RingerSelectorTools.RingerSelectorToolsConf import Ringer__AsgRingerSelectorTool
from AthenaCommon.Logging import logging
import collections
# We should include the ringer here
......@@ -334,7 +332,7 @@ def createTrigEgammaFastPhotonSelectors(ConfigFilePath=None):
selectors = []
for pidname , name in SelectorNames.items():
log.debug('Configuring electron ringer PID for %s', pidname)
SelectorTool=Ringer__AsgRingerSelectorTool(name)
SelectorTool=CompFactory.Ringer__AsgRingerSelectorTool(name)
SelectorTool.ConfigFiles = [ (ConfigFilePath+'/'+path) for path in ToolConfigFile[pidname] ]
selectors.append(SelectorTool)
return selectors
......@@ -65,7 +65,7 @@ tit_lrt.TrackParticleLocation = TrigEgammaKeys_LRT.TrigElectronTracksCollectionN
tit_lrt.VertexLocation = ''
tit_lrt.TracksInConeTool = tpict_lrt
"""Configuring EMTrackMatchBuilder Tool """
TrigEMTrackMatchBuilder = ToolFactory( egammaToolsConf.EMTrackMatchBuilder,
TrackParticlesName = TrigEgammaKeys.TrigElectronTracksCollectionName,
......
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from TriggerMenuMT.HLTMenuConfig.Electron.ElectronRecoSequences import l2CaloRecoCfg, l2CaloHypoCfg
from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequenceCA, \
......@@ -41,7 +41,7 @@ def _fastCalo(flags, chainDict):
def _ftfSeq(flags):
selAcc=SelectionCA('ElectronFTF')
# # # fast ID (need to be customised because require secialised configuration of the views maker - i.e. parent has to be linked)
name = "IMFastElectron"
name = 'IMFastElectron'
evtViewMaker = CompFactory.EventViewCreatorAlgorithm(name,
ViewFallThrough = True,
RoIsLink = 'initialRoI',
......@@ -52,7 +52,7 @@ def _ftfSeq(flags):
RequireParentView = True)
del name
from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg
idTracking = trigInDetFastTrackingCfg(flags, roisKey=evtViewMaker.InViewRoIs, signatureName="Electron")
idTracking = trigInDetFastTrackingCfg(flags, roisKey=evtViewMaker.InViewRoIs, signatureName='Electron')
fastInDetReco = InViewRecoCA('FastElectron', viewMaker=evtViewMaker)
fastInDetReco.mergeReco(idTracking)
fastInDetReco.addRecoAlgo(CompFactory.AthViews.ViewDataVerifier(name='VDVElectronFastCalo',
......@@ -83,7 +83,7 @@ def _precisonCaloSeq(flags):
from TrigCaloRec.TrigCaloRecConfig import hltCaloTopoClusteringCfg
recoAcc.mergeReco(hltCaloTopoClusteringCfg(flags,
namePrefix="Electron",
namePrefix='Electron',
roisKey=recoAcc.inputMaker().InViewRoIs) ) # RoI
copier = CompFactory.egammaTopoClusterCopier('TrigEgammaTopoClusterCopierPrecisionCaloRoIs',
......@@ -108,27 +108,26 @@ def _precisonCalo(flags, chainDict):
@AccumulatorCache
def _precisionTrackingSeq(flags):
selAcc=SelectionCA('ElectronPrecision')
name='ElectronPrecisionTracking'
selAcc=SelectionCA('ElectronPrecisionTracking')
name = "IMPrecisionTrackingElectron"
evtViewMaker = CompFactory.EventViewCreatorAlgorithm(name,
evtViewMaker = CompFactory.EventViewCreatorAlgorithm(f'IM{name}',
ViewFallThrough = True,
RoIsLink = 'initialRoI',
RoITool = CompFactory.ViewCreatorPreviousROITool(),
InViewRoIs = flags.Trigger.InDetTracking.Electron.roi, #this will then be renamed to: flags.InDet.Tracking.roi
Views = name+'Views',
ViewNodeName = 'PrecisionElectronInView',
Views = f'IM{name}Views',
ViewNodeName = f'{name}InView',
RequireParentView = True)
del name
precisionInDetReco = InViewRecoCA('PrecionTrackingElectron', viewMaker=evtViewMaker)
precisionInDetReco = InViewRecoCA(name, viewMaker=evtViewMaker)
from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
idTracking = trigInDetPrecisionTrackingCfg(flags, signatureName="Electron")
idTracking = trigInDetPrecisionTrackingCfg(flags, signatureName='Electron')
precisionInDetReco.mergeReco(idTracking)
selAcc.mergeReco(precisionInDetReco)
from TrigEgammaHypo.TrigEgammaPrecisionTrackingHypoTool import TrigEgammaPrecisionTrackingHypoToolFromDict
hypoAlg = CompFactory.TrigEgammaPrecisionTrackingHypoAlg("ElectronprecisionEtcutHypo")
hypoAlg = CompFactory.TrigEgammaPrecisionTrackingHypoAlg('ElectronprecisionEtcutHypo')
selAcc.addHypoAlgo(hypoAlg)
menuSequence = MenuSequenceCA(selAcc,
HypoToolGen=TrigEgammaPrecisionTrackingHypoToolFromDict)
......@@ -138,22 +137,176 @@ def _precisionTracking(flags, chainDict):
selAcc , menuSequence = _precisionTrackingSeq(flags)
return ChainStep(name=selAcc.name, Sequences=[menuSequence], chainDicts=[chainDict], multiplicity=getChainMultFromDict(chainDict))
@AccumulatorCache
def _precisionElectronSeq(flags, doIDperf=False):
name='PrecionElectron'
selAcc=SelectionCA(name)
recoAcc = InViewRecoCA(name, RequireParentView=True)
#TODO this should likely go elsewhere (egamma experts to decide)
from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaDefs import TrigEgammaKeys
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionCaloMenuSequences import precisionCaloMenuDefs
recoAcc.addRecoAlgo(CompFactory.AthViews.ViewDataVerifier(name='VDV'+recoAcc.name,
DataObjects=[( 'CaloCellContainer' , 'StoreGateSvc+CaloCells' ),
( 'xAOD::CaloClusterContainer' , 'StoreGateSvc+%s' % precisionCaloMenuDefs.caloClusters(ion=False) ),
( 'xAOD::TrackParticleContainer','StoreGateSvc+%s' % TrigEgammaKeys.TrigElectronTracksCollectionName)] ) )
def TrigEMTrackMatchBuilderToolCfg(flags, name='TrigEMTrackMatchBuilder_noGSF'):
acc = ComponentAccumulator()
from egammaTrackTools.egammaTrackToolsConfig import EMExtrapolationToolsCfg
emExtrapolatorTools = recoAcc.popToolsAndMerge(EMExtrapolationToolsCfg(flags))
builderTool = CompFactory.EMTrackMatchBuilder( name, #TODO, this is provate tool, it does not need to be specifically named
TrackParticlesName = TrigEgammaKeys.TrigElectronTracksCollectionName,
ExtrapolationTool = emExtrapolatorTools,
broadDeltaEta = 0.1, #candidate match is done in 2 times this so +- 0.2
broadDeltaPhi = 0.15, #candidate match is done in 2 times this so +- 0.3
useCandidateMatch = True,
useScoring = True,
SecondPassRescale = True,
UseRescaleMetric = True,
isCosmics = flags.Beam.Type=='cosmics')
acc.setPrivateTools(builderTool)
return acc
def TrigEgammaRecElectronCfg(flags, name='TrigEgammaRecElectron_noGSF'):
acc = ComponentAccumulator()
electronRec = CompFactory.egammaRecBuilder( name,
InputTopoClusterContainerName= 'HLT_CaloEMClusters',
egammaRecContainer= TrigEgammaKeys.EgammaRecKey,
doConversions = False,
TrackMatchBuilderTool = recoAcc.popToolsAndMerge(TrigEMTrackMatchBuilderToolCfg(flags)) )
acc.addEventAlgo(electronRec)
return acc
recoAcc.mergeReco( TrigEgammaRecElectronCfg(flags) )
def TrigElectronSuperClusterBuilderCfg(flags):
acc = ComponentAccumulator()
from egammaTools.egammaSwToolConfig import egammaSwToolCfg
from egammaMVACalib.egammaMVACalibConfig import egammaMVASvcCfg
superClusterBuilder = CompFactory.electronSuperClusterBuilder( 'TrigElectronSuperClusterBuilder_noGSF',
InputEgammaRecContainerName = TrigEgammaKeys.EgammaRecKey,
SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName,
ClusterCorrectionTool = recoAcc.popToolsAndMerge(egammaSwToolCfg(flags)),