Esempio n. 1
0
def InDetMeasRecalibST(name='InDetMeasRecalibST', **kwargs):
    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__MeasRecalibSteeringTool

    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

    from InDetRecExample import TrackingCommon as TrackingCommon
    if 'BroadPixelClusterOnTrackTool' not in kwargs:
        kwargs = setDefaults(
            kwargs,
            BroadPixelClusterOnTrackTool=TrackingCommon.
            getInDetBroadPixelClusterOnTrackTool(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))
    if 'BroadSCT_ClusterOnTrackTool' not in kwargs:
        kwargs = setDefaults(kwargs,
                             BroadSCT_ClusterOnTrackTool=TrackingCommon.
                             getInDetBroadSCT_ClusterOnTrackTool())

    if 'CommonRotCreator' not in kwargs:
        kwargs = setDefaults(
            kwargs,
            CommonRotCreator=TrackingCommon.getInDetRefitRotCreator(
                SplitClusterMapExtension=split_cluster_map_extension))

    return Trk__MeasRecalibSteeringTool(name, **kwargs)
Esempio n. 2
0
def GaussianSumFitter(name='GaussianSumFitter', **kwargs):
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

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

    if 'ToolForExtrapolation' not in kwargs:
        kwargs = setDefaults(
            kwargs,
            ToolForExtrapolation=TrackingCommon.getInDetGsfExtrapolator())

    if 'MeasurementUpdatorType' not in kwargs:
        kwargs = setDefaults(kwargs,
                             MeasurementUpdatorType=TrackingCommon.
                             getInDetGsfMeasurementUpdator())

    from TrkGaussianSumFilter.TrkGaussianSumFilterConf import Trk__GaussianSumFitter
    return Trk__GaussianSumFitter(name=name,
                                  **setDefaults(kwargs,
                                                ReintegrateOutliers=False,
                                                MakePerigee=True,
                                                RefitOnMeasurementBase=True,
                                                DoHitSorting=True))
Esempio n. 3
0
def InDetGlobalChi2FitterLowPt(name='InDetGlobalChi2FitterLowPt', **kwargs):
    # @TODO TrackingGeometrySvc was not set but is set now
    #       RotCreatorTool and BroadRotCreatorTool not set
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

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

    from InDetRecExample.InDetJobProperties import InDetFlags
    use_broad_cluster_any = InDetFlags.useBroadClusterErrors() and (
        not InDetFlags.doDBMstandalone())
    if 'BroadRotCreatorTool' not in kwargs and not InDetFlags.doRefit():
        kwargs = setDefaults(
            kwargs,
            BroadRotCreatorTool=TrackingCommon.getInDetBroadRotCreator(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))

    return InDetGlobalChi2FitterBase(
        name,
        **setDefaults(
            kwargs,
            OutlierCut=5.0,
            Acceleration=False,  # default
            RecalculateDerivatives=True,
            TrackChi2PerNDFCut=10))
Esempio n. 4
0
def getInDetPhysValMonitoringToolTightPrimary(**kwargs):
    if 'TrackSelectionTool' not in kwargs:
        from InDetPhysValMonitoring.TrackSelectionTool import getInDetTrackSelectionToolTightPrimary
        kwargs = setDefaults(kwargs,
                             TrackSelectionTool=toolFactory(
                                 getInDetTrackSelectionToolTightPrimary))

    kwargs = setDefaults(kwargs,
                         name='InDetPhysValMonitoringToolTightPrimary',
                         SubFolder='TightPrimary/',
                         useTrackSelection=True)

    return getInDetPhysValMonitoringTool(**kwargs)
