def vertexFinder_builder( signature, inputTracks, outputVertices ) : 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 finde the vertices ... vertexFinderTool = vertexFinderTool_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 ]
def __init__(self, extension="", InputTrackCollection=None, InputTrackCollectionTruth=None, VxCandidates=None, TrackParticles=None, TrackParticlesTruth=None): # get ToolSvc and topSequence from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() # get InDetFlags from InDetRecExample.InDetJobProperties import InDetFlags # ------------------------------------------------------------ # # --- now load primary vertex finder # # ------------------------------------------------------------ # For ITK we *do* want vertexing to run on forward tracks, so we don't leave out SLHCForward/VeryForward if InDetFlags.doVertexFinding() and not extension == "ForwardTracks": if InDetFlags.primaryVertexSetup() == 'DummyVxFinder': from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxDummyFinder InDetPriVxFinder = InDet__InDetPriVxDummyFinder( name="InDet" + extension + "PriVxDummyFinder", VxCandidatesOutputName=VxCandidates) else: # the loading of all tools for the primary vertex finding has been moved to InDetRecLoadTools.py from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder InDetPriVxFinder = InDet__InDetPriVxFinder( name="InDet" + extension + "PriVxFinder", VertexFinderTool=InDetPriVxFinderTool, TracksName=InputTrackCollection, VxCandidatesOutputName=VxCandidates, VertexCollectionSortingTool=VertexCollectionSortingTool, InternalEdmFactory=InDetVxEdmCnv) if InDetFlags.primaryVertexSortingSetup() == 'NoReSorting': InDetPriVxFinder.doVertexSorting = False else: InDetPriVxFinder.doVertexSorting = True topSequence += InDetPriVxFinder if InDetFlags.doPrintConfigurables(): print InDetPriVxFinder
maximumChi2cutForSeeding=49, maxVertices=200, createSplitVertices=False, InternalEdmFactory=InDetVxEdmCnv, doMaxTracksCut=InDetPrimaryVertexingCuts.doMaxTracksCut(), MaxTracks=InDetPrimaryVertexingCuts.MaxTracks()) ToolSvc += InDetPriVxFinderToolNoBeamConstraint if (InDetFlags.doPrintConfigurables()): print InDetPriVxFinderToolNoBeamConstraint from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder InDetPriVxFinderNoBeamConstraint = InDet__InDetPriVxFinder( name="InDetPriVxFinderNoBeamConstraint", VertexFinderTool=InDetPriVxFinderToolNoBeamConstraint, TracksName=InDetKeys.xAODTrackParticleContainer(), VxCandidatesOutputName=InDetKeys.PrimaryVerticesWithoutBeamConstraint( ), VertexCollectionSortingTool=VertexCollectionSortingTool, doVertexSorting=True, InternalEdmFactory=InDetVxEdmCnv) topSequence += InDetPriVxFinderNoBeamConstraint if InDetFlags.doPrintConfigurables(): print InDetPriVxFinderNoBeamConstraint if InDetFlags.doSplitVertexFindingForMonitoring(): # # Split primary vertexing # from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetIterativePriVxFinderTool InDetPriVxFinderToolSplit = InDet__InDetIterativePriVxFinderTool( name="InDetIterativePriVxFinderToolSplit",
name="InDetVKalPriVxFinder_Pix", TrackSummaryTool=InDetTrackSummaryTool, FitterTool=InDetVxFitterTool, BeamConstraint=0) if InDetFlags.useBeamConstraint(): InDetPriVxFinderTool_Pix.BeamConstraint = 1 ToolSvc += InDetPriVxFinderTool_Pix if (InDetFlags.doPrintConfigurables()): print InDetPriVxFinderTool_Pix from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder InDetPriVxFinder_Pix = InDet__InDetPriVxFinder( name="InDetPriVxFinder_Pix", VertexFinderTool=InDetPriVxFinderTool_Pix, TracksName="ResolvedPixelTracks", VxCandidatesOutputName=InDetKeys.PrimaryVertices() + '_Pix', VertexCollectionSortingTool=VertexCollectionSortingTool, doVertexSorting=doSorting, OutputLevel=DEBUG) topSequence += InDetPriVxFinder_Pix if InDetFlags.doPrintConfigurables(): print InDetPriVxFinder_Pix print "JW" print InDetTrackSelectorTool_Pix print InDetPriVxFinderTool_Pix print InDetPriVxFinder_Pix Stream.AddItem(['VxContainer#VxPrimaryCandidate_Pix']) from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
BeamConstraint = InDetFlags.useBeamConstraint()) ToolSvc += InDetPriVxFinderTool if InDetFlags.doPrintConfigurables: print InDetPriVxFinderTool # # load primary vertex finding algorithm and configure it # # LEVEL 0 from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder InDetPriVxFinders = {} for i in xrange(1,4): for type in ("even", "odd", "all"): InDetPriVxFinders[type+str(i)] = InDet__InDetPriVxFinder(name = "InDetPriVxFinder_"+type+"_"+str(i), VertexFinderTool = InDetPriVxFinderTool, TracksName = type+"_"+str(i)+"_TrackParticleCandidate", VxCandidatesOutputName = type+"_"+str(i)+"_VxPrimaryCandidate") topSequence += InDetPriVxFinders[type+str(i)] if InDetFlags.doPrintConfigurables: print InDetPriVxFinders[type+str(i)] InDetPriVxFinderParent = InDet__InDetPriVxFinder(name = "InDetPriVxFinderParent", VertexFinderTool = InDetPriVxFinderTool, TracksName = "TrackParticleCandidate", VxCandidatesOutputName = "parentVxPrimaryCandidate") topSequence += InDetPriVxFinderParent if InDetFlags.doPrintConfigurables: print InDetPriVxFinderParent # ------------------------------------------------------------ # switch off history service and no dump # ------------------------------------------------------------
from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptiveMultiPriVxFinderTool BeamSpotPriVxFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool( name="BeamSpotAdaptiveMultiPriVxFinderTool", VertexFitterTool=InDetVxFitterTool, TrackSelector=BeamSpotTrackSelectorTool, useBeamConstraint=False, selectiontype=0) ToolSvc += BeamSpotPriVxFinderTool from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder BeamSpotPriVxFinder = InDet__InDetPriVxFinder( name="BeamSpotPriVxFinder", VertexFinderTool=BeamSpotPriVxFinderTool, TracksName=InDetKeys.Tracks(), VxCandidatesOutputName="BeamSpotVxPrimaryCandidate") topSequence += BeamSpotPriVxFinder # # Setup of beamspot finder(s) # doVertexBasedBeamSpot = False doBeamSpotHistogramming = False if doVertexBasedBeamSpot: from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotVertex InDetBeamSpotVertex = InDet__InDetBeamSpotVertex( VertexContainer="BeamSpotVxPrimaryCandidate", MinTracksPerVtx=10,
def GeneralVertexer(system='Combined', setup=None, tracksName=None, suffix=""): """ attempt to make a simple tool for any type of combination of vertexing """ ToolSvc = Service('ToolSvc') hasPix = True if system in ['Combined', 'Pix', 'Resolved'] else False hasSCT = True if system in ['Combined', 'SCT', 'Resolved'] else False hasTRT = True if system in ['Combined', 'TRT'] else False nHitBLayer = InDetPrimaryVertexingCuts.nHitBLayer() if hasPix else 0 nHitPix = InDetPrimaryVertexingCuts.nHitPix() if hasPix else 0 nHitBLayerPlusPix = InDetPrimaryVertexingCuts.nHitBLayerPlusPix( ) if hasPix else 0 nHitSct = InDetPrimaryVertexingCuts.nHitSct() if hasSCT else 0 nHitSi = InDetPrimaryVertexingCuts.nHitSi() if hasSCT else 0 nHitTrt = InDetPrimaryVertexingCuts.nHitTrt() if hasTRT else 0 vxSetup = InDetFlags.primaryVertexSetup() if setup == None else setup print "JW: Setup is: ", system, hasPix, hasSCT, hasTRT, tracksName, setup, vxSetup #Extras try: InDetTrackZ0SortingTool = ToolSvc.InDetTrackZ0SortingTool except: from InDetMultipleVertexSeedFinderUtils.InDetMultipleVertexSeedFinderUtilsConf import InDet__InDetTrackZ0SortingTool InDetTrackZ0SortingTool = InDet__InDetTrackZ0SortingTool( name="InDetTrackZ0SortingTool") ToolSvc += InDetTrackZ0SortingTool if (InDetFlags.doPrintConfigurables()): print InDetTrackZ0SortingTool try: InDetSlidingWindowMultiSeedFinder = ToolSvc.InDetSlidingWindowMultiSeedFinder except: from InDetMultipleVertexSeedFinder.InDetMultipleVertexSeedFinderConf import InDet__SlidingWindowMultiSeedFinder InDetSlidingWindowMultiSeedFinder = InDet__SlidingWindowMultiSeedFinder( name="InDetSlidingWindowMultiSeedFinder", clusterLength=5. * mm, TrackSelector=InDetTrackSelectorTool, Extrapolator=InDetExtrapolator, SortingTool=InDetTrackZ0SortingTool, #UseMaxInCluster = True ) ToolSvc += InDetSlidingWindowMultiSeedFinder #Load additional fitters: try: InDetVKalVrtFitter = ToolSvc.InDetVKalVrtFitter print " JW Found InDetVKalVrtFitter" except: print " JW no InDetVKalVrtFitter" from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter InDetVKalVrtFitter = Trk__TrkVKalVrtFitter(name="InDetVKalVrtFitter") ToolSvc += InDetVKalVrtFitter if (InDetFlags.doPrintConfigurables()): print InDetVKalVrtFitter try: InDetVxFitterToolFastFinder = ToolSvc.InDetVxFitterToolFastFinder print " JW: found InDetVxFitterToolFastFinder" except: print "JW no InDetVxFitterToolFastFinder" from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FastVertexFitter InDetVxFitterToolFastFinder = Trk__FastVertexFitter( name="InDetVxFitterToolFastFinder", LinearizedTrackFactory=InDetLinFactory, Extrapolator=InDetExtrapolator) ToolSvc += InDetVxFitterToolFastFinder if (InDetFlags.doPrintConfigurables()): print InDetVxFitterToolFastFinder try: InDetVxFitterToolFullFinder = ToolSvc.InDetVxFitterToolFullFinder print "JW found InDetVxFitterToolFullFinder" except: print "JW no InDetVxFitterToolFullFinder" from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FullVertexFitter InDetVxFitterToolFullFinder = Trk__FullVertexFitter( name="InDetVxFitterToolFullFinder", LinearizedTrackFactory=InDetLinFactory, Extrapolator=InDetExtrapolator) ToolSvc += InDetVxFitterToolFullFinder if (InDetFlags.doPrintConfigurables()): print InDetVxFitterToolFullFinder try: print "JW Found InDetVxFitterToolSequential" except: print "JW no InDetVxFitterToolSequential" from TrkVertexFitters.TrkVertexFittersConf import Trk__SequentialVertexSmoother InDetVertexSmoother = Trk__SequentialVertexSmoother( name="InDetVertexSmoother") ToolSvc += InDetVertexSmoother if (InDetFlags.doPrintConfigurables()): print InDetVertexSmoother from TrkVertexFitters.TrkVertexFittersConf import Trk__SequentialVertexFitter InDetVxFitterToolSequential = Trk__SequentialVertexFitter( name="InDetSequentialVxFitterTool", LinearizedTrackFactory=InDetLinFactory, VertexSmoother=InDetVertexSmoother #VertexUpdator = # no setting required ) ToolSvc += InDetVxFitterToolSequential if (InDetFlags.doPrintConfigurables()): print InDetVxFitterToolSequential from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool InDetTrackSelectorTool_vx = InDet__InDetDetailedTrackSelectorTool( name="InDetDetailedTrackSelectorTool_" + system + "_" + vxSetup + suffix, pTMin=InDetPrimaryVertexingCuts.minPT(), IPd0Max=InDetPrimaryVertexingCuts.IPd0Max(), IPz0Max=InDetPrimaryVertexingCuts.IPz0Max(), z0Max=InDetPrimaryVertexingCuts.z0Max(), sigIPd0Max=InDetPrimaryVertexingCuts.sigIPd0Max(), sigIPz0Max=InDetPrimaryVertexingCuts.sigIPz0Max(), d0significanceMax=InDetPrimaryVertexingCuts.d0significanceMax(), z0significanceMax=InDetPrimaryVertexingCuts.z0significanceMax(), etaMax=InDetPrimaryVertexingCuts.etaMax(), useTrackSummaryInfo=InDetPrimaryVertexingCuts.useTrackSummaryInfo(), nHitBLayer=nHitBLayer, nHitPix=nHitPix, nHitBLayerPlusPix=nHitBLayerPlusPix, nHitSct=nHitSct, nHitSi=nHitSi, nHitTrt=nHitTrt, nHitTrtHighEFractionMax=InDetPrimaryVertexingCuts. nHitTrtHighEFractionMax(), nHitTrtHighEFractionWithOutliersMax=InDetPrimaryVertexingCuts. nHitTrtHighEFractionWithOutliersMax(), useSharedHitInfo=InDetPrimaryVertexingCuts.useSharedHitInfo(), useTrackQualityInfo=InDetPrimaryVertexingCuts.useTrackQualityInfo(), fitChi2OnNdfMax=InDetPrimaryVertexingCuts.fitChi2OnNdfMax(), TrtMaxEtaAcceptance=InDetPrimaryVertexingCuts.TrtMaxEtaAcceptance(), TrackSummaryTool=InDetTrackSummaryTool, Extrapolator=InDetExtrapolator) ToolSvc += InDetTrackSelectorTool_vx if (InDetFlags.doPrintConfigurables()): print InDetTrackSelectorTool_vx # ----------------------------------------- # # ----- load primary vertex finder tool # # ----------------------------------------- if (not (vxSetup == 'AdaptiveFinding') and not (vxSetup == 'AdaptiveMultiFinding') and not (vxSetup == 'DefaultVKalVrtFinding') and not (vxSetup == 'InDetPriVxFinderFullFinder') and not (vxSetup == 'InDetPriVxFinderFastFinder')): # # --- load primary vertex finder tool # from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool InDetPriVxFinderTool_vx = InDet__InDetPriVxFinderTool( name="InDetPriVxFinderTool_" + system + "_" + vxSetup + suffix, PriVxSeedFinder=InDetMultiSeedFinder, TrackSelector=InDetTrackSelectorTool_vx, VertexFitterTool=InDetVxFitterTool, chi2CutMethod=2, useBeamConstraint=InDetFlags.useBeamConstraint()) if jobproperties.Beam.numberOfCollisions( ) > 2.0: # 900 GeV running at "zero lumi" has 2.0 for this variable InDetPriVxFinderTool_vx.enableMultipleVertices = 1 else: InDetPriVxFinderTool_vx.enableMultipleVertices = 0 if rec.Commissioning(): InDetPriVxFinderTool_vx.maxChi2PerTrack = 15. elif vxSetup == 'AdaptiveFinding': # # --- load adaptive primary vertex finder # from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetIterativePriVxFinderTool InDetPriVxFinderTool_vx = InDet__InDetIterativePriVxFinderTool( name="InDetIterativePriVxFinderTool_" + system + "_" + vxSetup + suffix, VertexFitterTool=InDetVxFitterTool, TrackSelector=InDetTrackSelectorTool_vx, SeedFinder=InDetVtxSeedFinder, ImpactPoint3dEstimator=InDetImpactPoint3dEstimator, LinearizedTrackFactory=InDetLinFactory, useBeamConstraint=InDetFlags.useBeamConstraint(), significanceCutSeeding=12, maximumChi2cutForSeeding=49, maxVertices=25) elif vxSetup == 'AdaptiveMultiFinding': # # --- load adaptive multi primary vertex finder # from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptiveMultiPriVxFinderTool InDetPriVxFinderTool_vx = InDet__InDetAdaptiveMultiPriVxFinderTool( name="InDetAdaptiveMultiPriVxFinderTool_" + system + "_" + vxSetup + suffix, SeedFinder=InDetVtxSeedFinder, VertexFitterTool=InDetVxFitterTool, TrackSelector=InDetTrackSelectorTool_vx, useBeamConstraint=InDetFlags.useBeamConstraint(), selectiontype=0, do3dSplitting=InDetFlags.doPrimaryVertex3DFinding()) #Add additional finder tools elif vxSetup == 'InDetPriVxFinderFastFinder': # not the official name from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool InDetPriVxFinderTool_vx = InDet__InDetPriVxFinderTool( name="InDetPriVxFinderToolFastFinder_" + system + "_" + vxSetup + suffix, VertexFitterTool=InDetVxFitterToolFastFinder, PriVxSeedFinder=InDetSlidingWindowMultiSeedFinder, TrackSelector=InDetTrackSelectorTool_vx, useBeamConstraint=InDetFlags.useBeamConstraint()) if jobproperties.Beam.zeroLuminosity(): InDetPriVxFinderTool_vx.enableMultipleVertices = 0 else: InDetPriVxFinderTool_vx.enableMultipleVertices = 1 elif vxSetup == 'InDetPriVxFinderFullFinder': from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool InDetPriVxFinderTool_vx = InDet__InDetPriVxFinderTool( name="InDetPriVxFinderToolFullFinder_" + system + "_" + vxSetup + suffix, VertexFitterTool=InDetVxFitterToolFullFinder, PriVxSeedFinder=InDetSlidingWindowMultiSeedFinder, TrackSelector=InDetTrackSelectorTool_vx, useBeamConstraint=InDetFlags.useBeamConstraint()) if jobproperties.Beam.zeroLuminosity(): InDetPriVxFinderTool_vx.enableMultipleVertices = 0 else: InDetPriVxFinderTool_vx.enableMultipleVertices = 1 ToolSvc += InDetPriVxFinderTool_vx if (InDetFlags.doPrintConfigurables()): print InDetPriVxFinderTool_vx from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder InDetPriVxFinder_vx = InDet__InDetPriVxFinder( name="InDetPriVxFinder_" + system + "_" + vxSetup, VertexFinderTool=InDetPriVxFinderTool_vx, TracksName=tracksName, VxCandidatesOutputName=InDetKeys.PrimaryVertices() + "_" + system + "_" + vxSetup + suffix, VertexCollectionSortingTool=VertexCollectionSortingTool, doVertexSorting=doSorting, OutputLevel=DEBUG) from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += InDetPriVxFinder_vx pvFinders.append(InDetPriVxFinder_vx) primaryVertices.append(InDetPriVxFinder_vx.VxCandidatesOutputName) if InDetFlags.doPrintConfigurables(): print InDetPriVxFinder_vx Stream.AddItem([ 'VxContainer#' + InDetKeys.PrimaryVertices() + "_" + system + "_" + vxSetup + suffix ]) return (InDetTrackSelectorTool_vx, InDetPriVxFinderTool_vx, InDetPriVxFinder_vx)