Below a simple example is given describing
how to use HBOOK for booking, filling and printing simple histograms.
After telling HBOOK the length of the /PAWC/
common block
to be 10000
words with a call to HLIMIT, a
global title to appear on all histograms is specified by calling
HTITLE.
Next a 100 bin one-dimensional histogram with identifier 10 is booked
with a call to HBOOK1, followed by the booking
using a call to HBOOK2 of a two-dimensional histogram with identifier 20
and consisting of 100 times 40 cells.
The DO
-loop labelled 10 fills the one-dimensional histogram 10,
while the nested DO
loops labelled 20 and 30 look after filling
the two-dimensional histogram 20.
In both cases a call is made to routine HFILL.
Finally a call to HISTDO writes an index with information
about all histograms as well as a lineprinter representation of
the histograms on standard output.
Example of how to produce simple histograms
PROGRAM HSIMPLE * PARAMETER (NWPAWC = 10000) COMMON/PAWC/H(NWPAWC) *.___________________________________________ CALL HLIMIT(NWPAWC) * Set global title * CALL HTITLE('EXAMPLE NO = 1') * Book 1-dim histogram and scatter-plot * CALL HBOOK1(10,'EXAMPLE OF 1-DIM HISTOGRAM',100,1.,101.,0.) CALL HBOOK2(20,'EXAMPLE OF SCATTER-PLOT',100,0.,1.,40,1.,41.,30.) * Fill 1-dim histogram * DO 10 I=1,100 W=10*MOD(I,25) CALL HFILL(10,FLOAT(I)+0.5,0.,W) 10 CONTINUE * Fill scatter-plot * X=-0.005 DO 30 I=1,100 X=X+0.01 DO 20 J=1,40 Y=J IW=MOD(I,25)*MOD(J,10) IWMAX=J-MOD(I,25)+10 IF(IW.GT.IWMAX)IW=0 CALL HFILL(20,X,Y,FLOAT(IW)) 20 CONTINUE 30 CONTINUE * Print all histograms with an index * CALL HISTDO END
EXAMPLE NO = 1 ............................................................................................................................. . . . HBOOK HBOOK CERN VERSION 4.13 HISTOGRAM AND PLOT INDEX 17/12/91 . . . ............................................................................................................................. . . . NO TITLE ID B/C ENTRIES DIM NCHA LOWER UPPER ADDRESS LENGTH . . . ............................................................................................................................. . . . . . 1 EXAMPLE OF 1-DIM HISTOGRAM 10 32 100 1 X 100 0.100E+01 0.101E+03 79369 149 . . . . . . 2 EXAMPLE OF SCATTER-PLOT 20 5 4000 2 X 100 0.000E+00 0.100E+01 79217 760 . . Y 40 0.100E+01 0.410E+02 78482 726 . . . ............................................................................................................................. MEMORY UTILISATION MAXIMUM TOTAL SIZE OF COMMON /PAWC/ 80000 EXAMPLE NO = 1 -------------- EXAMPLE OF 1-DIM HISTOGRAM HBOOK ID = 10 DATE 17/12/91 NO = 1 250 240 - - - - 230 -I -I -I -I 220 -II -II -II -II 210 -I I -I I -I I -I I 200 -I I -I I -I I -I I 190 -I I -I I -I I -I I 180 -I I -I I -I I -I I 170 -I I -I I -I I -I I 160 -I I -I I -I I -I I 150 -I I -I I -I I -I I 140 -I I -I I -I I -I I 130 -I I -I I -I I -I I 120 -I I -I I -I I -I I 110 -I I -I I -I I -I I 100 -I I -I I -I I -I I 90 -I I -I I -I I -I I 80 -I I -I I -I I -I I 70 -I I -I I -I I -I I 60 -I I -I I -I I -I I 50 -I I -I I -I I -I I 40 -I I -I I -I I -I I 30 -I I -I I -I I -I I 20 -I I -I I -I I -I I 10 -I I -I I -I I -I I CHANNELS 100 0 1 10 0 1 2 3 4 5 6 7 8 9 0 1 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 CONTENTS 100 111111111122222 111111111122222 111111111122222 111111111122222 10 123456789012345678901234 123456789012345678901234 123456789012345678901234 123456789012345678901234 1. 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 LOW-EDGE 100 1 10 1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990 1. 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 * ENTRIES = 100 * ALL CHANNELS = 0.1200E+05 * UNDERFLOW = 0.0000E+00 * OVERFLOW = 0.0000E+00 * BIN WID = 0.1000E+01 * MEAN VALUE = 0.5433E+02 * R . M . S = 0.2854E+02 \finalnewpage EXAMPLE NO = 1 -------------- EXAMPLE OF SCATTER-PLOT HBOOK ID = 20 DATE 17/12/91 NO = 2 CHANNELS 100 U 0 1 O 10 N 0 1 2 3 4 5 6 7 8 9 0 V 1 D 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 E ************************************************************************************************************ OVE * * OVE 40 * * 40 39 * 9IR* 9IR* 9IR* 9IR* * 39 38 * 8GO** 8GO** 8GO** 8GO** * 38 37 * 7ELS* 7ELS* 7ELS* 7ELS* * 37 36 * 6CIOU* 6CIOU* 6CIOU* 6CIOU* * 36 35 * 5AFKPU* 5AFKPU* 5AFKPU* 5AFKPU* * 35 34 * 48CGKOS* 48CGKOS* 48CGKOS* 48CGKOS* * 34 33 * 369CFILORU 369CFILORU 369CFILORU 369CFILORU * 33 32 * 2468ACEGIKMOQS 2468ACEGIKMOQS 2468ACEGIKMOQS 2468ACEGIKMOQS * 32 31 * +23456789ABCDEFGHIJK +23456789ABCDEFGHIJK +23456789ABCDEFGHIJK +23456789ABCDEFGHIJK * 31 30 * * 30 29 * 9IR 9IR 9IR 9IR * 29 28 * 8GO* 8GO* 8GO* 8GO* * 28 27 * 7ELS 7ELS 7ELS 7ELS * 27 26 * 6CIOU 6CIOU 6CIOU 6CIOU * 26 25 * 5AFKP 5AFKP 5AFKP 5AFKP * 25 24 * 48CGKO 48CGKO 48CGKO 48CGKO * 24 23 * 369CFILO 369CFILO 369CFILO 369CFILO * 23 22 * 2468ACEGIK 2468ACEGIK 2468ACEGIK 2468ACEGIK * 22 21 * +23456789ABCDEF +23456789ABCDEF +23456789ABCDEF +23456789ABCDEF * 21 20 * * 20 19 * 9I 9I 9I 9I * 19 18 * 8GO 8GO 8GO 8GO * 18 17 * 7EL 7EL 7EL 7EL * 17 16 * 6CI 6CI 6CI 6CI * 16 15 * 5AFK 5AFK 5AFK 5AFK * 15 14 * 48CG 48CG 48CG 48CG * 14 13 * 369CF 369CF 369CF 369CF * 13 12 * 2468ACE 2468ACE 2468ACE 2468ACE * 12 11 * +23456789A +23456789A +23456789A +23456789A * 11 10 * * 10 9 * 9 9 9 9 * 9 8 * 8G 8G 8G 8G * 8 7 * 7E 7E 7E 7E * 7 6 * 6C 6C 6C 6C * 6 5 * 5A 5A 5A 5A * 5 4 * 48 48 48 48 * 4 3 * 369 369 369 369 * 3 2 * 2468 2468 2468 2468 * 2 1 * +2345 +2345 +2345 +2345 * 1 UND * * UND ************************************************************************************************************ LOW-EDGE 0 0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999 0 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 * I I * ENTRIES = 4000 PLOT ---------I---------I--------- * SATURATION AT= 31 I 10488I * SCALE .,+,2,3,.,., A,B, STATISTICS ---------I---------I--------- * STEP = 1.00 * MINIMUM=0.000 I I