#!//bin/tcsh

# $1 0=all rocs  
# $2 VERSION NUMBER
# $3 number of triggers

if ($#argv < 3) then
    echo "Insufficent parameters:"
    echo " ./startalltdc.csh ROC VERSION TRIGGERS"
    echo "                   ROC = 0 start all ROCS"
    exit
endif

if ($1 == 0) then
    echo "Start up all FDC ROCS with version "$2" and triggers: "$3
    ssh hdfdcops@rocfdc1 /home/hdfdcops/scripts/startuptdcs.csh 1 $2 12 $3 \&
    ssh hdfdcops@rocfdc4 /home/hdfdcops/scripts/startuptdcs.csh 4 $2 12 $3 \&
    ssh hdfdcops@rocfdc13 /home/hdfdcops/scripts/startuptdcs.csh 13 $2 12 $3 \&
    ssh hdfdcops@rocfdc14 /home/hdfdcops/scripts/startuptdcs.csh 14 $2 12 $3 \&

else
    if ( ($1 == 1) || ($1 == 4) || ($1 == 13) || ($1 == 14) ) then
	echo "Start up all FDC ROC "$1" with version "$2" and triggers: "$3
	
	ssh -f hdfdcops@rocfdc$1 /home/hdfdcops/scripts/startuptdcs.csh $1 $2 12 $3 \&
    endif
endif