Esempio n. 5
0
def InDetGlobalChi2FitterBase(name='GlobalChi2FitterBase', **kwargs):
    from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
    from InDetRecExample.TrackingCommon import setDefaults
    from AthenaCommon.AppMgr import ToolSvc
    from InDetRecExample.InDetJobProperties import InDetFlags
    import InDetRecExample.TrackingCommon as TrackingCommon

    kwargs = setDefaults(
        kwargs,
        ExtrapolationTool=TrackingCommon.getInDetExtrapolator(),
        NavigatorTool=TrackingCommon.getInDetNavigator(),
        PropagatorTool=TrackingCommon.getInDetPropagator(),
        MultipleScatteringTool=TrackingCommon.
        getInDetMultipleScatteringUpdator(),
        MeasurementUpdateTool=ToolSvc.InDetUpdator,
        TrackingGeometrySvc=AtlasTrackingGeometrySvc,
        MaterialUpdateTool=TrackingCommon.getInDetMaterialEffectsUpdator(),
        StraightLine=not InDetFlags.solenoidOn(),
        OutlierCut=4,
        SignedDriftRadius=True,
        ReintegrateOutliers=True,
        RecalibrateSilicon=True,
        RecalibrateTRT=True,
        TRTTubeHitCut=
        1.75,  # use tighter hit classification, old: TrackingCommon.default_ScaleHitUncertainty
        MaxIterations=40,
        Acceleration=True,
        RecalculateDerivatives=InDetFlags.doMinBias()
        or InDetFlags.doCosmics() or InDetFlags.doBeamHalo(),
        TRTExtensionCuts=True,
        TrackChi2PerNDFCut=7)
    from TrkGlobalChi2Fitter.TrkGlobalChi2FitterConf import Trk__GlobalChi2Fitter
    return Trk__GlobalChi2Fitter(name, **kwargs)
Esempio n. 6
0
def getInDetPhysValTruthDecoratorAlgStableParticles(**kwargs):
    '''
    Create a decoration algorithm which decorates stable truth particles only with track parameters at the perigee
    see @ref getInDetPhysValTruthDecoratorAlg for details.
    '''
    return getInDetPhysValTruthDecoratorAlg(
        **setDefaults(kwargs, TruthSelectionTool=getInDetTruthSelectionTool()))
Esempio n. 7
0
def getInDetPhysValMonitoringToolGSF(**kwargs):
    kwargs = setDefaults(kwargs,
                         name='InDetPhysValMonitoringToolGSF',
                         SubFolder='GSF/',
                         TrackParticleContainerName='GSFTrackParticles',
                         useTrackSelection=True)

    return getInDetPhysValMonitoringTool(**kwargs)
Esempio n. 8
0
def InDetGlobalChi2Fitter(name='InDetGlobalChi2Fitter', **kwargs):
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

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

    from InDetRecExample.InDetJobProperties import InDetFlags
    use_broad_cluster_any = InDetFlags.useBroadClusterErrors() and (
        not InDetFlags.doDBMstandalone())
    if 'BroadRotCreatorTool' not in kwargs and not InDetFlags.doRefit():
        kwargs = setDefaults(
            kwargs,
            BroadRotCreatorTool=TrackingCommon.getInDetBroadRotCreator(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))

    if InDetFlags.doDBMstandalone():
        kwargs = setDefaults(kwargs,
                             StraightLine=True,
                             OutlierCut=5,
                             RecalibrateTRT=False,
                             TRTExtensionCuts=False,
                             TrackChi2PerNDFCut=20)

    if InDetFlags.doRefit() or use_broad_cluster_any is True:
        kwargs = setDefaults(kwargs, RecalibrateSilicon=False)
    if InDetFlags.doRefit():
        kwargs = setDefaults(kwargs,
                             BroadRotCreatorTool=None,
                             ReintegrateOutliers=False,
                             RecalibrateTRT=False)
    if InDetFlags.doRobustReco():
        kwargs = setDefaults(
            kwargs,
            # BroadRotCreatorTool = None
            OutlierCut=10.0,
            TrackChi2PerNDFCut=20)

    if InDetFlags.doRobustReco() or InDetFlags.doCosmics():
        kwargs = setDefaults(kwargs, MaxOutliers=99)
    if InDetFlags.doCosmics() or InDetFlags.doBeamHalo():
        kwargs = setDefaults(kwargs, Acceleration=False)

    if InDetFlags.materialInteractions() and not InDetFlags.solenoidOn():
        kwargs = setDefaults(kwargs, Momentum=1000. * Units.MeV)
    return InDetGlobalChi2FitterBase(name, **kwargs)
Esempio n. 9
0
def createPublicTool(cfg_class, kwargs_in, **kwargs_default):
    kwargs = setDefaults(kwargs_in, **kwargs_default)
    name = kwargs.pop('name', cfg_class.__class__.__name__)
    from AthenaCommon.AppMgr import ToolSvc
    if hasattr(ToolSvc, name):
        return getattr(ToolSvc, name)
    a_tool = cfg_class(name=name, **kwargs)
    ToolSvc += a_tool
    return a_tool
Esempio n. 10
0
def getInDetPhysValMonitoringToolDBM(**kwargs):
    from InDetRecExample.InDetKeys import InDetKeys
    kwargs = setDefaults(kwargs,
                         name='InDetPhysValMonitoringToolDBM',
                         SubFolder='DBM/',
                         TrackParticleContainerName=InDetKeys.DBMTracks(),
                         useTrackSelection=True)

    return getInDetPhysValMonitoringTool(**kwargs)
