Make your own free website on Tripod.com
 

/VECTOR

Vector Processor commands. Vectors are equivalent to FORTRAN 77 arrays and they use the same notation except when

omitting indexes (see last line below). Up to 3 dimensions are supported. Examples:

 
    Vec(20) (mono-dimensional with 20 elements)

may be addressed by:

 
    Vec          for all elements
    Vec(13)      for element 13-th
    Vec(12:)     for elements 12-th to last
    Vec(:10)     for elements first to 10-th
    Vec(5:8)     for elements 5-th to 8-th

 
    Vec(3,100) (2-dimensional with 3 columns by 100 rows):

may be addressed by:

 
    Vec(2,5:8)   for elements 5-th to 8-th in 2-nd column
    Vec(2:3,5:8) for elements 5-th to 8-th in 2-nd to 3-rd columns
    Vec(2,5)     for element 5-th in 2-nd column
    Vec(:,3)     for all elements in 3-rd row
    Vec(2)       for all elements in 2-nd column (SPECIAL CASE)

The latest line shows the special (and non-standard with FORTRAN 77) notation such that missing indexes are substituted
to the right.

An 'invisible' vector called '?', mono-dimensional and of length 100, is always present. Is is used for communicating between
user arrays and KUIP vectors, being equivalenced with the real array VECTOR(100) in the labeled common block
/KCWORK/.

 /VECTOR/CREATE vname [ type values ]
 

 VNAME
         C
           Vector name(length)
 TYPE
         C
           Vector type D='R'
 VALUES
         C
           Value list D=' ' Separate Vararg
 

TYPE:

 'R'
 'I'
 

Create a vector named VNAME (elements are set to zero). The dimensions are taken from the name, for example VEC(20),
VEC(3,100), VEC(2,2,10). Up to 3 dimensions are supported. Dimensions which are not specified are taken to 1, for example
VEC(10) ---> VEC(10,1,1) and VEC ---> VEC(1,1,1). The vector may be of type Real or Integer. A vector is filled at the
same time if parameters are given after the TYPE:

 
    VEC/CREATE V(10) R 1 2 3 4 5 66 77 88 99 111
    VEC/CREATE W(20) R 1 2 3

In the last example only the first three elements are filled. Vector elements may be changed later with the command
VECTOR/INPUT.

If many equal values have to be entered consecutively, one can specify just one value and precede it by a repetition factor and
an asterisk. Example:

 
    VEC/CREATE Z(20) R 5*1 2 4*3   --->   VEC/CREATE Z(20) R 1 1 1 1 1 2 3 3 3
   3

Enter HELP VECTOR for more information on vector addressing.

 /VECTOR/LIST
 

List all vectors (name, dimensions, type).

 /VECTOR/DELETE vlist
 

 VLIST
       C
         Vector list D=' ' Loop
 

Delete from memory all vectors in the list VLIST. The vectors are separated in the list by a comma and embedded blanks are
not allowed. An asterisk at the end of VLIST acts as wild-card:

 
    VEC/DEL AB*          --->  deletes all vectors starting by AB
    VEC/DEL *            --->  deletes all vectors

 /VECTOR/COPY vnam1 vnam2
 

 VNAM1
        C
          Source vector name
 VNAM2
        C
          Destination vector name
 

Copy a vector into another one. Mixed vector type copy is supported (e.g. Integer ---> Real and viceversa). If VNAM2 does
not exist it is created with the required dimensions, not necessarily the same as the source vector if a sub-range was specified.
For example, if A is a 3 x 100 vector and B does not exist, COPY A(2,11:60) B will create B as a 50 elements
mono-dimensional vector; a special (and non-standard with FORTRAN 77) notation is used such that, still using the above
vectors, COPY A(2,1:100) B and COPY A(2) B have the same effect.

Note that VECTOR/COPY does not allow a range for the destination vector not specifying consecutive elements (i.e. along
the first dimension):

 
    VEC/COPY V(5)      W(3,4)     | O.K.
    VEC/COPY V1(2:3,5) V2(4:5,9)  | O.K.
    VEC/COPY V1(5,2:3) V2(4:5,9)  | O.K.
    VEC/COPY V1(3,3:4) V2(4,4:5)  | NOT allowed
    VEC/COPY V1(2:3,5) V2(2,4:5)  | NOT allowed

