~maddevelopers/mg5amcnlo/WWW5_caching

« back to all changes in this revision

Viewing changes to users/mardelcourt/PROC_427003/PROC_427003/bin/newprocess_mg5

  • 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
#  First get to main level directory for this process
 
4
#
 
5
 
 
6
if [[  ! -d ./bin || ! -d ./SubProcesses ]]; then
 
7
    cd ../
 
8
    if [[ ! -d ./bin || ! -d ./SubProcesses  ]]; then
 
9
        echo "Error: store must be executed from the main, or bin directory"
 
10
        exit
 
11
    fi
 
12
fi
 
13
 
 
14
# Check that mg5 exists
 
15
main=`pwd`
 
16
mgdir=$main/../bin
 
17
if [[  ! -x $mgdir/mg5 ]]; then
 
18
    mgdir=$main/../madgraph5/bin
 
19
fi
 
20
if [[ ! -x $mgdir/mg5 ]]; then
 
21
   echo "Error no mg5 executable $mgdir/mg5 found"
 
22
   exit
 
23
fi
 
24
 
 
25
 
 
26
dirbin=$main/bin/internal
 
27
bin=$main/bin 
 
28
 
 
29
# Local versions to work on the cluster
 
30
tag=''
 
31
while [[ "$1" != ""  ]]; do
 
32
    if [[ "$1" == "--web" ]]; then
 
33
    mgdir=$MADGRAPH_BASE/MG_ME/mg5
 
34
    dirbin=$MADGRAPH_BASE/MG_ME/WebBin
 
35
    bin =$MADGRAPH_BASE/MG_ME/WebBin
 
36
    tag="--web"
 
37
    fi
 
38
    shift 1
 
39
done
 
40
 
 
41
# some external executable
 
42
#gen_card=$dirbin/gen_cardhtml-pl
 
43
#gen_info=$dirbin/gen_infohtml-pl
 
44
 
 
45
# Check if we have to use MG4 proc_card.dat or MG5 proc_card.dat
 
46
if [[ -e ./Cards/proc_card_mg5.dat ]]; then 
 
47
   if [[ -e ./Cards/proc_card.dat ]]; then
 
48
      if [[ $tag != '--web' ]]; then
 
49
          echo "both mg4 and mg5 proc_card.dat are detected. Which one do you want to use? [4/5]"
 
50
          read card_use 
 
51
      else
 
52
           card_use='5'
 
53
      fi
 
54
   else
 
55
        card_use='5'
 
56
   fi
 
57
elif [[ -e ./Cards/proc_card.dat ]]; then
 
58
     card_use='4'
 
59
else
 
60
    echo "neither proc_card.dat or proc_card_mg5.dat" 
 
61
    echo "are present in directory Cards"
 
62
    echo "Prepare a card (see examples on the web) and"
 
63
    echo "copy it there, or run directly ../bin/mg5."
 
64
    exit
 
65
fi
 
66
 
 
67
echo $$ > generating
 
68
rm proc_log.txt >& /dev/null
 
69
echo "Started `date`" >  ./proc_log.txt
 
70
echo "Running..."
 
71
 
 
72
cp -p HTML/thinking.gif HTML/card.jpg
 
73
rm SubProcesses/done >& /dev/null
 
74
 
 
75
$gen_card >& /dev/null
 
76
 
 
77
# launch the mg5 program
 
78
if [[ $card_use == '4' ]]; then
 
79
# Run ./mg5 with stderr going to both the file proc_log.txt and to terminal
 
80
# output. See http://acs.lbl.gov/~ksb/Scratch/sh_redir_pipe.html
 
81
    ((echo import proc_v4 ./Cards/proc_card.dat | $mgdir/mg5 3>&1 1>&2 2>&3) | tee /dev/tty) >> proc_log.txt 2>&1
 
82
elif [[ $card_use == '5' ]]; then
 
83
# Run ./mg5 with stderr going to both the file proc_log.txt and to terminal
 
84
# output. See http://acs.lbl.gov/~ksb/Scratch/sh_redir_pipe.html
 
85
     (($mgdir/mg5 ./Cards/proc_card_mg5.dat 3>&1 1>&2 2>&3) | tee /dev/tty) >> proc_log.txt 2>&1
 
86
else
 
87
    echo 'not recognized mode'
 
88
fi
 
89
 
 
90
echo "Finished `date` " >> ./proc_log.txt
 
91
echo "`date` " >& ./CREATED
 
92
cd SubProcesses
 
93
touch done
 
94
cd ..
 
95
 
 
96
if [[  $tag == "--web"  ]]; then
 
97
   touch Online
 
98
fi
 
99
rm generating
 
100
echo 'done'
 
101
 
 
102
# Check that generation worked
 
103
if [[ ! -e SubProcesses/subproc.mg ]]; then
 
104
 
 
105
    cp -p HTML/stop.jpg HTML/card.jpg
 
106
    echo "No diagrams for this process!"
 
107
fi
 
108
 
 
109
$gen_card >& /dev/null