Documentation for the 'Find_Ks' package that searches
Ks ---> pi+ pi- using the Fiber Tracker
------------------------------------------------------


Bruce Hoeneisen
24 November 2000


Note:

This is a DRAFT. This project is under development.
Neither the software nor this documentation are complete.
The reason for presenting this work-in-progress is that I NEED
HELP for the next steps: interface this software with D0 objects,
and test with Monte Carlo data. This is almost hopeless with
my slow internet link from Ecuador. In particular I need
a pointer to documentation that defines fiber cluster
numbering, specially for the stereo fibers. Where is
'CftClusterChunk' defined? How do I 'hook' 'Find_Ks' to
the 'reco' software? ANY VOLUNTEERS TO WORK TOGETHER?

Contents
--------
1. For the impatient
2. Intruduction
3. Theoretical performance
4. Coordinate system
5. List of objects
6. List of functions
7. Usage
8. Measured performance
9. Conclusions


1. For the impatient

Copy everything from '~bruce1/Find_Ks/release0/' on 'd0mino.fnal.gov'
to your directory. Enter 'source ./Makefile' to compile and link. Enter
'./Find_Ks' to run. You will see the output on your screen.

All of the software of this package is contained in the class 'Find_Ks'.
The driver function 'Main.cpp' was written to test 'Find_Ks' in stand-alone
mode. 'Main.cpp' reads fiber tracker cluster hits from 'Hits_test.dat'
and adds noise hits for test purposes. Then 'Main.cpp' calls the
following functions:

'read_RCP' which reads the RCP parameters from the file 'Find_Ks.RCP';
'find_tracks_xy' which returns a list of found tracks in the transverse plane;
'find_tracks_xyz' which returns a list of found tracks in 3-dimensions;
'find_track_pairs' which returns a list of pairs of tracks that originate
   from a common point;
'get_errors' which fits the track pairs and obtains parameters of the
   daughter tracks and parent track with their errors.


2. Introduction

The software package 'Find_Ks' was
developed to search for low transverse momenta Ks decaying into a pair
of charged pions using the D0 detector Fiber Tracker. The pions have
low transverse momenta, and possibly do not exit the Fiber Tracker.

The input to 'Find_Ks' is a list of Fiber Tracker clusters
(i.e. neighboring fiber hits have already been resolved into clusters).
The output is a list of found track pairs that originate from a
common point. The
'Find_Ks' package can also return intermediate information such as
found tracks in xy, found tracks in xyz, found track pairs from
secondary vertices, and fitted track pairs.

The aplications in mind for this software are events

B^0 ---> J/psi Ks ---> l+ l- pi+ pi-

and

Lambda_b ---> J/psi Lambda^0 ---> l+ l- p+ pi-.

The kinematics of these events is documented in detail in D0 note
1984. The differential cross section
of Ks's from B's drops by a decade from p_T = 2GeV/c to 8GeV/c. The
differential cross section of pions from Ks's from B's drops by a
decade from 0GeV/c to 3.5GeV/c, and by another decade from 3.5GeV/c to
7GeV/c. Interesting cuts can be applied to DR, the distance between
the J/psi and the Ks in (eta, phi) space, but we do not consider
them here (see D0 note 1984).

Why write yet another algorithm to reconstruct tracks in the
fiber tracker? Finding tracks is different from finding track PAIRS:
if a track requires, say, 16 hits, then a track pair needs about 9
hits per track (to have the same number of fakes with a given
noise occupancy). Therefore the pattern recognition algorithm can
be quite different. For example we require hits only on axial and
stereo layers 2, 3, 4 and 5, thereby: a) Extending the pseudo-rapidity
reach of the tracker, b) Extending the transverse impact parameter that
can be reconstructed, and c) Finding tracks of very low transverse
momentum that do not exit the fiber tracker.

The following sections of this documentation explain the
theoretical performance of this algorithm, the coordinate system
and track model, the list of objects, list of functions,
the measured performance, and the usage. If you are impatient,
you may now jump to the conclusions in Section 9.


3. Theoretical performance

  The number of fake tracks found in the transverse (x, y) plane is
of order

n_xy = 3*10^6*e^n*Bmag[T]/pTmin[GeV/c]

