-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbutler.in
345 lines (311 loc) · 9.7 KB
/
butler.in
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
#!/bin/sh
# This script is automatically generated from butler.in by configure,
# DO NOT EDIT
pkgroot="@PKGROOT@"
enable_calchep="@enable_calchep@"
enable_micromegas="@enable_micromegas@"
enable_spheno="@enable_spheno@"
enable_whizard="@enable_whizard@"
enable_higgsbounds="@enable_higgsbounds@"
enable_ssp="@enable_ssp@"
enable_madgraph="@enable_madgraph@"
include_calchep=True
include_spheno=True
include_whizard=True
include_madgraph=True
MATH=@MATH@
separator="==============================================================================="
usage() {
test -n "$1" && echo $1
cat <<EOI
usage: butler [options] model
valid options are:
--help, -h : this help scree
--config : just show package configuration and exit
--skip-package : skip a package, where package is one of
spheno , calchep , micromegas , whizard ,
madgraph , ssp
--skip-sarah : skip the SARAH run and use an existing result
--yes : Assume that the answer to simple yes/no questions is 'yes'
EOI
exit
}
config() {
cat <<EOI
$separator
@PACKAGE_STRING@
$separator
Package configuration:
$separator
SARAH : yes
SARAH scan and plot (SSP) : $enable_ssp
SPHENO : $enable_spheno
CalcHEP : $enable_calchep
MicrOMEGAs : $enable_micromegas
WHIZARD : $enable_whizard
MadGraoh : $enable_madgraph
HiggsBounds : $enable_higgsbounds
package root : $pkgroot
Mathematica kernel : $MATH
Mathematica version : @MATH_VERSION@
$separator
EOI
}
die() {
test -n "$1" && echo $1
exit 1
}
ask() {
(
askval=""
first=""
while test ! "$askval" = yes && test ! "$askval" = no; do
test -n "$first" && echo please answer yes or no
first=1
read askval
done
test "$askval" = yes
)
}
createdir() {
if test "$1" = yes; then
if test -e "$2"; then
test ! -d "$2" && die ERROR: $2 exists and is not a directory
if ! test -n "YES";then
echo WARNING: $2 already exists, remove contents [yes/no]?
ask || "die Refusing to remove already existing directory $2, quitting..."
fi
echo removing contents of $2...
rm -fr "$2" || die
fi
test -n "$3" || mkdir -p "$2" || die
fi
}
model=""
skip_sarah=""
while test -n "$1"; do
case "$1" in
-h|--help)
usage
;;
--config)
config
exit
;;
--skip-spheno)
enable_spheno=no
include_spheno=False
;;
--skip-calchep)
enable_calchep=no
include_calchep=False
;;
--skip-micromegas)
enable_micromegas=no
;;
--skip-whizard)
enable_whizard=no
include_whizard=False
;;
--skip-madgraph)
enable_madgraph=no
include_madgraph=False
;;
--skip-ssp)
enable_ssp=no
;;
--skip-sarah)
skip_sarah=1
;;
--yes)
export YES=YES
;;
*)
if test -z "$model"; then
model="$1"
else
usage "invalid argument \"$1\""
fi
;;
esac
shift
test -n "$model" && test -n "$1" && usage "invalid argument \"$model\""
done
test -z "$model" && usage "ERROR: please supply a model"
if test -z "$skip_sarah"; then
echo running SARAH...
echo $separator
echo
$MATH <<EOI || die
Print["$model"];
<<"SARAH/SARAH.m"
Start["$model"];
SetOptions[MakeAll,IncludeSPheno->$include_spheno, IncludeCalcHep->$include_calchep, IncludeWHIZARD->$include_whizard, IncludeUFO->$include_madgraph];
WriteModelDirectories=True;
MakeAll[];
EOI
echo SARAH run finished
else
echo SARAH run skipped on user request, trying to use an existing result...
fi
test -e "$pkgroot/DirectoryNames.txt" || die \
"ERROR: Something went wrong when running SARAH; please check Mathematica output"
. "$pkgroot/DirectoryNames.txt" || die \
"ERROR: SARAH ran but produced a corrup DirectoryNames.txt --- check Mathematica output"
test -n "$SARAHModelName" && \
(test -d "$SPhenoDir" || test "$enable_spheno" = no) && \
(test -d "$CHepDir" || test "$enable_calchep" = no) && \
(test -d "$UFOdir" || test "$enable_madgraph" = no) && \
(test -d "$WHIZARDdir" || test "$enable_whizard" = no) && \
test -d "$FeynArtsDir" || die \
"ERROR: SARAH ran but produced incomplete output --- check Mathematica output"
spheno_dir="$pkgroot/SPHENO"
spheno_wd="$spheno_dir/$SARAHModelName"
calchep_wd="$pkgroot/calchep/$SARAHModelName"
micromegas_wd="$pkgroot/micromegas/$SARAHModelName"
madgraph_wd="$pkgroot/madgraph/models/$SARAHModelName"
sphenostat="disabled"
calchepstat="disabled"
micromegasstat="disabled"
whizardstat="disabled"
madgraohstat="disabled"
sspstat="disabled"
createdir "$enable_spheno" "$spheno_wd"
createdir "$enable_calchep" "$calchep_wd" 0
createdir "$enable_micromegas" "$micromegas_wd" 0
createdir "$enable_madgraph" "$madgraph_wd" 0
if test "$enable_whizard" = yes; then
whizardmdl=`echo "$WHIZARDdir/whizard/"*mdl | sed 's/.*\///' | sed 's/\.mdl//'`
test -n "$whizardmdl" || die \
"ERROR: SARAH ran, but no WHIZARD model was generated --- check Mathematica output"
if test -e "$pkgroot/whizard/share/whizard/models/$whizardmdl.mdl" && and ! $YES; then
echo "A WHIZARD model called $whizardmdl already exists; overwrite? [yes/no]"
ask || die "Refusing to overwrite existing WHIZARD model $whizardmdl; quitting..."
fi
fi
if test "$enable_ssp" = yes; then
sspsettings="$pkgroot/SSP/DefaultSettings.m.$SARAHModelName"
if test -e "$sspsettings" and ! $YES; then
echo "A SSP configuration $sspsettings already exists; overwrite [yes/no]"
ask || die "Refusing to overwrite existing $sspsettings; quitting..."
fi
fi
if test "$enable_spheno" = "yes"; then
echo
echo "Building SPHENO for $SARAHModelName"
echo $separator
echo
echo copying files...
cp -R "$SPhenoDir"/* "$spheno_wd" || die
echo building SPHENO...
echo
make -C "$spheno_dir" "Model=$spheno_wd" || die
echo
echo "SPHENO for $SARAHModelName built successfully in $spheno_wd"
sphenostat="code and executable located in $spheno_wd"
fi
if test "$enable_calchep" = "yes"; then
echo
echo "Creating a CalcHEP project for $SARAHModelName"
echo $separator
echo
oldpwd=`pwd`
cd "$pkgroot/calchep"
echo creating directory structure...
./mkWORKdir "$SARAHModelName" || die 1
echo copying files...
cp "$CHepDir"/* "$calchep_wd/models" || die 1
cd "$oldpwd"
echo
echo "CalcHEP project for $SARAHModelName created successfully in $calchep_wd"
calchepstat="project located in $calchep_wd"
fi
if test "$enable_madgraph" = "yes"; then
echo
echo "Creating a MadGraph project for $SARAHModelName"
echo $separator
echo
oldpwd=`pwd`
cd "$pkgroot/madgraph/models"
echo creating directory structure...
mkdir "$SARAHModelName" || die 1
echo copying files...
cp "$UFOdir"/* "$madgraph_wd" || die 1
cd "$oldpwd"
echo
echo "MadGraph project for $SARAHModelName created successfully in $madgraph_wd"
madgraphstat="project located in $madgraph_wd"
fi
if test "$enable_micromegas" = yes; then
echo
echo "Creating MicroMEGAs project for $SARAHModelName"
echo $separator
echo
oldpwd=`pwd`
cd "$pkgroot/micromegas"
echo creating directory structury...
./newProject "$SARAHModelName" || die
cd "$oldpwd"
cp "$CHepDir"/* "$micromegas_wd/work/models" || die
cp "$CHepDir"/* "$micromegas_wd/calchep/models" || die
cp "$CHepDir"/CalcOmega* "$micromegas_wd" || die
echo building project...
echo
make -C "$micromegas_wd" main=CalcOmega.cpp || die
echo
echo "MicrOMEGAs project for $SARAHModelName created successfully in $micromegas_wd"
micromegasstat="project located in $micromegas_wd"
fi
if test "$enable_whizard" = yes; then
echo
echo "Compiling WHIZARD model $whizardmdl"
echo $separator
echo
oldpwd=`pwd`
echo running configure...
echo
cd $WHIZARDdir
./configure --prefix="$pkgroot/whizard" WO_CONFIG="$pkgroot/whizard/bin" || die
echo
echo building and installing model
make install || die
cd "$oldpwd"
echo
echo "WHIZARD model $whizardmdl successfully installed"
whizardstat="model installed and available as $whizardmdl"
fi
if test "$enable_ssp" = yes; then
echo
echo "Creating SSP configuration for $SARAHModelName"
echo $separator
echo
echo "Writing $sspsettings..."
cat <<EOI > "$sspsettings" | die
DEFAULT[SPheno] = "$pkgroot/SPHENO/bin/SPheno$SARAHModelName";
DEFAULT[SPhenoInputFile] = "LesHouches.in.$SARAHModelName";
DEFAULT[SPhenoSpectrumFile] = "SPheno.spc.$SARAHModelName";
DEFAULT[MicroOmegas] = "$pkgroot/micromegas/$SARAHModelName/CalcOmega";
DEFAULT[MicroOmegasInputFile] = "SPheno.spc.$SARAHModelName";
DEFAULT[MicroOmegasOutputFile] = "omg.out";
DEFAULT[WHIZARD] = "$pkgroot/whizard/bin/whizard";
DEFAULT[WHIZARDparFile] = "WHIZARD.par.$SARAHModelName";
DEFAULT[HiggsBounds] = "$pkgroot/HiggsBounds/HiggsBounds LandH effC $NumberNeutralHiggs $NumberChargedHiggs";
DEFAULT[HiggsSignals] = "$pkgroot/HiggsSignals/HiggsSignals latestresults peak 2 effC $NumberNeutralHiggs $NumberChargedHiggs";
DEFAULT[MadGraph] = "$pkgroot/madgraph";
DEFAULT[MadGraphModel] = "$SARAHModelName";
EOI
echo
echo "Created SSP configuration $sspsettings"
sspstat="configuration available as $sspsettings"
fi
cat <<EOI
$separator
Summary
$separator
SPHENO : $sphenostat
CalcHEP : $calchepstat
MicrOMEGAs : $micromegasstat
WHIZARD : $whizardstat
MadGraph : $madgraphstat
SSP : $sspstat
EOI