def __init__(self,
                 InputCollections=None,
                 ResolvedTrackCollectionKey=None,
                 SiSPSeededTrackCollectionKey=None,
                 NewTrackingCuts=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[]):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        #
        # --- get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        #
        # --- decide if use the association tool
        #
        if (len(InputCollections) > 0) and (
                NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode()
                == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0"
                or NewTrackingCuts.mode() == "LowPtLargeD0"
                or NewTrackingCuts.mode() == "DisplacedSoftPion"
                or NewTrackingCuts.mode() == "BeamGas"
                or NewTrackingCuts.mode() == "ForwardTracks"
                or NewTrackingCuts.mode() == "ForwardSLHCTracks"
                or NewTrackingCuts.mode() == "PixelPrdAssociation"
                or NewTrackingCuts.mode() == "VeryForwardSLHCTracks"
                or NewTrackingCuts.mode() == "SLHCConversionFinding"):
            usePrdAssociationTool = True
        else:
            usePrdAssociationTool = False

        #
        # --- get list of already associated hits (always do this, even if no other tracking ran before)
        #
        if usePrdAssociationTool:
            from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
            InDetPRD_Association = InDet__InDetTrackPRD_Association(
                name='InDetPRD_Association' + NewTrackingCuts.extension(),
                AssociationTool=InDetPrdAssociationTool,
                TracksName=list(InputCollections))
            topSequence += InDetPRD_Association
            if (InDetFlags.doPrintConfigurables()):
                print InDetPRD_Association

        # ------------------------------------------------------------
        #
        # ----------- SiSPSeededTrackFinder
        #
        # ------------------------------------------------------------

        if InDetFlags.doSiSPSeededTrackFinder():
            #
            # --- Space points seeds maker, use different ones for cosmics and collisions
            #
            if NewTrackingCuts.mode() == "DBM":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
            elif InDetFlags.doCosmics():
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_Cosmic as SiSpacePointsSeedMaker
            elif InDetFlags.doHeavyIon():
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_HeavyIon as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_LowMomentum as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "BeamGas":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_BeamGas as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ITK as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "DisplacedSoftPion":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_TrkSeeded as SiSpacePointsSeedMaker
            else:
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker

            InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker(
                name="InDetSpSeedsMaker" + NewTrackingCuts.extension(),
                pTmin=NewTrackingCuts.minPT(),
                maxdImpact=NewTrackingCuts.maxPrimaryImpact(),
                maxZ=NewTrackingCuts.maxZImpact(),
                minZ=-NewTrackingCuts.maxZImpact(),
                usePixel=NewTrackingCuts.usePixel(),
                SpacePointsPixelName=InDetKeys.PixelSpacePoints(),
                # useSCT                 = NewTrackingCuts.useSCT(),
                useSCT=(NewTrackingCuts.useSCT()
                        and NewTrackingCuts.useSCTSeeding()),
                SpacePointsSCTName=InDetKeys.SCT_SpacePoints(),
                # useOverlapSpCollection = NewTrackingCuts.useSCT(),
                useOverlapSpCollection=(NewTrackingCuts.useSCT()
                                        and NewTrackingCuts.useSCTSeeding()),
                SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(),
                radMax=NewTrackingCuts.radMax(),
                RapidityCut=NewTrackingCuts.maxEta())

            if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon(
            ) or NewTrackingCuts.mode() == "ForwardTracks":
                InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds(
                )
                InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds(
                )
            if usePrdAssociationTool:
                # not all classes have that property !!!
                InDetSiSpacePointsSeedMaker.UseAssociationTool = True
                InDetSiSpacePointsSeedMaker.AssociationTool = InDetPrdAssociationTool
            if not InDetFlags.doCosmics():
                InDetSiSpacePointsSeedMaker.maxRadius1 = 0.75 * NewTrackingCuts.radMax(
                )
                InDetSiSpacePointsSeedMaker.maxRadius2 = NewTrackingCuts.radMax(
                )
                InDetSiSpacePointsSeedMaker.maxRadius3 = NewTrackingCuts.radMax(
                )
            if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                try:
                    InDetSiSpacePointsSeedMaker.pTmax = NewTrackingCuts.maxPT()
                except:
                    pass
                InDetSiSpacePointsSeedMaker.mindRadius = 4.0
            if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "SLHCConversionFinding":
                InDetSiSpacePointsSeedMaker.minRadius1 = 0
                InDetSiSpacePointsSeedMaker.minRadius2 = 0
                InDetSiSpacePointsSeedMaker.minRadius3 = 0
                InDetSiSpacePointsSeedMaker.maxRadius1 = 1000. * Units.mm
                InDetSiSpacePointsSeedMaker.maxRadius2 = 1000. * Units.mm
                InDetSiSpacePointsSeedMaker.maxRadius3 = 1000. * Units.mm
            if NewTrackingCuts.mode(
            ) == "ForwardTracks" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                InDetSiSpacePointsSeedMaker.checkEta = True
                InDetSiSpacePointsSeedMaker.etaMin = NewTrackingCuts.minEta()
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.RapidityCut = NewTrackingCuts.maxEta(
                )
            if NewTrackingCuts.mode() == "DBM":
                InDetSiSpacePointsSeedMaker.etaMin = NewTrackingCuts.minEta()
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.useDBM = True
            if NewTrackingCuts.mode() == "PixelThreeLayer":
                InDetSiSpacePointsSeedMaker.SkipIBLcut = True
            if NewTrackingCuts.mode() == "DisplacedSoftPion":
                InDetSiSpacePointsSeedMaker.maxSeedsForSpacePoint = 50
                InDetSiSpacePointsSeedMaker.DeltaThetaRoISP = 0.8
                InDetSiSpacePointsSeedMaker.DeltaPhiRoISP = 0.8
                InDetSiSpacePointsSeedMaker.RoISeedTool = RoISeedTool

            #InDetSiSpacePointsSeedMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiSpacePointsSeedMaker
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiSpacePointsSeedMaker

            #
            # --- Z-coordinates primary vertices finder (only for collisions)
            #
            if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
                from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
                InDetZvertexMaker = InDet__SiZvertexMaker_xk(
                    name='InDetZvertexMaker' + NewTrackingCuts.extension(),
                    Zmax=NewTrackingCuts.maxZImpact(),
                    Zmin=-NewTrackingCuts.maxZImpact(),
                    minRatio=0.17)  # not default
                InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker

                if InDetFlags.doHeavyIon():
                    InDetZvertexMaker.HistSize = 2000
                    ###InDetZvertexMaker.minContent = 200
                    InDetZvertexMaker.minContent = 30

                ToolSvc += InDetZvertexMaker
                if (InDetFlags.doPrintConfigurables()):
                    print InDetZvertexMaker

            else:
                InDetZvertexMaker = None

            #
            # --- SCT and Pixel detector elements road builder
            #
            from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
            InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(
                name='InDetSiRoadMaker' + NewTrackingCuts.extension(),
                PropagatorTool=InDetPatternPropagator,
                usePixel=NewTrackingCuts.usePixel(),
                PixManagerLocation=InDetKeys.PixelManager(),
                useSCT=NewTrackingCuts.useSCT(),
                SCTManagerLocation=InDetKeys.SCT_Manager(),
                RoadWidth=NewTrackingCuts.RoadWidth())
            #InDetSiDetElementsRoadMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiDetElementsRoadMaker
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiDetElementsRoadMaker

            #
            # --- Local track finding using sdCaloSeededSSSpace point seed
            #

            useBremMode = NewTrackingCuts.mode(
            ) == "Offline" or NewTrackingCuts.mode(
            ) == "SLHC" or NewTrackingCuts.mode() == "DBM"
            from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
            InDetSiTrackMaker = SiTrackMaker(
                name='InDetSiTrackMaker' + NewTrackingCuts.extension(),
                useSCT=NewTrackingCuts.useSCT(),
                usePixel=NewTrackingCuts.usePixel(),
                RoadTool=InDetSiDetElementsRoadMaker,
                CombinatorialTrackFinder=InDetSiComTrackFinder,
                pTmin=NewTrackingCuts.minPT(),
                pTminBrem=NewTrackingCuts.minPTBrem(),
                pTminSSS=InDetFlags.pT_SSScut(),
                nClustersMin=NewTrackingCuts.minClusters(),
                nHolesMax=NewTrackingCuts.nHolesMax(),
                nHolesGapMax=NewTrackingCuts.nHolesGapMax(),
                SeedsFilterLevel=NewTrackingCuts.seedFilterLevel(),
                Xi2max=NewTrackingCuts.Xi2max(),
                Xi2maxNoAdd=NewTrackingCuts.Xi2maxNoAdd(),
                nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(),
                CosmicTrack=InDetFlags.doCosmics(),
                Xi2maxMultiTracks=NewTrackingCuts.Xi2max(),  # was 3.
                useSSSseedsFilter=InDetFlags.doSSSfilter(),
                doMultiTracksProd=True,
                useBremModel=InDetFlags.doBremRecovery() and
                useBremMode,  # only for NewTracking the brem is debugged !!!
                doCaloSeededBrem=InDetFlags.doCaloSeededBrem(),
                doHadCaloSeedSSS=InDetFlags.doHadCaloSeededSSS(),
                phiWidth=NewTrackingCuts.phiWidthBrem(),
                etaWidth=NewTrackingCuts.etaWidthBrem(),
                InputClusterContainerName=InDetKeys.CaloClusterROIContainer(
                ),  # "InDetCaloClusterROIs" 
                InputHadClusterContainerName=InDetKeys.
                HadCaloClusterROIContainer(),  # "InDetCaloClusterROIs" 
                UseAssociationTool=usePrdAssociationTool)

            if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                InDetSiTrackMaker.ITKGeometry = True

            if NewTrackingCuts.mode() == "DBM":
                InDetSiTrackMaker.MagneticFieldMode = "NoField"
                InDetSiTrackMaker.useBremModel = False
                InDetSiTrackMaker.doMultiTracksProd = False
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
                InDetSiTrackMaker.pTminSSS = -1
                InDetSiTrackMaker.CosmicTrack = False
                InDetSiTrackMaker.useSSSseedsFilter = False
                InDetSiTrackMaker.doCaloSeededBrem = False
                InDetSiTrackMaker.doHadCaloSeedSSS = False
                InDetSiTrackMaker.UseAssociationTool = False

            elif InDetFlags.doCosmics():
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'

            elif InDetFlags.doHeavyIon():
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'

            elif NewTrackingCuts.mode() == "LowPt":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'

            elif NewTrackingCuts.mode() == "VeryLowPt" or (
                    NewTrackingCuts.mode() == "Pixel"
                    and InDetFlags.doMinBias()):
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'

            elif NewTrackingCuts.mode() == "BeamGas":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'

            elif NewTrackingCuts.mode() == "ForwardTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'

            elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'

            elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks'

            elif NewTrackingCuts.mode() == "SLHCConversionFinding":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_SLHCConversionTracks'

            elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode(
            ) == "LowPtLargeD0" or NewTrackingCuts.mode(
            ) == "DisplacedSoftPion":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'

            elif NewTrackingCuts.mode() == "PixelThreeLayer":
                InDetSiTrackMaker.CombinatorialTrackFinder = InDetSiComTrackFinderThreeLayerTracking

            else:
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'

            if InDetFlags.doStoreTrackSeeds():
                InDetSiTrackMaker.SeedSegmentsWrite = True
                InDetSiTrackMaker.SeedToTrackConversion = InDet_SeedToTrackConversion
            #InDetSiTrackMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiTrackMaker
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiTrackMaker
            #
            # set output track collection name
        #
            self.__SiTrackCollection = SiSPSeededTrackCollectionKey
            #
            # --- Setup Track finder using space points seeds
            #

            from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder

            if NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "ForwardTracks":

                InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(
                    name='InDetSiSpTrackFinder' + NewTrackingCuts.extension(),
                    TrackTool=InDetSiTrackMaker,
                    TracksLocation=self.__SiTrackCollection,
                    SeedsTool=InDetSiSpacePointsSeedMaker,
                    useZvertexTool=InDetFlags.useZvertexTool(),
                    ZvertexTool=InDetZvertexMaker,
                    useNewStrategy=False,
                    useMBTSTimeDiff=InDetFlags.useMBTSTimeDiff(),
                    useZBoundFinding=False)
                if InDetFlags.doHeavyIon():
                    InDetSiSPSeededTrackFinder.FreeClustersCut = 2  #Heavy Ion optimization from Igor

            else:
                InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(
                    name='InDetSiSpTrackFinder' + NewTrackingCuts.extension(),
                    TrackTool=InDetSiTrackMaker,
                    TracksLocation=self.__SiTrackCollection,
                    SeedsTool=InDetSiSpacePointsSeedMaker,
                    useZvertexTool=InDetFlags.useZvertexTool()
                    and NewTrackingCuts.mode() != "DBM",
                    ZvertexTool=InDetZvertexMaker,
                    useNewStrategy=InDetFlags.useNewSiSPSeededTF()
                    and NewTrackingCuts.mode() != "DBM",
                    useMBTSTimeDiff=InDetFlags.useMBTSTimeDiff(),
                    useZBoundFinding=NewTrackingCuts.doZBoundary()
                    and NewTrackingCuts.mode() != "DBM")

                if InDetFlags.doHeavyIon():
                    InDetSiSPSeededTrackFinder.FreeClustersCut = 2  #Heavy Ion optimization from Igor

            #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE
            topSequence += InDetSiSPSeededTrackFinder
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiSPSeededTrackFinder

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

        # ------------------------------------------------------------
        #
        # ---------- Ambiguity solving
        #
        # ------------------------------------------------------------

        if InDetFlags.doAmbiSolving():
            #
            # --- load InnerDetector TrackSelectionTool
            #

            prob1 = InDetFlags.pixelClusterSplitProb1()
            prob2 = InDetFlags.pixelClusterSplitProb2()
            nhitsToAllowSplitting = 9

            if geoFlags.Run() == 1:
                prob1 = InDetFlags.pixelClusterSplitProb1_run1()
                prob2 = InDetFlags.pixelClusterSplitProb2_run1()
                nhitsToAllowSplitting = 8

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetDenseEnvAmbiTrackSelectionTool as AmbiTrackSelectionTool
            else:
                from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool as AmbiTrackSelectionTool
            InDetAmbiTrackSelectionTool = AmbiTrackSelectionTool(
                name='InDetAmbiTrackSelectionTool' +
                NewTrackingCuts.extension(),
                AssociationTool=InDetPrdAssociationTool,
                DriftCircleCutTool=InDetTRTDriftCircleCut,
                minHits=NewTrackingCuts.minClusters(),
                minNotShared=NewTrackingCuts.minSiNotShared(),
                maxShared=NewTrackingCuts.maxShared(),
                minTRTHits=0,  # used for Si only tracking !!!
                sharedProbCut=0.10,
                UseParameterization=False,
                Cosmics=InDetFlags.doCosmics(),
                doPixelSplitting=InDetFlags.doPixelClusterSplitting()
                and NewTrackingCuts.mode != "DBM")
            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                InDetAmbiTrackSelectionTool.sharedProbCut = prob1
                InDetAmbiTrackSelectionTool.sharedProbCut2 = prob2
                InDetAmbiTrackSelectionTool.minSiHitsToAllowSplitting = nhitsToAllowSplitting
                InDetAmbiTrackSelectionTool.minUniqueSCTHits = 4
                InDetAmbiTrackSelectionTool.minTrackChi2ForSharedHits = 3
                InDetAmbiTrackSelectionTool.InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer(
                )
                InDetAmbiTrackSelectionTool.doHadCaloSeed = False  #Only split in cluster in region of interest
                InDetAmbiTrackSelectionTool.minPtSplit = InDetFlags.pixelClusterSplitMinPt(
                )  #Only allow split clusters on track withe pt greater than this MeV
                InDetAmbiTrackSelectionTool.phiWidth = 0.2  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.etaWidth = 0.2  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.InputEmClusterContainerName = InDetKeys.CaloClusterROIContainer(
                )
                InDetAmbiTrackSelectionTool.doEmCaloSeed = False  #Only split in cluster in region of interest
                InDetAmbiTrackSelectionTool.minPtConv = 10000  #Only allow split clusters on track withe pt greater than this MeV
                InDetAmbiTrackSelectionTool.phiWidthEM = 0.05  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.etaWidthEM = 0.05  #Split cluster ROI size

            if NewTrackingCuts.mode() == "DBM":
                InDetAmbiTrackSelectionTool.Cosmics = False
                InDetAmbiTrackSelectionTool.UseParameterization = False
                InDetAmbiTrackSelectionTool.doPixelSplitting = False
                InDetAmbiTrackSelectionTool.maxShared = 1000
                InDetAmbiTrackSelectionTool.maxTracksPerSharedPRD = 2
                InDetAmbiTrackSelectionTool.minHits = 0
                InDetAmbiTrackSelectionTool.minNotShared = 0
                InDetAmbiTrackSelectionTool.minScoreShareTracks = 0.0
                InDetAmbiTrackSelectionTool.minTRTHits = 0
                InDetAmbiTrackSelectionTool.sharedProbCut = 0.1
            if InDetFlags.doTIDE_AmbiTrackMonitoring(
            ) and InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "PixelPrdAssociation"
                    or NewTrackingCuts.mode() == "DBM"
                    or NewTrackingCuts.mode() == "PixelFourLayer"
                    or NewTrackingCuts.mode() == "PixelThreeLayer"):
                InDetAmbiTrackSelectionTool.ObserverTool = TrackObserverTool  #observerTool
                InDetAmbiTrackSelectionTool.MonitorAmbiguitySolving = True

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #    InDetAmbiTrackSelectionTool.OutputLevel = VERBOSE

            ToolSvc += InDetAmbiTrackSelectionTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiTrackSelectionTool
            #
            # --- set up different Scoring Tool for collisions and cosmics
            #
            if InDetFlags.doCosmics() and NewTrackingCuts.mode() != "DBM":
                from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
                InDetAmbiScoringTool = InDet__InDetCosmicScoringTool(
                    name='InDetCosmicsScoringTool' +
                    NewTrackingCuts.extension(),
                    nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(
                    ),
                    minTRTHits=0,
                    SummaryTool=InDetTrackSummaryTool)
            else:
                from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
                InDetAmbiScoringTool = InDet__InDetAmbiScoringTool(
                    name='InDetAmbiScoringTool' + NewTrackingCuts.extension(),
                    Extrapolator=InDetExtrapolator,
                    SummaryTool=InDetTrackSummaryTool,
                    DriftCircleCutTool=InDetTRTDriftCircleCut,
                    useAmbigFcn=True,  # this is NewTracking
                    useTRT_AmbigFcn=False,
                    minPt=NewTrackingCuts.minPT(),
                    maxRPhiImp=NewTrackingCuts.maxPrimaryImpact(),
                    maxZImp=NewTrackingCuts.maxZImpact(),
                    maxEta=NewTrackingCuts.maxEta(),
                    minSiClusters=NewTrackingCuts.minClusters(),
                    minPixel=NewTrackingCuts.minPixel(),
                    maxSiHoles=NewTrackingCuts.maxHoles(),
                    maxPixelHoles=NewTrackingCuts.maxPixelHoles(),
                    maxSCTHoles=NewTrackingCuts.maxSCTHoles(),
                    maxDoubleHoles=NewTrackingCuts.maxDoubleHoles(),
                    usePixel=NewTrackingCuts.usePixel(),
                    useSCT=NewTrackingCuts.useSCT(),
                    InputEmClusterContainerName=InDetKeys.
                    CaloClusterROIContainer(),
                    doEmCaloSeed=True and InDetFlags.doCaloSeededBrem(),
                    minTRTonTrk=0,
                    minTRTPrecisionFraction=0)
                # allow for some overlap for low-pt tracking
                #if InDetFlags.doLowPt() and not NewTrackingCuts.mode() == "LowPt":
                #   InDetAmbiScoringTool.minPt = NewTrackingCuts.minPT()-100.*Units.MeV

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #   InDetAmbiScoringTool.OutputLevel = VERBOSE

            ToolSvc += InDetAmbiScoringTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiScoringTool
            #
            # --- load Ambiguity Processor
            #
            useBremMode = NewTrackingCuts.mode(
            ) == "Offline" or NewTrackingCuts.mode() == "SLHC"

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityProcessorTool as ProcessorTool
                use_low_pt_fitter = True if NewTrackingCuts.mode(
                ) == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (
                    NewTrackingCuts.mode() == "Pixel"
                    and InDetFlags.doMinBias()) else False
                fitter_list = [(InDetTrackFitter if not use_low_pt_fitter else
                                InDetTrackFitterLowPt)]
                if InDetFlags.doRefitInvalidCov():
                    from AthenaCommon import CfgGetter
                    fitter_list.append(CfgGetter.getPublicTool('KalmanFitter'))
                    fitter_list.append(
                        CfgGetter.getPublicTool('ReferenceKalmanFitter'))

                InDetAmbiguityProcessor = ProcessorTool(
                    name='InDetAmbiguityProcessor' +
                    NewTrackingCuts.extension(),
                    Fitter=fitter_list,
                    ScoringTool=InDetAmbiScoringTool,
                    SelectionTool=InDetAmbiTrackSelectionTool,
                    SuppressHoleSearch=False,
                    tryBremFit=InDetFlags.doBremRecovery() and useBremMode
                    and NewTrackingCuts.mode() != "DBM",
                    caloSeededBrem=InDetFlags.doCaloSeededBrem()
                    and NewTrackingCuts.mode() != "DBM",
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=True,
                    RejectTracksWithInvalidCov=InDetFlags.doRejectInvalidCov())
            else:
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool as ProcessorTool
                InDetAmbiguityProcessor = ProcessorTool(
                    name='InDetAmbiguityProcessor' +
                    NewTrackingCuts.extension(),
                    Fitter=InDetTrackFitter,
                    ScoringTool=InDetAmbiScoringTool,
                    SelectionTool=InDetAmbiTrackSelectionTool,
                    SuppressHoleSearch=False,
                    tryBremFit=InDetFlags.doBremRecovery() and useBremMode
                    and NewTrackingCuts.mode() != "DBM",
                    caloSeededBrem=InDetFlags.doCaloSeededBrem()
                    and NewTrackingCuts.mode() != "DBM",
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=True)

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                InDetAmbiguityProcessor.SplitProbTool = NnPixelClusterSplitProbTool
                InDetAmbiguityProcessor.sharedProbCut = prob1
                InDetAmbiguityProcessor.sharedProbCut2 = prob2
                InDetAmbiguityProcessor.SplitClusterAmbiguityMap = InDetKeys.SplitClusterAmbiguityMap(
                )
                if InDetFlags.doTIDE_RescalePixelCovariances():
                    InDetAmbiguityProcessor.applydRcorrection = True

            if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode(
            ) == "DBM":
                InDetAmbiguityProcessor.SuppressHoleSearch = True
            if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                if InDetAmbiguityProcessor.getName().find('Dense'):
                    pass
                else:
                    InDetAmbiguityProcessor.Fitter = InDetTrackFitterLowPt

            if InDetFlags.materialInteractions():
                InDetAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType(
                )
            else:
                InDetAmbiguityProcessor.MatEffects = 0

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #    InDetAmbiguityProcessor.OutputLevel = VERBOSE

            if InDetFlags.doTIDE_AmbiTrackMonitoring(
            ) and InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "PixelPrdAssociation"
                    or NewTrackingCuts.mode() == "DBM"
                    or NewTrackingCuts.mode() == "PixelFourLayer"
                    or NewTrackingCuts.mode() == "PixelThreeLayer"):
                InDetAmbiguityProcessor.ObserverTool = TrackObserverTool  #observerTool
                InDetAmbiguityProcessor.MonitorAmbiguitySolving = True

            ToolSvc += InDetAmbiguityProcessor
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiguityProcessor
            #
            # --- set input and output collection
            #
            InputTrackCollection = self.__SiTrackCollection
            self.__SiTrackCollection = ResolvedTrackCollectionKey
            #
            # --- configure Ambiguity solver
            #
            from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
            InDetAmbiguitySolver = Trk__TrkAmbiguitySolver(
                name='InDetAmbiguitySolver' + NewTrackingCuts.extension(),
                TrackInput=[InputTrackCollection],
                TrackOutput=self.__SiTrackCollection,
                AmbiguityProcessor=InDetAmbiguityProcessor)
            topSequence += InDetAmbiguitySolver
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiguitySolver

            #
            # --- Delete Silicon Sp-Seeded tracks
            #
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(key=SiSPSeededTrackCollectionKey)

            if ((NewTrackingCuts.mode() in ["Pixel", "SCT"])
                    or not InDetFlags.doSGDeletion()):
                if InDetFlags.doTruth():
                    #
                    # set up the truth info for this container
                    #
                    include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                    InDetTracksTruth = ConfiguredInDetTrackTruth(
                        self.__SiTrackCollection,
                        self.__SiTrackCollection + "DetailedTruth",
                        self.__SiTrackCollection + "TruthCollection")
                    #
                    # add final output for statistics
                    #
                    TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                    TrackCollectionTruthKeys += [
                        InDetTracksTruth.TracksTruth()
                    ]
                else:
                    TrackCollectionKeys += [self.__SiTrackCollection]
   def __init__(self, InputCollections = None, ResolvedTrackCollectionKey = None, SiSPSeededTrackCollectionKey = None , NewTrackingCuts = None, TrackCollectionKeys=[] , TrackCollectionTruthKeys=[]):
      
      from InDetRecExample.InDetJobProperties import InDetFlags
      from InDetRecExample.InDetKeys          import InDetKeys
      #
      # --- get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr                import ToolSvc
      from AthenaCommon.AlgSequence           import AlgSequence
      topSequence = AlgSequence()

      #
      # --- decide if use the association tool
      #
      if (len(InputCollections) > 0) and (NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "BeamGas" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks"  or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks"):
         usePrdAssociationTool = True
      else:
         usePrdAssociationTool = False

      #
      # --- get list of already associated hits (always do this, even if no other tracking ran before)
      #
      if usePrdAssociationTool:
         from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
         InDetPRD_Association = InDet__InDetTrackPRD_Association(name            = 'InDetPRD_Association'+NewTrackingCuts.extension(),
                                                                 AssociationTool = InDetPrdAssociationTool,
                                                                 TracksName      = list(InputCollections)) 
         topSequence += InDetPRD_Association
         if (InDetFlags.doPrintConfigurables()):
            print InDetPRD_Association

      # ------------------------------------------------------------
      #
      # ----------- SiSPSeededTrackFinder
      #
      # ------------------------------------------------------------

      if InDetFlags.doSiSPSeededTrackFinder():
         #
         # --- Space points seeds maker, use different ones for cosmics and collisions
         #
         if NewTrackingCuts.mode() == "DBM":
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
         elif InDetFlags.doCosmics():
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_Cosmic as SiSpacePointsSeedMaker
         elif InDetFlags.doHeavyIon():
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_HeavyIon as SiSpacePointsSeedMaker
         elif NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()) :
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_LowMomentum as SiSpacePointsSeedMaker
         elif NewTrackingCuts.mode() == "BeamGas":
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_BeamGas as SiSpacePointsSeedMaker
         else:
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker

         InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker (name                   = "InDetSpSeedsMaker"+NewTrackingCuts.extension(),
                                                               pTmin                  = NewTrackingCuts.minPT(),
                                                               maxdImpact             = NewTrackingCuts.maxPrimaryImpact(),
                                                               maxZ                   = NewTrackingCuts.maxZImpact(),
                                                               minZ                   = -NewTrackingCuts.maxZImpact(),
                                                               usePixel               = NewTrackingCuts.usePixel(),
                                                               SpacePointsPixelName   = InDetKeys.PixelSpacePoints(),
                                                               # useSCT                 = NewTrackingCuts.useSCT(),
                                                               useSCT                 = (NewTrackingCuts.useSCT() and NewTrackingCuts.useSCTSeeding()),
                                                               SpacePointsSCTName     = InDetKeys.SCT_SpacePoints(),
                                                               # useOverlapSpCollection = NewTrackingCuts.useSCT(),
                                                               useOverlapSpCollection = (NewTrackingCuts.useSCT() and NewTrackingCuts.useSCTSeeding()),
                                                               SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
                                                               radMax                 = NewTrackingCuts.radMax(),
                                                               RapidityCut            = NewTrackingCuts.maxEta())
            
         if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  NewTrackingCuts.mode() == "ForwardTracks":
            InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds()
            InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds()
         if usePrdAssociationTool:
            # not all classes have that property !!!
            InDetSiSpacePointsSeedMaker.UseAssociationTool = True
            InDetSiSpacePointsSeedMaker.AssociationTool    = InDetPrdAssociationTool
         if not InDetFlags.doCosmics():
            InDetSiSpacePointsSeedMaker.maxRadius1         = 0.75*NewTrackingCuts.radMax()
            InDetSiSpacePointsSeedMaker.maxRadius2         = NewTrackingCuts.radMax()
            InDetSiSpacePointsSeedMaker.maxRadius3         = NewTrackingCuts.radMax()
         if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
            InDetSiSpacePointsSeedMaker.pTmax              = NewTrackingCuts.maxPT()
            InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
         if NewTrackingCuts.mode() == "SLHC":
            InDetSiSpacePointsSeedMaker.minRadius1         = 0
            InDetSiSpacePointsSeedMaker.minRadius2         = 0
            InDetSiSpacePointsSeedMaker.minRadius3         = 0
            InDetSiSpacePointsSeedMaker.maxRadius1         =1000.*Units.mm
            InDetSiSpacePointsSeedMaker.maxRadius2         =1000.*Units.mm
            InDetSiSpacePointsSeedMaker.maxRadius3         =1000.*Units.mm
         if NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
            InDetSiSpacePointsSeedMaker.checkEta           = True
            InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
            InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
            InDetSiSpacePointsSeedMaker.RapidityCut        = NewTrackingCuts.maxEta()
         if NewTrackingCuts.mode() == "DBM":
            InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
            InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
            InDetSiSpacePointsSeedMaker.useDBM = True

                    
         #InDetSiSpacePointsSeedMaker.OutputLevel = VERBOSE
         ToolSvc += InDetSiSpacePointsSeedMaker
         if (InDetFlags.doPrintConfigurables()):
            print InDetSiSpacePointsSeedMaker
            
         #
         # --- Z-coordinates primary vertices finder (only for collisions)
         #
         if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
            from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
            InDetZvertexMaker = InDet__SiZvertexMaker_xk(name          = 'InDetZvertexMaker'+NewTrackingCuts.extension(),
                                                         Zmax          = NewTrackingCuts.maxZImpact(),
                                                         Zmin          = -NewTrackingCuts.maxZImpact(),
                                                         minRatio      = 0.17) # not default
            InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker

            if InDetFlags.doHeavyIon():
               InDetZvertexMaker.HistSize = 2000
               ###InDetZvertexMaker.minContent = 200 
               InDetZvertexMaker.minContent = 30
               
            ToolSvc += InDetZvertexMaker
            if (InDetFlags.doPrintConfigurables()):
               print InDetZvertexMaker

         else:
            InDetZvertexMaker = None

         #
         # --- SCT and Pixel detector elements road builder
         #
         from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
         InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(name               = 'InDetSiRoadMaker'+NewTrackingCuts.extension(),
                                                                        PropagatorTool     = InDetPatternPropagator,
                                                                        usePixel           = NewTrackingCuts.usePixel(),
                                                                        PixManagerLocation = InDetKeys.PixelManager(),
                                                                        useSCT             = NewTrackingCuts.useSCT(), 
                                                                        SCTManagerLocation = InDetKeys.SCT_Manager(),         
                                                                        RoadWidth          = NewTrackingCuts.RoadWidth())
         #InDetSiDetElementsRoadMaker.OutputLevel = VERBOSE
         ToolSvc += InDetSiDetElementsRoadMaker
         if (InDetFlags.doPrintConfigurables()):
            print      InDetSiDetElementsRoadMaker

         #
         # --- Local track finding using sdCaloSeededSSSpace point seed
         #

         useBremMode = NewTrackingCuts.mode() == "Offline" or NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "DBM"
         from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
         InDetSiTrackMaker = SiTrackMaker(name                      = 'InDetSiTrackMaker'+NewTrackingCuts.extension(),
                                          useSCT                    = NewTrackingCuts.useSCT(),
                                          usePixel                  = NewTrackingCuts.usePixel(),
                                          RoadTool                  = InDetSiDetElementsRoadMaker,
                                          CombinatorialTrackFinder  = InDetSiComTrackFinder,
                                          pTmin                     = NewTrackingCuts.minPT(),
                                          pTminBrem                 = NewTrackingCuts.minPTBrem(),
                                          pTminSSS                  = InDetFlags.pT_SSScut(),
                                          nClustersMin              = NewTrackingCuts.minClusters(),
                                          nHolesMax                 = NewTrackingCuts.nHolesMax(),
                                          nHolesGapMax              = NewTrackingCuts.nHolesGapMax(),
                                          SeedsFilterLevel          = NewTrackingCuts.seedFilterLevel(),
                                          Xi2max                    = NewTrackingCuts.Xi2max(),
                                          Xi2maxNoAdd               = NewTrackingCuts.Xi2maxNoAdd(),
                                          nWeightedClustersMin      = NewTrackingCuts.nWeightedClustersMin(),
                                          CosmicTrack               = InDetFlags.doCosmics(),
                                          Xi2maxMultiTracks         = NewTrackingCuts.Xi2max(), # was 3.
                                          useSSSseedsFilter         = InDetFlags.doSSSfilter(), 
                                          doMultiTracksProd         = True,
                                          useBremModel              = InDetFlags.doBremRecovery() and useBremMode, # only for NewTracking the brem is debugged !!!
                                          doCaloSeededBrem          = InDetFlags.doCaloSeededBrem(),
                                          doHadCaloSeedSSS          = InDetFlags.doHadCaloSeededSSS(),
                                          phiWidth                  = NewTrackingCuts.phiWidthBrem(),
                                          etaWidth                  = NewTrackingCuts.etaWidthBrem(),
                                          InputClusterContainerName = InDetKeys.CaloClusterROIContainer(), # "InDetCaloClusterROIs" 
                                          InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer(), # "InDetCaloClusterROIs" 
                                          UseAssociationTool        = usePrdAssociationTool)
					  
         if NewTrackingCuts.mode() == "DBM":
            InDetSiTrackMaker.MagneticFieldMode = "NoField"
            InDetSiTrackMaker.useBremModel = False
            InDetSiTrackMaker.doMultiTracksProd = False
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'			
            InDetSiTrackMaker.pTminSSS = -1
            InDetSiTrackMaker.CosmicTrack = False
            InDetSiTrackMaker.useSSSseedsFilter = False
            InDetSiTrackMaker.doCaloSeededBrem = False
            InDetSiTrackMaker.doHadCaloSeedSSS = False
            InDetSiTrackMaker.UseAssociationTool = False
					
         elif InDetFlags.doCosmics():
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
	   
         elif InDetFlags.doHeavyIon():
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'
         
         elif NewTrackingCuts.mode() == "LowPt":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'

         elif NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'           

         elif NewTrackingCuts.mode() == "BeamGas":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'
 
         elif NewTrackingCuts.mode() == "ForwardTracks":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'

         elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'

         elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks": 
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks' 

         elif NewTrackingCuts.mode() == "LargeD0":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'
         
         else:
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
					  
         #InDetSiTrackMaker.OutputLevel = VERBOSE				  
         ToolSvc += InDetSiTrackMaker
         if (InDetFlags.doPrintConfigurables()):
            print InDetSiTrackMaker
         #
         # set output track collection name
         #
         self.__SiTrackCollection = SiSPSeededTrackCollectionKey
         #
         # --- Setup Track finder using space points seeds
         #

         from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder

         if NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks":

          InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name           = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                    TrackTool      = InDetSiTrackMaker,
                                                                    TracksLocation = self.__SiTrackCollection,
                                                                    SeedsTool      = InDetSiSpacePointsSeedMaker,
                                                                    useZvertexTool = InDetFlags.useZvertexTool(),
                                                                    ZvertexTool    = InDetZvertexMaker,
                                                                    useNewStrategy = False,
                                                                    useMBTSTimeDiff = InDetFlags.useMBTSTimeDiff(),
                                                                    useZBoundFinding = False)
         
         else:
          InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name           = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                    TrackTool      = InDetSiTrackMaker,
                                                                    TracksLocation = self.__SiTrackCollection,
                                                                    SeedsTool      = InDetSiSpacePointsSeedMaker,
                                                                    useZvertexTool = InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM",
                                                                    ZvertexTool    = InDetZvertexMaker,
                                                                    useNewStrategy = InDetFlags.useNewSiSPSeededTF() and NewTrackingCuts.mode() != "DBM",
                                                                    useMBTSTimeDiff = InDetFlags.useMBTSTimeDiff(),
                                                                    useZBoundFinding = NewTrackingCuts.doZBoundary() and NewTrackingCuts.mode() != "DBM")   

         #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE 
         topSequence += InDetSiSPSeededTrackFinder
         if (InDetFlags.doPrintConfigurables()):
            print InDetSiSPSeededTrackFinder

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

      if InDetFlags.doAmbiSolving():
         #
         # --- load InnerDetector TrackSelectionTool
         #
         
         prob1 = InDetFlags.pixelClusterSplitProb1()
         prob2 = InDetFlags.pixelClusterSplitProb2()
         nhitsToAllowSplitting = 9

         if geoFlags.Run() == 1:
            prob1 = InDetFlags.pixelClusterSplitProb1_run1()
            prob2 = InDetFlags.pixelClusterSplitProb2_run1() 
            nhitsToAllowSplitting = 8

         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetDenseEnvAmbiTrackSelectionTool as AmbiTrackSelectionTool
         else:
           from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool as AmbiTrackSelectionTool
         InDetAmbiTrackSelectionTool = AmbiTrackSelectionTool(name                = 'InDetAmbiTrackSelectionTool'+NewTrackingCuts.extension(),
                                                              AssociationTool     = InDetPrdAssociationTool,
                                                              DriftCircleCutTool  = InDetTRTDriftCircleCut,
                                                              minHits             = NewTrackingCuts.minClusters(),
                                                              minNotShared        = NewTrackingCuts.minSiNotShared(),
                                                              maxShared           = NewTrackingCuts.maxShared(),
                                                              minTRTHits          = 0, # used for Si only tracking !!!
                                                              sharedProbCut       = 0.10,
                                                              UseParameterization = False,
                                                              Cosmics             = InDetFlags.doCosmics(),
                                                              doPixelSplitting    = InDetFlags.doPixelClusterSplitting() and NewTrackingCuts.mode != "DBM")

         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           InDetAmbiTrackSelectionTool.sharedProbCut             = prob1
           InDetAmbiTrackSelectionTool.sharedProbCut2            = prob2
           InDetAmbiTrackSelectionTool.minSiHitsToAllowSplitting = nhitsToAllowSplitting
           InDetAmbiTrackSelectionTool.minUniqueSCTHits          = 4
           InDetAmbiTrackSelectionTool.minTrackChi2ForSharedHits = 3
           InDetAmbiTrackSelectionTool.InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer()
           InDetAmbiTrackSelectionTool.doHadCaloSeed             = False   #Only split in cluster in region of interest
           InDetAmbiTrackSelectionTool.minPtSplit                = InDetFlags.pixelClusterSplitMinPt()       #Only allow split clusters on track withe pt greater than this MeV
           InDetAmbiTrackSelectionTool.phiWidth                  = 0.2     #Split cluster ROI size
           InDetAmbiTrackSelectionTool.etaWidth                  = 0.2     #Split cluster ROI size
         if NewTrackingCuts.mode() == "DBM":
           InDetAmbiTrackSelectionTool.Cosmics = False
           InDetAmbiTrackSelectionTool.UseParameterization   = False
           InDetAmbiTrackSelectionTool.doPixelSplitting      = False
           InDetAmbiTrackSelectionTool.maxShared             = 1000
           InDetAmbiTrackSelectionTool.maxTracksPerSharedPRD = 2
           InDetAmbiTrackSelectionTool.minHits               = 0
           InDetAmbiTrackSelectionTool.minNotShared          = 0
           InDetAmbiTrackSelectionTool.minScoreShareTracks   = 0.0
           InDetAmbiTrackSelectionTool.minTRTHits            = 0
           InDetAmbiTrackSelectionTool.sharedProbCut         = 0.1
        
         # if NewTrackingCuts.mode() == "ForwardTracks":
         #    InDetAmbiTrackSelectionTool.OutputLevel = VERBOSE

         ToolSvc += InDetAmbiTrackSelectionTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiTrackSelectionTool
         #
         # --- set up different Scoring Tool for collisions and cosmics
         #
         if InDetFlags.doCosmics() and NewTrackingCuts.mode() != "DBM":
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
            InDetAmbiScoringTool = InDet__InDetCosmicScoringTool(name                 = 'InDetCosmicsScoringTool'+NewTrackingCuts.extension(),
                                                                 nWeightedClustersMin = NewTrackingCuts.nWeightedClustersMin(),
                                                                 minTRTHits           = 0,
                                                                 SummaryTool          = InDetTrackSummaryTool)
         else:
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
            InDetAmbiScoringTool = InDet__InDetAmbiScoringTool(name                    = 'InDetAmbiScoringTool'+NewTrackingCuts.extension(),
                                                               Extrapolator            = InDetExtrapolator,
                                                               SummaryTool             = InDetTrackSummaryTool,
                                                               DriftCircleCutTool      = InDetTRTDriftCircleCut,
                                                               useAmbigFcn             = True,  # this is NewTracking
                                                               useTRT_AmbigFcn         = False,
                                                               minPt                   = NewTrackingCuts.minPT(),
                                                               maxRPhiImp              = NewTrackingCuts.maxPrimaryImpact(),
                                                               maxZImp                 = NewTrackingCuts.maxZImpact(),
                                                               maxEta                  = NewTrackingCuts.maxEta(),
                                                               minSiClusters           = NewTrackingCuts.minClusters(),
                                                               minPixel                = NewTrackingCuts.minPixel(),                                     
                                                               maxSiHoles              = NewTrackingCuts.maxHoles(),
                                                               maxPixelHoles           = NewTrackingCuts.maxPixelHoles(),
                                                               maxSCTHoles             = NewTrackingCuts.maxSCTHoles(),
                                                               maxDoubleHoles          = NewTrackingCuts.maxDoubleHoles(),
                                                               usePixel                = NewTrackingCuts.usePixel(),
                                                               useSCT                  = NewTrackingCuts.useSCT(),
                                                               minTRTonTrk             = 0,
                                                               minTRTPrecisionFraction = 0);
            # allow for some overlap for low-pt tracking
            #if InDetFlags.doLowPt() and not NewTrackingCuts.mode() == "LowPt":
            #   InDetAmbiScoringTool.minPt = NewTrackingCuts.minPT()-100.*Units.MeV

         # if NewTrackingCuts.mode() == "ForwardTracks":
         #   InDetAmbiScoringTool.OutputLevel = VERBOSE   

         ToolSvc += InDetAmbiScoringTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiScoringTool
         #
         # --- load Ambiguity Processor
         #
         useBremMode = NewTrackingCuts.mode() == "Offline" or NewTrackingCuts.mode() == "SLHC"

         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityProcessorTool as ProcessorTool
         else:
           from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool as ProcessorTool
         InDetAmbiguityProcessor = ProcessorTool(name               = 'InDetAmbiguityProcessor'+NewTrackingCuts.extension(),
                                                 Fitter             = InDetTrackFitter,
                                                 ScoringTool        = InDetAmbiScoringTool,
                                                 SelectionTool      = InDetAmbiTrackSelectionTool,
                                                 SuppressHoleSearch = False,
                                                 tryBremFit         = InDetFlags.doBremRecovery() and useBremMode and NewTrackingCuts.mode() != "DBM",
                                                 caloSeededBrem     = InDetFlags.doCaloSeededBrem() and NewTrackingCuts.mode() != "DBM",
                                                 pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                 RefitPrds          = not InDetFlags.refitROT())
         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           InDetAmbiguityProcessor.sharedProbCut             = prob1
           InDetAmbiguityProcessor.sharedProbCut2            = prob2
           InDetAmbiguityProcessor.SplitClusterAmbiguityMap  = InDetKeys.SplitClusterAmbiguityMap()

         if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode() == "DBM":
            InDetAmbiguityProcessor.SuppressHoleSearch = True
         if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
            InDetAmbiguityProcessor.Fitter = InDetTrackFitterLowPt
             
         if InDetFlags.materialInteractions():
            InDetAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType()
         else:
            InDetAmbiguityProcessor.MatEffects = 0

         # if NewTrackingCuts.mode() == "ForwardTracks":
         #    InDetAmbiguityProcessor.OutputLevel = VERBOSE

         ToolSvc += InDetAmbiguityProcessor
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiguityProcessor
         #
         # --- set input and output collection
         #
         InputTrackCollection     = self.__SiTrackCollection
         self.__SiTrackCollection = ResolvedTrackCollectionKey
         #
         # --- configure Ambiguity solver
         #
         from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
         InDetAmbiguitySolver = Trk__TrkAmbiguitySolver(name               = 'InDetAmbiguitySolver'+NewTrackingCuts.extension(),
                                                        TrackInput         = [ InputTrackCollection ],
                                                        TrackOutput        = self.__SiTrackCollection,
                                                        AmbiguityProcessor = InDetAmbiguityProcessor)
         topSequence += InDetAmbiguitySolver
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiguitySolver

         #
         # --- Delete Silicon Sp-Seeded tracks
         #
         from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
         InDetSGDeletionAlg(key = SiSPSeededTrackCollectionKey)

         if ( ( NewTrackingCuts.mode() in ["Pixel", "SCT"] ) or not InDetFlags.doSGDeletion()):
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__SiTrackCollection,
                                                            self.__SiTrackCollection+"DetailedTruth",
                                                            self.__SiTrackCollection+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__SiTrackCollection ]
