~maddevelopers/mg5amcnlo/WWW5_caching

« back to all changes in this revision

Viewing changes to users/mardelcourt/PROC_129738/PROC_129738/bin/internal/Gridpack/refine4grid

  • Committer: John Doe
  • Date: 2013-03-25 20:27:02 UTC
  • Revision ID: john.doe@gmail.com-20130325202702-5sk3t1r8h33ca4p4
first clean version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
#  After a survey has been run and created results.dat to determine
 
4
#  which channels in each process are important, this routine can 
 
5
#  run to give an accurate integration of the cross section.
 
6
#
 
7
#  Usage: integrate accuracy parallel [name]
 
8
#
 
9
#  
 
10
#   First we need to get into the main directory
 
11
#
 
12
if [[  ! -d ./bin  ]]; then
 
13
    cd ../
 
14
    if [[ ! -d ./bin ]]; then
 
15
        echo "refine must be executed from the main, or bin directory"
 
16
        exit
 
17
    fi
 
18
fi
 
19
#
 
20
#  Now let shell know where to find important executables
 
21
#
 
22
main=`pwd`
 
23
dirbin=$main/bin/internal
 
24
# Begin Local versions
 
25
# set dirbin = /home/tstelzer/bin/MG_ME
 
26
# End Local versions 
 
27
qsub=qsub
 
28
 
 
29
if [[  "$1" == ""  ]]; then
 
30
    echo 'Desired accuracy (< 1), or number of unweighted events (>1)' 
 
31
    read a 
 
32
else
 
33
    a=$1
 
34
fi
 
35
if [[  "$2" == ""  ]]; then
 
36
    echo 'Enter 1 for parallel 0 for serial run' 
 
37
     read p 
 
38
else
 
39
     p=$2
 
40
fi
 
41
np=1
 
42
if [[  $p -gt 0 ]]; then
 
43
   if [[  "$3" == ""  ]]; then
 
44
    echo 'Enter name for jobs on pbs queue'
 
45
       read n
 
46
   else
 
47
       n=$3
 
48
   fi
 
49
   if [[ $# -gt 3 ]]; then
 
50
      np=$4
 
51
   fi
 
52
fi
 
53
#if [[ -d Source ]]; then
 
54
#    echo "Compiling Libraries" >& status
 
55
#    cd Source
 
56
#    make ../bin/sum_html >& /dev/null
 
57
#    make ../bin/gen_ximprove >&/dev/null
 
58
#    make all >& /dev/null
 
59
#    cd ..
 
60
#else
 
61
#    echo 'Error Source directory not found'
 
62
#    exit
 
63
#fi
 
64
if [[ -d SubProcesses ]]; then
 
65
    if [[  $p -gt 0 ]]; then    
 
66
        echo "Creating Jobs" >& status
 
67
    else
 
68
        echo " " >& status
 
69
    fi
 
70
    cd SubProcesses
 
71
    r=0
 
72
    if [[ -e randinit ]]; then
 
73
        source ./randinit
 
74
    fi
 
75
#    echo "Using random number seed offset = " $r
 
76
    for i in `cat subproc.mg` ; do
 
77
        cd $i
 
78
        echo $i
 
79
#       rm -f ajob* >& /dev/null        
 
80
#       rm -f wait.ajob* >& /dev/null
 
81
#       rm -f run.ajob* >& /dev/null
 
82
#       rm -f done.ajob* >& /dev/null
 
83
        echo $a $np F | ../../bin/internal/gen_ximprove >& gen_ximprove.log
 
84
 
 
85
        if [[ -e ajob1 ]]; then
 
86
#           make madevent > /dev/null
 
87
            chmod +x ajob*
 
88
            for j in ajob*  ; do
 
89
              touch wait.$j
 
90
              if [[ $p == 1 ]]; then
 
91
                $qsub -N $n $j>> ../../running_jobs
 
92
              else
 
93
                nice ./$j > /dev/null
 
94
                ../../bin/internal/sum_html >/dev/null
 
95
              fi
 
96
            done
 
97
        fi
 
98
 
 
99
        cd ..
 
100
        if [[ $p == 0  ]]; then 
 
101
            ../bin/internal/sum_html 
 
102
        fi
 
103
    done
 
104
#    echo "r=" $r >& randinit
 
105
else
 
106
    echo "Error unable to find SubProcesses directory"
 
107
    exit
 
108
fi
 
109
if [[ $p == 1 ]]; then
 
110
    $dirbin/monitor $5
 
111
fi
 
112
    cd ../SubProcesses
 
113
    echo "Combining runs" >& ../status
 
114
    ../bin/internal/sumall
 
115
cd ..
 
116
$dirbin/gen_crossxhtml-pl $5