~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to Template/NLO/bin/run_amcatnlo.sh

  • Committer: Marco Zaro
  • Date: 2012-08-28 21:06:34 UTC
  • mto: (78.35.14 AutoMint)
  • mto: This revision was merged to the branch mainline in revision 249.
  • Revision ID: marco.zaro@gmail.com-20120828210634-5a06yvda3hplw8ur
doing some renaming:
 Template/FKS-born -> Template/NLO
 fks_born.py -> fks_base.py
 fks_born_helas_objects.py -> fks_helas_objects.py
 export_fks_born.py -> export_fks.py

also functions/classes and tests renamed
all unit tests ok, exporting ok

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
 
 
3
echo '****************************************************'
 
4
echo 'This script runs a amcatnlo process'
 
5
echo '****************************************************'
 
6
 
 
7
# find the correct directory
 
8
if [[  ! -d ./SubProcesses  ]]; then
 
9
    cd ../
 
10
    if [[ ! -d ./SubProcesses ]]; then
 
11
        echo "Error: run_amcatnlo.sh must be executed from the main, or bin directory"
 
12
        exit
 
13
    fi
 
14
fi
 
15
 
 
16
Maindir=`pwd`
 
17
 
 
18
run_mode=$1
 
19
use_preset=$2
 
20
run_cluster=$3
 
21
 
 
22
if [[ $run_mode == "" ]] ; then
 
23
    echo 'Enter run mode (F, V or B)'
 
24
    read run_mode
 
25
fi
 
26
if [[ -e! madinMMC_$run_mode.2 ]] ; then
 
27
    echo 'Cannot read the inputs. File not found: madinMMC_'$run_mode'.2'
 
28
    exit
 
29
fi
 
30
 
 
31
if [[ $use_preset == "" ]] ; then
 
32
    echo "Enter presets used for integration grids (none, F, B or V)"
 
33
    echo "   [Default is 'none']"
 
34
    read use_preset
 
35
fi
 
36
if [[ $use_preset == "none" ]] ; then
 
37
    echo "No preset used"
 
38
    use_preset=""
 
39
else
 
40
    echo "Using preset:" $use_preset
 
41
fi
 
42
 
 
43
if [[ $run_cluster == "" ]] ; then
 
44
    echo "Local run (0), cluster running (1) or ganga (2)?"
 
45
#    echo "Cluster running needs a configured condor batching system"
 
46
    read run_cluster
 
47
fi
 
48
if [[ $run_cluster == 0 ]] ; then
 
49
    echo "Running locally"
 
50
elif [[ $run_cluster == 1 ]] ; then
 
51
    echo "submitting jobs to cluster"
 
52
elif [[ $run_cluster == 2 ]] ; then
 
53
    echo "using ganga to submit jobs"
 
54
else
 
55
    echo "ERROR" $run_cluster
 
56
    exit
 
57
fi
 
58
 
 
59
 
 
60
#---------------------------
 
61
# Update random number seed
 
62
cd $Maindir/SubProcesses/
 
63
r=0
 
64
if [[ -e randinit ]]; then
 
65
    source ./randinit
 
66
fi
 
67
for i in P*_* ; do
 
68
    r=`expr $r + 1`
 
69
done
 
70
echo "r=$r" >& randinit
 
71
cd $Maindir
 
72
 
 
73
 
 
74
vegas_mint="2"
 
75
 
 
76
cd SubProcesses
 
77
 
 
78
for dir in P*_* ; do
 
79
    cd $dir
 
80
    echo $dir
 
81
    if [[ -e madevent_mintMC ]]; then
 
82
        chmod +x ajob*
 
83
        if [[ $run_cluster == 1 ]] ; then
 
84
            for job in mg*.cmd ; do
 
85
                sed -i "7s/.*/Arguments = $vegas_mint $run_mode $use_preset/" $job
 
86
                condor_submit $job
 
87
            done
 
88
        elif [[ $run_cluster == 0 ]] ; then
 
89
            echo "Doing "$run_mode"-events in this dir"
 
90
            for job in ajob* ; do
 
91
                ./$job $vegas_mint $run_mode $use_preset
 
92
            done
 
93
        fi
 
94
    else
 
95
        echo 'madevent_mintMC does not exist. Skipping directory'
 
96
    fi
 
97
    echo ''
 
98
    cd ..
 
99
done
 
100
 
 
101
cd ..
 
102
 
 
103
 
 
104
 
 
105
echo ""
 
106
echo "Execute ./SubProcesses/combine_results.sh to collect results and"
 
107
echo "compute how many events are needed per channel."
 
108
echo ""
 
109
echo "./SubProcesses/combine_results.sh i n G"$run_mode"*"
 
110
echo ""
 
111
echo "where 'i' is 0 after grid setting and '1' after integration and"
 
112
echo "'n' is the total number of unweigted events you want."
 
113
echo "Update madinMMC_"$run_mode".2 before before"
 
114
echo "executing the next integration or event generation step."
 
115
echo ""