Overview of booking options

[HNONEQUI]

Histograms with non-equidistant bins

                 +--------------------------------------+
                 |CALL  HBOOKB (ID,CHTITL,NCX,XBINS,VMX) |
                 +--------------------------------------+
                                  

Action: As HBOOK1, but instead of giving the lower and upper limits, an array XBINS of NCX+1 elements is provided.

XBINS(1)
contains the lower edge of the first bin.
XBINS(2)
contains the lower edge of the second bin.
. ..
and so on.
XBINS(NCX+1)
contains the upper edge of the last bin.

[HPROFHIS]

Profile histograms

         +------------------------------------------------------+
         | CALL  HBPROF (ID,CHTITL,NCX,XLOW,XUP,YMIN,YMAX,CHOPT) |
         +------------------------------------------------------+
                                  
Action: Create a profile histogram. Profile histograms are used to display the mean value of Y and its RMS for each bin in X. Profile histograms are in many cases an elegant replacement of two-dimensional histograms : the inter-relation of two measured quantities X and Y can always be visualized by a two-dimensional histogram or scatter-plot; its representation on the line-printer is not particularly satisfactory, except for sparse data. If Y is an unknown (but single-valued) approximate function of X, this function is displayed by a profile histogram with much better precision than by a scatter-plot.

The following formulae show the cumulated contents (capital letters) and the values displayed by the printing or plotting routines (small letters) of the elements for bin J.

                                                  2
    H(J)  =  sum Y                  E(J)  =  sum Y
    l(J)  =  sum l                  L(J)  =  sum l
    h(J)  =  H(J)/L(J)              s(J)  =  sqrt(E(J)/L(J)- h(J)**2)
    e(J)  =  s(J)/sqrt(L(J))

The first five parameters are similar to HBOOK1. Only the values of Y between YMIN and YMAX will be considered. To fill a profile histogram, one must use CALL HFILL (ID,X,Y,1.).

H(J) is printed as the channel contents. The errors displayed are s(J) if CHOPT='S' (spread option), or e(J) if CHOPT=' ' (error on mean).

[HROUNDIN]

Rounding

                       +--------------------------+
                       | CALL  HBINSZ ('YES'/'NO') |
                       +--------------------------+
                                  

Action: Round the bin size for bookings of subsequent histograms to a reasonable value, i.e.: 1.,1.5,2.,2.5,4.,5. times an integer power of 10. HBINSZ controls a switch that, when on, rounds the binsize, still respecting the number of bins. The switch is initially off.

Input parameters:
'YES'
enable the 'reasonable rounding' feature.
'NO'
disable the 'reasonable rounding' feature.

[HPROSLBA]

Projections, Slices, Bands

                          +--------------------+
                          |CALL  HBPRO (ID,VMX) |
                          +--------------------+
                                  

Action: Books the projections of a 2-dimensional histogram as two 1-dimensional histograms.

Input parameters:
ID
identifier of an existing 2-dimensional histogram ID=0 means book projections for all existing 2-dimensional histograms.
VMX
upper limit of single channel content.

