next up previous contents index
Next: Retrieve the contents Up: Get information about Previous: Get information about

Retrieve the contents of a RWN into an array

CALL HGN (ID,*IDN*,IDNEVT,X*,IERROR*)

Action: Copy the contents of a RWN event into an array.

Input parameters:
ID
Identifier of the Ntuple.
IDN
Must be initialized to zero before the first call to HGN.
IDNEVT
Event number
Output parameters:
IDN
Internal HBOOK pointer
X
Array to contain variables for the event chosen.
IERROR
Error return code.

This routine returns in the vector X the contents of the row IDNEVT or Ntuple ID. The vector X must be of size NVAR, as specified in the call to HBOOKN. If more than one row of the Ntuple is to be processed, it is more efficient to call first HGNPAR and then HGNF.

CALL HGNPAR (ID,CHROUT)

Action: Obtains the address and parameters of Ntuple ID.

Input parameters:
ID
Identifier of the Ntuple.
CHROUT
Character variable containing the name of the calling subroutine (printed in case of errors).

This routine sets some internal pointers and must be called before the first call to HGNF for a given RWN. When accessing more than one row of an Ntuple it is more efficient to call HGNPAR and then HGNF for each row that is required than to call HGN.

CALL HGNF (ID,IDNEVT,X*,IERROR*)

Action: Copy the contents of an Ntuple event into an array. The routine HGNPAR must have been called prior to the first call to HGNF for a given Ntuple.

Input parameters:
ID
Identifier of the Ntuple.
IDNEVT
Event number
Output parameters:
X
Array to contain variables for the event chosen.
IERROR
Error return code.

This routine returns in the vector X the contents of the row IDNEVT or Ntuple ID. The vector X must have be of size NVAR, as specified in the call to HBOOKN.

Example of access to RWN information

\NODOC{\baselineskip=.95\baselineskip\relax}      PROGRAM TEST
      INTEGER    NWPAWC
      PARAMETER (NWPAWC=15000, MTUPLE=5)
      COMMON/PAWC/PAW(NWPAWC)
      CHARACTER*80 CHTITL
      CHARACTER*8 CHTAGS(MTUPLE),CHTAGZ(MTUPLE)
      DIMENSION EVENT(MTUPLE),RLOW(MTUPLE),RHIGH(MTUPLE)
      EQUIVALENCE (EVENT(1),X),(EVENT(2),Y),(EVENT(3),Z)
      EQUIVALENCE (EVENT(4),ENERGY),(EVENT(5),ELOSS)
      DATA CHTAGS/'X','Y','Z','Energy','Eloss'/
*-- Tell HBOOK how many words are in PAWC.
      CALL HLIMIT(NWPAWC)
*-- Book Ntuple 
      CALL HBOOKN(10,'A Row-Wise-Ntuple',5,' ',5000,CHTAGS)
*-- Fill the Ntuple 
      DO 10 I=1,1000
         CALL RANNOR(X,Y)
         Z=SQRT(X*X+Y*Y)
         ENERGY=50. + 10.*X
         ELOSS=10.*ABS(Y)
         CALL HFN(10,EVENT)
 10   CONTINUE
*--   Obtain the definitions of the Ntuple
      NVAR = MTUPLE
      CALL HGIVEN(10,CHTITL,NVAR,CHTAGZ,RLOW,RHIGH)
      PRINT *,'Definitions of Ntuple # ',10
      PRINT *,'   Title: ',CHTITL(1:LENOCC(CHTITL))
      PRINT *,'   Number of variables: ',NVAR
      DO 20 I=1,NVAR
         PRINT 9001,I,RLOW(I),RHIGH(I)
9001  FORMAT(' Min/Max values for column # ',I3,1X,F10.5,
     +       1X,F10.5)
 20   CONTINUE
*--   Get the contents of 'event' # 333
      CALL HGNPAR(10,'TEST')
      CALL HGNF(10,333,EVENT,IERR)
      PRINT *,IERR,EVENT
*--   Get the number of events in this Ntuple
      CALL HNOENT(10,NEVENT)
      PRINT *,NEVENT
 99   CONTINUE
      END


next up previous contents index
Next: Retrieve the contents Up: Get information about Previous: Get information about

Last update: Tue May 16 09:09:27 METDST 1995