
The goal of the time calibrations is to define for each channel the factor, linked the measured TDC in channels to the value in nsec, and to define the time delay constants, so that the measured time for electrons from the target to the Cherenkov detector will be the trajectory length divided by light velocity.
The amplitude in photoelectrons is calculated by
A_phe = (A_ch - A_pedest)/A_ope
where A_phe is a number of photoelectrons, A_ch is a measured amplitude in channels, A_pedest is a pedestal value, A_ope is a amplitude in channels for one-photoelectron peak. All values are specific for each PMT
So, to make calibrations, we need to define A_pedest and A_ope.
After this special run is performed, you need to analyze it, using program PEDMAN
To ana-Lise it, you have to
> pedman
you COULD see the pedman GUI

Sometimes ( always) you have to enlarge right and left GUI windows to see the all. Be sure you can see all buttons and red points on CC,EC etc. buttons.
To take a CC_CALIB run usually takes ~40 min with typical event rate about 10000/sec.
After the end of the run you'll have about 3 files on /raid/stage_in with names clas_cc_XXXXXX.A0Y, where XXXXX - run number, and Y = 0,1,2
To analyze this runs, you'll better copy them from /raid/stage_in to some work disk, say /work/clas/disk2. To measure the SPE positions we need simply to fill ADC distribution histograms for every PMT. It is possible to do that by any program, say RECSIS, but it takes a lot of time. Simplified code to do that was written and checked under cvs in the cc_cal directory.
here spe.ini file is to specify the files you need to analyze
RunNumber=50200
;
DataFile=ff1,ff2,ff3
;
It said that 3 files should be analyzed , - ff1, ff2 and ff3. You can make a soft links ff1(2,3) to files you copied from /raid/stage_in directory.
The (good) example of ADC distribution is shown here:

This peak can be fitted by simple Gaussian, and the position of this peak is One-Photoelectron position.
Unfortunately, there are some channels, where apart from Gaussian you see the noise , exponentially decreased with A, but visible. Those channels need to have some special fitting, using both functions to extract the OPE values. ( Ask Mauri ;-)
! But ! It is better to analyze the run ASAP to check that the file is OK.
Program to analyze the run is in CLAS standard place under cvs in the utilities/TDC_cal directory. So you need :
***** TDCcalibrate 5.0 *****
The program TDCcalibrate analyzes the raw banks (RCxx) of a data file for a TDC
calibration run. A TDC calibration run consists of M sets of N events (N=20
typical) with a fixed delay T to the TDC for each of the M sets.
T[i+1]=T[i] + dT for each successive run i. Each group of N events is fit,
and the resulting mean values are fit to a 2nd order polynomial. The
constants of this polynomial are then put in the MAP and written to a file.
USAGE HINTS (OLD FILES): If you get many 'data jump' errors, the data may be
too noisy. In such a case you may want to check the data sequence using
'-spy 13.8.0' (or any other channel). Then count by how many channels the
trigger is off. I.e. the peak number goes up one for # channels before the TDC
value jumps up. You then use the -skew # to correct the trigger point.
(and check again.)
If the data was taken with the scalers on, or if you expect there may be missing
events, you can ask the code to attempt to correct these problems with -autojump.
This tries to detect a premature jump in the time delay by spying on the TDC values
and detecting a jump larger than 30 channels. This does not work with noisy data !
DATABASE:
Use the -commit flag to commit new results into the database.
This code will put the values in the CALDB database through the MAP
compatibility routines. Control over which database host etc can be set
with environment variables. See the caldb/Map routines for more detail.
setenv CLAS_CALDB_HOST mydbhost.myuni.edu # sets the DB host machine.
setenv CLAS_CALDB_PASSWORD myspecialdbpass # sets DB password.
Note that the DB password is NOT your login password (should not!)
and that the USER environment variable is used for DB user also.
MAP:
The only way to write to old MAP files is to compile with the
MAP=yes argument to make. The executable will then be TDC_Cal_MAP.
USAGE: /home/vlassov/bin/LinuxRHEL3/TDC_cal
OPTIONS SUMMARY:
-quiet Become progressively more quiet.
-l # Start processing at event number #
-m # Process until event number #
-skew # 'Skew' the trigger, move the trigger point up (down) by #.
-commit Commit the new results to the DATABASE (equivalent to -map)
-map Put entry in MAP (or DB) for this run.
-mapfile
-hist Create a histogram output file. If ROOT is enabled,
a root file, else an ascii hvplot file
-hist_old If ROOT is enabled, make an ascii hvplot file also.
-noint If ROOT is enables, do not go interactive, dump the file.
-noTT Do not use Translation Tables.
-uTT
-faults # Tolerate # number of errors reading crates. (10)
-ncoeff # Fit the TDCs up to order # (default is 2)
-nocompare Do not compare new values against the old ones.
-autojump Automatically jump the trigger when code detects a jump in TDC values.
-notdc Do not write the TDC_RCxx files.
-noascii Do not write the ascii tables.
-paddle Show progress with a paddle wheel.
-skip # Skip processing of crate # (can be repeated.)
-only # Only process for crate #.
-debug Become progressively more verbose.
-spy cr.sl.ch spy on crate.slot.channel
-backup Make a backup of the map before writing a new one.(default)
-nobackup DO NOT make a backup of the map before writing a new one.
-old Force compatibility with files taken before Oct 13 1999 (run 21086)
-help -h Print this help.
There are no standard procedure under cvs for T0 calibrations. ( Under way )
Here are the steps needed to make this kind of calibrations:
s = TDCCC(i)*T1(i) - tr_time - cc_r(i)/v_light
where TDCCC(i) - is a measured TDC for
the electron;
T1(i) is the factor, defined before, to
switch from channels to nanoseconds;
tr_time is a trigger time;
cc_r(i) is a length of the
trajectory from the target to CC;
V-light is a light velocity.