Enter HELP VECTOR for more information on vector addressing.

 /VECTOR/INPUT vname [ values ]
 

 VNAME
         C
           Vector name
 VALUES
         C
           Value list D=' ' Separate Vararg
 

Enter values into a vector from the terminal. Example:

 
    VEC/INPUT V(6:10) 1.1 2.22 3.333 4.4444 5.55555

If many equal values have to be entered consecutively, one can specify just one value and precede it by a repetition factor and
an asterisk. Example:

 
    VEC/INPUT V 5*1 2 4*3   --->   VEC/INPUT V 1 1 1 1 1 2 3 3 3 3

Enter HELP VECTOR for more information on vector addressing.

 /VECTOR/PRINT vname [ dense ]
 

 VNAME
        C
          Vector name
 DENSE
        I
          Output density D=1 R=0,1,2
 

Write to the terminal the content of a vector. Enter HELP VECTOR for more information on vector addressing.

If DENSE.EQ.0 the output is one vector element per line. If DENSE.EQ.1 the output for a sequence of identical vector
elements is compressed to two lines stating the start and end indices. If DENSE.EQ.2 the output for a sequence of identical
vector elements is compressed to a single line.

 /VECTOR/READ vlist fname [ format opt match ]
 

 VLIST
         C
           Vector list
 FNAME
         C
           File name D=' '
 FORMAT
         C
           Format D=' '
 OPT
         C
           Options D='OC'
 MATCH
         C
           Matching pattern D=' '
 

OPT:

 'OC'
 'O'
 '' ''
 'C'
 

Enter values into vector(s) from a file. A format can be specified, e.g. FORMAT='F10.5,2X,F10.5', or the free format is used
if FORMAT is not supplied.

If vector(s) are not existing they will be created of the size as read from the file.

Vectors in the list VLIST (maximum 30) are separated by a comma and embedded blanks are not allowed. If subscripts are
present in vector names, the smallest one is taken.

OPT is used to select between the following options:

 
    'OC'   file is Opened, read and then Closed (default case)
    'O'    file is Opened and then read (left open for further reading)
    ' '    file is read (already open, left so for further reading)
    'C'    file is read and then Closed (already open)

If the character 'Z' is present in OPT, the vector elements equal to zero after reading are set to the latest non-zero element
value (for example reading 1 2 3 0 0 4 0 5 will give 1 2 3 3 3 4 4 5).

MATCH is used to specify a pattern string, restricting the vector filling only to the records in the file which verify the
pattern. Example of patterns:

 
     /string/      match a string (starting in column 1)
    -/string/      do not match a string (starting in column 1)
     /string/(n)   match a string, starting in column n
     /string/(*)   match a string, starting at any column

Enter HELP VECTOR for more information on vector addressing.

 /VECTOR/WRITE vlist [ fname format chopt ]
 

 VLIST
         C
           Vector list
 FNAME
         C
           File name D=' '
 FORMAT
         C
           Format D='(1X,G13.7)'
 CHOPT
         C
           Options D='OC'
 

CHOPT:

 'OC'
 'O'
 '' ''
 'C'
 

Write to a file the content of vector(s). If FNAME=' ' the content is written to the terminal. A format can be specified, e.g.
FORMAT='F10.5,2X,F10.5', or the default one is used if FORMAT is not supplied.

Vectors in the list VLIST (maximum 30) are separated by a comma and embedded blanks are not allowed. If subscripts are
present in vector names, the smallest one is taken.

CHOPT is used to select between the following options:

 
    'OC'   file is Opened, written and then Closed (default case)
    'O'    file is Opened and then written (left open for further writing)
    ' '    file is written (already open, left so for further writing)
    'C'    file is written and then Closed (already open)

Enter HELP VECTOR for more information on vector addressing.

 /VECTOR/DRAW vname [ id chopt ]
 

 VNAME
        C
          Vector name
 ID
        C
          Histogram Identifier D='12345'
 CHOPT
        C
          Options D=' '
 

CHOPT:

 '' ''
       Draw an histogram.
 'C'
       Draw a smooth curve.
 'S'
       Superimpose plot on top of existing picture.
 '+'
       Add contents of ID to last plotted histogram.
 'B'
       Select Bar chart format.
 'L'
       Connect channels contents by a line.
 'P'
       Draw the current polymarker at each channel.
 '*'
       Draw a * at each channel.
 

