Track residual study

Purpose

We want to include the unbiased track residuals in RECO data. The track residuals will be handy information for identifying kinks in muon decays in flight, showering pions etc. In particular, we intend the detailed view of a track in the event display to show the hit residual in each layer.

To include the residuals in RECO in a space-efficient way, we do the following:

  1. decide how to store the residual information:
    • residual in cm
    • residual in units of the (trajectory + hit) error
    • residual in units of the hit error
  2. determine the required precision
  3. propose a data structure for storing the residuals in TrackExtra and access methods

How to store the residual information?

There are three choices for storing the residual information:

  1. residual in units of the (trajectory + hit) error
  2. residual in cm
  3. residual in units of the hit error

The advantage of using the residual in units of the (trajectory + hit) error (the pull) is that everything is contained in the -5 < pull < 5 range. The disadvantage is that we won't be able to recover the numerator and denominator separately.

The advantage of using the residual in cm is that we can recover the trajectory. The disadvantage is that the distribution is very wide and that we don't recover the errors on the trajectory.

The advantage of using the residual in units of the hit error is that we can recover the trajectory. The disadvantage is that we don't recover the errors on the trajectory. We expect this distribution to be narrower than the residual distribution, but it is still wide compared to the pull distribution. I propose that we store the residual information in this format.

Here is what the options look like for ttbar, ideal geometry (with the tight track filter applied), for the barrel detectors (layers 1-3: PXB; 4-7: TIB; 8-13: TOB):

Misalignment can broaden and bias the distributions considerably. This is probably not our worry; nevertheless, here are the distributions from the same ttbar sample with the STARTUP_V1 geometry:

Here are the disk detectors (layers 1-2: PXF; 3-5: TID; 6-14: TEC):

Precision

I propose using four bits (including one sign bit) per hit to encode the residual. If we chose to store the pull, a natural assignment would be

three-bit encoding 0 1 2 3 4 5 6 7
pull value 0...0.5 0.5...1 1...1.5 1.5...2 2...3 3...4 4...5 >5

In the barrel, the same assignment also works well if we store residual / hit error. The only proposed modification is to widen the ranges in the first and last layer by a factor 2. See the cumulative distribution in local x and in local y.

In the disks, we can use the widened assignment in the pixel detectors. In the strip detectors, a uniform encoding makes more sense, since the distribution of residual / hit error is mostly flat. See the cumulative distribution in local x and in local y.

Do the stereo layers need different precision than the r-phi? These plots (comparing the r-phi in black and stereo in red in the layers that have both kinds of sensors) suggest that we can use the same precision for both: in the barrel, in the disks.

Data format

For the barrel detectors, I propose storing residual information in local x for every valid hit (i.e., if there are multiple hits in a layer, multiple residuals are stored). In local y, only the pixels contain useful information (see these residual distributions).

For the disk detectors, the proposal is the same (except that the encoding is slightly modified, see the previous section). Like in the barrel, only the pixels contain useful information in local y (see these residual distributions).

The residual data should be stored in a small class. TrackExtra will have a new data member of this class. The class provides methods that decode the residual information back into floats.

For local x, the class contains an array of size (4 bits x n_max) (where n_max is a reasonable maximal number of hits). Only the first (4 bits x n_valid) (where n_valid is the number of valid hits on the track, which is stored in TrackBase) is written to disk.

For local y, the class contains an array of size (4 bits x n_max) (where n_max is a reasonable maximal number of pixel hits). Only the first (4 bits x n_valid) (where n_valid is the number of valid pixel hits on the track, which is calculable from HitPattern in TrackBase) is written to disk.

In the ttbar sample, the average size of the residual information would be (17 local x + 3 local y) / track x 4 bits = 10 bytes / track.

The HitPattern in TrackBase can be used to determine the layer of a given residual.

Data format implementation

  • the residuals are stored in a class (TrackResiduals)
  • only residuals for valid hits are stored
  • residuals are requested from TrackResiduals by index; this index is aligned with HitPattern
  • to translate the HitPattern-index to an index into the array of stored residuals, TrackResiduals needs access to the HitPattern; this leads to the following implementation
    • the TrackResiduals method that returns the residual for the ith hit takes a const Track & as an argument
    • TrackExtra contains a private member of class TrackResiduals and a method that returns the residual for the ith hit given a const Track & as an argument
    • Track contains a method that returns the residual for the ith hit if TrackBase is present
  • the preferred way to get a residual is through Track::residual (int i); the other ways require the user to make sure he's passing in the right HitPattern

Extension of HitPattern to include r-phi/stereo bit

