- The libmatch98.a routines
- match98init()
- mavxrtra()
- mafilepseg()
- maselgtar() (function)
- magetgtar() (function)
- mamc2lepseg()
- maelseg_mtra()
- mamuseg_mtra()

- The KUIP commands

Please note that this matching package which is described here
was released together with a version of `tfevnt()`

and some of its subroutines dedicated to the '98 taskforce
studies in 1997. That way, the lepton seed for the upstream
propagation out of the RSEG table.

This version also relies on the new RK routines, which are provided with ARTE-08-01-r2 (and propably later)

The matching itself needs only to routines:

**match98init()**-
**MATCH**ing**98 INIT**ialization

Syntax:CALL match98init()

- This does some initialization and has to be called by
`usinit()`

. **mavxrtra()**-
**MA**tch with**V**erte**X**and fill into**RTRA**table

Syntax:INTEGER resgc,rsegs(),igtar CALL mavxrtra(rsegc,rsegs,igtar)

This is meant to be the very routine called in`usevnt()`

to actually do the matching with SVD segments and create RTRA table entries for the matched segments. It needs as input an array of integers`rsegs()`

, that contains the RSEG row numbers of the segments to be matched with a SVD segment. The input argument`rsegc`

indicates the last entry in`rsegs()`

containing a valid RSEG row number. Also the target wire from which the decay in question originated has to be provided for the target constraints used in the matching procedure. In case of missing information about the target wire, the routine can be called more than once, each time with a different target wire. (This is of course not the optimal solution, but serves as a workaround for the time being)

`rsegs()`

array, you can use `mafilepseg()`

, the GTAR row number can be
obtained with `maselgtar()`

/`magetgtar()`

. In general, the variable
`ierr`

returns a status indicating success when the value is
zero. For more details on `ierr`

you have to refer to the
source code or to ask me **mafilepseg(,,,)**-
**MA**tchlib:**FI**nd**LEP**ton**SEG**ments

Syntax:INTEGER rsegc_max,rsegs(rsegc_max),rsegc,cmp CALL mafilepseg(rsegc_max,rsegs,rsegc,cmp)

Collects all segments which have been reconstructed have a bit pattern in the table entry`RSEG_CMP`

which matches the argument`cmp`

and puts them in the array`rsegs()`

, which has to be at least of length`rsegc_max`

. The bit pattern (up to now) may consist of a combination of`rsegc_vxd`

Vertex Detector `rsegc_patt`

Pattern Tracker `rsegc_magt`

Magnet Tracker `rsegc_muon`

Muon Detector `rsegc_ecal`

Ecal Segment `rsegc_tar`

Target Constraint `RSEG_cmp.fi`

. (*You should never use numerical values and never invent new bit pattern definitions yourself!*) If you want an OR-wise combination of bit patterns, you have to invoke`mafilepseg()`

for each bit pattern separately.`mafilepseg()`

starts to fill the array at position`rsegc+1`

and returns in`rsegc`

the last row filled (so`rsegc`

is as well input as output) **maselgtar(,)**(function)-
**MA**tchlib:**SEL**ect**GTAR**row number

Syntax:INTEGER ngold,ierr,maselgtar igtar=maselgtar(ngold,ierr)

This function tries to estimate from the ngold'th decay stored in`ma_pstat(,)`

which target wire was the origin of the decay in question and returns the row number of the wire in table GTAR (hence`igtar`

). How the wire is selected (i.e. the contents of`ma_pstat(,)`

) depends heavily on the setting of`MATCH98/LEPTONMODE`

.`maselgtar()`

makes use of`magetgtar()`

. **magetgtar(,)**(function)-
**MA**tchlib:**GET****GTAR**row number

SyntaxINTEGER imtra,ierr,magetgtar igtar=magetgtar(imtra,ierr)

This routine selects the row number`igtar`

of the target wire which is closest to the BVER of the MC track with given row number`imtra`

.

**mamc2lepseg()**-
**MA**tchlib: convert**MC**information**TO****LEP**ton**SEG**ments

Syntax:CALL mamc2lepseg()

This routine fills the RSEG table with information from the MTRA table in order to provide a lepton seed for the Ranger upstream algorithm without having a (real) lepton detector simulation. Of course, the MC information is smeared with appropriate factors. It makes use of the routines`mamuseg_mtra()`

and`maelseg_mtra()`

. After`mamc2lepseg()`

has been called,`tfevnt()`

(the adapted version) can be called for the upstream propagation. Please note, that the covariance matrix of the RSEG entry for CARE output is not given properly yet. **maelseg_mtra()**-
**MA**tchlib: create**MU**on**SEG**ment from**MTRA**table row

Syntax:CALL maelseg_mtra(imtra,ierr)

Makes an entry in the RSEG table for the one given MTRA table entry (`imtra`

= MTRA row number) trying to simulate CARE output. The CARE package provides only cluster information from which a zero length segment with direction information gained by a target constraint can be constructed. **mamuseg_mtra()**-
**MA**tchlib: create**MU**on**SEG**ment from**MTRA**table row

Syntax:CALL mamuseg_mtra()

Makes an entry in the RSEG table for the one given MTRA table entry (`imtra`

= MTRA row number) trying to simulating MUREC output.

If you want to use (you probably have to) the KUIP commands of the '98 matching you have to put the line

#include "match98.cdf"in your

`uskuip.cdf`

file. Then you have the KUIP menu
`MATCH98`

available, which contains the following commands:
**CUTS**- Syntax:
`MATCH98/CUTS`

Set cuts for SVD segment matching. Shows values without arguments. The offsets are meant to be used if you want to use asymmetric cut windows, they are not well tested yet.`xcut``ycut``txcut``tycut`[`xoffset``yoffset``txoffset``tyoffset`] **SHOW**- Syntax:
`MATCH98/SHOW`

Show same settings and statistics of the matching stuff. Note that the abbreviation`SH`

, often used for`KUIP/SHELL`

becomes ambiguous. **LEPTONMODE**- Syntax:
`MATCH98/LEPTONMODE`

Set which decay is used for selecting Leptons in`mode``mamc2lepseg()`

and the target wire in`maselgtar()`

. Recognized values are

Apart from "GOLD" I do not guarantee for proper results ...GOLD for golden decays of *B*^{0}JPSI *J/Psi*->*l*^{+}l^{-}B for golden-like decays of other *B*s.Y or UPSILON *Y*->*l*^{+}l^{-}BSEM semileptonic *b*decaysCSEM semileptonic *c*decays. **ECALMODE**- Syntax:
`MATCH98/ECALMODE`

Way to simulate the ECAL, should be 1, which means that`mode``maelseg_mtra`

will use the information stored in the MCAL table. **DE**- Syntax:
`MATCH98/DE`

Set the width for simulating the calibration error of the ecal. If given, the parameters`dE`[`seed1``seed2`]`seed1``seed2`are used to initialize the random generator (`NORRAN()`

), otherwise there is no initalisation by the matching package. (The latter is what you want in most cases) **DETECTOR**- Syntax:
`MATCH98/DETECTOR`

Select lepton detector to be used in`detector``mamc2lepseg()`

. Recognized values are "ECAL", "MUON" and "BOTH" **SAMP**- Syntax:
`MATCH98/SAMP`

Change sampling factors for ECAL used in`e1samp``e2samp``e5samp``maelseg_mtra()`

if`mode`(see ECALMODE above) is 1; factors are given separately for 1 x 1, 2 x 2 and 5 x 5 division blocks. There should normally no need to use this. **RK**- Syntax:
`MATCH98/RK`

Set parameters for the Runge Kutta routines by T. Oest and radiation length values to be assumed for adding additional errors for covariance matrix estimation:`x``y``tx``ty``fstep``iter``rlenx``rleny``rlentx``rlenty``rlenp``x`Precision in x over full distance (RK parameter) `y`Precision in y over full distance (RK parameter) `tx`Precision in tx over full distance (RK parameter) `ty`Precision in ty over full distance (RK parameter) `fstep`Fstep (RK parameter) `iter`Number of Iterations (i.e. invocations of RK) `rlenx`rad. length for adding MS to RK error in x for tangent fit `rleny`rad. length for adding MS to RK error in y for tangent fit `rlentx`rad. length for adding MS to RK error in tx for tangent fit `rlenty`rad. length for adding MS to RK error in ty for tangent fit `rlenp`rad. length for adding MS to RK error for p fit **VERBOSE**- Syntax:
`MATCH98/VERBOSE`

Set verbosity of the match package. Default is`level``level`=4 (errors), 5 gives you also minor errors, 10 is already quite verbose. Without argument, it is set to 10.

PJW