示例#1
0
def InDetGlobalChi2FitterBase(name='GlobalChi2FitterBase', **kwargs):
    from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
    from InDetRecExample.TrackingCommon import setDefaults
    from AthenaCommon.AppMgr import ToolSvc
    from InDetRecExample.InDetJobProperties import InDetFlags
    import InDetRecExample.TrackingCommon as TrackingCommon

    kwargs = setDefaults(
        kwargs,
        ExtrapolationTool=TrackingCommon.getInDetExtrapolator(),
        NavigatorTool=TrackingCommon.getInDetNavigator(),
        PropagatorTool=TrackingCommon.getInDetPropagator(),
        MultipleScatteringTool=TrackingCommon.
        getInDetMultipleScatteringUpdator(),
        MeasurementUpdateTool=ToolSvc.InDetUpdator,
        TrackingGeometrySvc=AtlasTrackingGeometrySvc,
        MaterialUpdateTool=TrackingCommon.getInDetMaterialEffectsUpdator(),
        StraightLine=not InDetFlags.solenoidOn(),
        OutlierCut=4,
        SignedDriftRadius=True,
        ReintegrateOutliers=True,
        RecalibrateSilicon=True,
        RecalibrateTRT=True,
        TRTTubeHitCut=
        1.75,  # use tighter hit classification, old: TrackingCommon.default_ScaleHitUncertainty
        MaxIterations=40,
        Acceleration=True,
        RecalculateDerivatives=InDetFlags.doMinBias()
        or InDetFlags.doCosmics() or InDetFlags.doBeamHalo(),
        TRTExtensionCuts=True,
        TrackChi2PerNDFCut=7)
    from TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf import Trk__GlobalChi2Fitter
    return Trk__GlobalChi2Fitter(name, **kwargs)
示例#2
0
def DistributedKalmanFilter(name="DistributedKalmanFilter", **kwargs):
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

    from InDetRecExample.TrackingCommon import setDefaults
    if 'ExtrapolatorTool' not in kwargs:
        kwargs = setDefaults(
            kwargs, ExtrapolatorTool=TrackingCommon.getInDetExtrapolator())

    from InDetRecExample import TrackingCommon as TrackingCommon
    if 'ROTcreator' not in kwargs:
        kwargs = setDefaults(
            kwargs,
            ROTcreator=TrackingCommon.getInDetRotCreator(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))

    # @TODO set sortingReferencePoint = ???
    from TrkDistributedKalmanFilter.TrkDistributedKalmanFilterConf import Trk__DistributedKalmanFilter
    return Trk__DistributedKalmanFilter(name=name, **kwargs)
