예제 #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 configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        from TrkAlignGenTools.AlignmentTrackFitter import AlignmentTrackFitter
        #from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonRefitTool
        from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonRefitTool
        muonRefitTool = Muon__MuonRefitTool(
            "MuonRefitToolForAlignment",
            OutputLevel=align.OutputLevel(),
            Fitter=AlignmentTrackFitter().fitter())

        from __main__ import ToolSvc
        ToolSvc += muonRefitTool

        # create tool instance
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignRefitTool
        muonAlignRefitTool = Muon__MuonAlignRefitTool(
            OutputLevel=align.OutputLevel())

        combmu = mualign.selectCombinedMuons()

        muonAlignRefitTool.MuonRefitTool = muonRefitTool

        muonAlignRefitTool.RemoveBIS8Hits = False
        muonAlignRefitTool.RemoveTGCHits = False
        muonAlignRefitTool.RemoveTGCEtaHits = True
        muonAlignRefitTool.RemoveRPCEtaHits = True
        muonAlignRefitTool.RemoveCSCPhiHits = True
        muonAlignRefitTool.DeclusterTGCHits = False
        muonAlignRefitTool.RemoveSmallBarrelHits = False

        muonAlignRefitTool.RemoveCSCHits = mualign.removeCSCHits()
        muonAlignRefitTool.RemoveBEEHits = not mualign.alignEE()
        muonAlignRefitTool.RemoveEEHits = not mualign.alignEE()

        muonAlignRefitTool.RemoveBarrelHits = not mualign.alignBarrel()
        muonAlignRefitTool.RemoveEndcapHits = not mualign.alignEndcap()
        muonAlignRefitTool.RemoveTRTHits = mualign.removeTRTHits()
        muonAlignRefitTool.RemoveScattering = not align.includeScatterers()

        muonAlignRefitTool.RecreateStartingParameters = not mualign.selectCombinedMuons(
        )
        muonAlignRefitTool.ExtrapolateToMuonEntry = not mualign.selectCombinedMuons(
        )

        self._MuonAlignRefitToolHandle = muonAlignRefitTool

        mlog.info(" now adding to ToolSvc")
        from __main__ import ToolSvc
        ToolSvc += self.MuonAlignRefitToolHandle()

        mlog.info(" leaving configure")

        return True
    def configure ( self ) :
        mlog = logging.getLogger( self._name+'::configure :' )

        # create tool instance
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonGeometryManagerTool, Muon__MdtGeometryManagerTool, Muon__CscGeometryManagerTool, Muon__TgcGeometryManagerTool

        # MDT
        mdtGeometryManagerTool =  Muon__MdtGeometryManagerTool(OutputLevel = align.OutputLevel(),
                                                               AlignLevel = align.alignmentLevel(),
                                                               AlignTraX=mualign.mdtAlignTraX(),
                                                               AlignTraY=mualign.mdtAlignTraY(),
                                                               AlignTraZ=mualign.mdtAlignTraZ(),
                                                               AlignRotX=mualign.mdtAlignRotX(),
                                                               AlignRotY=mualign.mdtAlignRotY(),
                                                               AlignRotZ=mualign.mdtAlignRotZ())
        self._MdtGeometryManagerToolHandle = mdtGeometryManagerTool

        # CSC
        cscGeometryManagerTool =  Muon__CscGeometryManagerTool(OutputLevel = align.OutputLevel(),
                                                               AlignLevel = align.alignmentLevel())
        self._CscGeometryManagerToolHandle = cscGeometryManagerTool

        # TGC
        tgcGeometryManagerTool =  Muon__TgcGeometryManagerTool(OutputLevel = align.OutputLevel(),
                                                               AlignLevel = align.alignmentLevel())
        self._TgcGeometryManagerToolHandle = tgcGeometryManagerTool
        
        mlog.info(" now adding geometryManagerTools to ToolSvc" )
        from __main__ import ToolSvc
        ToolSvc += self.MdtGeometryManagerToolHandle()
        ToolSvc += self.CscGeometryManagerToolHandle()
        ToolSvc += self.TgcGeometryManagerToolHandle()

        muonGeometryManagerTool = Muon__MuonGeometryManagerTool(OutputLevel = align.OutputLevel(),
                                                                AlignLevel = align.alignmentLevel(),
                                                                MdtGeometryManager = mdtGeometryManagerTool,
                                                                CscGeometryManager = cscGeometryManagerTool,
                                                                TgcGeometryManager = tgcGeometryManagerTool,
                                                                doModuleSelection = mualign.doModuleSelection(),
                                                                AlignMdt = mualign.alignMDT(),
                                                                AlignTgc = False, #mualign.alignTGC(),
                                                                AlignCsc = False, #mualign.alignCSC(),
                                                                ModuleSelection = mualign.modulesToAlign())
        self._MuonGeometryManagerToolHandle = muonGeometryManagerTool
        
        mlog.info(" now adding MuonGeometryManagerTool to ToolSvc" )
        ToolSvc += self.MuonGeometryManagerToolHandle()

        mlog.info(" leaving configure" )

        return True
