~maddevelopers/mg5amcnlo/WWW5_caching

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
#
#  Stick a banner on top of the event file and update iseed
#  
#  Usage: put_banner event_file
#
#   First we need to get into the main directory
#
if [[  ! -d ./bin  ]]; then
    cd ../
    if [[ ! -d ./bin ]]; then
	echo "Error: put_banner be executed from the main, or bin directory"
	exit
    fi
fi
if [[  "$1" == ""  ]]; then
    echo 'Enter file with events (in directory Events)' 
    read c 
else
    c=$1
fi

if [[  "$2" == ""  ]]; then
    echo 'Enter random seed for the run'
    read r
else
    r=$2
fi


if [[ -d Events ]]; then
    cd Events
# Put all the info in a long banner
# First the header
# $B$ begin_banner $B$ !this is a tag for MadWeight. Don't edit this line
  cat ../Source/banner_header.txt >& b.txt
# $E$ begin_banner $E$ !this is a tag for MadWeight. Don't edit this line
# Now the version information
# grab the info first
   mgme=`awk '/.*/{print $1}' ../MGMEVersion.txt`
# $B$version_info$E$  ! Tag for add info in MW_version. Don't edit this line
   echo "<MGVersion>">& version.txt
   echo "# MG    version    : $mgme"    >>version.txt
   if [[ -e ../Source/MODEL/ModelVersion.txt ]];then
       model=`awk '/.*/{print $1}' ../Source/MODEL/ModelVersion.txt`
       echo "# model version    : $model"    >>version.txt
   fi
# $B$ write_version $E$  ! Tag for add info in MW_version. Don't edit this line
   echo "</MGVersion>" >> version.txt 
   cat version.txt >> b.txt
   rm -f version.txt
#proc_card.dat
   if [[ -e "../SubProcesses/procdef_mg5.dat" ]];then
       echo "<MG5ProcCard>" >>b.txt
       cat ../Cards/proc_card_mg5.dat  >> b.txt
       echo "</MG5ProcCard>" >>b.txt
       echo "<MGProcCard>" >>b.txt
       cat ../SubProcesses/procdef_mg5.dat  >> b.txt
       echo "</MGProcCard>" >>b.txt
   else
       echo "<MGProcCard>" >>b.txt
       cat ../Cards/proc_card.dat  >> b.txt
       echo "</MGProcCard>" >>b.txt
   fi
# $B$ param_card $B$  ! Tag for add info in MW_version. Don't edit this line
# param_card.dat
   echo "<slha>">>b.txt
   cp ../Cards/param_card.dat param_card_temp.dat
#   ../bin/qnumbers.pl ../Source/MODEL/particles.dat param_card_temp.dat
   cat param_card_temp.dat >> b.txt
   rm param_card_temp.dat
   echo "</slha>">>b.txt
# $E$ param_card $E$  ! Tag for add info in MW_version. Don't edit this line
# run_card.dat
   echo "<MGRunCard>">>b.txt
   cat ../Cards/run_card.dat   >> b.txt
   echo "</MGRunCard>">>b.txt
# grid_card.dat
   b=`awk '/^[^#].*=.*gridpack/{print $1}' ../Cards/run_card.dat`
   if [[ $b == ".true." ]]; then
      echo "<MGGridCard>">>b.txt
      cat ../Cards/grid_card.dat   >> b.txt
      echo "</MGGridCard>">>b.txt
   fi
# $B$ other_card $E$  ! Tag for add info in MW_version. Don't edit this line
# $B$ end_file $B$  ! Tag for add info in MW_version. Don't edit this line
#  
#  sed -e "s/^/#/g" b.txt > bb.txt
#  cat bb.txt >> b.txt
#now update the random seed
    if [[ $r -eq 0 && -e ../SubProcesses/randinit ]]; then
	source ../SubProcesses/randinit
#	echo "Got r "
    fi
#    echo $r
#    echo '<LesHouchesEvents version="1.0">' >& banner.txt
#    echo '<!---' >> banner.txt
    sed -e "s/[\t ]0.*iseed/ $r = iseed/g" b.txt >& banner.txt
    rm -f b.txt 
#now copy things over 
    cat $c >> banner.txt
    rm -f $c
    echo '</LesHouchesEvents>' >> banner.txt
    sed -e '/^ *$/d' banner.txt > $c
    rm -f temp.dat
    rm -f banner.txt
    cd ..
else
    echo 'Error Events directory not found'
    exit
fi
# $E$ end_file $E$  ! Tag for add info in MW_version. Don't edit this line