Пример #3
0
    def __init__(self,
                 NewTrackingCuts=None,
                 SiTrackCollection=None,
                 ExtendedTrackCollection=None,
                 ExtendedTracksMap=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[],
                 doPhase=True):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from AthenaCommon.DetFlags import DetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        #
        # ---------- TRT_TrackExtension
        #
        if InDetFlags.doTRTExtension() and InDetFlags.doTRTExtensionNew():

            #
            # Track extension to TRT algorithm
            #
            # set output extension map name
            OutputExtendedTracks = ExtendedTracksMap

            if doPhase:

                from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionToolCosmics
                InDetTRTExtensionToolPhase = InDet__TRT_TrackExtensionToolCosmics(
                    name='InDetTRT_ExtensionToolPhase',
                    Propagator=InDetPropagator,
                    Extrapolator=InDetExtrapolator,
                    TRT_ClustersContainer=InDetKeys.
                    TRT_DriftCirclesUncalibrated(),
                    SearchNeighbour=False,  #needs debugging!!!
                    RoadWidth=20.)

                ToolSvc += InDetTRTExtensionToolPhase

                from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
                InDetTRTExtensionPhase = InDet__TRT_TrackExtensionAlg(
                    name='InDetTRT_ExtensionPhase' +
                    NewTrackingCuts.extension(),
                    InputTracksLocation=SiTrackCollection,
                    ExtendedTracksLocation=OutputExtendedTracks,
                    TrackExtensionTool=InDetTRTExtensionToolPhase)

                topSequence += InDetTRTExtensionPhase
                if (InDetFlags.doPrintConfigurables()):
                    print InDetTRTExtensionPhase

            #
            else:
                from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
                InDetTRTExtension = InDet__TRT_TrackExtensionAlg(
                    name='InDetTRT_Extension' + NewTrackingCuts.extension(),
                    InputTracksLocation=SiTrackCollection,
                    ExtendedTracksLocation=OutputExtendedTracks,
                    TrackExtensionTool=InDetTRTExtensionTool)
                #InDetTRTExtension.OutputLevel = VERBOSE
                topSequence += InDetTRTExtension
                if (InDetFlags.doPrintConfigurables()):
                    print InDetTRTExtension

        #
        # ------------ Track Extension Processor
        #
        if InDetFlags.doExtensionProcessor() and InDetFlags.doTRTExtensionNew(
        ):

            if InDetFlags.trtExtensionType() is 'DAF':
                #
                # --- DAF Fitter setup
                #
                from TrkCompetingRIOsOnTrackTool.TrkCompetingRIOsOnTrackToolConf import Trk__CompetingRIOsOnTrackTool
                InDetCompetingRotCreator = Trk__CompetingRIOsOnTrackTool(
                    name='InDetCompetingRotCreator' +
                    NewTrackingCuts.extension(),
                    ToolForCompPixelClusters=None,  # default
                    ToolForCompSCT_Clusters=None,  # default
                    ToolForCompTRT_DriftCircles=InDetCompetingTRT_DC_Tool)
                ToolSvc += InDetCompetingRotCreator
                if (InDetFlags.doPrintConfigurables()):
                    print InDetCompetingRotCreator
                #
                from TrkDeterministicAnnealingFilter.TrkDeterministicAnnealingFilterConf import Trk__DeterministicAnnealingFilter
                InDetExtensionFitter = Trk__DeterministicAnnealingFilter(
                    name='InDetDAF' + NewTrackingCuts.extension(),
                    ToolForExtrapolation=InDetExtrapolator,
                    ToolForCompetingROTsCreation=InDetCompetingRotCreator,
                    ToolForUpdating=InDetUpdator,
                    AnnealingScheme=[200., 81., 9., 4., 1., 1., 1.],
                    DropOutlierCutValue=1.E-7,
                    OutlierCutValue=0.01)
                ToolSvc += InDetExtensionFitter
                if (InDetFlags.doPrintConfigurables()):
                    print InDetExtensionFitter
            else:
                InDetExtensionFitter = InDetTrackFitter
                if NewTrackingCuts.mode() == "LowPt":
                    InDetExtensionFitter = InDetTrackFitterLowPt

            #
            # --- load scoring for extension
            #
            if InDetFlags.doCosmics():
                from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
                InDetExtenScoringTool = InDet__InDetCosmicScoringTool(
                    name='InDetCosmicExtenScoringTool',
                    nWeightedClustersMin=0,
                    minTRTHits=NewTrackingCuts.minTRTonTrk(),
                    SummaryTool=InDetTrackSummaryTool)

            else:
                from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
                InDetExtenScoringTool = InDet__InDetAmbiScoringTool(
                    name='InDetExtenScoringTool' + NewTrackingCuts.extension(),
                    Extrapolator=InDetExtrapolator,
                    SummaryTool=InDetTrackSummaryTool,
                    DriftCircleCutTool=InDetTRTDriftCircleCut,
                    useAmbigFcn=True,  # this is NewTracking  
                    useTRT_AmbigFcn=False,
                    minPt=NewTrackingCuts.minPT(),
                    maxRPhiImp=NewTrackingCuts.maxPrimaryImpact(),
                    maxZImp=NewTrackingCuts.maxZImpact(),
                    maxEta=NewTrackingCuts.maxEta(),
                    minSiClusters=NewTrackingCuts.minClusters(),
                    minPixel=NewTrackingCuts.minPixel(),
                    maxSiHoles=NewTrackingCuts.maxHoles(),
                    maxPixelHoles=NewTrackingCuts.maxPixelHoles(),
                    maxSCTHoles=NewTrackingCuts.maxSCTHoles(),
                    maxDoubleHoles=NewTrackingCuts.maxDoubleHoles(),
                    usePixel=NewTrackingCuts.usePixel(),
                    useSCT=NewTrackingCuts.useSCT(),
                    minTRTonTrk=NewTrackingCuts.minTRTonTrk(),
                    minTRTPrecisionFraction=NewTrackingCuts.minTRTPrecFrac())

                if InDetFlags.trackFitterType() in [
                        'KalmanFitter', 'KalmanDNAFitter',
                        'ReferenceKalmanFitter'
                ]:
                    InDetExtenScoringTool.minTRTPrecisionFraction = 0.2

            #InDetExtenScoringTool.OutputLevel = VERBOSE
            ToolSvc += InDetExtenScoringTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetExtenScoringTool

            #
            # --- output track collection
            #
            self.__ForwardTrackCollection = ExtendedTrackCollection
            #
            # --- get configured track extension processor
            #
            if doPhase:

                from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor
                InDetExtensionProcessorPhase = InDet__InDetExtensionProcessor(
                    name="InDetExtensionProcessorPhase" +
                    NewTrackingCuts.extension(),
                    TrackName=SiTrackCollection,
                    Cosmics=True,
                    ExtensionMap=OutputExtendedTracks,
                    NewTrackName=self.__ForwardTrackCollection,
                    TrackFitter=InDetExtensionFitter,
                    ScoringTool=InDetExtenScoringTool,
                    suppressHoleSearch=False,  # does not work properly
                    tryBremFit=InDetFlags.doBremRecovery(),
                    caloSeededBrem=InDetFlags.doCaloSeededBrem(),
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=not (InDetFlags.refitROT() or
                                   (InDetFlags.trtExtensionType() is 'DAF')))
                #InDetExtensionProcessor.OutputLevel = VERBOSE
                if InDetFlags.materialInteractions():
                    InDetExtensionProcessorPhase.matEffects = InDetFlags.materialInteractionsType(
                    )
                else:
                    InDetExtensionProcessorPhase.matEffects = 0

                topSequence += InDetExtensionProcessorPhase
                if (InDetFlags.doPrintConfigurables()):
                    print InDetExtensionProcessorPhase

            else:

                from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor
                InDetExtensionProcessor = InDet__InDetExtensionProcessor(
                    name="InDetExtensionProcessor" +
                    NewTrackingCuts.extension(),
                    TrackName=SiTrackCollection,
                    Cosmics=InDetFlags.doCosmics(),
                    ExtensionMap=OutputExtendedTracks,
                    NewTrackName=self.__ForwardTrackCollection,
                    TrackFitter=InDetExtensionFitter,
                    ScoringTool=InDetExtenScoringTool,
                    suppressHoleSearch=False,  # does not work properly
                    tryBremFit=InDetFlags.doBremRecovery(),
                    caloSeededBrem=InDetFlags.doCaloSeededBrem(),
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=not (InDetFlags.refitROT() or
                                   (InDetFlags.trtExtensionType() is 'DAF')))
                #InDetExtensionProcessor.OutputLevel = VERBOSE
                if InDetFlags.materialInteractions():
                    InDetExtensionProcessor.matEffects = InDetFlags.materialInteractionsType(
                    )
                else:
                    InDetExtensionProcessor.matEffects = 0

                topSequence += InDetExtensionProcessor

                if (InDetFlags.doPrintConfigurables()):
                    print InDetExtensionProcessor

            # --- Delete Resolved Si tracks and extension map
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(container="TrackExtensionMap#",
                               key=OutputExtendedTracks)
            if not InDetFlags.doMonitoringAlignment():
                InDetSGDeletionAlg(key=SiTrackCollection)

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

            #
        else:
            self.__ForwardTrackCollection = SiTrackCollection
