Users familiar with HBOOK will find Handypak calls not too different. You basically make one call to "book" a histogram (that is, to define the histogram) and then make subsequent calls to accumulate data into the histogram.
We will show you a simple example of making a histogram from Prepmort, then we will show you some other Handypak routines that you can call from Prepmort, and finally we will give you a few special warnings about how to write your calls so that they will work correctly on the Alpha.
When you want to do complicated things with Handypak, you will need to refer to a copy of the real Handypak manual. The manual is available from SLAC Publications as SLAC Report 234. The title is "Handypak, a Histogram and Display Package" by Adam Boyarski. Look for Release 6.5 or later, revised in September 1988. You can probably do simple calls without the manual just by studying other people's code in DUCS. But the manual is extremely well written and lists more features than we can cover in this Workbook.
"&COMMON /JAZELL/" POINTER F_PHCHRG --> PHCHRG, P_PHCHRG --> PHCHRG; INTEGER JZBLOC; REAL*4 PT; LOGICAL FIRST / .TRUE. /; IF FIRST [ $CALL JZBLOC( 'PHCHRG', F_PHCHRG ) ERROR RETURN; FIRST = .FALSE.; CALL HDEF1(101,'R*4',40,0.,10.,' Transverse Momentum (PT)@'); CALL HDEF2(102,'R*4',40,40.,0.,-2.,50.,2.,' PT versus Tan(lambda)@'); ] BANKLOOP F_PHCHRG, P_PHCHRG [ PT = 1./ P_PHCHRG%(HLXPAR(2)); CALL HCUM1(101,PT,1.0); CALL HCUM2(102,PT,P_PHCHRG%(HLXPAR(3)),1.0); ]
In the section on using Jazelle from
Prepmort, you already saw most of what is in this piece of code.
IF FIRST... block is used to do some initial setup,
BANKLOOP is used to loop over all of the
PHCHRG banks in the current event.
The only new things to learn are the
CALL HDEF lines and the
CALL HCUM lines.
The 1 or 2 in
HCUM2 refer to whether the histogram is 1 dimensional
or 2 dimensional.
The arguments of
HDEF1 are as follows:
101was our histogram ID. It can be either a four digit integer or a four character string. If it is a string, it should be enclosed in quote marks, for example
'R*4'was our "mode of storage." It depends on what kind of variable you are going to histogram.
40was our number of bins
0.was the lower limit
10.was the upper limit
Transverse Momentum (PT)was the title.
Notice that the last character in the title string is
This character is not actually part of the title but is used by Handypak
to find the length of the string.
It must be included or the title will come out wrong.
The arguments of
HDEF2 are the same as for
The arguments of
HCUM1 are as follows:
101was our histogram ID. It needs to match the one that was in our
PTwas the variable to accumulate into the histogram.
1.0was the weighting factor to use for this accumulation. In our example, we weight all entries the same. But you have the option of varying the weighting factor from one entry to another.
The arguments of
HCUM2 are the same as for
except that after you specify the variable for the horizontal axis,
you specify the variable for the vertical axis.
If you were to include the above example into a piece of your Prepmort and
then call this Prepmort from IDA, you would have two new histograms,
numbered 101 and 102, that you could
The next section of this Workbook will teach you how to compile your
Prepmort and call it from IDA.
But first we will mention a few more important points about Handypak
and a few more Handypak routines that you might want to call from Prepmort.
If you are accumulating Real numbers, use a Real mode of storage. If you are accumulating Integers, use an Integer mode of storage.
If necessary, you can use the Fortran functions
FLOAT to convert the variable accordingly.
For example, if histogram number 35 is using
'R*4' mode of storage
and the variable
ADC is an integer, you could have:
S, at the end of the mode of storage. This turns on the scatterplot storage feature.
For example, you could have:
CALL HDEF2('VEDS','I*4S',101,100,0.,0.,.01,.2,'E Vs S-C in VXSMRD@');The reason Handypak has you set this as part of the mode of storage is that, to create a scatterplot, Handypak needs to store every point's exact coordinates while, to create any other kind of plot, Handypak just needs to store accumulated sums.
When you call any Handypak routines from Prepmort except for
you need to send character strings a special way.
Enclose the character strings in the construction
%REF( ... ).
CALL HOUT(101,%REF('POSTSCR'));The string we are sending is
'POSTSCR', the way we send it to Handypak is
The reason that the first two Handypak calls you learned,
HCUM, do not require this construction
is that the Prepmort pre-compiler adds this for you.
This was done just for those two routines because for many users those are
the only Handypak routines they call.
You will see a lot of code in DUCS that does not contain this %REF structure.
It is code that was written before we began using Alphas.
The VAX computers allowed us to leave out the
But this was not standard Fortran and the Alphas do not allow it.
You should put the
%REF structure around all Handypak calls
other than calls to
Your Handypak calls will then work on both the Alpha and the VAX.
HOUTcommand that you learned in the Workbook section: IDA Continued. But you also have the option of doing the output from Prepmort. To do this, you call the Handypak routine
For example, to output the two histograms that we created above,
CALL HOUT(101,%REF('POSTSCR')); CALL HOUT(102,%REF('POSTSCR'));This would output the histograms to a PostScript file. Note again the
%REF(...)structure required around character strings.
You can select from the same set of output devices that you can use from IDA.
If the histogram ID was specified as a character string,
use the character string in the
HOUTcommand such as
To get the same effect from Prepmort,
you have to call a different routine before you
You must first call the Handypak routine
For example, to set up output for six histograms per page, with two in the horizontal direction and three in the vertical direction,
HOPTCaffect how information is accumulated into a histogram. In general,
HOPTCis called soon after a histogram is defined.
DOPTCaffect how histograms are displayed. So
HOPTCcan be called any time before the histogram is outputted.
HOPTCand what is done by
DOPTC. Study the Handypak manual for details.
Watch out. The version of
HOPTC that you call from Prepmort
is not exactly the same as the version described in the Handypak manual.
All of the available options are the same, but the arguements are
in a different order.
The version you call from Prepmort has the histogram ID first, not last.
HOPTCcould be used.
" This line in the declarations section of the Prepmort routine " REAL SCALES(8)/0.,1.,5.,4.,10.,2.,4.,0./; " These lines later, in the executable section of the Prepmort routine " CALL HDEF2(102,'R*4',40,40.,0.,-2.,50.,2.,' PT versus Tan(lambda)@'); CALL HOPTC('ALL ','STAT',.TRUE.); CALL HOPTC('ALL ','SOUT',.TRUE.); CALL HOPTC('ALL ','HMSCAL',SCALES);The option
ALLis used here in place of a specific histogram ID.
The first two
HOPTC calls cause Handypak to do a more accurate
accumulation of statistics information for all histograms.
It accumulates statistical information at every
The default, which is to have these options set
uses only the final bin contents sums for its statistics.
HOPTC call turns on manual scales.
The default is to have the scales set automatically.
The manuals scales are set to the values specified in the Real array
HOPTCfrom Prepmort, you need to place the histogram ID argument first, not last.
CALL DOPTC ('MARKER',3) ; CALL DOPTC ('ERROR',0) ; CALL DOPTC ('LINE',1) ;
DOPTCcall sets the mark style to be mark number 3, a diamond shape (instead of the default maker which is a *).
DOPTCcall turns off the error bars (instead of the default which is to show symmetric error bars).
DOPTCcall makes lines be drawn between the plot points (instead of the default which is to just draw the points).
%REFstructures to make these calls work on the Alpha.