where Bmag is the magnetic induction, and pTmin is the
minimum transverse momentum of the searched tracks. The number of
required axial doublet layers is n. The calculation of n_xy
is presented in Appendix A, and asumes pTmin > 0.1GeV/c.

  For EACH fake track found in the transverse plane (x, y) there are n_z
fake tracks found in three dimensions, where approximately

n_z = 2*10^4*e^n

(see Appendix A). Here n is the number of required stereo doublet layers.

  The number of fake found track pairs (before any invariant mass or
opposite sign or impact parameter cuts) is then of order

n_fake = 2^19*e^(4n)*((Bmag[T]/pTmin[GeV/c])^2)

asuming that we require hits in n axial layers and n stereo layers.

  To understand the preceeding equation, let us consider the case
Bmag = 2T and pTmin = 0.1GeV/c. Then we obtain n_fake = 1 for the
ocupancies listed in the following Table. The corresponding values
of n_xy and n_z are also listed. The fiber tracker is usefull
for ocupancies less than the ones indicated in the Table 1.

Table 1.
----------------------------------------------------------------------
number of layers   maximum useful fiber ocupancy   at maximum ocupancy
       n                       e                   n_xy      n_xy*n_z
----------------------------------------------------------------------
       4                       4.2%                200          13
       5                       8.0%                200          13
       6                      12.2%                200          13
       7                      16.5%                200          13
       8                      20.7%                200          13
----------------------------------------------------------------------

Note that the performance depends on the setting of the RCP parameters
and the numbers presented in this section are only order of magnitude
estimates. The actual performance is lower due to correlations: real
tracks pick up "noise" hits. The MEASURED performance is discussed in
Section 7.

We require hits in 4 axial layers (5A, 4A, 3A, 2A) and the corresponding
4 stereo layers (5U, 4V, 3U, 2V). We require at least one hit in axial
layers 1A or 6A. We search for hits in the remaining layers
of the Fiber Tracker. The RCP parameters 'minHitsA' and 'minHits'
determine the required number of axial and total hits.


4. Coordinate system

The axis of the Fiber Tracker is z. The transverse plane is (x, y).
Phi is the polar angle measured from the x axis counter-clockwise
and is in the range 0 <= phi < 2*pi.
There are 16 Fiber Tracker layers numbered from n = 0 to 15 in this
order (A stands for 'axial' and 'U' and 'V' are the stereo layers):
1A, 1U, 2A, 2V, 3A, 3U, 4A, 4V, 5A, 5U, 6A, 6V, 7A, 7U, 8A, 8V.
The bins (or clusters) in layer n are numbered from i = 0 to max(n) - 1
counter-clockwise starting at phi = 0. The radius of layer n is r(n).
The numerical values of max(n) and r(n) are given in 'Find_Ks.cpp'.
For an axial layer n:

x = r(n)*cos(phi)
y = r(n)*sin(phi)

where

phi = 2*pi*i/max(n).