示例#3
0
def InDetKalmanTrackFitterBase(name='InDetKalmanTrackFitterBase', **kwargs):
    from InDetRecExample import TrackingCommon as TrackingCommon
    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanFitter
    from AthenaCommon.AppMgr import ToolSvc
    split_cluster_map_extension = kwargs.get('SplitClusterMapExtension', '')

    kwargs.setdefault('ExtrapolatorHandle',
                      TrackingCommon.getInDetExtrapolator())
    if 'RIO_OnTrackCreatorHandle' not in kwargs:
        from InDetRecExample import TrackingCommon as TrackingCommon
        kwargs = setDefaults(
            kwargs,
            RIO_OnTrackCreatorHandle=TrackingCommon.getInDetRefitRotCreator(
                SplitClusterMapExtension=split_cluster_map_extension))

    kwargs.setdefault('MeasurementUpdatorHandle', ToolSvc.InDetUpdator)
    setTool('KalmanSmootherHandle', 'InDetBKS', kwargs)
    setTool('KalmanOutlierLogicHandle', 'InDetKOL', kwargs)
    kwargs.setdefault('DynamicNoiseAdjustorHandle', None)
    kwargs.setdefault('BrempointAnalyserHandle', None)
    kwargs.setdefault('AlignableSurfaceProviderHandle', None)
    if len(split_cluster_map_extension) > 0:
        if 'RecalibratorHandle' not in kwargs:
            the_tool_name = 'InDetMeasRecalibST'
            kwargs.setdefault(
                'RecalibratorHandle',
                CfgGetter.getPublicToolClone(
                    the_tool_name + split_cluster_map_extension,
                    the_tool_name,
                    SplitClusterMapExtension=split_cluster_map_extension))
    else:
        setTool('RecalibratorHandle', 'InDetMeasRecalibST', kwargs)
    # setTool('InternalDAFHandle','KalmanInternalDAF',kwargs )
    # from InDetRecExample.InDetJobProperties import InDetFlags
    # kwargs.setdefault('DoDNAForElectronsOnly', True if InDetFlags.doBremRecovery() and InDetFlags.trackFitterType() is 'KalmanFitter' else False)
    return Trk__KalmanFitter(name, **kwargs)
  InDetGlobalTrackMonTool=InDetGlobalTrackMonTool( name          = "InDetGlobalTrackMonTool",
                                                   histoPathBase = "/GLOBAL",
                                                   DoIBL         = InDetFlags.doIBL(),
                                                   trackMax      = 75,
                                                   TrackToVertexIPEstimator = TrackingCommon.getTrackToVertexIPEstimator() )

  TrackCollection = InDetKeys.UnslimmedTracks()

  from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool 
  InDetTrackSelectionToolGlobalMon_Baseline = InDet__InDetTrackSelectionTool(name = "InDetTrackSelectionToolGlobalMon_Baseline",
                                                                                 UseTrkTrackTools = True,
                                                                                 CutLevel = "TightPrimary",
                                                                                 maxNPixelHoles = 1,
                                                                                 minPt = 5000,
                                                                                 TrackSummaryTool    = TrackingCommon.getInDetTrackSummaryTool(),
                                                                                 Extrapolator        = TrackingCommon.getInDetExtrapolator())

  InDetTrackSelectionToolGlobalMon_TightPrimary = InDet__InDetTrackSelectionTool(name = "InDetTrackSelectionToolGlobalMon_TightPrimary",
                                                                                 UseTrkTrackTools = True,
                                                                                 CutLevel = "TightPrimary",
                                                                                 minPt = 5000,
                                                                                 TrackSummaryTool    = TrackingCommon.getInDetTrackSummaryTool(),
                                                                                 Extrapolator        = TrackingCommon.getInDetExtrapolator())

  #ToolSvc += InDetTrackSelectionToolGlobalMon_Baseline
  #ToolSvc += InDetTrackSelectionToolGlobalMon_TightPrimary
  
  InDetGlobalTrackMonTool.Baseline_SelTool = InDetTrackSelectionToolGlobalMon_Baseline
  InDetGlobalTrackMonTool.Tight_SelTool = InDetTrackSelectionToolGlobalMon_TightPrimary

  if DQMonFlags.monManDataType == 'heavyioncollisions' or InDetFlags.doHeavyIon() == True:
