#! /bin/sh # # Initialization script of ROBs. # This is for testing ROB configuration instead of using C.E. # No filter is switched on!!! # source _setup if [ $# -ne 1 ]; then echo "" echo " Usage : do_init type_of_config" echo " Currently, type_of_config should be one of \"p\", \"nf\" and \"pgt\"." echo "" exit; fi let testgood=`./check_ttcvi-seq.pl | tail -1` if [ $testgood -eq 0 ]; then echo "" echo "Found running ttcvi-seq program on daq02. Maybe other test stand is using." echo "You need to disconnect TTC plug on DCS board to proceed." echo -n "Do you want to proceed? (y/n): " read OK if [ x$OK == "xn" ]; then echo "Abort." exit; fi fi CONF_TYPE=$1 HOST=dcs$DCS_SERIAL DC_TYPE=$ROC_TYPE #PRESENT_PATH=`pwd` #PRESENT_PATH=${PRESENT_PATH##/home/trd} #echo "Present path :" $PRESENT_PATH echo "$HOST sits on Type C$DC_TYPE ROC." echo "" echo "#######################################################" echo "Initializing with configuration type of \"$CONF_TYPE\"." echo "#######################################################" echo "" let NUMLINK=$DC_TYPE+3 if [ $DC_TYPE -eq 0 ]; then NUMLINK=3 # NUMLINK=3 for C0 chambers ssh $HOST "/usr/local/sbin/rob_power off; \ sleep 3; \ /usr/local/sbin/rob_power 1 1 1 1 1 1 0 0" else ssh $HOST "/usr/local/sbin/rob_power cycle" fi # Manipulate TTCvi #echo "Disabling TTCvi main trigger." #ssh daq02 ./ttcvi-seq src=7 report # Select software Trigger echo "" ssh $HOST '/usr/local/sbin/ttcrx_regs s' echo "" echo "Sending RESET 5 times" ssh $HOST \ " /usr/local/sbin/rob_reset; sleep 1; \ /usr/local/sbin/rob_reset; sleep 1; \ /usr/local/sbin/rob_reset; sleep 1; \ /usr/local/sbin/rob_reset; sleep 1; \ /usr/local/sbin/rob_reset " # Initialize LINKPAIR=0 LINK=0 # always use link 0 while [ $LINKPAIR -lt $NUMLINK ]; do CONF_FILE=/dcsnfs/ROC_Test/dat/$CONF_TYPE/lxc${DC_TYPE}_lp${LINKPAIR}.dat echo "" echo "########################################################################" echo "${HOST}: dcs2trap -link ${LINKPAIR} 0 -q -i ${CONF_FILE}" echo "########################################################################" echo "" if [ -r $CONF_FILE ]; then ssh $HOST "killall dcs2trap" > /dev/null 2>&1 ssh $HOST "/usr/local/sbin/dcs2trap -link $LINKPAIR $LINK -q -i ${CONF_FILE}" else echo "config file ${CONF_FILE} does not exist!" fi let LINKPAIR=LINKPAIR+1 done # Set TRAP state machines to acq mode echo "" ssh $HOST "/usr/local/sbin/pretrigger 5" echo "" ssh $HOST '/usr/local/sbin/ttcrx_regs t' echo "" echo ":: Chamber ($HOST) is probably armed and dangerous!" echo "::" `date` echo "" # Keep configuration information echo "LAST_CONFIG=$CONF_TYPE" > _current/_config echo -n "Do you want to apply patch? (y/n): " read OK if [ x$OK == "xy" ]; then ./send_patch.sh fi # EOF