3
# This runs survey,refine,unweight_events, one after the other
5
# First we need to get into the main directory
11
if [[ ! -d ./bin ]]; then
13
if [[ ! -d ./bin ]]; then
14
echo "Error: it must be executed from the main, or bin directory"
19
# Now let shell know where to find important executables
23
pydir=$main/../pythia-pgs/src
25
ERAdir=$main/../ExRootAnalysis
26
MAdir=$main/../MadAnalysis
33
#if ( "$1" == "" ) then
34
# echo 'Number of unweighted events. This is ingnored and read from run_card.dat '
40
#if [[ "$1" == "" ]]; then
41
# echo 'Enter 1 for parallel 0 for serial run'
48
#if [[ $p -gt 0 ]]; then
49
# if [[ "$2" == "" ]]; then
50
# echo 'Enter name for jobs on pbs queue'
55
# if [[ "$3" == "" ]]; then
56
# echo 'Enter run name'
62
# if [[ "$2" == "" ]]; then
63
# echo 'Enter run name'
71
if [[ "$4" -ne "" ]]; then
73
webbin="$MADGRAPH_BASE/MG_ME/WebBin"
74
pydir="$webbin/pythia-pgs"
76
ERAdir="$MADGRAPH_BASE/MG_ME/ExRootAnalysis"
77
MAdir="$MADGRAPH_BASE/MG_ME/MadAnalysis"
78
td="$MADGRAPH_BASE/MG_ME/td"
82
a=`awk '/^[^#].*=.*gevents/{print $1}' Cards/grid_card.dat`
83
echo Generating $a events
85
echo 'restoring default data...'
86
$dirbin/restore_data default
87
echo '...default data restored.'
89
# Check if run already exists. If so, store run w/ new name
90
# and remove old run before starting.
93
if [[ -e status ]]; then
96
if [[ -e error ]]; then
100
#echo "Cleaning directories" > status
101
#$dirbin/gen_crossxhtml-pl $t
104
#echo "Starting jobs" > status
105
#$dirbin/gen_crossxhtml-pl $t
106
#$dirbin/survey $p $n $t
107
if [[ -e error ]]; then
113
$dirbin/gen_crossxhtml-pl $t
114
$dirbin/gen_cardhtml-pl
119
# Changes for gen_grid_job don't need refine
121
$dirbin/refine4grid $a $p $n 1 $t
125
# Now collect the events
127
echo "Combining Events" >& status
128
echo "Combining Events"
129
$dirbin/gen_crossxhtml-pl $t
130
pushd ./Source > /dev/null
131
# make ../bin/combine_events
133
pushd SubProcesses > /dev/null
134
$dirbin/run_combine $p
135
mv events.lhe ../Events/
136
mv unweighted_events.lhe ../Events/
142
echo "putting the banner"
143
$dirbin/put_banner events.lhe
144
$dirbin/put_banner unweighted_events.lhe
151
if [[ (-x $ERAdir/ExRootLHEFConverter) && (-e unweighted_events.lhe) ]]; then
152
echo "Creating Root File" >& ../status
153
$dirbin/gen_crossxhtml-pl $t
154
$ERAdir/ExRootLHEFConverter unweighted_events.lhe unweighted_events.root
157
#if ((-x $ERAdir/ExRootMain) && (-e unweighted_events.root) && (-e ../Cards/plot_card.dat)) then
158
# echo "Creating Root Plots" >& ../status
159
# $dirbin/gen_crossxhtml-pl $t
162
# echo "../unweighted_events.root" > events.list
163
# $dirbin/plot $ERAdir > plot.log
165
# $dirbin/plot_page-pl $t
167
if [[ (-x $MAdir/plot_events) && (-e unweighted_events.lhe) && (-e ../Cards/plot_card.dat) ]]; then
168
echo "Creating Plots" >& ../status
169
$dirbin/gen_crossxhtml-pl $t
172
echo "../unweighted_events.lhe" > events.list
173
$dirbin/plot $MAdir $td > plot.log
175
$dirbin/plot_page-pl $t
180
# Below is for Pythia runs...
183
$dirbin/gen_crossxhtml-pl $t
186
# Run Pythia and PGS on events
189
# Compile pythia if not there
190
if [[ !(-x $pydir/pythia) && (-d $pydir) && (-e ../Cards/pythia_card.dat) ]]; then
191
pushd $pydir > /dev/null
192
echo "No pythia executable - running make"
197
if [[ (-x $pydir/pythia) && (-e ../Cards/pythia_card.dat) ]]; then
198
gunzip -c ${t}_unweighted_events.lhe.gz > unweighted_events.lhe
199
echo "Running Pythia" >& ../status
200
$dirbin/gen_crossxhtml-pl $t
201
# shower and hadronize event through Pythia
202
echo "Running pythia..."
203
# qsub -v pydir=$pydir $dirbin/run_pythia >> ../running_jobs
204
$dirbin/run_pythia $pydir $p
207
if [[ (-x $pydir/hep2lhe) && (-e ../Cards/pythia_card.dat) && (-e pythia_events.hep) ]]; then
208
echo "Creating Pythia LHE File" >& ../status
209
$dirbin/gen_crossxhtml-pl $t
210
$dirbin/run_hep2lhe $pydir $p
213
if [[ (-x $ERAdir/ExRootLHEFConverter) && (-e pythia_events.lhe) ]]; then
214
echo "Creating Pythia LHE Root File" >& ../status
215
$dirbin/gen_crossxhtml-pl $t
216
$ERAdir/ExRootLHEFConverter pythia_events.lhe pythia_lhe_events.root
219
# Compile pgs if not there
220
if [[ !(-x $pgsdir/pgs) && (-d $pgsdir) && (-e ../Cards/pgs_card.dat) ]]; then
221
pushd $pgsdir > /dev/null
222
echo "No pgs executable - running make"
227
if [[ (-x $pgsdir/pgs) && (-e ../Cards/pgs_card.dat) ]]; then
228
echo "Running PGS" >& ../status
229
$dirbin/gen_crossxhtml-pl $t
230
# now pass the event to a detector simulator and reconstruct objects
231
echo "Running PGS..."
232
# qsub -v pgsdir=$pgsdir $dirbin/run_pgs >> ../running_jobs
233
$dirbin/run_pgs $pgsdir $p
237
if [[ (-x $ERAdir/ExRootLHCOlympicsConverter) && (-e pgs_events.lhco) ]]; then
238
echo "Creating PGS Root File" >& ../status
239
$dirbin/gen_crossxhtml-pl $t
240
$ERAdir/ExRootLHCOlympicsConverter pgs_events.lhco pgs_events.root
245
$dirbin/gen_cardhtml-pl