/HISTOGRAM_OPERATIONS

Histogram operations and comparisons.

/HISTOGRAM/OPERATIONS/ADD id1 id2 id3 [ c1 c2 option ]

ID1 C First histogram Identifier
ID2 C Second histogram Identifier
ID3 C Result histogram Identifier
C1 R Scale factor for ID1 D=1.
C2 R Scale factor for ID2 D=1.
OPTION C Option D=' '

OPTION:

'' ''
'E'

Add histograms: ID3 = C1*ID1 + C2*ID2. Applicable to 1-Dim and 2-Dim histograms. See command HRIN to add histograms with same IDS from different files. If option 'E' is set, error bars are calculated for ID3.

/HISTOGRAM/OPERATIONS/SUBTRACT id1 id2 id3 [ c1 c2 option ]

ID1 C First histogram Identifier
ID2 C Second histogram Identifier
ID3 C Result histogram Identifier
C1 R Scale factor for ID1 D=1.
C2 R Scale factor for ID2 D=1.
OPTION C Option D=' '

OPTION:

'' ''
'E'

Subtract histograms: ID3 = C1*ID1 - C2*ID2. Applicable to 1-Dim and 2-Dim histograms. If option 'E' is set, error bars are calculated for ID3.

/HISTOGRAM/OPERATIONS/MULTIPLY id1 id2 id3 [ c1 c2 option ]

ID1 C First histogram Identifier
ID2 C Second histogram Identifier
ID3 C Result histogram Identifier
C1 R Scale factor for ID1 D=1.
C2 R Scale factor for ID2 D=1.
OPTION C Option D=' '

OPTION:

'' ''
'E'

Multiply histogram contents: ID3 = C1*ID1 * C2*ID2. Applicable to 1-Dim and 2-Dim histograms. If option 'E' is set, error bars are calculated for ID3.

/HISTOGRAM/OPERATIONS/DIVIDE id1 id2 id3 [ c1 c2 option ]

ID1 C First histogram Identifier
ID2 C Second histogram Identifier
ID3 C Result histogram Identifier
C1 R Scale factor for ID1 D=1.
C2 R Scale factor for ID2 D=1.
OPTION C Option D=' '

OPTION:

'' ''
'E'

Divide histograms: ID3 = C1*ID1 / C2*ID2. Applicable to 1-Dim and 2-Dim histograms. If option 'E' is set, error bars are calculated for ID3.

/HISTOGRAM/OPERATIONS/RESET id [ title ]

ID C Histogram Identifier Loop
TITLE C New title D=' '

Reset contents and errors of an histogram. Bin definition is not modified.

/HISTOGRAM/OPERATIONS/DIFF id1 id2 [ chopt ]

ID1 C First Histogram Identifier
ID2 C Second Histogram Identifier
CHOPT C Options D='D'

CHOPT:

'' '' The comparison is done only on the shape of the two histograms.
'N' Include also comparison of the relative normalisation of the two histograms, in addition to comparing the shapes. PROB is then a combined confidence level taking account of absolute contents.
'D' Debug printout, produces a blank line and two lines of information at each call, including the ID numbers, the number of events in each histogram, the PROB value, and the maximum Kolmogorov distance between the two histograms. For 2-Dim histograms, there are two Kolmogorov distances (see below). If 'N' is specified, there is a third line of output giving the PROB for shape alone, and for normalisation.
'O' Overflow, requests that overflow bins be taken into account.
'U' Underflow, requests that underflow bins be taken into account.
'L' Left: include x-underflows
'R' Right: include x-overflows
'T' Top: include y-overflows
'B' Bottom: include y-underflows
'F1' Histogram 1 has no error (is a function)
'F2' Histogram 2 has no error (is a function)

Test of compatibility for two 1-Dim histograms ID1 and ID2. A probability PROB is calculated as a number between zero and one, where PROB near one indicates very similar histograms, and PROB near zero means that it is very unlikely that the two arose from the same parent distribution. For two histograms sampled randomly from the same distribution, PROB will be (approximately) uniformly distributed between 0 and 1. See discussion in HBOOK manual under 'HDIFF- Statistical Considerations'. By default (if no options are selected with CHOPT) the comparison is done only on the shape of the two histograms, without consideration of the difference in numbers of events, and ignoring all underflow and overflow bins.

/HISTOGRAM/OPERATIONS/SORT id [ chopt ]

ID C Histogram Identifier Loop
CHOPT C Options D='XA'

CHOPT:

