trackselectortool = TrackSelector(
    "AlignTrackSelectorTool",
    MaxChi2Cut="20",
    MinNDoF=2,
    MinNVeloPhiHits=5,
    MinNVeloRHits=5,
    #TrackTypes = [ "Long","Velo","Upstream" ]
    TrackTypes=["Velo", "Long"])

trackselectoralg = TrackContainerCopy(
    "AlignTrackSelector",
    inputLocation="Rec/Track/Best",
    outputLocation="Alignment/AlignmentTracks")
trackselectoralg.addTool(GetElementsToBeAligned(
    OutputLevel=TAlignment().getProp("OutputLevel"), Elements=elements),
                         name="GetElementsToBeAligned")

trackselectoralg.addTool(trackselectortool, "Selector")

trkselector = TrackSelector("VertexTrackSelector", TrackTypes=["Long"])
vertexresidualtool = Al__VertexResidualTool("Al::VertexResidualTool")
#vertexresidualtool.addTool(TrackSelector("TrackSelector",TrackTypes = [ "Long" ] ) )
vertexresidualtool.addTool(trkselector, name="MyTrackSelector")
vertexresidualtool.MyTrackSelector.TrackTypes = ["Long"]
#vertexresidualtool.MyTrackSelectorHandle = trkselector
#vertexresidualtool.UseCorrelations = computeVertexCorrelations

TAlignment().filterSeq().Members.append(trackselectoralg)

## run some monitoring code
else:
    #CondDB().addLayer( MUONAlignmentCondition )
    CondDB().addLayer(OTAlignmentCondition)

# ================================================================================================
# add all 'private' reconstruction to this sequence which is automatically added to the alignment sequence.
# ================================================================================================
from Configurables import GaudiSequencer
trackFilterSeq = GaudiSequencer("TrackFilterSeq")

# ----------------------------------------------------------------------------------
# make a selection of the Best-tracks based on the chisquare
# ----------------------------------------------------------------------------------
from Configurables import (TrackSelector, TrackContainerCopy)
seedselectoralg = TrackContainerCopy("SeedSelection")
seedselectoralg.addTool(TrackSelector("SeedSelector"), name="Selector")
seedselectoralg.inputLocation = 'Rec/Track/Best'
seedselectoralg.outputLocation = 'Rec/Track/SelectedBest'
seedselectoralg.Selector.MaxChi2Cut = 5
#seedselectoralg.Selector.MinNOTHits = 12
trackFilterSeq.Members.append(seedselectoralg)

## # ----------------------------------------------------------------------------------
## from Configurables import TrackListRefiner
## # ----------------------------------------------------------------------------------