Remark:

  1. if ID does not exist, or is a 1-dimensional histogram, the call does nothing
  2. see HBOOK1 for details about VMX
  3. booking of projections can be executed only after the 2-dimensional histogram with identifier ID has been booked.
                            +----------------------+
                            | CALL  HBPROX (ID,VMX) |
                            +----------------------+
                            and--------------------+
                            | CALL  HBPROY (ID,VMX) |
                            +----------------------+
                                      

    Action: Books projection onto X or Y only. See HBPRO for more details.

                         +------------------------------+
                         | CALL  HBANDX (ID,YMI,YMA,VMX) |
                         +------------------------------+
                                      

    Action: Books a projection onto X, restricted to the Y interval (YMI,YMA).

    Input parameters:
    ID
    identifier of an existing 2-dimensional histogram
    YMI
    lower limit of Y interval
    YMA
    upper limit of Y interval
    VMX
    maximum value to be stored in 1 channel.

    The same remarks as for HBPRO apply.

                         +------------------------------+
                         | CALL  HBANDY (ID,XMI,XMA,VMX) |
                         +------------------------------+
                                      

    Action: As HBANDX but the projection is onto Y.

    
                           +--------------------------+
                           |CALL  HBSLIX (ID,NSLI,VMX) |
                           +--------------------------+
                                      

    Action: Books slices along Y of 2-dimensional histograms as NSLI 1-dimensional histograms. Each slice is a projection onto X restricted to an interval along the Y axis.

    Input parameters:
    ID
    identifier of an existing 2-dimensional histogram
    NSLI
    number of slices
    VMX
    maximum value to be stored in 1 channel.

    The same remarks as for HBPRO apply.

                           +--------------------------+
                           |CALL  HBSLIY (ID,NSLI,VMX) |
                           +--------------------------+
                                      

    Action: As HBSLIX but slices are projected onto Y.

    [HSTATIS1]

    Statistics

    Mean value and standard deviation of 1-dimensional histograms are calculated at editing time, using the channel contents. If a more accurate calculation is desired, or if more statistical information is needed, the following option will provide it : CALL HIDOPT (ID,'STAT') STAT

                                +----------------+
                                |CALL  HBARX (ID) |
                                +----------------+
    
                                      

    Action: Store the errors for 1-dimensional histograms, X-projections, etc., in memory and superimpose them on the plot during output. This routine must be called after booking but before filling.

    Input parameters:
    ID
    identifier of an existing histogram. ID=0 means all histograms already booked.

    If ID corresponds to a 2-dimensional histogram, HBARX acts on all X projections, slices, bands.

                                              i
                                             n   2
                             Error(i)= sqrt(sum W  )
                                            j=1  ji
    

    where :

        i  bin number
        i
       n   number of entries in bin i
      W    weight of event j in bin i
       ji
    

    It is clear that the sum of the squares of weights in each bin must also be stored to perform this calculation. However when filling with weight always equal to 1, errors can be calculated from bin contents only, and HBARX, HBARY need not be called. The superimposition of error bars can be selected at output time, using HIDOPT(ID,'ERRO') ERRO In both cases the values of errors can be printed under the contents, via the editing option HIDOPT(ID,'PERR') HPAKE permits user-defined error bar setting.

    
                                +----------------+
                                |CALL  HBARY (ID) |
                                +----------------+
                                      

    Action: As HBARX, it is used to act on Y projections of 2-dimensional histograms.

    [HFUNCREP]

    Function Representation

                    +----------------------------------------+
                    | CALL  HBFUN1 (ID,CHTITL,NX,XMI,XMA,FUN) |
                    +----------------------------------------+
                                      

    Action: Books 1-dimensional histogram and fills it with the values of the external function FUN(X) computed at the centre of each bin. One computer word per channel is used.

    The first five parameters are as for HBOOK1.

    Input parameters:
    ID
    histogram identifier, integer non zero
    CHTITL
    histogram title (character variable or constant up to 80 characters)
    NX
    number of channels
    XMI
    lower edge of first channel
    XMA
    upper edge of last channel
    FUN
    real function of one variable, to be declared EXTERNAL in the calling subroutine, and to be supplied by the user.

    
               +--------------------------------------------------+
               |CALL  HBFUN2 (ID,CHTITL,NX,XMI,XMA,NY,YMI,YMA,FUN) |
               +--------------------------------------------------+
                                      

    Action: Books a 2-dimensional histogram and fills it with the values of the external function FUN(X,Y), computed at the centre of each bin. One computer word per channel is used.

    The first eight parameters are as for HBOOK2.

    Input parameters:
    ID
    histogram identifier, integer
    CHTITL
    histogram title (character variable or constant up to 80 characters)
    NX
    number of channels in X
    XMI
    lower edge of first X channel
    XMA
    upper edge of last X channel
    NY
    number of channels in Y
    YMI
    lower edge of first Y channel
    YMA
    upper edge of last Y channel
    FUN
    real function of two variables, to be declared EXTERNAL in the calling subroutine, and to be supplied by the user.

                              +--------------------+
                              |CALL  HFUNC (ID,FUN) |
                              +--------------------+
                                      

    Action: Samples the function FUN, which must have been declared EXTERNAL, at the centre of the bins of a histogram. The function will be superimposed onto the histogram at editing time and its values optionally printed out (see HIDOPT(ID,'PFUN') PFUN

    Input parameters:
    ID
    identifier of an existing 1-dimensional histogram. ID=0 signals that the function should be calculated for all existing 1-dimensional histograms.
    FUN
    External real function, e.g. REAL FUNCTION FUN(X). The function parameter X will be the central value of a histogram bin. The user must return the corresponding function at that point as a value in FUN.

    Remark:

    1. Not existing for 2-dimensional histograms.
    2. Function FUN cannot contain any call to an entry of the HBOOK package.
    3. HFUNC can be called several times for the same histogram identifier ID. If the latter case, the values of the old function will be overwritten by the new one. 2
    4. The chi-squared chi , as defined below, will be printed along with the statistical information at the bottom of the histogram.

                          2  n                 2     i     2
                       chi = sum (((C(i)- F(i)) )/(sum  W   ))
                             i=1                    j=1  ji
      

      with:

      
        n    the number of channels of the histogram
         ch
        C(i) the contents of channel i
        F(i) the value of the function at the centre of channel i
          i
         n   the number of entries in channel ii
        W    the weight of event j in channel i
         ji
             i.e. square root of the contents C(i) or as given by  HBARX/ HPAKE
      

      Reserve array in memory

                           +------------------------------+
                           | CALL  HARRAY (ID,NWORDS,LOC*) |
                           +------------------------------+
                                        

      Action: Reserves an array in the memory storage area managed by HBOOK.

      Input parameters:
      ID
      identifier of the array (pseudo-histogram)
      NWORDS
      length of the array.
      Output Parameters
      LOC
      Address minus one in the internal HBOOK common block /PAWC/ of the 1st element of the array, i.e.
            COMMON/PAWC/NWPAW,IXPAWC,IHDIV,IXHIGZ,IXKU,FENC(5),LMAIN,HCV(9989)
            DIMENSION IQ(2),Q(2),LQ(8000)
            EQUIVALENCE (LQ(1),LMAIN),(IQ(1),LQ(9)),(Q(1),IQ(1))
            IADDR = Q(LOC+1)
      

      Remark:

      At any time the address of preudo-histogram ID can be obtained with HLOCAT(ID,LOC)

      Axis labels and histograms

      A set of routines, HLABEL, HFC1 and HFC2, allows one to associate labels with histogram channels. This association can be made before or after a histogram is filled, but it has the advantage that the label information get stored in the histogram data structure, so that it is available for all future plots in an automatic way in the HPLOT and PAW packages. Printing histograms with associated alphanumeric labels is not implemented in the line-printer oriented routines of HBOOK.

                        +------------------------------------+
                        | CALL  HLABEL (ID,NLAB,*CLAB*,CHOPT) |
                        +------------------------------------+
                                        

      Action: Associates alphanumeric labels with a histogram. This routine can be called for a histogram after it has been filled, and then the labels specified will be shown on the respective axes. The routine can also be called before a histogram is filled , and in this case, when filling, a certain order can be imposed. By default the entries will be automatically ordered.

      Input parameters:
      ID
      Histogram identifier.
      NLAB
      Number of labels.
      CHOPT
      Character variable specifying the option desired.
      ' '
      As 'N' below.
      'N'
      Add NLAB new labels read in CLAB to histogram ID.
      'R'
      Read NLAB labels into in CLAB from histogram ID.
      'X'
      X-axis is being treated (default).
      'Y'
      Y-axis is being treated.
      'Z'
      Z-axis is being treated.
      'S'
      Sorting order of the labels:
      'S'
      default, as SA;
      'SA'
      alphabetically;
      'SE'
      reverse alphabetical order;
      'SD'
      by increasing channel contents (after filling);
      'SV'
      by decreasing channel contents (after filling).
      'T'
      Modify (replace) NLAB existing labels read from CLAB in histogram ID.
      Input/Output parameter:
      *CLAB*
      Character variable array with NLAB elements (input and output).

      Notes:

      1. For one-dimensional histograms HLABEL can be called at any time.
      2. For two-dimensional histograms one must call HLABEL with option 'N' for each axis between the call to HBOOK2 and the first call to HFC2.