~maddevelopers/mg5amcnlo/WWW5_caching

« back to all changes in this revision

Viewing changes to users/mardelcourt/PROC_129738/PROC_129738/bin/internal/put_banner

  • Committer: John Doe
  • Date: 2013-03-25 20:27:02 UTC
  • Revision ID: john.doe@gmail.com-20130325202702-5sk3t1r8h33ca4p4
first clean version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
#  Stick a banner on top of the event file and update iseed
 
4
#  
 
5
#  Usage: put_banner event_file
 
6
#
 
7
#   First we need to get into the main directory
 
8
#
 
9
if [[  ! -d ./bin  ]]; then
 
10
    cd ../
 
11
    if [[ ! -d ./bin ]]; then
 
12
        echo "Error: put_banner be executed from the main, or bin directory"
 
13
        exit
 
14
    fi
 
15
fi
 
16
if [[  "$1" == ""  ]]; then
 
17
    echo 'Enter file with events (in directory Events)' 
 
18
    read c 
 
19
else
 
20
    c=$1
 
21
fi
 
22
 
 
23
if [[  "$2" == ""  ]]; then
 
24
    echo 'Enter random seed for the run'
 
25
    read r
 
26
else
 
27
    r=$2
 
28
fi
 
29
 
 
30
 
 
31
if [[ -d Events ]]; then
 
32
    cd Events
 
33
# Put all the info in a long banner
 
34
# First the header
 
35
# $B$ begin_banner $B$ !this is a tag for MadWeight. Don't edit this line
 
36
  cat ../Source/banner_header.txt >& b.txt
 
37
# $E$ begin_banner $E$ !this is a tag for MadWeight. Don't edit this line
 
38
# Now the version information
 
39
# grab the info first
 
40
   mgme=`awk '/.*/{print $1}' ../MGMEVersion.txt`
 
41
# $B$version_info$E$  ! Tag for add info in MW_version. Don't edit this line
 
42
   echo "<MGVersion>">& version.txt
 
43
   echo "# MG    version    : $mgme"    >>version.txt
 
44
   if [[ -e ../Source/MODEL/ModelVersion.txt ]];then
 
45
       model=`awk '/.*/{print $1}' ../Source/MODEL/ModelVersion.txt`
 
46
       echo "# model version    : $model"    >>version.txt
 
47
   fi
 
48
# $B$ write_version $E$  ! Tag for add info in MW_version. Don't edit this line
 
49
   echo "</MGVersion>" >> version.txt 
 
50
   cat version.txt >> b.txt
 
51
   rm -f version.txt
 
52
#proc_card.dat
 
53
   if [[ -e "../SubProcesses/procdef_mg5.dat" ]];then
 
54
       echo "<MG5ProcCard>" >>b.txt
 
55
       cat ../Cards/proc_card_mg5.dat  >> b.txt
 
56
       echo "</MG5ProcCard>" >>b.txt
 
57
       echo "<MGProcCard>" >>b.txt
 
58
       cat ../SubProcesses/procdef_mg5.dat  >> b.txt
 
59
       echo "</MGProcCard>" >>b.txt
 
60
   else
 
61
       echo "<MGProcCard>" >>b.txt
 
62
       cat ../Cards/proc_card.dat  >> b.txt
 
63
       echo "</MGProcCard>" >>b.txt
 
64
   fi
 
65
# $B$ param_card $B$  ! Tag for add info in MW_version. Don't edit this line
 
66
# param_card.dat
 
67
   echo "<slha>">>b.txt
 
68
   cp ../Cards/param_card.dat param_card_temp.dat
 
69
#   ../bin/qnumbers.pl ../Source/MODEL/particles.dat param_card_temp.dat
 
70
   cat param_card_temp.dat >> b.txt
 
71
   rm param_card_temp.dat
 
72
   echo "</slha>">>b.txt
 
73
# $E$ param_card $E$  ! Tag for add info in MW_version. Don't edit this line
 
74
# run_card.dat
 
75
   echo "<MGRunCard>">>b.txt
 
76
   cat ../Cards/run_card.dat   >> b.txt
 
77
   echo "</MGRunCard>">>b.txt
 
78
# grid_card.dat
 
79
   b=`awk '/^[^#].*=.*gridpack/{print $1}' ../Cards/run_card.dat`
 
80
   if [[ $b == ".true." ]]; then
 
81
      echo "<MGGridCard>">>b.txt
 
82
      cat ../Cards/grid_card.dat   >> b.txt
 
83
      echo "</MGGridCard>">>b.txt
 
84
   fi
 
85
# $B$ other_card $E$  ! Tag for add info in MW_version. Don't edit this line
 
86
# $B$ end_file $B$  ! Tag for add info in MW_version. Don't edit this line
 
87
#  
 
88
#  sed -e "s/^/#/g" b.txt > bb.txt
 
89
#  cat bb.txt >> b.txt
 
90
#now update the random seed
 
91
    if [[ $r -eq 0 && -e ../SubProcesses/randinit ]]; then
 
92
        source ../SubProcesses/randinit
 
93
#       echo "Got r "
 
94
    fi
 
95
#    echo $r
 
96
#    echo '<LesHouchesEvents version="1.0">' >& banner.txt
 
97
#    echo '<!---' >> banner.txt
 
98
    sed -e "s/[\t ]0.*iseed/ $r = iseed/g" b.txt >& banner.txt
 
99
    rm -f b.txt 
 
100
#now copy things over 
 
101
    cat $c >> banner.txt
 
102
    rm -f $c
 
103
    echo '</LesHouchesEvents>' >> banner.txt
 
104
    sed -e '/^ *$/d' banner.txt > $c
 
105
    rm -f temp.dat
 
106
    rm -f banner.txt
 
107
    cd ..
 
108
else
 
109
    echo 'Error Events directory not found'
 
110
    exit
 
111
fi
 
112
# $E$ end_file $E$  ! Tag for add info in MW_version. Don't edit this line