A description of the muTr calibration procedure - MJL - 10/30/01 ================================================================ The muTr calibration is meant to provide accurate pedestals, gains and rms noise values on a daily basis. The pedestals and noise levels are critical for setting the zero-suppression thresholds while the gains are important for calibrating the relative charge response of neighboring cathode strips so that an accurate position in a cluster can be determined during analysis. Calibrations are obtained by pulsing a special set of "anode" wires in every muTr chamber which in turn induces a response from every cathode strip in that chamber. The response at zero amplitude of the pulser gives the pedestals and rms and a fit to the response for 13 different amplitudes determines the charge (gain) function. The calibration procedure takes a series of thirteen 100 event runs at different amplitudes and lasts a total of about 20 minutes. Recently the procedure has been extended to include automatic analysis and recording of the calibrations. The steps involved go like this: * The shift person initiates the taking of data by typing a simple one word command ("docalib") when logged into the phoncs account on phoncs0 (in the directory ~phoncs/mutr/calib). This automatically takes 13 runs at different amplitudes, using arcnet commands via arcnet_client from a program ("calib.c") to set each amplitude for the calibration system. * At the end of the runs the script creates a file in the same directory called newcalib.txt which contains the "tag" name for the calibration, e.g. 28Oct01_0800 for a run taken on October 28th at 8:00 am. * A cron job ("cauto") is running in the phnxmutr account on va011 that looks for the newcalib.txt file every 10 minutes. If it finds the file, it reads the "tag" from the file, locates the log file which has the "tag" in its name, and begins the analysis of the data by invoking a script ("do"). The main working directory is ~phnxmutr/mjl/calib. * The analysis scripts ("do" & "getrun") read the log file to find the run number and amplitude for each run and also find the prdf files on one of the buffer disks and read them. It is assumed that it is ok to read directly from the buffer disk since calibration data is only taken at a time when there is no beam and there will be no interference with any ongoing beam data taking. The scripts create a new subdirectory in the analysis directory with the tag in the directory name where all the working files and resulting files are kept. * The analysis script starts by invoking a program ("calibnts.c") to scan all the prdf files to create ntuples for each partition (there are four for muTr) and each pulser amplitude. This program also uses the zero-amplitude runs to determine the pedestals and rms noise values and from these calculates new zero-suppression threshold files for each FEM and writes them out to a threshold directory. * Then the script invokes another program ("calibhis.c") which reads all the ntuples and creates histograms of response vrs amplitude for each strip, then fits these to obtain the gain response function (presently linear). The resulting calibration values are recorded into a text file for each plane. This program also writes out the average calibration values for each station/octant into a text file (avg_$tag.txt) to allow a quick look at the sanity of the determined values. * Postscript plots of all the gains, pedestals and rms values for each strip are generated. * A monitoring process examines all calibration analysis results and in particular produces postscript plots of the changes in pedestals and gains between this calibration and the last one done before it. These plots are useful to see gross or groups of strips whose shifts in pedestals or gains are more than a small amount. * The text files are concatenated into one master text file with all strips in logical order file by a script ("docat"). This files is called cal-$tag.txt. * A script ("dodb") uses a root macro ("dbputAll.C") to read the text file and then record all the calibration values into Objectivity with a time stamp of the day (midnight presently) on which the data was taken. * The new zero-suppression threshold files created above are copied into the active muTr zero-suppression directory for use in DAQ. * Results from the calibration (txt files and postscript plots) are copied to the calibration results web site (rcas:~leitch/calib_results) and the html file there is updated to reference the new calibration and directory containing these files. * An email is sent to me informing me a new calibration has been done and recorded.