Installing and running ESPACE on monsoon/twister for E89044

IMPORTANT: Always use the full path names to the files required by the kumac files or scripts that invoke espace!
for example in the AnaLumi.kumac file use:
datadir = /data/e89044/parallel/replay_raw/dat0
hboodir = /data/e89044/parallel/[kin_tag]


1) You need an executable version of espace. Either a precompiled version or a version you created yourself( may be tough to do).

2) Edit the .bashrc file to include the following statements ( as an example)
export CERN=/CERN
export CERN_LEVEL=2006
export OSNAME=Linux
export HALLA_DIR=/home/aniol/espace
export LOC_HALLA_BIN=$HALLA_DIR/bin/$OSNAME


3)  Create the espace directory ( as in the example above:  /home/aniol/espace )

4) In the espace directory download the tar file :  espace-2.9.2-src.tar
Extract the tar file and run  make in /home/aniol/espace/src/r2-9. Even if it doesn't work because of compilation errors you will still have the necessary subdirectories unpacked. Example:
bin     quick_install_files   espace-2.9.2-src.tar   quick_install.html  db    src      lib       

5) Setting up the e89044 directories to run under espace. You want to do this if you need to replay the raw data files to create new hbook files. An example is in twister or monsoon:
[aniol@twister ~]$ cd /data/e89044/parallel
[aniol@twister parallel]$ ls
analysis     kin01  kin20  Read_Scal.f  voutier_scaler_information_e89044.eml
information  kin03  kin21  replay_raw

The hbook files will be stored in the directories, kin01, kin03, etc. The replay is done from the replay_raw directory.
[aniol@twister parallel]$ cd replay_raw
[aniol@twister replay_raw]$ ls
bin     dat0  espace     header  replay_run   shower_calib_r2441.dat
calfil  db    espace2.8  kumac   replay_run2  voutier_originals

The raw data files are stored in the dat0 directory.
[aniol@twister replay_raw]$ cd dat0
[aniol@twister dat0]$ ls
e89044_2441.dat.0  e89044_2666.dat.0

The kumac files which control the hbook outputs are in the kumac directory:
[aniol@twister replay_raw]$ cd kumac
[aniol@twister kumac]$ ls
AnaLumi.kumac   AnaPhys.kumac

The inclusive data are analyzed using the AnaLumi.kumac file and the e-p coincidence data ( trigger 5, t5) are analyzed using the AnaPhys.kumac file.

To start an espace replay go to the replay _raw directory: /data/e89044/parallel/replay_raw
If the raw data file has more than 1 million events use the replay_run2 script. For example,

[aniol@twister replay_raw]$ ./replay_run2 2666 kin03 helium filterof bigfile
*** No default logon file /home/aniol/.espacelogon.kumac found
 Hello aniol, welcome to ESPACE 2.8 (PL 41)
espace> exec /data/e89044/parallel/replay_raw/kumac/AnaLumi.kumac
Run number ? (<CR>=) 2666
Kinematics number ? (<CR>=) kin03
Target type ? (<CR>=) helium
either 0 or 1 (<CR>=) 0
First event number ? (<CR>=) 1
Last  event number ? (<CR>=) 1000000
 /data/e89044/parallel/replay_raw/dat0/e89044_2666.dat.0
 ***** ok to here ****
 run date in sec after 1970:  952473543
 run number:   2666
 run type:     0
Prescale factors: T1/T2/T3/T4/T5/T8 =       5/       6/     110/      45/       1/9999999
 !-READ_SHOW_COEF-Inf-File "shower_calib_r2666.dat" found.
  event number:   1000
  event number:   2000
  event number:   3000
  event number:   4000
  event number:   5000
  event number:   6000
  event number:   7000
  event number:   8000
  event number:   9000
  event number:   10000
  event number:   11000
  event number:   12000

 *** Break *** Keyboard interrupt

The meanings of the input fields in the replay_run2 script  "./replay_run2 2666 kin03 helium filterof bigfile"  are:
2666 ->run number
kin03 -> kinematics 03
helium -> target material
filterof -> use AnaLumi.kumac, filteron -> use AnaPhys.kumac
bigfile-> means that there are between 1 million and 2 million events in the raw data file

If the data file has more than 1 million events there will be 2  hbook files in the kin# directory  with the designations "csla" and a " _0" and "_1" designation for the first 1 million events and the excess events over 1 million. A designation of "t5" indicates a trigger 5 coincidence required.
kin03_2666_0_csla.hbook  , 1st 1 million events using AnaLumi.kumac
kin03_2666_1_csla.hbook, remaining events above 1M using AnaLumi.kumac
kin03_2666_t5_0_csla.hbook, 1st 1million events using AnaPhys.kumac
kin03_2666_t5_1_csla.hbook, remaining events above 1M using AnaPhys.kumac