## longTrackSelector = TrackListRefiner("LongTrackSelector",
##                                      inputLocation = "Rec/Track/SelectedBest",
##                                      outputLocation = "Rec/Track/SeectedLong",
##                                      Selector = TrackSelector())
## longTrackSelector.Selector.TrackTypes = ["Long","Downstream"]
示例#3
0
    def algorithm(self):
        from Configurables import TrackSys
        TrackSys().GlobalCuts = {
            'Velo': 4000,
            'OT': 8000
        }  #### to remove busy events
        Name = self._name
        inputTrackLocation = self._inputLocation
        from Configurables import GaudiSequencer, HltTrackConverter, TrackContainerCopy, Escher
        from TAlignment.Utils import configuredFitAndHitAdderSequence
        seq = GaudiSequencer(self.name() + "Seq")
        ## Here starts Stefania's code ========================
        from Configurables import MuonNNetRec, MuonPadRec, MuonClusterRec

        muonTrackTool = MuonNNetRec(
            name="MuonNNetRec",
            AssumeCosmics=False,
            PhysicsTiming=False,
            AssumePhysics=
            True,  ## assume that tracks come from IP (only forward)
            AddXTalk=True,
            XtalkRadius=1.5,
            SkipStation=0,
            #DecodingTool = "MuonMonHitDecode", # default is "MuonHitDecode"
            ClusterTool="MuonClusterRec"  # default is "MuonFakeClustering"
            #OutputLevel   = 2
        )

        clusterTool = MuonClusterRec(name="MuonClusterRec",
                                     OutputLevel=5,
                                     MaxPadsPerStation=500)  #default 1500
        padRecTool = MuonPadRec(name="PadRecTool", OutputLevel=5)

        from Configurables import MakeMuonTracks
        copy = MakeMuonTracks(name='MakeMuonTracks',
                              OutputLevel=5,
                              SkipBigClusters=True)
        copy.addTool(muonTrackTool, name='MuonRecTool')
        # ------------------------------------------------------------------
        seq.Members += [copy]  # Copy MuonTracks to LHCb tracks
        # ------------------------------------------------------------------
        from TrackFitter.ConfiguredFitters import ConfiguredForwardStraightLineEventFitter  #, ConfiguredStraightLineFitter
        from Configurables import MeasurementProvider, TrackKalmanFilter

        muonTrackFit = ConfiguredForwardStraightLineEventFitter(
            "MuonTrackFit", TracksInContainer="Rec/Track/Muon")
        #muonTrackFit =  ConfiguredStraightLineFitter( 'MuonTrackFit' , TracksInContainer = 'Rec/Track/Muon' )

        muonTrackFit.Fitter.OutputLevel = 5
        muonTrackFit.Fitter.addTool(TrackKalmanFilter, 'NodeFitter')
        muonTrackFit.Fitter.addTool(MeasurementProvider, name='MeasProvider')

        muonTrackFit.Fitter.MeasProvider.MuonProvider.clusterize = True  #default False
        muonTrackFit.Fitter.MeasProvider.MuonProvider.OutputLevel = 5
        muonTrackFit.Fitter.ErrorX = 1000
        muonTrackFit.Fitter.ErrorY = 10000
        muonTrackFit.Fitter.MaxNumberOutliers = 0
        # ------------------------------------------------------------------
        seq.Members += [muonTrackFit]
        # ------------------------------------------------------------------
        from Configurables import TAlignment, GetElementsToBeAligned
        from Configurables import TrackFilterAlg
        trackFilterAlg = TrackFilterAlg(
            name="FilterTracks",
            OutputLevel=5,
            TracksInputContainer="Rec/Track/Muon",  # MuonTrackRec
            TracksOutputContainer="Rec/Track/SelectedMuon",  # Filtered tracks
            MuonFilter=True,  ###------------------------------ MUONTRACKSELECTOR
            MuonPcut=6000.,  ## 6 GeV
            MuonChisquareCut=5,
            inCaloAcceptance=True,
            noOverlap=False,
            #TheRegion       = 10
            minHitStation=3)  # >3

        ####???????
        trackFilterAlg.addTool(GetElementsToBeAligned(
            OutputLevel=5, Elements=TAlignment().ElementsToAlign),
                               name="GetElementsToBeAligned")
        # ------------------------------------------------------------------
        seq.Members += [trackFilterAlg]
        # ------------------------------------------------------------------
        from Configurables import TrackMuonMatching, TrackMasterExtrapolator, TrackChi2Calculator
        #, TrajOTCosmicsProjector, TrajOTProjector, TrackProjectorSelector
        matching = TrackMuonMatching(
            name="TrackMuonMatching",
            AllCombinations=False,  # default true
            MatchAtFirstMuonHit=True,  # default false
            FullDetail=True,  #????
            OutputLevel=5,
            TTracksLocation=inputTrackLocation,  # Best container + chisquare < 5
            MuonTracksLocation='Rec/Track/SelectedMuon',  # MuonNNet
            TracksOutputLocation='Rec/Track/Best/TMuon',
            MatchChi2Cut=20.0,
            WriteNtuple=False)
        matching.addTool(TrackMasterExtrapolator, name='Extrapolator')
        matching.Extrapolator.ApplyMultScattCorr = True
        matching.Extrapolator.ApplyEnergyLossCorr = False
        matching.Extrapolator.ApplyElectronEnergyLossCorr = False
        matching.addTool(TrackChi2Calculator, name='Chi2Calculator')
        # ------------------------------------------------------------------
        seq.Members += [matching]  # Track-Muon  Matching
        # ------------------------------------------------------------------

        from TrackFitter.ConfiguredFitters import ConfiguredEventFitter
        #tmuonfit = ConfiguredFastEventFitter( 'TMuonFit', TracksInContainer = 'Rec/Track/Best/TMuon') # contains Best+Muon
        tmuonfit = ConfiguredEventFitter(
            "TMuonFit",
            TracksInContainer='Rec/Track/Best/TMuon')  # contains Best+Muon

        tmuonfit.Fitter.MakeNodes = True
        tmuonfit.Fitter.MakeMeasurements = True
        tmuonfit.Fitter.addTool(TrackKalmanFilter, 'NodeFitter')
        tmuonfit.Fitter.ErrorX = 1000
        tmuonfit.Fitter.ErrorY = 10000
        tmuonfit.Fitter.NumberFitIterations = 5
        tmuonfit.Fitter.MaxDeltaChiSqConverged = 0.1
        tmuonfit.Fitter.MaxNumberOutliers = 0
        tmuonfit.Fitter.addTool(MeasurementProvider(), name='MeasProvider')
        tmuonfit.Fitter.MeasProvider.MuonProvider.clusterize = True
        #tmuonfit.Fitter.MeasProvider.MuonProvider.OutputLevel   = 2
        tmuonfit.Fitter.MeasProvider.IgnoreMuon = False
        # ------------------------------------------------------------------
        seq.Members += [tmuonfit]  # Fit TMuon tracks
        # ------------------------------------------------------------------
        from Configurables import TrackSelector, TrackContainerCopy
        tmuonselectoralg = TrackContainerCopy(
            name="TmuonSelection",
            inputLocations=['Rec/Track/Best/TMuon'],
            outputLocation=self.location())
        tmuonselectoralg.addTool(TrackSelector, name="Selector")
        tmuonselectoralg.Selector.MaxChi2Cut = 10
        #tmuonselectoralg.Selector.OutputLevel = 2
        # ------------------------------------------------------------------
        seq.Members += [tmuonselectoralg]  # selects good TMuon tracks
        # ------------------------------------------------------------------

        return seq
    tmuonfit.Fitter.addTool(MeasurementProvider(), name='MeasProvider')
    tmuonfit.Fitter.MeasProvider.MuonProvider.clusterize = True
    tmuonfit.Fitter.MeasProvider.MuonProvider.OutputLevel = outputlevel
    tmuonfit.Fitter.MeasProvider.IgnoreMuon = False

    if OTMuonMatching:
        trackFilterSeq.Members.append(matching)
        trackFilterSeq.Members.append(tmuonfit)
    # ------------------------------------------------------------------
from Configurables import TrackMonitor
trackFilterSeq.Members.append(
    TrackMonitor("MyTMuonMonitor", TracksInContainer='Rec/Track/Best/TMuon'))

from Configurables import (TrackSelector, TrackContainerCopy)
tmuonselectoralg = TrackContainerCopy("TmuonSelection")
tmuonselectoralg.addTool(TrackSelector, name="Selector")
tmuonselectoralg.Selector.MaxChi2Cut = 10
tmuonselectoralg.Selector.OutputLevel = outputlevel
tmuonselectoralg.inputLocation = 'Rec/Track/Best/TMuon'
tmuonselectoralg.outputLocation = 'Rec/Track/AlignTracks'

trackFilterSeq.Members.append(tmuonselectoralg)
##==============================================================

#-- Use latest database tags for real data

from Configurables import LHCbApp
#LHCbApp().Monitors = ["MemoryAuditor"]
Escher().DataType = "2010"
LHCbApp().DDDBtag = "default"
LHCbApp().CondDBtag = "default"
示例#5
0
TAlignment().TrackLocation = "Rec/Track/AlignTracks"
TAlignment().Constraints = constraints
TAlignment().WriteCondSubDetList = ['OT']

from Configurables import (PatSeeding, PatSeedingTool)
PatSeeding = PatSeeding("PatSeeding")
PatSeeding.addTool(PatSeedingTool("PatSeedingTool"))
PatSeeding.PatSeedingTool.MaxOTOccupancy = 0.02
PatSeeding.PatSeedingTool.MaxITOccupancy = 0.02
#PatSeeding.PatSeedingTool.CommonXFraction        = 0.
#PatSeeding.PatSeedingTool.MaxUsedFractPerRegion  = 0.
#PatSeeding.PatSeedingTool.MaxUsedFractITOT       = 0.
#PatSeeding.PatSeedingTool.MaxUsedFractLowQual    = 0.

