def algorithm(self): Name = self._name inputTrackLocation = self._inputLocation from Configurables import GaudiSequencer, HltTrackConverter, TrackContainerCopy, Escher from Configurables import TrackContainerCopy, TrackSelector trackRefitSeq = GaudiSequencer( self.name() + "Seq") # GaudiSequencer("TrackRefitSeq") # create a track list for tracks with velo hits velotrackselector = TrackContainerCopy( "GoodLongRefittedVeloTracks", inputLocations=["Rec/Track/Best"], outputLocation="Rec/Track/GoodLongRefittedVeloTracks", Selector=TrackSelector()) velotrackselector.Selector.MinNVeloRHits = 7 velotrackselector.Selector.MinNVeloPhiHits = 6 # refit the tracks in that list from TrackFitter.ConfiguredFitters import * velotrackrefitter = ConfiguredEventFitter( Name="TracksWithVeloHitsFitter", TracksInContainer="Rec/Track/GoodLongRefittedVeloTracks", FieldOff=True) velotrackrefitter.Fitter.MeasProvider.IgnoreIT = True velotrackrefitter.Fitter.MeasProvider.IgnoreOT = True velotrackrefitter.Fitter.MeasProvider.IgnoreTT = True velotrackrefitter.Fitter.MeasProvider.IgnoreMuon = True velotrackrefitter.Fitter.MakeNodes = True velotrackrefitter.Fitter.MakeMeasurements = True trackRefitSeq.Members += [velotrackselector, velotrackrefitter] return trackRefitSeq
def configureSelector(self, a): from Configurables import TrackSelector a.Selector = TrackSelector() a.Selector.MinPCut = 50000 a.Selector.TrackTypes = ["Ttrack"] if self._fitted: a.Selector.MaxChi2Cut = 5
def configureSelector(self, a): from Configurables import TrackSelector a.Selector = TrackSelector() a.Selector.TrackTypes = ["Velo", "Backward"] a.Selector.MinNVeloRHits = 4 a.Selector.MinNVeloPhiHits = 4 a.Selector.MaxNVeloHoles = 0 if self._fitted: a.Selector.MaxChi2Cut = 5
def configureSelector(self, a): from Configurables import TrackSelector a.Selector = TrackSelector() a.Selector.MinPCut = 5000 a.Selector.MaxPCut = 200000 a.Selector.MinPtCut = 200 a.Selector.MaxNTHoles = 1 a.Selector.TrackTypes = ["Long"] if self._fitted: a.Selector.MaxChi2Cut = 5 a.Selector.MaxChi2PerDoFMatch = 5 a.Selector.MaxChi2PerDoFVelo = 5 a.Selector.MaxChi2PerDoFDownstream = 5
def configuredFitAndHitAdderSequence(Name, InputLocation, OutputLocation): from TrackFitter.ConfiguredFitters import ConfiguredEventFitter from Configurables import (TrackHitAdder, TrackContainerCopy, TrackSelector, GaudiSequencer, TrackStateInitAlg) # create the sequence if isinstance(Name, GaudiSequencer): seq = Sequence Name = seq.name() Name.replace('Sequence', '') Name.replace('Seq', '') else: seq = GaudiSequencer(Name + 'Seq') # I am lazy: use the DOD to get the decoded clusters #importOption( "$STDOPTS/DecodeRawEvent.py" ) # now setup the fitters seq.Members += [ TrackStateInitAlg(Name + 'FitInit', TrackLocation=InputLocation), ConfiguredEventFitter(Name + 'FitBeforeHitAdder', TracksInContainer=InputLocation), TrackHitAdder(Name + 'HitAdder', TrackLocation=InputLocation), ConfiguredEventFitter(Name + 'FitAfterHitAdder', TracksInContainer=InputLocation) ] tracksel = TrackContainerCopy(Name + 'CopyAndSelect', inputLocations=[InputLocation], outputLocation=OutputLocation, Selector=TrackSelector()) # also apply a selection tracksel.Selector.MaxChi2Cut = 5 tracksel.Selector.MaxChi2PerDoFMatch = 5 tracksel.Selector.MaxChi2PerDoFVelo = 5 tracksel.Selector.MaxChi2PerDoFDownstream = 5 seq.Members.append(tracksel) return seq
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"]
## Here we configure the track fitting/selection and what else? ## importOptions( trackingOpts ) from Configurables import (GetElementsToBeAligned, TrackContainerCopy, TrackSelector, Al__VertexResidualTool, Al__AlignConstraintTool) #trackselectortool = TrackSelector( MinPCut = "3000", MaxChi2Cut="20", TrackTypes = [ "Long","Upstream","Velo" ] ) #trackselectortool = TrackSelector( MaxChi2Cut="20", TrackTypes = [ "Long","Upstream","Velo" ] ) elements = TAlignment().getProp("ElementsToAlign") print "Elements = ", elements 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"])
constraints.append( "VPFixModule41 : VP/VPRight/Module41WithSupport: Tx Ty Tz Rx Ry Rz") constraints.append( "VPFixModule50 : VP/VPLeft/Module50WithSupport: Tx Ty Tz Rx Ry Rz") constraints.append( "VPFixModule51 : VP/VPRight/Module51WithSupport: Tx Ty Tz Rx Ry Rz") # constraints = [] print "aligning elements ", elements trackRefitSeq = GaudiSequencer("TrackRefitSeq") # create a track list for tracks with velo hits velotrackselector = TrackContainerCopy( "TracksWithVeloHits", inputLocation="Rec/Track/Best", outputLocation="Rec/Track/TracksWithVeloHits", Selector=TrackSelector()) # refit the tracks in that list velotrackrefitter = ConfiguredEventFitter( Name="TracksWithVeloHitsFitter", TracksInContainer="Rec/Track/TracksWithVeloHits", FieldOff=True) velotrackrefitter.Fitter.MeasProvider.IgnoreIT = True velotrackrefitter.Fitter.MeasProvider.IgnoreOT = True velotrackrefitter.Fitter.MeasProvider.IgnoreTT = True velotrackrefitter.Fitter.MeasProvider.IgnoreMuon = True velotrackrefitter.Fitter.MeasProvider.IgnoreUT = True velotrackrefitter.Fitter.MakeNodes = True velotrackrefitter.Fitter.MakeMeasurements = True trackRefitSeq.Members += [velotrackselector, velotrackrefitter]
def doMyAlignChanges(): from Configurables import TrackEventFitter, VeloTrackSelector from TrackFitter.ConfiguredFitters import ConfiguredStraightLineFitter TweakFitter(TrackEventFitter('FitMatch')) TweakFitter(TrackEventFitter('FitForward')) TweakFitter(TrackEventFitter('FitSeed')) TweakFitter(TrackEventFitter('FitVelo')) TweakFitter(TrackEventFitter('FitVeloTT')) TweakFitter(TrackEventFitter('RefitSeed')) TweakFitter(TrackEventFitter('TrackRefitter')) # add a filter on Velo tracks from Configurables import TrackListFilter GaudiSequencer("RecoVELOSeq").Members += [ TrackListFilter("VeloFilter", inputLocation="Rec/Track/Velo") ] GaudiSequencer("RecoVELOSeq").Members += [ TrackContainerCopy('VeloOnlyContainerCopy', inputLocation="Rec/Track/Velo", outputLocation="Rec/Track/VeloOnly", copyFailures=True, Selector=None), ConfiguredStraightLineFitter('VeloOnlyFitter', TracksInContainer="Rec/Track/VeloOnly") ] veloOnlyRefiner = TrackListRefiner( "VeloOnlySelector", inputLocation="Rec/Track/VeloOnly", outputLocation="Rec/Track/SelectedVeloOnly", Selector=TrackSelector()) veloOnlyRefiner.Selector.MaxChi2Cut = 5 #veloOnlyRefiner.OutputLevel = 1 GaudiSequencer("RecoVELOSeq").Members.append(veloOnlyRefiner) GaudiSequencer("RecoVELOSeq").Members += [ TrackListRefiner('VeloASideSelector', inputLocation="Rec/Track/SelectedVeloOnly", outputLocation="Rec/Track/VeloASide", Selector=VeloTrackSelector()), TrackCaloMatchMonitor("VeloAEcalMatchMonitor", TrackLocation='Rec/Track/VeloASide', CaloSystem='Ecal', RequireTHits=False) ] TrackListRefiner('VeloASideSelector').Selector.MinHitsASide = 6 GaudiSequencer("RecoVELOSeq").Members += [ TrackListRefiner('VeloCSideSelector', inputLocation="Rec/Track/SelectedVeloOnly", outputLocation="Rec/Track/VeloCSide", Selector=VeloTrackSelector()), TrackCaloMatchMonitor("VeloCEcalMatchMonitor", TrackLocation='Rec/Track/VeloCSide', CaloSystem='Ecal', RequireTHits=False) ] TrackListRefiner('VeloCSideSelector').Selector.MinHitsCSide = 6 from Configurables import AlRobustAlignAlg GaudiSequencer("AlignMonitorSeq").Members += [ AlRobustAlignAlg('VeloARobustAlign', TrackLocation="Rec/Track/VeloASide"), AlRobustAlignAlg('VeloCRobustAlign', TrackLocation="Rec/Track/VeloCSide") ] GaudiSequencer("AlignPostMonitorSeq").Members += [ AlRobustAlignAlg('VeloARobustAlignPost', TrackLocation="Rec/Track/VeloASide"), AlRobustAlignAlg('VeloCRobustAlignPost', TrackLocation="Rec/Track/VeloCSide") ] from Configurables import Tf__Tsa__Seed, Tf__Tsa__SeedAddHits tsaSeed = Tf__Tsa__Seed("TsaSeed") tsaSeed.addTool(Tf__Tsa__SeedAddHits(), name="SeedAddHits") # tolerance if inside box mm tsaSeed.SeedAddHits.tol = 5 # tolerance window make bigger mmm tsaSeed.SeedAddHits.dCut = 2 # chi-sq cut tsaSeed.SeedAddHits.outlierCutParabola = 5 from Configurables import STOfflinePosition itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition') itClusterPosition.ErrorVec = [0.28, 0.22, 0.35, 0.35] itClusterPosition.APE = 0.1 from Configurables import TrackFieldOffMatchMonitor seedRefiner = TrackListRefiner("SeedSelector", inputLocation="Rec/Track/Seed", outputLocation="Rec/Track/SelectedSeed", Selector=TrackSelector()) seedRefiner.Selector.MaxChi2Cut = 5 GaudiSequencer('MoniTrSeq').Members += [ seedRefiner, TrackFieldOffMatchMonitor( VeloTrackLocation='Rec/Track/SelectedVeloOnly', SeedTrackLocation='Rec/Track/SelectedSeed') ] from Configurables import TrackMatchVeloSeed TrackMatchVeloSeed("TrackMatch").Chi2MatchingCut = 500
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 ##############################################################################
# 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)
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 ##############################################################################
TAlignment().ElementsToAlign = list(elements) TAlignment().TrackLocation = "Rec/Track/AlignTracks" TAlignment().VertexLocation = "Rec/Vertex/Primary" TAlignment().Constraints = constraints TAlignment().WriteCondSubDetList = ['Velo'] TAlignment().EigenValueThreshold = 100 # 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 = 4, MinNVeloPhiHits = 4) ) trackFilterSeq.Members.append( alignSelector ) # Load the velo misalignment from Configurables import ( CondDB, CondDBAccessSvc ) veloCond = CondDBAccessSvc( 'VeloAlignCond' ) veloCond.ConnectionString = 'sqlite_file:/afs/cern.ch/lhcb/group/tracking/vol7/wouter/DB/B2HH_LHCBCOND_Velo-slice_5sigma.db/LHCBCOND' #veloCond.ConnectionString = 'sqlite_file:/afs/cern.ch/lhcb/group/tracking/vol7/wouter/DB/B2HH_LHCBCOND_Velo-slice_5sigma_aligned.db/LHCBCOND' CondDB().addLayer( veloCond ) ############################################################################## # I/O datasets are defined in a separate file, see examples in 2008-TED_Data.py ##############################################################################