def ConfiguredHltFitter(Name):
    fitter = ConfiguredMasterFitter(Name,
                                    FieldOff=None,
                                    SimplifiedGeometry=True,
                                    LiteClusters=True)
    fitter.NodeFitter.ForceBiDirectionalFit = True
    fitter.NumberFitIterations = 1
    fitter.MaxNumberOutliers = 2
    fitter.UpdateTransport = False
    fitter.AddDefaultReferenceNodes = True
    fitter.UpdateReferenceInOutlierIterations = False
    ## Force to use drift time
    from Configurables import TrajOTProjector, TrackProjectorSelector
    otprojector = TrajOTProjector('OTFastFitProjector')
    otprojector.PrefitStrategy = 0
    fitter.Projector.OT = otprojector
    fitter.MeasProvider.IgnoreMuon = True
    return fitter
def ConfiguredForwardFitter(Name,
                            FieldOff=None,
                            LiteClusters=True,
                            ForceUseDriftTime=True):
    fitter = ConfiguredMasterFitter(Name,
                                    FieldOff=FieldOff,
                                    SimplifiedGeometry=True,
                                    LiteClusters=LiteClusters)
    fitter.NumberFitIterations = 1
    fitter.MaxNumberOutliers = 0
    fitter.AddDefaultReferenceNodes = False
    fitter.NodeFitter.ForceBiDirectionalFit = False
    fitter.FillExtraInfo = False
    fitter.UpdateReferenceInOutlierIterations = False
    if ForceUseDriftTime:
        from Configurables import TrajOTProjector, TrackProjectorSelector
        otprojector = TrajOTProjector('OTFastFitProjector')
        otprojector.PrefitStrategy = 0
        fitter.Projector.OT = otprojector
    return fitter
conddb = CondDB()
conddb.IgnoreHeartBeat = True
#if running online
#conddb.UseDBSnapshot = True
#conddb.EnableRunChangeHandler = True
#conddb.Tags['ONLINE'] = 'fake'
#import AllHlt1
#conddb.RunChangeHandlerConditions = AllHlt1.ConditionMap

# Further selection
#theApp.VetoHltErrorEvents = False
#from Configurables import L0Conf
#L0Conf().EnsureKnownTCK=False

from Configurables import TrajOTProjector
Projector = TrajOTProjector("OTProjector", UseDrift=True)

from TrackFitter.ConfiguredFitters import *
Fitter = ConfiguredMasterFitter("TrackMonFitter")
Fitter.Projector.OT = Projector
Fitter.MaxNumberOutliers = 0

#OT t0 calibration
from Configurables import (GaudiSequencer, TrackHitAdder, TrackEventFitter,
                           OTModuleClbrMon, TrackMon)