Because we rely on the hit pattern in TrackBase to translate between an index in the track residuals array and a layer in the detector, we need to add to HitPattern whether a hit is in the mono or the stereo side of a module. We therefore extend the HitPattern as follows:

//      +-----+-----+-----+-----+-----+-----+-----+-----+----------------+-----+-----+
//      |tk/mu|  sub-structure  |   sub-sub-structure   |     stereo     |  hit type |
//      +-----+-----+-----+-----+-----+-----+-----+-----+----------------+-----+-----+
//  ... | 10  |   9    8     7  |   6    5     4     3  |        2       |  1     0  | bit
//
//      |tk = 1      PXB = 1            layer = 1-3                       hit type = 0-3
//      |tk = 1      PXF = 2            disk  = 1-2                       hit type = 0-3
//      |tk = 1      TIB = 3            layer = 1-4      0=rphi,1=stereo  hit type = 0-3
//      |tk = 1      TID = 4            wheel = 1-3      0=rphi,1=stereo  hit type = 0-3
//      |tk = 1      TOB = 5            layer = 1-6      0=rphi,1=stereo  hit type = 0-3
//      |tk = 1      TEC = 6            wheel = 1-9      0=rphi,1=stereo  hit type = 0-3
//      |mu = 0      DT  = 1            layer                             hit type = 0-3
//      |mu = 0      CSC = 2            layer                             hit type = 0-3
//      |mu = 0      RPC = 3            layer                             hit type = 0-3
//
//      hit type, see DataFormats/TrackingRecHit/interface/TrackingRecHit.h
//      valid    = valid hit                                     = 0
//      missing  = detector is good, but no rec hit found        = 1
//      inactive = detector is off, so there was no hope         = 2
//      bad      = there were many bad strips within the ellipse = 3

comparison

hit patterns before the layout was changed			hit patterns after the additional bit was added, but before it was	hit patterns after the additional bit was added and filled with the
								   filled							  	   sensor side 							   
																  									   
HitPattern							HitPattern							  	HitPattern							   
	tracker	substructure 1	layer 1	hit type 0			tracker	substructure 1	layer 1	hit type 0		  		tracker	substructure 1	layer 1	hit type 0		   
	tracker	substructure 1	layer 2	hit type 0			tracker	substructure 1	layer 2	hit type 0		  		tracker	substructure 1	layer 2	hit type 0		   
	tracker	substructure 1	layer 3	hit type 0			tracker	substructure 1	layer 3	hit type 0		  		tracker	substructure 1	layer 3	hit type 0		   
	tracker	substructure 1	layer 3	hit type 0			tracker	substructure 1	layer 3	hit type 0		  		tracker	substructure 1	layer 3	hit type 0		   
	tracker	substructure 3	layer 1	hit type 0			tracker	substructure 3	layer 1	hit type 0		  		tracker	substructure 3	layer 1	hit type 0		   
	tracker	substructure 3	layer 1	hit type 0			tracker	substructure 3	layer 1	hit type 0		  		tracker	substructure 3	layer 1	hit type 0		   
	tracker	substructure 3	layer 2	hit type 0			tracker	substructure 3	layer 2	hit type 0		  		tracker	substructure 3	layer 2	hit type 0		   
	tracker	substructure 3	layer 2	hit type 0			tracker	substructure 3	layer 2	hit type 0		  		tracker	substructure 3	layer 2	hit type 0		   
	tracker	substructure 4	layer 1	hit type 0			tracker	substructure 4	layer 1	hit type 0		  		tracker	substructure 4	layer 1	hit type 0		   
	tracker	substructure 5	layer 1	hit type 0			tracker	substructure 5	layer 1	hit type 0		  		tracker	substructure 5	layer 1	hit type 0		   
	tracker	substructure 5	layer 1	hit type 0			tracker	substructure 5	layer 1	hit type 0		  		tracker	substructure 5	layer 1	hit type 0		   
	tracker	substructure 6	layer 1	hit type 0			tracker	substructure 6	layer 1	hit type 0		  		tracker	substructure 6	layer 1	hit type 0		   
	tracker	substructure 6	layer 2	hit type 0			tracker	substructure 6	layer 2	hit type 0		  		tracker	substructure 6	layer 2	hit type 0		   
	tracker	substructure 6	layer 3	hit type 0			tracker	substructure 6	layer 3	hit type 0		  		tracker	substructure 6	layer 3	hit type 0		   
	tracker	substructure 6	layer 4	hit type 0			tracker	substructure 6	layer 4	hit type 0		  		tracker	substructure 6	layer 4	hit type 0		   