예제 #4
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        from TrkAlignGenTools.AlignTrackCreatorGetter import AlignTrackCreatorGetter
        alignTrackCreator = AlignTrackCreatorGetter().AlignTrackCreatorHandle()

        from TrkAlignGenTools.AlignTrackDresserGetter import AlignTrackDresserGetter
        alignTrackDresser = AlignTrackDresserGetter().AlignTrackDresserHandle()

        from TrkAlignGenTools.AlignTrackDresserGetter import AlignTrackDresserGetter
        alignTrackDresser = AlignTrackDresserGetter().AlignTrackDresserHandle()

        from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignAlg
        alignAlg = Trk__AlignAlg("AlignAlg",
                                 OutputLevel=align.OutputLevel(),
                                 AlignTrackCreator=alignTrackCreator,
                                 AlignTrackDresser=alignTrackDresser,
                                 AlignTool=self.getAlignTool(),
                                 WriteNtuple=align.writeNtuple(),
                                 FileName=align.ntupleFileName(),
                                 FilePath=align.ntupleFilePath(),
                                 SolveOnly=align.solveOnly())

        self._alignAlgHandle = alignAlg

        # add to topSequence
        mlog.info(" now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += self.AlignAlgHandle()

        mlog.info(" leaving configure")

        return True
예제 #5
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from TrkAlignGenTools.AlignResidualCalculatorGetter import AlignResidualCalculatorGetter
        resCalc = AlignResidualCalculatorGetter(
        ).AlignResidualCalculatorHandle()

        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackCreator
        alignTrackCreator = Trk__AlignTrackCreator(
            "AlignTrackCreator",
            OutputLevel=align.OutputLevel(),
            ResidualCalculator=resCalc,
            IncludeScatterers=align.includeScatterers(),
            RemoveATSOSNotInAlignModule=align.removeATSOSNotInAlignModule(),
            RequireOverlap=align.requireOverlap())

        # options for good event list
        if align.writeEventList():
            from TrkAlignGenTools.AlignmentIOFiles import AlignmentIOFiles
            alignIO = AlignmentIOFiles()
            alignTrackCreator.EventList = "goodEvts.txt"
            alignTrackCreator.WriteEventList = True

        self._AlignTrackCreatorHandle = alignTrackCreator

        #mlog.info(" now adding to ToolSvc")
        #from __main__ import ToolSvc
        #ToolSvc += self.AlignTrackCreatorHandle()

        mlog.info(" leaving configure")

        return True
    def configure ( self ) :
        mlog = logging.getLogger( self._name+'::configure :' )

        muonIO = MuonAlignmentIOFiles()

        # create tool instance

        from __main__ import ToolSvc

        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__CscAlignDBTool
        muonAlignDBTool = Muon__CscAlignDBTool(OutputLevel = align.OutputLevel(),
                                               ABLineDbTool = ToolSvc.MGM_AlignmentDbTool,
                                               ASZTOutputFile = muonIO.asztOutputFile(),
                                               AlternateASZTFile = str(''),
                                               SigmaOutputFile = '',
                                               SigmaInputFile = '',
                                               UseMultiLevelDbTool = mualign.doMultiLevelAlignment()) 
        if mualign.useAlternateASZT() : 
            muonAlignDBTool.AlternateASZTFile = muonIO.asztInputFile()
        self._CscAlignDBToolHandle = muonAlignDBTool

        if mualign.doMultiLevelAlignment :
            MultiLevelAlignmentDbTool = ToolSvc.MultiLevelAlignmentDbTool
        else:
            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool("MultiLevelAlignmentDbTool")
            MultiLevelAlignmentDbTool.ABLineDbTool = ToolSvc.MGM_AlignmentDbTool

        mlog.info(" leaving configure" )

        return True
    def configure ( self ) :
        mlog = logging.getLogger( self._name+'::configure :' )

        # create tool instance
        from TrkAlignGenTools.AlignResidualCalculatorGetter import AlignResidualCalculatorGetter
        resCalc = AlignResidualCalculatorGetter().ResidualPullCalculatorHandle()
        
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonFillNtupleTool
        from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
        muonIO = MuonAlignmentIOFiles()
        muonFillNtupleTool = Muon__MuonFillNtupleTool(OutputLevel = align.OutputLevel(),
                                                      ResidualPullCalculator = resCalc,
                                                      MuonContainer = mualign.MuonContainerName())

        from MuonAlignGenTools.MuonAlignModuleToolGetter import MuonAlignModuleToolGetter
        muonAlignModuleTool = MuonAlignModuleToolGetter().MuonAlignModuleToolHandle()
        muonFillNtupleTool.AlignModuleTool = muonAlignModuleTool
        muonFillNtupleTool.BigNtuple = mualign.doBigNtuple()

        
        from MuTagTools.MuTagToolsConf import MuTagEDMHelper
        ConfiguredMuTagEDMHelper = MuTagEDMHelper("ConfiguredMuTagEDMHelper")
        from __main__ import ToolSvc
        ToolSvc += ConfiguredMuTagEDMHelper        
        muonFillNtupleTool.muTagEDMHelperTool = ConfiguredMuTagEDMHelper

        self._MuonFillNtupleToolHandle = muonFillNtupleTool

        mlog.info(" leaving configure" )

        return True
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        from MuonAlignGenTools.MuonAlignRefitToolGetter import MuonAlignRefitToolGetter
        muonAlignRefitTool = MuonAlignRefitToolGetter(
        ).MuonAlignRefitToolHandle()

        # create tool instance
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonTrackCollectionProvider
        muonTrackCollectionProvider = Muon__MuonTrackCollectionProvider(
            "MuonTrackCollectionProvider",
            OutputLevel=align.OutputLevel(),
            InputMuonCol=mualign.MuonContainerName(),
            InputTrackCol=align.inputTrkCol(),
            InputIDTrackCol=mualign.inputIDTrackCol(),
            UseStandaloneTracks=mualign.useStandaloneTracks(),
            TrackType=mualign.inputTrackCollectionType(),
            MomentumCut=mualign.momentumCut(),
            MuonAlignRefitTool=muonAlignRefitTool)

        self._muonTrackCollectionProviderHandle = muonTrackCollectionProvider

        mlog.info(" now adding to ToolSvc")
        from __main__ import ToolSvc
        ToolSvc += self.MuonTrackCollectionProviderHandle()

        mlog.info(" leaving configure")

        return True
예제 #9
0
    def setAlignmentDbTool(self, useAlternateAscii):

        from AtlasGeoModel.MuonGM import GeoModelSvc
        MuonDetectorTool = GeoModelSvc.DetectorTools["MuonDetectorTool"]
        MuonDetectorTool.OutputLevel = align.OutputLevel()
        altASZTFile = ""
        if mualign.doMultiLevelAlignment():
            MuonDetectorTool.UseAsciiConditionData = 1
            MuonDetectorTool.UseConditionDb = 1
        else:
            print "doMultiLevelAlignment=False"
        from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
        if useAlternateAscii:
            altASZTFile = self.muonIO.asztInputFile()
            MuonDetectorTool.AlternateASZTFile = altASZTFile
        print MuonDetectorTool

        from MuonCondTool.MuonCondToolConf import MuonAlignmentDbTool
        MuonAlignmentDbTool = MuonAlignmentDbTool("MGM_AlignmentDbTool")
        MuonAlignmentDbTool.ParlineFolders = [
            "/MUONALIGN/MDT/BARREL", "/MUONALIGN/MDT/ENDCAP/SIDEA",
            "/MUONALIGN/MDT/ENDCAP/SIDEC", "/MUONALIGN/TGC/SIDEA",
            "/MUONALIGN/TGC/SIDEC"
        ]
        MuonAlignmentDbTool.OutputLevel = align.OutputLevel()

        from __main__ import ToolSvc
        ToolSvc += MuonAlignmentDbTool

        if mualign.doMultiLevelAlignment():
            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool(
                "MultiLevelAlignmentDbTool")
            MultiLevelAlignmentDbTool.ABLineDbTool = ToolSvc.MGM_AlignmentDbTool
            MultiLevelAlignmentDbTool.L1AsciiFile = self.muonIO.inputLevel1File(
            )
            MultiLevelAlignmentDbTool.OutputLevel = align.OutputLevel()
            ToolSvc += MultiLevelAlignmentDbTool

            MuonDetectorTool.TheMuonAlignmentTool = MultiLevelAlignmentDbTool
        else:
            MuonDetectorTool.TheMuonAlignmentTool = MuonAlignmentDbTool
예제 #10
0
    def setCombMuonTrackFitter(self):
        mlog = logging.getLogger(
            'AlignmentTrackFitter::setCombMuonTrackFitter')
        from AthenaCommon.Include import include
        include('MuonCombinedRecExample/CombinedMuonFitTools.py')

        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc.MuonCombinedTrackFitter.FillDerivativeMatrix = True

        self._fitter = ToolSvc.MuonCombinedTrackFitter
        self._fitter.OutputLevel = align.OutputLevel()

        if align.useSLFitter():
            mlog.warning("SL Fitter set to default (curved) fitter!")
            self._slfitter = ToolSvc.MuonCombinedTrackFitter
예제 #11
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__TrackCollectionProvider
        trackCollectionProvider = Trk__TrackCollectionProvider(
            "TrackCollectionProvider",
            OutputLevel=align.OutputLevel(),
            InputTrkCol=align.inputTrkCol())

        self._trackCollectionProviderHandle = trackCollectionProvider

        mlog.info(" leaving configure")

        return True
예제 #12
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MdtGeometryManagerTool
        mdtGeometryManagerTool = Muon__MdtGeometryManagerTool(
            OutputLevel=align.OutputLevel(),
            MdtAlignParameters=mualign.mdtAlignParams())
        self._MdtGeometryManagerToolHandle = mdtGeometryManagerTool

        mlog.info(" now adding to ToolSvc")
        from __main__ import ToolSvc
        ToolSvc += self.MdtGeometryManagerToolHandle()

        mlog.info(" leaving configure")

        return True
예제 #13
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')
        outputLevel = AlignmentFlags.OutputLevel()

        # create tool instance
        from AthenaCommon.AppMgr import ToolSvc

        from MuonResidualPullCalculators.MuonResidualPullCalculatorsConf import Muon__TGC_ResidualPullCalculator
        tgc_respullcalc = Muon__TGC_ResidualPullCalculator(
            "TGC_ResidualPullCalculator")
        #OutputLevel=outputLevel)
        ToolSvc += tgc_respullcalc

        from InDetTrackValidation.InDetTrackValidationConf import InDet__SCT_ResidualPullCalculator
        sct_respullcalc = InDet__SCT_ResidualPullCalculator()
        ToolSvc += sct_respullcalc

        #from TrkValTools.TrkValToolsConf import Trk__ResidualPullCalculator
        from TrkResidualPullCalculator.TrkResidualPullCalculatorConf import \
            Trk__ResidualPullCalculator
        resPullCalc = Trk__ResidualPullCalculator(
            "ResidualPullCalculator",
            #OutputLevel=outputLevel,
            ResidualPullCalculatorForTGC=tgc_respullcalc,
            ResidualPullCalculatorForSCT=sct_respullcalc)
        ToolSvc += resPullCalc

        self._ResidualPullCalculatorHandle = ToolSvc.ResidualPullCalculator

        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignResidualCalculator
        resCalc = Trk__AlignResidualCalculator(
            "AlignResidualCalculator",
            OutputLevel=outputLevel,
            ResidualType=0,
            ResidualPullCalculator=resPullCalc,
            IncludeScatterers=AlignmentFlags.includeScatteringResiduals())

        self._AlignResidualCalculatorHandle = resCalc

        mlog.info(" now adding to ToolSvc")
        ToolSvc += self.AlignResidualCalculatorHandle()

        mlog.info(" leaving configure")

        return True
예제 #14
0
 def derivativeCalcTool(self):
     try:
         self._derivCalcTool
     except:
         derivativeType = AlignmentFlags.derivativeType()
         if derivativeType == 'Analytical':
             from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AnalyticalDerivCalcTool
             self._derivCalcTool = Trk__AnalyticalDerivCalcTool(
                 "AnalyticalDerivCalcTool",
                 OutputLevel=AlignmentFlags.OutputLevel())
         elif derivativeType == 'Numerical':
             from TrkAlignGenTools.ShiftingDerivCalcToolGetter import ShiftingDerivCalcToolGetter
             self._derivCalcTool = ShiftingDerivCalcToolGetter(
             ).ShiftingDerivCalcToolHandle()
         else:
             print "bad option!"
     print "have derivCalcTool"
     return self._derivCalcTool
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignModuleTool
        muonAlignModuleTool = Muon__MuonAlignModuleTool(
            OutputLevel=align.OutputLevel(),
            AlignModuleListType=mualign.alignModuleListType())

        self._MuonAlignModuleToolHandle = muonAlignModuleTool

        mlog.info(" now adding to ToolSvc")
        from __main__ import ToolSvc
        ToolSvc += self.MuonAlignModuleToolHandle()

        mlog.info(" leaving configure")

        return True
예제 #16
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__AlignSolve
        alignAlg = Trk__AlignSolve("AlignSolve",
                                   OutputLevel=align.OutputLevel(),
                                   AlignTool=self.getAlignTool())

        self._alignAlgHandle = alignAlg

        # add to topSequence
        mlog.info(" now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += self.AlignSolveHandle()

        mlog.info(" leaving configure")

        return True
예제 #17
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__AlignTrackDresser
        alignTrackDresser = Trk__AlignTrackDresser(
            "AlignTrackDresser",
            OutputLevel=AlignmentFlags.OutputLevel(),
            DerivCalcTool=self.derivativeCalcTool())

        self._AlignTrackDresserHandle = alignTrackDresser

        #mlog.info(" now adding to ToolSvc")
        #from __main__ import ToolSvc
        #ToolSvc += self.AlignTrackDresserHandle()

        mlog.info(" leaving configure")

        return True
예제 #18
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from TrkAlignGenTools.AlignResidualCalculatorGetter import AlignResidualCalculatorGetter
        resCalc = AlignResidualCalculatorGetter(
        ).AlignResidualCalculatorHandle()

        from TrkAlignGenTools.AlignmentTrackFitter import AlignmentTrackFitter
        from TrkAlignGenTools.TrkAlignGenToolsConf import Trk__ShiftingDerivCalcTool
        shiftingDerivCalcTool = Trk__ShiftingDerivCalcTool(
            "ShiftingDerivCalcTool",
            OutputLevel=AlignmentFlags.OutputLevel(),
            TrackFitterTool=AlignmentTrackFitter().fitter(),
            ResidualCalculator=resCalc,
            TranslationSize=mualign.shiftSizeTranslations(),
            RotationSize=mualign.shiftSizeRotations(),
            NumberOfShifts=mualign.numberOfShifts(),
            doChi2VChamberShiftsMeasType=mualign.doChi2VChamberShiftsMeasType(
            ))
        if AlignmentFlags.useSLFitter():
            shiftingDerivCalcTool.SLTrackFitterTool = AlignmentTrackFitter(
            ).slfitter()

        # configure other jobOptions
        shiftingDerivCalcTool.RunOutlierRemoval = AlignmentFlags.runOutlierRemoval(
        )
        shiftingDerivCalcTool.ParticleNumber = AlignmentFlags.particleNumber()
        shiftingDerivCalcTool.TrackAlignParamCut = AlignmentFlags.trackAlignParamCut(
        )
        shiftingDerivCalcTool.SetMinIterations = AlignmentFlags.setMinIterations(
        )

        self._ShiftingDerivCalcToolHandle = shiftingDerivCalcTool

        mlog.info(" now adding to ToolSvc")
        from __main__ import ToolSvc
        ToolSvc += self.ShiftingDerivCalcToolHandle()

        mlog.info(" leaving configure")

        return True
예제 #19
0
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        from TrkAlignGenAlgs.TrkAlignGenAlgsConf import Trk__SelectEventNumber
        selEvtNumber = Trk__SelectEventNumber("SelectEventNumber",
                                              OutputLevel=align.OutputLevel(),
                                              EventList=align.eventList())

        self._selectEventNumberHandle = selEvtNumber

        mlog.info("created selectEventNumber:")
        mlog.info(selEvtNumber)

        # add to sequencer
        mlog.info(" now adding to sequencer")
        from AthenaCommon.AppMgr import athFilterSeq
        sequencer = athFilterSeq
        sequencer += self.SelectEventNumberHandle()

        mlog.info(" leaving configure")

        return True
예제 #20
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()
예제 #21
0
    def setAlignmentDbTool(self, useAlternateAscii, isMC):

        from AtlasGeoModel.MuonGM import GeoModelSvc
        MuonDetectorTool = GeoModelSvc.DetectorTools["MuonDetectorTool"]
        MuonDetectorTool.OutputLevel = align.OutputLevel()
        #MuonDetectorTool.OutputLevel = INFO

        print "in setAlignmentDbTool, useAlternateAscii=", useAlternateAscii
        if isMC:

            #altASZTFile = ""
            if mualign.doMultiLevelAlignment():
                MuonDetectorTool.UseAsciiConditionData = 1
                MuonDetectorTool.UseConditionDb = 0
            from MuonAlignGenTools.MuonAlignmentIOFiles import MuonAlignmentIOFiles
            if useAlternateAscii:
                #altASZTFile = self.muonIO.asztInputFile()
                MuonDetectorTool.AlternateASZTFile = "asztInput.txt"
                MuonDetectorTool.UseAsciiConditionData = 1

        # get MuonAlignmentDbTool if already configured, create one if not
        from __main__ import ToolSvc
        try:
            muonAlignmentDbTool = ToolSvc.MGM_AlignmentDbTool
        except:
            from MuonCondTool.MuonCondToolConf import MuonAlignmentDbTool
            muonAlignmentDbTool = MuonAlignmentDbTool("MGM_AlignmentDbTool")
            ToolSvc += muonAlignmentDbTool
            MuonDetectorTool.TheMuonAlignmentTool = muonAlignmentDbTool

        muonAlignmentDbTool.OutputLevel = align.OutputLevel()
        #muonAlignmentDbTool.OutputLevel = DEBUG
        muonAlignmentDbTool.DumpALines = False
        if isMC and useAlternateAscii and align.alignmentLevel == 3:
            muonAlignmentDbTool.ALinesFile = "asztInput.txt"
        if not isMC:
            muonAlignmentDbTool.ParlineFolders = [
                "/MUONALIGN/MDT/BARREL", "/MUONALIGN/MDT/ENDCAP/SIDEA",
                "/MUONALIGN/MDT/ENDCAP/SIDEC", "/MUONALIGN/TGC/SIDEA",
                "/MUONALIGN/TGC/SIDEC"
            ]
        print "doMultiLevelAlignment: ", mualign.doMultiLevelAlignment()

        if mualign.doMultiLevelAlignment():
            from MuonCondTool.MuonCondToolConf import MultiLevelAlignmentDbTool
            MultiLevelAlignmentDbTool = MultiLevelAlignmentDbTool(
                "MultiLevelAlignmentDbTool")
            MultiLevelAlignmentDbTool.ABLineDbTool = muonAlignmentDbTool
            if align.alignmentLevel == 1:
                MultiLevelAlignmentDbTool.L1AsciiFile = "level1input.txt"
            elif align.alignmentLevel == 23:
                MultiLevelAlignmentDbTool.L23AsciiFile = "level23input.txt"
            elif align.alignmentLevel == 3:
                MultiLevelAlignmentDbTool.L3AsciiFile = "asztInput.txt"
            else:
                print "*** Alignment level: ", align.alignmentLevel,\
                      "not yet implemented in MultiLevelAlignmentDbTool ***"
            MultiLevelAlignmentDbTool.OutputLevel = align.OutputLevel()
            #MultiLevelAlignmentDbTool.OutputLevel = INFO

            #MultiLevelAlignmentDbTool.MuonIdHelperTool = ToolSvc.MuonIdHelperTool
            ToolSvc += MultiLevelAlignmentDbTool

            MuonDetectorTool.TheMuonAlignmentTool = MultiLevelAlignmentDbTool

        #from IOVDbSvc.CondDB import conddb
        #conddb.addOverride("/MUONALIGN/MDT/ENDCAP/SIDEA","MuonAlignMDTEndCapAAlign-2010-01-02")
        #conddb.addOverride("/MUONALIGN/MDT/ENDCAP/SIDEC","MuonAlignMDTEndCapCAlign-2010-01-02")

        print ToolSvc
    def configure(self):
        mlog = logging.getLogger(self._name + '::configure :')

        # create tool instance
        from TrkAlignGenTools.AlignmentTrackFitter import AlignmentTrackFitter
        from MuonAlignGenTools.MuonAlignGenToolsConf import Muon__MuonAlignHelperTool, Muon__MuonTrackPreProcessor

        from MuonAlignGenTools.MuonAlignRefitToolGetter import MuonAlignRefitToolGetter
        muonAlignRefitTool = MuonAlignRefitToolGetter(
        ).MuonAlignRefitToolHandle()

        muonAlignHelperTool = Muon__MuonAlignHelperTool(
            OutputLevel=align.OutputLevel())

        from __main__ import ToolSvc
        ToolSvc += muonAlignHelperTool

        muonTrackPreProcessor = Muon__MuonTrackPreProcessor(
            OutputLevel=align.OutputLevel(),
            TrackFitterTool=AlignmentTrackFitter().fitter(),
            MuonAlignRefitTool=muonAlignRefitTool)

        if align.useSLFitter():
            muonTrackPreProcessor.SLTrackFitterTool = AlignmentTrackFitter(
            ).slfitter()

        muonTrackPreProcessor.RefitTracks = align.refitTracks()
        muonTrackPreProcessor.ParticleNumber = align.particleNumber()
        muonTrackPreProcessor.RunOutlierRemoval = align.runOutlierRemoval()
        muonTrackPreProcessor.RedoErrorScaling = mualign.redoErrorScaling()
        muonTrackPreProcessor.pTCorrectTrack = mualign.pTCorrectTrack()
        muonTrackPreProcessor.RemovePerigeeBeforeRefit = mualign.removePerigeeBeforeRefit(
        )

        muonTrackPreProcessor.ResetScatteringAngles = mualign.resetScatteringAngles(
        )

        muonTrackPreProcessor.ApplyStandardSelectionCuts = mualign.applyStandardSelectionCuts(
        )
        muonTrackPreProcessor.ApplySelectionCuts = mualign.applySelectionCuts()
        muonTrackPreProcessor.RequireOneHitPerTubeLayerEC = mualign.requireOneHitPerTubeLayerEC(
        )
        muonTrackPreProcessor.RequireInnerLayerEndcapMdt = mualign.requireInnerLayerECTracks(
        )
        muonTrackPreProcessor.RequireOuterLayerEndcapMdt = mualign.requireOuterLayerECTracks(
        )
        muonTrackPreProcessor.RequireBarrelECOverlap = mualign.requireBarrelECOverlap(
        )
        muonTrackPreProcessor.CutOnBarrel = mualign.cutOnBarrelTracks()
        muonTrackPreProcessor.RequireRPCPhiHit = mualign.requireRPCPhiHit()
        muonTrackPreProcessor.RequireSmallLargeOverlap = mualign.requireSmallLargeOverlap(
        )

        muonTrackPreProcessor.MuonContainer = mualign.MuonContainerName()
        muonTrackPreProcessor.SelectCombinedMuons = mualign.selectCombinedMuons(
        )

        muonTrackPreProcessor.MSID_ptDiffCut = mualign.msidPtDiffCut()
        muonTrackPreProcessor.chiSqCut = mualign.cutOnTrackChisquare()
        muonTrackPreProcessor.nAllowedHoles = mualign.cutOnNumHolesOnTrack()
        muonTrackPreProcessor.nAllowedOutliers = mualign.cutOnNumOutlierOnTrack(
        )
        muonTrackPreProcessor.MaxDriftSignSum = mualign.cutOnMaxDriftSignSum()

        self._MuonTrackPreProcessorHandle = muonTrackPreProcessor

        mlog.info(" adding MuonTrackPreProcessor to ToolSvc")
        ToolSvc += muonAlignHelperTool

        mlog.info(" leaving configure")

        return True
예제 #23
0
    errScaleDbNameSplit = errScaleDbName.rsplit("/", 1)
    if len(errScaleDbNameSplit) > 1:
        errScaleDbName = errScaleDbNameSplit[1]
    from IOVDbSvc.CondDB import conddb
    IOVDbSvc.dbConnection = "sqlite://X;schema=mycool.db;dbname=OFLP200"
    conddb.addFolder(
        "",
        "<dbConnection>sqlite://X;schema=mycool.db;dbname=OFLP200</dbConnection> /MUON/TrkErrorScaling"
        + "<tag>MuonTrkErrorScaling_nominal</tag>",
        force=True)
    conddb.addFolderWithTag(errScaleDbName, '/MUON/TrkErrorScaling',
                            'MuonTrkErrorScaling_nominal')

    from MuonErrorScalingTools.MuonErrorScalingToolsConf import Muon__MuonRIO_OnTrackErrorScalingTool, Muon__MuonErrorScaleDbTool
    muonErrorScaleDbTool = Muon__MuonErrorScaleDbTool(
        "MuonErrorScaleDbTool", OutputLevel=align.OutputLevel())
    ToolSvc += muonErrorScaleDbTool
    muonErrorScalingTool = Muon__MuonRIO_OnTrackErrorScalingTool(
        "MuonRIO_OnTrackErrorScalingTool",
        OutputLevel=align.OutputLevel(),
        ErrorScaleDbTool=muonErrorScaleDbTool)
    ToolSvc += muonErrorScalingTool

    from MuonRecExample import MuonRecTools
    MdtDriftCircleOnTrackCreator = MuonRecTools.getPublicTool(
        "MdtDriftCircleOnTrackCreator")
    MdtDriftCircleOnTrackCreator.DoErrorScaling = True
    MdtDriftCircleOnTrackCreator.OutputLevel = align.OutputLevel()
    MdtDriftCircleOnTrackCreator.ErrorScalingTool = muonErrorScalingTool

    from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
예제 #24
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