GaudiSequencer("MoniOTSeq").Members = [
    TrackHitAdder(TrackLocation="Rec/Track/Best"),
    TrackEventFitter(TracksInContainer="Rec/Track/Best", Fitter=Fitter),
    OTModuleClbrMon(
        TrackType=
        3,  # Long tracks                                                                  
Example #4
0
from Configurables import (TrackFilterAlg, GetElementsToBeAligned,
                           AlignSelTool, TrajOTProjector)
from Configurables import TAlignment
from TAlignment import *

INFO = 3
DEBUG = 2
outputLevel = INFO
useDrift = False
trackThrough = "OT"

trajOTProjector = TrajOTProjector(OutputLevel=DEBUG, UseDrift=useDrift)

trackFilterAlg = TrackFilterAlg(
    "FilterTracks1",
    OutputLevel=outputLevel,
    TracksInputContainer="Rec/Track/Best",  #"Rec/Track/Tsa", 
    TracksOutputContainer="Alignment/FilterTracks1",
    TrackType="Long",  #"Ttrack", #"Long",
    StripUnwantedDetectorHits=False,
    KeepDetectorHits="OT",
    MinNHits=0)

elements = TAlignment().getProp("ElementsToAlign")

trackFilterAlg.addTool(GetElementsToBeAligned(OutputLevel=outputLevel,
                                              Elements=elements),
                       name="GetElementsToBeAligned")

trackFilterAlg.addTool(
    AlignSelTool(
def ConfiguredMasterFitter(Name,
                           FieldOff=None,
                           SimplifiedGeometry=None,
                           NoDriftTimes=None,
                           KalmanSmoother=None,
                           LiteClusters=False,
                           ApplyMaterialCorrections=None,
                           StateAtBeamLine=True,
                           MaxNumberOutliers=2,
                           FastOutlierIteration=False,
                           MSRossiAndGreisen=False):
    # set the mutable default arguments
    if FieldOff is None: FieldOff = TrackSys().fieldOff()
    if SimplifiedGeometry is None:
        SimplifiedGeometry = TrackSys().simplifiedGeometry()
    if NoDriftTimes is None: NoDriftTimes = TrackSys().noDrifttimes()
    if KalmanSmoother is None: KalmanSmoother = TrackSys().kalmanSmoother()
    if ApplyMaterialCorrections is None:
        ApplyMaterialCorrections = not TrackSys().noMaterialCorrections()

    if isinstance(Name, TrackMasterFitter):
        fitter = Name
    else:
        if allConfigurables.get(Name):
            raise ValueError, 'ConfiguredMasterFitter: instance with name ' + Name + ' already exists'
        fitter = TrackMasterFitter(Name)

    # apply material corrections
    if not ApplyMaterialCorrections:
        fitter.ApplyMaterialCorrections = False
        fitter.Extrapolator.ApplyMultScattCorr = False
        fitter.Extrapolator.ApplyEnergyLossCorr = False
        fitter.Extrapolator.ApplyElectronEnergyLossCorr = False

    # provide a state at the beamline
    fitter.StateAtBeamLine = StateAtBeamLine

    # set the maximum number of outliers removed in the fit
    fitter.MaxNumberOutliers = MaxNumberOutliers

    # set up the material locator
    # Using 'RossiAndGreisen' will omit the log term in the multiple scattering calculation (which should give better pulls).
    if SimplifiedGeometry:
        fitter.addTool(SimplifiedMaterialLocator, name="MaterialLocator")
        fitter.Extrapolator.addTool(SimplifiedMaterialLocator,
                                    name="MaterialLocator")
    else:
        fitter.addTool(DetailedMaterialLocator, name="MaterialLocator")
        fitter.Extrapolator.addTool(DetailedMaterialLocator,
                                    name="MaterialLocator")

    fitter.MaterialLocator.addTool(StateThickMSCorrectionTool,
                                   "StateMSCorrectionTool")
    fitter.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = MSRossiAndGreisen
    fitter.Extrapolator.MaterialLocator.addTool(StateThickMSCorrectionTool,
                                                "StateMSCorrectionTool")
    fitter.Extrapolator.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = MSRossiAndGreisen

    # not yet used for DC09 production
    # else:
    #    fitter.addTool(DetailedMaterialLocator(), name="MaterialLocator")
    #    fitter.MaterialLocator.GeneralDedxToolName="StateDetailedBetheBlochEnergyCorrectionTool"
    #    fitter.Extrapolator.addTool(DetailedMaterialLocator(), name="MaterialLocator")
    #    fitter.Extrapolator.GeneralDedxToolName = "StateDetailedBetheBlochEnergyCorrectionTool"
    #    fitter.Extrapolator.addTool(DetailedMaterialLocator(), name="MaterialLocator")
    #    fitter.Extrapolator.MaterialLocator.GeneralDedxToolName = "StateDetailedBetheBlochEnergyCorrectionTool"

    # special settings for field-off
    if FieldOff:
        fitter.Extrapolator.addTool(TrackSimpleExtraSelector,
                                    name="ExtraSelector")
        fitter.Extrapolator.ExtraSelector.ExtrapolatorName = "TrackLinearExtrapolator"
        fitter.Extrapolator.ApplyEnergyLossCorr = False
        fitter.Extrapolator.ApplyElectronEnergyLossCorr = False
        fitter.ApplyEnergyLossCorr = False
        fitter.NodeFitter.DoF = 4

    # change the smoother
    if KalmanSmoother:
        fitter.NodeFitter.ForceBiDirectionalFit = False

    if FastOutlierIteration:
        fitter.UpdateReferenceInOutlierIterations = False

    # don't use drift times
    if NoDriftTimes:
        # set up the NoDriftTimeProjector in the toolsvc
        defaultOTNoDriftTimeProjector = TrajOTProjector(
            "OTNoDrifttimesProjector")
        defaultOTNoDriftTimeProjector.UseDrift = False
        fitter.Projector.OT = defaultOTNoDriftTimeProjector

    # use lite clusters for velo and ST
    if LiteClusters:
        from Configurables import (
            MeasurementProviderT_MeasurementProviderTypes__VeloLiteR_,
            MeasurementProviderT_MeasurementProviderTypes__VeloLitePhi_,
            MeasurementProviderT_MeasurementProviderTypes__TTLite_,
            MeasurementProviderT_MeasurementProviderTypes__ITLite_,
            MeasurementProviderT_MeasurementProviderTypes__UTLite_)
        fitter.MeasProvider.VeloRProvider = MeasurementProviderT_MeasurementProviderTypes__VeloLiteR_(
        )
        fitter.MeasProvider.VeloPhiProvider = MeasurementProviderT_MeasurementProviderTypes__VeloLitePhi_(
        )
        fitter.MeasProvider.TTProvider = MeasurementProviderT_MeasurementProviderTypes__TTLite_(
        )
        fitter.MeasProvider.ITProvider = MeasurementProviderT_MeasurementProviderTypes__ITLite_(
        )
        fitter.MeasProvider.UTProvider = MeasurementProviderT_MeasurementProviderTypes__UTLite_(
        )

    if TrackSys().cosmics():
        fitter.MeasProvider.OTProvider.RawBankDecoder = 'OTMultiBXRawBankDecoder'

    # figure out upgrade detectors
    from Configurables import LHCbApp
    if hasattr(LHCbApp(), "Detectors"):
        if LHCbApp().isPropertySet("Detectors"):
            subDets = LHCbApp().upgradeDetectors()
            useUpgrade = bool(
                [det for det in subDets if det in ['VP', 'UT', 'FT']])
            if useUpgrade:
                fitter.MeasProvider.IgnoreVelo = True
                fitter.MeasProvider.IgnoreVP = True
                fitter.MeasProvider.IgnoreTT = True
                fitter.MeasProvider.IgnoreUT = True
                fitter.MeasProvider.IgnoreIT = True
                fitter.MeasProvider.IgnoreOT = True
                fitter.MeasProvider.IgnoreFT = True

                if ("VP" in subDets):
                    fitter.MeasProvider.IgnoreVP = False
                if ("FT" in subDets):
                    fitter.MeasProvider.IgnoreFT = False
                if ("UT" in subDets):
                    fitter.MeasProvider.IgnoreUT = False

    return fitter