HistCompr Gather histograms and compare to standard distributions.
The HistCompr monitor compiles histograms from a list of channels. It then compares these histograms to a set of standard histograms and generates a trigger if the histograms differ significantly. Both the histogram and the reference are served to the DMT viewer by way of the monitor data protocol.HistCompr performs the following steps.
- Read reference histograms from the specified directory. The histogram is read from the file with the same name as the histogram. If a reference directory is not specified, or if there is no file with the appropriate name, the is step is omitted.
- Fill the histogram. The histogram is filled for the length of time specified by the -time command line argument. The histogram is served to any client while the data are being filled.
- Compare to reference. When the histogram has been filled for the specified time, the Histogram data are compared to the reference histogram (if specified). If the resulting chi-square is greater than the limit specified in the configuration file, and the -trig argument was specified on the command line, a HistCompr trigger is generated. If the chi-square exceeds the limit and the -plot argument was specified, The histogram is plotted on the DISPLAY monitor. In any case the histogram is cleared and the filling process is repeated.
- Save histograms. On termination, if the -savdir argument was specified, all Histograms are saved in the specified directory. The histogram names are used as the file names.
HistCompr can therefore be used in the following modes:
- Background histogrammer: If the -refdir and -savdir arguments are omitted, HistCompr will collect all histograms specified in the configuration file. These may be interrogated using the monitor data message protocol (e.g. with the DMT viewer).
- Collect reference histograms: If the -savdir argument is specified, HistCompr will collect histograms and save them in the directory specified by the -savdir argument on termination. The saved histograms are named appropriately to be used as references for subsequent trigger runs.
- Trigger generation: If the -refdir argument is specified, HistCompr will periodically compare the collected histograms to the reference histogram found in the specified directory. If the resulting chi-square is greater than the limit value specified in the configuration file, and if the -trig argument was specified, HistCompr grnerates a trigger with an ID of "HistCompr" and a sub-ID of the histogram name.
Running HistCompr
The HistCompr command line is as follows:
HistCompr [-conf <config-file>] [-time <reset-time>] [-savedir <save-dir>] \ [-refdir <reference-dir>] [-osc <osc-config>] [-plot] [-trig]The arguments have the following meaning:
<config-File> Configuration file name <reset-time> All histograms are reset after the specified time has elapsed. <save-dir> Directory into which to save the histograms. <reference-dir> Directory from which the reference histograms are to be fetched. <osc-config> Configuration file for an Operating State Condition list to be used to qualify data for histogramming. -plot Call Root plotter for every histogram failing the comparison. -trig Enable trigger generation. Configuration File
The HistCompr configuration file specifies which channels are to be histogrammed, the binning and options. Each line within a configuration file specifies a histogram to be made. The contents of a configuration file line are as follows:
- Filter directive:
p0 Filter name. p1 Type of filter (BaseLine, IIRFilter or MultiPipe). p2-N Type specific arguments. Baseline Suppression Filters
p2 Time constant in seconds [1.0]. IIR Filters
p2 Sample rate p3 List of s-plane poles p4 List of s-plane zeros MultiPipe Filters
p2-N List of filter names to be used to form a pipeline - Histogram directive:
p0 Histogram name. p1 Name of chanel to be histogrammed. p2 Number of histogram bins. p3 low edge of first bin. p4 High edge of last bin. p5 Number of Chi-Square trigger threshold -base subtract baseline. -while <cond> Requisite OSC condition. - Parameter directives contain a parameter name followed by the value it is to assume.
ServerName The name under which HistCompr will register [HistCompr] HistCompr Chi-Square Calculation
The
is calculated by normalizing both the Histogram and the reference to one and using the following formula
The numbers
and
are the fractional occupation of the
histogram or reference bin respectively. N is the number of bins in the histogram. Note that the overflow and underflow counts are treated identically to the histogram bins.
is the total number of histogram entries. This formula assumes (among other things) that the reference histogram is an exact representation of the desired distribution. Any occurance of a non-zero histogram bin with a zero reference would give an undefined chi-square. To prevent this, the error on the difference is redefined to be
when this case occurs.
alphabetic index hierarchy of classes
generated by doc++