Пример #4
0
    pTminBrem=NewTrackingCuts.minPTBrem(),
    pTminSSS=InDetFlags.pT_SSScut(),
    nClustersMin=NewTrackingCuts.minClusters(),
    nHolesMax=NewTrackingCuts.nHolesMax(),
    nHolesGapMax=NewTrackingCuts.nHolesGapMax(),
    SeedsFilterLevel=NewTrackingCuts.seedFilterLevel(),
    Xi2max=NewTrackingCuts.Xi2max(),
    Xi2maxNoAdd=NewTrackingCuts.Xi2maxNoAdd(),
    nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(),
    CosmicTrack=InDetFlags.doCosmics(),
    Xi2maxMultiTracks=NewTrackingCuts.Xi2max(),  # was 3.
    useSSSseedsFilter=InDetFlags.doSSSfilter(),
    doMultiTracksProd=True,
    useBremModel=InDetFlags.doBremRecovery()
    and useBremMode,  # only for NewTracking the brem is debugged !!!
    doCaloSeededBrem=InDetFlags.doCaloSeededBrem(),
    doHadCaloSeedSSS=InDetFlags.doHadCaloSeededSSS(),
    phiWidth=NewTrackingCuts.phiWidthBrem(),
    etaWidth=NewTrackingCuts.etaWidthBrem(),
    InputClusterContainerName=InDetKeys.CaloClusterROIContainer(
    ),  # "InDetCaloClusterROIs"
    InputHadClusterContainerName=InDetKeys.HadCaloClusterROIContainer(
    ),  # "InDetCaloClusterROIs"
    UseAssociationTool=usePrdAssociationTool)