# set up a track selection
from Configurables import (GaudiSequencer, TrackContainerCopy, TrackSelector,
                           TrackMonitor)
trackFilterSeq = GaudiSequencer("TrackFilterSeq")
alignSelector = TrackContainerCopy("AlignSelector",
                                   inputLocation="Rec/Track/Best",
                                   outputLocation="Rec/Track/AlignTracks")
alignSelector.addTool(TrackSelector("Selector", MaxChi2Cut=5))
trackFilterSeq.Members.append(alignSelector)
trackFilterSeq.Members.append(
    TrackMonitor("AlignTrackMonitor",
                 TracksInContainer="Rec/Track/AlignTracks"))

##############################################################################
# I/O datasets are defined in a separate file, see examples in 2008-TED_Data.py
##############################################################################
示例#6
0
def STPerformanceStudy(Name_Prefix="STPerf_",
                       Efficiency=True,
                       Residuals=True,
                       ActivateFullClusters=True,
                       TrackContainter=False):
    #Define tracks for ST Performance
    if not TrackContainter:
        from Configurables import TrackSelector, TrackContainerCopy
        goodtracksselector = TrackContainerCopy(
            name=Name_Prefix + "Selection",
            inputLocation='/Event/Rec/Track/Best',
            outputLocation='/Event/Rec/Track/PerformanceTracks')
        goodtracksselector.addTool(TrackSelector, name="Selector")
        goodtracksselector.Selector.MinPCut = 10000.
        goodtracksselector.Selector.MaxChi2Cut = 2.
        goodtracksselector.Selector.MaxChi2PerDoFMatch = 2.
        goodtracksselector.Selector.MaxChi2PerDoFDownstream = 2.
        goodtracksselector.Selector.MaxChi2PerDoFVelo = 2.
        goodtracksselector.Selector.TrackTypes = ["Long"]
        TrackLocation = '/Event/Rec/Track/PerformanceTracks'
    else:
        TrackLocation = TrackContainter

    #Define clusters used for ST Efficiency studies
    from Configurables import STClusterCollector
    # Search window (residual) for STEfficiency and STClusterCollector
    window = 0.4
    # Tolerance for X an Y in the first estimate of the track crossing the silicion position
    # and central position of the cluster
    xTol = 1.
    yTol = 0.

    # Collecting the ST clusters
    itClusterCollector = STClusterCollector("ToolSvc.ITClusterCollector")
    itClusterCollector.DetType = "IT"
    itClusterCollector.ignoreHitsOnTrack = False
    itClusterCollector.xTol = xTol
    itClusterCollector.yTol = yTol
    itClusterCollector.window = window
    itClusterCollector.MagFieldOn = True
    itClusterCollector.dataLocation = "/Event/Raw/IT/Clusters"

    ttClusterCollector = STClusterCollector("ToolSvc.TTClusterCollector")
    ttClusterCollector.DetType = "TT"
    ttClusterCollector.ignoreHitsOnTrack = False
    ttClusterCollector.xTol = xTol
    ttClusterCollector.yTol = yTol
    ttClusterCollector.window = window
    ttClusterCollector.MagFieldOn = True
    ttClusterCollector.dataLocation = "/Event/Raw/TT/Clusters"

    #Configuring ST Efficiency algorithms
    from Configurables import STEfficiency
    ttEff = STEfficiency(Name_Prefix + "TTHitEfficiency")
    ttEff.TracksInContainer = TrackLocation
    ttEff.DetType = "TT"
    ttEff.Cuts = [window]
    ttEff.XLayerCut = window  #0.4
    ttEff.StereoLayerCut = window  #0.4
    ttEff.MinExpectedSectors = 2  #2
    ttEff.MaxNbResSectors = 10  #10
    ttEff.MinStationPassed = 1  #1
    # Edge size excluded of the computation
    ttEff.MinDistToEdgeX = 2  #2
    ttEff.MinDistToEdgeY = 2  #2
    ttEff.ResidualsPlot = False
    ttEff.FullDetail = False
    ttEff.TH1DSummaryHist = True
    ttEff.EfficiencyPlot = False
    ttEff.SingleHitPerSector = True  #True
    ttEff.TakeEveryHit = True  #True
    ttEff.OutputLevel = 3

    itEff = STEfficiency(Name_Prefix + "ITHitEfficiency")
    itEff.TracksInContainer = TrackLocation
    itEff.DetType = "IT"
    itEff.Cuts = [window]
    itEff.XLayerCut = window  #0.4
    itEff.StereoLayerCut = window  #0.4
    itEff.MinExpectedSectors = 6  #6
    itEff.MaxNbResSectors = 10
    itEff.MinStationPassed = 3  #3
    # Edge size excluded of the computation
    itEff.MinDistToEdgeX = 2  #2
    itEff.MinDistToEdgeY = 2  #2
    itEff.ResidualsPlot = False
    itEff.FullDetail = False
    itEff.TH1DSummaryHist = True
    ttEff.EfficiencyPlot = False
    itEff.SingleHitPerSector = True
    itEff.TakeEveryHit = True
    itEff.OutputLevel = 3

    #Configuring Track Monitors to work in performance mode
    from Configurables import ITTrackMonitor, TTTrackMonitor
    itMon = ITTrackMonitor(Name_Prefix + 'ITTrackMonitor')
    itMon.TracksInContainer = TrackLocation
    itMon.FullDetail = False
    itMon.plotsByLayer = False
    itMon.plotsBySector = False
    itMon.ProfileSummaryHist = False
    itMon.TH2DSummaryHist = True
    itMon.minNumITHits = 6

    ttMon = TTTrackMonitor(Name_Prefix + 'TTTrackMonitor')
    ttMon.TracksInContainer = TrackLocation
    ttMon.FullDetail = False
    ttMon.plotsBySector = False
    ttMon.ProfileSummaryHist = False
    ttMon.TH2DSummaryHist = True
    ttMon.minNumTTHits = 2

    #These lines activates Full clusters. For .raw data only!
    #Access to the full clusters
    if ActivateFullClusters:
        from Configurables import TrackSys
        TrackSys().ExpertTracking = ["fullClustersHLT1", "fullClustersHLT2"]

    # Post configuration actions
    def PostConfigurationActions():
        from Configurables import GaudiSequencer
        if not TrackContainter:
            GaudiSequencer('MoniTrSeq').Members += [goodtracksselector]
        if Efficiency:
            GaudiSequencer('MoniTrSeq').Members += [itEff, ttEff]
        if Residuals:
            GaudiSequencer('MoniTrSeq').Members += [ttMon, itMon]

    from GaudiKernel.Configurable import appendPostConfigAction
    appendPostConfigAction(PostConfigurationActions)

    return True
