The CMS.TrackerTrackHitFilter: a tool for excluding hits from tracker tracks


The CMS.TrackerTrackHitFilter is a CMSSW module contained in the RecoTracker/CMS.FinalTrackSelectors package. It loops over all the hits of a tracker track (independent of the tracking algo you used) and checks for each of them that some requirements set by the user are satisfied. This module supersedes the old Alignment/TrackHitFilter. The output of the CMS.TrackerTrackHitFilter is a TrackCandidate that must be given to a TrackProducer in order to have a final track in which the 'bad hits' which did not pass the previous selections are not taken into account during the fit of the track parameters. The main development was done in the scope of the tracker alignment group, in which it is important to get rid of poor quality hits which can bias significantly the residual distributions and consequently the alignment results. The actual features of the CMS.TrackerTrackHitFilter are:

  • exclude/keep hits from a specific subdetector or layer of the TK
  • exclude hits with a Signal/Noise ratio (S/N) outside a user-defined range (can be different for each of the six subdetectors)
  • exclude hits from specific modules
  • choose whether to strip or make invalid the excluded hits
  • exclude hits in which the TrackTrajectory crossed the module with a too grazing angle
  • exclude pixel hits with bad quality according to the PixelTemplate algorithm
  • strip bad hits at the beginning or the end of the hit collection of the final track candidate


Recipe for 22X

Check out the following packages:

  • cvs co -r V04-00-01 AnalysisDataFormats/SiStripClusterInfo
  • cvs co -r clusterProb22x CondFormats/SiPixelObjects
  • cvs co -r clusterProb22x DataFormats/TrackerRecHit2D
  • cvs co -r clusterProb22x_v3 CMS.RecoLocalTracker/SiPixelRecHits
  • cvs co -r clusterProb22x RecoTracker/TransientTrackingRecHit
  • cvs co -r clusterProb22x TrackingTools/TransientTrackingRecHit
  • cvs co -r V00-12-00-07 RecoTracker/CMS.FinalTrackSelectors
  • cvs co -r V00-18-12 RecoTracker/CMS.FinalTrackSelectors/src/
  • cvs co -r V00-18-12 RecoTracker/CMS.FinalTrackSelectors/python/

and compile

Recipe for 31X

Check out the package

  • cvs co -r V00-18-12 RecoTracker/CMS.FinalTrackSelectors

and be happy wink

Recipe for 33X

Check out the package in release

  • cvs co -r V00-19-00 RecoTracker/CMS.FinalTrackSelectors


The hit filter does not give you a track!!! It creates a TrackCandidate that needs to be given as input to the TrackProducer in order to have a nice track that you can use in your analysis. This means that in the path in your cfg the CMS.TrackerTrackHitFilter must be always followed by a TrackProducer module. Always about the path: some of the HitFilter features require the usage of trajectories rather plain tracks. One of the switches in the cfg is 'useTrajectories' that must be set to true if you want to use one of these features (you can run on trajectories even if you don't really need it, however). Of course, if you choose to use the trajectories and you don't put a TracksToTrajectories or TrackRefitter module (that create a transient trajectory out from the track) in front of the HitFilter, you will get a bad crash. Attached to this twiki there is an example cfg that uses the CMS.TrackerTrackHitFilter. A code snippet working with cosmic tracks can be the following

#includes needed
process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")  #this is needed by the TrackRefitter and the TrackProducer

# parameters for TrackRefitter
import RecoTracker.TrackProducer.TrackRefitters_cff
process.TrackRefitter1 = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone()
process.TrackRefitter1.src = 'ALCARECOTkAlCosmicsCTF0T'
process.TrackRefitter1.TrajectoryInEvent = True #if you set 'True' in CMS.TrackerTrackHitFilter.useTrajectories, this must also be 'True'
process.TrackRefitter1.TTRHBuilder = "WithAngleAndTemplate"

#TrackRefitter1 takes the tracks from the "ALCARECOTkAlCosmicsCTF0T" collection and refits them putting the trajectory in the event

# CMS.TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
process.TrackerTrackHitFilter.src = 'TrackRefitter1'
process.TrackerTrackHitFilter.useTrajectories= True  # this is needed only if you require some selections; but it will work even if you don't ask for them
process.TrackerTrackHitFilter.minimumHits = 6
process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
process.TrackerTrackHitFilter.replaceWithInactiveHits = True
process.TrackerTrackHitFilter.stripAllInvalidHits = False
process.TrackerTrackHitFilter.rejectBadStoNHits = True
process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
process.TrackerTrackHitFilter.rejectLowAngleHits= True
process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
process.TrackerTrackHitFilter.usePixelQualityFlag= True

#now we give the TrackCandidate coming out of the CMS.TrackerTrackHitFilter to the track producer
import RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff
process.ctfProducerCustomised = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksP5.clone()
process.ctfProducerCustomised.src = 'CMS.TrackerTrackHitFilter'
#.. plus any other settings you prefer for your trackproducer

#the process path, finally
process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.TrackerTrackHitFilter*process.ctfProducerCustomised)