InDetSiTrackMaker.TrackPatternRecoInfo = "SiSPSeededFinder"
if not doBeamSpot:
    InDetSiTrackMaker.BeamSpotKey = ""

# Set up SiSPSeededTrackFinder (alg)
# InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
from InDetRecExample import TrackingCommon as TrackingCommon
Пример #5
0
   def __init__(self, NewTrackingCuts = None, SiTrackCollection = None, ExtendedTrackCollection = None, ExtendedTracksMap = None, TrackCollectionKeys=[], TrackCollectionTruthKeys=[] , doPhase = True):
      
      from InDetRecExample.InDetJobProperties import InDetFlags
      from AthenaCommon.DetFlags              import DetFlags
      from InDetRecExample.InDetKeys          import InDetKeys
      
      import InDetRecExample.TrackingCommon   as TrackingCommon
      #
      # get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr                import ToolSvc
      from AthenaCommon.AlgSequence           import AlgSequence
      topSequence = AlgSequence()
      
      #    
      # ---------- TRT_TrackExtension
      #
      if InDetFlags.doTRTExtension() and InDetFlags.doTRTExtensionNew():


         #
         # Track extension to TRT algorithm
         #
         # set output extension map name
         OutputExtendedTracks = ExtendedTracksMap

         if doPhase:

           from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionToolCosmics
           InDetTRTExtensionToolPhase = TrackingCommon.getInDetTRT_ExtensionToolPhase()


           from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
           InDetTRTExtensionPhase    = InDet__TRT_TrackExtensionAlg (name                   = 'InDetTRT_ExtensionPhase'+NewTrackingCuts.extension(),
                                                                     InputTracksLocation    = SiTrackCollection,
                                                                     ExtendedTracksLocation = OutputExtendedTracks,
                                                                     TrackExtensionTool     = InDetTRTExtensionToolPhase)

           topSequence += InDetTRTExtensionPhase
           if (InDetFlags.doPrintConfigurables()):
            printfunc (InDetTRTExtensionPhase)

         else:
          cuts_args = {}
          if NewTrackingCuts is not None :
             cuts_args={'TrackingCuts': NewTrackingCuts}
          from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
          InDetTRTExtension = InDet__TRT_TrackExtensionAlg(name                   = 'InDetTRT_Extension'+NewTrackingCuts.extension(),
                                                           InputTracksLocation    = SiTrackCollection,
                                                           ExtendedTracksLocation = OutputExtendedTracks,
                                                           TrackExtensionTool     = TrackingCommon.getInDetTRT_ExtensionTool(**cuts_args))
          #InDetTRTExtension.OutputLevel = VERBOSE
          topSequence += InDetTRTExtension
          if (InDetFlags.doPrintConfigurables()):
            printfunc (InDetTRTExtension)
   
      #
      # ------------ Track Extension Processor
      #
      if InDetFlags.doExtensionProcessor() and InDetFlags.doTRTExtensionNew():
            
         if InDetFlags.trtExtensionType() == 'DAF' :
            #
            # --- DAF Fitter setup
            #
            from TrkCompetingRIOsOnTrackTool.TrkCompetingRIOsOnTrackToolConf import Trk__CompetingRIOsOnTrackTool
            InDetCompetingRotCreator =  Trk__CompetingRIOsOnTrackTool( name                        = 'InDetCompetingRotCreator'+NewTrackingCuts.extension(),
                                                                       ToolForCompPixelClusters    = None,      # default
                                                                       ToolForCompSCT_Clusters     = None,      # default
                                                                       ToolForCompTRT_DriftCircles = InDetCompetingTRT_DC_Tool )
            ToolSvc += InDetCompetingRotCreator
            if (InDetFlags.doPrintConfigurables()):
               printfunc (InDetCompetingRotCreator)
            #
            from TrkDeterministicAnnealingFilter.TrkDeterministicAnnealingFilterConf import Trk__DeterministicAnnealingFilter
            InDetExtensionFitter =  Trk__DeterministicAnnealingFilter( name = 'InDetDAF'+NewTrackingCuts.extension(),
                                                                       ToolForExtrapolation           = InDetExtrapolator,
                                                                       ToolForCompetingROTsCreation   = InDetCompetingRotCreator,
                                                                       ToolForUpdating                = InDetUpdator,
                                                                       AnnealingScheme                = [200., 81., 9., 4., 1., 1., 1.],
                                                                       DropOutlierCutValue            = 1.E-7,
                                                                       OutlierCutValue                = 0.01 )
            ToolSvc += InDetExtensionFitter
            if (InDetFlags.doPrintConfigurables()):
               printfunc (InDetExtensionFitter)
         else:
            from AthenaCommon import CfgGetter
            InDetExtensionFitter = CfgGetter.getPublicTool('InDetTrackFitter' if NewTrackingCuts.mode() != "LowPt" else  'InDetTrackFitterLowPt')

         #
         # --- load scoring for extension
         #
         if InDetFlags.doCosmics():
            InDetExtenScoringTool = TrackingCommon.getInDetCosmicExtenScoringTool(NewTrackingCuts)
         else:
            InDetExtenScoringTool = TrackingCommon.getInDetExtenScoringTool(NewTrackingCuts)

         #
         # --- output track collection
         #
         self.__ForwardTrackCollection = ExtendedTrackCollection 
         #
         # --- get configured track extension processor
         #
         if doPhase:
         
          from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
          InDetExtensionProcessorPhase = InDet__InDetExtensionProcessor ( name               = "InDetExtensionProcessorPhase"+NewTrackingCuts.extension(),
                                                                    TrackName          = SiTrackCollection,
                                                                    Cosmics            = True,
                                                                    ExtensionMap       = OutputExtendedTracks,
                                                                    NewTrackName       = self.__ForwardTrackCollection,
                                                                    TrackFitter        = InDetExtensionFitter,
                                                                    TrackSummaryTool   = TrackingCommon.getInDetTrackSummaryTool(),
                                                                    ScoringTool        = InDetExtenScoringTool,
                                                                    suppressHoleSearch = False,  # does not work properly
                                                                    tryBremFit         = InDetFlags.doBremRecovery(),
                                                                    caloSeededBrem     = InDetFlags.doCaloSeededBrem(),
                                                                    pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                                    RefitPrds          = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() == 'DAF')))
         #InDetExtensionProcessor.OutputLevel = VERBOSE
          if InDetFlags.materialInteractions():
             InDetExtensionProcessorPhase.matEffects = InDetFlags.materialInteractionsType()
          else:
             InDetExtensionProcessorPhase.matEffects = 0
   
          topSequence += InDetExtensionProcessorPhase
          if (InDetFlags.doPrintConfigurables()):
              printfunc (InDetExtensionProcessorPhase)

         else:

          from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
          InDetExtensionProcessor = InDet__InDetExtensionProcessor ( name               = "InDetExtensionProcessor"+NewTrackingCuts.extension(),
                                                                    TrackName          = SiTrackCollection,
                                                                    Cosmics            = InDetFlags.doCosmics(),
                                                                    ExtensionMap       = OutputExtendedTracks,
                                                                    NewTrackName       = self.__ForwardTrackCollection,
                                                                    TrackFitter        = InDetExtensionFitter,
                                                                    TrackSummaryTool   = TrackingCommon.getInDetTrackSummaryTool(),
                                                                    ScoringTool        = InDetExtenScoringTool,
                                                                    suppressHoleSearch = False,  # does not work properly
                                                                    tryBremFit         = InDetFlags.doBremRecovery(),
                                                                    caloSeededBrem     = InDetFlags.doCaloSeededBrem(),
                                                                    pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                                    RefitPrds          = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() == 'DAF')))
          #InDetExtensionProcessor.OutputLevel = VERBOSE
          if InDetFlags.materialInteractions():
             InDetExtensionProcessor.matEffects = InDetFlags.materialInteractionsType()
          else:
             InDetExtensionProcessor.matEffects = 0
   
          topSequence += InDetExtensionProcessor

          if (InDetFlags.doPrintConfigurables()):
             printfunc (InDetExtensionProcessor)
         
         # --- Delete Resolved Si tracks and extension map
         from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg         
         InDetSGDeletionAlg(container = "TrackExtensionMap#", key = OutputExtendedTracks)
         if not InDetFlags.doMonitoringAlignment():
            InDetSGDeletionAlg(key = SiTrackCollection)
         
         #
         # ------------ Track truth.
         #
         if not InDetFlags.doSGDeletion():
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__ForwardTrackCollection,
                                                            self.__ForwardTrackCollection+"DetailedTruth",
                                                            self.__ForwardTrackCollection+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__ForwardTrackCollection ]
               
         #
      else:
         self.__ForwardTrackCollection = SiTrackCollection
