|
|
|
The histogramming functions are summarized in Table 5.5.
Histograms are created with calls to either histo(...)
or
histo2d(...)
for one- or two-dimensional histograms,
respectively. These calls return a handle to the created
histogram which must be used to refer to the object when filling,
clearing etc. This handle is used just inside the current task context
and has nothing to do with e.g. PAW's histogram identifiers.
The usual way of using histograms is by means of filling via
calls to hfill
or hfill2d
, respectively. However, you
can also ''abuse'' the histograms for producing x/y plots, where one
quantity is simply plotted against another. Simply use hpoke(h, bin, y);
for entering a point at (bin,y). It is important to remember
to use the x-coordinate in units of bins (indexing with floats will
not give the desired results). Once all desired channels are filled,
the information can automatically be transferred to the display
program with the update();
call. This causes the current contents of
the histograms to be transferred to paw (To make this work
correctly, you should switch off the automatic (periodic) update done
by YODA by default. To do so, enter set_updatetimer 0
in YODA's
terminal window. Periodic update can be restored with
set_updatetimer VALUE
, where VALUE
is the time between
refresh cycles in milliseconds).
The histogram can then be cleared with hclear(h);
.
The corresponding calls for two-dimensional histograms are available
as well and work just in the same manner.
Histograms can also be read from and written to file in either HBOOK or YODAs native YZ format (see table 5.5).
The histogramming functions set a variable ERRNO, to test if the last command was successful (ERRNO == 0) or not (ERRNO > 0). See table 5.5 for an explanation of the error codes.