(i is the i'th bin (or cluster) in layer n).

For a stereo track in layer n (with cluster i):

x = r(n)*cos(phi)
y = r(n)*sin(phi)
phi + m*2*pi = a + b*z = 2*pi*i/max(n) + b*z

where m = 0 or 1 or -1. For z = 0, m = 0 (recall that phi is always
in the range 0 <= phi < 2*pi).

A track is defined by one set of hits in axial and stereo layers 2, 3, 4
and 5 (all required), and hits in layers 1, 6, 7 and 8 (which are always
searched and may be optionally required depending on RCP parameters).
Note that we consider only a single pass through the layers.

The pattern-recognition algorithm asumes constant magnetic field over three
adjacent layers, which is a reasonable approximation near the center
of the D0 detector Solenoid. The helical tracks are then modeled as follows:

x = x0 + R*cos(alpha)
y = y0 + R*sin(alpha)

where

alpha = A + B*z.

We define the azimuth angle alpha of the helical track on layer 5A,
alpha_5, to be in the range 0 <= alpha_5 < 2*pi. For other layers
alpha is defined to be continuous (i.e. no jumps by 2*pi).

If B >= 9.0e6, then the track is in the transverse plane. In
this case we define A = z.

The magnetic field Bmag is positive in the +z direction.


5. List of objects

For details see the corresponding '*.h' files.

'Hits': Contains a list of Fiber Tracker clusters (neighboring
	hits have already been resolved into clusters).

'TrackFound_xy': List of clusters of one found track in xy.

'LTrackFound_xy': List of found tracks in xy.

'TrackFound_xyz': List of clusters of one found track in xyz.

'LTrackFound_xyz': List of found tracks in xyz.

'DecayPair': Pair of tracks that originate from a common
           (usually secondary) vertex.

'LDecayPair': List of DecayPair's.


6. List of functions

For details see the corresponding '*.cpp' files.

'find_track_xy':

This function has a 'Hits' object as input and a 'LTrackFound_xy'
object as output.

The search begins with a scan of clusters in layer 5A.
For each cluster found in layer 5A search '2*nbins_search' fiber bins in
layer 4A. For each hit bin found in layer 4A search '2*nbins_pT' fiber
bins in layer 3A. The search width 'nbins_pT' is determined by 'pTmin'
and 'Bmag'. For each hit bin found in layer 3A search
bins in layer 2A around the bin corresponding to the circular track defined by
the hits in layers 3A, 4A and 5A. The width of the search on layer 2A
is determined by 'dlmin' plus 'mcs' standard deviations of the Multiple Coulomb
Scattering. 'nbins_search', 'pTmin', 'Bmag', 'dlmin' and 'mcs' are RCP parameters.

Then we search optional hits in layers 1A and 6A, 7A and 8A. We
require at least one hit on layers 1A or 6A to reduce the number of
found xy tracks. If no hit is found in layers 6A and 7A the search on
layer 8A is abandoned.

Note that hits in layers 5A, 4A, 3A, and 2A are required. At least one
hit is required in 1A or 6A. The minimum number of axial
hits is 5 <= 'minHitsA' <=8.


'find_track_xyz'

This function has a 'LTrackFound_xy' object and a 'Hits' object as input and
a 'LTrackFound_xyz' object as output. For each found track in xy we loop
over stereo fibers in layers 5U and 2V. These pairs define helical tracks.
The helical tracks permit prediction of z's on layers 4V and 3U. Then
we loop over hits in 4V and 3U to search for matches. Stereo hits are
required on layers 2V 3U, 4V and 5U. Finally additional
stereo hits are searched in layers 1U, 6V, 7U, 8V. These hits are optional.
The minimum number of required hits (axial and stereo) is determined by
the RCP parameter 9 <= 'minHits' <= 16.


'find_track_pairs'

This function has a 'LTrackFound_xyz' object as input and a 'LDecayPair'
as output. We loop over pairs of tracks found in xyz. A track pair is
obtained by finding the intersection (x, y) in the transverse plane.
Then for each track we then obtain the z of the intersection (x, y).
If these two z's differ by less than
the RCP parameter 'dzmin' then we have a pair of tracks with a common origin
(x, y, z). Then we require that the transverse impact parameter,
sqrt(x^2 + y^2), be in the range from 'bmin' to 'bmax' (which are RCP
parameters).


We note that most of the "fake" tracks are really not fake: they are
real tracks that have picked up one or two noise hits. For this
reason we run the functions 'clean_tracks_xy', 'clean_tracks_xyz' and
'clean_pair' if the corresponding RCP parameters 'clean_LTrackFound_xy',
'clean_LTrackFound_xyz' and 'clean_LDecayPair' are set to 1.


'get_error'

This function has a 'LDecayPair' object as input and another 'LDecayPair' as
output. The output has the same information as the input, and additionally
has the fitted parameters of the 'DecayPair's and their errors. To obtain
the errors we recalculate the parameters asuming that the hits are shifted
by one bin.


7. Usage

To search for Ks ---> pi+ pi- the user needs the following code:

   //Given hits find tracks in xy:
   bool verbose1 = true; //set verbose
   if(verbose1) cout << "\nMain: Find tracks in xy.\n";
   LTrackFound_xy ltfxy; //reserve memory for a list of xy tracks
   fks.find_tracks_xy(Hits_test, ltfxy, Bmag); //find xy tracks
   if(ltfxy.error != 0) cout << "Main: error = "
      << ltfxy.error << " in ltfxy from 'Find_Ks::find_tracks_xy.\n";

   //Given tracks in xy find tracks in xyz:
   bool verbose2 = true; //set verbose
   if(verbose2) cout << "\nMain: Find tracks in xyz.\n";
   LTrackFound_xyz ltfxyz; //reserve memory for list of xyz tracks
   fks.find_tracks_xyz(Hits_test, ltfxy, ltfxyz); //find xyz tracks
   if(ltfxyz.error != 0) cout << "Main: error = "
     << ltfxyz.error << " in ltfxyz from 'Find_Ks::find_tracks_xyz'.\n";

   //Given tracks in xyz find track pairs from secondary vertex:
   bool verbose3 = true; //set verbose
   if(verbose3) cout << "\nMain: Find track pairs.\n";
   LDecayPair ldp; //reserve memory for list of fit xyz tracks
   fks.find_track_pairs(ltfxyz, ldp, Bmag); //fit xyz tracks
   if(ldp.error != 0) cout << "Main: error = "
     << ldp.error << " in ldp from 'Find_Ks::find_track_pairs'.\n";

   //Given track pairs obtain the errors of the positions and momenta.
   bool verbose4 = true; //set verbose
   if(verbose4) cout << "\nMain: Obtain errors of parameters.\n";
   LDecayPair ldp1; //reserve memory for list of fit xyz tracks
   fks.get_errors(ldp, ldp1, Bmag); //fit xyz tracks
   if(ldp1.error != 0) cout << "Main: error = "
     << ldp1.error << " in ldp1 from 'Find_Ks::get_errors'.\n";


8. Measured performance.

These measurements were made with the following RCP parameters:
nbins_search = 200, pTmin = 0.1GeV/c, mcs = 2.0, dlmin = 0.25mm,
dzmin = 7.0mm, minHitsA = 5, minHits = 9, bmin = 10mm,
bmax = 240mm, clean_LTrackFound_xy = 1, clean_LTrackFound_xyz = 1
clean_LDecayPair = 1. Note the very low threshold pTmin which
is challenging. The number of real xy tracks in the test was 4,
the number of real xyz tracks was 4, and the number of real track
pairs was 2. Random hits are added to obtain the occupancies
listed below. Note that the occupancy e is the fraction of
hit fibers. We take the fraction of hit clusters to be
e/3 (since one fiber of a doublet corresponds to two clusters
and one noise track hits 1.5 fibers on average but only one
cluster). No invariant mass cut or opposite sign cut is applied.
These are our "loose" cuts. The number of fakes obtained
as a function of fiber occupancy is listed in Table 2.

Table 2. Fakes for "loose" cuts.
-----------------------------------------------------------
occupancy   fake xy tracks   fake xyz tracks   fake track
e           n_xy             n_xy*n_z          pairs
-----------------------------------------------------------
0.00                0               0               0
0.01                0               0               0
0.02                0               0               0
0.03                0               0               0
0.04                8               0               0
0.05               33               3               3
-----------------------------------------------------------

"Standard" cuts are the same as "loose" cuts, but
minHitsA = 6, and minHits = 12. See Table 3.

Table 3. Fakes for "standard" cuts.
-----------------------------------------------------------
occupancy   fake xy tracks   fake xyz tracks   fake track
e           n_xy             n_xy*n_z          pairs
-----------------------------------------------------------
0.00                0               0               0
0.01                0               0               0
0.02                0               0               0
0.03                0               0               0
0.04                8               0               0
0.05               33               0               0
0.06               number of xy tracks overflowes
-----------------------------------------------------------

Finally consider "tight" cuts, which are the same as "loose" cuts
but with nbins_search = 150 and pTmin = 0.3GeV/c and minHitsA = 7
and minHits = 14. The results are shown in Table 4.

Table 3. Fakes for "tight" cuts.
-----------------------------------------------------------
occupancy   fake xy tracks   fake xyz tracks   fake track
e           n_xy             n_xy*n_z          pairs
-----------------------------------------------------------
0.00                0               0               0
0.01                0               0               0
0.02                0               0               0
0.03                0               0               0
0.04                0               0               0
0.05                2               0               0
0.06                4               1               0
0.07                8               1               0
0.08               10               1               0
0.09               19               2               0
0.10               28               2               0
0.11     more than limit of 200 xy tracks after scanning 7A
-----------------------------------------------------------

Note that the algorithm is VERY robust.


9. Conclusions.

We have developed an algorithm to efficiently find
track pairs originating from a secondary vertex with transverse
momenta as low as pT = 0.1GeV/c in a high noise
environment, e.g. Ks ---> pi+ pi-
and lambda ---> p+ pi-. We use only fiber tracker hits.
Tests show that the algorithm is useful with 'loose' cuts
up to 4% ocupancy, with 'standard'
cuts up to 5% ocupancy, and with 'tight' cuts up to
10% ocupancy or more.


Appendix A: Fake tracks

The search for tracks in the transverse (x, y) plane begins with a scan of
layer 5A. The doublet layer 5A has 2*2560 fibers and 2*2560*e hit fibers,
where e is the fiber occupancy. The number of cluster bins is 4*2560 and
the number of hit clusters is 2*2560*e/1.5, since on average a "noise" track
hits 1.5 fibers of the doublet. The ocupancy of the cluster bins is
therefore e/3.

Then we search approximately 400 cluster bins in layer 4A (determined by an RCP
parameter). These bins contain 400*e/3 hits.
Then we search approximately
20*Bmag/pTmin bins in layer 3A, where Bmag is the mangetic induction in
Tesla, and pTmin is the minimum transverse momentum in GeV/c.
The search continues over three bins in each succeeding axial
layer. Two fibers is determined by geometrical reasons and is valid for
pT greater than 0.1GeV/c. At lower pT Multilple Coulomb Scattering dominates
(the standard deviation of the scattering angle in the plane is about
0.0012/(beta*p[GeV/c]) radians). (The three fibers asumed here can be modified by
an RCP parameter.) This gives an estimate of the number of fake found tracks in the
(x, y) plane given by n_xy in Section 3.

The stereo angle is 3 degrees, the fiber pitch is 0.97mm, and the fiber
length of layer 5A is 2520mm. So one fiber in layer 5A is crossed by
136 fibers in layer 5U. Similarly, one fiber in layer 2A is crossed by
90 fibers in layer 2V. So, for each track found in the transverse plane,
we search 4*136*e/3 hits in the doublet layer 5U, and 4*90*e/3 hits in
doublet layer 2V. Then we have to search three cluster bins
in each additional stereo layer. This gives the number of fake tracks found
in (x, y, z) for each track found in (x, y) as given by n_z in Section 3.

So the number of fake track pairs is 0.5*((n_xy*n_z)^2). The probability that
two fake tracks cross at the same z is about 1/90. The
result is an estimate of the number of fake pairs, n_fake, and is given in
Section 3.


Appendix B: Random calculations

1.- Nuclear collision length of pions in nylon: 51cm.

2.- dE/dx of charged pions in nylon: 2.25MeV/cm at p = 0.42GeV/c;
4.5MeV/cm at p = 0.1GeV/c; 11MeV/cm at p = 0.05MeV/c,
2.9MeV/cm at p = 10GeV/c. So a pion with momentum 0.1GeV/c will
loose half of its momentum in about 7cm of nylon. The 8 layers
of the fiber tracker are equivalent to about 4cm of nylon (?).
Conclusion: dE/dx becomes important for pT < 0.1GeV/c
and we can not simply asume circular tracks in the transverse plane
for the low momentum pions of this study. This is why we approximate
to circles only for 3 or 4 neighboring layers. dE/dx given by pulse
hights might help particle identification for very low
momentum pions.

3.- Multiple Coulomb Scattering. Standard deviation of angle in plane for
pions through 4mm of nylon = theta. x/Xo = 4mm/367mm.

Theta = (0.0012GeV/c)/(beta*p) [radians].

At what momentum is theta = 1mm/50mm = 0.02? Answer: p = 0.1GeV/c.
At much higher momentum we can neglect Multiple Coulomb Scattering
compared to the Fiber Tracker position resolution. For lower momentum,
Multiple Coulomb Scattering dominates the resolution.

4.- A Ks decays into a pi+ with momentum p_pi = 0.206GeV/c in the direction +y,
and a pi- with momentum p_pi = 0.206GeV/c in the direction -y, in the Ks rest
frame. Now boost the Ks in the x direction until its momentum in the lab
frame is p_K. What is the opening angle alpha of the two pions? Answer:

tan(alpha/2) = p_pi*m_K/(p_K*sqrt(m_pi^2 + p_pi^2)).

For p_K = 1GeV/c, alpha = 0.41 radians. For p_K = 3GeV/c, alpha = 0.14 radians.

5.- What is the radius of a pion track in the transverse plane if pT = 0.1GeV/c?
Answer: 167mm for Bmag = 2T.