示例#7
0
# trackFitAlg                           = TrackEventFitter("FitTracks",
#                                                          OutputLevel        = INFO,
#                                                          TracksInContainer  = "Alignment/FilterTracks1",
#                                                          TracksOutContainer = "Alignment/FittedTracks")
# trackFitAlg.addTool(TrackMasterFitter("Fitter"))
# trackMasterFitter = allConfigurables["FitTracks.Fitter"]
# trackMasterFitter.addTool(TrackMasterExtrapolator("Extrapolator"))
# trackMasterExtrapolator = allConfigurables["FitTracks.Fitter.Extrapolator"]
# trackMasterFitter.addTool(TrackKalmanFilter("NodeFitter"))
# trackMasterNodeFitter = allConfigurables["FitTracks.Fitter.NodeFitter"]
# trackMasterNodeFitter.addTool(TrackMasterExtrapolator("Extrapolator"))
# trackMasterNodeFitterExtrapolator = allConfigurables["FitTracks.Fitter.NodeFitter.Extrapolator"]
# importOptions("$TALIGNMENTROOT/options/BFieldOff.opts")

#AlConfigurable().filterSeq().Members.append( trackFitAlg )

from Configurables import (TrackContainerCopy, TrackSelector)

trackContCopy = TrackContainerCopy(
    "FilterTracks2",
    OutputLevel=INFO,
    inputLocations=["Alignment/FilterTracks1"],  #"Alignment/FittedTracks",
    outputLocation="Alignment/AlignmentTracks",
    copyFailures=False)

