# Diff command in ROOT?

Hi, all:

In Paw, we have “diff” command. Please see below. I would like to know what’s the corresponding command in ROOT? Does anyone know? Thanks in advance!!

Regards,
Chengping

• HISTOGRAM/OPERATIONS/DIFF ID1 ID2 [ CHOPT ]

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

Possible CHOPT values are:

’ ’ 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.

if you have TH1 *h1 and *h2

``` h1->Add(h2,-1); ```
Rene