diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx index 3d27dea70d6a34b9ecd4ed0b1b848c28f7aae39c..af02eca10c188127b9a6568914ddc4c09a8fa729 100644 --- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx +++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/Root/TrackVertexAssociationTool.cxx @@ -244,6 +244,7 @@ TrackVertexAssociationTool::TrackVertexAssociationTool(const std::string& name) m_d0sig_cut(-1), m_dzSinTheta_cut(-1), m_doUsedInFit(false), + m_doPVPriority(false), m_requirePriVtx(false), m_hardScatterDeco("hardScatterVertexLink"), m_trkContName("InDetTrackParticles") @@ -254,6 +255,7 @@ TrackVertexAssociationTool::TrackVertexAssociationTool(const std::string& name) declareProperty("d0sig_cut", m_d0sig_cut, "Cut on d0Sig. Not applied if set to -1."); declareProperty("dzSinTheta_cut", m_dzSinTheta_cut, "Cut on |dz*sinTheta| (in mm). Not applied if set to -1."); declareProperty("doUsedInFit", m_doUsedInFit, "Control whether to allow for a MatchStatus of UsedInFit."); + declareProperty("doPVPriority", m_doPVPriority, "Control whether to give priority to matching to PV instead of closest vertex."); declareProperty("requirePriVtx", m_requirePriVtx, "Control whether a vertex must be VxType::PriVtx in order for a track (not UsedInFit) to be uniquely matched to it."); declareProperty("HardScatterLinkDeco", m_hardScatterDeco, "The decoration name of the ElementLink to the hardscatter vertex (found on xAOD::EventInfo)"); declareProperty("TrackContName", m_trkContName, "The name of the xAOD::TrackParticleContainer to access the AMVF vertices+weights for (not actually read)."); @@ -474,6 +476,7 @@ const xAOD::Vertex* TrackVertexAssociationTool::getUniqueMatchVertexInternal(con if (dzSinTheta < min_dz) { min_dz = dzSinTheta; bestMatchVertex = vertex; + if(m_doPVPriority) break; //This will stop the iteration on the vertices. This works since the PV should always be the first entry in the vertex collection } } } diff --git a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h index 7da0d2be1cfec26253bf4440451c87d629e875df..f254830f583db6c93ce5d15a19d4b8757c2a9459 100644 --- a/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h +++ b/InnerDetector/InDetRecTools/TrackVertexAssociationTool/TrackVertexAssociationTool/TrackVertexAssociationTool.h @@ -123,6 +123,9 @@ namespace CP { /// Flag to cut on d0sig instead of d0. bool m_doUsedInFit; + /// Flag to switch priority to match the primary vertex instead of closest vertex. + bool m_doPVPriority; + /// Flag to cut on d0sig instead of d0. bool m_requirePriVtx; diff --git a/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py b/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py index 0b7b2c0c9dfdd84cfd1f5d2abe2f5aa6ad6f2216..c5b8abe15fe8c73a48ddb47b5670e38eb81c0349 100644 --- a/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py +++ b/Reconstruction/Jet/JetRecTools/python/JetRecToolsConfig.py @@ -55,22 +55,21 @@ def getTrackSelTool(trkopt="",doWriteTracks=False, cutLevel="Loose", minPt=500): return jettrackselloose -def getTrackVertexAssocTool(trkopt="", theSequence=None): +def getTrackVertexAssocTool(trkopt="", theSequence=None, ttva_opts = { "WorkingPoint" : "Custom", "d0_cut" : 2.0, "dzSinTheta_cut" : 2.0 }): 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 from TrackVertexAssociationTool.getTTVAToolForReco import getTTVAToolForReco + idtvassoc = getTTVAToolForReco( "idloosetvassoc", - WorkingPoint = "Custom", - d0_cut = 2.0, - dzSinTheta_cut = 2.0, TrackContName = trackcollectionmap[trkopt]["Tracks"], VertexContName = trackcollectionmap[trkopt]["Vertices"], returnCompFactory = True, - add2Seq=theSequence + add2Seq=theSequence, + **ttva_opts ) jettvassoc = CompFactory.TrackVertexAssociationTool( diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py index 95d8841e778567ce1bab03197805554ff4b7d980..ef44a4e02d5cf5e24b85c94d46439cd57b94073f 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py @@ -366,6 +366,9 @@ def createTriggerFlags(): # the minimum pT threshold to use for the muon removal flags.addFlag("Trigger.FSHad.PFOMuonRemovalMinPt", 10 * GeV) + # Switch on AMVF vertice and priority TTVA for jet slice + flags.addFlag("Trigger.Jet.doAMVFPriorityTTVA", False) + return flags # for reference, this flags are skipped as never used or never set in fact, or set identical to de default or used in a very old JO: # fakeLVL1, useCaloTTL diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py index f6dab21968b983fdad89d753d4f53d980cbef75b..22f401f2b5f6b9cd20a048e352d0651b202629b1 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py @@ -228,6 +228,7 @@ def getFilterCut(recoAlg): def defineCalibMods(jetRecoDict,dataSource,rhoKey="auto"): from TrigInDetConfig.ConfigSettings import getInDetTrigConfig + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags config = getInDetTrigConfig( 'jet' ) @@ -259,7 +260,7 @@ def defineCalibMods(jetRecoDict,dataSource,rhoKey="auto"): gscDepth = "EM3" if "gsc" in jetRecoDict["jetCalib"]: gscDepth = "trackWIDTH" - pvname = config.vertex_jet + pvname = config.vertex if flags.Trigger.Jet.doAMVFPriorityTTVA else config.vertex_jet elif jetRecoDict["constitType"] == "pf": gscDepth = "auto" @@ -273,7 +274,7 @@ def defineCalibMods(jetRecoDict,dataSource,rhoKey="auto"): ("a4","subjesgscIS"): ("TrigLS2","JetArea_EtaJES_GSC"), # w/o pu residual + calo+trk GSC ("a4","subresjesgscIS"): ("TrigLS2","JetArea_Residual_EtaJES_GSC"), # pu residual + calo+trk GSC }[(jetRecoDict["recoAlg"],jetRecoDict["jetCalib"])] - pvname = config.vertex_jet + pvname = config.vertex if flags.Trigger.Jet.doAMVFPriorityTTVA else config.vertex_jet if jetRecoDict["jetCalib"].endswith("IS") and (dataSource=="data"): calibSeq += "_Insitu" diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py index f6e5cef48d02880c5295092c34993f49ba17febf..9e5fc543cdd3c36dea6b699289cd3e21aa66d432 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetTrackingConfig.py @@ -7,6 +7,8 @@ from AthenaCommon.CFElements import parOR from JetRecTools.JetRecToolsConfig import getTrackVertexAssocTool from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable +from TrigInDetConfig.TrigInDetPriVtxConfig import makeVertices + # these keys are not used in this file, they are used elsewhere, so # wouldn;t it be better to actually define them in the file where they @@ -17,6 +19,7 @@ trkcollskeys = ["Tracks", "Vertices", "TVA", "GhostTracks", "GhostTracksLabel", def JetTrackingSequence(dummyFlags,trkopt,RoIs): + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags jetTrkSeq = parOR( "JetTrackingSeq_"+trkopt, []) @@ -31,13 +34,18 @@ def JetTrackingSequence(dummyFlags,trkopt,RoIs): jetTrkSeq += viewAlgs # add the collections for the eflowRec reconstriction in the trigger + from eflowRec.PFHLTSequence import trackvtxcontainers - trackvtxcontainers["ftf"] = ( IDTrigConfig.tracks_FTF(), IDTrigConfig.vertex_jet ) + trackvtxcontainers["ftf"] = ( IDTrigConfig.tracks_FTF(), IDTrigConfig.vertex if flags.Trigger.Jet.doAMVFPriorityTTVA else IDTrigConfig.vertex_jet ) # now run he actual vertex finders and TTVA tools - _ = jetVertex( "amvf", jetTrkSeq, trkopt+"_amvf", IDTrigConfig, verticesname=IDTrigConfig.vertex, adaptiveVertex=IDTrigConfig.adaptiveVertex, ) - trackcollmap = jetVertex( "jet", jetTrkSeq, trkopt, IDTrigConfig, verticesname=IDTrigConfig.vertex_jet, adaptiveVertex=IDTrigConfig.adaptiveVertex_jet ) - + if flags.Trigger.Jet.doAMVFPriorityTTVA: + trackcollmap = jetVertex( "jet", jetTrkSeq, trkopt, IDTrigConfig, verticesname=IDTrigConfig.vertex, adaptiveVertex=IDTrigConfig.adaptiveVertex, ) + else: + vtxAlgs = makeVertices( "amvf", IDTrigConfig.tracks_FTF(), IDTrigConfig.vertex, IDTrigConfig, IDTrigConfig.adaptiveVertex ) + jetTrkSeq += vtxAlgs[-1] + trackcollmap = jetVertex( "jet", jetTrkSeq, trkopt, IDTrigConfig, verticesname=IDTrigConfig.vertex_jet, adaptiveVertex=IDTrigConfig.adaptiveVertex_jet, ) + return jetTrkSeq, trackcollmap @@ -50,13 +58,11 @@ def jetVertex( signature, jetseq, trkopt, config, verticesname=None, adaptiveVer if verticesname is None: verticesname = config.vertex - if adaptiveVertex is None: adaptiveVertex = config.adaptiveVertex - tracksname = config.tracks_FTF() + tracksname = config.tracks_FTF() - from TrigInDetConfig.TrigInDetPriVtxConfig import makeVertices vtxAlgs = makeVertices( signature, tracksname, verticesname, config, adaptiveVertex ) prmVtx = vtxAlgs[-1] jetseq += prmVtx @@ -64,7 +70,7 @@ def jetVertex( signature, jetseq, trkopt, config, verticesname=None, adaptiveVer outmap = None # track to vertex association ... - + tvaname = "JetTrackVtxAssoc_"+trkopt label = "GhostTrack_{}".format(trkopt) ghosttracksname = "PseudoJet{}".format(label) @@ -81,7 +87,6 @@ def jetVertex( signature, jetseq, trkopt, config, verticesname=None, adaptiveVer } trackcollectionmap[trkopt] = trkcolls - # why is some of this adding of parameters to the trackcollectionmap # done here, and some in getTrackSelTool ? Could these two functions # not be combined or broken up into more transparent smaller functions ? @@ -93,7 +98,13 @@ def jetVertex( signature, jetseq, trkopt, config, verticesname=None, adaptiveVer trackcollectionmap[trkopt]["JetTracks"] = jettracksname prepname = "jetalg_TrackPrep"+trkopt - jettvassoc = getTrackVertexAssocTool( trkopt, jetseq ) + jettvassoc = getTrackVertexAssocTool( trkopt, jetseq , + ttva_opts = { "WorkingPoint" : "Custom", + "d0_cut" : 2.0, + "dzSinTheta_cut" : 2.0, + "doPVPriority": adaptiveVertex, + } + ) jettrkprepalg = CompFactory.JetAlgorithm(prepname) jettrkprepalg.Tools = [ jettrackselloose, jettvassoc ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/IsoHighPtTrackTriggerConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/IsoHighPtTrackTriggerConfiguration.py index 8286561d0b1490d730bbbe40535bae3d37b38ae2..9b23fd6cf91958aecf3714ee8336a99ce0b28b3b 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/IsoHighPtTrackTriggerConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/IsoHighPtTrackTriggerConfiguration.py @@ -20,8 +20,12 @@ def FTFTrackSequence(ConfigFlags): TrkInputNoViewAlg = makeInDetAlgsNoView( config=IDTrigConfig, rois=caloFSRoI ) from TrigInDetConfig.TrigInDetPriVtxConfig import makeVertices + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags + + VTX_NAME = IDTrigConfig.vertex if flags.Trigger.Jet.doAMVFPriorityTTVA else IDTrigConfig.vertex_jet + ADAPTIVE_VTX = IDTrigConfig.adaptiveVertex if flags.Trigger.Jet.doAMVFPriorityTTVA else IDTrigConfig.adaptiveVertex_jet - vtxAlgs = makeVertices( "jet", IDTrigConfig.tracks_FTF(), IDTrigConfig.vertex_jet, IDTrigConfig, adaptiveVertex=IDTrigConfig.adaptiveVertex_jet ) + vtxAlgs = makeVertices( "jet", IDTrigConfig.tracks_FTF(), VTX_NAME, IDTrigConfig, adaptiveVertex=ADAPTIVE_VTX) prmVtx = vtxAlgs[-1] TrkSeq = [InputMakerAlg,TrkInputNoViewAlg, prmVtx]