~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to Template/bin/calculate_crossx

Added Template and HELAS into bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
#  This runs survey,refine,unweight_events, one after the other
 
4
#  
 
5
#   First we need to get into the main directory
 
6
#
 
7
#
 
8
#  Usage: generate_events compression events parallel [name]
 
9
#
 
10
 
 
11
if [[  ! -d ./bin  ]]; then
 
12
    cd ../
 
13
    if [[ ! -d ./bin ]]; then
 
14
        echo "Error: it must be executed from the main, or bin directory"
 
15
        exit
 
16
    fi
 
17
fi
 
18
#
 
19
#  Now let shell know where to find important executables
 
20
#
 
21
main=`pwd`
 
22
dirbin=$main/bin
 
23
pydir=$main/../pythia-pgs/src
 
24
pgsdir=$pydir
 
25
ERAdir=$main/../ExRootAnalysis
 
26
webbin=$dirbin
 
27
td=$dirbin/td
 
28
web=0
 
29
 
 
30
echo $$ >> myprocid
 
31
 
 
32
#if ( "$1" == "" ) then
 
33
#    echo 'Number of unweighted events. This is ingnored and read from run_card.dat ' 
 
34
#    set a  = $< 
 
35
#else
 
36
#    set a = $1
 
37
#endif
 
38
if [[  "$1" == ""  ]]; then
 
39
    echo 'Enter 1 for parallel 0 for serial run' 
 
40
     read p 
 
41
else
 
42
     p=$1
 
43
fi
 
44
n=MadEvent
 
45
if [[  $p -gt 0 ]]; then
 
46
   if [[  "$2" == ""  ]]; then
 
47
    echo 'Enter name for jobs on pbs queue'
 
48
       read n
 
49
   else
 
50
       n=$2
 
51
   fi
 
52
   if [[  "$3" == ""  ]]; then
 
53
       echo 'Enter run name'
 
54
       read t
 
55
   else
 
56
       t=$3
 
57
   fi
 
58
else
 
59
   if [[  "$2" == ""  ]]; then
 
60
      echo 'Enter run name'
 
61
      read t
 
62
   else
 
63
      t=$2
 
64
   fi
 
65
fi
 
66
#set t = TeV2
 
67
if [[  ${#argv} -gt 3  ]]; then
 
68
    web=1
 
69
    webbin="$MADGRAPH_BASE/MG_ME/WebBin"
 
70
    pydir="$webbin/pythia-pgs"
 
71
    pgsdir=$pydir
 
72
    ERAdir="$MADGRAPH_BASE/MG_ME/ExRootAnalysis"
 
73
    td=$webbin/td
 
74
    touch Online
 
75
fi
 
76
date
 
77
a=`awk '/^[^#].*=.*nevents/{print $1}' Cards/run_card.dat`
 
78
echo Generating $a events
 
79
#
 
80
#  Check if run already exists. If so, store run w/ new name
 
81
#  and remove old run before starting.
 
82
#
 
83
 
 
84
if [[  -e status  ]]; then
 
85
  rm status
 
86
fi
 
87
if [[  -e error  ]]; then
 
88
  rm error
 
89
fi
 
90
touch RunWeb
 
91
echo "Cleaning directories" > status
 
92
$dirbin/gen_crossxhtml-pl $t
 
93
$dirbin/clean
 
94
touch survey
 
95
echo "Starting jobs" > status
 
96
$dirbin/gen_crossxhtml-pl $t
 
97
$dirbin/survey $p $n $t
 
98
if [[  -e error  ]]; then
 
99
  cat error
 
100
  date
 
101
  cp -f error status
 
102
  rm refine
 
103
  rm RunWeb
 
104
  $dirbin/gen_crossxhtml-pl $t
 
105
  $dirbin/gen_cardhtml-pl
 
106
  exit
 
107
fi
 
108
#
 
109
#  Now collect the events - just to get the banner in fact
 
110
#
 
111
echo "Combining Events" >& status
 
112
echo "Combining Events" 
 
113
$dirbin/gen_crossxhtml-pl $t
 
114
pushd ./Source > /dev/null
 
115
make ../bin/combine_events
 
116
popd > /dev/null
 
117
pushd SubProcesses > /dev/null
 
118
$dirbin/run_combine $p
 
119
mv events.lhe ../Events/
 
120
mv unweighted_events.lhe ../Events/
 
121
popd > /dev/null
 
122
#
 
123
#  do the banner
 
124
#
 
125
cd ./Events
 
126
echo "putting the banner"
 
127
$dirbin/put_banner events.lhe
 
128
$dirbin/put_banner unweighted_events.lhe
 
129
cd ../
 
130
#
 
131
#  Store Events
 
132
#
 
133
echo "Storing Events" >& status
 
134
$dirbin/gen_crossxhtml-pl $t
 
135
$dirbin/store $t
 
136
rm -f RunWeb
 
137
echo " " >& status
 
138
$dirbin/gen_crossxhtml-pl $t
 
139
$dirbin/gen_cardhtml-pl
 
140
date