~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to Template/LO/SubProcesses/survey.sh

  • Committer: olivier Mattelaer
  • Date: 2015-03-05 00:14:16 UTC
  • mfrom: (258.1.9 2.3)
  • mto: (258.8.1 2.3)
  • mto: This revision was merged to the branch mainline in revision 259.
  • Revision ID: olivier.mattelaer@uclouvain.be-20150305001416-y9mzeykfzwnl9t0j
partial merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
if [[ -e MadLoop5_resources.tar && ! -e MadLoop5_resources ]]; then
 
4
tar -xf MadLoop5_resources.tar;
 
5
fi
 
6
k=run1_app.log;
 
7
script=ajob1;                      
 
8
offset=$1;
 
9
shift;
 
10
subdir=$offset;
 
11
for i in $@ ; do
 
12
     j=G$i;
 
13
     if [[ $offset == *.* ]];then
 
14
         subdir=${offset%.*};
 
15
         offset=${offset##*.};
 
16
         j=G${i}_${subdir};     
 
17
     elif [[ $offset -gt 0 ]]; then
 
18
         j=G${i}_${subdir};
 
19
     fi
 
20
     if [[ ! -e $j ]]; then
 
21
         mkdir $j;
 
22
     fi
 
23
     cd $j;
 
24
     if [[ $offset -eq 0 ]]; then
 
25
         rm -f ftn25 ftn26 ftn99;
 
26
         rm -f $k;
 
27
     else
 
28
         echo   "$offset"  > moffset.dat;
 
29
     fi
 
30
     if [[ $offset -eq $subdir ]]; then
 
31
         rm -f ftn25 ftn26 ftn99;
 
32
         rm -f $k;
 
33
     else
 
34
        if [[ -e ../ftn25 ]]; then
 
35
            cp ../ftn25 .;
 
36
        fi
 
37
     fi
 
38
     if [[ ! -e input_app.txt  ]]; then
 
39
         cat ../input_app.txt >& input_app.txt;
 
40
     fi
 
41
     echo $i >> input_app.txt;
 
42
 
 
43
     for((try=1;try<=10;try+=1)); 
 
44
     do
 
45
     ../madevent >> $k <input_app.txt;
 
46
     if [ -s $k ]
 
47
     then
 
48
         break;
 
49
     else
 
50
     sleep 1;
 
51
     fi
 
52
     done
 
53
#     rm -f ftn25 ftn99
 
54
#     rm -f ftn26
 
55
     echo "" >> $k; echo "ls status:" >> $k; ls >> $k;
 
56
     cp $k log.txt;
 
57
     cd ../;
 
58
done;