From 97a0acb29ffac6503cc39129a834b35080683f18 Mon Sep 17 00:00:00 2001 From: Jiri Masik <jiri.masik@cern.ch> Date: Tue, 17 Oct 2023 09:33:21 +0200 Subject: [PATCH] rework FTFCfg to be able to reuse spacePointTool from displaced vertex code rework FTFCfg to be able to reuse spacePointTool from displaced vertex code --- .../python/TrigFastTrackFinderConfig.py | 97 ++++++++++--------- .../src/TrigFastTrackFinder.cxx | 4 - .../src/TrigFastTrackFinder.h | 4 +- .../TrigInDetConfig/python/ConfigSettings.py | 6 -- .../python/ConfigSettingsBase.py | 12 +-- .../python/InDetTrigSequence.py | 2 +- .../src/TrigSpacePointConversionTool.cxx | 4 +- .../src/TrigSpacePointConversionTool.h | 2 +- 8 files changed, 62 insertions(+), 69 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinderConfig.py b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinderConfig.py index 091fedef2ec4..8fadfdff4458 100755 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinderConfig.py +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinderConfig.py @@ -245,54 +245,61 @@ def TrigZFinderCfg(flags : AthConfigFlags, numberingTool) -> ComponentAccumulato ) return acc - -@AccumulatorCache -def TrigFastTrackFinderCfg(flags: AthConfigFlags, name: str, slice_name: str, RoIs: str, inputTracksName:str = None) -> ComponentAccumulator: +def TrigL2LayerNumberToolCfg(flags: AthConfigFlags, **kwargs) -> ComponentAccumulator: acc = ComponentAccumulator() + kwargs.setdefault("UseNewLayerScheme", True) + acc.setPrivateTools(CompFactory.TrigL2LayerNumberTool(**kwargs)) + return acc + +def TrigSpacePointConversionToolCfg(flags: AthConfigFlags, **kwargs) -> ComponentAccumulator: + acc = ComponentAccumulator() + + kwargs.setdefault("UseNewLayerScheme", True) + + if "layerNumberTool" not in kwargs: + ntargs = {"UseNewLayerScheme" : kwargs.get("UseNewLayerScheme")} + kwargs.setdefault("layerNumberTool",acc.popToolsAndMerge(TrigL2LayerNumberToolCfg(flags,**ntargs))) + + kwargs.setdefault("DoPhiFiltering", flags.Tracking.ActiveConfig.DoPhiFiltering) + kwargs.setdefault("UseBeamTilt", False) + kwargs.setdefault("PixelSP_ContainerName", "PixelTrigSpacePoints") + kwargs.setdefault("SCT_SP_ContainerName", "SCT_TrigSpacePoints") + kwargs.setdefault("UsePixelSpacePoints",flags.Tracking.ActiveConfig.UsePixelSpacePoints) - from TrigInDetConfig.ConfigSettings import getInDetTrigConfig - config = getInDetTrigConfig( slice_name ) + from RegionSelector.RegSelToolConfig import regSelTool_SCT_Cfg, regSelTool_Pixel_Cfg - remapped_type = config.name - isCosmicConfig = (remapped_type=="cosmics") + if "RegSelTool_Pixel" not in kwargs: + kwargs.setdefault("RegSelTool_Pixel", acc.popToolsAndMerge( regSelTool_Pixel_Cfg( flags))) - #Global keys/names for collections - from TrigInDetConfig.InDetTrigCollectionKeys import TrigPixelKeys, TrigSCTKeys + if "RegSelTool_SCT" not in kwargs: + kwargs.setdefault("RegSelTool_SCT", acc.popToolsAndMerge( regSelTool_SCT_Cfg( flags))) + # Spacepoint conversion + acc.setPrivateTools(CompFactory.TrigSpacePointConversionTool(**kwargs)) + + return acc + + +@AccumulatorCache +def TrigFastTrackFinderCfg(flags: AthConfigFlags, name: str, RoIs: str, inputTracksName:str = None) -> ComponentAccumulator: + acc = ComponentAccumulator() + + signature = flags.Tracking.ActiveConfig.input_name + isCosmicConfig = (signature=="cosmics") - useNewLayerNumberScheme = True - acc.addPublicTool(CompFactory.TrigL2LayerNumberTool(name="TrigL2LayerNumberTool_FTF", - UseNewLayerScheme = useNewLayerNumberScheme)) - numberingTool = acc.getPublicTool("TrigL2LayerNumberTool_FTF") # GPU offloading config begins - perhaps set from configure if flags.Trigger.InDetTracking.doGPU: acc.addPublicTool(CompFactory.TrigInDetAccelerationTool(name = "TrigInDetAccelerationTool_FTF")) # GPU offloading config ends - - # Spacepoint conversion - from RegionSelector.RegSelToolConfig import regSelTool_SCT_Cfg, regSelTool_Pixel_Cfg - - acc.addPublicTool( - CompFactory.TrigSpacePointConversionTool(name = 'TrigSpacePointConversionTool_' + remapped_type, - DoPhiFiltering = config.DoPhiFiltering, - UseNewLayerScheme = useNewLayerNumberScheme, - UseBeamTilt = False, - PixelSP_ContainerName = TrigPixelKeys.SpacePoints, - SCT_SP_ContainerName = TrigSCTKeys.SpacePoints, - layerNumberTool = numberingTool, - UsePixelSpacePoints = config.UsePixelSpacePoints, - RegSelTool_Pixel = acc.popToolsAndMerge( regSelTool_Pixel_Cfg( flags) ), - RegSelTool_SCT = acc.popToolsAndMerge( regSelTool_SCT_Cfg( flags) ), - ) - ) - - spTool = acc.getPublicTool('TrigSpacePointConversionTool_' + remapped_type) + useNewLayerNumberScheme = True + spTool = acc.popToolsAndMerge(TrigSpacePointConversionToolCfg(flags,UseNewLayerScheme=useNewLayerNumberScheme)) + numberingTool = acc.popToolsAndMerge(TrigL2LayerNumberToolCfg(flags,UseNewLayerScheme=useNewLayerNumberScheme)) from InDetConfig.SiTrackMakerConfig import TrigSiTrackMaker_xkCfg TrackMaker_FTF = acc.popToolsAndMerge( - TrigSiTrackMaker_xkCfg(flags, name = 'InDetTrigSiTrackMaker_FTF_'+slice_name) + TrigSiTrackMaker_xkCfg(flags, name = 'InDetTrigSiTrackMaker_FTF_'+signature) ) acc.addPublicTool(TrackMaker_FTF) @@ -302,21 +309,21 @@ def TrigFastTrackFinderCfg(flags: AthConfigFlags, name: str, slice_name: str, Ro acc.addPublicTool( CompFactory.TrigInDetTrackFitter( - name = "TrigInDetTrackFitter_"+remapped_type, + name = "TrigInDetTrackFitter_"+signature, doBremmCorrection = flags.Tracking.ActiveConfig.doBremRecoverySi, correctClusterPos = True, #improved err(z0) estimates in Run 2 ROTcreator = TrigRotCreator, ) ) - theTrigInDetTrackFitter = acc.getPublicTool("TrigInDetTrackFitter_"+remapped_type) + theTrigInDetTrackFitter = acc.getPublicTool("TrigInDetTrackFitter_"+signature) if (flags.Tracking.ActiveConfig.doZFinder): theTrigZFinder = acc.popToolsAndMerge(TrigZFinderCfg(flags,numberingTool)) - if not config.doZFinderOnly: + if not flags.Tracking.ActiveConfig.doZFinderOnly: from TrkConfig.TrkTrackSummaryToolConfig import InDetTrigTrackSummaryToolCfg, InDetTrigFastTrackSummaryToolCfg - if config.holeSearch_FTF : + if flags.Tracking.ActiveConfig.holeSearch_FTF : trackSummaryTool = acc.popToolsAndMerge(InDetTrigTrackSummaryToolCfg(flags,name="InDetTrigTrackSummaryTool")) else: trackSummaryTool = acc.popToolsAndMerge(InDetTrigFastTrackSummaryToolCfg(flags,name="InDetTrigFastTrackSummaryTool")) @@ -360,23 +367,20 @@ def TrigFastTrackFinderCfg(flags: AthConfigFlags, name: str, slice_name: str, Ro RoIs = RoIs, ) - if config.LRT_D0Min is not None: - ftf.LRT_D0Min = config.LRT_D0Min - - if config.LRT_HardMinPt is not None: - ftf.LRT_HardMinPt = config.LRT_HardMinPt + ftf.LRT_D0Min = flags.Tracking.ActiveConfig.LRT_D0Min + ftf.LRT_HardMinPt = flags.Tracking.ActiveConfig.LRT_HardPtMin - ftf.UseTrigSeedML = config.UseTrigSeedML + ftf.UseTrigSeedML = flags.Tracking.ActiveConfig.UseTrigSeedML if isCosmicConfig: ftf.Doublet_FilterRZ = False from TrigEDMConfig.TriggerEDMRun3 import recordable - if config.dodEdxTrk: + if flags.Tracking.ActiveConfig.dodEdxTrk: ftf.dEdxTrk = recordable("HLT_dEdxTrk") ftf.dEdxHit = recordable("HLT_dEdxHit") - if config.doDisappearingTrk: + if flags.Tracking.ActiveConfig.doDisappearingTrk: ftf.DisTrkCand = recordable("HLT_DisTrkCand") from TrkConfig.TrkGlobalChi2FitterConfig import InDetTrigGlobalChi2FitterCfg InDetTrigTrackFitter = acc.popToolsAndMerge(InDetTrigGlobalChi2FitterCfg(flags)) @@ -384,7 +388,7 @@ def TrigFastTrackFinderCfg(flags: AthConfigFlags, name: str, slice_name: str, Ro ftf.DisTrackFitter = InDetTrigTrackFitter if flags.Tracking.ActiveConfig.doZFinder: - ftf.doZFinderOnly = config.doZFinderOnly + ftf.doZFinderOnly = flags.Tracking.ActiveConfig.doZFinderOnly ftf.trigZFinder = theTrigZFinder ftf.zVertexResolution = 20 if flags.Tracking.ActiveConfig.name == "jetSuper" else 1 ftf.zVertexResolutionEndcap = 150 if flags.Tracking.ActiveConfig.name == "jetSuper" else ftf.zVertexResolution @@ -397,3 +401,4 @@ def TrigFastTrackFinderCfg(flags: AthConfigFlags, name: str, slice_name: str, Ro return acc + diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx index 7ea333858044..81232d7335ef 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx @@ -58,8 +58,6 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator), - m_numberingTool("TrigL2LayerNumberTool"), - m_spacePointTool("TrigSpacePointConversionTool"), m_trackMaker("InDet::SiTrackMaker_xk/InDetTrigSiTrackMaker"), m_trigInDetTrackFitter("TrigInDetTrackFitter"), m_trigZFinder("TrigZFinder/TrigZFinder", this ), @@ -158,8 +156,6 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p declareProperty("RoIs", m_roiCollectionKey = std::string("OutputRoIs"), "RoIs to read in"); //* Tools */ - declareProperty( "SpacePointProviderTool", m_spacePointTool ); - declareProperty( "LayerNumberTool", m_numberingTool ); declareProperty( "initialTrackMaker", m_trackMaker); declareProperty( "trigInDetTrackFitter", m_trigInDetTrackFitter ); declareProperty( "trigZFinder", m_trigZFinder ); diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h index 60a1c28c848a..e1b79cf7a96a 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h @@ -140,8 +140,8 @@ protected: // AlgTools and Services - ToolHandle<ITrigL2LayerNumberTool> m_numberingTool; - ToolHandle<ITrigSpacePointConversionTool> m_spacePointTool; + ToolHandle<ITrigL2LayerNumberTool> m_numberingTool {this, "LayerNumberTool", "TrigL2LayerNumberTool"}; + ToolHandle<ITrigSpacePointConversionTool> m_spacePointTool {this, "SpacePointProviderTool", "TrigSpacePointConversionTool"}; ToolHandle<InDet::ISiTrackMaker> m_trackMaker; ToolHandle<ITrigInDetTrackFitter> m_trigInDetTrackFitter; ToolHandle<ITrigZFinder> m_trigZFinder; diff --git a/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py b/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py index feac489d9fbe..bc48cf819895 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py @@ -410,8 +410,6 @@ class ConfigSettings_fullScanLRT( _ConfigSettingsBase ): self._DoubletDR_Max = 200 self._nClustersMin = 8 self._isLRT = True - self._LRTD0Min = 2.0 - self._LRTHardPtMin = 1.0*GeV #pt config self._maxZImpact = 500. self._maxRPhiImpact = 300. @@ -445,8 +443,6 @@ class ConfigSettings_DJetLRT( _ConfigSettingsBase ): self._DoubletDR_Max = 200 self._nClustersMin = 8 self._isLRT = True - self._LRTD0Min = 2.0 - self._LRTHardPtMin = 1.0*GeV #pt config self._maxZImpact = 500. self._maxRPhiImpact = 300. @@ -480,8 +476,6 @@ class ConfigSettings_DVtxLRT( _ConfigSettingsBase ): self._DoubletDR_Max = 200 self._nClustersMin = 8 self._isLRT = True - self._LRTD0Min = 2.0 - self._LRTHardPtMin = 1.0*GeV #pt config self._maxZImpact = 500. self._maxRPhiImpact = 300. diff --git a/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettingsBase.py b/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettingsBase.py index e27da6f5b02a..fa5ac4da319b 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettingsBase.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettingsBase.py @@ -45,8 +45,8 @@ class _ConfigSettingsBase() : self._nClustersMin = 7 self._roi = None self._isLRT = False - self._LRTD0Min = None - self._LRTHardPtMin = None + self._LRT_D0Min = 2.0 + self._LRT_HardPtMin = 1.0*GeV self._doRecord = True self._vertex = None self._adaptiveVertex = False @@ -228,11 +228,11 @@ class _ConfigSettingsBase() : @property def LRT_D0Min(self): - return self._LRTD0Min + return self._LRT_D0Min @property def LRT_HardMinPt(self): - return self._LRTHardPtMin + return self._LRT_HardPtMin @property def roi(self): @@ -397,8 +397,8 @@ class _ConfigSettingsBase() : log.info( " TrackZ0Max : %s", self._TrackZ0Max ) log.info( " adaptiveVertex : %s", self._adaptiveVertex ) log.info( " isLRT : %s", self._isLRT ) - log.info( " LRTD0Min : %s", self._LRTD0Min ) - log.info( " LRTHardPtmin : %s", self._LRTHardPtMin ) + log.info( " LRTD0Min : %s", self._LRT_D0Min ) + log.info( " LRTHardPtmin : %s", self._LRT_HardPtMin ) log.info( " doHitDV : %s", self._doHitDV ) log.info( " nClustersMin : %s", self._nClustersMin ) log.info( " suffix : %s", self._suffix ) diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigSequence.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigSequence.py index 3344aaab729e..fa2872eb43e1 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigSequence.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigSequence.py @@ -287,7 +287,7 @@ class InDetTrigSequence: from TrigFastTrackFinder.TrigFastTrackFinderConfig import TrigFastTrackFinderCfg acc.merge(TrigFastTrackFinderCfg(flags, "TrigFastTrackFinder_" + signature, - signature, self.__rois, **ftfargs)) + self.__rois, **ftfargs)) if not flags.Tracking.ActiveConfig.doZFinderOnly: from TrigInDetConfig.TrigInDetConfig import trackFTFConverterCfg diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx index 03f319ad18e8..90a3a1fed653 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.cxx @@ -23,15 +23,13 @@ TrigSpacePointConversionTool::TrigSpacePointConversionTool(const std::string& t, const std::string& n, const IInterface* p ) : - AthAlgTool(t,n,p), - m_layerNumberTool("TrigL2LayerNumberTool") + AthAlgTool(t,n,p) { declareInterface< ITrigSpacePointConversionTool >( this ); declareProperty( "DoPhiFiltering", m_filter_phi = true ); declareProperty( "UseBeamTilt", m_useBeamTilt = true ); declareProperty( "UseNewLayerScheme", m_useNewScheme = false ); - declareProperty( "layerNumberTool", m_layerNumberTool); declareProperty( "PixelSP_ContainerName", m_pixelSpacePointsContainerKey = std::string("PixelTrigSpacePoints")); declareProperty( "SCT_SP_ContainerName", m_sctSpacePointsContainerKey = "SCT_TrigSpacePoints" ); declareProperty( "UsePixelSpacePoints", m_usePixelSpacePoints = true ); diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h index 11729f7a0730..9180b7753d87 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigSpacePointConversionTool.h @@ -42,7 +42,7 @@ class TrigSpacePointConversionTool : virtual public ITrigSpacePointConversionToo protected: - ToolHandle<ITrigL2LayerNumberTool> m_layerNumberTool; + ToolHandle<ITrigL2LayerNumberTool> m_layerNumberTool {this, "layerNumberTool", "TrigL2LayerNumberTool"}; const AtlasDetectorID* m_atlasId = nullptr; const SCT_ID* m_sctId = nullptr; -- GitLab