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

Generate a user function

 

HBOOK can automatically produce a skeleton user selection function, which includes the Ntuple declaration via the calls HBNT, HBNAME and HBNAMC, and can be used in a later run to access the elements of the Ntuple. Two cases are available; one for use in batch and the other for use with PAW. In the first case the common block names will be those specifed by the user in the call to HBNAME or HBNAMC. For PAW, these common names are /PAWCR4/, /PAWCR8/ and /PAWCCH/ for storing the ``single precision'' (LOGICAL, INTEGER and REAL*4), ``double precision'' (REAL*8 and COMPLEX) and CHARACTER data respectively.

CALL HUWFUN (LUN,ID,CHFUN,ITRUNC,CHOPT)

Action:

Write an user function or subroutine to access an Ntuple.

Input parameters:
LUN
Logical unit used to write the user routine. LUN must be opened before this call.
ID
Identifier of the Ntuple.
CHFUN
Character variable specifying the routine name.
ITRUNC
All variable names will be truncated to ITRUNC characters. ITRUNC=0 is no truncation.
CHOPT
Character variable specifying the desired options.
'B'
Make an user subroutine for batch usage (i.e. with HBNAME and HBNAMC calls) (default).
'P'
Make a PAW selection function.

A simple example of the two kinds of skeletons generated with routine HUWFUN is given below. Another more complex example can be found on page gif, where the code of a fully worked out subroutine based on such a sketeton can also be studied.

In PAW, the command UWFUNC generates a skeleton for the RWN or CWN analysis function automatically.

Example of an Ntuple definition and HUWFUN usage

      COMMON /CVECT/ V1, V2, V3, V4, V5, V6, V7, V8, V9, V10,
     +               V11, V12, V13, V14, V15, V16, V17, V18, V19, V20
      ...
      ...
*
*-- book N-tuple 20
*
      CALL HBNT(20,'1 block 20 variable N-tuple', ' ')
      CALL HBNAME(20,'VECT',V1,'V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,
     +                          V12,V13,V14,V15,V16,V17,V18,V19,V20')
*
      ...
      OPEN(11,FILE='nt20.f',STATUS='UNKNOWN')
      OPEN(12,FILE='nt20p.f',STATUS='UNKNOWN')
      CALL HUWFUN(11, 20, 'NT20', 0, 'B')
      CALL HUWFUN(12, 20, 'NT20', 0, 'P')
      ...
The HUWFUN output files nt20.f and nt20p.f look like:

File nt20.f

      SUBROUTINE NT20
*********************************************************
*                                                       *
* This file was generated by HUWFUN.                    *
*                                                       *
*********************************************************
*
*     N-tuple Id:     20
*     N-tuple Title:  1 block 20 variable N-tuple
*     Creation:       11/06/92 18.46.10
*
*********************************************************
*
      REAL V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17
     + ,V18,V19,V20
      COMMON /VECT/ V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15
     + ,V16,V17,V18,V19,V20
*
      CALL HBNAME(20,' ',0,'$CLEAR')
      CALL HBNAME(20,'VECT',V1,'$SET')
*

*
*--   Enter user code here
*

*
      END

File nt20p.f

      REAL FUNCTION NT20()
*********************************************************
*                                                       *
* This file was generated by HUWFUN.                    *
*                                                       *
*********************************************************
*
*     N-tuple Id:     20
*     N-tuple Title:  1 block 20 variable N-tuple
*     Creation:       11/06/92 18.46.10
*
*********************************************************
*
      COMMON /PAWIDN/ IDNEVT,VIDN1,VIDN2,VIDN3,VIDN(10)
*
      REAL V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17
     + ,V18,V19,V20
      COMMON /PAWCR4/ V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14
     + ,V15,V16,V17,V18,V19,V20
*

*
*--   Enter user code here
*

      NT20 = 1.
*
      END


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

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