예제 #1
0
    def setMCTBFitter(self):

        from AthenaCommon.AppMgr import ToolSvc

        # this assumes that MCTBFitter has already been set
        from MuonRecExample import MuonRecTools
        #ToolSvc.MCTBFitter.OutputLevel = align.OutputLevel()
        #ToolSvc.MCTBSLFitter.OutputLevel = align.OutputLevel()

        MCTBFitter = MuonRecTools.getPublicToolClone(
            "myMCTBFitter", "MCTBFitterMaterialFromTrack")
        MCTBFitter.FillDerivativeMatrix = True
        MCTBFitter.OutputLevel = align.OutputLevel()
        #MCTBFitter.OutputLevel = VERBOSE
        #MCTBFitter.GetMaterialFromTrack = True
        #MCTBFitter.PrintDerivatives = True
        ToolSvc += MCTBFitter
        self._fitter = ToolSvc.myMCTBFitter

        if align.useSLFitter():
            MCTBSLFitter = MuonRecTools.getPublicToolClone(
                "myMCTBSLFitter", "MCTBSLFitterMaterialFromTrack")
            MCTBSLFitter.FillDerivativeMatrix = True
            MCTBSLFitter.OutputLevel = align.OutputLevel()
            #MCTBSLFitter.OutputLevel = VERBOSE
            #MCTBSLFitter.GetMaterialFromTrack = True
            ##rdh MCTBSLFitter.Momentum = 0
            #MCTBSLFitter.PrintDerivatives = True
            ToolSvc += MCTBSLFitter
            self._slfitter = ToolSvc.myMCTBSLFitter
예제 #2
0
    def __init__(self, name=Configurable.DefaultName):
        super(MuGirlNS__CandidateToolConfig, self).__init__(name)

        global ToolSvc, ServiceMgr
        from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
        MuGirlCandidateRegSelSvc = RegSelSvcDefault()
        MuGirlCandidateRegSelSvc.enableMuon = True
        ServiceMgr += MuGirlCandidateRegSelSvc
        self.doCSC = True
        self.RegionSelector = MuGirlCandidateRegSelSvc
        from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__MdtMathSegmentFinder
        finder_candidate = Muon__MdtMathSegmentFinder(
            "MuGirlCandidateSegmentFinder")
        ToolSvc += finder_candidate

        #from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__DCMathSegmentMaker
        #maker_candidate = Muon__DCMathSegmentMaker("MuGirlCandidateSegmentMaker")
        #maker_candidate.MdtSegmentFinder = finder_candidate
        #       maker_candidate.CurvedErrorScaling=True
        #ToolSvc += maker_candidate
        #from MdtDriftCircleOnTrackCreator.MdtDriftCircleOnTrackCreatorConf import Muon__MdtDriftCircleOnTrackCreator
        #DriftCircleOnTrack = Muon__MdtDriftCircleOnTrackCreator("MuGirlCandidateDriftCircleOnTrack")
        #ToolSvc += DriftCircleOnTrack
        #self.MdtSegmentMaker = maker_candidate
        self.MdtSegmentMaker = MuonRecTools.getPublicTool("DCMathSegmentMaker")
        self.MdtDriftCircleOnTrackCreator = MuonRecTools.getPublicTool(
            "MdtDriftCircleOnTrackCreator")
        #self.MdtDriftCircleOnTrackCreator = DriftCircleOnTrack
        import MuonRecExample.MuonReadCalib  # setup the calibration service
        #from CscSegmentMakers.Csc2dSegmentMaker import Csc2dSegmentMaker
        #from CscSegmentMakers.Csc4dSegmentMaker import Csc4dSegmentMaker
        self.CscSegmentMaker = MuonRecTools.getPublicTool("Csc4dSegmentMaker")
        #from MuidCaloEnergyTools.MuidCaloEnergyToolsConf import Rec__MuidCaloEnergyTool
        #ToolSvc += Rec__MuidCaloEnergyTool(name = 'MuidCaloEnergyToolParam',EnergyLossMeasurement = False)
        #ToolSvc += Rec__MuidCaloEnergyTool(name = 'MuidCaloEnergyTool')
        from MuonRecExample import MuonPrdProviderToolsConfig
        from AthenaCommon.DetFlags import DetFlags

        if DetFlags.haveRDO.MDT_on():
            self.MdtRdoToPrepDataTool = ToolSvc.MdtPrepDataProviderTool
        else:
            self.MdtRdoToPrepDataTool = None
        if DetFlags.haveRDO.RPC_on():
            self.RpcRdoToPrepDataTool = ToolSvc.RpcPrepDataProviderTool
        else:
            self.RpcRdoToPrepDataTool = None
        if DetFlags.haveRDO.TGC_on():
            self.TgcRdoToPrepDataTool = ToolSvc.TgcPrepDataProviderTool
        else:
            self.TgcRdoToPrepDataTool = None
        if DetFlags.haveRDO.CSC_on():
            self.CscRdoToPrepDataTool = ToolSvc.CscPrepDataProviderTool
        else:
            self.CscRdoToPrepDataTool = None

        #from CscClusterization.CscThresholdClusterBuilderTool import CscThresholdClusterBuilderTool
        self.CscClusterProviderTool = MuonRecTools.getPublicTool(
            "CscThresholdClusterBuilderTool")
