Changeset View
Changeset View
Standalone View
Standalone View
examples/runCoordinatorTask.sh
- This file was moved from examples/runMasterSlave.sh.
Show All 22 Lines | |||||
if [ $# -lt 1 ] | if [ $# -lt 1 ] | ||||
then | then | ||||
echo "Usage: $0 <nExpt> [firstExpt = 0]" | echo "Usage: $0 <nExpt> [firstExpt = 0]" | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
nexpt=$1 | nexpt=$1 | ||||
firstexpt=0 | firstexpt=0 | ||||
numslaves=2 | numtasks=2 | ||||
if [ $# -gt 1 ] | if [ $# -gt 1 ] | ||||
then | then | ||||
firstexpt=$2 | firstexpt=$2 | ||||
fi | fi | ||||
# Do whatever you need to do to setup your ROOT environment | # Do whatever you need to do to setup your ROOT environment | ||||
# Generate the toy MC | # Generate the toy MC | ||||
if [ ! -e gen-DD-Slave.root ] | if [ ! -e gen-DD-Task.root ] | ||||
then | then | ||||
echo "Generating MC for DD category" | echo "Generating MC for DD category" | ||||
./Slave gen DD $nexpt $firstexpt > gen-log-DD.out 2>&1 | ./SimFitTask gen DD $nexpt $firstexpt > gen-log-DD.out 2>&1 | ||||
fi | fi | ||||
if [ ! -e gen-LL-Slave.root ] | if [ ! -e gen-LL-Task.root ] | ||||
then | then | ||||
echo "Generating MC for LL category" | echo "Generating MC for LL category" | ||||
./Slave gen LL $nexpt $firstexpt > gen-log-LL.out 2>&1 | ./SimFitTask gen LL $nexpt $firstexpt > gen-log-LL.out 2>&1 | ||||
fi | fi | ||||
# Do the simultaneous fit | # Do the simultaneous fit | ||||
for ifit in `seq 0 19` | for ifit in `seq 0 19` | ||||
do | do | ||||
echo "Running fit $ifit" | echo "Running fit $ifit" | ||||
./Master $ifit $nexpt $firstexpt $numslaves > master-log-$ifit.out 2>&1 & | ./SimFitCoordinator $ifit $nexpt $firstexpt $numtasks > coordinator-log-$ifit.out 2>&1 & | ||||
sleep 5 | sleep 5 | ||||
NUMOFLINES=$(wc -l < "master-log-$ifit.out") | NUMOFLINES=$(wc -l < "coordinator-log-$ifit.out") | ||||
while [ $NUMOFLINES -lt 1 ] | while [ $NUMOFLINES -lt 1 ] | ||||
do | do | ||||
sleep 5 | sleep 5 | ||||
NUMOFLINES=$(wc -l < "master-log-$ifit.out") | NUMOFLINES=$(wc -l < "coordinator-log-$ifit.out") | ||||
done | done | ||||
port=`tail -1 master-log-$ifit.out | awk '{print $NF}'` | port=`tail -1 coordinator-log-$ifit.out | awk '{print $NF}'` | ||||
./Slave fit DD $ifit $port localhost > slave-dd-log-$ifit.out 2>&1 & | ./SimFitTask fit DD $ifit $port localhost > task-dd-log-$ifit.out 2>&1 & | ||||
sleep 1 | sleep 1 | ||||
./Slave fit LL $ifit $port localhost > slave-ll-log-$ifit.out 2>&1 | ./SimFitTask fit LL $ifit $port localhost > task-ll-log-$ifit.out 2>&1 | ||||
done | done | ||||
# Extract the best fit | # Extract the best fit | ||||
echo "Extracting the best fit results" | echo "Extracting the best fit results" | ||||
ls fitDD*.root > input-list-DD.txt | ls fitDD*.root > input-list-DD.txt | ||||
ls fitLL*.root > input-list-LL.txt | ls fitLL*.root > input-list-LL.txt | ||||
ls master-ntuple-*.root > input-list-master.txt | ls coordinator-ntuple-*.root > input-list-coordinator.txt | ||||
./ResultsExtractorMain $nexpt input-list-DD.txt best-fits-DD.root > resultsextractor-DD.out 2>&1 | ./ResultsExtractorMain $nexpt input-list-DD.txt best-fits-DD.root > resultsextractor-DD.out 2>&1 | ||||
./ResultsExtractorMain $nexpt input-list-LL.txt best-fits-LL.root > resultsextractor-LL.out 2>&1 | ./ResultsExtractorMain $nexpt input-list-LL.txt best-fits-LL.root > resultsextractor-LL.out 2>&1 | ||||
./ResultsExtractorMain $nexpt input-list-master.txt best-fits-master.root > resultsextractor-master.out 2>&1 | ./ResultsExtractorMain $nexpt input-list-coordinator.txt best-fits-coordinator.root > resultsextractor-coordinator.out 2>&1 | ||||