Esempio n. 1
0
def generateInDetSensitiveDetectorList():
    SensitiveDetectorList = []

    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())
    isRUN1 = not (isRUN2 or isUpgrade)

    from AthenaCommon.DetFlags import DetFlags
    #if isRUN2 and DetFlags.simulation.DBM_on():
    #    SensitiveDetectorList += [ 'DBMSensorSD' ]
    if DetFlags.simulate.pixel_on():
        if isRUN1 or isRUN2:
            if DetFlags.simulate.BCM_on():
                SensitiveDetectorList += ['BCMSensorSD']
                SensitiveDetectorList += ['BLMSensorSD']
        SensitiveDetectorList += ['PixelSensorSD']
    if DetFlags.simulate.SCT_on():
        if isUpgrade:
            SensitiveDetectorList += ['SLHC_SctSensorSD']
        else:
            SensitiveDetectorList += ['SctSensorSD']
    if DetFlags.simulate.TRT_on() and not isUpgrade:
        SensitiveDetectorList += ['TRTSensitiveDetector']
    return SensitiveDetectorList
Esempio n. 2
0
def getIDETEnvelope(name="IDET", **kwargs):
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())
    #isRUN1 = not (isRUN2 or isUpgrade)

    kwargs.setdefault("DetectorName", "IDET")
    innerRadius = 37. * mm  # RUN1 default
    if isRUN2:
        innerRadius = 28.9 * mm  #29.15*mm
    if isUpgrade:
        innerRadius = 32.15 * mm
    kwargs.setdefault("InnerRadius", innerRadius)
    kwargs.setdefault("OuterRadius", 1.148 * m)
    kwargs.setdefault("dZ", 347.5 * cm)
    SubDetectorList = []
    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.geometry.pixel_on():
        SubDetectorList += ['Pixel']
    if DetFlags.geometry.SCT_on():
        SubDetectorList += ['SCT']
    if DetFlags.geometry.TRT_on() and not isUpgrade:
        SubDetectorList += ['TRT']
    SubDetectorList += ['IDetServicesMat']
    kwargs.setdefault("SubDetectors", SubDetectorList)
    return CfgMgr.CylindricalEnvelope(name, **kwargs)
