                                  ============
                                  LibTrkLevel2
                                     V0.01
                                  ============

List of F77 subroutines included in the library:

- DOTRACK
- DOTRACK2

- GRKUTA
- GRKUTA2
- GUFLD

- READB
- READBINNER
- READBOUTER

- INTER_B
- INTER_B_INNER
- INTER_B_OUTER


Usage inside F77 code:

--------------------------------------------------------------------------------
CALL READ_B(*PATH)
--------------------------------------------------------------------------------

PATH          (CHARACTER) Path of the directory that contains field-map files:
                 - External_top_map_n4_150402.rz  
                 - measure_n3_290302.rz  
                 - measure_n4_110402_corrected.rz

Read the magnetic field maps (rz files) and fill related common blocks.
===> To be called before using TRACK and INTER_B
It calls READBINNER and READBOUTER.

--------------------------------------------------------------------------------
CALL DOTRACK(*NPOINT,*ZIN,XOUT*,YOUT*,*AL_P,IFAIL*)
--------------------------------------------------------------------------------

NPOINT        (INTEGER) Num. points 
ZIN(NPOINT)   (DOUBLE)  Input z-coordinates (in cm)
XOUT(NPOINT)  (DOUBLE)  Output x-coordinates (in cm)
YOUT(NPOINT)  (DOUBLE)  Output y-coordinates (in cm)
AL_P(6)       (DOUBLE)  Track state vector
IFAIL         (INTEGER) Error flag (ok if IFLAG=0)

Calculate particle-trajectory coordinates, for the state vector AL_P, 
at z-coordinates set by the user. 
Make use of GRKUTA, routine to solve kinematic equations in a magnetic field
using Runge-Kutta method, adapted from GEANT3 library.

--------------------------------------------------------------------------------
CALL DOTRACK2(*NPOINT,*ZIN,XOUT*,YOUT*,THXOUT*,THYOUT*,TLOUT*,*AL_P,IFAIL*)
--------------------------------------------------------------------------------

NPOINT         (INTEGER) Num. points 
ZIN(NPOINT)    (DOUBLE)  Input z-coordinates (in cm)
XOUT(NPOINT)   (DOUBLE)  Output x-coordinates (in cm)
YOUT(NPOINT)   (DOUBLE)  Output y-coordinates (in cm)
THXOUT(NPOINT) (DOUBLE)  Output projected angle (in deg) on XZ plane
THYOUT(NPOINT) (DOUBLE)  Output projected angle (in deg) on YZ plane
TLOUT(NPOINT)  (DOUBLE)  Output track length (in cm) 
AL_P(6)        (DOUBLE)  Track state vector
IFAIL          (INTEGER) Error flag (ok if IFLAG=0)

Calculate particle-trajectory coordinates, for the state vector AL_P, 
at z-coordinates set by the user. 
Make use of GRKUTA2, routine to solve kinematic equations in a magnetic field
using Runge-Kutta method, adapted from GEANT3 library.
Same as DOTRACK and GRKUTA, modified in order to give as output the projected
angles and the track length.
The track length assigned to each track point i is evaluated between the i-th 
plane and the closest lower(upper) one, reference plane included, if the plane 
is above(below) the reference plane.

--------------------------------------------------------------------------------
CALL GUFLD(*V,*F)
--------------------------------------------------------------------------------

V(3)           (REAL) x,y,z spatial coordinates (in m)
F(3)           (REAL) Magnetic-field components (in kGauss)

Evaluate the three components of the magnetic field, by interpolating the
measured magnetic field map (used by GRKUTA/GRKUTA2). 
It calls INTER_B.

--------------------------------------------------------------------------------
CALL INTER_B(*X,*Y,*Z,B*)
--------------------------------------------------------------------------------

X,Y,Z         (DOUBLE) Spatial coordinates (in m)
B(3)          (DOUBLE) Magnetic-field components (in T)

Evaluate the three components of the magnetic field, by interpolating the
measured magnetic field map. 
It calls INTER_B_INNER and INTER_B_OUTER.