예제 #3
0
                        'MuonTrkErrorScaling_nominal')

from MuonErrorScalingTools.MuonErrorScalingToolsConf import Muon__MuonRIO_OnTrackErrorScalingTool, Muon__MuonErrorScaleDbTool

muonErrorScaleDbTool = Muon__MuonErrorScaleDbTool("MuonErrorScaleDbTool",
                                                  OutputLevel=outputLevel)
ToolSvc += muonErrorScaleDbTool
muonErrorScalingTool = Muon__MuonRIO_OnTrackErrorScalingTool(
    "MuonRIO_OnTrackErrorScalingTool",
    OutputLevel=outputLevel,
    ErrorScaleDbTool=muonErrorScaleDbTool)
ToolSvc += muonErrorScalingTool

from MuonRecExample import MuonRecTools

MdtDriftCircleOnTrackCreator = MuonRecTools.getPublicTool(
    "MdtDriftCircleOnTrackCreator")
MdtDriftCircleOnTrackCreator.DoErrorScaling = True
MdtDriftCircleOnTrackCreator.ScaleErrorsManually = False
MdtDriftCircleOnTrackCreator.OutputLevel = outputLevel
MdtDriftCircleOnTrackCreator.ErrorScalingTool = muonErrorScalingTool

CscClusterOnTrackCreator = MuonRecTools.getPublicTool(
    "CscClusterOnTrackCreator")
CscClusterOnTrackCreator.DoRpcErrorScaling = True
CscClusterOnTrackCreator.DoTgcErrorScaling = True
CscClusterOnTrackCreator.DoCscErrorScaling = True
CscClusterOnTrackCreator.OutputLevel = outputLevel
CscClusterOnTrackCreator.ErrorScalingTool = muonErrorScalingTool

MuonClusterOnTrackCreator = MuonRecTools.getPublicTool(
    "MuonClusterOnTrackCreator")
