def __hlt2FullDownstreamTracking(self): """ Full Downstream track reconstruction and fitting for tracking efficiency lines """ from Configurables import PatSeeding from Configurables import PatSeedingTool from HltLine.HltLine import bindMembers from Configurables import TrackEventFitter, TrackMasterFitter DownstreamFit = TrackEventFitter('DownstreamFitter') DownstreamFit.TracksInContainer = Hlt2TrackLoc[ "Downstream"] #use unfitted Downstream tracks out of Hlt2Tracking DownstreamFit.TracksOutContainer = Hlt2TrackEffLoc[ "FullDownstream"] #our outputlocation DownstreamFit.addTool(TrackMasterFitter, name='Fitter') from TrackFitter.ConfiguredFitters import ConfiguredHltFitter, ConfiguredMasterFitter DownstreamFitter = getattr(DownstreamFit, 'Fitter') from Configurables import HltRecoConf ConfiguredMasterFitter(DownstreamFitter, SimplifiedGeometry=True, LiteClusters=True, MSRossiAndGreisen=HltRecoConf().getProp( "NewMSinFit")) #on par with Hlt track fits DownstreamFitter.OutputLevel = 5 # Build the bindMembers bm_name = self.getProp("Prefix") + "FullDownstreamTracking" bm_members = [DownstreamFit] bm_output = Hlt2TrackEffLoc["FullDownstream"] return bindMembers(bm_name, bm_members).setOutputSelection(bm_output)
def ConfiguredForwardStraightLineEventFitter(Name, TracksInContainer): eventfitter = TrackEventFitter(Name) eventfitter.TracksInContainer = TracksInContainer fittername = Name + ".Fitter" eventfitter.addTool(ConfiguredForwardStraightLineFitter(Name=fittername), name="Fitter") return eventfitter
def ConfiguredEventFitter(Name, TracksInContainer, FieldOff=None, SimplifiedGeometry=None, NoDriftTimes=None, KalmanSmoother=None, LiteClusters=False, ApplyMaterialCorrections=None, StateAtBeamLine=True, MaxNumberOutliers=2, MSRossiAndGreisen=False): # make sure the name is unique if allConfigurables.get(Name): raise ValueError, 'ConfiguredEventFitter: instance with name ' + Name + ' already exists' # create the event fitter eventfitter = TrackEventFitter(Name) eventfitter.TracksInContainer = TracksInContainer # this addTool should not be necessary but unfortunately there is a problem with the toolhandle configuration eventfitter.addTool(TrackMasterFitter, name="Fitter") # configure the fitter ConfiguredMasterFitter(eventfitter.Fitter, FieldOff=FieldOff, SimplifiedGeometry=SimplifiedGeometry, NoDriftTimes=NoDriftTimes, KalmanSmoother=KalmanSmoother, LiteClusters=LiteClusters, ApplyMaterialCorrections=ApplyMaterialCorrections, StateAtBeamLine=StateAtBeamLine, MaxNumberOutliers=MaxNumberOutliers, MSRossiAndGreisen=MSRossiAndGreisen) return eventfitter
def ConfiguredForwardEventFitter(Name, TracksInContainer, ForceUseDriftTime=True): eventfitter = TrackEventFitter(Name) eventfitter.TracksInContainer = TracksInContainer fittername = Name + ".Fitter" eventfitter.addTool(ConfiguredForwardFitter( Name=fittername, ForceUseDriftTime=ForceUseDriftTime), name="Fitter") return eventfitter
def ConfiguredHltEventFitter( name, TracksInContainer, TracksOutContainer = None): # create the event fitter from Configurables import ( TrackEventFitter, TrackMasterFitter, TrackInitFit, TrackStateInitTool ) eventfitter = TrackEventFitter(name) eventfitter.TracksInContainer = TracksInContainer if TracksOutContainer != None: eventfitter.TracksOutContainer = TracksOutContainer ConfiguredHltInitFitter(eventfitter) return eventfitter
def trackingPreFilter(name, prefilter): VeloMuonBuilder1 = VeloMuonBuilder("VeloMuonBuilder") VeloMuonBuilder1.OutputLevel = 6 VeloMuonBuilder1.MuonLocation = "Hlt1/Track/MuonSeg" VeloMuonBuilder1.VeloLocation = "Rec/Track/FittedVelo" VeloMuonBuilder1.lhcbids = 4 VeloMuonBuilder1.OutputLocation = "Rec/VeloMuon/Tracks" preve = TrackPrepareVelo("preve") preve.inputLocation = "Rec/Track/Velo" preve.outputLocation = "Rec/Track/UnfittedPreparedVelo" preve.bestLocation = "" vefit = TrackEventFitter('vefit') vefit.TracksInContainer = "Rec/Track/UnfittedPreparedVelo" vefit.TracksOutContainer = "Rec/Track/FittedVelo" vefit.addTool(TrackMasterFitter, name = 'Fitter') ConfiguredFastFitter( getattr(vefit,'Fitter')) #define a TrackCloneFinder #low = TrackCloneFinder("TrackCloneFinder/low") #low.MatchingFraction = 0.6 Tf__PatVeloSpaceTracking("PatVeloSpaceTracking").addTool( Tf__PatVeloSpaceTool(), name="PatVeloSpaceTool" ) Tf__PatVeloSpaceTracking("PatVeloSpaceTracking").PatVeloSpaceTool.MarkClustersUsed = True; #Tf__PatVeloSpaceTracking("PatVeloSpaceTracking").OutputLevel = 0; # algos = [tisTosPreFilterHlt1Jpsi, tisTosPreFilterHlt2Jpsi, Tf__PatVeloRTracking(), Tf__PatVeloSpaceTracking(),Tf__PatVeloGeneralTracking(), preve,vefit, StandaloneMuonRec(), VeloMuonBuilder1] # alg = GaudiSequencer("VeloMuonTrackingFor"+name, #Members = [Jpsi_already_there, # jpsidotracking], Members = [ DecodeVeloRawBuffer(name+"VeloDecoding"), Tf__PatVeloRTracking(name+"VeloR"), Tf__PatVeloSpaceTracking(name+"VeloSpace"), Tf__PatVeloGeneralTracking(name+"VeloGen"), preve,vefit, StandaloneMuonRec(name+"MuonStandalone"), VeloMuonBuilder1]) return GSWrapper(name="WrappedVeloMuonTracking", sequencer=alg, output='Rec/VeloMuon/Tracks', requiredSelections = [ prefilter])
def fittedVelo(inputTracks, outputTracks, name='VeloOnlyFitterAlg'): from Configurables import TrackEventFitter, TrackInitFit from Configurables import TrackStateInitTool, TrackMasterFitter if HltRecoConf().getProp("FastFitVelo"): # For now use the save option where Velo tracks are copied and the original ones are not changed from Configurables import TrackStateInitAlg, TrackStateInitTool,FastVeloFitLHCbIDs from Configurables import TrackContainerCopy copy = TrackContainerCopy(name+"CopyVelo") copy.inputLocations = [ inputTracks ] copy.outputLocation = outputTracks init = TrackStateInitAlg(name) init.TrackLocation = copy.outputLocation init.addTool(TrackStateInitTool, name="StateInitTool") init.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs" init.StateInitTool.addTool(TrackMasterExtrapolator, "Extrapolator") init.StateInitTool.Extrapolator.addTool(SimplifiedMaterialLocator, name = "MaterialLocator") init.StateInitTool.addTool(FastVeloFitLHCbIDs,name="FastVeloFitLHCbIDs") init.StateInitTool.FastVeloFitLHCbIDs.UseKalmanFit = True return [copy,init] else: fa = TrackEventFitter(name) fa.TracksInContainer = inputTracks fa.TracksOutContainer = outputTracks fa.Fitter = "TrackInitFit/Fit" fa.addTool(TrackInitFit, "Fit") fa.Fit.Init = "TrackStateInitTool/VeloOnlyStateInit" fa.Fit.addTool(TrackStateInitTool, "VeloOnlyStateInit") fa.Fit.VeloOnlyStateInit.VeloFitterName = "FastVeloFitLHCbIDs" fa.Fit.VeloOnlyStateInit.addTool(TrackMasterExtrapolator, "Extrapolator") fa.Fit.VeloOnlyStateInit.Extrapolator.addTool(SimplifiedMaterialLocator, name = "MaterialLocator") fa.Fit.Fit = "TrackMasterFitter/Fit" fa.Fit.addTool(TrackMasterFitter, name = "Fit") from TrackFitter.ConfiguredFitters import ConfiguredForwardFitter fitter = ConfiguredForwardFitter(fa.Fit.Fit) return [ fa ]
def RecoTrackingHLT1(exclude=[], simplifiedGeometryFit=True, liteClustersFit=True): '''Function that defines the pattern recognition algorithms for the HLT1 sequence of the Run 2 offline tracking''' ## Start TransportSvc, needed by track fit ApplicationMgr().ExtSvc.append("TransportSvc") ## -------------------------------------------------------------------- ## Pattern Recognition and Fitting ## -------------------------------------------------------------------- # Which algs to run ? trackAlgs = TrackSys().getProp("TrackPatRecAlgorithms") # Which data type is it? dataType = TrackSys().getProp("DataType") # Decode the RAW banks ExcludedLayers = TrackSys().getProp("ExcludedLayers") DecodeTracking(trackAlgs, ExcludedLayers) from Configurables import STOfflinePosition IT = STOfflinePosition('ITClusterPosition') IT.DetType = "IT" TT = STOfflinePosition('TTClusterPosition') TT.DetType = "TT" from STTools import STOfflineConf STOfflineConf.DefaultConf().configureTools() ## Make sure the default extrapolator and interpolator use simplified material from Configurables import TrackMasterExtrapolator, TrackInterpolator, SimplifiedMaterialLocator, DetailedMaterialLocator if TrackSys().simplifiedGeometry() and ('SimpleGeom' not in exclude): TrackMasterExtrapolator().MaterialLocator = 'SimplifiedMaterialLocator' TrackInterpolator().addTool(TrackMasterExtrapolator( MaterialLocator='SimplifiedMaterialLocator'), name='Extrapolator') ### This configures public tools to use the new multiple scattering description without the log term from Configurables import StateThickMSCorrectionTool me = TrackMasterExtrapolator() me.addTool(DetailedMaterialLocator(), name="MaterialLocator") me.MaterialLocator.addTool(StateThickMSCorrectionTool, name="StateMSCorrectionTool") me.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = True ti = TrackInterpolator() ti.addTool(me) from Configurables import TrackStateProvider tsp = TrackStateProvider() tsp.addTool(TrackInterpolator, name="Interpolator") tsp.addTool(TrackMasterExtrapolator, name="Extrapolator") tsp.Interpolator.addTool(TrackMasterExtrapolator, name='Extrapolator') if simplifiedGeometryFit or (TrackSys().simplifiedGeometry() and ('SimpleGeom' not in exclude)): tsp.Extrapolator.addTool(SimplifiedMaterialLocator, name="MaterialLocator") tsp.Interpolator.Extrapolator.addTool(SimplifiedMaterialLocator, name="MaterialLocator") else: tsp.Extrapolator.addTool(DetailedMaterialLocator, name="MaterialLocator") tsp.Interpolator.Extrapolator.addTool(DetailedMaterialLocator, name="MaterialLocator") tsp.Extrapolator.MaterialLocator.addTool(StateThickMSCorrectionTool, name="StateMSCorrectionTool") tsp.Extrapolator.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = True tsp.Interpolator.Extrapolator.MaterialLocator.addTool( StateThickMSCorrectionTool, name="StateMSCorrectionTool") tsp.Interpolator.Extrapolator.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = True ### ## Velo tracking ## Why is Velo not in the tracking sequence? if "FastVelo" in trackAlgs: from Configurables import FastVeloTracking GaudiSequencer("RecoVELOSeq").Members += [ FastVeloTracking("FastVeloTracking") ] if TrackSys().timing(): FastVeloTracking().TimingMeasurement = True ## Tracking sequence from Configurables import ProcessPhase track = ProcessPhase("TrackHLT1") GaudiSequencer("RecoTrHLT1Seq").Members += [track] from Configurables import MagneticFieldSvc if TrackSys().fieldOff(): MagneticFieldSvc().ForcedSignedCurrentScaling = 0. if "noDrifttimes" in TrackSys().getProp("ExpertTracking"): from Configurables import (Tf__OTHitCreator) Tf__OTHitCreator("OTHitCreator").NoDriftTimes = True # Get the fitters from TrackFitter.ConfiguredFitters import ConfiguredFit, ConfiguredFitSeed, ConfiguredMasterFitter # Clone killer tracklists = [] # Is this standard sequence? stdSeq = "fastSequence" not in TrackSys().getProp("ExpertTracking") ## Velo-TT pattern if "VeloTT" in trackAlgs: track.DetectorList += ["VeloTTPat"] from Configurables import PatVeloTTHybrid GaudiSequencer("TrackHLT1VeloTTPatSeq").Members += [ PatVeloTTHybrid("PatVeloTTHybrid") ] from PatVeloTT import PatVeloTTAlgConf PatVeloTTAlgConf.PatVeloTTConf().configureAlgRun2HLT1() if TrackSys().timing(): PatVeloTTHybrid("PatVeloTTHybrid").TimingMeasurement = True tracklists += ["Rec/Track/VeloTT"] ## Forward pattern if "ForwardHLT1" in trackAlgs: if "VeloTT" not in trackAlgs: raise RuntimeError("Cannot run HLT1 forward without VeloTT") track.DetectorList += ["ForwardPatHLT1"] from Configurables import PatForward, PatForwardTool GaudiSequencer("TrackHLT1ForwardPatHLT1Seq").Members += [ PatForward("PatForwardHLT1") ] # should be replaced by more 'global' tracking configuration from PatAlgorithms import PatAlgConf PatAlgConf.ForwardConf().configureAlgRun2HLT1() if TrackSys().timing(): PatForward("PatForwardHLT1").TimingMeasurement = True tracklists += ["Rec/Track/ForwardHLT1"] ## Fitting all HLT1 tracks track.DetectorList += ["FitHLT1"] from Configurables import TrackEventFitter, TrackInitFit, TrackStateInitTool, TrackStateInitAlg, TrackMasterExtrapolator, TrackMasterFitter from Configurables import SimplifiedMaterialLocator, DetailedMaterialLocator from Configurables import TrackContainerCopy ###### ### Fitter for Velo tracks ###### if "FastVelo" in trackAlgs: if "VeloForwardKalmanHLT1" in TrackSys().getProp("ExpertTracking"): # This is the option for the 2015 early measurements veloFitter = TrackEventFitter('VeloOnlyFitterAlg') veloFitter.TracksInContainer = "Rec/Track/Velo" veloFitter.TracksOutContainer = "Rec/Track/FittedHLT1VeloTracks" veloFitter.Fitter = "TrackInitFit/Fit" veloFitter.addTool(TrackInitFit, "Fit") veloFitter.Fit.Init = "TrackStateInitTool/VeloOnlyStateInit" veloFitter.Fit.addTool(TrackStateInitTool, "VeloOnlyStateInit") veloFitter.Fit.VeloOnlyStateInit.VeloFitterName = "FastVeloFitLHCbIDs" veloFitter.Fit.VeloOnlyStateInit.addTool(TrackMasterExtrapolator, "Extrapolator") if (simplifiedGeometryFit): veloFitter.Fit.VeloOnlyStateInit.Extrapolator.addTool( SimplifiedMaterialLocator, name="MaterialLocator") else: veloFitter.Fit.VeloOnlyStateInit.Extrapolator.addTool( DetailedMaterialLocator, name="MaterialLocator") veloFitter.Fit.Fit = "TrackMasterFitter/Fit" veloFitter.Fit.addTool(TrackMasterFitter, name="Fit") from TrackFitter.ConfiguredFitters import ConfiguredForwardFitter ConfiguredForwardFitter(veloFitter.Fit.Fit, LiteClusters=liteClustersFit) GaudiSequencer("TrackHLT1FitHLT1Seq").Members += [veloFitter] else: # and this is the option for after the early measurements # copy tracks from pat reco output container to a new one copyVeloTracks = TrackContainerCopy("CopyVeloTracks") copyVeloTracks.inputLocations = ["Rec/Track/Velo"] copyVeloTracks.outputLocation = "Rec/Track/FittedHLT1VeloTracks" from FastVelo import FastVeloAlgConf stateInit = TrackStateInitAlg('VeloOnlyInitAlg') FastVeloAlgConf.FastVeloKalmanConf().configureFastKalmanFit( init=stateInit) GaudiSequencer("TrackHLT1FitHLT1Seq").Members += [ copyVeloTracks, stateInit ] ###### ### Fitter for Forward tracks ### Need to be careful: This is all a little fragile, so if you plan to change something, check that everything configures the way you expect ### The Extrapolator for the StateInitTool does not use material corrections, so don't need to explicitely add the StateThickMSCorrectionTool ###### if "ForwardHLT1" in trackAlgs: fwdFitter = TrackEventFitter('ForwardHLT1FitterAlg') fwdFitter.TracksInContainer = "Rec/Track/ForwardHLT1" fwdFitter.TracksOutContainer = "Rec/Track/FittedHLT1ForwardTracks" # Keep only good tracks, this cut should be aligned with the one in the TrackBestTrackCreator fwdFitter.MaxChi2DoF = 4.0 fwdFitter.Fitter = "TrackInitFit/Fit" fwdFitter.addTool(TrackInitFit, "Fit") fwdFitter.Fit.Init = "TrackStateInitTool/FwdStateInit" fwdFitter.Fit.addTool(TrackStateInitTool, "FwdStateInit") fwdFitter.Fit.FwdStateInit.addTool(TrackMasterExtrapolator, "Extrapolator") fwdFitter.Fit.FwdStateInit.UseFastMomentumEstimate = True fwdFitter.Fit.FwdStateInit.VeloFitterName = "FastVeloFitLHCbIDs" if (simplifiedGeometryFit): fwdFitter.Fit.FwdStateInit.Extrapolator.addTool( SimplifiedMaterialLocator, name="MaterialLocator") else: fwdFitter.Fit.FwdStateInit.Extrapolator.addTool( DetailedMaterialLocator, name="MaterialLocator") fwdFitter.Fit.Fit = "TrackMasterFitter/Fit" fwdFitter.Fit.addTool(TrackMasterFitter, name="Fit") from TrackFitter.ConfiguredFitters import ConfiguredMasterFitter ConfiguredMasterFitter(fwdFitter.Fit.Fit, SimplifiedGeometry=simplifiedGeometryFit, LiteClusters=liteClustersFit, MSRossiAndGreisen=True) GaudiSequencer("TrackHLT1FitHLT1Seq").Members += [fwdFitter]
def ConfiguredHltEventFitter(Name, TracksInContainer): eventfitter = TrackEventFitter(Name) eventfitter.TracksInContainer = TracksInContainer fittername = Name + ".Fitter" eventfitter.addTool(ConfiguredHltFitter(Name=fittername), name="Fitter") return eventfitter