Manipulation of histograms. Interface to the HBOOK package.
/HISTOGRAM/FILE lun fname [ lrecl chopt ]
LUN
I
Logical unit
number R=0:128
FNAME
C
File name
LRECL
I
Record length
in words D=1024
CHOPT
C
Options D='
'
CHOPT:
'' ''
Existing file is opened (read
mode only).
'N'
A new file is opened.
'U'
Existing file is opened to be
modified.
'D'
Reset lock.
Open an HBOOK direct access file.
If LUN is 0 the next free logical unit will be used.
If LRECL is 0 the system will determine the correct record length of
an existing file. The maximale record length which can
be auto detected is LRECL=8192
/HISTOGRAM/LIST [ chopt ]
CHOPT
C
Options D='
'
CHOPT:
'' ''
List histograms and Ntuples in
the current directory.
'I'
A verbose format is used (HINDEX),
(only for //PAWC).
'S'
List with histograms sorted by
increasing IDs.
List histograms and Ntuples in the current directory.
/HISTOGRAM/DELETE id
ID
C
Histogram Identifier Loop
Delete histogram/Ntuple ID in Current Directory (memory).
If ID=0 all histograms and Ntuples are deleted.
To delete histograms in disk files use command HIO/HSCRATCH.
/HISTOGRAM/PLOT [ id chopt ]
ID
C
Histogram Identifier
Loop Minus
CHOPT
C
Options D='
' Minus
CHOPT:
'' ''
Draw the histogram.
'C'
Draw a smooth curve.
'S'
Superimpose plot on top
of existing picture.
'+'
Add contents of ID to last
plotted histogram. Use option K with previous histogram if you have several
zones.
'-'
Substract contents of ID
to last plotted histogram. Use option K with previous histogram if you
have several
zones.
'+-'
Draw the delta with the
last plotted histogram. Use option K with previous histogram if you have
several zones.
'B'
Select Bar chart format.
'L'
Connect channels contents
by a line.
'P'
Draw the current polymarker
at each channel or cell.
'*'
Draw a * at each channel.
'K'
Must be given if option
'U' or '+' is given later.
'U'
Update channels modified
since last call.
'E'
Draw error bars and current
marker.
'E0'
Draw error bars without
symbols clipping.
'E1'
Draw small lines at the
end of the error bars.
'E2'
Draw error rectangles.
'E3'
Draw a filled area through
the end points of the vertical error bars.
'E4'
Draw a smoothed filled area
through the end points of the vertical error bars.
'A'
Axis labels and tick marks
are not drawn.
'BOX'
Draw 2-Dim with proportional
boxes.
'COL'
Draw 2-Dim with a color
table.
'Z'
Used with COL or SURF, it
draws the color map.
'SURF'
Draw as a surface plot (angles
are set via the command angle).
'SURF1'
Draw as a surface with color
levels
'SURF2'
Same as SURF1 but without
cell lines.
'SURF3'
Same as SURF but with the
contour plot (in color) on top.
'SURF4'
Draw as a surface with Gouraud
shading.
'LEGO'
Draw as a lego plot (angles
are set via the command angle).
'LEGO1'
Draw lego plot with light
simulation.
'LEGO2'
Draw lego plot with color
levels.
'BB'
Suppress the Back Box on
3D plots.
'FB'
Suppress the Front Box on
3D plots.
'CONT'
Draw 2-Dim as a contour
plot (15 levels).
'TEXT'
Draw 2-Dim as a table.
'CHAR'
Draw 2-Dim with characters
(a la HBOOK).
'HIST'
Draw only histogram (no
errors or associated function).
'FUNC'
Draw only the associated
function (not the histogram).
'CYL'
Cylindrical coordinates
for 3D plots.
'POL'
Polar coordinates for 3D
plots.
'SPH'
Spherical coordinates for
3D plots.
'PSD'
Pseudo-rapidity/phi coordinates
for 3D plots.
Plot a single histogram or a 2-Dim projection. If ID=0 or ID=* all the
histograms in the current directory are plotted. Each
plotted histogram will start either a new picture or a new zone in
the current picture.
Histogram subranges can be specified in 2 different ways:
PAW > h/pl id(ic1:ic2) | with ic1 and ic2
integers means plot
| from channel ic1 to channel ic2
PAW > h/pl id(x1:x2) | with x1
and x2 reals (with a .) means plot
| from channel corresponding to x1
Note that the mixed mode h/pl id(x1:ic2) is also accepted.
If ic1 or x1 are omitted, the first channel is used. If ic2 or x2 are omitted, the last channel is used.
PAW > h/pl 10(:20)
| equivalent to h/pl 10(1:20)
PAW > h/pl 10(20:)
| plot from channel 20 to the last channel
This subrange works also for 2-DIM cases. Example:
PAW > Histo/plot 10(25:1.)
PAW > Histo/plot 20(4:18,0.:0.5)
A specific histogram cycle can be accessed:
PAW > h/pl id;nc | cycle number nc is used
(default is highest cycle)
1 Dim histograms could be plotted with option LEGO or SURF. In this case the angles are THETA=1 and PHI=-1.
When option 'E' is used, the marker type can be changed with SET MTYP,
the marker size with SET KSIZ, the marker
color with SET PMCI.
With Option E1, the size of the tick marks at the end of the error bars
is equal to the marker size and can be changed with
SET KSIZ.
When the option E is used with the option SURF1, SURF2, SURF3 or LEGO1,
the colors are mapped on the errors not on
the content of the histogram.
To plot projection X of ID type
PAW > HI/PLOT ID.PROX
To plot band 1 in Y of ID type
PAW > HI/PLOT ID.BANY.1
To plot slice 3 in Y of ID type
PAW > HI/PLOT ID.SLIY.3
In addition to the Cartesian coordinate systems, Polar, cylindrical,
spherical, pseudo-rapidity/phi coordinates are available for
LEGO and SURFACE plots, including stacked lego plots. For example:
PAW > Histo/plot 10+20+30
LEGO1,CYL | stacked cylindrical lego plot
PAW > Histo/plot 10+20+30
LEGO1,POL | polar
PAW > Histo/plot 10+20+30
LEGO1,SPH | spherical
PAW > Histo/plot 10+20+30
LEGO1,PSD | pseudo-rapidity/phi
Note that the viewing angles may be changed via the command ANGLES.
The axis, the front box, and the back box can be
suppressed on 3D plots with the options 'A', 'FB' and 'BB'.
/HISTOGRAM/ZOOM [ id chopt icmin icmax ]
ID
C
Histogram Identifier
Loop Minus
CHOPT
C
Options D='
'
ICMIN
I
First channel
D=1
ICMAX
I
Last channel
D=9999
CHOPT:
'' ''
Plot the zoomed 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.
Plot a single histogram between channels ICMIN and ICMAX. Each plotted
histogram will start either a new picture or a
new zone in the current picture. If no parameters are given to the
command, then the system waits for two points using the
graphics cursor. To quit ZOOM, click the right button of the mouse
or CRTL/E.
/HISTOGRAM/MANY_PLOTS idlist
IDLIST
C
List of histogram
Identifiers Vararg
Plot one or several histograms into the same plot. Plotted histograms are superimposed on the same zone of the picture.
/HISTOGRAM/PROJECT id
ID
C
Histogram Identifier Loop
Fill all booked projections of a 2-Dim histogram. Filling is done using the 2-D contents of ID.
/HISTOGRAM/COPY id1 id2 [ title ]
ID1
C
First histogram Identifier
ID2
C
Second histogram Identifier
Loop
TITLE
C
New title D=' '
Copy a histogram onto another one. Bin definition, contents, errors,
etc. are preserved. If TITLE is not given, ID2 has the
same title as ID1.
It is possible to copy a projection of a 2D histogram into a 1D histogram.
Ranges can be specify in the first histogram identifier to reduce or enlarge the X or Y scale.
Example:
Fun2 2 x*y 40 0 1 40 0 1 ' '
| Create a 2D histogram
Slix 2 10 ; H/proj 2
| Slices on X
H/Copy 2.slix.3 3
| Copy the slice 3
H/Copy 2(0.:.5,-1.:2.) 4
| Copy with new X and Y scales
/HISTOGRAM/FIT id func [ chopt np par step pmin pmax errpar ]
ID
C
Histogram
Identifier
FUNC
C
Function
name D=' '
CHOPT
C
Options
D=' '
NP
I
Number
of parameters D=0 R=0:34
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). If the L option
is given (Log Likelihood), bins with errors=0 are excluded of the fit.
'M'
The interactive Minuit is invoked.
(see Application HMINUIT below).
'E'
Performs a better Error evaluation
(MIGRAD + HESSE + MINOS).
'U'
User function value is taken from
/HCFITD/FITPAD(24),FITFUN. Allows to do fitting in DOUBLE PRECISION.
'K'
Keep the settings of Application
HMINUIT for a subsequent command.
Fit a user defined (and parameter dependent) function to a histogram
ID (1-Dim or 2-Dim) in the specified range. FUNC
may be:
A) The name of a file which contains the user defined function to be
minimized. Function name and file name must be the
same. The function must be of type REAL. For example file 'func.f'
is:
REAL FUNCTION FUNC(X)
or FUNC(X,Y) for a 2-Dim histogram
COMMON/PAWPAR/PAR(2)
FUNC=PAR(1)*X +PAR(2)*EXP(-X)
END
PAW > His/fit 10 func.f ! 2 par
To do fitting in DOUBLE PRESICION option U should be used. In that case, the file 'func.f' should look like:
REAL FUNCTION FUNC(X)
or FUNC(X,Y) for a 2-Dim histogram
DOUBLE PRECISION FITPAD(24),FITFUN
COMMON/HCFITD/FITPAD,FITFUN
FITFUN=FITPAD(1)*X
+FITPAD(2)*EXP(-X)
FUNC=FITFUN
END
B) One of the following keywords (1-Dim only):
G : to fit Func=par(1)*exp(-0.5*((x-par(2))/par(3))**2)
E : to fit Func=exp(par(1)+par(2)*x)
Pn: to fit Func=par(1)+par(2)*x+par(3)*x**2......+par(n+1)*x**n
PAW > His/fit 10 G
C) A combination of the keywords in B with the 2 operators + or *.
PAW > His/Fit 10 p4+g ! 8 par
PAW > His/Fit 10 p2*g+g ! 9 par
In this case, the order of parameters in PAR must correspond to the
order of the basic functions. For example, in the first case
above, par(1:5) apply to the polynomial of degree 4 and par(6:8) to
the gaussian while in the second case par(1:3) apply to the
polynomial of degree 2, par(4:6) to the first gaussian and par(7:9)
to the second gaussian. Blanks are not allowed in the
expression.
For cases A and C, before the execution of this command, the vector
PAR must be filled (via Vector/Input) with the initial
values. For case B, if NP is set to 0, then the initial values of PAR
will be calculated automatically. After the fit, the vector
PAR contains the new values of parameters. If the vector ERRPAR is
given, it will contain the errors on the fitted
parameters. A bin range may be specified with ID.
PAW > Histo/Fit 10(25:56).
When the Histo/it command is used in a macro, it might be convenient
to specify MINUIT directives in the macro itself via
the Application HMINUIT as described in this example:
Macro fit
Application HMINUIT exit
name 1 par_name1
name 2 par_name2
migrad
improve
exit
Histo/fit id fitfun.f M
Return
Some plotting options available in the command HISTOGRAM/PLOT can be also used.