예제 #4
0
    ToolSvc += VP1DNAdjustor
    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__ForwardKalmanFitter as PublicFKF
    VP1FKF = PublicFKF(name='VP1FKF', StateChi2PerNDFPreCut=25.0)
    ToolSvc += VP1FKF

    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanSmoother as PublicBKS
    VP1BKS = PublicBKS(name='VP1BKS', InitialCovarianceSeedFactor=200.)
    ToolSvc += VP1BKS

    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanOutlierLogic as PublicKOL
    VP1KOL = PublicKOL(name='VP1KOL', StateChi2PerNDFCut=12.5)
    ToolSvc += VP1KOL

    #FIXME! Only do this for Muons?
    from MuonRecExample import MuonRecTools
    MdtTubeHitOnTrackCreator = MuonRecTools.getPublicTool(
        "MdtTubeHitOnTrackCreator")

    from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator
    VP1RotCreator = Trk__RIO_OnTrackCreator(
        name='VP1RotCreator',
        ToolMuonDriftCircle=MdtTubeHitOnTrackCreator,
        Mode='all')
    ToolSvc += VP1RotCreator
    print VP1RotCreator
    print MdtTubeHitOnTrackCreator

    from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanFitter as ConfiguredKalmanFitter
    VP1KalmanFitter = ConfiguredKalmanFitter(
        name='VP1KalmanFitter',
        ExtrapolatorHandle=VP1Extrapolator,
        RIO_OnTrackCreatorHandle=VP1RotCreator,
from RecExConfig.RecFlags import rec as recFlags
from MuonTrackPerformance.MuonTrackPerformanceConf import MuonMakeTrackNtuple, MuonMakeSegmentNtuple
from MuonRecExample import MuonRecTools
MuonRecTools.loadAll()

CBNT_AthenaAware += MuonMakeTrackNtuple(doTruth=recFlags.doTruth())
CBNT_AthenaAware += MuonMakeSegmentNtuple()
예제 #6
0
    def set_iPatFitter(self):
        from AthenaCommon.AppMgr import ToolSvc
        from MuonRecExample import MuonRecTools
        MuonExtrapolator = MuonRecTools.getPublicTool('MuonExtrapolator')

        from AthenaCommon.Include import include
        include('TrkDetDescrSvc/AtlasTrackingGeometrySvc.py')

        # set up the extrapolator and fitter as used by Muid
        from TrkExRungeKuttaIntersector.TrkExRungeKuttaIntersectorConf import \
            Trk__IntersectorWrapper as Propagator
        MuidPropagator = Propagator(name='MuidPropagator')
        ToolSvc += MuidPropagator

        from TrkExTools.TrkExToolsConf import Trk__MaterialEffectsUpdator
        MuidMaterialUpdator = Trk__MaterialEffectsUpdator(
            name="MuidMaterialEffectsUpdator")
        ToolSvc += MuidMaterialUpdator

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from TrkExTools.TrkExToolsConf import Trk__Navigator
        MuidNavigator = Trk__Navigator(
            name='MuidNavigator',
            TrackingGeometrySvc=svcMgr.AtlasTrackingGeometrySvc)
        ToolSvc += MuidNavigator

        from TrkExTools.TrkExToolsConf import Trk__Extrapolator
        MuidExtrapolator = Trk__Extrapolator(
            name='MuidExtrapolator',
            Propagators=[MuidPropagator],
            MaterialEffectsUpdators=[MuidMaterialUpdator],
            Navigator=MuidNavigator)
        ToolSvc += MuidExtrapolator

        # material allocation
        from TrkiPatFitter.TrkiPatFitterConf import Trk__MaterialAllocator
        MuidMaterialAllocator = Trk__MaterialAllocator(
            name='MuidMaterialAllocator',
            AggregateMaterial=True,
            Extrapolator=MuidExtrapolator,
            TrackingGeometrySvc=svcMgr.AtlasTrackingGeometrySvc)
        ToolSvc += MuidMaterialAllocator

        from TrkiPatFitter.TrkiPatFitterConf import Trk__iPatGlobalFitter
        Fitter = Trk__iPatGlobalFitter(
            name='iPatGlobalFitter',
            #from TrkiPatFitter.TrkiPatFitterConf import Trk__iPatFitter
            #Fitter = Trk__iPatFitter(
            #    name='iPatFitter',
            AggregateMaterial=True,
            AsymmetricCaloEnergy=False,
            FullCombinedFit=True,
            MaterialAllocator=MuidMaterialAllocator,
            OutputLevel=align.OutputLevel())
        #OutputLevel = VERBOSE)

        ToolSvc += Fitter
        self._fitter = ToolSvc.iPatGlobalFitter
        #self._fitter = ToolSvc.iPatFitter

        if align.useSLFitter():
            SLFitter = Trk__iPatGlobalFitter(
                name='iPatGlobalSLFitter',
                #SLFitter = Trk__iPatFitter(
                #    name                    = 'iPatSLFitter',
                AggregateMaterial=True,
                FullCombinedFit=True,
                LineFit=True,
                MaterialAllocator=MuidMaterialAllocator,
                OutputLevel=align.OutputLevel())
            ToolSvc += SLFitter
            self._slfitter = ToolSvc.iPatGlobalSLFitter
예제 #7
0
    def __init__(self, name=Configurable.DefaultName):
        super(MuGirlNS__StauToolConfig, self).__init__(name)

        from AthenaCommon.AppMgr import ToolSvc
        from MuGirlStau.MuGirlStauConf import MuGirlNS__StauBetaTofTool
        BetaTofTool_stau = MuGirlNS__StauBetaTofTool(name='StauBetaTofTool')
        ToolSvc += BetaTofTool_stau

        DriftCircleOnTrack_stau = MuonRecTools.getPublicToolClone(
            "StauMdtDriftCircleCreator",
            "MdtDriftCircleOnTrackCreator",
            DoFixedError=False,
            FixedError=0.,
            TimeWindowSetting=mdtCalibWindowNumber('Collision_t0fit'))
        #  TimeWindowLowerBound = 50., TimeWindowUpperBound = 100 )
        #  ScaleErrorsManually = True, FixedErrorScale = 2., FixedError = 0.1)
        ToolSvc += DriftCircleOnTrack_stau
        DriftCircleOnTrack_stau.TimingMode = 3
        DriftCircleOnTrack_stau.MuonTofTool = BetaTofTool_stau

        from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__MdtMathSegmentFinder
        finder_stau = Muon__MdtMathSegmentFinder("MuGirlStauSegmentFinder")
        finder_stau.DoDrop = True
        finder_stau.Chi2PerDofDropping = 20
        finder_stau.MDTAssocationPullcut = 5
        finder_stau.RecoverMdtOutliers = False
        finder_stau.RemoveSingleMdtOutliers = False
        ToolSvc += finder_stau
        from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__DCMathSegmentMaker
        maker_stau = Muon__DCMathSegmentMaker("MuGirlStauSegmentMaker")
        maker_stau.MdtSegmentFinder = finder_stau
        maker_stau.CurvedErrorScaling = True
        maker_stau.SinAngleCut = 0.05
        maker_stau.MdtCreator = DriftCircleOnTrack_stau
        ToolSvc += maker_stau

        #from MuidTrackBuilder.MuidTrackBuilderConf import Rec__CombinedMuonTrackBuilder
        #CombinedMuonTrackBuilder_stau = Rec__CombinedMuonTrackBuilder(name = 'MuGirlStauCombinedMuonTrackBuilder')
        #CombinedMuonTrackBuilder_stau.CleanCombined=False
        #ToolSvc += CombinedMuonTrackBuilder_stau

        #from MuGirlGlobalFit.MuGirlGlobalFitConf import MuGirlNS__GlobalFitTool
        #GlobalFitTool_stau = MuGirlNS__GlobalFitTool(name = 'MuGirlStauGlobalFitTool')
        #GlobalFitTool_stau.TrackFitter = CombinedMuonTrackBuilder_stau
        #ToolSvc += GlobalFitTool_stau

        #         from TrackToCalo.TrackToCaloConf import Rec__ParticleCaloCellAssociationTool
        #         caloCellAssociationTool = Rec__ParticleCaloCellAssociationTool("MuGirlStauCaloCellAssociationTool")
        #         ToolSvc += caloCellAssociationTool
        #         self.ParticleCaloCellAssociationTool = caloCellAssociationTool

        self.StauMdtDriftCircleCreator = DriftCircleOnTrack_stau
        self.StauMdtSegmentMaker = maker_stau
        self.StauBetaTofTool = BetaTofTool_stau
        #self.StauGlobalFitTool = GlobalFitTool_stau
        # print maker_stau

        if globalflags.DataSource() == 'data':
            self.isData = True
            self.rpcTimeShift = 88.
        else:
            self.isData = False

        from AthenaCommon.Utils.unixtools import find_datafile
        self.doCalibration = True

        self.mdtCalibFileName = "mdt_calibration.data"
        self.rpcCalibFileName = "rpc_calibration.data"
        self.caloCalibFileName = "calo_calibration.data"
예제 #8
0
                        'MuonTrkErrorScaling_nominal')