Пример #6
0
    def __init__(self,
                 InputCollections=None,
                 ResolvedTrackCollectionKey=None,
                 SiSPSeededTrackCollectionKey=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.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        #
        # --- decide if use the association tool
        #
        if (len(InputCollections) > 0) and (
                NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode()
                == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0"
                or NewTrackingCuts.mode() == "R3LargeD0"
                or NewTrackingCuts.mode() == "LowPtLargeD0"
                or NewTrackingCuts.mode() == "BeamGas"
                or NewTrackingCuts.mode() == "ForwardTracks"
                or NewTrackingCuts.mode() == "ForwardSLHCTracks"
                or NewTrackingCuts.mode() == "Disappearing"
                or NewTrackingCuts.mode() == "VeryForwardSLHCTracks"
                or NewTrackingCuts.mode() == "SLHCConversionFinding"):
            usePrdAssociationTool = True
        else:
            usePrdAssociationTool = False

        #
        # --- get list of already associated hits (always do this, even if no other tracking ran before)
        #
        asso_tool = None
        if usePrdAssociationTool:
            prefix = 'InDet'
            suffix = NewTrackingCuts.extension()
            InDetPRD_Association = TrackingCommon.getInDetTrackPRD_Association(
                namePrefix=prefix,
                nameSuffix=suffix,
                TracksName=list(InputCollections))

            # asso_tool = TrackingCommon.getConstPRD_AssociationTool(namePrefix     = prefix, nameSuffix = suffix)

            topSequence += InDetPRD_Association
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetPRD_Association)

        # ------------------------------------------------------------
        #
        # ----------- SiSPSeededTrackFinder
        #
        # ------------------------------------------------------------

        if InDetFlags.doSiSPSeededTrackFinder():
            #
            # --- Space points seeds maker, use different ones for cosmics and collisions
            #
            if NewTrackingCuts.mode() == "DBM":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
            elif InDetFlags.doCosmics():
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_Cosmic as SiSpacePointsSeedMaker
            elif InDetFlags.doHeavyIon():
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_HeavyIon as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_LowMomentum as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "BeamGas":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_BeamGas as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ITK as SiSpacePointsSeedMaker
            else:
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker

            InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker(
                name="InDetSpSeedsMaker" + NewTrackingCuts.extension(),
                pTmin=NewTrackingCuts.minPT(),
                maxdImpact=NewTrackingCuts.maxPrimaryImpact(),
                maxZ=NewTrackingCuts.maxZImpact(),
                minZ=-NewTrackingCuts.maxZImpact(),
                usePixel=NewTrackingCuts.usePixel(),
                SpacePointsPixelName=InDetKeys.PixelSpacePoints(),
                # useSCT                 = NewTrackingCuts.useSCT(),
                useSCT=(NewTrackingCuts.useSCT()
                        and NewTrackingCuts.useSCTSeeding()),
                SpacePointsSCTName=InDetKeys.SCT_SpacePoints(),
                # useOverlapSpCollection = NewTrackingCuts.useSCT(),
                useOverlapSpCollection=(NewTrackingCuts.useSCT()
                                        and NewTrackingCuts.useSCTSeeding()),
                SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(),
                radMax=NewTrackingCuts.radMax(),
                RapidityCut=NewTrackingCuts.maxEta())

            if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon(
            ) or NewTrackingCuts.mode() == "ForwardTracks":
                InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds(
                )
                InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds(
                )
                if not InDetFlags.doHeavyIon():
                    InDetSiSpacePointsSeedMaker.maxSeedsForSpacePointStrips = NewTrackingCuts.MaxSeedsPerSP_Strips(
                    )
                    InDetSiSpacePointsSeedMaker.maxSeedsForSpacePointPixels = NewTrackingCuts.MaxSeedsPerSP_Pixels(
                    )
                    InDetSiSpacePointsSeedMaker.alwaysKeepConfirmedStripSeeds = NewTrackingCuts.KeepAllConfirmedStripSeeds(
                    )
                    InDetSiSpacePointsSeedMaker.alwaysKeepConfirmedPixelSeeds = NewTrackingCuts.KeepAllConfirmedPixelSeeds(
                    )

            if NewTrackingCuts.mode() == "R3LargeD0":
                InDetSiSpacePointsSeedMaker.optimisePhiBinning = False
                InDetSiSpacePointsSeedMaker.usePixel = False
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.maxSeedsForSpacePointStrips = NewTrackingCuts.MaxSeedsPerSP_Strips(
                )
                InDetSiSpacePointsSeedMaker.alwaysKeepConfirmedStripSeeds = NewTrackingCuts.KeepAllConfirmedStripSeeds(
                )
                InDetSiSpacePointsSeedMaker.maxdRadius = 150
                InDetSiSpacePointsSeedMaker.seedScoreBonusConfirmationSeed = -2000  #let's be generous

            if usePrdAssociationTool:
                # not all classes have that property !!!
                InDetSiSpacePointsSeedMaker.PRDtoTrackMap      = prefix+'PRDtoTrackMap'+suffix \
                                                                    if usePrdAssociationTool else ''
            if not InDetFlags.doCosmics():
                InDetSiSpacePointsSeedMaker.maxRadius1 = 0.75 * NewTrackingCuts.radMax(
                )
                InDetSiSpacePointsSeedMaker.maxRadius2 = NewTrackingCuts.radMax(
                )
                InDetSiSpacePointsSeedMaker.maxRadius3 = NewTrackingCuts.radMax(
                )
            if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                try:
                    InDetSiSpacePointsSeedMaker.pTmax = NewTrackingCuts.maxPT()
                except:
                    pass
                InDetSiSpacePointsSeedMaker.mindRadius = 4.0
            if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "SLHCConversionFinding":
                InDetSiSpacePointsSeedMaker.minRadius1 = 0
                InDetSiSpacePointsSeedMaker.minRadius2 = 0
                InDetSiSpacePointsSeedMaker.minRadius3 = 0
                InDetSiSpacePointsSeedMaker.maxRadius1 = 1000. * Units.mm
                InDetSiSpacePointsSeedMaker.maxRadius2 = 1000. * Units.mm
                InDetSiSpacePointsSeedMaker.maxRadius3 = 1000. * Units.mm
            if NewTrackingCuts.mode(
            ) == "ForwardTracks" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                InDetSiSpacePointsSeedMaker.checkEta = True
                InDetSiSpacePointsSeedMaker.etaMin = NewTrackingCuts.minEta()
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.RapidityCut = NewTrackingCuts.maxEta(
                )
            if NewTrackingCuts.mode() == "DBM":
                InDetSiSpacePointsSeedMaker.etaMin = NewTrackingCuts.minEta()
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.useDBM = True

            #InDetSiSpacePointsSeedMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiSpacePointsSeedMaker
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetSiSpacePointsSeedMaker)

            #
            # --- Z-coordinates primary vertices finder (only for collisions)
            #
            if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
                from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
                InDetZvertexMaker = InDet__SiZvertexMaker_xk(
                    name='InDetZvertexMaker' + NewTrackingCuts.extension(),
                    Zmax=NewTrackingCuts.maxZImpact(),
                    Zmin=-NewTrackingCuts.maxZImpact(),
                    minRatio=0.17)  # not default
                InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker

                if InDetFlags.doHeavyIon():
                    InDetZvertexMaker.HistSize = 2000
                    ###InDetZvertexMaker.minContent = 200
                    InDetZvertexMaker.minContent = 30

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

            else:
                InDetZvertexMaker = None

            #
            # --- SCT and Pixel detector elements road builder
            #
            from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
            InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(
                name='InDetSiRoadMaker' + NewTrackingCuts.extension(),
                PropagatorTool=InDetPatternPropagator,
                usePixel=NewTrackingCuts.usePixel(),
                PixManagerLocation=InDetKeys.PixelManager(),
                useSCT=NewTrackingCuts.useSCT(),
                SCTManagerLocation=InDetKeys.SCT_Manager(),
                RoadWidth=NewTrackingCuts.RoadWidth())
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetSiDetElementsRoadMaker)
            # Condition algorithm for InDet__SiDetElementsRoadMaker_xk
            if DetFlags.haveRIO.pixel_on():
                # Condition algorithm for SiCombinatorialTrackFinder_xk
                from AthenaCommon.AlgSequence import AthSequencer
                condSeq = AthSequencer("AthCondSeq")
                if not hasattr(condSeq,
                               "InDetSiDetElementBoundaryLinksPixelCondAlg"):
                    from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
                    condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(
                        name="InDetSiDetElementBoundaryLinksPixelCondAlg",
                        ReadKey="PixelDetectorElementCollection",
                        WriteKey="PixelDetElementBoundaryLinks_xk",
                        UsePixelDetectorManager=True)

            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")

                if not hasattr(condSeq,
                               "InDetSiDetElementBoundaryLinksSCTCondAlg"):
                    from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
                    condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(
                        name="InDetSiDetElementBoundaryLinksSCTCondAlg",
                        ReadKey="SCT_DetectorElementCollection",
                        WriteKey="SCT_DetElementBoundaryLinks_xk")

            #
            # --- Local track finding using sdCaloSeededSSSpace point seed
            #
            # @TODO ensure that PRD association map is used if usePrdAssociationTool is set
            is_dbm = InDetFlags.doDBMstandalone() or NewTrackingCuts.extension(
            ) == 'DBM'
            rot_creator_digital = TrackingCommon.getInDetRotCreatorDigital(
            ) if not is_dbm else TrackingCommon.getInDetRotCreatorDBM()

            from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk
            track_finder = InDet__SiCombinatorialTrackFinder_xk(
                name='InDetSiComTrackFinder' + NewTrackingCuts.extension(),
                PropagatorTool=InDetPatternPropagator,
                UpdatorTool=InDetPatternUpdator,
                RIOonTrackTool=rot_creator_digital,
                usePixel=DetFlags.haveRIO.pixel_on(),
                useSCT=DetFlags.haveRIO.SCT_on() if not is_dbm else False,
                PixelClusterContainer=InDetKeys.PixelClusters(),
                SCT_ClusterContainer=InDetKeys.SCT_Clusters())
            if is_dbm:
                track_finder.MagneticFieldMode = "NoField"
                track_finder.TrackQualityCut = 9.3

            if (DetFlags.haveRIO.SCT_on()):
                track_finder.SctSummaryTool = InDetSCT_ConditionsSummaryTool
            else:
                track_finder.SctSummaryTool = None

            ToolSvc += track_finder

            useBremMode = NewTrackingCuts.mode(
            ) == "Offline" or NewTrackingCuts.mode(
            ) == "SLHC" or NewTrackingCuts.mode() == "DBM"
            from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
            InDetSiTrackMaker = SiTrackMaker(
                name='InDetSiTrackMaker' + NewTrackingCuts.extension(),
                useSCT=NewTrackingCuts.useSCT(),
                usePixel=NewTrackingCuts.usePixel(),
                RoadTool=InDetSiDetElementsRoadMaker,
                CombinatorialTrackFinder=track_finder,
                pTmin=NewTrackingCuts.minPT(),
                pTminBrem=NewTrackingCuts.minPTBrem(),
                pTminSSS=InDetFlags.pT_SSScut(),
                nClustersMin=NewTrackingCuts.minClusters(),
                nHolesMax=NewTrackingCuts.nHolesMax(),
                nHolesGapMax=NewTrackingCuts.nHolesGapMax(),
                SeedsFilterLevel=NewTrackingCuts.seedFilterLevel(),
                Xi2max=NewTrackingCuts.Xi2max(),
                Xi2maxNoAdd=NewTrackingCuts.Xi2maxNoAdd(),
                nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(),
                CosmicTrack=InDetFlags.doCosmics(),
                Xi2maxMultiTracks=NewTrackingCuts.Xi2max(),  # was 3.
                useSSSseedsFilter=InDetFlags.doSSSfilter(),
                doMultiTracksProd=True,
                useBremModel=InDetFlags.doBremRecovery() and
                useBremMode,  # only for NewTracking the brem is debugged !!!
                doCaloSeededBrem=InDetFlags.doCaloSeededBrem(),
                doHadCaloSeedSSS=InDetFlags.doHadCaloSeededSSS(),
                phiWidth=NewTrackingCuts.phiWidthBrem(),
                etaWidth=NewTrackingCuts.etaWidthBrem(),
                InputClusterContainerName=InDetKeys.CaloClusterROIContainer(
                ),  # "InDetCaloClusterROIs" 
                InputHadClusterContainerName=InDetKeys.
                HadCaloClusterROIContainer(),  # "InDetCaloClusterROIs" 
                UseAssociationTool=usePrdAssociationTool)

            if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                InDetSiTrackMaker.ITKGeometry = True

            if NewTrackingCuts.mode() == "DBM":
                InDetSiTrackMaker.MagneticFieldMode = "NoField"
                InDetSiTrackMaker.useBremModel = False
                InDetSiTrackMaker.doMultiTracksProd = False
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
                InDetSiTrackMaker.pTminSSS = -1
                InDetSiTrackMaker.CosmicTrack = False
                InDetSiTrackMaker.useSSSseedsFilter = False
                InDetSiTrackMaker.doCaloSeededBrem = False
                InDetSiTrackMaker.doHadCaloSeedSSS = False

            elif InDetFlags.doCosmics():
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'

            elif InDetFlags.doHeavyIon():
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'

            elif NewTrackingCuts.mode() == "LowPt":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'

            elif NewTrackingCuts.mode() == "VeryLowPt" or (
                    NewTrackingCuts.mode() == "Pixel"
                    and InDetFlags.doMinBias()):
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'

            elif NewTrackingCuts.mode() == "BeamGas":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'

            elif NewTrackingCuts.mode() == "ForwardTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'

            elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'

            elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks'

            elif NewTrackingCuts.mode() == "SLHCConversionFinding":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_SLHCConversionTracks'

            elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode(
            ) == "R3LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'

            else:
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'

            if InDetFlags.doStoreTrackSeeds():
                from SeedToTrackConversionTool.SeedToTrackConversionToolConf import InDet__SeedToTrackConversionTool
                InDet_SeedToTrackConversion = InDet__SeedToTrackConversionTool(
                    name="InDet_SeedToTrackConversion",
                    OutputName=InDetKeys.SiSPSeedSegments() +
                    NewTrackingCuts.extension())
                InDetSiTrackMaker.SeedToTrackConversion = InDet_SeedToTrackConversion
                InDetSiTrackMaker.SeedSegmentsWrite = True

            #InDetSiTrackMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiTrackMaker
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetSiTrackMaker)
            #
            # set output track collection name
        #
            self.__SiTrackCollection = SiSPSeededTrackCollectionKey
            #
            # --- Setup Track finder using space points seeds
            #

            from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder

            if NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "ForwardTracks":

                InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name             = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                          TrackTool        = InDetSiTrackMaker,
                                                                          PRDtoTrackMap    = prefix+'PRDtoTrackMap'+suffix \
                                                                                             if usePrdAssociationTool else '',
                                                                          TrackSummaryTool = TrackingCommon.getInDetTrackSummaryToolNoHoleSearch(),
                                                                          TracksLocation   = self.__SiTrackCollection,
                                                                          SeedsTool        = InDetSiSpacePointsSeedMaker,
                                                                          useZvertexTool   = InDetFlags.useZvertexTool(),
                                                                          ZvertexTool      = InDetZvertexMaker,
                                                                          useNewStrategy   = False,
                                                                          useMBTSTimeDiff  = InDetFlags.useMBTSTimeDiff(),
                                                                          useZBoundFinding = False)
                if InDetFlags.doHeavyIon():
                    InDetSiSPSeededTrackFinder.FreeClustersCut = 2  #Heavy Ion optimization from Igor

            else:
                InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name             = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                          TrackTool        = InDetSiTrackMaker,
                                                                          PRDtoTrackMap    = prefix+'PRDtoTrackMap'+suffix \
                                                                                             if usePrdAssociationTool else '',
                                                                          TrackSummaryTool = TrackingCommon.getInDetTrackSummaryToolNoHoleSearch(),
                                                                          TracksLocation   = self.__SiTrackCollection,
                                                                          SeedsTool        = InDetSiSpacePointsSeedMaker,
                                                                          useZvertexTool   = InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM",
                                                                          ZvertexTool      = InDetZvertexMaker,
                                                                          useNewStrategy   = InDetFlags.useNewSiSPSeededTF() and NewTrackingCuts.mode() != "DBM",
                                                                          useMBTSTimeDiff  = InDetFlags.useMBTSTimeDiff(),
                                                                          useZBoundFinding = NewTrackingCuts.doZBoundary() and NewTrackingCuts.mode() != "DBM")

                if InDetFlags.doHeavyIon():
                    InDetSiSPSeededTrackFinder.FreeClustersCut = 2  #Heavy Ion optimization from Igor

            #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE
            topSequence += InDetSiSPSeededTrackFinder
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetSiSPSeededTrackFinder)

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

        # ------------------------------------------------------------
        #
        # ---------- Ambiguity solving
        #
        # ------------------------------------------------------------

        if InDetFlags.doAmbiSolving():
            #
            # --- load InnerDetector TrackSelectionTool
            #

            prob1 = InDetFlags.pixelClusterSplitProb1()
            prob2 = InDetFlags.pixelClusterSplitProb2()
            nhitsToAllowSplitting = 9

            from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags
            if CommonGeometryFlags.Run() == 1:
                prob1 = InDetFlags.pixelClusterSplitProb1_run1()
                prob2 = InDetFlags.pixelClusterSplitProb2_run1()
                nhitsToAllowSplitting = 8

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetDenseEnvAmbiTrackSelectionTool as AmbiTrackSelectionTool
            else:
                from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool as AmbiTrackSelectionTool
            InDetAmbiTrackSelectionTool = AmbiTrackSelectionTool(
                name='InDetAmbiTrackSelectionTool' +
                NewTrackingCuts.extension(),
                DriftCircleCutTool=InDetTRTDriftCircleCut,
                AssociationTool=TrackingCommon.
                getInDetPRDtoTrackMapToolGangedPixels(),
                minHits=NewTrackingCuts.minClusters(),
                minNotShared=NewTrackingCuts.minSiNotShared(),
                maxShared=NewTrackingCuts.maxShared(),
                minTRTHits=0,  # used for Si only tracking !!!
                sharedProbCut=0.10,
                UseParameterization=False,
                Cosmics=InDetFlags.doCosmics(),
                doPixelSplitting=InDetFlags.doPixelClusterSplitting()
                and NewTrackingCuts.mode != "DBM")
            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                InDetAmbiTrackSelectionTool.sharedProbCut = prob1
                InDetAmbiTrackSelectionTool.sharedProbCut2 = prob2
                InDetAmbiTrackSelectionTool.minSiHitsToAllowSplitting = nhitsToAllowSplitting
                InDetAmbiTrackSelectionTool.minUniqueSCTHits = 4
                InDetAmbiTrackSelectionTool.minTrackChi2ForSharedHits = 3
                InDetAmbiTrackSelectionTool.InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer(
                ) + "Bjet"
                InDetAmbiTrackSelectionTool.doHadCaloSeed = InDetFlags.doCaloSeededAmbi(
                )  #Do special cuts in region of interest
                InDetAmbiTrackSelectionTool.minPtSplit = InDetFlags.pixelClusterSplitMinPt(
                )  #Only allow split clusters on track withe pt greater than this MeV
                InDetAmbiTrackSelectionTool.maxSharedModulesInROI = 3  #Maximum number of shared modules for tracks in ROI
                InDetAmbiTrackSelectionTool.minNotSharedInROI = 2  #Minimum number of unique modules for tracks in ROI
                InDetAmbiTrackSelectionTool.minSiHitsToAllowSplittingInROI = 7  #Minimum number of Si hits to allow splittings for tracks in ROI
                InDetAmbiTrackSelectionTool.phiWidth = 0.1  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.etaWidth = 0.1  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.InputEmClusterContainerName = InDetKeys.CaloClusterROIContainer(
                )
                InDetAmbiTrackSelectionTool.doEmCaloSeed = False  #Only split in cluster in region of interest
                InDetAmbiTrackSelectionTool.minPtConv = 10000  #Only allow split clusters on track withe pt greater than this MeV
                InDetAmbiTrackSelectionTool.phiWidthEM = 0.05  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.etaWidthEM = 0.05  #Split cluster ROI size

            if NewTrackingCuts.mode() == "DBM":
                InDetAmbiTrackSelectionTool.Cosmics = False
                InDetAmbiTrackSelectionTool.UseParameterization = False
                InDetAmbiTrackSelectionTool.doPixelSplitting = False
                InDetAmbiTrackSelectionTool.maxShared = 1000
                InDetAmbiTrackSelectionTool.maxTracksPerSharedPRD = 2
                InDetAmbiTrackSelectionTool.minHits = 0
                InDetAmbiTrackSelectionTool.minNotShared = 0
                InDetAmbiTrackSelectionTool.minScoreShareTracks = 0.0
                InDetAmbiTrackSelectionTool.minTRTHits = 0
                InDetAmbiTrackSelectionTool.sharedProbCut = 0.1

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #    InDetAmbiTrackSelectionTool.OutputLevel = VERBOSE

            ToolSvc += InDetAmbiTrackSelectionTool
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetAmbiTrackSelectionTool)
            #
            # --- set up different Scoring Tool for collisions and cosmics
            #
            if InDetFlags.doCosmics() and NewTrackingCuts.mode() != "DBM":
                InDetAmbiScoringTool = TrackingCommon.getInDetCosmicsScoringTool(
                    NewTrackingCuts)
            elif (NewTrackingCuts.mode() == "R3LargeD0"
                  and InDetFlags.nnCutLargeD0Threshold > 0):
                # Set up NN config
                InDetAmbiScoringTool = TrackingCommon.getInDetNNScoringTool(
                    NewTrackingCuts)
            else:
                InDetAmbiScoringTool = TrackingCommon.getInDetAmbiScoringTool(
                    NewTrackingCuts)

            #
            # --- load Ambiguity Processor
            #
            useBremMode = NewTrackingCuts.mode(
            ) == "Offline" or NewTrackingCuts.mode() == "SLHC"

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                # DenseEnvironmentsAmbiguityProcessorTool
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityProcessorTool as ProcessorTool
                use_low_pt_fitter = True if NewTrackingCuts.mode(
                ) == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (
                    NewTrackingCuts.mode() == "Pixel"
                    and InDetFlags.doMinBias()) else False

                from AthenaCommon import CfgGetter
                from InDetRecExample.TrackingCommon import setDefaults
                if len(NewTrackingCuts.extension()) > 0:
                    fitter_args = setDefaults(
                        {},
                        SplitClusterMapExtension=NewTrackingCuts.extension())
                    fitter_list=[     CfgGetter.getPublicToolClone('InDetTrackFitter'+NewTrackingCuts.extension(), 'InDetTrackFitter',**fitter_args)    if not use_low_pt_fitter \
                                 else CfgGetter.getPublicToolClone('InDetTrackFitterLowPt'+NewTrackingCuts.extension(), 'InDetTrackFitterLowPt',**fitter_args)]
                else:
                    fitter_list=[     CfgGetter.getPublicTool('InDetTrackFitter')    if not use_low_pt_fitter \
                                 else CfgGetter.getPublicTool('InDetTrackFitterLowPt')]

                if InDetFlags.doRefitInvalidCov():
                    from AthenaCommon import CfgGetter
                    if len(NewTrackingCuts.extension()) > 0:
                        fitter_args = setDefaults(
                            {},
                            SplitClusterMapExtension=NewTrackingCuts.extension(
                            ))
                        fitter_list.append(
                            CfgGetter.getPublicToolClone(
                                'KalmanFitter' + NewTrackingCuts.extension(),
                                'KalmanFitter', **fitter_args))
                        fitter_list.append(
                            CfgGetter.getPublicToolClone(
                                'ReferenceKalmanFitter' +
                                NewTrackingCuts.extension(),
                                'ReferenceKalmanFitter', **fitter_args))
                    else:
                        fitter_list.append(
                            CfgGetter.getPublicTool('KalmanFitter'))
                        fitter_list.append(
                            CfgGetter.getPublicTool('ReferenceKalmanFitter'))

                InDetAmbiguityProcessor = ProcessorTool(
                    name='InDetAmbiguityProcessor' +
                    NewTrackingCuts.extension(),
                    Fitter=fitter_list,
                    AssociationTool=TrackingCommon.
                    getInDetPRDtoTrackMapToolGangedPixels(),
                    AssociationMapName='PRDToTrackMap' +
                    NewTrackingCuts.extension(),
                    TrackSummaryTool=TrackingCommon.getInDetTrackSummaryTool(),
                    ScoringTool=InDetAmbiScoringTool,
                    SelectionTool=InDetAmbiTrackSelectionTool,
                    SuppressHoleSearch=False,
                    tryBremFit=InDetFlags.doBremRecovery() and useBremMode
                    and NewTrackingCuts.mode() != "DBM",
                    caloSeededBrem=InDetFlags.doCaloSeededBrem()
                    and NewTrackingCuts.mode() != "DBM",
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=True,
                    doHadCaloSeed=InDetFlags.doCaloSeededRefit(),
                    InputHadClusterContainerName=InDetKeys.
                    HadCaloClusterROIContainer() + "Bjet")

                # DenseEnvironmentsAmbiguityScoreProcessorTool
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityScoreProcessorTool as ScoreProcessorTool
                InDetAmbiguityScoreProcessor = ScoreProcessorTool(
                    name='InDetAmbiguityScoreProcessor' +
                    NewTrackingCuts.extension(),
                    ScoringTool=InDetAmbiScoringTool,
                    SplitProbTool=NnPixelClusterSplitProbTool
                    if InDetFlags.doPixelClusterSplitting()
                    and 'NnPixelClusterSplitProbTool' in globals() else None,
                    AssociationTool=TrackingCommon.
                    getInDetPRDtoTrackMapToolGangedPixels(),
                    AssociationToolNotGanged=TrackingCommon.
                    getPRDtoTrackMapTool(),
                    AssociationMapName='PRDToTrackMap' +
                    NewTrackingCuts.extension(),
                    SelectionTool=InDetAmbiTrackSelectionTool)
                # hasScoreProcessorTool = True
            else:
                from AthenaCommon import CfgGetter
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool as ProcessorTool
                InDetAmbiguityProcessor = ProcessorTool(
                    name='InDetAmbiguityProcessor' +
                    NewTrackingCuts.extension(),
                    Fitter=CfgGetter.getPublicTool('InDetTrackFitter'),
                    AssociationTool=TrackingCommon.
                    getInDetPRDtoTrackMapToolGangedPixels(),
                    TrackSummaryTool=TrackingCommon.getInDetTrackSummaryTool(),
                    ScoringTool=InDetAmbiScoringTool,
                    SelectionTool=InDetAmbiTrackSelectionTool,
                    SuppressHoleSearch=False,
                    tryBremFit=InDetFlags.doBremRecovery() and useBremMode
                    and NewTrackingCuts.mode() != "DBM",
                    caloSeededBrem=InDetFlags.doCaloSeededBrem()
                    and NewTrackingCuts.mode() != "DBM",
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=True)
                InDetAmbiguityScoreProcessor = None

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode()
                    == "DBM") and 'NnPixelClusterSplitProbTool' in globals():
                if InDetAmbiguityScoreProcessor is not None:
                    InDetAmbiguityScoreProcessor.sharedProbCut = prob1
                    InDetAmbiguityScoreProcessor.sharedProbCut2 = prob2
                    if NewTrackingCuts.extension() == "":
                        InDetAmbiguityScoreProcessor.SplitClusterMap_old = ""
                    elif NewTrackingCuts.extension() == "Disappearing":
                        InDetAmbiguityScoreProcessor.SplitClusterMap_old = InDetKeys.SplitClusterAmbiguityMap(
                        )
                    InDetAmbiguityScoreProcessor.SplitClusterMap_new = InDetKeys.SplitClusterAmbiguityMap(
                    ) + NewTrackingCuts.extension()
                if InDetFlags.doTIDE_RescalePixelCovariances():
                    InDetAmbiguityProcessor.applydRcorrection = True

            if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode(
            ) == "DBM":
                InDetAmbiguityProcessor.SuppressHoleSearch = True
            if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                if InDetAmbiguityProcessor.getName().find('Dense'):
                    pass
                else:
                    from AthenaCommon import CfgGetter
                    InDetAmbiguityProcessor.Fitter = CfgGetter.getPublicTool(
                        'InDetTrackFitterLowPt')

            if InDetFlags.materialInteractions():
                InDetAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType(
                )
            else:
                InDetAmbiguityProcessor.MatEffects = 0

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #    InDetAmbiguityProcessor.OutputLevel = VERBOSE

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

            # add InDetAmbiguityScoreProcessor
            if InDetAmbiguityScoreProcessor is not None:
                ToolSvc += InDetAmbiguityScoreProcessor

            #
            # --- set input and output collection
            #
            InputTrackCollection = self.__SiTrackCollection
            self.__SiTrackCollection = ResolvedTrackCollectionKey

            #
            # --- configure Ambiguity (score) solver
            #
            from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguityScore
            # from RecExConfig.hideInput import hideInput
            # hideInput ('TrackCollection', self.__SiTrackCollection)
            InDetAmbiguityScore = Trk__TrkAmbiguityScore(
                name='InDetAmbiguityScore' + NewTrackingCuts.extension(),
                TrackInput=[InputTrackCollection],
                TrackOutput='ScoredMap' + 'InDetAmbiguityScore' +
                NewTrackingCuts.extension(),
                AmbiguityScoreProcessor=InDetAmbiguityScoreProcessor
            )  ## TODO: check the case when it is None object
            topSequence += InDetAmbiguityScore
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetAmbiguityScore)

            #
            # --- configure Ambiguity solver
            #
            from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
            from RecExConfig.hideInput import hideInput
            hideInput('TrackCollection', self.__SiTrackCollection)
            InDetAmbiguitySolver = Trk__TrkAmbiguitySolver(
                name='InDetAmbiguitySolver' + NewTrackingCuts.extension(),
                TrackInput='ScoredMap' + 'InDetAmbiguityScore' +
                NewTrackingCuts.extension(),
                TrackOutput=self.__SiTrackCollection,
                AmbiguityProcessor=InDetAmbiguityProcessor)
            topSequence += InDetAmbiguitySolver
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetAmbiguitySolver)

            #
            # --- Delete Silicon Sp-Seeded tracks
            #
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(key=SiSPSeededTrackCollectionKey)

            if ((NewTrackingCuts.mode() in ["Pixel", "SCT"])
                    or not InDetFlags.doSGDeletion()):
                if InDetFlags.doTruth():
                    #
                    # set up the truth info for this container
                    #
                    include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                    InDetTracksTruth = ConfiguredInDetTrackTruth(
                        self.__SiTrackCollection,
                        self.__SiTrackCollection + "DetailedTruth",
                        self.__SiTrackCollection + "TruthCollection")
                    #
                    # add final output for statistics
                    #
                    TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                    TrackCollectionTruthKeys += [
                        InDetTracksTruth.TracksTruth()
                    ]
                else:
                    TrackCollectionKeys += [self.__SiTrackCollection]
Пример #7
0
def makeInDetPatternRecognition(whichSignature,
                                rois='EMViewRoIs',
                                InputCollections=None,
                                NewTrackingCuts=None):
    from InDetRecExample.InDetJobProperties import InDetFlags
    #Global keys/names for collections
    from InDetRecExample.InDetKeys import InDetKeys  #FIXME: to be replaced with Trig keys?
    from .InDetTrigCollectionKeys import TrigPixelKeys, TrigSCTKeys

    from AthenaCommon.DetFlags import DetFlags

    from AthenaCommon.AppMgr import ToolSvc

    prefix = 'InDetTrigMT'
    suffix = '_%s' % whichSignature if whichSignature else ''
    #Final output track collection
    #SiSPSeededTrackCollectionKey = "SiSPSeededTracks_%s"%whichSignature
    outEFIDTracks = "HLT_IDTrkTrack_%s_%s" % (whichSignature, 'EFID')
    outEFIDTrackParticles = "HLT_IDTrack_%s_%s" % (whichSignature, 'EFID')

    viewAlgs = []  #list of all algs running in this module
    #
    # --- decide if use the association tool
    #
    #FIXME: Make the same decision as offline (based on the tracking cuts)?
    #if (len(InputCollections) > 0) and (NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0" or NewTrackingCuts.mode() == "BeamGas" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks"  or NewTrackingCuts.mode() == "Disappearing" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks" or NewTrackingCuts.mode() == "SLHCConversionFinding"):

    #Why not use association tool? what are the cases when not needed?
    #usePrdAssociationTool = True
    #else:
    usePrdAssociationTool = False

    import InDetRecExample.TrackingCommon as TrackingCommon
    if usePrdAssociationTool:
        print('Running SiSPseedTrackFinder!')
        #FIXME: switch to naming based on tracking

        #FIXME: If so:
        # 1] Get a new association tool
        #associationTool = TrackingCommon.getInDetTrigPRDtoTrackMapToolGangedPixels(),

        # 2] Use the ganged pixel from here?
        #from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPrdAssociationTool

        # 3] Create the new one as in offline tracking:
        InDetTrigPrdAssociation = TrackingCommon.getInDetTrackPRD_Association(
            namePrefix=prefix,
            nameSuffix=suffix,
            TracksName=list(InputCollections)
        )  #This is readHandle #What input collection Thought there are no tracks at this point??!
        # 4] if so do I use normal or ganged?
        #from InDetAssociationTools.InDetAssociationToolsConf import InDet__InDetPRD_AssociationToolGangedPixels
        #InDetTrigPrdAssociationl = InDet__InDetPRD_AssociationToolGangedPixels(name = "%sPrdAssociationTool%s"%(prefix,suffix),
        #                                                                          PixelClusterAmbiguitiesMapName = TrigPixelKeys.PRDtoTrackMap )
        viewAlgs.append(InDetTrigPrdAssociation)

    #FIXME? use trigger flags?
    #if InDetFlags.doSiSPSeededTrackFinder():
    doSiSPSeededTrackFinder = True
    if doSiSPSeededTrackFinder:
        print('Running SiSPseedTrackFinder!')

        #FIXME: Need to add different options based on the
        from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker

        InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker(
            name="%sInDetSpSeedsMaker%s" %
            (prefix, suffix),  #+NewTrackingCuts.extension(),
            pTmin=NewTrackingCuts.minPT(),
            maxdImpact=NewTrackingCuts.maxPrimaryImpact(),
            maxZ=NewTrackingCuts.maxZImpact(),
            minZ=-NewTrackingCuts.maxZImpact(),
            usePixel=NewTrackingCuts.usePixel(),
            SpacePointsPixelName=TrigPixelKeys.SpacePoints,
            # useSCT                 = NewTrackingCuts.useSCT(),
            useSCT=(NewTrackingCuts.useSCT()
                    and NewTrackingCuts.useSCTSeeding()),
            SpacePointsSCTName=TrigSCTKeys.SpacePoints,
            # useOverlapSpCollection = NewTrackingCuts.useSCT(),
            useOverlapSpCollection=(NewTrackingCuts.useSCT()
                                    and NewTrackingCuts.useSCTSeeding()),
            SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(),
            radMax=NewTrackingCuts.radMax(),
            RapidityCut=NewTrackingCuts.maxEta())

        ToolSvc += InDetSiSpacePointsSeedMaker
        #FIXME consider specific settings here
        #if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  NewTrackingCuts.mode() == "ForwardTracks":
        #        InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds()
        #        InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds()

        if usePrdAssociationTool:
            #   # not all classes have that property !!!
            InDetSiSpacePointsSeedMaker.PRDtoTrackMap = TrigPixelKeys.PRDtoTrackMap  #InDetTrigPrdAssociationTool

        #if not InDetFlags.doCosmics():
        #   InDetSiSpacePointsSeedMaker.maxRadius1         = 0.75*NewTrackingCuts.radMax()
        #   InDetSiSpacePointsSeedMaker.maxRadius2         = NewTrackingCuts.radMax()
        #   InDetSiSpacePointsSeedMaker.maxRadius3         = NewTrackingCuts.radMax()
        #if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
        #   try :
        #      InDetSiSpacePointsSeedMaker.pTmax              = NewTrackingCuts.maxPT()
        #   except:
        #      pass
        #   InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
        #if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "SLHCConversionFinding":
        #   InDetSiSpacePointsSeedMaker.minRadius1         = 0
        #   InDetSiSpacePointsSeedMaker.minRadius2         = 0
        #   InDetSiSpacePointsSeedMaker.minRadius3         = 0
        #   InDetSiSpacePointsSeedMaker.maxRadius1         =1000.*Units.mm
        #   InDetSiSpacePointsSeedMaker.maxRadius2         =1000.*Units.mm
        #   InDetSiSpacePointsSeedMaker.maxRadius3         =1000.*Units.mm
        #if NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
        #   InDetSiSpacePointsSeedMaker.checkEta           = True
        #   InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
        #   InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
        #   InDetSiSpacePointsSeedMaker.RapidityCut        = NewTrackingCuts.maxEta()
        #if NewTrackingCuts.mode() == "DBM":
        #   InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
        #   InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
        #   InDetSiSpacePointsSeedMaker.useDBM = True

        #Z finder for the vtx
        #
        # --- Z-coordinates primary vertices finder (only for collisions)
        #
        if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
            from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
            InDetZvertexMaker = InDet__SiZvertexMaker_xk(
                name='%sInDetZvertexMaker%s' % (prefix, suffix),
                Zmax=NewTrackingCuts.maxZImpact(),
                Zmin=-NewTrackingCuts.maxZImpact(),
                minRatio=0.17)  # not default
            InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker

            if InDetFlags.doHeavyIon():
                InDetZvertexMaker.HistSize = 2000
                ###InDetZvertexMaker.minContent = 200
                InDetZvertexMaker.minContent = 30

            ToolSvc += InDetZvertexMaker
            #if (InDetFlags.doPrintConfigurables()):
            #   printfunc (InDetZvertexMaker)

        else:
            InDetZvertexMaker = None

        #
    #   # --- SCT and Pixel detector elements road builder
    #   #
    #FIXME which propagator
    # 1]
        from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPropagator

        # 2] How about offline

        from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
        InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(
            name='%sInDetSiRoadMaker%s' %
            (prefix, suffix),  #+NewTrackingCuts.extension(),
            PropagatorTool=InDetTrigPropagator,  #InDetPatternPropagator,
            usePixel=NewTrackingCuts.usePixel(),
            PixManagerLocation=InDetKeys.PixelManager(),
            useSCT=NewTrackingCuts.useSCT(),
            SCTManagerLocation=InDetKeys.SCT_Manager(
            ),  #FIXME change the name?        
            RoadWidth=NewTrackingCuts.RoadWidth())

        ToolSvc += InDetSiDetElementsRoadMaker
        #if (InDetFlags.doPrintConfigurables()):
        #   printfunc (     InDetSiDetElementsRoadMaker)
        # Condition algorithm for InDet__SiDetElementsRoadMaker_xk
        if DetFlags.haveRIO.pixel_on():
            #FIXME:
            #pixelOn = True
            #if pixelOn:
            # Condition algorithm for SiCombinatorialTrackFinder_xk
            from AthenaCommon.AlgSequence import AthSequencer
            condSeq = AthSequencer("AthCondSeq")
            if not hasattr(condSeq,
                           "InDetSiDetElementBoundaryLinksPixelCondAlg"):
                from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
                condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(
                    name="InDetSiDetElementBoundaryLinksPixelCondAlg",
                    ReadKey="PixelDetectorElementCollection",
                    WriteKey="PixelDetElementBoundaryLinks_xk",
                    UsePixelDetectorManager=True)

        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")

            if not hasattr(condSeq,
                           "InDetSiDetElementBoundaryLinksSCTCondAlg"):
                from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiDetElementBoundaryLinksCondAlg_xk
                condSeq += InDet__SiDetElementBoundaryLinksCondAlg_xk(
                    name="InDetSiDetElementBoundaryLinksSCTCondAlg",
                    ReadKey="SCT_DetectorElementCollection",
                    WriteKey="SCT_DetElementBoundaryLinks_xk")

    #   #
    #   # --- Local track finding using sdCaloSeededSSSpace point seed
    #   #
    #   # @TODO ensure that PRD association map is used if usePrdAssociationTool is set
        is_dbm = InDetFlags.doDBMstandalone() or NewTrackingCuts.extension(
        ) == 'DBM'
        rot_creator_digital = TrackingCommon.getInDetRotCreatorDigital(
        ) if not is_dbm else TrackingCommon.getInDetRotCreatorDBM()

        from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigSCTConditionsSummaryTool, InDetTrigPatternUpdator

        from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk
        track_finder = InDet__SiCombinatorialTrackFinder_xk(
            name='%sInDetSiComTrackFinder%s' %
            (prefix, suffix),  #+NewTrackingCuts.extension(),
            PropagatorTool=InDetTrigPropagator,  #InDetPatternPropagator,
            UpdatorTool=InDetTrigPatternUpdator,  #InDetPatternUpdator,
            SctSummaryTool=InDetTrigSCTConditionsSummaryTool,
            RIOonTrackTool=rot_creator_digital,
            usePixel=DetFlags.haveRIO.pixel_on(),
            useSCT=DetFlags.haveRIO.SCT_on() if not is_dbm else False,
            PixelClusterContainer=TrigPixelKeys.
            Clusters,  #InDetKeys.PixelClusters(),
            SCT_ClusterContainer=TrigSCTKeys.Clusters
        )  #InDetKeys.SCT_Clusters())

        ToolSvc += track_finder
        if is_dbm:
            track_finder.MagneticFieldMode = "NoField"
            track_finder.TrackQualityCut = 9.3

        #track_finder.SctSummaryTool = InDetTrigSCTConditionsSummaryTool
        #if (DetFlags.haveRIO.SCT_on()):
        #   track_finder.SctSummaryTool = InDetSCT_ConditionsSummaryTool
        #else:
        #   track_finder.SctSummaryTool = None

    #   ToolSvc += track_finder

        useBremMode = NewTrackingCuts.mode(
        ) == "Offline" or NewTrackingCuts.mode(
        ) == "SLHC" or NewTrackingCuts.mode() == "DBM"
        from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
        InDetSiTrackMaker = SiTrackMaker(
            name='%sInDetSiTrackMaker%s' %
            (prefix, suffix),  #+NewTrackingCuts.extension(),
            useSCT=NewTrackingCuts.useSCT(),
            usePixel=NewTrackingCuts.usePixel(),
            RoadTool=InDetSiDetElementsRoadMaker,
            CombinatorialTrackFinder=track_finder,
            pTmin=NewTrackingCuts.minPT(),
            pTminBrem=NewTrackingCuts.minPTBrem(),
            pTminSSS=InDetFlags.pT_SSScut(),
            nClustersMin=NewTrackingCuts.minClusters(),
            nHolesMax=NewTrackingCuts.nHolesMax(),
            nHolesGapMax=NewTrackingCuts.nHolesGapMax(),
            SeedsFilterLevel=NewTrackingCuts.seedFilterLevel(),
            Xi2max=NewTrackingCuts.Xi2max(),
            Xi2maxNoAdd=NewTrackingCuts.Xi2maxNoAdd(),
            nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(),
            CosmicTrack=InDetFlags.doCosmics(),
            Xi2maxMultiTracks=NewTrackingCuts.Xi2max(),  # was 3.
            useSSSseedsFilter=InDetFlags.doSSSfilter(),
            doMultiTracksProd=True,
            useBremModel=InDetFlags.doBremRecovery()
            and useBremMode,  # only for NewTracking the brem is debugged !!!
            doCaloSeededBrem=InDetFlags.doCaloSeededBrem(),
            doHadCaloSeedSSS=InDetFlags.doHadCaloSeededSSS(),
            phiWidth=NewTrackingCuts.phiWidthBrem(),
            etaWidth=NewTrackingCuts.etaWidthBrem(),
            InputClusterContainerName=InDetKeys.CaloClusterROIContainer(
            ),  # "InDetCaloClusterROIs" 
            InputHadClusterContainerName=InDetKeys.HadCaloClusterROIContainer(
            ),  # "InDetCaloClusterROIs" 
            UseAssociationTool=usePrdAssociationTool)

        ToolSvc += InDetSiTrackMaker

        #FIXME: do only cosmics for now, but change later
        #   if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks" :
        #      InDetSiTrackMaker.ITKGeometry = True

        #   if NewTrackingCuts.mode() == "DBM":
        #      InDetSiTrackMaker.MagneticFieldMode = "NoField"
        #      InDetSiTrackMaker.useBremModel = False
        #      InDetSiTrackMaker.doMultiTracksProd = False
        #      InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
        #      InDetSiTrackMaker.pTminSSS = -1
        #      InDetSiTrackMaker.CosmicTrack = False
        #      InDetSiTrackMaker.useSSSseedsFilter = False
        #      InDetSiTrackMaker.doCaloSeededBrem = False
        #      InDetSiTrackMaker.doHadCaloSeedSSS = False

        #elif InDetFlags.doCosmics():
        #  InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
        InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
        #
        #   elif InDetFlags.doHeavyIon():
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'
        #
        #   elif NewTrackingCuts.mode() == "LowPt":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'

        #   elif NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'

        #   elif NewTrackingCuts.mode() == "BeamGas":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'

        #   elif NewTrackingCuts.mode() == "ForwardTracks":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'

        #   elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'

        #   elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks'

        #   elif NewTrackingCuts.mode() == "SLHCConversionFinding":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_SLHCConversionTracks'

        #   elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "LowPtLargeD0":
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'
        #
        #   else:
        #     InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
        #
        if InDetFlags.doStoreTrackSeeds():
            from SeedToTrackConversionTool.SeedToTrackConversionToolConf import InDet__SeedToTrackConversionTool
            InDet_SeedToTrackConversion = InDet__SeedToTrackConversionTool(
                name="%sInDet_SeedToTrackConversion%s" % (prefix, suffix),
                OutputName=InDetKeys.SiSPSeedSegments() +
                NewTrackingCuts.extension())
            InDetSiTrackMaker.SeedToTrackConversion = InDet_SeedToTrackConversion
            InDetSiTrackMaker.SeedSegmentsWrite = True

    #   #InDetSiTrackMaker.OutputLevel = VERBOSE
    #   ToolSvc += InDetSiTrackMaker
    #   if (InDetFlags.doPrintConfigurables()):
    #      printfunc (InDetSiTrackMaker)
    #   #
    #   # set output track collection name
    #  #
    #   self.__SiTrackCollection = SiSPSeededTrackCollectionKey
    #   #
    #   # --- Setup Track finder using space points seeds
    #   #

    #FIXME: which summary tool to use??
    # trackSummaryTool = TrackingCommon.getInDetTrackSummaryToolNoHoleSearch()
    #ToolSvc += trackSummaryTool
        from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryTool

        from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder
        InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(
            name='%sInDetSiSpTrackFinder%s' %
            (prefix, suffix),  # +NewTrackingCuts.extension(),
            TrackTool=InDetSiTrackMaker,
            PRDtoTrackMap=TrigPixelKeys.PRDtoTrackMap
            if usePrdAssociationTool else '',
            SpacePointsPixelName=TrigPixelKeys.SpacePoints,
            SpacePointsSCTName=TrigSCTKeys.SpacePoints,
            TrackSummaryTool=InDetTrigTrackSummaryTool,
            TracksLocation=outEFIDTracks,
            SeedsTool=InDetSiSpacePointsSeedMaker,
            useZvertexTool=InDetFlags.useZvertexTool(),
            ZvertexTool=InDetZvertexMaker)

        if NewTrackingCuts.mode(
        ) == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks":
            InDetSiSPSeededTrackFinder.useNewStrategy = False
            InDetSiSPSeededTrackFinder.useMBTSTimeDiff = InDetFlags.useMBTSTimeDiff(
            )
            InDetSiSPSeededTrackFinder.useZBoundFinding = False
    #    if InDetFlags.doHeavyIon() :
    #     InDetSiSPSeededTrackFinder.FreeClustersCut = 2 #Heavy Ion optimization from Igor
        else:
            InDetSiSPSeededTrackFinder.useZvertexTool = InDetFlags.useZvertexTool(
            ) and NewTrackingCuts.mode() != "DBM"
            InDetSiSPSeededTrackFinder.useNewStrategy = InDetFlags.useNewSiSPSeededTF(
            ) and NewTrackingCuts.mode() != "DBM"
            InDetSiSPSeededTrackFinder.useMBTSTimeDiff = InDetFlags.useMBTSTimeDiff(
            )
            InDetSiSPSeededTrackFinder.useZBoundFinding = NewTrackingCuts.doZBoundary(
            ) and NewTrackingCuts.mode() != "DBM"

        viewAlgs.append(InDetSiSPSeededTrackFinder)

        #for alg in viewAlgs:
        #   print alg

    #    if InDetFlags.doHeavyIon() :
    #     InDetSiSPSeededTrackFinder.FreeClustersCut = 2 #Heavy Ion optimization from Igor

    #   #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE
    #   topSequence += InDetSiSPSeededTrackFinder
    #   if (InDetFlags.doPrintConfigurables()):
    #      printfunc (InDetSiSPSeededTrackFinder)

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

    #Convert final track collection to xAOD track particles
    from .InDetTrigCommon import getTrackParticleCnv
    viewAlgs.append(
        getTrackParticleCnv(prefix, suffix + "_EFID", outEFIDTracks,
                            outEFIDTrackParticles))

    #print viewAlgs
    #print 'VIEWS!', len(viewAlgs)
    #print(len(viewAlgs))

    return viewAlgs
   def __init__(self, NewTrackingCuts = None, SiTrackCollection = None, ExtendedTrackCollection = None, ExtendedTracksMap = None, TrackCollectionKeys=[], TrackCollectionTruthKeys=[] , doPhase = True):
      
      from InDetRecExample.InDetJobProperties import InDetFlags
      from AthenaCommon.DetFlags              import DetFlags
      from InDetRecExample.InDetKeys          import InDetKeys
      #
      # get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr                import ToolSvc
      from AthenaCommon.AlgSequence           import AlgSequence
      topSequence = AlgSequence()
      
      #    
      # ---------- TRT_TrackExtension
      #
      if InDetFlags.doTRTExtension():


         #
         # Track extension to TRT algorithm
         #
         # set output extension map name
         OutputExtendedTracks = ExtendedTracksMap

         if doPhase:

           from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionToolCosmics
           InDetTRTExtensionToolPhase = InDet__TRT_TrackExtensionToolCosmics(name                  = 'InDetTRT_ExtensionToolPhase',
                                                                             Propagator            = InDetPropagator,
                                                                             Extrapolator          = InDetExtrapolator,
                                                                             TRT_ClustersContainer = InDetKeys.TRT_DriftCirclesUncalibrated(),
                                                                             SearchNeighbour       = False, #needs debugging!!!
                                                                             RoadWidth             = 20.)

           ToolSvc += InDetTRTExtensionToolPhase
      

           from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
           InDetTRTExtensionPhase    = InDet__TRT_TrackExtensionAlg (name                   = 'InDetTRT_ExtensionPhase'+NewTrackingCuts.extension(),
                                                                     InputTracksLocation    = SiTrackCollection,
                                                                     ExtendedTracksLocation = OutputExtendedTracks,
                                                                     TrackExtensionTool     = InDetTRTExtensionToolPhase)
           
           topSequence += InDetTRTExtensionPhase
           if (InDetFlags.doPrintConfigurables()):
            print InDetTRTExtensionPhase
           
         #
         else: 
          from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
          InDetTRTExtension    = InDet__TRT_TrackExtensionAlg (name                   = 'InDetTRT_Extension'+NewTrackingCuts.extension(),
                                                              InputTracksLocation    = SiTrackCollection,
                                                              ExtendedTracksLocation = OutputExtendedTracks,
                                                              TrackExtensionTool     = InDetTRTExtensionTool)
          #InDetTRTExtension.OutputLevel = VERBOSE
          topSequence += InDetTRTExtension
          if (InDetFlags.doPrintConfigurables()):
            print InDetTRTExtension
   
      #
      # ------------ Track Extension Processor
      #
      if InDetFlags.doExtensionProcessor():
            
         if InDetFlags.trtExtensionType() is 'DAF' :
            #
            # --- DAF Fitter setup
            #
            from TrkCompetingRIOsOnTrackTool.TrkCompetingRIOsOnTrackToolConf import Trk__CompetingRIOsOnTrackTool
            InDetCompetingRotCreator =  Trk__CompetingRIOsOnTrackTool( name                        = 'InDetCompetingRotCreator'+NewTrackingCuts.extension(),
                                                                       ToolForCompPixelClusters    = None,      # default
                                                                       ToolForCompSCT_Clusters     = None,      # default
                                                                       ToolForCompTRT_DriftCircles = InDetCompetingTRT_DC_Tool )
            ToolSvc += InDetCompetingRotCreator
            if (InDetFlags.doPrintConfigurables()):
               print InDetCompetingRotCreator
            #
            from TrkDeterministicAnnealingFilter.TrkDeterministicAnnealingFilterConf import Trk__DeterministicAnnealingFilter
            InDetExtensionFitter =  Trk__DeterministicAnnealingFilter( name = 'InDetDAF'+NewTrackingCuts.extension(),
                                                                       ToolForExtrapolation           = InDetExtrapolator,
                                                                       ToolForCompetingROTsCreation   = InDetCompetingRotCreator,
                                                                       ToolForUpdating                = InDetUpdator,
                                                                       AnnealingScheme                = [200., 81., 9., 4., 1., 1., 1.],
                                                                       DropOutlierCutValue            = 1.E-7,
                                                                       OutlierCutValue                = 0.01 )
            ToolSvc += InDetExtensionFitter
            if (InDetFlags.doPrintConfigurables()):
               print InDetExtensionFitter
         else:
            InDetExtensionFitter = InDetTrackFitter
            if NewTrackingCuts.mode() == "LowPt":
               InDetExtensionFitter = InDetTrackFitterLowPt

         #
         # --- load scoring for extension
         #
         if InDetFlags.doCosmics():
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
            InDetExtenScoringTool = InDet__InDetCosmicScoringTool(name                 = 'InDetCosmicExtenScoringTool',
                                                                  nWeightedClustersMin = 0,
                                                                  minTRTHits           = NewTrackingCuts.minTRTonTrk(),
                                                                  SummaryTool          = InDetTrackSummaryTool)
            
         else:
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
            InDetExtenScoringTool = InDet__InDetAmbiScoringTool(name                    = 'InDetExtenScoringTool'+NewTrackingCuts.extension(),
                                                                Extrapolator            = InDetExtrapolator,
                                                                SummaryTool             = InDetTrackSummaryTool,
                                                                DriftCircleCutTool      = InDetTRTDriftCircleCut,
                                                                useAmbigFcn             = True,  # this is NewTracking  
                                                                useTRT_AmbigFcn         = False,
                                                                minPt                   = NewTrackingCuts.minPT(),
                                                                maxRPhiImp              = NewTrackingCuts.maxPrimaryImpact(),
                                                                maxZImp                 = NewTrackingCuts.maxZImpact(),
                                                                maxEta                  = NewTrackingCuts.maxEta(),
                                                                minSiClusters           = NewTrackingCuts.minClusters(),
                                                                minPixel                = NewTrackingCuts.minPixel(),
                                                                maxSiHoles              = NewTrackingCuts.maxHoles(),
                                                                maxPixelHoles           = NewTrackingCuts.maxPixelHoles(),
                                                                maxSCTHoles             = NewTrackingCuts.maxSCTHoles(),
                                                                maxDoubleHoles          = NewTrackingCuts.maxDoubleHoles(),
                                                                usePixel                = NewTrackingCuts.usePixel(),
                                                                useSCT                  = NewTrackingCuts.useSCT(),
                                                                minTRTonTrk             = NewTrackingCuts.minTRTonTrk(),
                                                                minTRTPrecisionFraction = NewTrackingCuts.minTRTPrecFrac())
            
            if InDetFlags.trackFitterType() in ['KalmanFitter', 'KalmanDNAFitter', 'ReferenceKalmanFitter']:
               InDetExtenScoringTool.minTRTPrecisionFraction = 0.2

         #InDetExtenScoringTool.OutputLevel = VERBOSE 
         ToolSvc += InDetExtenScoringTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetExtenScoringTool     
         
         #
         # --- output track collection
         #
         self.__ForwardTrackCollection = ExtendedTrackCollection 
         #
         # --- get configured track extension processor
         #
         if doPhase:
         
          from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
          InDetExtensionProcessorPhase = InDet__InDetExtensionProcessor ( name               = "InDetExtensionProcessorPhase"+NewTrackingCuts.extension(),
                                                                    TrackName          = SiTrackCollection,
                                                                    Cosmics            = True,
                                                                    ExtensionMap       = OutputExtendedTracks,
                                                                    NewTrackName       = self.__ForwardTrackCollection,
                                                                    TrackFitter        = InDetExtensionFitter,
                                                                    ScoringTool        = InDetExtenScoringTool,
                                                                    suppressHoleSearch = False,  # does not work properly
                                                                    tryBremFit         = InDetFlags.doBremRecovery(),
                                                                    caloSeededBrem     = InDetFlags.doCaloSeededBrem(),
                                                                    pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                                    RefitPrds          = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() is 'DAF')))
         #InDetExtensionProcessor.OutputLevel = VERBOSE
          if InDetFlags.materialInteractions():
             InDetExtensionProcessorPhase.matEffects = InDetFlags.materialInteractionsType()
          else:
             InDetExtensionProcessorPhase.matEffects = 0
   
          topSequence += InDetExtensionProcessorPhase
          if (InDetFlags.doPrintConfigurables()):
              print InDetExtensionProcessorPhase

         else:

          from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
          InDetExtensionProcessor = InDet__InDetExtensionProcessor ( name               = "InDetExtensionProcessor"+NewTrackingCuts.extension(),
                                                                    TrackName          = SiTrackCollection,
                                                                    Cosmics            = InDetFlags.doCosmics(),
                                                                    ExtensionMap       = OutputExtendedTracks,
                                                                    NewTrackName       = self.__ForwardTrackCollection,
                                                                    TrackFitter        = InDetExtensionFitter,
                                                                    ScoringTool        = InDetExtenScoringTool,
                                                                    suppressHoleSearch = False,  # does not work properly
                                                                    tryBremFit         = InDetFlags.doBremRecovery(),
                                                                    caloSeededBrem     = InDetFlags.doCaloSeededBrem(),
                                                                    pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                                    RefitPrds          = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() is 'DAF')))
          #InDetExtensionProcessor.OutputLevel = VERBOSE
          if InDetFlags.materialInteractions():
             InDetExtensionProcessor.matEffects = InDetFlags.materialInteractionsType()
          else:
             InDetExtensionProcessor.matEffects = 0
   
          topSequence += InDetExtensionProcessor

          if (InDetFlags.doPrintConfigurables()):
             print InDetExtensionProcessor
         
         # --- Delete Resolved Si tracks and extension map
         from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg         
         InDetSGDeletionAlg(container = "TrackExtensionMap#", key = OutputExtendedTracks)
         if not InDetFlags.doMonitoringAlignment():
            InDetSGDeletionAlg(key = SiTrackCollection)
         
         #
         # ------------ Track truth.
         #
         if not InDetFlags.doSGDeletion():
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__ForwardTrackCollection,
                                                            self.__ForwardTrackCollection+"DetailedTruth",
                                                            self.__ForwardTrackCollection+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__ForwardTrackCollection ]
               
         #
      else:
         self.__ForwardTrackCollection = SiTrackCollection
