Arithmetic Operations

[HARITHME]

Histograms can be added, subtracted, divided or multiplied, provided their number of channels are the same.

                +----------------------------------------+
                | CALL  HOPERA (ID1,CHOPER,ID2,ID3,C1,C2) |
                +----------------------------------------+
                                  

Action: Fills an histogram I3 with values such that, logically (operands are the bin contents)

ID3 = C1 * ID1 (OPERATION) C2 * ID2

Input parameters:
ID1,ID2
Operand histogram identifiers.
CHOPER
Character variable specifying the kind of operation to be performed (+,-,*,/) and 'E', whether errors have to be calculated (see below).
ID3
Identifier of the histogram containing the result after the operation.
C1,C2
Multiplicative constants.

Remark:

  1. ID1, ID2 and ID3 must have the same number of channels.
  2. If histogram ID3 is not empty, its contents are overwritten
  3. The output histogram ID3 can be either one of the input histograms ID1 or ID2.
  4. If histogram ID3 does not exist, it is created by HOPERA with the same specification as for histogram ID1.
  5. The mean value, standard deviation, etc. are calculated from the contents of the resulting histogram ID3, unless the 'STAT' option STAT is active and the operation is an addition or subtraction, in which case they are computed exactly.
  6. A division by zero gives zero.
  7. Negative results for bin contents in a packed histogram are meaningless
  8. The number of entries in the resulting histogram ID3 is set to the sum of the entries in histograms ID1 and ID2.
  9. When an operation is performed on two 1-dimensional histograms with the sum of the squares of the weights stored (option HBARX), the error on the resulting histogram is calculated supposing that the contents of the two input histograms ID1 and ID2 are uncorrelated. This is valid also for projections, slices and bands of 2-dimensional histograms.
  10. If histogram ID3 is packed the number of bits allocated per channel (cell) has to be sufficient to store the results.
  11. If the parameter HOPERA computes the error bars on the resulting histograms correctly, assuming that the input histograms ID1 and ID2 are independent.