3
# This runs pythia on the unweighted_events.dat
5
# Usage: run_pythia [pydir [para/serial [run_name]]]
6
# where pydir is the path to the pythia executable
12
pydir=../../pythia-pgs/src
23
ERAdir=../../ExRootAnalysis
26
if [ ! -e ../Cards/pythia_card.dat ]; then
27
echo "No pythia_card.dat found. Quitting..."
31
echo $$ >> ../myprocid
33
if [ "$run" != "" ]; then
34
if [ ! -e ${run}_unweighted_events.lhe.gz ]; then
35
echo "No file ${run}_unweighted_events.lhe.gz. Quitting..."
38
echo gunzip ${run}_unweighted_events.lhe.gz
39
gunzip -c ${run}_unweighted_events.lhe.gz > unweighted_events.lhe
43
# shower and hadronize event through Pythia
45
echo " " >> ../Cards/pythia_card.dat
46
echo " LHAPATH=$pydir/PDFsets" >> ../Cards/pythia_card.dat
47
export PDG_MASS_TBL=$pydir/mass_width_2004.mc
48
rm -f pythia.log > /dev/null
49
rm -f pythia.err > /dev/null
50
rm -f pythia.out > /dev/null
54
echo '#!/bin/bash' > pythia.pbs
55
echo "export PDG_MASS_TBL=$pydir/mass_width_2004.mc;cd $main;$pydir/pythia;touch pythia.out" >> pythia.pbs
57
qsub -N pythia_run -e pythia.err -o pythia.log -V -q madgraph pythia.pbs >> ../running_jobs
58
while [ ! -e pythia.out ]
64
$pydir/pythia >& pythia.log
67
if [[ -e pythia.err ]];then
71
if [ "$run" != "" ]; then
72
if [ -e pythia_events.hep ]; then
73
if [ -x $pydir/hep2lhe ]; then
74
echo "Creating Pythia LHE File" > ../status
75
echo "Creating Pythia LHE File"
76
../bin/gen_crossxhtml-pl $run
77
../bin/run_hep2lhe $pydir $p
79
if [[ -x $ERAdir/ExRootLHEFConverter && -e pythia_events.lhe ]]; then
80
echo "Creating Pythia LHE Root File" > ../status
81
echo "Creating Pythia LHE Root File"
82
../bin/gen_crossxhtml-pl $run
83
$ERAdir/ExRootLHEFConverter pythia_events.lhe ${run}_pythia_lhe_events.root
86
echo Storing Pythia files > ../status
87
../bin/gen_crossxhtml-pl $run
88
mv -f pythia_events.hep ${run}_pythia_events.hep
89
gzip -f ${run}_pythia_events.hep
90
mv -f pythia.log ${run}_pythia.log
92
if [ -e ../Cards/pythia_card.dat ] ; then
93
echo "<MGPythiaCard>" >>${run}_banner.txt
94
cat ../Cards/pythia_card.dat >> ${run}_banner.txt
95
echo "</MGPythiaCard>" >>${run}_banner.txt
98
if [ -e events.tree ]; then
99
mv -f events.tree ${run}_events.tree
100
gzip -f ${run}_events.tree
101
mv -f xsecs.tree ${run}_xsecs.tree
102
mv -f beforeveto.tree ${run}_beforeveto.tree
103
gzip -f ${run}_beforeveto.tree
105
if [ -e pythia_events.lhe ]; then
106
echo \<LesHouchesEvents version=\"1.0\"\> > temp.lhe
107
echo \<\!-- >> temp.lhe
108
cat ${run}_banner.txt >> temp.lhe
109
sed /'<LesHouchesEvents version=\"1.0\">'/s//'-->'/ pythia_events.lhe >> temp.lhe
110
rm -f pythia_events.lhe
111
mv -f temp.lhe ${run}_pythia_events.lhe
112
gzip -f ${run}_pythia_events.lhe
114
rm -f unweighted_events.lhe