Draw vector VNAME (real) interpreting it as a histogram. Optionally save the contents in histogram ID.

 /VECTOR/HFILL vname id
 

 VNAME
        C
          Vector name
 ID
        C
          Histogram Identifier
 

Fill the existing histogram ID with vector VNAME (real) . Note that the command VECTOR/PLOT can automatically
book, fill and plot the contents of a vector.

 /VECTOR/PLOT vname [ id chopt ]
 

 VNAME
        C
          Vector name
 ID
        C
          Histogram Identifier D='12345'
 CHOPT
        C
          Options D=' '
 

CHOPT:

 '' ''
       Draw an histogram.
 'C'
       Draw a smooth curve.
 'S'
       Superimpose plot on top of existing picture.
 '+'
       Add contents of ID to last plotted histogram.
 'B'
       Select Bar chart format.
 'L'
       Connect channels contents by a line.
 'P'
       Draw the current polymarker at each channel.
 '*'
       Draw a * at each channel.
 

Each element of VNAME (real) is used to fill an histogram which is automatically booked with 100 channels and then
plotted. If VNAME has the form VNAME1%VNAME2 then a scatter-plot of vector VNAME1 versus VNAME2 is plotted.
If ID is given different of 12345, then a 2-Dim histogram is created with 40 bins by 40 bins and filled. One can use the
command VECTOR/HFILL to fill an already existing histogram. When option 'S' is used, the limits of the current plot are
used to create the 1D histogram.

 /VECTOR/FIT x y ey func [ chopt np par step pmin pmax errpar ]
 

 X
         C
           Vector of X coordinates
 Y
         C
           Vector of Y coordinates
 EY
         C
           Vector of errors on Y D='?'
 FUNC
         C
           Function name
 CHOPT
         C
           Character options D=' '
 NP
         I
           Number of parameters D=0 R=0:20
 PAR
         C
           Vector of parameters
 STEP
         C
           Vector of steps size
 PMIN
         C
           Vector of lower bounds
 PMAX
         C
           Vector of upper bounds
 ERRPAR
         C
           Vector of errors on parameters
 

CHOPT:

 '' ''
       Do the fit, plot the result and print the parameters.
 '0'
       Do not plot the result of the fit. By default the fitted function is drawn unless the option 'N' below is specified.
 'S'
       Superimpose plot on top of existing picture.
 'N'
       Do not store the result of the fit bin by bin with the histogram. By default the function is calculated at the middle of
       each bin and the fit results stored with the histogram data structure.
 'Q'
       Quiet mode. No print
 'V'
       Verbose mode. Results after each iteration are printed By default only final results are printed.
 'B'
       Some or all parameters are bounded. The vectors STEP,PMIN,PMAX must be specified. Default is: All parameters
       vary freely.
 'L'
       Use Log Likelihood. Default is chisquare method.
 'D'
       The user is assumed to compute derivatives analytically using the routine HDERIV. By default, derivatives are
       computed numerically.
 'W'
       Sets weights equal to 1. Default weights taken from the square root of the contents or from HPAKE/HBARX
       (PUT/ERRORS).
 'M'
       The interactive Minuit is invoked.
 'E'
       Performs a better Error evaluation (MIGRAD + HESSE + MINOS).
 'Z'
       FUNC is the user fitting model
 

Fit a user defined function to the points defined by the two vectors X and Y and the vector of associated errors EY. See
command HISTOGRAM/FIT for explanation of parameters. Note that if option 'W' is specified or EY='?' (default), the
array EY is ignored. Option 'L' is not available.

When option 'Z' is given, FUNC is the user fitting model. FUNC is a subroutine with the calling sequence:

 
         SUBROUTINE FUNC(N,X,Y,EY,NPAR,IFLAG,NPFITS)

where

 
         - X(N),Y(N),EY(N) are the input vectors,
         - NPAR the number of parameters
         - NPFITS is an output parameter = Number of points used in the fit

The user must declare the

 
         COMMON /HCFITD/FITPAD(24),FITFUN

in FUNC

Some plotting options available in the command HISTOGRAM/PLOT can be also used.