The steerings available are the following:

  • src (string) = the track (trajectory) collection given in input to the HitFilter (def.: "generalTracks")
  • useTrajectories (bool) = if you want that the HitFilter loops on Trajectories rather than tracks (def.: False). Needs to be true if you set any of the following steerings as true:
    • rejectLowAngleHits
    • tagOverlaps
  • minimumHits (uint32) = if the number of valid hits after all the selections is below (<) this number, the track is rejected (def.: 3)
  • replaceWithInactiveHits (bool) = rejected hits can be either excluded (stripped) from the final hit collection contained in the TrackCandidate or held as invalid. The advantage of the latter is that the TrackProducer will still consider these invalid hits when estimating the multiple scattering effects, hence improving the quality of the fit (def.: False)
  • stripFrontInvalidHits and stripBackInvalidHits (bool) = strip invalid & inactive hits from any end of the track (def.: False)
  • stripAllInvalidHits (bool) = strip all invalid & inactive hits (again, careful, it may be not a good idea because of the MS estimation) (def.: False)
  • commands (vstring) = list of commands specifying the subdetectors and the layers that you want to reject (hold). In order to be understood by the parser, each string you enter here must have either the drop or the keep words as first fields, followed by the subdet where you want to apply the rule (the possibilities are PXB, PXE, TIB, TOB, TID, TEC) and (not required) the number of the layer. For example
    process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","drop PXE","keep TIB","drop TID 3","keep TOB","keep TEC")
    will select only the hits from pixel barrel, TIB, the first two wheels of TID, TOB, TEC. The hits from pixel endcap or TID wheel 3 will be kicked out or flagged as invalid according to your choice of replaceWithInactiveHits. If you want to keep only one layer after having dropped the entire structure, you can in the following way:
    process.TrackerTrackHitFilter.commands = cms.vstring("drop TIB", "keep TIB 4")
  • detsToIgnore (vuint32) = a list of DetIds of the modules you want to reject. If a hit was collected by a module belonging to the list, it is rejected. Important: the hit filter wants the IDs of the det units. If you set the id of the det, it will not do what you want. (def.:"")
  • rejectBadStoNHits (bool) = flag that switches on the control on the S/N ratio of the hits (def.: False)
  • StoNcommands (vstring) = a set of commands, similar to commands with your desired selections on the S/N selection. It is ignored if rejectBadStoNHits is set to False. In order to be understood by the parser, each string you enter here must have as first field the subdetector where you want to apply the rule, followed by a number that is the lowest threshold on the S/N. The third field is not mandatory and is the higher threshold on the S/N. For example:
    process.TrackerTrackHitFilter.StoNcommands = cms.vstring("TOB 18.0")
    will apply the S/N check only to TOB hits and will reject hits with S/N < 18.0. The special field "ALL" applies the same S/N selection to all the subdets:
    process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
  • CMNSubtractionMode (string) = the common mode subtraction mode you prefer to use when calculating the S/N (def:"Median")
  • rejectLowAngleHits (bool) = main switch if you want to apply a cut on the angle between the track and the surface of the module (def.: False)
  • TrackAngleCut (double) = the minimum angle between the track and the module surface for holding the hit. The angle is measured starting from the module surface ! The angle is expressed in radians (def.: 0.25)
  • tagOverlaps (bool) = the CMS.TrackerTrackHitFilter has the possibility to check if the hit is in the overlap region between two neighboring modules. No actions are implemented at the moment, but the core of the overlap finder is there (def.: False)
  • usePixelQualityFlag (bool) = if you want to apply a selection on the pixel (both barrel and forward) hits based on the template quality (def.: False. Cuts are configurable, but the defaults are set to the values suggested to the experts):
    • the pixel template code should give a probability value (i.e. the pixel cluster shape and trajectory angle should be within the template validity range)
    • the pixel cluster shape in the x-direction should be compatible with the template one with a probability > cut configurable
    • the pixel cluster shape in the y-direction should be compatible with the template one with a probability > cut configurable
    • the qBin from the pixel templates should be within a configurable range
    • cut on cluster charge corrected by the track angle

Known bugs/limitations

  • the trajectory angle cut should be made changeable for subdet like the S/N cut
  • a hit rejection based on geometrical selections (phi, eta, z, etc.) would be nice



Review status

Reviewer/Editor and Date (copy from screen) Comments
AlessioBonato - 14 Apr 2009 created template page

Responsible: AlessioBonato
Last reviewed by: AlessioBonato

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt r1 manage 18.7 K 2009-04-16 - 13:25 AlessioBonato Example of a HIPAlignment cfg file that uses the new TrackerTrackHitFilter
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r11 - 2009-12-08 - AlessioBonato
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback