def trackingDownPreFilter(name, prefilter, seedcut): #Test code for debugging #Jpsi_already_there = LoKi__VoidFilter("Jpsi_already_there") #Jpsi_already_there.Code = "1 <= CONTAINS('Rec/Track/Downstream')" #Jpsi_not_yet_there = LoKi__VoidFilter("Jpsi_not_yet_there") #Jpsi_not_yet_there.Code = "1 > CONTAINS('Rec/Track/Downstream')" TrackToDST(name + "_DownTrackToDST" ).TracksInContainer = "Rec/" + name + "_Downstream/FittedTracks" jpsidotracking = GaudiSequencer("DownTrackingFor" + name) #Add seed tracking DownSeeding = PatSeeding(name + "_DownSeeding") DownSeeding.OutputTracksName = "Rec/" + name + "_DownSeeding/Tracks" PatAlgConf.SeedingConf().configureAlg(SeedAlg=DownSeeding) #DownSeeding.addTool(PatSeedingTool, name=name+"_PatSeedingTool") #DownSeeding.addTool(PatSeedingTool) #PatSeedingTool(name+"_PatSeedingTool").MinMomentum = seedcut seedtoolname = name + "_PatSeedingTool" DownSeeding.addTool(PatSeedingTool, name=seedtoolname) seedtool = getattr(DownSeeding, seedtoolname) seedtool.MinMomentum = seedcut jpsidotracking.Members += [DownSeeding] #Add Seed Fit jpsidotracking.Members += [GaudiSequencer(name + "_TrackSeedFitSeq")] #AddPatDownstream downstreamTracking = PatDownstream(name + "_PatDownstream") downstreamTracking.InputLocation = DownSeeding.OutputTracksName downstreamTracking.OutputLocation = 'Rec/' + name + '_Downstream/Tracks' jpsidotracking.Members += [downstreamTracking] #AddDownstreamFitSeq DownInitAlg = TrackStateInitAlg(name + "_InitSeedDownstream") jpsidotracking.Members += [DownInitAlg] DownInitAlg.TrackLocation = "Rec/" + name + "_Downstream/Tracks" downstreamFit = ConfiguredFitDownstream(name + "_FitDownstream") downstreamFit.TracksInContainer = 'Rec/' + name + '_Downstream/Tracks' downstreamFit.TracksOutContainer = 'Rec/' + name + '_Downstream/FittedTracks' jpsidotracking.Members += [downstreamFit] jpsidotracking.Members += [TrackToDST(name + "_DownTrackToDST")] return GSWrapper(name="WrappedDownstreamTracking" + name, sequencer=jpsidotracking, output='Rec/' + name + '_Downstream/FittedTracks', requiredSelections=[prefilter])
def trackingDownPreFilter(name, prefilter): #Jpsi_already_there = LoKi__VoidFilter("Jpsi_already_there") #Jpsi_already_there.Code = "1 <= CONTAINS('Rec/Track/Downstream')" #Jpsi_not_yet_there = LoKi__VoidFilter("Jpsi_not_yet_there") #Jpsi_not_yet_there.Code = "1 > CONTAINS('Rec/Track/Downstream')" TrackToDST( "DownTrackToDST").TracksInContainer = "Rec/Downstream/FittedTracks" #TrackSys().setProp('SpecialData', ['earlyData']) jpsidotracking = GaudiSequencer("DownTrackingFor" + name) #Add seed tracking jpsidotracking.Members += [PatSeeding("PatSeeding")] PatAlgConf.SeedingConf().configureAlg() #Add Seed Fit jpsidotracking.Members += [GaudiSequencer("TrackSeedFitSeq")] #AddPatDownstream downstreamTracking = PatDownstream() downstreamTracking.OutputLocation = 'Rec/Downstream/Tracks' jpsidotracking.Members += [downstreamTracking] #AddDownstreamFitSeq jpsidotracking.Members += [TrackStateInitAlg("InitSeedDownstream")] TrackStateInitAlg( "InitSeedDownstream").TrackLocation = "Rec/Downstream/Tracks" downstreamFit = ConfiguredFitDownstream() downstreamFit.TracksInContainer = 'Rec/Downstream/Tracks' downstreamFit.TracksOutContainer = 'Rec/Downstream/FittedTracks' jpsidotracking.Members += [downstreamFit] jpsidotracking.Members += [TrackToDST("DownTrackToDST")] #alg = GaudiSequencer("JpsitracksFor" + name, # Members = [Jpsi_already_there, # jpsidotracking], # ModeOR = True, # ShortCircuit = True) return GSWrapper(name="WrappedDownstreamTracking", sequencer=jpsidotracking, output='Rec/Downstream/FittedTracks', requiredSelections=[prefilter])
def trackingDownPreFilter(name, prefilter): #Test code for debugging #Jpsi_already_there = LoKi__VoidFilter("Jpsi_already_there") #Jpsi_already_there.Code = "1 <= CONTAINS('Rec/Track/Downstream')" #Jpsi_not_yet_there = LoKi__VoidFilter("Jpsi_not_yet_there") #Jpsi_not_yet_there.Code = "1 > CONTAINS('Rec/Track/Downstream')" TrackToDST( "DownTrackToDST").TracksInContainer = "Rec/Downstream/FittedTracks" jpsidotracking = GaudiSequencer("DownTrackingFor" + name) #Add seed tracking jpsidotracking.Members += [PatSeeding("PatSeeding")] PatAlgConf.SeedingConf().configureAlg() #Add Seed Fit jpsidotracking.Members += [GaudiSequencer("TrackSeedFitSeq")] #AddPatDownstream downstreamTracking = PatDownstream() downstreamTracking.OutputLocation = 'Rec/Downstream/Tracks' jpsidotracking.Members += [downstreamTracking] #AddDownstreamFitSeq jpsidotracking.Members += [TrackStateInitAlg("InitSeedDownstream")] TrackStateInitAlg( "InitSeedDownstream").TrackLocation = "Rec/Downstream/Tracks" downstreamFit = ConfiguredFitDownstream() downstreamFit.TracksInContainer = 'Rec/Downstream/Tracks' downstreamFit.TracksOutContainer = 'Rec/Downstream/FittedTracks' jpsidotracking.Members += [downstreamFit] jpsidotracking.Members += [TrackToDST("DownTrackToDST")] return GSWrapper(name="WrappedDownstreamTracking", sequencer=jpsidotracking, output='Rec/Downstream/FittedTracks', requiredSelections=[prefilter])
def RecoTrackingHLT2(exclude=[], simplifiedGeometryFit=True, liteClustersFit=True): '''Function that defines the pattern recognition algorithms for the HLT2 sequence of the Run 2 offline tracking''' ## Tracking sequence from Configurables import ProcessPhase track = ProcessPhase("TrackHLT2") GaudiSequencer("RecoTrHLT2Seq").Members += [track] tracklists = [] # Which algs to run ? trackAlgs = TrackSys().getProp("TrackPatRecAlgorithms") # Which data type is it? dataType = TrackSys().getProp("DataType") ## Forward pattern if "ForwardHLT2" in trackAlgs: track.DetectorList += ["ForwardPatHLT2"] # Need to filter out the Velo tracks of the fitted HLT1 tracks #from Configurables import TrackListRefiner, TrackSelector #refiner = TrackListRefiner("FilterForwardHLT1Tracks") #refiner.inputLocation = "Rec/Track/FittedHLT1Tracks" #refiner.outputLocation = "Rec/Track/FittedHLT1ForwardTracks" #refiner.Selector = "TrackSelector" #refiner.addTool(TrackSelector("TrackSelector")) #refiner.TrackSelector.TrackTypes = [ "Long" ] #GaudiSequencer("TrackHLT2ForwardPatHLT2Seq").Members += [ refiner ] from Configurables import PatForward GaudiSequencer("TrackHLT2ForwardPatHLT2Seq").Members += [ PatForward("PatForwardHLT2") ] from PatAlgorithms import PatAlgConf PatAlgConf.ForwardConf().configureAlgRun2HLT2() if TrackSys().timing(): PatForward("PatForwardHLT2").TimingMeasurement = True #tracklists += ["Rec/Track/ForwardHLT2"] #merge forward from HLT1 and HLT2 from Configurables import TrackContainerCopy merger = TrackContainerCopy("MergeForwardHLT1HLT2") merger.inputLocations = [ "Rec/Track/FittedHLT1ForwardTracks", "Rec/Track/ForwardHLT2" ] merger.outputLocation = "Rec/Track/Forward" merger.copyFailures = True GaudiSequencer("TrackHLT2ForwardPatHLT2Seq").Members += [merger] tracklists += ["Rec/Track/Forward"] ## Seed pattern if "PatSeed" in trackAlgs: track.DetectorList += ["SeedPat"] from Configurables import PatSeeding GaudiSequencer("TrackHLT2SeedPatSeq").Members += [ PatSeeding("PatSeeding") ] # should be replaced by more 'global' tracking configuration from PatAlgorithms import PatAlgConf PatAlgConf.SeedingConf().configureAlg() if TrackSys().timing(): PatSeeding("PatSeeding").TimingMeasurement = True if TrackSys().cosmics(): from PatAlgorithms import PatAlgConf PatAlgConf.CosmicConf().configureAlg() tracklists += ["Rec/Track/Seed"] ## Matching if "PatMatch" in trackAlgs: track.DetectorList += ["MatchPat"] from Configurables import PatMatch GaudiSequencer("TrackHLT2MatchPatSeq").Members += [ PatMatch("PatMatch") ] # timing? # global conf? tracklists += ["Rec/Track/Match"] ## avoid running both downstream algos if "Downstream" in trackAlgs and "PatLongLivedTracking" in trackAlgs: raise RuntimeError( "Cannot run both PatDownstream and PatLongLivedTracking at once") ## Downstream if "Downstream" in trackAlgs: track.DetectorList += ["DownstreamPat"] from Configurables import PatDownstream GaudiSequencer("TrackHLT2DownstreamPatSeq").Members += [ PatDownstream("PatDownstream") ] from PatAlgorithms import PatAlgConf # global conf? #PatAlgConf.DownstreamConf().configureAlg() if TrackSys().timing(): PatDownstream("PatDownstream").TimingMeasurement = True tracklists += ["Rec/Track/Downstream"] ## PatLongLivedTracking (aka improved Downstream) if "PatLongLivedTracking" in trackAlgs: track.DetectorList += ["DownstreamPat"] from Configurables import PatLongLivedTracking GaudiSequencer("TrackHLT2DownstreamPatSeq").Members += [ PatLongLivedTracking("PatLongLivedTracking") ] if TrackSys().timing(): PatLongLivedTracking( "PatLongLivedTracking").TimingMeasurement = True tracklists += ["Rec/Track/Downstream"] fit = ProcessPhase("FitHLT2") GaudiSequencer("RecoTrHLT2Seq").Members += [fit] ### Clean clone and fit fit.DetectorList += ["Best"] # complete the list of track lists if "FastVelo" in trackAlgs: tracklists += ["Rec/Track/Velo"] if "VeloTT" in trackAlgs: tracklists += ["Rec/Track/VeloTT"] # create the best track creator # note the comment for the HLT1 forward fitter about configurations from TrackFitter.ConfiguredFitters import ConfiguredMasterFitter from Configurables import TrackBestTrackCreator, TrackMasterFitter, TrackStateInitTool # add and cut on the GP in the TrackBestTrackCreator # the variable is needed later addGhostProbTBTC = True bestTrackCreator = TrackBestTrackCreator(TracksInContainers=tracklists) bestTrackCreator.MaxChi2DoF = 4.0 bestTrackCreator.addTool(TrackMasterFitter, name="Fitter") bestTrackCreator.DoNotRefit = True bestTrackCreator.addTool(TrackStateInitTool, name="StateInitTool") bestTrackCreator.StateInitTool.UseFastMomentumEstimate = True # cut on ghost prob bestTrackCreator.AddGhostProb = addGhostProbTBTC bestTrackCreator.GhostIdTool = "Run2GhostId" bestTrackCreator.MaxGhostProb = 0.4 # configure its fitter and stateinittool ConfiguredMasterFitter(getattr(bestTrackCreator, "Fitter"), SimplifiedGeometry=simplifiedGeometryFit, LiteClusters=liteClustersFit, MSRossiAndGreisen=True) if "FastVelo" in trackAlgs: bestTrackCreator.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs" # add to the sequence GaudiSequencer("FitHLT2BestSeq").Members += [bestTrackCreator] ### Change dEdx correction for simulated data #if TrackSys().getProp("Simulation"): # from Configurables import StateDetailedBetheBlochEnergyCorrectionTool,DetailedMaterialLocator # from Configurables import TrackBestTrackCreator # fitter = TrackBestTrackCreator().Fitter # fitter.MaterialLocator.addTool(StateDetailedBetheBlochEnergyCorrectionTool("GeneralDedxTool")) # fitter.MaterialLocator.GeneralDedxTool.EnergyLossFactor = 0.76 # Make V0 # needs to be done after fitting, but before the extra infos from Configurables import TrackV0Finder V0 = ProcessPhase("RecV0") GaudiSequencer("RecoTrHLT2Seq").Members += [V0] V0.DetectorList += ["MakeV0"] ### Clean clone and fit trackV0Finder = TrackV0Finder("TrackV0Finder") GaudiSequencer("RecV0MakeV0Seq").Members += [trackV0Finder] ######################################################### ########################################################## addExtraInfo = ProcessPhase("AddExtraInfo") GaudiSequencer("RecoTrHLT2Seq").Members += [addExtraInfo] ## Extra track information sequence extraInfos = TrackSys().getProp("TrackExtraInfoAlgorithms") if len(extraInfos) > 0: ## Clone finding and flagging if "CloneFlagging" in extraInfos: addExtraInfo.DetectorList += ["Clones"] from Configurables import TrackBuildCloneTable, TrackCloneCleaner #trackClones = GaudiSequencer("TrackClonesSeq") if TrackSys().timing(): trackClones.MeasureTime = True cloneTable = TrackBuildCloneTable("FindTrackClones") cloneTable.maxDz = 500 * mm cloneTable.zStates = [0 * mm, 990 * mm, 9450 * mm] cloneTable.klCut = 5e3 cloneCleaner = TrackCloneCleaner("FlagTrackClones") cloneCleaner.CloneCut = 5e3 #trackClones.Members += [ cloneTable, cloneCleaner ] GaudiSequencer("AddExtraInfoClonesSeq").Members += [ cloneTable, cloneCleaner ] ## Add the likelihood information if "TrackLikelihood" in extraInfos and ('TrackLikelihood' not in exclude): addExtraInfo.DetectorList += ["TrackLikelihood"] from Configurables import TrackAddLikelihood, TrackLikelihood trackAddLikelihood = TrackAddLikelihood() trackAddLikelihood.addTool(TrackLikelihood, name="TrackMatching_likTool") trackAddLikelihood.TrackMatching_likTool.otEff = 0.9 GaudiSequencer("AddExtraInfoTrackLikelihoodSeq").Members += [ trackAddLikelihood ] ## ghost probability using a Neural Net if "GhostProbability" in extraInfos and addGhostProbTBTC is False: addExtraInfo.DetectorList += ["GhostProb"] from Configurables import TrackAddNNGhostId nn = TrackAddNNGhostId("TrackAddNNGhostdId") nn.GhostIdTool = "Run2GhostId" # to be decided GaudiSequencer("AddExtraInfoGhostProbSeq").Members += [nn] # this is very misleading (naming wise), but it will erase extra info that is put on the track by some algorithms # (not of the ones beforehand). addExtraInfo.DetectorList += ["EraseExtraInfo"] from Configurables import TrackEraseExtraInfo # erase extra info on Best tracks and on fitted Velo tracks (i.e. on everything that is saved on a DST) eraseExtraInfoBest = TrackEraseExtraInfo("TrackEraseExtraInfoBest") eraseExtraInfoFittedVelo = TrackEraseExtraInfo( "TrackEraseExtraInfoFittedVelo") eraseExtraInfoFittedVelo.InputLocation = "Rec/Track/FittedHLT1VeloTracks" GaudiSequencer("AddExtraInfoEraseExtraInfoSeq").Members += [ eraseExtraInfoBest, eraseExtraInfoFittedVelo ] ## Muon alignment tracks ## is this still needed? Looks rather old if "MuonAlign" in trackAlgs: from Configurables import TrackEventFitter, AlignMuonRec track.DetectorList += ["MuonRec"] GaudiSequencer("TrackMuonRecSeq").Members += [ AlignMuonRec("AlignMuonRec"), TrackEventFitter("MuonTrackFitter") ] importOptions("$TRACKSYSROOT/options/AlignMuonRec.opts") if TrackSys().fieldOff(): AlignMuonRec("AlignMuonRec").BField = False importOptions("$STDOPTS/DstContentMuonAlign.opts")
def RecoTracking(exclude=[]): '''What used to be in the options file, moved here''' ## 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 DecodeTracking(trackAlgs) from Configurables import STOfflinePosition IT = STOfflinePosition('ITClusterPosition') IT.DetType = "IT" TT = STOfflinePosition('TTClusterPosition') TT.DetType = "TT" from STTools import STOfflineConf STOfflineConf.DefaultConf().configureTools() #importOptions( "$STTOOLSROOT/options/Brunel.opts" ) ## Velo tracking if "FastVelo" in trackAlgs: from Configurables import FastVeloTracking GaudiSequencer("RecoVELOSeq").Members += [FastVeloTracking()] if TrackSys().timing(): FastVeloTracking().TimingMeasurement = True if "Velo" in trackAlgs: from Configurables import Tf__PatVeloGeneralTracking if TrackSys().veloOpen(): if TrackSys().beamGas(): from Configurables import Tf__PatVeloGeneric GaudiSequencer("RecoVELOSeq").Members += [ Tf__PatVeloGeneric("PatVeloGeneric"), Tf__PatVeloGeneralTracking("PatVeloGeneralTracking") ] else: from Configurables import Tf__PatVeloTrackTool GaudiSequencer("RecoVELOSeq").Members += [ Tf__PatVeloGeneralTracking("PatVeloGeneralTracking") ] Tf__PatVeloGeneralTracking( "PatVeloGeneralTracking").PointErrorMin = 2 * mm Tf__PatVeloGeneralTracking("PatVeloGeneralTracking").addTool( Tf__PatVeloTrackTool("PatVeloTrackTool")) Tf__PatVeloTrackTool("PatVeloTrackTool").highChargeFract = 0.5 if TrackSys().timing(): Tf__PatVeloGeneralTracking( "PatVeloGeneralTracking").TimingMeasurement = True else: from Configurables import (Tf__PatVeloRTracking, Tf__PatVeloSpaceTool, Tf__PatVeloSpaceTracking) GaudiSequencer("RecoVELOSeq").Members += [ Tf__PatVeloRTracking("PatVeloRTracking"), Tf__PatVeloSpaceTracking("PatVeloSpaceTracking"), Tf__PatVeloGeneralTracking("PatVeloGeneralTracking") ] Tf__PatVeloSpaceTracking("PatVeloSpaceTracking").addTool( Tf__PatVeloSpaceTool(), name="PatVeloSpaceTool") Tf__PatVeloSpaceTracking("PatVeloSpaceTracking" ).PatVeloSpaceTool.MarkClustersUsed = True if TrackSys().timing(): Tf__PatVeloSpaceTracking( "PatVeloSpaceTracking").TimingMeasurement = True Tf__PatVeloRTracking( "PatVeloRTracking").TimingMeasurement = True Tf__PatVeloGeneralTracking( "PatVeloGeneralTracking").TimingMeasurement = True ## Make sure the default extrapolator and interpolator use simplified material if TrackSys().simplifiedGeometry() and ('SimpleGeom' not in exclude): from Configurables import TrackMasterExtrapolator, TrackInterpolator TrackMasterExtrapolator().MaterialLocator = 'SimplifiedMaterialLocator' TrackInterpolator().addTool(TrackMasterExtrapolator( MaterialLocator='SimplifiedMaterialLocator'), name='Extrapolator') ## Tracking sequence from Configurables import ProcessPhase track = ProcessPhase("Track") GaudiSequencer("RecoTrSeq").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") # TrackMatching not supported anymore, raise error if "Match" in trackAlgs: raise RuntimeError( "TrackMatching not supported anymore. If you think this is wrong, report to [email protected]" ) ## Forward pattern if "Forward" in trackAlgs: track.DetectorList += ["ForwardPat"] from Configurables import PatForward GaudiSequencer("TrackForwardPatSeq").Members += [ PatForward("PatForward") ] from PatAlgorithms import PatAlgConf PatAlgConf.ForwardConf().configureAlg() if TrackSys().timing(): PatForward("PatForward").TimingMeasurement = True tracklists += ["Rec/Track/Forward"] ## Seed pattern if "TsaSeed" in trackAlgs and "PatSeed" in trackAlgs: raise RuntimeError("Cannot run both Tsa and Pat Seeding at once") if "TsaSeed" in trackAlgs: track.DetectorList += ["SeedPat"] from Configurables import Tf__Tsa__Seed, Tf__Tsa__SeedTrackCnv GaudiSequencer("TrackSeedPatSeq").Members += [ Tf__Tsa__Seed("TsaSeed"), Tf__Tsa__SeedTrackCnv("TsaSeedTrackCnv") ] from TsaAlgorithms import TsaAlgConf TsaAlgConf.TsaSeedConf().configureAlg() if TrackSys().timing(): Tf__Tsa__Seed("TsaSeed").TimingMeasurement = True if "PatSeed" in trackAlgs: track.DetectorList += ["SeedPat"] from Configurables import PatSeeding GaudiSequencer("TrackSeedPatSeq").Members += [PatSeeding("PatSeeding")] from PatAlgorithms import PatAlgConf PatAlgConf.SeedingConf().configureAlg() if TrackSys().timing(): PatSeeding("PatSeeding").TimingMeasurement = True if TrackSys().cosmics(): from PatAlgorithms import PatAlgConf PatAlgConf.CosmicConf().configureAlg() if "TsaSeed" in trackAlgs or "PatSeed" in trackAlgs: tracklists += ["Rec/Track/Seed"] # TrackMatching not supported anymore, comment for the moment in case anything breaks #if "Match" in trackAlgs : # Fit now #track.DetectorList += [ "SeedFit" ] ## Seed fit initialization #from Configurables import TrackStateInitAlg, TrackStateInitTool #initSeedFit = TrackStateInitAlg("InitSeedFit", # TrackLocation = "Rec/Track/Seed") #GaudiSequencer("TrackSeedFitSeq").Members += [initSeedFit] #if "FastVelo" in trackAlgs : # initSeedFit.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs" # Use small ErrorQoP fitter, needed for Match #GaudiSequencer("TrackSeedFitSeq").Members += [ConfiguredFitSeed()] # TrackMatching not supported anymore, comment for the moment in case anything breaks ## Match #if "Match" in trackAlgs and "PatMatch" in trackAlgs : # raise RuntimeError("Cannot run both TrackMatching and PatMatch at once") #if "Match" in trackAlgs : # track.DetectorList += [ "MatchPat" ] # from Configurables import TrackMatchVeloSeed # GaudiSequencer("TrackMatchPatSeq").Members += [ TrackMatchVeloSeed("TrackMatch") ] # from TrackMatching import TrackMatchConf # TrackMatchConf.MatchingConf().configureAlg() # TrackMatchVeloSeed("TrackMatch").LikCut = -99999. # if TrackSys().timing() : # TrackMatchVeloSeed("TrackMatch").TimingMeasurement = True; if "PatMatch" in trackAlgs: track.DetectorList += ["MatchPat"] from Configurables import PatMatch GaudiSequencer("TrackMatchPatSeq").Members += [PatMatch("PatMatch")] if "Match" in trackAlgs or "PatMatch" in trackAlgs: tracklists += ["Rec/Track/Match"] ## Downstream if "Downstream" in trackAlgs: track.DetectorList += ["DownstreamPat"] from Configurables import PatDownstream GaudiSequencer("TrackDownstreamPatSeq").Members += [PatDownstream()] tracklists += ["Rec/Track/Downstream"] from PatAlgorithms import PatAlgConf #PatAlgConf.DownstreamConf().configureAlg() if TrackSys().timing(): PatDownstream("PatDownstream").TimingMeasurement = True ## Velo-TT pattern if "VeloTT" in trackAlgs: track.DetectorList += ["VeloTTPat"] # from 2015 on, 'VeloTTHybrid' is used (as in the HLT) # on python configuration is used if dataType is "2015": from Configurables import PatVeloTTHybrid GaudiSequencer("TrackVeloTTPatSeq").Members += [ PatVeloTTHybrid("PatVeloTTHybrid") ] if TrackSys().timing(): PatVeloTTHybrid("PatVeloTTHybrid").TimingMeasurement = True # for everything older, the old 'PatVeloTT' is run else: from Configurables import PatVeloTT GaudiSequencer("TrackVeloTTPatSeq").Members += [ PatVeloTT("PatVeloTT") ] from PatVeloTT.PatVeloTTAlgConf import PatVeloTTConf PatVeloTTConf().configureAlg() if TrackSys().timing(): PatVeloTT("PatVeloTT").TimingMeasurement = True tracklists += ["Rec/Track/VeloTT"] ### Clean clone and fit track.DetectorList += ["Fit"] if TrackSys().getProp("OldCloneKiller"): from Configurables import TrackEventCloneKiller, TrackStateInitAlg, TrackContainerCopy cloneKiller = TrackEventCloneKiller() cloneKiller.TracksInContainers = tracklists cloneKiller.TracksOutContainer = "Rec/Track/AllBest" GaudiSequencer("TrackFitSeq").Members += [cloneKiller] stateInitAlg = TrackStateInitAlg("InitBestFit") stateInitAlg.TrackLocation = "Rec/Track/AllBest" if "FastVelo" in trackAlgs: stateInitAlg.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs" GaudiSequencer("TrackFitSeq").Members += [stateInitAlg] GaudiSequencer("TrackFitSeq").Members += [ ConfiguredFit("FitBest", "Rec/Track/AllBest") ] copyBest = TrackContainerCopy("CopyBest") copyBest.inputLocations = ["Rec/Track/AllBest"] GaudiSequencer("TrackFitSeq").Members += [copyBest] ## Velo fitting if "Velo" in trackAlgs or "FastVelo" in trackAlgs: ## Prepare the velo tracks for the fit track.DetectorList += ["VeloFit"] from Configurables import TrackPrepareVelo GaudiSequencer("TrackVeloFitSeq").Members += [TrackPrepareVelo()] ## Fit the velo tracks GaudiSequencer("TrackVeloFitSeq").Members += [ ConfiguredFit("FitVelo", "Rec/Track/PreparedVelo") ] ## copy the velo tracks to the "best" container copyVelo = TrackContainerCopy("CopyVelo") copyVelo.inputLocations = ["Rec/Track/PreparedVelo"] GaudiSequencer("TrackVeloFitSeq").Members += [copyVelo] else: # complete the list of track lists if "Velo" in trackAlgs or "FastVelo" in trackAlgs: tracklists += ["Rec/Track/Velo"] # create the best track creator from Configurables import TrackBestTrackCreator bestTrackCreator = TrackBestTrackCreator(TracksInContainers=tracklists) # configure its fitter and stateinittool ConfiguredMasterFitter(bestTrackCreator.Fitter) if "FastVelo" in trackAlgs: bestTrackCreator.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs" # add to the sequence GaudiSequencer("TrackFitSeq").Members.append(bestTrackCreator) ### Change dEdx correction for simulated data if TrackSys().getProp("Simulation"): from Configurables import StateDetailedBetheBlochEnergyCorrectionTool, DetailedMaterialLocator if TrackSys().getProp("OldCloneKiller"): from Configurables import TrackEventFitter, TrackMasterFitter fitBest = TrackEventFitter("FitBest") fitBest.Fitter.MaterialLocator.addTool( StateDetailedBetheBlochEnergyCorrectionTool("GeneralDedxTool")) fitBest.Fitter.MaterialLocator.GeneralDedxTool.EnergyLossFactor = 0.76 else: from Configurables import TrackBestTrackCreator fitter = TrackBestTrackCreator().Fitter fitter.MaterialLocator.addTool( StateDetailedBetheBlochEnergyCorrectionTool("GeneralDedxTool")) fitter.MaterialLocator.GeneralDedxTool.EnergyLossFactor = 0.76 ## Extra track information sequence extraInfos = TrackSys().getProp("TrackExtraInfoAlgorithms") if len(extraInfos) > 0: track.DetectorList += ["AddExtraInfo"] ## Clone finding and flagging if "CloneFlagging" in extraInfos: from Configurables import TrackBuildCloneTable, TrackCloneCleaner trackClones = GaudiSequencer("TrackClonesSeq") GaudiSequencer("TrackAddExtraInfoSeq").Members += [trackClones] if TrackSys().timing(): trackClones.MeasureTime = True cloneTable = TrackBuildCloneTable("FindTrackClones") cloneTable.maxDz = 500 * mm cloneTable.zStates = [0 * mm, 990 * mm, 9450 * mm] cloneTable.klCut = 5e3 cloneCleaner = TrackCloneCleaner("FlagTrackClones") cloneCleaner.CloneCut = 5e3 trackClones.Members += [cloneTable, cloneCleaner] ## Add expected hit information #if "ExpectedHits" in extraInfos : # GaudiSequencer("TrackAddExtraInfoSeq").Members += [ TrackComputeExpectedHits() ] ## Add the likelihood information if "TrackLikelihood" in extraInfos and ('TrackLikelihood' not in exclude): from Configurables import TrackAddLikelihood, TrackLikelihood trackAddLikelihood = TrackAddLikelihood() trackAddLikelihood.addTool(TrackLikelihood, name="TrackMatching_likTool") trackAddLikelihood.TrackMatching_likTool.otEff = 0.9 GaudiSequencer("TrackAddExtraInfoSeq").Members += [ trackAddLikelihood ] ## ghost probability using a Neural Net if "GhostProbability" in extraInfos: from Configurables import TrackAddNNGhostId, TrackNNGhostId nn = TrackAddNNGhostId() GaudiSequencer("TrackAddExtraInfoSeq").Members += [nn] track.DetectorList += ["EraseExtraInformation"] from Configurables import TrackEraseExtraInfo GaudiSequencer("TrackEraseExtraInformationSeq").Members += [ TrackEraseExtraInfo() ] ## Muon alignment tracks if "MuonAlign" in trackAlgs: from Configurables import TrackEventFitter, AlignMuonRec track.DetectorList += ["MuonRec"] GaudiSequencer("TrackMuonRecSeq").Members += [ AlignMuonRec("AlignMuonRec"), TrackEventFitter("MuonTrackFitter") ] importOptions("$TRACKSYSROOT/options/AlignMuonRec.opts") if TrackSys().fieldOff(): AlignMuonRec("AlignMuonRec").BField = False importOptions("$STDOPTS/DstContentMuonAlign.opts")