next up previous index
Next: BASE420 The random Up: GEANT Previous: Debug of events

BASE410 Utility Routines

Routine ID: BASE410
Author(s): Submitted: 08.08.87
Origin: R.BrunRevised: 08.11.93

CALL GLOOK (CHNAME,IVECT,N,ILOOK*)

CHNAME
( CHARACTER*4) variable containing the name to be searched for in IVECT;
IVECT
( INTEGER) array containing the ASCII code of the names among which NAME is searched. The names are stored 4 characters per word;
N
( INTEGER) number of items in IVECT;
ILOOK
( INTEGER) position in IVECT where NAME has been found, 0 if not found.

This routine is very useful when searching for a string stored in a ZEBRA bank. For instance to find the position of the 'CRYS' volume in the volume bank, the following piece of code could be written:

+SEQ,GCBANK.
+SEQ,GCNUM.
      .
      .
      .
      CALL GLOOK('CRYS',IQ(JVOLUM+1),NVOLUM,IVO)
      IF(IVO.GT.0) THEN
         JVO = LQ(JVOLUM-IVO)
      ELSE
         JVO = 0
      ENDIF

JVO, if different from 0, is the pointer to the data bank containing the information relative to the volume 'CRYS'.

CALL GEVKEV (EGEV,ENERU*,CHUNIT*)

EGEV
( REAL) input, energy in GeV;
ENERU
( REAL) output, energy in the new unit;
CHUNIT
( CHARACTER*4) unit in which the energy has been converted.

This subroutine converts the input energy in GeV to a unit in which 1 ≤E ≤999 . CHUNIT contains the new unit. The following piece of code illustrates the use of GEVKEV:

+SEQ,GCTRAK.
      CHARACTER*4 CHUNIT
      .
      .
      .
      CALL GEVKEV(DESTEP, DE, CHUNIT)
      WRITE(6,10000) DE, CHUNIT
10000 FORMAT(' The energy loss in this step is ',F7.2,A)

BASE420


Janne Saarela
Mon Apr 3 12:46:29 METDST 1995