示例#5
0
    def __init__(self,
                 InputCollections=None,
                 NewTrackingCuts=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[]):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys

        import InDetRecExample.TrackingCommon as TrackingCommon
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AppMgr import ServiceMgr
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        #
        # --- decide if use the association tool
        #
        asso_tool = None
        if len(InputCollections) > 0:
            usePrdAssociationTool = True
            prefix = 'InDetSegment'
            suffix = ''
            asso_tool = TrackingCommon.getConstPRD_AssociationTool(
                namePrefix=prefix, nameSuffix=suffix)
        else:
            prefix = ''
            suffix = ''
            usePrdAssociationTool = False

        # --- the PRD association tool is filled by the Segment making
        #     no need to run again

        # ------------------------------------------------------------
        #
        # ---------- TRT Seeded Tracking
        #
        # ------------------------------------------------------------

        if InDetFlags.doTRTSeededTrackFinder():
            #
            # --- decide which TRT seed space point finder to use
            #
            if InDetFlags.loadTRTSeededSPFinder():
                #
                # --- defaul space point finder
                #
                from TRT_SeededSpacePointFinderTool.TRT_SeededSpacePointFinderToolConf import InDet__TRT_SeededSpacePointFinder_ATL
                InDetTRT_SeededSpacePointFinder = \
                      InDet__TRT_SeededSpacePointFinder_ATL(name                   = 'InDetTRT_SeededSpFinder'  ,
                                                            SpacePointsSCTName     = InDetKeys.SCT_SpacePoints(),
                                                            SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
                                                            PRDtoTrackMap          = prefix+'PRDtoTrackMap'+suffix \
                                                                                        if usePrdAssociationTool else "",
                                                            NeighborSearch         = True,
                                                            LoadFull               = False,
                                                            DoCosmics              = InDetFlags.doCosmics(),
                                                            pTmin                  = NewTrackingCuts.minSecondaryPt())
                # InDetTRT_SeededSpacePointFinder.OutputLevel = VERBOSE

            elif InDetFlags.loadSimpleTRTSeededSPFinder():
                #
                # --- alternative version using the region selector
                #
                from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
                InDetRegSelSvc = RegSelSvcDefault()
                InDetRegSelSvc.enablePixel = DetFlags.pixel_on()
                InDetRegSelSvc.enableSCT = DetFlags.SCT_on()

                ServiceMgr += InDetRegSelSvc
                if (InDetFlags.doPrintConfigurables()):
                    printfunc(InDetRegSelSvc)

                from TRT_SeededSpacePointFinderTool.TRT_SeededSpacePointFinderToolConf import InDet__SimpleTRT_SeededSpacePointFinder_ATL
                InDetTRT_SeededSpacePointFinder = InDet__SimpleTRT_SeededSpacePointFinder_ATL(
                    name='InDetTRT_SeededSpFinder',
                    SpacePointsSCTName=InDetKeys.SCT_SpacePoints(),
                    SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(),
                    PerigeeCut=1000.,
                    DirectionPhiCut=.3,
                    DirectionEtaCut=1.,
                    MaxHoles=2,
                    AssociationTool=asso_tool,
                    RestrictROI=True)
                # InDetTRT_SeededSpacePointFinder.OutputLevel = VERBOSE
                if not usePrdAssociationTool:
                    InDetTRT_SeededSpacePointFinder.AssociationTool = None

            # add either into the Tool Service
            ToolSvc += InDetTRT_SeededSpacePointFinder
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededSpacePointFinder)
            #
            # Silicon det elements road maker tool
            #
            from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
            InDetTRT_SeededSiRoadMaker = InDet__SiDetElementsRoadMaker_xk(
                name='InDetTRT_SeededSiRoad',
                PropagatorTool=InDetPatternPropagator,
                usePixel=NewTrackingCuts.usePixel(),
                PixManagerLocation=InDetKeys.PixelManager(),
                useSCT=NewTrackingCuts.useSCT(),
                SCTManagerLocation=InDetKeys.SCT_Manager(),
                RoadWidth=35.,
                MaxStep=20.)  # NOT DEFAULT ?
            # InDetTRT_SeededSiRoadMaker.OutputLevel = VERBOSE
            if InDetFlags.doCosmics():
                InDetTRT_SeededSiRoadMaker.RoadWidth = 50
            # Condition algorithm for InDet__SiDetElementsRoadMaker_xk
            if NewTrackingCuts.useSCT():
                from AthenaCommon.AlgSequence import AthSequencer
                condSeq = AthSequencer("AthCondSeq")
                if not hasattr(condSeq, "InDet__SiDetElementsRoadCondAlg_xk"):
                    from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadCondAlg_xk
                    condSeq += InDet__SiDetElementsRoadCondAlg_xk(
                        name="InDet__SiDetElementsRoadCondAlg_xk")

            ToolSvc += InDetTRT_SeededSiRoadMaker
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededSiRoadMaker)
            #
            # --- TRT seeded back tracking tool
            #
            from TRT_SeededTrackFinderTool.TRT_SeededTrackFinderToolConf import InDet__TRT_SeededTrackFinder_ATL
            InDetTRT_SeededTrackTool = InDet__TRT_SeededTrackFinder_ATL(
                name='InDetTRT_SeededTrackMaker',
                PropagatorTool=InDetPatternPropagator,
                UpdatorTool=InDetPatternUpdator,
                RoadTool=InDetTRT_SeededSiRoadMaker,
                SeedTool=InDetTRT_SeededSpacePointFinder,
                CombinatorialTrackFinder=InDetSiComTrackFinder,
                pTmin=NewTrackingCuts.minSecondaryPt(),
                nHolesMax=NewTrackingCuts.SecondarynHolesMax(),
                # ME bugfix: nHolesGapMax             = 2*NewTrackingCuts.SecondarynHolesGapMax(),
                nHolesGapMax=NewTrackingCuts.SecondarynHolesGapMax(),
                Xi2max=NewTrackingCuts.SecondaryXi2max(),
                Xi2maxNoAdd=NewTrackingCuts.SecondaryXi2maxNoAdd(),
                SearchInCaloROI=False,
                InputClusterContainerName=InDetKeys.CaloClusterROIContainer(),
                ConsistentSeeds=True,
                # BremCorrection           = True,
                BremCorrection=False)
            if InDetFlags.doCosmics():
                InDetTRT_SeededTrackTool.nWClustersMin = 0

            ToolSvc += InDetTRT_SeededTrackTool
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededTrackTool)

            #
            # --- Output key for the finder
            #
            self.__TRTSeededTracks = InDetKeys.TRTSeededTracks()
            #
            # TRT seeded back tracking algorithm

            from AthenaCommon import CfgGetter
            from TRT_SeededTrackFinder.TRT_SeededTrackFinderConf import InDet__TRT_SeededTrackFinder
            import InDetRecExample.TrackingCommon as TrackingCommon
            InDetTRT_SeededTrackFinder = InDet__TRT_SeededTrackFinder(name                  = 'InDetTRT_SeededTrackFinder',
                                                                      RefitterTool          = CfgGetter.getPublicTool('InDetTrackFitter'),
                                                                      TrackTool             = InDetTRT_SeededTrackTool,
                                                                      PRDtoTrackMap         = prefix+'PRDtoTrackMap'+suffix \
                                                                                                  if usePrdAssociationTool else "",
                                                                      TrackSummaryTool      = TrackingCommon.getInDetTrackSummaryToolNoHoleSearch(),
                                                                      TrackExtensionTool    = InDetTRTExtensionTool,
                                                                      MinTRTonSegment       = NewTrackingCuts.minSecondaryTRTonTrk(),
                                                                      MinTRTonly            = NewTrackingCuts.minTRTonly(),
                                                                      TrtExtension          = True,
                                                                      SiExtensionCuts       = NewTrackingCuts.SiExtensionCuts(),
                                                                      minPt                 = NewTrackingCuts.minSecondaryPt(),
                                                                      maxRPhiImp            = NewTrackingCuts.maxSecondaryImpact(),
                                                                      maxZImp               = NewTrackingCuts.maxZImpact(),
                                                                      maxEta                = NewTrackingCuts.maxEta(),
                                                                      Extrapolator          = TrackingCommon.getInDetExtrapolator(),
                                                                      RejectShortExtension  = NewTrackingCuts.rejectShortExtensions(),
                                                                      FinalRefit            = False,
                                                                      FinalStatistics       = False,
                                                                      OutputSegments        = False,
                                                                      InputSegmentsLocation = InDetKeys.TRT_Segments(),
                                                                      OutputTracksLocation  = self.__TRTSeededTracks,
                                                                      CaloClusterEt         = NewTrackingCuts.minRoIClusterEt())

            if (NewTrackingCuts.RoISeededBackTracking()):
                from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT
                InDetTRT_SeededTrackFinder.RegSelTool = makeRegSelTool_SCT()
                InDetTRT_SeededTrackFinder.CaloSeededRoI = True
            # InDetTRT_SeededTrackFinder.OutputLevel = VERBOSE
            topSequence += InDetTRT_SeededTrackFinder
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededTrackFinder)

            #
            # ------------ Track truth.
            #
            if not InDetFlags.doSGDeletion():
                if InDetFlags.doTruth():
                    #
                    # set up the truth info for this container
                    #
                    include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                    InDetTracksTruth = ConfiguredInDetTrackTruth(
                        self.__TRTSeededTracks,
                        self.__TRTSeededTracks + "DetailedTruth",
                        self.__TRTSeededTracks + "TruthCollection")
                    #
                    # add final output for statistics
                    #
                    TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                    TrackCollectionTruthKeys += [
                        InDetTracksTruth.TracksTruth()
                    ]
                else:
                    TrackCollectionKeys += [self.__TRTSeededTracks]

            # --- output track collection
            self.__BackTrackingTracks = self.__TRTSeededTracks

        # ------------------------------------------------------------
        #
        # --- Resolve back tracking tracks ?
        #
        # ------------------------------------------------------------

        if InDetFlags.doResolveBackTracks():
            #
            # --- set up special Scoring Tool for TRT seeded tracks
            #
            if InDetFlags.doCosmics():
                InDetTRT_SeededScoringTool = TrackingCommon.getInDetCosmicScoringTool_TRT(
                    NewTrackingCuts)
                InDetTRT_SeededSummaryTool = TrackingCommon.getInDetTrackSummaryToolSharedHits(
                )
            else:
                InDetTRT_SeededScoringTool = TrackingCommon.getInDetTRT_SeededScoringTool(
                    NewTrackingCuts)
                InDetTRT_SeededSummaryTool = TrackingCommon.getInDetTrackSummaryTool(
                )

            #
            # --- Load selection tool
            #
            from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool
            InDetTRT_SeededAmbiTrackSelectionTool = InDet__InDetAmbiTrackSelectionTool(
                name='InDetTRT_SeededAmbiTrackSelectionTool',
                DriftCircleCutTool=InDetTRTDriftCircleCut,
                AssociationTool=TrackingCommon.
                getInDetPRDtoTrackMapToolGangedPixels(),
                minScoreShareTracks=-1.,  # off !
                minHits=NewTrackingCuts.minSecondaryClusters(),
                minNotShared=NewTrackingCuts.minSecondarySiNotShared(),
                maxShared=NewTrackingCuts.maxSecondaryShared(),
                minTRTHits=NewTrackingCuts.minSecondaryTRTonTrk(),
                UseParameterization=NewTrackingCuts.useParameterizedTRTCuts(),
                Cosmics=InDetFlags.doCosmics(),
                doPixelSplitting=InDetFlags.doPixelClusterSplitting())

            # InDetTRT_SeededAmbiTrackSelectionTool.OutputLevel = DEBUG
            ToolSvc += InDetTRT_SeededAmbiTrackSelectionTool
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededAmbiTrackSelectionTool)

            #
            # --- load Ambiguity Processor
            #
            from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool
            InDetTRT_SeededAmbiguityProcessor = Trk__SimpleAmbiguityProcessorTool(
                name='InDetTRT_SeededAmbiguityProcessor',
                Fitter=CfgGetter.getPublicTool('InDetTrackFitter'),
                AssociationTool=TrackingCommon.
                getInDetPRDtoTrackMapToolGangedPixels(),
                TrackSummaryTool=InDetTRT_SeededSummaryTool,
                SelectionTool=InDetTRT_SeededAmbiTrackSelectionTool,
                RefitPrds=not InDetFlags.refitROT(),
                SuppressTrackFit=False,
                SuppressHoleSearch=False,
                ScoringTool=InDetTRT_SeededScoringTool)
            # InDetTRT_SeededAmbiguityProcessor.OutputLevel = DEBUG
            if InDetFlags.materialInteractions():
                InDetTRT_SeededAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType(
                )
            else:
                InDetTRT_SeededAmbiguityProcessor.MatEffects = 0
            #
            ToolSvc += InDetTRT_SeededAmbiguityProcessor
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededAmbiguityProcessor)

            #
            # --- load the algorithm
            #

            from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguityScore
            InDetAmbiguityScore = Trk__TrkAmbiguityScore(
                name='InDetTRT_SeededAmbiguityScore',
                TrackInput=[self.__TRTSeededTracks],
                TrackOutput='ScoredMap' + 'InDetTRT_SeededAmbiguityScore')
            topSequence += InDetAmbiguityScore

            self.__ResolvedTRTSeededTracks = InDetKeys.ResolvedTRTSeededTracks(
            )
            #
            from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
            InDetTRT_SeededAmbiguitySolver = Trk__TrkAmbiguitySolver(
                name='InDetTRT_SeededAmbiguitySolver',
                TrackInput='ScoredMap' + 'InDetTRT_SeededAmbiguityScore',
                TrackOutput=self.__ResolvedTRTSeededTracks,
                AmbiguityProcessor=InDetTRT_SeededAmbiguityProcessor)
            topSequence += InDetTRT_SeededAmbiguitySolver
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRT_SeededAmbiguitySolver)

            # --- Delete (non-resloved) TRT seeded tracks
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(key=InDetKeys.TRTSeededTracks())

            #
            # ------------ Track truth.
            #
            if not InDetFlags.doSGDeletion():
                if InDetFlags.doTruth():
                    #
                    # set up the truth info for this container
                    #
                    include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                    InDetTracksTruth = ConfiguredInDetTrackTruth(
                        self.__ResolvedTRTSeededTracks,
                        self.__ResolvedTRTSeededTracks + "DetailedTruth",
                        self.__ResolvedTRTSeededTracks + "TruthCollection")
                    #
                    # add final output for statistics
                    #
                    TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                    TrackCollectionTruthKeys += [
                        InDetTracksTruth.TracksTruth()
                    ]
                else:
                    TrackCollectionKeys += [self.__ResolvedTRTSeededTracks]

            # --- output track collection
            self.__BackTrackingTracks = self.__ResolvedTRTSeededTracks