Пример #9
0
    def __init__(self, name="FTF", type="eGamma"):
        TrigFastTrackFinderMT.__init__(self, name)
        remapped_type = "electron"
        from TrigOnlineSpacePointTool.TrigOnlineSpacePointToolConf import TrigL2LayerNumberTool

        self.retrieveBarCodes = False  #Look at truth information for spacepoints from barcodes
        #self.SignalBarCodes = [10001] #single particles
        self.SignalBarCodes = [11, 12]  #z->mumu

        self.useNewLayerNumberScheme = True

        self.OutputCollectionSuffix = type
        from AthenaCommon.AppMgr import ToolSvc

        numberingTool = TrigL2LayerNumberTool(name="TrigL2LayerNumberTool_FTF")
        numberingTool.UseNewLayerScheme = self.useNewLayerNumberScheme
        ToolSvc += numberingTool
        self.LayerNumberTool = numberingTool

        from InDetTrigRecExample.InDetTrigSliceSettings import InDetTrigSliceSettings
        if type == "FTK" or type == "FTKRefit":
            from TrigFTK_RecExample.TrigFTKLoadTools import theFTK_DataProviderSvc
            self.FTK_DataProviderSvc = theFTK_DataProviderSvc
            self.FTK_Mode = True
        if type == "FTKRefit":
            self.FTK_Refit = True
        else:
            #Spacepoint conversion
            from TrigOnlineSpacePointTool.TrigOnlineSpacePointToolConf import TrigSpacePointConversionTool
            spTool = TrigSpacePointConversionTool().clone(
                'TrigSpacePointConversionTool_' + remapped_type)
            spTool.DoPhiFiltering = InDetTrigSliceSettings[('doSpPhiFiltering',
                                                            remapped_type)]
            spTool.UseNewLayerScheme = self.useNewLayerNumberScheme
            spTool.UseBeamTilt = False
            spTool.PixelSP_ContainerName = 'PixelSpacePoints'
            spTool.SCT_SP_ContainerName = 'SCT_SpacePoints'
            spTool.layerNumberTool = numberingTool
            ToolSvc += spTool
            self.SpacePointProviderTool = spTool
            self.MinSPs = 5  #Only process RoI with more than 5 spacepoints

            self.Triplet_MinPtFrac = 1
            self.Triplet_nMaxPhiSlice = 53
            if remapped_type == "cosmics":
                self.Triplet_nMaxPhiSlice = 2  #Divide detector in 2 halves for cosmics

            self.Triplet_MaxBufferLength = 3
            self.doSeedRedundancyCheck = InDetTrigSliceSettings[(
                'checkRedundantSeeds', remapped_type)]
            self.Triplet_D0Max = InDetTrigSliceSettings[('d0SeedMax',
                                                         remapped_type)]
            self.Triplet_D0_PPS_Max = InDetTrigSliceSettings[('d0SeedPPSMax',
                                                              remapped_type)]
            self.TrackInitialD0Max = 20.
            if remapped_type == 'cosmics':
                self.TrackInitialD0Max = 1000.
                self.TrackZ0Max = 1000.
            self.TripletDoPSS = False
            self.pTmin = InDetTrigSliceSettings[('pTmin', remapped_type)]
            self.DoubletDR_Max = InDetTrigSliceSettings[('dRdoubletMax',
                                                         remapped_type)]
            self.SeedRadBinWidth = InDetTrigSliceSettings[('seedRadBinWidth',
                                                           remapped_type)]

            if remapped_type == "cosmics":
                self.Doublet_FilterRZ = False

            ## SCT and Pixel detector elements road builder
            from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigSiDetElementsRoadMaker
            InDetTrigSiDetElementsRoadMaker_FTF = InDetTrigSiDetElementsRoadMaker.clone(
                'InDetTrigSiDetElementsRoadMaker_FTF')
            InDetTrigSiDetElementsRoadMaker_FTF.RoadWidth = 10.0
            InDetTrigSiDetElementsRoadMaker_FTF.usePixel = True
            InDetTrigSiDetElementsRoadMaker_FTF.useSCT = True
            if remapped_type == "cosmics":
                from InDetTrigRecExample.InDetTrigConfigRecLoadToolsCosmics import InDetTrigSiDetElementsRoadMakerCosmics
                InDetTrigSiDetElementsRoadMaker_FTF = InDetTrigSiDetElementsRoadMakerCosmics.clone(
                    'InDetTrigSiDetElementsRoadMaker_FTF')
            ToolSvc += InDetTrigSiDetElementsRoadMaker_FTF

            from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigSiComTrackFinder
            InDetTrigSiComTrackFinder_FTF = InDetTrigSiComTrackFinder.clone(
                "InDetTrigSiComTrackFinder_FTF")
            ToolSvc += InDetTrigSiComTrackFinder_FTF
            print InDetTrigSiComTrackFinder_FTF

            from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import EFIDTrackingCuts
            TrackingCuts = EFIDTrackingCuts
            if remapped_type == "cosmics":
                from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import EFIDTrackingCutsCosmics
                TrackingCuts = EFIDTrackingCutsCosmics

            from InDetRecExample.InDetKeys import InDetKeys
            from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as Propagator
            InDetPatternPropagator = Propagator(name='InDetPatternPropagator')
            ToolSvc += InDetPatternPropagator
            from TrkMeasurementUpdator_xk.TrkMeasurementUpdator_xkConf import Trk__KalmanUpdator_xk
            InDetPatternUpdator = Trk__KalmanUpdator_xk(
                name='InDetPatternUpdator')
            ToolSvc += InDetPatternUpdator

            from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__PixelClusterOnTrackTool
            PixelClusterOnTrackToolDigital = InDet__PixelClusterOnTrackTool(
                "InDetPixelClusterOnTrackToolDigital",
                DisableDistortions=False,
                applyNNcorrection=False,
                NNIBLcorrection=False,
                SplitClusterAmbiguityMap=InDetKeys.SplitClusterAmbiguityMap(),
                RunningTIDE_Ambi=False,
                ErrorStrategy=2,
                PositionStrategy=1)

            ToolSvc += PixelClusterOnTrackToolDigital
            from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__SCT_ClusterOnTrackTool
            SCT_ClusterOnTrackTool = InDet__SCT_ClusterOnTrackTool(
                "InDetSCT_ClusterOnTrackTool",
                #CorrectionStrategy = -1,  # no position correction (test for bug #56477)
                CorrectionStrategy=0,  # do correct position bias
                ErrorStrategy=2)  # do use phi dependent errors
            ToolSvc += SCT_ClusterOnTrackTool
            from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator
            InDetRotCreatorDigital = Trk__RIO_OnTrackCreator(
                name='InDetRotCreatorDigital',
                ToolPixelCluster=PixelClusterOnTrackToolDigital,
                ToolSCT_Cluster=SCT_ClusterOnTrackTool,
                Mode='indet')
            ToolSvc += InDetRotCreatorDigital
            from InDetAssociationTools.InDetAssociationToolsConf import InDet__InDetPRD_AssociationToolGangedPixels
            InDetPrdAssociationTool = InDet__InDetPRD_AssociationToolGangedPixels(
                name="InDetPrdAssociationTool",
                PixelClusterAmbiguitiesMapName=InDetKeys.GangedPixelMap(),
                addTRToutliers=True)
            ToolSvc += InDetPrdAssociationTool

            from AthenaCommon.DetFlags import DetFlags
            from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk
            InDetSiComTrackFinder = InDet__SiCombinatorialTrackFinder_xk(
                name='InDetSiComTrackFinder',
                PropagatorTool=InDetPatternPropagator,
                UpdatorTool=InDetPatternUpdator,
                RIOonTrackTool=InDetRotCreatorDigital,
                AssosiationTool=InDetPrdAssociationTool,
                usePixel=True,  #DetFlags.haveRIO.pixel_on(),
                useSCT=True,  #DetFlags.haveRIO.SCT_on(),
                PixManagerLocation=InDetKeys.PixelManager(),
                SCTManagerLocation=InDetKeys.SCT_Manager(),
                PixelClusterContainer=InDetKeys.PixelClusters(),
                SCT_ClusterContainer=InDetKeys.SCT_Clusters())
            ToolSvc += InDetSiComTrackFinder
            from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
            InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(
                name='InDetSiRoadMaker_' + remapped_type,
                PropagatorTool=InDetPatternPropagator,
                usePixel=True,  #DetFlags.haveRIO.pixel_on(),
                PixManagerLocation=InDetKeys.PixelManager(),
                useSCT=True,  #DetFlags.haveRIO.SCT_on(), 
                SCTManagerLocation=InDetKeys.SCT_Manager(),
                RoadWidth=10.0)
            print InDetSiDetElementsRoadMaker
            ToolSvc += InDetSiDetElementsRoadMaker

            from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
            TrackMaker_FTF = SiTrackMaker(
                name='InDetTrigSiTrackMaker_FTF_' + remapped_type,
                RoadTool=InDetSiDetElementsRoadMaker,
                CombinatorialTrackFinder=InDetSiComTrackFinder,
                pTmin=InDetTrigSliceSettings[('pTmin', remapped_type)],
                nClustersMin=TrackingCuts.minClusters(),
                nHolesMax=TrackingCuts.nHolesMax(),
                nHolesGapMax=TrackingCuts.nHolesGapMax(),
                SeedsFilterLevel=0,  # Do not use built-in seeds filter
                Xi2max=TrackingCuts.Xi2max(),
                Xi2maxNoAdd=TrackingCuts.Xi2maxNoAdd(),
                nWeightedClustersMin=TrackingCuts.nWeightedClustersMin(),
                Xi2maxMultiTracks=TrackingCuts.Xi2max(),
                UseAssociationTool=False)

            from InDetRecExample.InDetJobProperties import InDetFlags
            if not InDetFlags.doCaloSeededBrem():
                TrackMaker_FTF.InputClusterContainerName = ""
                TrackMaker_FTF.InputHadClusterContainerName = ""

            from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
            if type == 'eGamma' and InDetTrigFlags.doBremRecovery():
                TrackMaker_FTF.useBremModel = True

            if remapped_type == "cosmics":
                TrackMaker_FTF.RoadTool.CosmicTrack = True

            ToolSvc += TrackMaker_FTF
            self.initialTrackMaker = TrackMaker_FTF

            from TrigInDetTrackFitter.TrigInDetTrackFitterConf import TrigInDetTrackFitter
            theTrigInDetTrackFitter = TrigInDetTrackFitter()
            #theTrigInDetTrackFitter.correctClusterPos = False #Flag to control whether to correct cluster position
            theTrigInDetTrackFitter.correctClusterPos = True  #temporarily to true to improve err(z0) estimates

            from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigRotCreator
            theTrigInDetTrackFitter.ROTcreator = InDetTrigRotCreator
            ToolSvc += theTrigInDetTrackFitter
            self.trigInDetTrackFitter = theTrigInDetTrackFitter
            from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
            if type == 'eGamma' and InDetTrigFlags.doBremRecovery():
                theTrigInDetTrackFitterBrem = TrigInDetTrackFitter(
                    name='theTrigInDetTrackFitterBrem', doBremmCorrection=True)
                ToolSvc += theTrigInDetTrackFitterBrem
                self.trigInDetTrackFitter = theTrigInDetTrackFitterBrem

            self.doZFinder = InDetTrigSliceSettings[('doZFinder',
                                                     remapped_type)]
            if (self.doZFinder):
                from IDScanZFinder.IDScanZFinderConf import TrigZFinder
                theTrigZFinder = TrigZFinder()
                theTrigZFinder.NumberOfPeaks = 3
                theTrigZFinder.LayerNumberTool = numberingTool

                theTrigZFinder.FullScanMode = True  #TODO: know this from the RoI anyway - should set for every event
                ToolSvc += theTrigZFinder
                self.trigZFinder = theTrigZFinder
                self.doFastZVertexSeeding = True
                self.zVertexResolution = 7.5

            from TrigInDetConf.TrigInDetRecCommonTools import InDetTrigFastTrackSummaryTool
            self.TrackSummaryTool = InDetTrigFastTrackSummaryTool

            if remapped_type == "tauCore":
                from TrigInDetConf.TrigInDetRecCommonTools import InDetTrigTrackSummaryToolWithHoleSearch
                self.TrackSummaryTool = InDetTrigTrackSummaryToolWithHoleSearch

            from TrigInDetTrackFitter.TrigInDetTrackFitterConf import TrigL2ResidualCalculator
            resCalc = TrigL2ResidualCalculator(OfflineClusters=False)
            ToolSvc += resCalc
            self.TrigL2ResidualCalculator = resCalc
            self.doCloneRemoval = InDetTrigSliceSettings[('doCloneRemoval',
                                                          remapped_type)]