'X' X-axis is being treated.
'Y' Y-axis is being treated.
'Z' Z-axis is being treated.
'A' Alphabetically.
'E' Reverse alphabetical order.
'D' By increasing channel contents.
'V' By decreasing channel contents.

Sort the alphanumeric labels of the histogram ID according to the value of CHOPT.

/HISTOGRAM/OPERATIONS/SMOOTH id [ option sensit smooth ]

ID C Histogram or Ntuple Identifier Minus
OPTION C Options D='2M'
SENSIT R Sensitivity parameter D=1. R=0.3:3.
SMOOTH R Smoothness parameter D=1. R=0.3:3.

OPTION:

'0' Replace original histogram by smoothed.
'1' Replace original histogram by smoothed.
'2' Store values of smoothed function and its parameters without replacing the original histogram (but see note below) - the smoothed function can be displayed at editing time - see HISTOGRAM/PLOT.
'M' Invoke multiquadric smoothing (see HBOOK routine HQUAD).
'Q' Invoke the 353QH algorithm (see HBOOK routine HSMOOF).
'S' Invoke spline smoothing.
'V' Verbose (default for all except 1-D histogram).
'N' Do not plot the result of the fit.
'F' Write Fortran77 function to HQUADF.DAT (multiquadric only)

Smooth a histogram or 'simple' ntuple. ('simple' = 1, 2, or 3 variables.)

For multiquadric smoothing, SENSIT controls the sensitivity to statistical fluctuations. SMOOTH controls the (radius of) curvature of the multiquadric basis functions.

Notes:

1) The multiquadric basis functions are SQRT(R**2+D**2), where R is the distance from the 'centre', and D is a scale parameter and also the curvature at the 'centre'. 'Centres' are located at points where the 2nd differential or Laplacian of event density is statistically significant.

2) The data must be statistically independent, i.e. events (weighted or unweighted) drawn randomly from a parent probability distribution or differential cross-section.

For spline smoothing, SENSIT and SMOOTH control the no. of knots (= 10 * SENSIT) and degree of splines (= SMOOTH + 2) (thus if SENSIT and SMOOTH are at their default values a 10-knot cubic spline is used).

Notes:

1) The spline option ALWAYS replaces the contents of a 2-D histogram. (Also chi-squared is unavailable in this case.)

2) Use the SPLINE command for more flexibility.

/HISTOGRAM/OPERATIONS/SPLINE id [ isel knotx kx ]

ID C Histogram Identifier
ISEL I Option flag D=2
KNOTX I Number of knots D=10
KX I Degree of the spline D=3

Smooth 1-Dim or 2-Dim histogram ID using B-splines. If ID is a 1-Dim histogram then:

ISEL = 0,1 replace original histogram by smoothed. = 2 superimpose as a function when editing.

If ID is a 2-Dim histogram then original contents are replaced.

/HISTOGRAM/OPERATIONS/FUNCTION id ufunc

ID C Histogram Identifier
UFUNC C Name of the function

Associate the function UFUNC with the histogram ID.

Example:

HIS/OP/FUN 110 X**2 H/PL 110

/HISTOGRAM/OPERATIONS/PARAM id [ isel r2min maxpow ]

ID C Histogram Identifier
ISEL I Control word D=11
R2MIN R Min correlation coefficient D=1.
MAXPOW I Max degree of polynomials D=5 R=1:20

Perform a regression on contents of the 1-Dim histogram ID. Find the best parameterisation in terms of elementary functions (regressors). See HBOOK guide HPARAM. Control word ISEL=1000*T +100*W +10*S +P

S = 1 resulting parametric fit superimposed on histogram 0 no superposition P = 0 minimal output: the residual sum of squares is printed 1 normal output: in addition, the problem characteristics and options are printed; also the standard deviations and confidence intervals of the coefficients. 2 extensive output: the results of each iteration are printed with the normal output. W = 0 weights on histogram contents are already defined via HBARX or HPAKE. If not they are taken to be equal to the square-root of the contents. 1 weights are equal to 1. T = 0 monomials will be selected as the elementary functions 1 Chebyshev polynomials with a definition region: [-1,1] 2 Legendre polynomials with a definition region: [-1,1] 3 shifted Chebyshev polynomials with a definition region: [0,1] 4 Laguerre polynomials with a definition region: [0,+infinite] 5 Hermite polynomials with a definition region: [-inf,+inf]

The FORTRAN code of the parameterisation is written onto the file FPARAM.DAT.

/HISTOGRAM/OPERATIONS/HSETPR param value

PARAM C Parameter name D='FEPS'
VALUE R Parameter value D=0.001

Set various parameters for command PARAM.