~madteam/mg5amcnlo/series2.0

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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
#
################################################################################
#                                                                             ##
#                    MadGraph/MadEvent                                        ##
#                                                                             ##
# FILE : compile                                                              ##
# VERSION : 1.0                                                               ##
# DATE : 23 Septembre 2007                                                    ##
# AUTHOR : MH - MadGraph team                                                 ##
#                                                                             ##
# DESCRIPTION : script to compile madevent                                    ##
# USAGE : ./make_package                                                      ##
################################################################################

# set nonomatch

if [[ ! -d ./bin ]]; then
    cd ../
    if [[ ! -d ./bin ]]; then
        echo "Error: it must be executed from the main, or bin directory"
        exit
    fi
fi


#
# If argument is equal to 'd' use dynamic libraries
#
echo $PWD
if [[  "$1" == ""  ]]; then
    echo "Using default makefiles"
elif [[ "$1" == "dynamic" && "$2" == "lhapdf" ]]; then
    echo "Changing makefiles for the generation of dynamic libraries including LHAPDF support (might not work under MacOsX)"
    if [[ -e ./Source/makefile_dlhapdf ]]; then
	mv ./Source/makefile ./Source/makefile_static
        cp ./Source/makefile_dlhapdf ./Source/makefile
    else
        echo "Error: Could not replace Source/makefile"
        exit
    fi
    if [[ -e SubProcesses/makefile_dlhapdf ]]; then
	mv SubProcesses/makefile SubProcesses/makefile_static
        cp SubProcesses/makefile_dlhapdf SubProcesses/makefile
    else
        echo "Error: Could not replace SubProcesses/makefile"
        exit
    fi
    if [[ -e SubProcesses/makefile_mo_dlhapdf ]]; then
        mv SubProcesses/makefile SubProcesses/makefile_static
        cp SubProcesses/makefile_mo_dlhapdf SubProcesses/makefile_mo
    else
        echo "Error: Could not replace SubProcesses/makefile_mo"
        exit
    fi
    if [[ -e Source/DHELAS/Makefile_dynamic ]]; then
	mv Source/DHELAS/Makefile Source/DHELAS/Makefile_static
        cp Source/DHELAS/Makefile_dynamic Source/DHELAS/Makefile
	sed -i.bak "s|f77|gfortran|g" Source/DHELAS/Makefile
    else
        echo "Error: Could not replace Source/DHELAS/Makefile"
        exit
    fi
    if [[ -e Source/MODEL/makefile_dynamic ]]; then
	mv Source/MODEL/makefile Source/MODEL/makefile_static
        cp Source/MODEL/makefile_dynamic Source/MODEL/makefile
	sed -i.bak "s|f77|gfortran|g" Source/MODEL/makefile
    else
        echo "Error: Could not replace Source/MODEL/makefile"
        exit
    fi
    if [[ -e Source/CERNLIB/makefile_dynamic ]]; then
	mv Source/CERNLIB/makefile Source/CERNLIB/makefile_static
        cp Source/CERNLIB/makefile_dynamic Source/CERNLIB/makefile
	sed -i.bak "s|f77|gfortran|g" Source/CERNLIB/makefile
    else
        echo "Error: Could not replace Source/CERNLIB/makefile"
        exit
    fi
    if [[ -e Source/PDF/makefile_dlhapdf ]]; then
	mv Source/PDF/makefile Source/PDF/makefile_static
        cp Source/PDF/makefile_dlhapdf Source/PDF/makefile
    else
        echo "Error: Could not replace Source/PDF/makefile"
        exit
    fi
elif [[ "$1" == "dynamic" ]]; then
    echo "Changing makefiles for the generation of dynamic libraries (might not work under MacOsX)"
    if [[ -e ./Source/makefile_dynamic ]]; then
	mv ./Source/makefile ./Source/makefile_static
        cp ./Source/makefile_dynamic ./Source/makefile
    else
        echo "Error: Could not replace Source/makefile"
        exit
    fi
    if [[ -e SubProcesses/makefile_dynamic ]]; then
	mv SubProcesses/makefile SubProcesses/makefile_static
        cp SubProcesses/makefile_dynamic SubProcesses/makefile
    else
        echo "Error: Could not replace SubProcesses/makefile"
        exit
    fi
    if [[ -e Source/DHELAS/Makefile_dynamic ]]; then
	mv Source/DHELAS/Makefile Source/DHELAS/Makefile_static
        cp Source/DHELAS/Makefile_dynamic Source/DHELAS/Makefile
    else
        echo "Error: Could not replace Source/DHELAS/Makefile"
        exit
    fi
    if [[ -e Source/MODEL/makefile_dynamic ]]; then
	mv Source/MODEL/makefile Source/MODEL/makefile_static
        cp Source/MODEL/makefile_dynamic Source/MODEL/makefile
    else
        echo "Error: Could not replace Source/MODEL/makefile"
        exit
    fi
    if [[ -e Source/CERNLIB/makefile_dynamic ]]; then
	mv Source/CERNLIB/makefile Source/CERNLIB/makefile_static
        cp Source/CERNLIB/makefile_dynamic Source/CERNLIB/makefile
    else
        echo "Error: Could not replace Source/CERNLIB/makefile"
        exit
    fi
    if [[ -e Source/PDF/makefile_dynamic ]]; then
	mv Source/PDF/makefile Source/PDF/makefile_static
        cp Source/PDF/makefile_dynamic Source/PDF/makefile
    else
        echo "Error: Could not replace Source/PDF/makefile"
        exit
    fi
else
    echo Error: invalid argument $1
    exit
fi

#
#  Now let shell know where to find important executables
#

if [[ -d Source ]]; then
    cd Source
    make ../bin/sum_html
    make ../bin/gen_ximprove
    make all
    make ../bin/combine_events
    make ../bin/combine_runs
    cd ..
else
    echo 'Error Source directory not found'
    exit
fi

if [[ -d SubProcesses ]]; then
    cd SubProcesses
    for i in `cat subproc.mg` ; do
	cd $i
	echo $i
	rm -f ajob* >& /dev/null
	rm -f wait.ajob* >& /dev/null
	rm -f run.ajob* >& /dev/null
	rm -f done.ajob* >& /dev/null
#        if [[ -e ajob1 ]]; then
#	   chmod +x ajob*
        make madevent > /dev/null
#        fi
	cd ..
     done
    cd ..
else
    echo "Error could not find SubProcesses"
    exit
fi

if [[ -d ../DECAY ]]; then
    echo "DECAY directory found, compiling..."
    cd ../DECAY
    if [[  "$1" == ""  ]]; then
	sed -i.bak "s|HELAS/lib/libdhelas3.a|madevent/lib/libdhelas3.a|g" makefile
    elif [[ "$1" == "dynamic" ]]; then
	sed -i.bak "s|HELAS/lib/libdhelas3.a|madevent/lib/libdhelas3.so|g" makefile
    else
	echo Error: invalid argument $1
	exit
    fi
    make
fi

echo ""