示例#6
0
    def __init__(self,
                 extension="",
                 InputCollections=None,
                 NewTrackingCuts=None,
                 BarrelSegments=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[],
                 PRDtoTrackMap=''):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        from AthenaCommon.DetFlags import DetFlags

        import InDetRecExample.TrackingCommon as TrackingCommon
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # --- Always use PRD association tool (even if only 1 collection) to remove TRT
        #     segments with significant overlaping hits
        usePrdAssociationTool = True
        #usePrdAssociationTool = True if len(InputCollections) > 0 else False

        #
        # --- get list of already associated hits (always do this, even if no other tracking ran before)
        #
        prd_to_track_map = PRDtoTrackMap
        if usePrdAssociationTool and extension != "_TRT":
            prefix = 'InDetTRTonly_'
            InDetTRTonly_PRD_Association = TrackingCommon.getInDetTrackPRD_Association(
                namePrefix=prefix,
                nameSuffix=extension,
                TracksName=list(InputCollections))

            prd_to_track_map = prefix + 'PRDtoTrackMap' + extension
            topSequence += InDetTRTonly_PRD_Association
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRTonly_PRD_Association)

        #
        # Cut values and output key for the TRT segments standalone TRT track finder
        #
        if extension == "_TRT":
            # TRT track segments
            pTmin = NewTrackingCuts.minPT()
            self.__TRTStandaloneTracks = InDetKeys.TRTTracks()
        else:
            # TRT standalone
            # pTmin                      = NewTrackingCuts.minSecondaryPt()
            pTmin = NewTrackingCuts.minTRTonlyPt(
            )  # new cut parameter to make it flexible...
            self.__TRTStandaloneTracks = InDetKeys.TRTTracks_NewT()

        #
        # --- set up special Scoring Tool for standalone TRT tracks
        #
        from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetTrtTrackScoringTool
        InDetTRT_StandaloneScoringTool = InDet__InDetTrtTrackScoringTool(
            name='InDetTRT_StandaloneScoringTool' + extension,
            SummaryTool=TrackingCommon.getInDetTrackSummaryTool(),
            DriftCircleCutTool=InDetTRTDriftCircleCut,
            useAmbigFcn=True,
            useSigmaChi2=False,
            PtMin=pTmin,
            minTRTonTrk=NewTrackingCuts.minTRTonly(),
            maxEta=2.1,
            UseParameterization=NewTrackingCuts.useTRTonlyParamCuts(),
            OldTransitionLogic=NewTrackingCuts.useTRTonlyOldLogic(),
            minTRTPrecisionFraction=NewTrackingCuts.minSecondaryTRTPrecFrac())
        # InDetTRT_StandaloneScoringTool.OutputLevel = VERBOSE
        ToolSvc += InDetTRT_StandaloneScoringTool
        if (InDetFlags.doPrintConfigurables()):
            printfunc(InDetTRT_StandaloneScoringTool)

        #
        # set up TRT_SegmentToTrackTool
        #
        from AthenaCommon import CfgGetter
        from TRT_SegmentToTrackTool.TRT_SegmentToTrackToolConf import InDet__TRT_SegmentToTrackTool
        asso_tool = TrackingCommon.getInDetPRDtoTrackMapToolGangedPixels(
        ) if usePrdAssociationTool else None
        InDetTRT_SegmentToTrackTool = InDet__TRT_SegmentToTrackTool(
            name='InDetTRT_SegmentToTrackTool' + extension,
            RefitterTool=CfgGetter.getPublicTool('InDetTrackFitterTRT'),
            AssociationTool=asso_tool,
            TrackSummaryTool=TrackingCommon.getInDetTrackSummaryTool(),
            ScoringTool=InDetTRT_StandaloneScoringTool,
            Extrapolator=TrackingCommon.getInDetExtrapolator(),
            FinalRefit=True,
            MaxSharedHitsFraction=NewTrackingCuts.maxTRTonlyShared(),
            SuppressHoleSearch=True)

        ToolSvc += InDetTRT_SegmentToTrackTool
        if (InDetFlags.doPrintConfigurables()):
            printfunc(InDetTRT_SegmentToTrackTool)

        if not InDetFlags.doCosmics():
            #
            # --- TRT standalone tracks algorithm
            #

            from TRT_StandaloneTrackFinder.TRT_StandaloneTrackFinderConf import InDet__TRT_StandaloneTrackFinder
            InDetTRT_StandaloneTrackFinder = InDet__TRT_StandaloneTrackFinder(
                name='InDetTRT_StandaloneTrackFinder' + extension,
                MinNumDriftCircles=NewTrackingCuts.minTRTonly(),
                MinPt=NewTrackingCuts.minTRTonlyPt(),
                InputSegmentsLocation=BarrelSegments,
                MaterialEffects=0,
                PRDtoTrackMap=prd_to_track_map,
                OldTransitionLogic=NewTrackingCuts.useTRTonlyOldLogic(),
                OutputTracksLocation=self.__TRTStandaloneTracks,
                TRT_SegToTrackTool=InDetTRT_SegmentToTrackTool)
            #InDetTRT_StandaloneTrackFinder.OutputLevel = VERBOSE
            topSequence += InDetTRT_StandaloneTrackFinder
            if InDetFlags.doPrintConfigurables():
                printfunc(InDetTRT_StandaloneTrackFinder)

            # --- Delete TRT segments for the subdetector pattern only (back-tracking has already run by this point)
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(container="Trk::SegmentCollection#",
                               key=BarrelSegments)

        else:
            #
            # --- cosmics segment to track conversion for Barrel
            #
            from AthenaCommon import CfgGetter
            from TRT_SegmentsToTrack.TRT_SegmentsToTrackConf import InDet__TRT_SegmentsToTrack
            InDetTrkSegmenttoTrk = InDet__TRT_SegmentsToTrack(
                name="InDetTRT_SegmentsToTrack_Barrel" + extension,
                InputSegmentsCollection=BarrelSegments,
                OutputTrackCollection=self.__TRTStandaloneTracks,
                TrackFitter=CfgGetter.getPublicTool('InDetTrackFitter'),
                SummaryTool=TrackingCommon.getInDetTrackSummaryToolTRTTracks(),
                AssociationTool=TrackingCommon.
                getInDetPRDtoTrackMapToolGangedPixels()
                if prd_to_track_map != '' else None,
                InputAssociationMapName=prd_to_track_map,
                MinNHit=NewTrackingCuts.minTRTonly(),
                OutlierRemoval=True,
                MaterialEffects=False)
            #InDetTrkSegmenttoTrk.OutputLevel = VERBOSE
            topSequence += InDetTrkSegmenttoTrk
            if InDetFlags.doPrintConfigurables():
                printfunc(InDetTrkSegmenttoTrk)

        #
        #
        # ------------ Track truth.
        #
        if (extension == "_TRT" or not InDetFlags.doSGDeletion()):
            if InDetFlags.doTruth():
                #
                # set up the truth info for this container
                #
                include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                InDetTracksTruth = ConfiguredInDetTrackTruth(
                    self.__TRTStandaloneTracks,
                    self.__TRTStandaloneTracks + "DetailedTruth",
                    self.__TRTStandaloneTracks + "TruthCollection")
                #
                # add final output for statistics
                #
                TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                TrackCollectionTruthKeys += [InDetTracksTruth.TracksTruth()]
            else:
                TrackCollectionKeys += [self.__TRTStandaloneTracks]