Esempio n. 11
0
def DistributedKalmanFilter(name="DistributedKalmanFilter", **kwargs):
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

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

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

    # @TODO set sortingReferencePoint = ???
    from TrkDistributedKalmanFilter.TrkDistributedKalmanFilterConf import Trk__DistributedKalmanFilter
    return Trk__DistributedKalmanFilter(name=name, **kwargs)
Esempio n. 12
0
def InDetGlobalChi2FitterDBM(name='InDetGlobalChi2FitterDBM', **kwargs):
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')
    if 'RotCreatorTool' not in kwargs:
        from InDetRecExample import TrackingCommon as TrackingCommon
        kwargs = setDefaults(
            kwargs,
            RotCreatorTool=TrackingCommon.getInDetRotCreatorDBM(
                SplitClusterMapExtension=split_cluster_map_extension))

    return InDetGlobalChi2FitterBase(
        name,
        **setDefaults(kwargs,
                      BroadRotCreatorTool=None,
                      StraightLine=True,
                      OutlierCut=5,
                      RecalibrateTRT=False,
                      RecalculateDerivatives=False,
                      TRTExtensionCuts=False,
                      TrackChi2PerNDFCut=20,
                      Momentum=1000. * Units.MeV))
Esempio n. 13
0
def getInDetxAODParticleCreatorTool(prd_to_track_map=None, suffix=""):
    from AthenaCommon.AppMgr import ToolSvc
    if hasattr(ToolSvc, 'InDetxAODParticleCreatorTool' + suffix):
        return getattr(ToolSvc, 'InDetxAODParticleCreatorTool')

    _perigee_expression = InDetFlags.perigeeExpression()
    # need to treat Vertex specifically because at the time of
    # the track particle creation the primary vertex does not yet exist.
    # The problem is solved by first creating track particles wrt. the beam line
    # and correcting the parameters after the vertex finding.
    if _perigee_expression == 'Vertex':
        _perigee_expression = 'BeamLine'

    from InDetRecExample import TrackingCommon as TrackingCommon
    from InDetRecExample.TrackingCommon import setDefaults
    if prd_to_track_map is None:
        track_summary_tool = TrackingCommon.getInDetTrackSummaryToolSharedHits(
        )
    else:
        prop_args = setDefaults({}, nameSuffix=suffix)
        asso_tool = TrackingCommon.getConstPRD_AssociationTool(
            **setDefaults(prop_args, PRDtoTrackMap=prd_to_track_map))
        helper_tool = TrackingCommon.getInDetSummaryHelperSharedHits(
            **setDefaults(prop_args, AssoTool=asso_tool))
        track_summary_tool = TrackingCommon.getInDetTrackSummaryToolSharedHits(
            **setDefaults(prop_args, InDetSummaryHelperTool=helper_tool))

    from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool
    InDetxAODParticleCreatorTool = Trk__TrackParticleCreatorTool(
        name="InDetxAODParticleCreatorTool" + suffix,
        Extrapolator=InDetExtrapolator,
        TrackSummaryTool=track_summary_tool,
        BadClusterID=InDetFlags.pixelClusterBadClusterID(),
        KeepParameters=True,
        KeepFirstParameters=InDetFlags.KeepFirstParameters(),
        PerigeeExpression=_perigee_expression)

    ToolSvc += InDetxAODParticleCreatorTool
    if InDetFlags.doPrintConfigurables():
        printfunc(InDetxAODParticleCreatorTool)
    return InDetxAODParticleCreatorTool
Esempio n. 14
0
def createExtendNameIfNotDefault(cfg_class, check_prop, def_val, kwargs_in,
                                 **kwargs_default):
    kwargs = setDefaults(kwargs_in, **kwargs_default)
    def_name = cfg_class.getType() if hasattr(
        cfg_class, 'getType') else cfg_class.__class__.__name__
    the_name = kwargs.pop('name', def_name)
    if check_prop in kwargs and kwargs[check_prop] != def_val:
        if the_name == def_name:
            the_name += '_'
            the_name += kwargs[check_prop]
    elif check_prop not in kwargs:
        kwargs.setdefault(check_prop, def_val)
    return cfg_class(name=the_name, **kwargs)