trackContCopy.addTool(TrackSelector(), name="Selector")
trackContCopy.Selector.TrackTypes = ["Long", "Ttrack"]
trackContCopy.Selector.MaxChi2Cut = 40.0

TAlignment().filterSeq().Members.append(trackContCopy)
示例#8
0
#trackselectortool = TrackSelector( MinPCut = "3000", MaxChi2Cut="20", TrackTypes = [ "Long","Upstream","Velo" ] )
#trackselectortool = TrackSelector( MaxChi2Cut="20", TrackTypes = [ "Long","Upstream","Velo" ] )
trackselectortool = TrackSelector(
    "AlignTrackSelectorTool",
    MaxChi2Cut="20",
    MinNDoF=2,
    MinNVeloPhiHits=5,
    MinNVeloRHits=5,
    #TrackTypes = [ "Long","Velo","Upstream" ]
    TrackTypes=["Velo"])

trackselectoralg = TrackContainerCopy(
    "AlignTrackSelector",
    inputLocations=["Rec/Track/Best"],
    outputLocation="Alignment/AlignmentTracks")
trackselectoralg.addTool(trackselectortool, "Selector")
AlConfigurable().filterSeq().Members.append(trackselectoralg)

from Configurables import (Al__VertexResidualTool, Al__AlignConstraintTool)

trkselector = TrackSelector("VertexTrackSelector", TrackTypes=["Long"])
vertexresidualtool = Al__VertexResidualTool("Al::VertexResidualTool")
#vertexresidualtool.addTool(TrackSelector("TrackSelector",TrackTypes = [ "Long" ] ) )
vertexresidualtool.addTool(trkselector, name="MyTrackSelector")
vertexresidualtool.MyTrackSelector.TrackTypes = ["Long"]
#vertexresidualtool.MyTrackSelectorHandle = trkselector
vertexresidualtool.ComputeCorrelations = computeVertexCorrelations

## run some monitoring code
from Configurables import (TrackMonitor, TrackVertexMonitor)
示例#9
0
TAlignment().TrackLocation = "Rec/Track/AlignTracks"
TAlignment().VertexLocation = "Rec/Vertex/Primary"
TAlignment().Constraints = constraints
TAlignment().WriteCondSubDetList = ['Velo']
#TAlignment().UpdateInFinalize = False

# still set up a track selection
from Configurables import (GaudiSequencer, TrackContainerCopy, TrackSelector,
                           TrackMonitor)
trackFilterSeq = GaudiSequencer("TrackFilterSeq")
alignSelector = TrackContainerCopy("AlignSelector",
                                   inputLocation="Rec/Track/Best",
                                   outputLocation="Rec/Track/AlignTracks")
alignSelector.addTool(
    TrackSelector("Selector",
                  MaxChi2Cut=10,
                  MinNVeloRHits=3,
                  MinNVeloPhiHits=3))
trackFilterSeq.Members.append(alignSelector)
trackFilterSeq.Members.append(
    TrackMonitor("AlignTrackMonitor",
                 TracksInContainer="Rec/Track/AlignTracks"))

# Load the velo alignment slce
#from Configurables import ( CondDB, CondDBAccessSvc )
#veloCond = CondDBAccessSvc( 'VeloAlignCond' )
#veloCond.ConnectionString = 'sqlite_file:/afs/cern.ch/lhcb/group/tracking/vol7/wouter/DB/VeloSliceFestNothing.db/LHCBCOND'
#CondDB().addLayer( veloCond )

##############################################################################
# I/O datasets are defined in a separate file, see examples in 2008-TED_Data.py