
Event generator MC truth access routines:
==========================================


***************************************************************************
    SUBROUTINE AgNZGETE(ILK,IDE,NPART,IRUN,IEVT,CGNAM,VERT,IWTFL,WEIGH)
* Description: Get parameters of a single event in gates                  *
* Input : ILK   - Link number  : 1 = primary, 2 = secondary (obsolete)    *
*         IDE   - ID of event in gate ( ZEBRA IDN)                        *
* Output: NPART - Number of particles in event record                     *
*         IRUN  - run number as recorded by generator                     *
*         IEVT  - event number as recorded by generator                   *
*         CGNAM - generator name                                          *
*         VERT(4)- x,y,z,t of event (metres,seconds or mm,mm/c)           *
*         IWTFL - weight flag                                             *
*         WEIGH - event weight                                            *
* Original version:                              Robert DeWolf  23/07/92  *
***************************************************************************
#
****************************************************************************
    SUBROUTINE AgNZGETP(IL,IDE,IP,ISTAT,IDPDG,P,AMASS,MOTH,TIME,IDAU1,V)
* Description: Get parameters of a single particle from EVNT bank          *
* Input : IL    - Link number : 1 = primary, 2 = secondary (obsolete)      *
*         IDE   - ID of event in gate                                      *
*         IP    - Number of particle in event record                       *
* Output: ISTAT - HEPEVT status flag. Returns 0 if record not found.       *
*         IDPDG - PDG code for particle                                    *
*         P     - 4-momentum (px,py,pz,E)                                  *
*         AMASS - particle (quark) mass                                    *
*         MOTH  - mothers. If MOTH(2)<0 the range is MOTH(1)-ABS(MOTH(2))  *
*         TIME  - Start time of particle relative to interaction (sec)     *
*         IDAU1 - a daughter pointer                                       *
*         V     - vertex coordinates (in meter)                            *
* Original version:                              Robert DeWolf  23/07/92   *
****************************************************************************
#



GEANT track/vertex access:
==========================


      SUBROUTINE GFKINE(ITRA,VERT,PVERT,IPART,NVERT,UBUF,NWBUF)
*
************************************************************************
*                                                                      *
*           Retrieves Vertex and Track parameters                      *
*           -------------------------------------                      *
*                                                                      *
*  Retrieves parameters for a track with a long lifetime.              *
*                                                                      *
*  Input:                                                              *
*    ITRA      track number for which parameters are requested         *
*                                                                      *
*  Output:                                                             *
*    VERT      vector origin of the track                              *
*    PVERT     4 momentum components at the track origin               *
*    IPART     particle type (=0 if track ITRA does not exist)         *
*    NVERT     vertex number origin of the track                       *
*    UBUF      user words stored in GSKINE.                            *
*                                                                      *
*    ==>Called by : <USER>, GTREVE                                     *
*       Author    R.Brun  *********                                    *
*  modifications:                                                      *
*  PN, 28.08.98:  interface to kine bank via LgKINE                    *
*                                                                      *
************************************************************************


      SUBROUTINE GFVERT(NVTX,V,NTBEAM,NTTARG,TOFG,UBUF,NWBUF)
C.
C.    ******************************************************************
C.    *                                                                *
C     *       Retrieves the parameter of a vertex bank                 *
C     *       Vertex is generated from tracks NTBEAM NTTARG            *
C     *       NVTX is the new vertex number                            *
C.    * Input:                                                         *
C.    *  NVTX      requested vertex number                             *
C.    *                                                                *
C.    * Output:                                                        *
C.    *  VERT      array of (x,y,z) position of the vertex             *
C.    *  NTBEAM    beam track number origin of the vertex              *
C.    *            =0 if none exists                                   *
C.    *  NTTARG    target track number origin of the vertex            *
C.    *  TOFG      time of flight when the vertex was created
C.    *  UBUF      user array of NUBUF floating point numbers          *
C.    *  NUBUF                                                         *
C.    *                                                                *
C.    *    ==>Called by : <USER>                                       *
C.    *       Authors    F.Carminati                   *********       *
C.    *                                                                *
C.    ******************************************************************
C.


connection from GEANT tracks to EVENT GENERATOR tracks:
=======================================================


*************************************************************************
        subroutine agkinor (Ikine,Ikorg,Igenz)
*                                                                       *
* Description: provided Kine track number returns its primary track     *
*              origin both in KINE and GENZ banks                       *
*                                                                       *
*************************************************************************
#


Digit (signal) access:
======================

*************************************************************************
*                                                                       *
             Function     A g F D I G 0 (Cset,Cdet)
*                                                                       *
*  Prepare digit access chains in each detector element of a subsystem  *
*  Input :                                                              *
*    Character*4 Cset - subsytem name,                                  *
*    Character*4 Cdet - sensetive detector name.                        *
*************************************************************************


*************************************************************************
*                                                                       *
     Function     A g F D I G 1 (NHit,LTRA,ISC,DIGI)
*                                                                       *
* Description:  make a loop over detector elements and give to user     *
*               all hits in the selected element sequentially           *
*  Output:                                                              *
*    Int Nhit - sequential hit(digit) number in the detector element    *
*               the last hit (digit) has negative number                *
*    Int Ltra - if positive, KINE track number which produced this hit  *
*               if negative or 0 - more then one track contributed      *
*    Int ISC(15) array of volume IDs which defines the detector element *
*                Call AgfPATH(ISC) restores the coordinate transformation
*    Real DIGI(15) - array of measurements (signals)                    *
*************************************************************************





Reconstructed quantity access:
===============================

#include "<structure_description>.inc"

     USE path/structure



example:
========

atrecon/calorec/htyp.inc :
--------------------------
     structure HTYP  {int ID, int IXM, int IYM, ENE, ETE,
                      ETA,PHI,RHO, DETA,DPHI,DRHO, SETA,SPHI,SRHO }

code:
-----
#include "atrecon/calorec/htyp.inc"

     USE /recb/sect/hcal/jets(i)/htyp

     Print *,' jet energy,Et,eta,phi =', htyp_ene,htyp_ete,htyp_eta,htyp_phi