Esempio n. 15
0
def InDetGlobalChi2FitterTRT(name='InDetGlobalChi2FitterTRT', **kwargs):
    '''
    Global Chi2 Fitter for TRT segments with different settings
    '''
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

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

    from InDetRecExample.InDetJobProperties import InDetFlags
    return InDetGlobalChi2FitterBase(
        name,
        **setDefaults(
            kwargs,
            MaterialUpdateTool='',  # default
            TrackingGeometrySvc='',  # default
            SignedDriftRadius=True,  # default,
            RecalibrateSilicon=False,  # default,
            RecalibrateTRT=False,  # default,
            TRTTubeHitCut=2.5,  # default,
            MaxIterations=10,
            Acceleration=False,  # default,
            RecalculateDerivatives=False,
            TRTExtensionCuts=True,  # default,
            TrackChi2PerNDFCut=999999,
            Momentum=1000. * Units.MeV if InDetFlags.materialInteractions()
            and not InDetFlags.solenoidOn() else 0,  # default,
            OutlierCut=5,  # default
            MaxOutliers=99 if InDetFlags.doRobustReco()
            or InDetFlags.doCosmics() else 10,  # default,
            ReintegrateOutliers=False
            if InDetFlags.doRefit() else False  # default
        ))
Esempio n. 16
0
def InDetKalmanTrackFitterBase(name='InDetKalmanTrackFitterBase', **kwargs):
    from InDetRecExample import TrackingCommon as TrackingCommon
    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanFitter
    from AthenaCommon.AppMgr import ToolSvc
    split_cluster_map_extension = kwargs.get('SplitClusterMapExtension', '')

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

    kwargs.setdefault('MeasurementUpdatorHandle', ToolSvc.InDetUpdator)
    setTool('KalmanSmootherHandle', 'InDetBKS', kwargs)
    setTool('KalmanOutlierLogicHandle', 'InDetKOL', kwargs)
    kwargs.setdefault('DynamicNoiseAdjustorHandle', None)
    kwargs.setdefault('BrempointAnalyserHandle', None)
    kwargs.setdefault('AlignableSurfaceProviderHandle', None)
    if len(split_cluster_map_extension) > 0:
        if 'RecalibratorHandle' not in kwargs:
            the_tool_name = 'InDetMeasRecalibST'
            kwargs.setdefault(
                'RecalibratorHandle',
                CfgGetter.getPublicToolClone(
                    the_tool_name + split_cluster_map_extension,
                    the_tool_name,
                    SplitClusterMapExtension=split_cluster_map_extension))
    else:
        setTool('RecalibratorHandle', 'InDetMeasRecalibST', kwargs)
    # setTool('InternalDAFHandle','KalmanInternalDAF',kwargs )
    # from InDetRecExample.InDetJobProperties import InDetFlags
    # kwargs.setdefault('DoDNAForElectronsOnly', True if InDetFlags.doBremRecovery() and InDetFlags.trackFitterType() is 'KalmanFitter' else False)
    return Trk__KalmanFitter(name, **kwargs)