0x244								0x488								  	0x488								   
0x248								0x490								  	0x490								   
0x24c								0x498								  	0x498								   
0x24c								0x498								  	0x498								   
0x2c4								0x588								  	0x58c								   
0x2c4								0x588								  	0x588								   
0x2c8								0x590								  	0x594								   
0x2c8								0x590								  	0x590								   
0x304								0x608								  	0x608								   
0x344								0x688								  	0x688								   
0x344								0x688								  	0x68c								   
0x384								0x708								  	0x708								   
0x388								0x710								  	0x710								   
0x38c								0x718								  	0x718								   
0x390								0x720								  	0x720								   
HitPattern							HitPattern							  	HitPattern							   
	tracker	substructure 1	layer 1	hit type 0			tracker	substructure 1	layer 1	hit type 0		  		tracker	substructure 1	layer 1	hit type 0		   
	tracker	substructure 1	layer 3	hit type 0			tracker	substructure 1	layer 3	hit type 0		  		tracker	substructure 1	layer 3	hit type 0		   
	tracker	substructure 3	layer 1	hit type 1			tracker	substructure 3	layer 1	hit type 1		  		tracker	substructure 3	layer 1	hit type 1		   
	tracker	substructure 4	layer 1	hit type 0			tracker	substructure 4	layer 1	hit type 0		  		tracker	substructure 4	layer 1	hit type 0		   
	tracker	substructure 4	layer 2	hit type 0			tracker	substructure 4	layer 2	hit type 0		  		tracker	substructure 4	layer 2	hit type 0		   
0x244								0x488								  	0x488								   
0x24c								0x498								  	0x498								   
0x2c5								0x589								  	0x589								   
0x304								0x608								  	0x608								   
0x308								0x610								  	0x610								   
HitPattern							HitPattern							  	HitPattern							   
	tracker	substructure 1	layer 1	hit type 0			tracker	substructure 1	layer 1	hit type 0		  		tracker	substructure 1	layer 1	hit type 0		   
	tracker	substructure 1	layer 3	hit type 0			tracker	substructure 1	layer 3	hit type 0		  		tracker	substructure 1	layer 3	hit type 0		   
	tracker	substructure 3	layer 1	hit type 1			tracker	substructure 3	layer 1	hit type 1		  		tracker	substructure 3	layer 1	hit type 1		   
	tracker	substructure 4	layer 1	hit type 1			tracker	substructure 4	layer 1	hit type 1		  		tracker	substructure 4	layer 1	hit type 1		   
	tracker	substructure 4	layer 2	hit type 0			tracker	substructure 4	layer 2	hit type 0		  		tracker	substructure 4	layer 2	hit type 0		   
0x244								0x488								  	0x488								   
0x24c								0x498								  	0x498								   
0x2c5								0x589								  	0x589								   
0x305								0x609								  	0x609								   
0x308								0x610								  	0x610								   
HitPattern							HitPattern							  	HitPattern							   
	tracker	substructure 1	layer 1	hit type 0			tracker	substructure 1	layer 1	hit type 0		  		tracker	substructure 1	layer 1	hit type 0		   
	tracker	substructure 1	layer 2	hit type 0			tracker	substructure 1	layer 2	hit type 0		  		tracker	substructure 1	layer 2	hit type 0		   
	tracker	substructure 1	layer 3	hit type 0			tracker	substructure 1	layer 3	hit type 0		  		tracker	substructure 1	layer 3	hit type 0		   
	tracker	substructure 3	layer 1	hit type 0			tracker	substructure 3	layer 1	hit type 0		  		tracker	substructure 3	layer 1	hit type 0		   
	tracker	substructure 3	layer 1	hit type 0			tracker	substructure 3	layer 1	hit type 0		  		tracker	substructure 3	layer 1	hit type 0		   
	tracker	substructure 3	layer 2	hit type 1			tracker	substructure 3	layer 2	hit type 1		  		tracker	substructure 3	layer 2	hit type 1		   
	tracker	substructure 3	layer 3	hit type 0			tracker	substructure 3	layer 3	hit type 0		  		tracker	substructure 3	layer 3	hit type 0		   
	tracker	substructure 3	layer 4	hit type 0			tracker	substructure 3	layer 4	hit type 0		  		tracker	substructure 3	layer 4	hit type 0		   
0x244								0x488								  	0x488								   
0x248								0x490								  	0x490								   
0x24c								0x498								  	0x498								   
0x2c4								0x588								  	0x588								   
0x2c4								0x588								  	0x58c								   
0x2c9								0x591								  	0x591								   
0x2cc								0x598								  	0x598								   
0x2d0								0x5a0								  	0x5a0								   

-- JohannesMuelmenstaedt - 05 Jun 2009

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2020-08-31 - TWikiAdminUser
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox/SandboxArchive All webs login

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