# configure muon hit creator tools to use error scaling
from MuonRecExample import MuonRecTools

from MuonErrorScalingTools.MuonErrorScalingToolsConf import Muon__MuonErrorScaleDbTool, Muon__MuonRIO_OnTrackErrorScalingTool
muonErrorScaleDbTool = Muon__MuonErrorScaleDbTool("MuonErrorScaleDbTool")
ToolSvc += muonErrorScaleDbTool

muonRIO_OnTrackErrorScalingTool = \
    Muon__MuonRIO_OnTrackErrorScalingTool("MuonRIO_OnTrackErrorScalingTool",
                                          ErrorScaleDbTool=muonErrorScaleDbTool)

ToolSvc += muonRIO_OnTrackErrorScalingTool

muonClusterOnTrackCreator = MuonRecTools.getPublicTool(
    "MuonClusterOnTrackCreator")
muonClusterOnTrackCreator.OutputLevel = 1

muonClusterOnTrackCreator.ErrorScalingTool = ToolSvc.MuonRIO_OnTrackErrorScalingTool
muonClusterOnTrackCreator.ErrorScalingTool.OutputLevel = 1

mdtDriftCircleOnTrackCreator = MuonRecTools.getPublicTool(
    "MdtDriftCircleOnTrackCreator")
mdtDriftCircleOnTrackCreator.DoFixedError = False
mdtDriftCircleOnTrackCreator.DoErrorScaling = True
mdtDriftCircleOnTrackCreator.OutputLevel = 1

mdtDriftCircleOnTrackCreator.ErrorScalingTool = ToolSvc.MuonRIO_OnTrackErrorScalingTool
mdtDriftCircleOnTrackCreator.ErrorScalingTool.OutputLevel = 1
MCTBSLFitter.FillDerivativeMatrix = False
MCTBSLFitter.SortHits = False
MCTBSLFitter.OutputLevel = INFO
MCTBSLFitter.GetMaterialFromTrack = True
MCTBSLFitter.Momentum = 0.
ToolSvc += MCTBSLFitter

# create instance of MuonTrackTagTestTool
from MuonTrackThroughCalo.ConfMuonTrackThroughCalo import ConfMuonTrackThroughCalo
MuonTTC = ConfMuonTrackThroughCalo("MuonTrackThroughCalo")

from AthenaCommon.AppMgr import ToolSvc
ToolSvc += MuonTTC

from MuonRecExample import MuonRecTools
atlasExtrapolator = MuonRecTools.getPublicTool('AtlasExtrapolator')
from MuonCombinedTestTools.MuonCombinedTestToolsConf import MuonCombined__MuonTrackTagTestTool
combinedMuonTag = MuonCombined__MuonTrackTagTestTool(
    name="CombinedMuonTag",
    ExtrapolatorTool=atlasExtrapolator,
    TTCTool=MuonTTC,
    Chi2Cut=2500.)
ToolSvc += combinedMuonTag

from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__UnbiasedMuonResiduals
topSequence += Muon__UnbiasedMuonResiduals(
    "UnbiasedMuonResiduals",
    WhichSegmCollections=[1, 1],
    SegmentCollectionName=["MooreSegments", "ConvertedMBoySegments"],
    #MuonTrackCollections = ["MuidMuonCollection","StacoMuonCollection"],
    MuonTrackCollections=["MooreTracks", "ConvertedMBoyTracks"],
예제 #10
0
TMEF_MuonHoughPatternToolCosmic = MuonHoughPatternTool(
    "TMEF_MuonHoughPatternToolCosmic",
    UseCosmics=True,
    NumberOfMaximaPerIterations=1)

ToolSvc += TMEF_MuonHoughPatternToolCosmic

from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__MdtMathSegmentFinder

TMEF_MdtMathSegmentFinderCosmic = Muon__MdtMathSegmentFinder(
    "TMEF_MdtMathSegmentFinderCosmic",
    AssociationRoadWidth=15,
    SortSegmentWithAllHits=True)
if doT0Fit:
    if muonRecFlags.doSegmentT0Fit():
        TMEF_MdtSegmentT0Fitter = MuonRecTools.getPublicTool(
            "MdtSegmentT0Fitter", "TMEF_MdtSegmentT0Fitter")
        TMEF_MdtMathSegmentFinderCosmic.DCFitProvider = TMEF_MdtSegmentT0Fitter

ToolSvc += TMEF_MdtMathSegmentFinderCosmic

from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__DCMathSegmentMaker

TMEF_DCMathSegmentMakerCosmic = Muon__DCMathSegmentMaker(
    "TMEF_DCMathSegmentMakerCosmic",
    SinAngleCut=0.9,
    AddUnassociatedPhiHits=True,
    #SortSegmentWithAllHits = True,
    CurvedErrorScaling=False,
    MdtCreator=TMEF_MdtDriftCircleOnTrackCreatorCosmic,
    MdtSegmentFinder=TMEF_MdtMathSegmentFinderCosmic)
예제 #11
0
    def configureAlignment(self, useAlternateAscii=False, isMC=True):

        print "in configureAlignment"

        self.setAlignmentDbTool(useAlternateAscii, isMC)

        # get AlignAlg without muon-specific tools
        from TrkAlignGenAlgs.AlignAlgGetter import AlignAlgGetter
        alignAlg = AlignAlgGetter().AlignAlgHandle()

        # add muon-specific tools using current MuonAlignment flags

        # MuonTrackCollectionProvider
        if mualign.trackCollectionProvider() == 'MuonTrackCollectionProvider':
            from MuonAlignGenTools.MuonTrackCollectionProviderGetter import MuonTrackCollectionProviderGetter
            alignAlg.TrackCollectionProvider = MuonTrackCollectionProviderGetter(
            ).MuonTrackCollectionProviderHandle()

            # create instance of MuonMatchQuality
            #from MuonTrackThroughCalo.ConfMuonTrackThroughCalo import ConfMuonTrackThroughCalo
            #MuonTTC = ConfMuonTrackThroughCalo("MuonTrackThroughCalo")

            from AthenaCommon.AppMgr import ToolSvc
            #ToolSvc += MuonTTC

            from MuonRecExample import MuonRecTools
            muonCombiTrackMaker = MuonRecTools.getPublicTool(
                'MooTrackSteering')
            #muonCombiTrackMaker.OutputLevel = DEBUG
            muonCombiTrackMaker.OutputLevel = align.OutputLevel()

            atlasExtrapolator = MuonRecTools.getPublicTool('AtlasExtrapolator')
            from MuonCombinedTestTools.MuonCombinedTestToolsConf import MuonCombined__MuonTrackTagTestTool
            combinedMuonTag = MuonCombined__MuonTrackTagTestTool(
                name="CombinedMuonTag",
                ExtrapolatorTool=atlasExtrapolator,
                #TTCTool          = MuonTTC,
                Chi2Cut=2500.)
            ToolSvc += combinedMuonTag

            alignAlg.TrackCollectionProvider.TagTool = combinedMuonTag

        # create tool instance
        elif mualign.trackCollectionProvider() == 'TrackCollectionProvider':
            from TrkAlignGenTools.TrackCollectionProviderGetter import TrackCollectionProviderGetter
            alignAlg.TrackCollectionProvider = TrackCollectionProviderGetter(
            ).TrackCollectionProviderGetterHandle()
        else:
            print "Using default TrackCollectionProvider!"

# MuonTrackPreProcessor
        from MuonAlignGenTools.MuonTrackPreProcessorGetter import MuonTrackPreProcessorGetter
        alignAlg.AlignTrackPreProcessor = MuonTrackPreProcessorGetter(
        ).MuonTrackPreProcessorHandle()

        # MuonGeometryManagerTool
        from MuonAlignGenTools.MuonGeometryManagerToolGetter import MuonGeometryManagerToolGetter
        alignAlg.GeometryManagerTool = MuonGeometryManagerToolGetter(
        ).MuonGeometryManagerToolHandle()

        # MuonFillNtupleTool
        from MuonAlignGenTools.MuonFillNtupleToolGetter import MuonFillNtupleToolGetter
        alignAlg.FillNtupleTool = MuonFillNtupleToolGetter(
        ).MuonFillNtupleToolHandle()

        # MdtAlignDBTool
        if mualign.alignMDT():
            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter
            alignAlg.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle(
            )
        elif mualign.alignCSC():
            from MuonAlignGenTools.CscAlignDBToolGetter import CscAlignDBToolGetter
            alignAlg.AlignDBTool = CscAlignDBToolGetter().CscAlignDBToolHandle(
            )
        else:
            print '************ At the moment set to MdtAlignDBTool  *************'
            print '*********** but please make sure what you are doing ***********'
            from MuonAlignGenTools.MdtAlignDBToolGetter import MdtAlignDBToolGetter
            alignAlg.AlignDBTool = MdtAlignDBToolGetter().MdtAlignDBToolHandle(
            )

# create MuonAlignModuleTool and configure tools
        from MuonAlignGenTools.MuonAlignModuleToolGetter import MuonAlignModuleToolGetter
        alignModTool = MuonAlignModuleToolGetter().MuonAlignModuleToolHandle()
        alignAlg.AlignTool.AlignModuleTool = alignModTool
        alignAlg.AlignTool.MatrixTool.AlignModuleTool = alignModTool
        alignAlg.AlignTrackCreator.AlignModuleTool = alignModTool
        alignAlg.AlignTrackDresser.DerivCalcTool.AlignModuleTool = alignModTool

        # set matrix tool output to DEBUG
        alignAlg.AlignTool.MatrixTool.OutputLevel = 2

        # configure GlobalChi2AlignTool's output tree
        globalChi2AlignTool = alignAlg.AlignTool

        # add RegionSelectionSvc
        self.addRegionSelectionSvc()