Guidelines For PrimEx Monitoring Programs


Responsibilites

Each major detector or analysis subsystem has a monitoring program dedicated to it. Each program has three responsiblities it is required to address:
  1. Provide histograms or plots which indicate that the system is functioning properly.
  2. Provide histograms or plots which can be used to produce calibration constants.
  3. Provide histograms or plots which indicate the quality of the current calibration.

Access to Histograms

For purposes of online monitoring, histograms must be made available for viewing as they are filled. Mechanisms exist for this in both HBOOK (using hlimap()) and ROOT (using TMapFile). Therefore, each program must have an online mode in which histograms are mapped to shared memory for access by another process. This mode should be entered by passing the "-online" option on the command line. For consistency, all online monitoring programs should accept this option, even if they run in online mode by default.

The preferred method of providing online histograms is through ROOT. This will make it simpler for shift takers by having a single program for viewing the minimal subset of histograms which indicate all systems are functioning. ROOT uses a memory mapped file. Thus, all programs should create these files in a standard directory with a known name. This may be accomplished using a symbolic link. See the Files section below for more details.

Resetting Histograms

All monitor programs must automatically reset histograms at begin run transitions (i.e. when the run number changes). This is best done by booking the histograms in a brun routine rather than only at init time.

Additionally, all monitor programs must reset all histograms when they receive a SIGHUP signal. (Do this by calling signal() when the program starts. See the man page). Adhering to this standard will make it easier to build standard tools for the shift takers.

Files

Monitor programs should also create files to archive the histograms for later access. These will need to have names which make it easy to identify the run and system from which the file was created. The suggested naming scheme is:

tac_calib00123.root

The above example would specify the file came from the tac_calib program and is for run 123 (note the leading zeros for the run number in the file name).

The files should also be kept in a standard directory on a clon disk. A directory has been setup specifically for this. It is:

/home/primex/online

Files in this directory will be periodically uploaded to the tape silo. Monitor programs will be launched from this directory so histogram files should be created in the current working directory. They should NOT specify a full pathname by default for the output file since this could interfere with the archive files should a second instance of a program be launched (say for debugging).

The above guidelines are summarized in the following checklist

Subsystem:
Histograms which indicate the system is working
Histograms which indicate quality of the existing calibration
Histograms from which calibrations can be extracted
"-online" command line switch accepted
Histograms mapped to shared memory when in online mode
Program accepts SIGHUP and resets histograms on it
Files archived with run number in name and in current working directory

See the tac_calib program for a simple example which adheres to these guidelines.

David Lawrence
davidl@jlab.org
Last Updated November 25 2003 02:44:37 PM