From 1d40025c6084fe38fcc45a56d55b4e38b3ae2f03 Mon Sep 17 00:00:00 2001 From: Matthew Joseph Basso <matthew.joseph.basso@cern.ch> Date: Tue, 30 Mar 2021 07:21:07 +0000 Subject: [PATCH] Ensure InDetUsedInVertexFitTrackDecorator accompanies TTVA tool in reco --- .../share/InDetRecPostProcessing.py | 19 ++--- .../InDetRecExample/share/WriteInDetAOD.py | 2 +- .../InDetRecExample/share/WriteInDetESD.py | 2 +- .../TrackVertexAssociationTool/CMakeLists.txt | 1 + .../python/__init__.py | 0 .../python/getTTVAToolForReco.py | 72 +++++++++++++++++++ .../python/SpecialTrackAssociatorConfig.py | 12 ++-- .../share/PhysValMuon_jobOptions.py | 13 +--- .../Jet/JetRec/python/JetAlgorithm.py | 4 -- .../Jet/JetRec/python/JetRecStandardTools.py | 11 +-- .../JetRecTools/python/JetRecToolsConfig.py | 18 +++-- .../python/LegacyRunII/METRecoConfig.py | 5 +- .../python/IsoUpdatedTrackCones.py | 5 +- .../tauRec/python/TauAlgorithmsHolder.py | 8 ++- .../python/TrigTauAlgorithmsHolder.py | 22 +++--- .../HLTMenuConfig/Jet/JetTrackingConfig.py | 14 +--- .../HLTMenuConfig/MET/METRecoSequences.py | 16 +++-- 17 files changed, 134 insertions(+), 90 deletions(-) create mode 100644 InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/__init__.py create mode 100644 InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/getTTVAToolForReco.py diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py index e8f11778a0b5..a71279c57b7d 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py @@ -143,21 +143,10 @@ if InDetFlags.doLowBetaFinder(): # ------------------------------------------------------------------------- if InDetFlags.doTTVADecos(): - from InDetUsedInFitTrackDecoratorTool.InDetUsedInFitTrackDecoratorToolConf import InDet__InDetUsedInFitTrackDecoratorTool - InDetUsedInFitDecoratorTool = InDet__InDetUsedInFitTrackDecoratorTool(name = "InDetUsedInFitDecoratorTool", - AMVFVerticesDecoName = "TTVA_AMVFVertices", - AMVFWeightsDecoName = "TTVA_AMVFWeights", - TrackContainer = InDetKeys.xAODTrackParticleContainer(), - VertexContainer = InDetKeys.xAODVertexContainer()) - ToolSvc += InDetUsedInFitDecoratorTool - - from InDetUsedInVertexFitTrackDecorator.InDetUsedInVertexFitTrackDecoratorConf import InDet__InDetUsedInVertexFitTrackDecorator - InDetUsedInFitDecorator = InDet__InDetUsedInVertexFitTrackDecorator(name = "InDetUsedInFitDecorator", - UsedInFitDecoratorTool = ToolSvc.InDetUsedInFitDecoratorTool) - - topSequence += InDetUsedInFitDecorator - if InDetFlags.doPrintConfigurables(): - printfunc(InDetUsedInFitDecorator) + + # Get a dummy (*unused*) TTVA tool - automatically handles addition of used-in-fit decoration + from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco + getTTVAToolForReco('dummy', TrackContName = InDetKeys.xAODTrackParticleContainer(), VertexContName = InDetKeys.xAODVertexContainer()) # ------------------------------------------------------------------------- # diff --git a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py index 5076d49866e8..a466e795b8db 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetAOD.py @@ -8,7 +8,7 @@ InDetAODList = [] if InDetFlags.doxAOD(): - excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation.-TTVA_AMVFVertices.-TTVA_AMVFWeights" + excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation.-TTVA_AMVFVertices_forReco.-TTVA_AMVFWeights_forReco" if not (InDetFlags.KeepFirstParameters() or InDetFlags.keepAdditionalHitsOnTrackParticle()): excludedAuxData += '.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition' diff --git a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py index d65fdfb62d71..3e205240df49 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py @@ -136,7 +136,7 @@ if globalflags.InputFormat()=='bytestream': if InDetFlags.doxAOD(): - excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation.-TTVA_AMVFVertices.-TTVA_AMVFWeights" + excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation.-TTVA_AMVFVertices_forReco.-TTVA_AMVFWeights_forReco" if not (InDetFlags.KeepFirstParameters() or InDetFlags.keepAdditionalHitsOnTrackParticle()): excludedAuxData += '.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition' diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt index 4933303f91d3..d5cc14d44232 100644 --- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/CMakeLists.txt @@ -37,4 +37,5 @@ if( XAOD_STANDALONE ) endif() # Install files from the package: +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/__init__.py b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/getTTVAToolForReco.py b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/getTTVAToolForReco.py new file mode 100644 index 000000000000..05c6e516e717 --- /dev/null +++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/python/getTTVAToolForReco.py @@ -0,0 +1,72 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +# These are *constants* (OK, the user actually has the ability to change the track/vertex containers in the function calls, +# but the default container names are constants) +_DEFAULT_TRACK_CONT = 'InDetTrackParticles' +_DEFAULT_VERTEX_CONT = 'PrimaryVertices' +_DECO_TOOL_NAME = 'InDetUsedInFitDecoratorTool' +_DECO_ALG_NAME = 'InDetUsedInFitDecorator' +_VERTEX_DECO = 'TTVA_AMVFVertices_forReco' +_WEIGHT_DECO = 'TTVA_AMVFWeights_forReco' + +def _assertDecoValue(kwargs, key, default): + if key in kwargs.keys(): + if kwargs[key] != default: + raise RuntimeError('Property \'%s\' must be \'%s\': %s = %s' % (key, default, key, kwargs[key])) + else: + kwargs[key] = default + +def _mangleName(theName, theSequence): + return theSequence.name()+"_"+theName + +def addUsedInFitDecoratorForReco(TrackContName = _DEFAULT_TRACK_CONT, VertexContName = _DEFAULT_VERTEX_CONT, add2Seq = None): + '''Function for adding a used-in-fit decorator alg to a sequence''' + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + # If not sequence is provided, add the decoration alg to the top sequence + if add2Seq is None: + add2Seq = topSequence + # Name mangling to ensure we do not duplicate names in configs + # with a genuine need for multiple instances in multiple sequences (i.e. trigger) + theToolName = _mangleName(_DECO_TOOL_NAME, add2Seq) + theAlgName = _mangleName(_DECO_ALG_NAME, add2Seq) + if not hasattr(add2Seq, theAlgName): + import AthenaCommon.CfgMgr as CfgMgr + from AthenaCommon.AppMgr import ToolSvc + ToolSvc += CfgMgr.InDet__InDetUsedInFitTrackDecoratorTool( name = theToolName, + AMVFVerticesDecoName = _VERTEX_DECO, + AMVFWeightsDecoName = _WEIGHT_DECO, + TrackContainer = TrackContName, + VertexContainer = VertexContName ) + add2Seq += CfgMgr.InDet__InDetUsedInVertexFitTrackDecorator(name = theAlgName, + UsedInFitDecoratorTool = getattr(ToolSvc, theToolName) ) + return + +def getTTVAToolForReco(name = None, returnCompFactory = False, addDecoAlg = True, add2Seq = None, **kwargs): + '''Function for retrieving a TTVA tool instance and, if it doesn't exist, + for adding a used-in-fit track decorator to a sequence''' + + # First some argument checking + _assertDecoValue(kwargs, 'AMVFVerticesDeco', _VERTEX_DECO) + _assertDecoValue(kwargs, 'AMVFWeightsDeco', _WEIGHT_DECO) + + # If a name has been provided for the TTVA tool, update our kwargs + if name is not None: + kwargs['name'] = name + + # Fetch the track and vertex containers for use in the used-in-fit deco tool + TrackContName, VertexContName = kwargs.get('TrackContName', _DEFAULT_TRACK_CONT), kwargs.pop('VertexContName', _DEFAULT_VERTEX_CONT) + + # Instantiate our TTVA tool + if returnCompFactory: + from AthenaConfiguration.ComponentFactory import CompFactory + tool = CompFactory.getComp("CP::TrackVertexAssociationTool")(**kwargs) + else: + import AthenaCommon.CfgMgr as CfgMgr + tool = CfgMgr.CP__TrackVertexAssociationTool(**kwargs) + + # Add the decorator to the top sequence (if requested) + if addDecoAlg: + addUsedInFitDecoratorForReco(TrackContName, VertexContName, add2Seq) + + return tool diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py index b339ec19c00e..15440572471e 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py @@ -1,10 +1,9 @@ # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -# import the TrackToVertexIPEstimator configurable -CP__TrackVertexAssociationTool=CompFactory.CP.TrackVertexAssociationTool +# Import a reco TTVA tool +from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco def SpecialTrackAssociatorCfg( name = 'SpecialTrackAssociator', PrimaryVertexCollectionName="", useBTagFlagsDefaults = True, **options ): """Sets up a SpecialTrackAssociator tool and returns it. @@ -17,11 +16,10 @@ def SpecialTrackAssociatorCfg( name = 'SpecialTrackAssociator', PrimaryVertexCol output: The actual tool.""" acc = ComponentAccumulator() if useBTagFlagsDefaults: - defaults = { 'WorkingPoint' : 'Loose', - } + defaults = { 'WorkingPoint': 'Loose' } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name - acc.setPrivateTools(CP__TrackVertexAssociationTool( **options)) - + acc.setPrivateTools(getTTVAToolForReco(returnCompFactory=True, **options)) + return acc diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py index 8b51e095ac06..59c52a942c17 100644 --- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py +++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMuon_jobOptions.py @@ -2,17 +2,8 @@ from AthenaCommon.CfgGetter import getPublicTool getPublicTool("MuonCombinedInDetDetailedTrackSelectorTool") algseq = CfgMgr.AthSequencer("AthAlgSeq") -from InDetUsedInFitTrackDecoratorTool.InDetUsedInFitTrackDecoratorToolConf import InDet__InDetUsedInFitTrackDecoratorTool -PhysValMuUsedInFitDecoratorTool = InDet__InDetUsedInFitTrackDecoratorTool(name = "PhysValMuUsedInFitDecoratorTool", - AMVFVerticesDecoName = "TTVA_AMVFVertices", - AMVFWeightsDecoName = "TTVA_AMVFWeights", - TrackContainer = "InDetTrackParticles", - VertexContainer = "PrimaryVertices" ) -ToolSvc += PhysValMuUsedInFitDecoratorTool -from InDetUsedInVertexFitTrackDecorator.InDetUsedInVertexFitTrackDecoratorConf import InDet__InDetUsedInVertexFitTrackDecorator -PhysValMuInDetUsedInFitDecorator = InDet__InDetUsedInVertexFitTrackDecorator(name = "PhysValMuInDetUsedInFitDecorator", - UsedInFitDecoratorTool = ToolSvc.PhysValMuUsedInFitDecoratorTool) -algseq += PhysValMuInDetUsedInFitDecorator +from TrackVertexAssociationTool.getTTVAToolForReco import addUsedInFitDecoratorForReco +addUsedInFitDecoratorForReco(add2Seq = algseq) from IsolationAlgs.IsoUpdatedTrackCones import GetUpdatedIsoTrackCones if not hasattr(algseq,"IsolationBuilderTight500"): algseq += GetUpdatedIsoTrackCones() diff --git a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py index 163cfb21d5fa..79ea227347da 100644 --- a/Reconstruction/Jet/JetRec/python/JetAlgorithm.py +++ b/Reconstruction/Jet/JetRec/python/JetAlgorithm.py @@ -104,10 +104,6 @@ def addJetRecoToAlgSequence(job =None, useTruth =None, eventShapeTools =None, if jetFlags.useTracks: ctools += [jtm.tracksel, jtm.trackselloose_trackjets] if jetFlags.useVertices: - # Decorations may be made by a separate ID algorithm. - if not hasattr (job, 'InDetUsedInFitDecorator'): - ctools += [jtm.tvassocdeco] - ctools += [jtm.tvassoc] # LCOriginTopoClusters and EMOriginTopoClusters are shallow copies diff --git a/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py b/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py index 15f2208f2753..cc23a1855cfc 100644 --- a/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py +++ b/Reconstruction/Jet/JetRec/python/JetRecStandardTools.py @@ -32,7 +32,6 @@ from JetRecTools.JetRecToolsConf import ChargedHadronSubtractionTool from JetRecTools.JetRecToolsConf import JetTrackSelectionTool from JetRecTools.JetRecToolsConf import JetTrackSelectionTool2 from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool -from JetRecTools.JetRecToolsConf import JetUsedInFitTrackDecoratorTool from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool try: @@ -158,14 +157,8 @@ else: # Track-vertex association. #-------------------------------------------------------------- -# Need to add used-in-fit decorator beforehand: -from InDetUsedInFitTrackDecoratorTool.InDetUsedInFitTrackDecoratorToolConf import InDet__InDetUsedInFitTrackDecoratorTool -jtm += InDet__InDetUsedInFitTrackDecoratorTool("jetUsedInFitTrkDecoTool", TrackContainer = jtm.trackContainer, VertexContainer = jtm.vertexContainer) - -jtm += JetUsedInFitTrackDecoratorTool("tvassocdeco", Decorator = jtm.jetUsedInFitTrkDecoTool) - -from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TrackVertexAssociationTool -jtm += CP__TrackVertexAssociationTool("jetLooseTVAtool", WorkingPoint="Custom", d0_cut=2.0, dzSinTheta_cut=2.0) +from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco +jtm += getTTVAToolForReco("jetLooseTVAtool", WorkingPoint="Custom", d0_cut=2.0, dzSinTheta_cut=2.0, TrackContName=jtm.trackContainer, VertexContName=jtm.vertexContainer) jtm += TrackVertexAssociationTool( "tvassoc", diff --git a/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py b/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py index 27a961e90a83..0b7b2c0c9dfd 100644 --- a/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py +++ b/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py @@ -55,18 +55,22 @@ def getTrackSelTool(trkopt="",doWriteTracks=False, cutLevel="Loose", minPt=500): return jettrackselloose -def getTrackVertexAssocTool(trkopt=""): +def getTrackVertexAssocTool(trkopt="", theSequence=None): if trkopt: "_{}".format(trkopt) # Track-vertex association # This is to be deprecated # In fact can probably be switched already to match legacy master # but for a future MR - idtvassoc = CompFactory.getComp("CP::TrackVertexAssociationTool")( + from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco + idtvassoc = getTTVAToolForReco( "idloosetvassoc", WorkingPoint = "Custom", d0_cut = 2.0, dzSinTheta_cut = 2.0, - TrackContName = trackcollectionmap[trkopt]["Tracks"] + TrackContName = trackcollectionmap[trkopt]["Tracks"], + VertexContName = trackcollectionmap[trkopt]["Vertices"], + returnCompFactory = True, + add2Seq=theSequence ) jettvassoc = CompFactory.TrackVertexAssociationTool( @@ -74,7 +78,7 @@ def getTrackVertexAssocTool(trkopt=""): TrackParticleContainer = trackcollectionmap[trkopt]["Tracks"], TrackVertexAssociation = trackcollectionmap[trkopt]["TVA"], VertexContainer = trackcollectionmap[trkopt]["Vertices"], - TrackVertexAssoTool = idtvassoc, + TrackVertexAssoTool = idtvassoc ) return jettvassoc @@ -83,8 +87,10 @@ def getTrackUsedInFitTool(trkopt=""): # InDet decorator tool: IDUsedInFitTrkDecoTool = CompFactory.getComp("InDet::InDetUsedInFitTrackDecoratorTool")( "IDUsedInFitTrkDecoTool", - TrackContainer = trackcollectionmap[trkopt]["Tracks"], - VertexContainer = trackcollectionmap[trkopt]["Vertices"] + TrackContainer = trackcollectionmap[trkopt]["Tracks"], + VertexContainer = trackcollectionmap[trkopt]["Vertices"], + AMVFVerticesDecoName = "TTVA_AMVFVertices_forReco", + AMVFWeightsDecoName = "TTVA_AMVFWeights_forReco" ) # Jet wrapper: JetUsedInFitTrkDecoTool = CompFactory.JetUsedInFitTrackDecoratorTool( diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py index f8d4dfb203cd..7684023b308f 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py @@ -1,4 +1,4 @@ -# 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 __future__ import print_function from AthenaCommon import CfgMgr @@ -241,7 +241,8 @@ class METConfig: maxZ0SinTheta=3, maxD0=2, minPt=500) - self.trkvxtool=CfgMgr.CP__TrackVertexAssociationTool("TrackVertexAssociationTool_MET", WorkingPoint="Nominal") + from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco + self.trkvxtool=getTTVAToolForReco("TrackVertexAssociationTool_MET", WorkingPoint="Nominal") self.trkisotool = CfgMgr.xAOD__TrackIsolationTool("TrackIsolationTool_MET") self.trkisotool.TrackSelectionTool = self.trkseltool # As configured above from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool, Rec__ParticleCaloCellAssociationTool diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py index cfc4bc46a836..094919170953 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py @@ -19,6 +19,7 @@ def GetUpdatedIsoTrackCones(postfix="", object_types=("Electrons", "Photons", "M """ import ROOT + from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco # This is a doubly nested list ptcone_list = [ [ROOT.xAOD.Iso.IsolationType.ptcone40, ROOT.xAOD.Iso.IsolationType.ptcone30, ROOT.xAOD.Iso.IsolationType.ptcone20] @@ -63,8 +64,8 @@ def GetUpdatedIsoTrackCones(postfix="", object_types=("Electrons", "Photons", "M TrackSelectionTool=CfgMgr.InDet__InDetTrackSelectionTool( minPt=track_pt, CutLevel="Loose" ), - TTVATool=CfgMgr.CP__TrackVertexAssociationTool( - WorkingPoint="Loose", + TTVATool=getTTVAToolForReco( + WorkingPoint="Loose" ), CoreTrackEtaRange=0.01 if loose_cone else 0.0, **toolkwargs, diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index 69cd22f29db7..7af55b94742e 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -821,9 +821,11 @@ def getTVATool(): if _name in cached_instances: return cached_instances[_name] - from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TrackVertexAssociationTool - TVATool = CP__TrackVertexAssociationTool(name = _name, - WorkingPoint = "Nonprompt_Hard_MaxWeight") + from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco + TVATool = getTTVAToolForReco(name = _name, + WorkingPoint = "Nonprompt_Hard_MaxWeight", + TrackContName = _DefaultTrackContainer, + VertexContName= _DefaultVertexContainer) from AthenaCommon.AppMgr import ToolSvc ToolSvc += TVATool diff --git a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py index e68a07385825..575869128c56 100644 --- a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py +++ b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py @@ -844,16 +844,18 @@ def getTVATool(): if _name in cached_instances: return cached_instances[_name] - from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TrackVertexAssociationTool - TVATool = CP__TrackVertexAssociationTool(name = _name, - WorkingPoint = "Custom", - d0_cut = 2.5*mm, - use_d0sig = False, - d0sig_cut = -1, - dzSinTheta_cut = 3.0*mm, - doUsedInFit = False, - requirePriVtx=False - ) + from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco + TVATool = getTTVAToolForReco(name = _name, + WorkingPoint = "Custom", + d0_cut = 2.5*mm, + use_d0sig = False, + d0sig_cut = -1, + dzSinTheta_cut = 3.0*mm, + doUsedInFit = False, + requirePriVtx=False, + TrackContName=_DefaultTrackContainer, + VertexContName=_DefaultVertexContainer + ) from AthenaCommon.AppMgr import ToolSvc ToolSvc += TVATool diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py index 4aee716c433b..b9d5b83ef4b0 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py @@ -49,22 +49,10 @@ def JetTrackingSequence(dummyFlags,trkopt,RoIs): if trkopt not in trackcollectionmap.keys(): trackcollectionmap[trkopt] = trkcolls - # Track decoration. - trkdecortool = CompFactory.getComp('InDet::InDetUsedInFitTrackDecoratorTool') \ - ("jetTrkDecorTool", - TrackContainer = trackcollectionmap[trkopt]["Tracks"], - VertexContainer = trackcollectionmap[trkopt]["Vertices"] - ) - trkdecoralg = CompFactory.getComp('InDet::InDetUsedInVertexFitTrackDecorator') \ - ("jetTrkDecorAlg", - UsedInFitDecoratorTool = trkdecortool - ) - jetTrkSeq += conf2toConfigurable( trkdecoralg ) - # Jet track selection jettrackselloose = getTrackSelTool(trkopt,doWriteTracks=True) jettracksname = jettrackselloose.OutputContainer - jettvassoc = getTrackVertexAssocTool(trkopt) + jettvassoc = getTrackVertexAssocTool(trkopt, jetTrkSeq) trackcollectionmap[trkopt]["JetTracks"] = jettracksname diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METRecoSequences.py index c9442641ff3a..0881027345ab 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METRecoSequences.py @@ -28,9 +28,7 @@ from ..Menu.SignatureDicts import JetChainParts_Default from InDetTrackSelectionTool.InDetTrackSelectionToolConf import ( InDet__InDetTrackSelectionTool, ) -from TrackVertexAssociationTool.TrackVertexAssociationToolConf import ( - CP__TrackVertexAssociationTool, -) +from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco import copy log = logging.getLogger(__name__) @@ -269,9 +267,15 @@ class CVFClusterInputConfig(AlgInputConfig): InputVertexKey=inputVertices, OutputCVFKey="CVF", TrackSelectionTool=InDet__InDetTrackSelectionTool(CutLevel="TightPrimary"), - TVATool=CP__TrackVertexAssociationTool( - WorkingPoint="Custom", d0_cut=2.0, dzSinTheta_cut=2.0, - TrackContName = inputTracks, + # Note: Currently (March 2021), this is configured to not use the TTVA decorations + # provided by tracking CP. This will work with the current configured WP. + # + # If you need the decorations, you need to make sure to pass + # this method the correct alg sequence to add to, since it needs + # to schedule an algorithm to provide the information. + TVATool=getTTVAToolForReco( + WorkingPoint="Custom", d0_cut=2.0, dzSinTheta_cut=2.0, addDecoAlg=False, + TrackContName=inputTracks, VertexContName=inputVertices ), ExtensionTool=ApproximateTrackToLayerTool() ) -- GitLab