#!/bin/tcsh


# $1 0=all rocs  
# $2 VERSION NUMBER


if ($#argv < 2) then
    echo "CDC basline adjuster and DAC value determiner"
    echo "Insufficent parameters:"
    echo " ./startall.csh ROC VERSION"
    echo "                ROC = 0 start all ROCS"
    exit
endif

if ($1 == 0) then
    echo "Start up all FDC ROCS with version "$2" to set DAC values for baseline"
    echo "ROC 2"
    ssh hdcdcops@rocfdc2 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 2 $2 14  \&
    echo "ROC 3"
    ssh hdcdcops@rocfdc3 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 3 $2 14  \&
    echo "ROC 5"
    ssh hdcdcops@rocfdc5 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 5 $2 14  \&
    echo "ROC 6"
    ssh hdcdcops@rocfdc6 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 6 $2 15  \&
    echo "ROC 7"
    ssh hdcdcops@rocfdc7 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 7 $2 15  \&
    echo "ROC 8"
    ssh hdcdcops@rocfdc8 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 8 $2 14  \&
    echo "ROC 9"
    ssh hdcdcops@rocfdc9 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 9 $2 15  \&
    echo "ROC 11"
    ssh hdcdcops@rocfdc11 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 11 $2 14  \&
    echo "ROC 12"
    ssh hdcdcops@rocfdc12 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh 12 $2 14  \&
else
    echo "Start up all CDC ROC "$1" with version "$2      
   ssh -f hdcdcops@roccdc$1 /home/hdcdcops/scripts/startupbaselineWithSearchFDC.csh $1 $2 15 \&

endif
