#! /bin/tcsh
#
# This is the script to test ORI using DCS+T3+ORItx and PC which has ORIrx.

# Set parameters of DCS which is controling T3+ORItx, and PC which has ORIrx.
set DCS=dcs0045
set PC=daq00

# Initializing
ssh $DCS "echo 000000 > /dev/vreg"
ssh $DCS "echo ffffff > /dev/vreg"
ssh $DCS /usr/local/sbin/dcs2trap -link 2 0 -i /dcsnfs/ORI_Conf/DATA/sc_init.dat
echo Initialized.

@ a=1
while 1
  echo Pass: $a
  echo ========== Pass $a ==========
  echo Date: `date`
  ssh $PC  /home/testbeam/bin/nioase -r                                            
  ssh $DCS /usr/local/sbin/dcs2trap -link 2 0 -i /dcsnfs/ORI_Conf/CNF/dat/event.dat
  ssh $PC  /home/testbeam/bin/nioase -c16 ni16 -r
  scp ${PC}:ni16 .
  echo "=== ni16 output begin ==="
  cat ni16
  echo "=== ni16 output end ==="
  echo -n "Nerrorlines (Pass $a): "
  wc -l ni16
  wc -l ni16
  echo ""
  echo ""
  echo done
  @ a++;
  sleep 3
end

# EOF
