~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to Template/bin/multi_run

Added Template and HELAS into bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
if [[  ! -d ./bin  ]]; then
 
4
    cd ../
 
5
    if [[ ! -d ./bin ]]; then
 
6
        echo "Error: it must be executed from the main, or bin directory"
 
7
        exit
 
8
    fi
 
9
fi
 
10
 
 
11
echo $$ > myprocid
 
12
 
 
13
main=`pwd`
 
14
dirbin=$main/bin
 
15
ERAdir=$main/../ExRootAnalysis
 
16
MAdir=$main/../MadAnalysis
 
17
td=$main/../td
 
18
 
 
19
p=0
 
20
n=''
 
21
t='default'
 
22
nrun=5
 
23
add=''
 
24
 
 
25
if [[  "$4" == ""  ]]; then
 
26
    echo 'Enter 1 for parallel 0 for serial run' 
 
27
    read p
 
28
    if [[  $p -gt 0 ]]; then
 
29
    echo 'Enter name for jobs on pbs queue'
 
30
    read n
 
31
    fi
 
32
    echo 'Enter run name'
 
33
    read t
 
34
    echo 'Enter number of wanted runs'
 
35
    read nrun 
 
36
else
 
37
     p=$1
 
38
     n=$2
 
39
     if [[  $p == 0  ]]; then
 
40
       n=' '
 
41
     fi
 
42
     t=$3
 
43
     nrun=$4
 
44
     if [[  $# -gt 5  ]]; then
 
45
       add=$5
 
46
       ERAdir="$MADGRAPH_BASE/MG_ME/ExRootAnalysis"
 
47
       MAdir="$MADGRAPH_BASE/MG_ME/MadAnalysis"
 
48
       td="$MADGRAPH_BASE/MG_ME/td"
 
49
     fi
 
50
fi
 
51
 
 
52
#$dirbin/generate_events $p $n $t\_1 $add
 
53
#cp -p $main/Events/$t\_1\_unweighted_events\.lhe\.gz $main/Events/$t\_unweighted_events\.lhe\.gz
 
54
#cp -p $main/Events/$t\_1\_banner.txt $main/Events/$t\_banner.txt
 
55
i=1
 
56
 
 
57
while [[  $i -le $nrun  ]]; do 
 
58
    echo "Running generate_events for run ${t}_$i (see ${t}_$i.log)"
 
59
    $dirbin/generate_events $p $n $t\_$i $add >& $t\_$i.log
 
60
#  $dirbin/merge.pl $main/Events/$t\_unweighted_events\.lhe\.gz $main/Events/$t\_$i\_unweighted_events\.lhe\.gz $main/Events/$t\_unweighted_events\.lhe\.gz $main/Events/$t\_banner.txt
 
61
  i=`expr $i + 1`
 
62
done 
 
63
 
 
64
#set allfiles = `ls $main/Events/$t\_\*\_unweighted_events\.lhe\.gz`
 
65
touch RunWeb
 
66
 
 
67
echo "Merging LHE files"
 
68
echo "Merging LHE files" >& ../status
 
69
$dirbin/merge.pl $main/Events/$t\_*\_unweighted_events\.lhe\.gz $main/Events/$t\_unweighted_events\.lhe\.gz $main/Events/$t\_banner.txt
 
70
 
 
71
$dirbin/gen_crossxhtml-pl $t
 
72
 
 
73
#
 
74
#  Create root file and plots
 
75
#
 
76
 
 
77
cd $main/Events
 
78
 
 
79
if [[ (-e $t\_unweighted_events.lhe.gz) ]]; then
 
80
    gunzip $t\_unweighted_events.lhe.gz
 
81
fi
 
82
 
 
83
if [[ (-x $ERAdir/ExRootLHEFConverter) && (-e $t\_unweighted_events.lhe) ]]; then
 
84
    echo "Creating Root File"
 
85
    echo "Creating Root File" >& ../status
 
86
    $dirbin/gen_crossxhtml-pl $t
 
87
    $ERAdir/ExRootLHEFConverter $t\_unweighted_events.lhe $t\_unweighted_events.root
 
88
fi
 
89
 
 
90
#if [[ (-x $ERAdir/ExRootMain) && (-e $t\_unweighted_events.root) && (-e ../Cards/plot_card.dat) ]]; then
 
91
#    echo "Creating Root Plots" >& ../status
 
92
#    $dirbin/gen_crossxhtml-pl
 
93
#    mkdir $t
 
94
#    cd $t
 
95
#    echo "../$t""_unweighted_events.root" > events.list
 
96
#    $dirbin/plot $ERAdir > plot.log
 
97
#    cd ..
 
98
#    $dirbin/plot_page-pl $t
 
99
#    mv plots.html $t\_plots.html
 
100
#    $dirbin/gen_crossxhtml-pl
 
101
#fi
 
102
 
 
103
if [[ (-x $MAdir/plot_events) && (-e $t\_unweighted_events.lhe) && (-e ../Cards/plot_card.dat) ]]; then
 
104
    echo "Creating Plots"
 
105
    echo "Creating Plots" >& ../status
 
106
    $dirbin/gen_crossxhtml-pl $t
 
107
    mkdir $t
 
108
    cd $t
 
109
    echo "../${t}_unweighted_events.lhe" > events.list
 
110
    $dirbin/plot $MAdir $td > plot.log
 
111
    cd ..
 
112
    $dirbin/plot_page-pl $t
 
113
    mv plots.html ${t}_plots.html
 
114
fi
 
115
 
 
116
if [[ -e $t\_unweighted_events.lhe ]]; then
 
117
    gzip $t\_unweighted_events.lhe
 
118
fi
 
119
 
 
120
cd ..
 
121
rm RunWeb
 
122
rm status
 
123
 
 
124
$dirbin/gen_crossxhtml-pl