示例#7
0
def vertexFinderTool_builder( signature ) : 

    from AthenaCommon.AppMgr import ToolSvc

    # use the getters from TrackingCommon ... 
    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()

    # get the selection cuts use to select the actual tracks in the tool ...
    from InDetTrigRecExample.TrigInDetConfiguredVtxCuts import ConfiguredTrigVtxCuts 
    vtxcuts = ConfiguredTrigVtxCuts() 
    vtxcuts.printInfo()

    
    # now create the five sub tools needed ...

    linearTrackFactory     =     linearTrackFactory_builder( signature, extrapolator )
    vertexFitterTool       =       vertexFitterTool_builder( signature, linearTrackFactory, extrapolator )
    impactEstimator        =        impactEstimator_builder( signature, extrapolator )
    trackSelectorTool      =      trackSelectorTool_builder( signature, trackSummaryTool, extrapolator, vtxcuts )
    trackDensitySeedFinder = trackDensitySeedFinder_builder( signature )
    
    # 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__InDetIterativePriVxFinderTool
    
    vertexFinderTool = InDet__InDetIterativePriVxFinderTool( name                     = "InDetTrigPriVxFinderTool" + signature,
                                                             VertexFitterTool         = vertexFitterTool,
                                                             TrackSelector            = trackSelectorTool,
                                                             SeedFinder               = trackDensitySeedFinder,
                                                             ImpactPoint3dEstimator   = impactEstimator,
                                                             LinearizedTrackFactory   = linearTrackFactory,
                                                             useBeamConstraint        = True,
                                                             significanceCutSeeding   = 12,
                                                             maximumChi2cutForSeeding = 49,
                                                             maxVertices              = 200,
                                                             createSplitVertices      = False,
                                                             doMaxTracksCut           = vtxcuts.doMaxTracksCut(),
                                                             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
   
    return vertexFinderTool