Skip to content
Snippets Groups Projects
Commit b4087aad authored by Lukas Novotny's avatar Lukas Novotny Committed by Frank Winklmeier
Browse files

Initial work on offline vertexing started

The offline vertexing (adaptive multi vertex finder) initial work. The changes have not been built or even tested yet.
parent 9c57d314
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
__author__ = "Mark Sutton" __author__ = "Mark Sutton and Lukas Novotny"
__doc__ = "vertexFinder_builder" __doc__ = "vertexFinder_builder"
__all__ = [ "vertexFinder_builder", "makeVertices" ] __all__ = [ "vertexFinder_builder", "makeVertices" ]
...@@ -12,11 +12,65 @@ __all__ = [ "vertexFinder_builder", "makeVertices" ] ...@@ -12,11 +12,65 @@ __all__ = [ "vertexFinder_builder", "makeVertices" ]
# #
# vertexFinder_builder() # vertexFinder_builder()
# #
# function at the end - the rest are just helper # the rest are just helper
# functions to create the relevant tools that are # functions to create the relevant tools that are
# needed along the way # needed along the way
# old function for backwards compatability
#TODO inputTrackCollection is obsolete, remove in the next MR iteration
def makeVertices( whichSignature, inputTrackCollection, outputVtxCollection, config, adaptiveVertexing=False ) :
return vertexFinder_builder( signature = whichSignature,
inputTracks = config.FT.tracksFTF(),
outputVertices = outputVtxCollection,
adaptiveVertexing = adaptiveVertexing )
# actual function to create the vertex finder instance
# needs the tool to actually create the vertices, plus the
# tool to sort them into the desired order, and some monitoring
# here the vertex finder tool is chosen (iterative vs adaptive)
def vertexFinder_builder( signature, inputTracks, outputVertices, adaptiveVertexing ) :
from AthenaCommon.Logging import logging
log = logging.getLogger("InDetVtx")
from TrigEDMConfig.TriggerEDMRun3 import recordable
# create the three subtools for use by the vertexFinder itself ...
# the actual tool which finds the vertices ...
# and actual place which choose between iterative and adaptive vertex finder tools
if adaptiveVertexing :
vertexFinderTool = adaptiveMultiVertexFinderTool_builder( signature )
else :
vertexFinderTool = iterativeVertexFinderTool_builder( signature )
# which are then sorted ...
vertexSortingTool = vertexSortingTool_builder( signature )
# and finally some monitoring ...
vertexMonitoringTool = vertexMonitoringTool_builder( signature )
# no create the vertex finder ...
from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
vertexFinder = InDet__InDetPriVxFinder( name = "InDetTrigPriVxFinder" + signature,
VertexFinderTool = vertexFinderTool,
TracksName = recordable(inputTracks),
VxCandidatesOutputName = recordable(outputVertices),
VertexCollectionSortingTool = vertexSortingTool,
doVertexSorting = True,
PriVxMonTool = vertexMonitoringTool )
log.debug(vertexFinder)
return [ vertexFinder ]
# linearised track factory, whatever that does, for the vertex finder # linearised track factory, whatever that does, for the vertex finder
def linearTrackFactory_builder( signature, extrapolator ) : def linearTrackFactory_builder( signature, extrapolator ) :
...@@ -35,7 +89,7 @@ def linearTrackFactory_builder( signature, extrapolator ) : ...@@ -35,7 +89,7 @@ def linearTrackFactory_builder( signature, extrapolator ) :
# vertex fitter for the vertex finder # vertex fitter for the vertex finder
def vertexFitterTool_builder( signature, linearTrackFactory, extrapolator ) : def iterativeVertexFitterTool_builder( signature, linearTrackFactory, extrapolator ) :
from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ToolSvc
...@@ -132,7 +186,7 @@ def trackDensitySeedFinder_builder( signature ) : ...@@ -132,7 +186,7 @@ def trackDensitySeedFinder_builder( signature ) :
# create the actual vertex finder tool ... # create the actual vertex finder tool ...
def vertexFinderTool_builder( signature ) : def iterativeVertexFinderTool_builder( signature ) :
from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ToolSvc
...@@ -141,7 +195,6 @@ def vertexFinderTool_builder( signature ) : ...@@ -141,7 +195,6 @@ def vertexFinderTool_builder( signature ) :
# the track summary tool, and extrapolator will be needed by multiple # the track summary tool, and extrapolator will be needed by multiple
# tools so create them once and pass them into the builders ... # tools so create them once and pass them into the builders ...
trackSummaryTool = TrackingCommon.getInDetTrackSummaryTool() trackSummaryTool = TrackingCommon.getInDetTrackSummaryTool()
extrapolator = TrackingCommon.getInDetExtrapolator() extrapolator = TrackingCommon.getInDetExtrapolator()
...@@ -152,12 +205,11 @@ def vertexFinderTool_builder( signature ) : ...@@ -152,12 +205,11 @@ def vertexFinderTool_builder( signature ) :
# now create the five sub tools needed ... # now create the five sub tools needed ...
linearTrackFactory = linearTrackFactory_builder( signature, extrapolator )
linearTrackFactory = linearTrackFactory_builder( signature, extrapolator ) vertexFitterTool = iterativeVertexFitterTool_builder( signature, linearTrackFactory, extrapolator )
vertexFitterTool = vertexFitterTool_builder( signature, linearTrackFactory, extrapolator ) impactEstimator = impactEstimator_builder( signature, extrapolator )
impactEstimator = impactEstimator_builder( signature, extrapolator ) trackSelectorTool = trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts )
trackSelectorTool = trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts ) trackDensitySeedFinder = trackDensitySeedFinder_builder( signature )
trackDensitySeedFinder = trackDensitySeedFinder_builder( signature )
# now create the actual vertex finder tool ... # now create the actual vertex finder tool ...
# this is the main part of the actual working part of the code - # this is the main part of the actual working part of the code -
...@@ -182,38 +234,6 @@ def vertexFinderTool_builder( signature ) : ...@@ -182,38 +234,6 @@ def vertexFinderTool_builder( signature ) :
MaxTracks = vtxcuts.MaxTracks() ) MaxTracks = vtxcuts.MaxTracks() )
# InDetAdaptiveMultiPriVxFinderTool job options for later
# verxtexFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool( name = "InDetTrigPriVxFinderTool" + signature,
# VertexFitterTool = vertexFitterTool,
# ...
# VertexFitterTool = vertexFitterTool,
# TrackSelector = trackSelectorTool,
# SeedFinder = trackDensitySeedFinder,
# IPEstimator = Trk::ITrackToVertexIPEstimator : impactEstimator is different type than for IterativeFinder
# BeamSpotKey = InDet::BeamSpotData : what is this ??
# TracksMaxZinterval =
# maxVertexChi2 =
# finalCutMaxVertexChi2 =
# cutVertexDependence =
# MinWeight =
# realMultiVertex =
# useFastCompatibility =
# useBeamConstraint =
# addSingleTrackVertices =
# tracksMaxSignificance =
# m_useSeedConstraint =
# selectiontype =
# //==0 for sum p_t^2
# //==1 for NN
# //==2 for min bias compatibility estimation (in the future)
# maxIterations =
# do3dSplitting =
# zBfieldApprox =
# maximumVertexContamination =
ToolSvc += vertexFinderTool ToolSvc += vertexFinderTool
return vertexFinderTool return vertexFinderTool
...@@ -221,7 +241,6 @@ def vertexFinderTool_builder( signature ) : ...@@ -221,7 +241,6 @@ def vertexFinderTool_builder( signature ) :
# create the vertex sorting tool - this is to sort the vertex candidates into # create the vertex sorting tool - this is to sort the vertex candidates into
# some order so clients can pick the best one off the front and so on ... # some order so clients can pick the best one off the front and so on ...
...@@ -245,64 +264,120 @@ def vertexSortingTool_builder( signature ) : ...@@ -245,64 +264,120 @@ def vertexSortingTool_builder( signature ) :
return vertexSortingTool return vertexSortingTool
# create online vertex monitoring histograms # create online vertex monitoring histograms
def vertexMonitoringTool_builder( signature ) : def vertexMonitoringTool_builder( signature ) :
from InDetPriVxFinder.InDetPriVxFinderMonitoring import InDetPriVxFinderMonitoringTool from InDetPriVxFinder.InDetPriVxFinderMonitoring import InDetPriVxFinderMonitoringTool
return InDetPriVxFinderMonitoringTool() return InDetPriVxFinderMonitoringTool()
#------------------------------------------------------------------------------------------------------------------
# BUILDERS FOR ADAPTIVE MULTI VERTEX TOOL
#------------------------------------------------------------------------------------------------------------------
# create the actual vertex finder tool ...
def adaptiveMultiVertexFinderTool_builder( signature ) :
# actual function to create the vertex finder instance from AthenaCommon.AppMgr import ToolSvc
# needs the tool to actually create the vertices, plus the
# tool to sort them into the desired order, and some monitoring
def vertexFinder_builder( signature, inputTracks, outputVertices ) :
from AthenaCommon.Logging import logging # use the getters from TrackingCommon ...
log = logging.getLogger("InDetVtx") import InDetRecExample.TrackingCommon as TrackingCommon
# the track summary tool, and extrapolator will be needed by multiple
# tools so create them once and pass them into the builders ...
trackSummaryTool = TrackingCommon.getInDetTrackSummaryTool()
extrapolator = TrackingCommon.getInDetExtrapolator()
doVtx3DFinding = True # TODO!!!! InDetFlags.doPrimaryVertex3DFinding()
from TrigEDMConfig.TriggerEDMRun3 import recordable # get the selection cuts use to select the actual tracks in the tool ...
from InDetTrigRecExample.TrigInDetConfiguredVtxCuts import ConfiguredTrigVtxCuts
vtxcuts = ConfiguredTrigVtxCuts()
vtxcuts.printInfo()
# create the three subtools for use by the vertexFinder itself ...
# the actual tool which finde the vertices ... # now create the five sub tools needed ...
vertexFinderTool = vertexFinderTool_builder( signature ) linearTrackFactory = linearTrackFactory_builder( signature, extrapolator )
impactEstimator = impactEstimator_builder( signature, extrapolator )
vertexFitterTool = adaptiveVertexFitterTool_builder( signature, linearTrackFactory, extrapolator,impactEstimator )
trackSelectorTool = trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts )
seedFinder = adaptiveMultiVertexSeedFinder_builder( signature, doVtx3DFinding)
# now create the actual vertex finder tool ...
# this is the main part of the actual working part of the code -
# the vertoces are found by this class, in this instance it includes
# a beam line constraint - it we want this to allow this constrain
# to be disabled we can add a flag and some additional logic
from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptiveMultiPriVxFinderTool
vertexFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool(name = "InDetTrigAdaptiveMultiPriVxFinderTool" + signature,
SeedFinder = seedFinder,
VertexFitterTool = vertexFitterTool,
TrackSelector = trackSelectorTool,
useBeamConstraint = True,
selectiontype = 0, # what is this?
do3dSplitting = doVtx3DFinding)
ToolSvc += vertexFinderTool
return vertexFinderTool
# which are then sorted ...
vertexSortingTool = vertexSortingTool_builder( signature )
# and finally some monitoring ...
vertexMonitoringTool = vertexMonitoringTool_builder( signature )
# no create the vertex finder ... # annealing for adaptive vertex finder
def annealingMaker_builder(signature) :
from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder from AthenaCommon.AppMgr import ToolSvc
vertexFinder = InDet__InDetPriVxFinder( name = "InDetTrigPriVxFinder" + signature, from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__DetAnnealingMaker
VertexFinderTool = vertexFinderTool, annealingMaker = Trk__DetAnnealingMaker(name = "InDetTrigAnnealingMaker" + signature,
TracksName = recordable(inputTracks), SetOfTemperatures = [1.])
VxCandidatesOutputName = recordable(outputVertices), ToolSvc += annealingMaker
VertexCollectionSortingTool = vertexSortingTool,
doVertexSorting = True,
PriVxMonTool = vertexMonitoringTool )
log.debug(vertexFinder) return annealingMaker
# vertex fitter for the vertex finder
# this one is for adaptive vertex finder tool
def adaptiveVertexFitterTool_builder( signature, linearTrackFactory, extrapolator,impactEstimator ) :
from AthenaCommon.AppMgr import ToolSvc
annealingMaker = annealingMaker_builder ( signature )
from TrkVertexFitters.TrkVertexFittersConf import Trk__AdaptiveMultiVertexFitter
vertexFitterTool = Trk__AdaptiveMultiVertexFitter(name = "InDetTrigAdaptiveMultiVertexFitterTool" + signature,
LinearizedTrackFactory = linearTrackFactory,
ImpactPoint3dEstimator = impactEstimator,
AnnealingMaker = annealingMaker,
DoSmoothing = True) # false is default
ToolSvc += vertexFitterTool
return [ vertexFinder ] return vertexFitterTool
# old function for backwards compatability
#TODO inputTrackCollection is obsolete, remove in the next MR iteration
def makeVertices( whichSignature, inputTrackCollection, outputVtxCollection, config ) :
return vertexFinder_builder( signature = whichSignature, def adaptiveMultiVertexSeedFinder_builder( signature , doVtx3DFinding):
inputTracks = config.FT.tracksFTF(),
outputVertices = outputVtxCollection ) from AthenaCommon.AppMgr import ToolSvc
if (doVtx3DFinding): #InDetFlags.doPrimaryVertex3DFinding()
from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__CrossDistancesSeedFinder
seedFinder = Trk__CrossDistancesSeedFinder( name = "InDetTrigCrossDistancesSeedFinder" + signature,
trackdistcutoff = 1.,
trackdistexppower = 2)
else:
from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__ZScanSeedFinder
seedFinder = Trk__ZScanSeedFinder(name = "InDetTrigZScanSeedFinder" + signature
# Mode1dFinder = # default, no setting needed
)
ToolSvc += seedFinder
return seedFinder
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment