next up previous contents index
Next: For compatibility with Up: Description of FFREAD Previous: Get some internal

An example of use

Here is an example of the use of FFREAD in the real world. First, a slightly reduced version of the GEANT routine GFFGO, which sets up the standard GEANT keys and then reads in the data cards. Note the usage of key types and array lengths and, as a convention, the use of the keyword 'MIXED'.

Example of using FFREAD

      SUBROUTINE GFFGO
C
      COMMON/GCCUTS/CUTGAM,CUTELE,CUTNEU,CUTHAD,CUTMUO,BCUTE,BCUTM
     +             ,DCUTE ,DCUTM ,PPCUTM,TOFMAX,GCUTS(5)
C
      COMMON/GCFLAG/IDEBUG,IDEMIN,IDEMAX,ITEST,IDRUN,IDEVT,IEORUN
     +        ,IEOTRI,IEVENT,ISWIT(10),IFINIT(20),NEVENT,NRNDM(2)
C
      COMMON/GCKINE/IKINE,PKINE(10),ITRA,ISTAK,IVERT,IPART,ITRTYP
     +      ,NAPART(5),AMASS,CHARGE,TLIFE,VERT(3),PVERT(4),IPAOLD
C
      COMMON/GCLIST/NHSTA,NGET ,NSAVE,NSETS,NPRIN,NGEOM,NVIEW,NPLOT
     +       ,NSTAT,LHSTA(20),LGET (20),LSAVE(20),LSETS(20),LPRIN(20)
C
C             Define standard keys
C
      CALL FFKEY ('CUTS',CUTGAM,16,'REAL')
      CALL FFKEY ('DEBU',IDEMIN, 3,'INTEGER')
      CALL FFKEY ('GET ',LGET  ,20,'MIXED')
      CALL FFKEY ('HSTA',LHSTA ,20,'MIXED')
      CALL FFKEY ('KINE',IKINE ,11,'MIXED')
      CALL FFKEY ('PRIN',LPRIN ,20,'MIXED')
      CALL FFKEY ('RNDM',NRNDM , 2,'INTEGER')
      CALL FFKEY ('RUN ',IDRUN , 2,'INTEGER')
      CALL FFKEY ('RUNG',IDRUN , 2,'INTEGER')
      CALL FFKEY ('SAVE',LSAVE ,20,'MIXED')
      CALL FFKEY ('SETS',LSETS ,20,'MIXED')
      CALL FFKEY ('SWIT',ISWIT ,10,'INTEGER')
      CALL FFKEY ('TRIG',NEVENT, 1,'INTEGER')
C
C             Now read data cards
C
      CALL FFGO
C
 999  END

And here is an example input, taken from the GEANT test job GEXAM1:

Input file to previous example

LIST
TRIGGERS   10
DEBUG     1   1    1
SWIT      1
CUTS  0.0001    0.001
KINE 2=10. 1.
SETS    'CDET' 'HBAR'  'MUEC'
PRINT   'MATE' 'VOLU'  'TMED'
END


Janne Saarela
Tue May 16 09:50:47 METDST 1995