4 #// Copyright 2009 Sebastian Neubert
6 #// This file is part of rootpwa
8 #// rootpwa is free software: you can redistribute it and/or modify
9 #// it under the terms of the GNU General Public License as published by
10 #// the Free Software Foundation, either version 3 of the License, or
11 #// (at your option) any later version.
13 #// rootpwa is distributed in the hope that it will be useful,
14 #// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #// GNU General Public License for more details.
18 #// You should have received a copy of the GNU General Public License
19 #// along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
24 # Master Script for performing a genetic waveset run
25 # This will do NG generations of wavesets. Each generation
26 # will constitute a population of NW wavesets.
27 # The mutants are created with mutator from a MOTHER waveset.
28 # Available waves are listed in the WPOOL file
29 # Data is stored into a directory tree rooted in GENEROOT
30 # All wavesets are fitted in parallel on the cluster.
33 export
DATAROOT=/afs/e18/compass/analysis/sneubert/5PiLTData3/
34 #export GENEROOT=/afs/e18/compass/analysis/sneubert/PWAFITS/GENETICS/ltRUN22Extended
35 export GENEROOT=/nfs/nas/user/sneubert/PWAFITS/GENETICS/ltRUN30cont
37 #export MOTHER=$GENEROOT/gen2/results.dat
38 export
MOTHER=$GENEROOT/parents.list
41 # in later generations several ancestors are possible
42 export NANC=50 # number of ancestors per generation (
top)
43 export WPOOL=$GENEROOT/wavepool
44 export NW=50
# number of wavesets in one generation
45 export
NG=100 # number of generations
46 export FIX=1 # first N waves to be fixed
47 export EXCH=1; # number of waves to exchange per mutation
48 export
ADD=0; # number of waves to add ...
49 export
DROP=0; # number of waves to drop ...
50 export
VARY=5; # range -V..+V by which to vary number of waves per mutation
52 export
CROSS=0.85; # crossover probability 0..1
54 # define additional options to pass to qsub
55 # for example to exclude single nodes:
56 # export SGEOPT="-l h='!node59|!node60|'"
59 # check if we are ready to go
60 if ! $ROOTPWA/scripts/checkWavesForFit.sh $WPOOL
$DATAROOT; then
61 echo "Go and check your amplitudes!";
66 # loop over generations
67 for (( g = $STARTGEN ; g < $NG; g++ )) ;
do
71 cp $MOTHER $GENDIR/ancestors.dat;
74 echo "---------------- Generation $g -----------------";
75 echo "------------------------------------------------";
76 echo "------------------------------------------------";
78 # generate mutant population and start fits
79 for((
i = 0 ;
i < $NW;
i++ )) ;
do
84 echo "mutator -S$i -E$EXCH -A$ADD -D$DROP -V$VARY -P$WPOOL -F$FIX -p$PRESSURE -c$CROSS $MOTHER > $SETDIR/$WLIST"
85 if mutator -S
$i -E$EXCH -
A$ADD -
D$DROP -V$VARY -P$WPOOL -
F$FIX -
p$PRESSURE -c$CROSS $MOTHER > $SETDIR/
$WLIST; then
86 # start fits. Pass WLIST and FITDIR to script
88 echo "Starting pwafit in directory $SETDIR with wavelist $WLIST"
89 QMES=(`qsub $SGEOPT -v
"WLIST=$WLIST,FITDIR=$SETDIR" -t 2-7:1 fitgene.sge | tr
' ' ' '`)
91 echo "Jobnumber: $JOBNR"
94 echo "++++++ Mutator failed!"
97 done; # end loop over populations
99 # wait for fits to be finished
101 echo -
n "Generation $g: Waiting for fits to finish ..."
102 OUTFILE=`mktemp -t qstat_resXXX`
105 # restart pending error jobs
106 cat $OUTFILE | grep Eqw |
while read
a;
do
107 qmod -cj ${a:0:7} &> /dev/null;
115 echo " no jobs running anymore";
120 if [ -
n "$RES" ]; then
127 # collect fit results and determine the best fit (use all generations)
129 selector 28 $NANC $MOTHER $GENDIR/
set*/ > $GENDIR/results.dat
130 export MOTHER=$GENDIR/results.dat
134 done; # end loop over generations