Esempio n. 17
0
def getInDetPhysValMonitoringTool(**kwargs):
    kwargs = setDefaults(kwargs, useTrackSelection=False, EnableLumi=False)

    # create the HistogramDefinitionSvc
    # at the moment there can only be one HistogramDefinitionSvc
    from InDetPhysValMonitoring.HistogramDefinitionSvc import getHistogramDefinitionSvc
    #self.HistogramDefinitionSvc =
    serviceFactory(getHistogramDefinitionSvc)

    from InDetPhysValMonitoring.InDetPhysValJobProperties import isMC, InDetPhysValFlags
    if isMC():
        from InDetPhysValMonitoring.InDetPhysValDecoration import getInDetRttTruthSelectionTool
        kwargs = setDefaults(kwargs,
                             TruthParticleContainerName="TruthParticles")
        if 'TruthSelectionTool' not in kwargs:
            kwargs = setDefaults(
                kwargs, TruthSelectionTool=getInDetRttTruthSelectionTool())
        if InDetPhysValFlags.doValidateTracksInJets():
            jets_name = 'AntiKt4LCTopoJets'
            kwargs = setDefaults(kwargs,
                                 JetContainerName=jets_name,
                                 FillTrackInJetPlots=True)
            from InDetPhysValMonitoring.addTruthJets import addTruthJetsIfNotExising
            addTruthJetsIfNotExising(jets_name)
            if InDetPhysValFlags.doValidateTracksInBJets():
                kwargs = setDefaults(kwargs, FillTrackInBJetPlots=True)

        else:
            kwargs = setDefaults(kwargs,
                                 JetContainerName='',
                                 FillTrackInJetPlots=False)

        #adding the VeretxTruthMatchingTool
        from InDetTruthVertexValidation.InDetTruthVertexValidationConf import InDetVertexTruthMatchTool
        kwargs = setDefaults(
            kwargs,
            useVertexTruthMatchTool=True,
            VertexTruthMatchTool=toolFactory(InDetVertexTruthMatchTool))

        #Options for Truth Strategy : Requires full pile-up truth containers for some
        if InDetPhysValFlags.setTruthStrategy(
        ) == 'All' or InDetPhysValFlags.setTruthStrategy() == 'PileUp':
            from RecExConfig.AutoConfiguration import IsInInputFile
            if IsInInputFile('xAOD::TruthPileupEventContainer',
                             'TruthPileupEvents'):
                kwargs = setDefaults(
                    kwargs, PileupSwitch=InDetPhysValFlags.setTruthStrategy())
            else:
                print(
                    'WARNING Truth Strategy for InDetPhysValMonitoring set to %s but TruthPileupEvents are missing in the input; resetting to HardScatter only'
                    % (InDetPhysValFlags.setTruthStrategy()))
        elif InDetPhysValFlags.setTruthStrategy() != 'HardScatter':
            print(
                'WARNING Truth Strategy for for InDetPhysValMonitoring set to invalid option %s; valid flags are ["HardScatter", "All", "PileUp"]'
                % (InDetPhysValFlags.setTruthStrategy()))

    else:
        # disable truth monitoring for data
        kwargs = setDefaults(
            kwargs,
            TruthParticleContainerName='',
            TruthVertexContainerName='',
            TruthEvents='',
            TruthPileupEvents='',
            TruthSelectionTool='',
            # the jet container is actually meant to be a truth jet container
            JetContainerName='',
            FillTrackInJetPlots=False,
            FillTrackInBJetPlots=False)

    # Control the number of output histograms
    if InDetPhysValFlags.doPhysValOutput():
        kwargs = setDefaults(kwargs, SkillLevel=100)

    elif InDetPhysValFlags.doExpertOutput():
        kwargs = setDefaults(kwargs, SkillLevel=200)

    # hack to remove example physval monitor
    from RecExConfig.AutoConfiguration import IsInInputFile
    if not IsInInputFile('xAOD::JetContainer', 'AntiKt4EMTopoJets'):
        add_remover = True
        from RecExConfig.RecFlags import rec
        try:
            for elm in rec.UserExecs:
                if elm.find('removePhysValExample') > 0:
                    add_remover = False
                    break
        except:
            pass
        if add_remover:
            rec.UserExecs += [
                'from InDetPhysValMonitoring.InDetPhysValMonitoringTool import removePhysValExample;removePhysValExample();'
            ]

    return InDetPhysValMonitoring.InDetPhysValMonitoringConf.InDetPhysValMonitoringTool(
        **kwargs)
Esempio n. 18
0
def create(cfg_class, kwargs_in, **kwargs_default):
    kwargs = setDefaults(kwargs_in, **kwargs_default)
    name = kwargs.pop('name', cfg_class.__class__.__name__)
    return cfg_class(name=name, **kwargs)
Esempio n. 19
0
def getInDetTruthSelectionTool(**kwargs):
    return getInDetRttTruthSelectionTool(**setDefaults(
        kwargs, name='InDetTruthSelectionTool',
        maxProdVertRadius=-1))  # disable production radius cut
Esempio n. 20
0
def getPhysValMonInDetHoleSearchTool(**kwargs):
    from InDetRecExample.TrackingCommon import getInDetHoleSearchTool
    kwargs = setDefaults(kwargs, name='PhysValMonInDetHoleSearchTool')

    return getInDetHoleSearchTool(**kwargs)
Esempio n. 21
0
def getInDetTrackSelectionToolLoose(name="InDetTrackSelectionToolLoose",
                                    **kwargs):
    kwargs = setDefaults(kwargs, CutLevel="Loose")
    return InDet__InDetTrackSelectionTool(name, **kwargs)
Esempio n. 22
0
def getInDetTrackSelectionToolTightPrimary(
        name="InDetTrackSelectionToolTightPrimary", **kwargs):
    kwargs = setDefaults(kwargs, CutLevel="TightPrimary")
    return InDet__InDetTrackSelectionTool(name, **kwargs)
Esempio n. 23
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]