***********************************************************************
``calib_proc''     Example Calibration Procedure           SPGC Mar '98
***********************************************************************

Step 1: egmap

1) If using MEGHA/eg-format put egmap.dat file in current sort directory.
   Nb: Assume convention  amplitude -> ADC=1-384 and time addresses are 
   respective amplitude+384 i.e. time->385-768

Step 2: Matchsticks
 
1) Pick simple channel sort e.g. adcs768-c.srt
2) Use Sunsort Mstick and copy complete output to file ``go.raw''
3) Use awk script ``mstick < go.raw > go.cal'' to produce 
   gain offset file : go.cal
4) Use program `go_diff' to check differences between different
   matchsticks files i.e. quick check for gain drifts etc!

5) Now Look at signal times for matchsticks data
6) Use Sunsort pkfind to evaluate centroid of each peak
   and output to file "to.raw"
7) Use awk script "toff < to.raw > to.cal" to produce gain offset
   appliciable to time channels
8) Append to.cal to end of file go.cal

Step 3: Check pulser calibrations using sort subroutines

1) Create calib-inputs as a sub-directory of current sort directory.
2) Include appropriately modified Makefile, cal.c, calset.c and cal.h
3) copy egmap.dat to egmap.cal in calib-inputs
4) Put go.cal in calib-inputs directory
5) use e.g. simple-c.srt to check the calibrations
6) Make and run simple-c.srt
7) This will point to the various files that you need in calib-inputs
   to get going

Step 4: Generate Detector coordinates

1) Create xyz coordinate file in calib-inputs: detpos.cal
2) Examine detector coverage: coord_cov detpos.cal NDETS
3) Generate strip end angles: pssd_angs detpos.cal NDETS

Step 5: Position/energy Calibrations

For Strip detectors

1) Establish E and x limits for each strip using e.g. elastics ->evx.raw
2) Calculate corresponding EvTH: ethcal pssd_angs.out
3) Generate calibration gainfactors: egain evx.raw ethcal.out
4) Move egain.out to gsig.cal in calib-inputs
5) Generate x-limits file xlim < evx.raw > xlim.cal
6) Run simple-c.srt and check EvX, EvTH  calibrations
7) Check Q2vTH for different reactions using reac.cal input file
8) You're on your own!

Step 6:

You could try simulating your reaction (see sort-subs/simulation directory)
1) Use simple_sim-c.srt
2) Create an input deck (see eg_input.sca)
3) Make and run the scanga simulation using "user" format on the sort-tool
   and reading from disc /dev/zero
    ->use -DSIM to run simulation
    ->use nothing to run as normal sort
4) The simulation will fill out the ev structure with pseudo data

