SEE_ALSO

## NAME

phav -- Calibrate the discriminator threshold setting.

## USAGE

`phav intable outtable scheme`

## DESCRIPTION

Fit a specified pulse height distribution function to observed digital data obtained for the same target, but at different discriminator threshold settings. The measured count rate will be the INTEGRATED pulse height distribution (IPHD), which is assumed to have the form:

IPHD = 0.5 * P * SQRT(2*pi) * [1 - erf((x-Q)/(R*SQRT(2)))] + S * (exp(-x/T)) + Uwhere "erf" is the error function. This is based on the assumption that the pulse height distribution (PHD) has the form:

PHD = P/R * exp-((x-Q)**2/2*R**2) + S/T * exp(-x/T)A non-linear least squares fitting algorithm is used to determine the fitting parameters P, Q, R, S, and T. After a pulse height model is obtained, this task will look for an optimal discriminator setting using the method specified in the

`scheme`parameter.

No calibrational corrections are performed on the input data because most of these data are not obtained at the "standard" discriminator threshold setting where other calibrations are made.

The maximum number of input data points is 2,000.

## PARAMETERS

- intable [file name]
- Name of the input table, which consists of the following columns:
'DETECTOB' Detector ID (int). 'TRGTNAME' Target name (char*20). 'VOLTAGE' High voltage setting (real). 'DOBJ' Digital count rate (real). 'DOBJ_ERR' Standard deviation of count rate (real). 'THRESH' Discriminator threshold setting (real). 'EPOCH' Epoch of observation (double).

- outtable [file name]
- Name of the output table produced by
`phav`; this table will have the following columns:'SCHEME' Scheme used to determine the optimum discriminator setting (char*16). 'TRGTNAME' Target name (char*20). 'DETECTOR' Detector ID (int). 'NPOINTS' Number of input data points (int). 'ITERMAX' Number of iterations used in the least squares fitting (int). 'BEST_THRESH' Optimum discriminator setting (real). 'GAUSS_AMPL' Height of the Gaussian component (=P/R) (real). 'GAUSS_WIDTH' Half "width" of the Gaussian component (=R) (real). 'GAUSS_CENTER' Discriminator setting of the gaussian's center (=Q) (real). 'EXP_AMPL' Height of the exponential component (=S/T) (real). 'EXP_WIDTH' "Width" of the exponential component at which the exponential falls to 1/e (=T) (real). 'BACKGROUND' Constant term in the INTEGRATED PHD (=U) (real). 'CHISQ' Chi squared of the fit (real). 'WEIGHT' Weight flag of digital count (real). 'VOLTAGE' High voltage setting (real). 'TOLERANCE' Fractional sigma-squared change of the last least squares iteration (real). 'FRACTION' Specified fraction applied to the coefficient modification during the least squares fitting (real). 'TEMPMIN' Lowest temperature of all observations (real). 'TEMPMAX' Highest temperature of all observations (real). 'TEMPAVE' Average temperature (real). 'EPOCHMIN' Lower limit of epoch (double). 'EPOCHMAX' Upper limit of epoch (double). 'EPOCHAVE' Average epoch (double).

- scheme [string, allowed values = HALF_PEAK | 3HWHM_BELOW_PEAK |
- MAX_AREA_DIFF]
Scheme used to determine the optimum discriminator setting. The following three options are available: (1) "HALF_PEAK", the optimum setting is half way between the Gaussian peak and the origin, (2) "3HWHM_BELOW_PEAK", the optimum setting is 3 half-width-half-maximum (HWHM) lower than the Gaussian peak, and (3) "MAX_AREA_DIFF", the optimum occurs where the difference between the area under the Gaussian curve and the area under the exponential curve is maximized.

- (weight = 0.) [real]
- Weighting flag of the digital count rate. The weight of each data point is
proportional to the standard deviation with this flag as its exponent.
For example, if
`weight = 0.`, equal weights is applied.

- (itermax = 200) [integer, min = 1]
- The maximum number of iterations for the non-linear least squares fitting.

- (tolern = 1.E-12) [real, min = 0., max = 1.]
- The tolerance of the "goodness" of the least squares fit. If the
FRACTIONAL improvement of the sigma-squared is smaller than
`tolern`, the fit is deemed satisfactory and the least squares iteration will terminate.

- (fraction = 0.1) [real, min = 0., max = 1.]
- Specified fraction applied to the coefficients modification during the non-linear least squares fitting.

## EXAMPLES

1. Calibrate the optimal discriminator threshold setting from the input data
table `xphav$input1` and put the results in output table `yphav$output`.
Use `HALF_PEAK` as the scheme with equally weighted data.

hs> phav "xphav$input1" "yphav$output" scheme="HALF_PEAK" weight=0.

## BUGS

## REFERENCES

## SEE ALSO