Beispiel #1
0
#
# ----- load primary vertex finder tool
#
# -----------------------------------------

if (not (InDetFlags.primaryVertexSetup() == 'AdaptiveFinding')
        and not (InDetFlags.primaryVertexSetup() == 'AdaptiveMultiFinding')
        and not (InDetFlags.primaryVertexSetup() == 'DefaultVKalVrtFinding')):
    #
    # --- load primary vertex finder tool
    #
    from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool
    InDetPriVxFinderTool_Pix = InDet__InDetPriVxFinderTool(
        name="InDetPriVxFinderTool_Pix",
        PriVxSeedFinder=InDetMultiSeedFinder,
        TrackSelector=InDetTrackSelectorTool_Pix,
        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_Pix.enableMultipleVertices = 1
    else:
        InDetPriVxFinderTool_Pix.enableMultipleVertices = 0

    if rec.Commissioning():
        InDetPriVxFinderTool_Pix.maxChi2PerTrack = 15.

elif InDetFlags.primaryVertexSetup() == 'AdaptiveFinding':
    # --- load adaptive primary vertex finder
    #
                                                     
ToolSvc += InDetVxFitterTool
if InDetFlags.doPrintConfigurables: print      InDetVxFitterTool
#
# ----- load vertex finder tool
#

# LEVEL 1

if not (InDetFlags.primaryVertexSetup() == 'AdaptiveFinding') and not (InDetFlags.primaryVertexSetup() == 'AdaptiveMultiFinding') and not (InDetFlags.primaryVertexSetup() == 'DefaultVKalVrtFinding'):
  #
  # load primary vertex finder tool
  #
  from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool
  InDetPriVxFinderTool = InDet__InDetPriVxFinderTool(name              = "InDetPriVxFinderTool",
                                                     VertexFitterTool  = InDetVxFitterTool,
                                                     TrackSelector     = InDetTrackSelectorTool,
                                                     useBeamConstraint = InDetFlags.useBeamConstraint())
  if jobproperties.Beam.zeroLuminosity():
    InDetPriVxFinderTool.enableMultipleVertices = 0;
  else:
    InDetPriVxFinderTool.enableMultipleVertices = 1;
                                                          
elif InDetFlags.primaryVertexSetup() == 'AdaptiveFinding':
  #
  # load adaptive primary vertex finder
  #

  from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptivePriVxFinderTool
  InDetPriVxFinderTool = InDet__InDetAdaptivePriVxFinderTool(name             = "InDetAdaptivePriVxFinderTool",
                                                             VertexFitterTool = InDetVxFitterTool,
                                                             TrackSelector    = InDetTrackSelectorTool
    def __init__(self,
                 name="TrigVxPrimaryAllTESG_Electron_EF",
                 type="electron"):
        super(InDet__TrigVxPrimaryAllTE, self).__init__(name)

        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.GlobalFlags import GlobalFlags
        from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
        import AthenaCommon.SystemOfUnits as Units

        from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigExtrapolator, InDetTrigTrackSelectorTool

        from InDetTrigRecExample.InDetTrigConfigRecLoadToolsPost import InDetTrigLinFactory
        from InDetMultipleVertexSeedFinderUtils.InDetMultipleVertexSeedFinderUtilsConf import InDet__InDetTrackZ0SortingTool
        InDetTrackZ0SortingTool = InDet__InDetTrackZ0SortingTool(
            name="InDetTrigTrackZ0SortingTool_SG")
        ToolSvc += InDetTrackZ0SortingTool

        from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__Trk2dDistanceSeeder
        Trk2dDistanceSeeder = Trk__Trk2dDistanceSeeder(
            name="TrigTrk2dDistanceSeederFor2D_SG", SolveAmbiguityUsingZ=False)
        ToolSvc += Trk2dDistanceSeeder

        from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__Trk2DDistanceFinder
        Trk2DDistanceFinder = Trk__Trk2DDistanceFinder(
            name="TrigTrk2DDistanceFinder_SG",
            Trk2dDistanceSeeder=Trk2dDistanceSeeder)

        ToolSvc += Trk2DDistanceFinder

        from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__CrossDistancesSeedFinder
        InDet2DVtxSeedFinder = Trk__CrossDistancesSeedFinder(
            name="InDetTrig2DCrossDistancesSeedFinder_SG",
            TrkDistanceFinder=Trk2DDistanceFinder,
            trackdistcutoff=1.,
            trackdistexppower=2,
            useweights=True
            #Mode1dFinder = # default, no setting needed
        )
        ToolSvc += InDet2DVtxSeedFinder

        from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FastVertexFitter
        InDetVxFitterTool = Trk__FastVertexFitter(
            name="InDetTrigFastVertexFitterTool_SG",
            LinearizedTrackFactory=InDetTrigLinFactory,
            Extrapolator=InDetTrigExtrapolator)
        ToolSvc += InDetVxFitterTool

        from InDetMultipleVertexSeedFinder.InDetMultipleVertexSeedFinderConf import InDet__SlidingWindowMultiSeedFinder
        InDetMultiSeedFinder = InDet__SlidingWindowMultiSeedFinder(
            name="InDetTrigSlidingWindowMultiSeedFinder_SG",
            clusterLength=5. * Units.mm,
            TrackSelector=InDetTrigTrackSelectorTool,
            Extrapolator=InDetTrigExtrapolator,
            SortingTool=InDetTrackZ0SortingTool,
            #UseMaxInCluster = True
        )
        ToolSvc += InDetMultiSeedFinder

        from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool
        InDetTrigPriVxFinderTool = InDet__InDetPriVxFinderTool(
            name="InDetTrigPriVxFinderTool_SG",
            PriVxSeedFinder=InDetMultiSeedFinder,
            TrackSelector=InDetTrigTrackSelectorTool,
            VertexFitterTool=InDetVxFitterTool,
            #maxChi2PerTrack   = InDetPrimaryVertexingCuts.MaxChi2PerTrack(),
            #chi2CutMethod     = InDetPrimaryVertexingCuts.chi2CutMethod(),
            enableMultipleVertices=True,
            useBeamConstraint=True)

        ToolSvc += InDetTrigPriVxFinderTool

        self.VertexFinderTool = InDetTrigPriVxFinderTool
        self.RunWithoutField = False
        self.RetrieveTracksFromSG = True
        self.TrackCollectionFromSG = "FTKConv_Trk_Tracks"

        #monitoring
        from InDetTrigPriVxFinder.InDetTrigPriVxFinderMonitoring import InDetTrigPriVxFinderValidationMonitor
        from InDetTrigPriVxFinder.InDetTrigPriVxFinderMonitoring import InDetTrigPriVxFinderOnlineMonitor
        from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig
        vxtime = TrigTimeHistToolConfig("VxTime")
        vxtime.TimerHistLimits = [0, 100]
        from InDetTrigRecExample.InDetTrigSliceSettings import InDetTrigSliceSettings
        if InDetTrigSliceSettings[('doFullScan', type)]:
            vxtime.TimerHistLimits = [0, 400]
        self.AthenaMonTools = [
            InDetTrigPriVxFinderValidationMonitor(
                name="InDetTrigPriVxFinderAllTEOnlineMonitor"),
            InDetTrigPriVxFinderOnlineMonitor(
                name="InDetTrigPriVxFinderAllTEValidationMonitor"), vxtime
        ]
Beispiel #4
0
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)
Beispiel #5
0
                                                 TrackSelector    = InDetTrigTrackSelectorTool,
                                                 SeedFinder = InDetTrigVtxSeedFinder,
                                                 ImpactPoint3dEstimator = InDetTrigImpactPoint3dEstimator,
                                                 LinearizedTrackFactory = InDetTrigLinFactory,
                                                 useBeamConstraint = InDetTrigFlags.useBeamConstraint(),
                                                 significanceCutSeeding = 12,
                                                 maximumChi2cutForSeeding = 49,
                                                 maxVertices = 200,
                                                 )

    else:
        from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetPriVxFinderTool
        InDetTrigPriVxFinderTool = \
            InDet__InDetPriVxFinderTool( name = "InDetTrigPriVxFinderTool",
                                         VertexFitterTool = InDetTrigVxFitterTool,
                                         TrackSelector = InDetTrigTrackSelectorTool,
                                         useBeamConstraint = InDetTrigFlags.useBeamConstraint(),
                                         )

        #from AthenaCommon.BeamFlags import jobproperties
        # if jobproperties.Beam.zeroLuminosity():
        #    InDetTrigPriVxFinderTool.enableMultipleVertices = 0;
        # else:
        InDetTrigPriVxFinderTool.enableMultipleVertices = 1
        #    InDetTrigPriVxFinderTool.useBeamConstraint = InDetTrigFlags.useBeamConstraint()
        if InDetTrigFlags.vertexSeedFinder() == 'SlidingWindowMultiSeedFinder':
            InDetTrigPriVxFinderTool.PriVxSeedFinder = InDetTrigMultiSeedFinder

        #can be switched off by enableMultipleVertices=0?

    InDetTrigPriVxFinderTool.useBeamConstraint = InDetTrigFlags.useBeamConstraint(