Esempio n. 3
0
def getPixelPhysicsRegionTool(name='PixelPhysicsRegionTool', **kwargs):
    kwargs.setdefault("RegionName", 'Pixel')
    volumeList = ['Pixel::siLog', 'Pixel::siBLayLog']
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    if (commonGeoFlags.Run() in [
            "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL()):
        volumeList += ['Pixel::dbmDiamondLog']
    kwargs.setdefault("VolumeList", volumeList)
    kwargs.setdefault("ElectronCut", 0.05)
    kwargs.setdefault("PositronCut", 0.05)
    kwargs.setdefault("GammaCut", 0.05)
    return CfgMgr.RegionCreator(name, **kwargs)
Esempio n. 4
0
def getTRTSensitiveDetector(name="TRTSensitiveDetector", **kwargs):
    bare_collection_name = "TRTUncompressedHits"
    mergeable_collection_suffix = "_G4"
    merger_input_property = "TRTUncompressedHits"
    region = "ID"
    hits_collection_name = generate_mergeable_collection_name(
        bare_collection_name, mergeable_collection_suffix,
        merger_input_property, region)
    logicalVolumeNames = ["TRT::Gas", "TRT::GasMA"]
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as geoFlags
    if (geoFlags.Run() in ["RUN2", "RUN3"]):
        ## RUN2 configuration
        logicalVolumeNames += [
            "TRT::Gas_Ar", "TRT::GasMA_Ar", "TRT::Gas_Kr", "TRT::GasMA_Kr"
        ]
    kwargs.setdefault("LogicalVolumeNames", logicalVolumeNames)

    kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
    return CfgMgr.TRTSensitiveDetectorTool(name, **kwargs)
Esempio n. 5
0
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration

# Configuration functions for IP2DTag
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags
from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
from IOVDbSvc.CondDB import conddb
btagrun1 = False
if conddb.dbdata == 'COMP200':
    btagrun1 = True
elif conddb.isMC:
    btagrun1 = (commonGeoFlags.Run() == "RUN1"
                or (commonGeoFlags.Run() == "UNDEFINED"
                    and geoFlags.isIBL() == False))

metaIP2DTag = {
    'IsATagger': True,
    'xAODBaseName': 'IP2D',
    'DependsOn': [  #'AtlasExtrapolator',
        #'BTagTrackToVertexTool',
        #'InDetVKalVxInJetTool',
        #'BTagFullLinearizedTrackFactory',
        #'BTagTrackToVertexIPEstimator',
        #'IP2DDetailedTrackGradeFactory',
        #'IP2DBasicTrackGradeFactory',
        #'SVForIPTool_IP2D',
        #'IP2DTrackSelector',
        #'IP2DNewLikelihoodTool'
    ],
    'PassByPointer': {  #'SVForIPTool'                : 'SVForIPTool_IP2D',
Esempio n. 6
0
    def InitializeGeometryParameters(self):

        # ----------------------------------------------------------------------------
        # Read versionname, layout and dbm from PixelSwicthes table

        dbId, dbSwitches, dbParam = self.dbGeomCursor.GetCurrentLeafContent(
            "PixelSwitches")

        _versionName = "UNDEFINED"
        _layout = "UNDEFINED"
        _dbm = False

        if len(dbId) > 0:
            key = dbId[0]
            if "VERSIONNAME" in dbParam:
                _versionName = dbSwitches[key][dbParam.index("VERSIONNAME")]
            if "LAYOUT" in dbParam:
                _layout = dbSwitches[key][dbParam.index("LAYOUT")]
            if "BUILDDBM" in dbParam:
                _dbm = (dbSwitches[key][dbParam.index("BUILDDBM")] != 0)

        self.__dict__["VersionName"] = _versionName
        self.__dict__["Layout"] = _layout
        self.__dict__["DBM"] = _dbm

        # ----------------------------------------------------------------------------
        # IBL layout

        dbId, dbLayers, dbParam = self.dbGeomCursor.GetCurrentLeafContent(
            "PixelLayer")
        IBLStaveIndex = -1
        IBLgeoLayout = -1
        _IBLlayout = "noIBL"
        if len(dbId) > 0:
            key = dbId[0]
            if "STAVEINDEX" in dbParam and dbLayers[key][dbParam.index(
                    "STAVEINDEX")] not in ["NULL", None]:
                IBLStaveIndex = int(dbLayers[key][dbParam.index("STAVEINDEX")])

            if IBLStaveIndex > -1:
                dbId, dbStaves, dbParam = self.dbGeomCursor.GetCurrentLeafContent(
                    "PixelStave")

                if len(dbId) > 0 and IBLStaveIndex <= len(dbStaves.keys()):
                    key = dbId[IBLStaveIndex]
                    if "LAYOUT" in dbParam and dbStaves[key][dbParam.index(
                            "LAYOUT")] not in ["NULL", None]:
                        IBLgeoLayout = int(
                            dbStaves[key][dbParam.index("LAYOUT")])
                        if IBLgeoLayout in [3, 4]: _IBLlayout = "planar"
                        elif IBLgeoLayout in [5]: _IBLlayout = "3D"

        self.__dict__["IBLlayout"] = _IBLlayout

        # ----------------------------------------------------------------------------
        # IBL and SLHC parameters

        self.__dict__["IBL"] = False
        self.__dict__["SLHC"] = False
        if _layout in ['IBL']: self.__dict__["IBL"] = True
        if self.__dict__["IBL"] == False: self.__dict__["IBLlayout"] = "noIBL"
        if _layout not in ['SLHC'] and (CommonGeometryFlags.Run()
                                        in ["RUN2", "RUN3"]):
            self.__dict__["IBL"] = True
        if _layout in ['SLHC']: self.__dict__["SLHC"] = True
Esempio n. 7
0
def getATLAS_RegionCreatorList():
    regionCreatorList = []
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())

    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    if simFlags.SimulateCavern.get_Value():
        regionCreatorList += [
            'SX1PhysicsRegionTool', 'BedrockPhysicsRegionTool',
            'CavernShaftsConcretePhysicsRegionTool'
        ]
        #regionCreatorList += ['CavernShaftsAirPhysicsRegionTool'] # Not used currently
    if DetFlags.ID_on():
        if DetFlags.pixel_on():
            regionCreatorList += ['PixelPhysicsRegionTool']
        if DetFlags.SCT_on():
            regionCreatorList += ['SCTPhysicsRegionTool']
        if DetFlags.TRT_on() and not isUpgrade:
            regionCreatorList += ['TRTPhysicsRegionTool']
            if isRUN2:
                regionCreatorList += ['TRT_ArPhysicsRegionTool'
                                      ]  #'TRT_KrPhysicsRegionTool'
        # FIXME dislike the ordering here, but try to maintain the same ordering as in the old configuration.
        if DetFlags.bpipe_on():
            if simFlags.BeamPipeSimMode.statusOn and simFlags.BeamPipeSimMode(
            ) != "Normal":
                regionCreatorList += ['BeampipeFwdCutPhysicsRegionTool']
            if simFlags.ForwardDetectors.statusOn and simFlags.ForwardDetectors(
            ) == 2:
                regionCreatorList += ['FWDBeamLinePhysicsRegionTool']
    if DetFlags.Calo_on():
        if DetFlags.geometry.LAr_on():
            ## Shower parameterization overrides the calibration hit flag
            if simFlags.LArParameterization.statusOn and simFlags.LArParameterization() > 0 \
                    and simFlags.CalibrationRun.statusOn and simFlags.CalibrationRun.get_Value() in ['LAr','LAr+Tile','DeadLAr']:
                print(
                    'You requested both calibration hits and frozen showers / parameterization in the LAr.'
                )
                print(
                    '  Such a configuration is not allowed, and would give junk calibration hits where the showers are modified.'
                )
                print(
                    '  Please try again with a different value of either simFlags.LArParameterization ('
                    + str(simFlags.LArParameterization()) +
                    ') or simFlags.CalibrationRun (' +
                    str(simFlags.CalibrationRun.get_Value()) + ')')
                raise RuntimeError('Configuration not allowed')
            if simFlags.LArParameterization() > 0:
                regionCreatorList += [
                    'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool',
                    'HECPhysicsRegionTool', 'FCALPhysicsRegionTool'
                ]
                # FIXME 'EMBPhysicsRegionTool' used for parametrization also - do we need a second instance??
                regionCreatorList += [
                    'EMECParaPhysicsRegionTool', 'FCALParaPhysicsRegionTool',
                    'FCAL2ParaPhysicsRegionTool'
                ]
                if simFlags.LArParameterization.get_Value() > 1:
                    regionCreatorList += [
                        'PreSampLArPhysicsRegionTool',
                        'DeadMaterialPhysicsRegionTool'
                    ]
            elif simFlags.LArParameterization(
            ) is None or simFlags.LArParameterization() == 0:
                regionCreatorList += [
                    'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool',
                    'HECPhysicsRegionTool', 'FCALPhysicsRegionTool'
                ]
    ## FIXME _initPR never called for FwdRegion??
    #if simFlags.ForwardDetectors.statusOn:
    #    if DetFlags.geometry.FwdRegion_on():
    #        regionCreatorList += ['FwdRegionPhysicsRegionTool']
    if DetFlags.Muon_on():
        regionCreatorList += [
            'DriftWallPhysicsRegionTool', 'DriftWall1PhysicsRegionTool',
            'DriftWall2PhysicsRegionTool'
        ]
        if simFlags.CavernBG.statusOn and simFlags.CavernBG.get_Value(
        ) != 'Read' and not (simFlags.RecordFlux.statusOn
                             and simFlags.RecordFlux()):
            regionCreatorList += ['MuonSystemFastPhysicsRegionTool']
    return regionCreatorList
Esempio n. 8
0
    def __init__(self, name="L1MuctpiTool"):

        LVL1MUCTPI__L1MuctpiTool.__init__(self, name)

        # Create a logger:
        from AthenaCommon.Logging import logging
        logger = logging.getLogger("L1MuctpiTool")

        # Set properties of the LUT overlap handling:
        self.OverlapStrategyName = "LUT"
        self.DumpLUT = False
        self.LUTXMLFile = "UNDEFINED"
        self.RunPeriod = "UNDEFINED"
        self.FlaggingMode = False
        self.MultiplicityStrategyName = "INCLUSIVE"

        # Decide which LUT to use, based on which run we are simulating:
        from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
        from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
        if (commonGeoFlags.Run()
                == "RUN1") or ((commonGeoFlags.Run() == "UNDEFINED") and
                               (geoFlags.isIBL() is False)):
            self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml"
            self.RunPeriod = "RUN1"
            logger.info(
                "Configuring MuCTPI simulation with Run 1 configuration file:")
            logger.info(
                "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml"
            )
            logger.info("  with a RunPeriod=RUN1")
        elif (commonGeoFlags.Run()
              == "RUN2") or ((commonGeoFlags.Run() == "UNDEFINED") and
                             (geoFlags.isIBL() is True)):
            self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            self.RunPeriod = "RUN2"
            logger.info(
                "Configuring MuCTPI simulation with Run 2 configuration file:")
            logger.info(
                "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            )
            logger.info("  with a RunPeriod=RUN2")
        else:
            self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            self.RunPeriod = "RUN2"
            logger.warning(
                "Couldn't determine which run to simulate, using Run 2 configuration file:"
            )
            logger.warning(
                "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            )
            logger.warning("  with a RunPeriod=RUN2")

            pass

        # Set properties for NIM outputs ot L1Topo conversion from RoI to eta/phi
        self.GeometryXMLFile = "TrigConfMuctpi/TestMioctGeometry_2016_05_30_CS_2600573263.xml"

        # Turn on the NIM output creation by default:
        self.DoNIMOutput = True
        # The bit settings were extracted from here:
        #   https://savannah.cern.ch/bugs/?90300#comment14
        self.NIMBarrelBit = 29
        self.NIMEndcapBit = 30
Esempio n. 9
0
################################################################################

addTool("MuonRecExample.MuonPrdProviderToolsConfig.RpcPrepDataProviderTool",
        "RpcPrepDataProviderTool")
addTool("MuonRecExample.MuonPrdProviderToolsConfig.MdtPrepDataProviderTool",
        "MdtPrepDataProviderTool")
addTool("MuonRecExample.MuonPrdProviderToolsConfig.TgcPrepDataProviderTool",
        "TgcPrepDataProviderTool")
if MuonGeometryFlags.hasCSC():
    addTool(
        "MuonRecExample.MuonPrdProviderToolsConfig.CscPrepDataProviderTool",
        "CscPrepDataProviderTool")
    addAlgorithm(
        "MuonRecExample.MuonPrdProviderToolsConfig.CscRdoToCscPrepData",
        "CscRdoToCscPrepData")
if (CommonGeometryFlags.Run() in ["RUN3", "RUN4"]):
    addTool(
        "MuonRecExample.MuonPrdProviderToolsConfig.MM_PrepDataProviderTool",
        "MM_PrepDataProviderTool")
    addTool(
        "MuonRecExample.MuonPrdProviderToolsConfig.STGC_PrepDataProviderTool",
        "STGC_PrepDataProviderTool")

################################################################################
# Tools from MuonRecExample.MooreTools
################################################################################

addTool("MuonRecExample.MooreTools.MuonSegmentSelectionTool",
        "MuonSegmentSelectionTool")
addTool("MuonRecExample.MooreTools.MuonSegmentMatchingTool",
        'MuonSegmentMatchingTool')
Esempio n. 10
0
    topSequence += xAODMaker__EventInfoCnvAlg()

# Set up BeamSpot
if doBeamSpot:
    if not hasattr(condSeq, "BeamSpotCondAlg"):
        conddb.addFolderSplitOnline("INDET",
                                    "/Indet/Onl/Beampos",
                                    "/Indet/Beampos",
                                    className="AthenaAttributeList")
        from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg
        condSeq += BeamSpotCondAlg("BeamSpotCondAlg")

from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags

do_runI = commonGeoFlags.Run() not in ["RUN2", "RUN3"]
if do_runI:
    sys.exit("RUN1 is not supported. Bye.")

# Set up cabling
include("InDetRecExample/InDetRecCabling.py")

# Set up Pixel conditions
if doPixel:
    # Taken from InDetRecExample/share/InDetRecConditionsAccess.py
    #################
    # Module status #
    #################
    useNewDeadmapFormat = False
    useNewChargeFormat = False
Esempio n. 11
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]
Esempio n. 12
0
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# FLS: copied the original IP3DTag.py and rename every occurrence of IP3D -> IP3DTrighHybrid

# Configuration functions for IP3DTrigHybridTag
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags

from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
from IOVDbSvc.CondDB import conddb
btagrun1=False
if conddb.dbdata == 'COMP200':
    btagrun1=True
elif conddb.isMC:
    btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False))

metaIP3DTrigHybridTag = {'IsATagger': True,
                         'xAODBaseName': 'IP3DTrigHybrid',
                         'DependsOn': ['AtlasExtrapolator',
                                       'BTagTrackToVertexTool',
                                       'InDetVKalVxInJetTool',
                                       'BTagFullLinearizedTrackFactory',
                                       'BTagTrackToVertexIPEstimator',
                                       'IP3DTrigHybridNewLikelihoodTool',
                                       'IP3DTrigHybridTrackSelector',
                                       'TrigHybridInDetTrackSelector',
                                       'TrigHybridSpecialTrackAssociator',
                                       'SVForIPTool_IP3DTrigHybrid',
                                       'IP3DTrigHybridBasicTrackGradeFactory',
                                       'IP3DTrigHybridDetailedTrackGradeFactory'],
                         'PassByPointer': {'SVForIPTool': 'SVForIPTool_IP3DTrigHybrid',
Esempio n. 13
0
    if rn is None:
        try:
            from G4AtlasApps.SimFlags import simFlags
            if simFlags.RunNumber.statusOn:
                rn = simFlags.RunNumber()
        except:
            msg.info("No SimFlags available - looks like HLT job")
    if rn is None:
        try:
            from RecExConfig.AutoConfiguration import GetRunNumber
            rn = GetRunNumber()
        except:
            msg.info("No Run Number available - assume latest cabling")

    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as geoFlags
    if geoFlags.Run() == "RUN1":
        if rn > 219651:  # choose RUN2 cabling for old geometry tags starting from 26-MAR-2013
            TileCablingType = 4
            msg.warning("Forcing RUN2 cabling for run %s with geometry %s" %
                        (rn, gbltg))
    elif geoFlags.Run() == "RUN2":
        if rn == None or (
                globalflags.DataSource() != 'data' and rn >= 310000
        ) or rn >= 343000 or rn < 1:  # choose RUN2a cabling for R2 geometry tags starting from 31-Jan-2018
            TileCablingType = 5
            msg.info(
                "Forcing RUN2a (2018) cabling for run %s with geometry %s" %
                (rn, gbltg))
        else:
            TileCablingType = 4
            msg.info(
Esempio n. 14
0
def Initiate(ConfInstance=None):
  """Sets up the basic global tools required for B-Tagging. This function is idempotent; it will not run again if it has run once. It is
  typically called by other functions in this file to make sure the basic global tools exist.

  The function returns True if B-Tagging is initialized or has been before. It returns False if it B-Tagging has been switched off for various
  reasons (these are checked in the checkFlagsUsingBTaggingFlags function).

  If the B-tagging calibration broker has been registered we assume initiation has already been performed; this allows users to setup their own initiation code."""

  if ConfInstance is None:
    from BTagging.BTaggingConfiguration import getConfiguration
    ConfInstance = getConfiguration()

  if ConfInstance._Initialized:
    return True

  from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
  from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
  from IOVDbSvc.CondDB import conddb
  # Declare the COOL folder to the CondInputLoader
  btagrun1=False
  if conddb.dbdata == 'COMP200':
    btagrun1=True
  elif conddb.isMC:
    # The Run() parameter only exists for ATLAS-R1(...) and ATLAS-R2(...) geo tags,
    # not for ATLAS-GEO(...) and ATLAS-IBL(...) ones. Hence if Run() is undefined,
    # presence of IBL is used to switch between Run1/Run2
    btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False))
  if (btagrun1):
    print (ConfInstance.BTagTag()+' - INFO - Setting up Run 1 configuration')
    BTaggingFlags.JetFitterNN=True
    BTaggingFlags.SV2    =True
    BTaggingFlags.JetVertexCharge=False
    BTaggingFlags.SoftMu=False
    BTaggingFlags.MV2c10mu=False
    BTaggingFlags.MV2c10rnn=False
    BTaggingFlags.MV2cl100=False
    BTaggingFlags.RNNIP=False
    BTaggingFlags.DL1=False
    BTaggingFlags.DL1mu=False
    BTaggingFlags.DL1rnn=False
  else:
    print (ConfInstance.BTagTag()+' - INFO - Setting up Run 2 configuration')

  if ConfInstance._name == "Trig":
    BTaggingFlags.MV2c20=True

  print (ConfInstance.BTagTag()+' - INFO - Initializing default basic tools')

  if ConfInstance.checkFlagsUsingBTaggingFlags():

    #Print the flags
    BTaggingFlags.Print()

    #If debugging do a check of the tool collection structure
    if(BTaggingFlags.OutputLevel < 3):
      from BTagging.BTaggingConfiguration import checkToolCollectionStructure
      checkToolCollectionStructure()

    #Get TheTruthCollectionKey from input
    TheTruthCollectionKey = 'TruthEvents'
    BTaggingFlags.RetagJets = BTaggingFlags.Jets
    if BTaggingFlags.AutoInspectInputFile:
      from AthenaCommon.GlobalFlags import globalflags
      if globalflags.InputFormat == 'pool':
        try:
          from RecExConfig.InputFilePeeker import inputFileSummary
          BTaggingFlags.RetagJets = []
          for i in inputFileSummary['eventdata_items']:
            if i[0] == 'McEventCollection':
              # TheTruthCollectionKey = i[1] # disable taking the name from the input file?
              pass
            elif i[0] == 'JetCollection':
              jetC1 = (i[1]).replace('AODJets','')
              jetC = jetC1.replace('Jets','')
              if jetC in BTaggingFlags.Jets:
                BTaggingFlags.RetagJets += [ jetC ]
        except Exception:
          print (ConfInstance.BTagTag()+' - WARNING - Automatic inspection of input file failed (file too old?)')
          import traceback
          traceback.print_exc()

    print (ConfInstance.BTagTag()+' - Using ', TheTruthCollectionKey, ' as truth key')
#    print (ConfInstance.BTagTag()+' - Re-tagging these jet collections: ', BTaggingFlags.RetagJets)

    #
    # ============ Setup basic services
    #
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if not hasattr(svcMgr, 'THistSvc'):
      from GaudiSvc.GaudiSvcConf import THistSvc
      svcMgr += THistSvc()
    if not 'topSequence' in dir():
      from AthenaCommon.AlgSequence import AlgSequence
      topSequence = AlgSequence()


    #Create and add our condition algorithm to the Condition Sequencer

    SetupConditionAlgorithm(ConfInstance)

    #
    # ========== Add tools now
    #

    # -------------- Calibration Broker --------------
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.Resilience import treatException,protectedInclude
    if ConfInstance._name == "" or ConfInstance._name == "Trig":
      # No calibration broker setup - The condition algorithm is used
      pass
    elif ConfInstance._name == "AODFix":
      protectedInclude("BTagging/BTagCalibBroker_AODFix_jobOptions.py")
      BTagCalibrationBrokerTool = ConfInstance.getTool("BTagCalibrationBrokerTool")
    else:
      print (ConfInstance.BTagTag()+' - ERROR - Configuration instance "'+ConfInstance._name+'" has no calibration broker setup specified!')
      raise RuntimeError
    # -------------- \Calibration Broker --------------

    # -- for reference mode:
    if BTaggingFlags.Runmodus == 'reference':

      svcMgr.THistSvc.Output += ["RefFile DATAFILE='BTagCalibALL.root' OPT='RECREATE'"]

    ConfInstance._Initialized = True
    return True
  else:
    print (ConfInstance.BTagTag()+' - WARNING - Tool initialization requested but B-Tagging is not possible for the current dataset.')
    return False