This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·634 lines (469 loc) · 12.6 KB
/
install.sh
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
#!/bin/sh
######################################################
# installation script - now greatly improved
# by default installs and runs everything
# except mcfm
#
# has control flags to allow any combination
# of jobs to be done.
#
# APPLGRID - install appl_grid
# PDF - install hoppet
# MCFM - install mcfm
# MCFM60 - install mcfm 6.0
# RMCFM - run mcfm
# RMCFM60 - run mcfm 6.0
# NLO - install nlojet
# NLOMOD - instal nlojet module
# RNLOMOD - run nlojet module
#
# To do a single job,
# diasble everything with --none, ie
#
# install.sh --none --appl
#
######################################################
ARGS=$*
###############################################
# setup everything
###############################################
if [ "$BASEDIR" = "" ]; then
export BASEDIR=$PWD
fi
export INSTALLBASE=$BASEDIR
# control flags
APPLGRID=1
PDF=1
MCFM=0
MCFM60=1
RMCFM=0
RMCFM60=0
NLO=1
NLOMOD=1
RNLOMOD=1
FASTJET=1
USERJ=1
# echo "setting everything"
setall() {
APPLGRID=1
PDF=1
MCFM=1
MCFM60=1
RMCFM=1
RMCFM60=1
NLO=1
NLOMOD=1
RNLOMOD=1
FASTJET=1
USERJ=1
}
# echo "unsetting everything"
unsetall() {
APPLGRID=0
PDF=0
MCFM=0
MCFM60=0
RMCFM=0
RMCFM60=0
NLO=0
NLOMOD=0
RNLOMOD=0
FASTJET=0
USERJ=0
}
# echo "setting everything"
printflags() {
echo "APPLGRID $APPLGRID"
echo "PDF $PDF"
echo "MCFM $MCFM"
echo "MCFM60 $MCFM60"
echo "RMCFM $RMCFM"
echo "RMCFM60 $RMCFM60"
echo "NLO $NLO"
echo "NLOMOD $NLOMOD"
echo "RNLOMOD $RNLOMOD"
echo "FASTJET $FASTJET"
echo "USERJ $USERJ"
}
# usage message
usage() {
echo "usage: install.sh [OPTIONS]\n"
echo " --help| -h this help"
echo
echo " --all|-a do everything"
echo " --none|-n don't do anything"
echo " --appl install appl_grid"
echo " --pdf|--hoppet install hoppet"
echo " --mcfm install mcfm"
echo " --mcfm60 install mcfm v6.0"
echo " --nlo install nlojet"
echo " --mod install nlojet module"
echo
echo " --runmcfm run mcfm"
echo " --runmcfm60 run mcfm v6.0"
echo " --runmod run nlojet module"
echo
echo " --user build and run simple user example"
echo " --fastjet build fastjet"
echo
echo " --prefix=<directory> set the installation directory"
echo
echo "\nReport bugs to <sutt@cern.ch>"
# exit
}
# set the installation diectory if required
prefix() {
export INSTALLBASE=`echo $PREFIX | sed "s#--prefix=##"`
# echo installing in $INSTALLBASE
}
###############################################
# parse arguments and set control flags
###############################################
for WORD in $ARGS ; do
case $WORD in
--all|-a) setall;;
--none|-n) unsetall;;
--appl) APPLGRID=1;;
--pdf|--hoppet) PDF=1;;
--mcfm) MCFM=1;;
--mcfm60) MCFM60=1;;
--runmcfm) RMCFM=1;;
--runmcfm60) RMCFM60=1;;
--nlo) NLO=1;;
--mod) NLOMOD=1;;
--runmod) RNLOMOD=1;;
--user) USERJ=1;;
--fastjet) FASTJET=1;;
--prefix=*) PREFIX=$WORD;prefix;;
--help|-h) usage;exit;;
*) usage;exit;;
esac
done
echo "base directory " $BASEDIR
if [ -e $INSTALLBASE ]; then
echo "installing in $INSTALLBASE"
else
echo "$INSTALLBASE does not exist"
exit
fi
cd $BASEDIR
export PATH=$INSTALLBASE/bin:$BASEDIR/bin:$PATH
ROOTFOUND=`which root-config`
if [ "$ROOTFOUND" = "" ]; then
echo "root not setup"
exit
fi
LHAPDFFOUND=`which lhapdf-config`
if [ "$LHAPDFFOUND" = "" ]; then
echo "lhapdf not setup"
exit
fi
# use root-config to decide what architecture root libraries will be used
# export ARCH=`rootarch.sh`
export ARCH=`root-config --ldflags`
export SYSARCH=`setarch.sh`
export CXXFLAGS=$ARCH
export F90FLAGS=$ARCH
export F77FLAGS=$ARCH
export CFLAGS=$ARCH
export FC=gfortran
# export FFLAGS="$ARCH -O"
export FFLAGS=$ARCH
export LDFLAGS=$ARCH
export HOPPETLIBS=
export HOPPETINCS=
export HOPPETFLAG=
export FASTJETLIBS=
export FASTJETINCS=
export FASTJETFLAG=
export ROOTSYS=`root-config --prefix`
export LHAPDFLIB=`lhapdf-config --prefix`/lib
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$INSTALLBASE/lib:$INSTALLBASE/libexec:$LHAPDFLIB:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$INSTALLBASE/lib:$INSTALLBASE/libexec:$LHAPDFLIB:$DYLD_LIBRARY_PATH
############################
# INSTALL THE APPL GRID CODE
############################
install_appl_grid() {
cd $BASEDIR/appl_grid
./configure --prefix=$INSTALLBASE
# if [ "$1" = "clean" ]; then
# make clean
# fi
make clean
autoreconf -i
make
make install
hash -r
}
############################
# INSTALL EVOLUTION CODE
############################
install_pdf() {
cd $BASEDIR/hoppet
if [ -e $BASEDIR/hoppet/benchmarking/benchmark.f90 ]; then
rm $BASEDIR/hoppet/benchmarking/benchmark.f90
fi
if [ "$1" = "clean" ]; then
make clean
fi
./configure --prefix=$INSTALLBASE FC=$FC FFLAGS=" -fPIC $FFLAGS" LDFLAGS="$LDFLAGS"
make
# make check
make install
hash -r
# cd $BASEDIR/pdf-conv-1.0/src
#
# if [ "$1" = "clean" ]; then
# make clean
# fi
#
# make install
}
######################
# INSTALL MCFM
######################
install_mcfm() {
cd $BASEDIR
cd $BASEDIR/mcfm
make install
}
install_mcfm60() {
cd $BASEDIR
cd $BASEDIR/mcfm-6.0
make install
# should no longer be needed by lhapdf. hmmmm
cd Bin
if [ -e PDFsets ]; then
ls -ld PDFsets
else
ln -s `lhapdf-config --pdfsets-path` .
ls -ld PDFsets
fi
}
############################################
# RUN THE MCFM TEST EXECUTABLE
###########################cd ..#################
run_mcfm() {
if [ -d $BASEDIR/mcfm/run ]; then
cd $BASEDIR/mcfm/run
rm -f *.log
# should no longer be needed by lhapdf. hmmmm
if [ -e PDFsets ]; then
ls -ld PDFsets
else
ln -s `lhapdf-config --pdfsets-path` .
ls -ld PDFsets
fi
echo "running mcfm - please wait ..."
if [ -e ../exe/$SYSARCH/mcfm ]; then
rm -rf W_*
#### Wminus test executable ####
# ../exe/$SYSARCH/mcfm WMinput.DAT >& mcfm-wm0.log
# ../exe/$SYSARCH/mcfm WMinput.DAT >& mcfm-wm1.log
# ../exe/$SYSARCH/stand grid-30-Wminus_eta4.root
# mv fout.root fout-Wminus.root
rm -rf W_*
# #### Wplus test executable ####
../exe/$SYSARCH/mcfm WPinput.DAT >& mcfm-wp0.log
../exe/$SYSARCH/mcfm WPinput.DAT >& mcfm-wp1.log
../exe/$SYSARCH/stand grid-30-Wplus_eta4.root
mv fout.root fout-Wplus.root
cd ..
fi
fi
}
run_mcfm60() {
if [ -d $BASEDIR/mcfm-6.0/Bin ]; then
cd $BASEDIR/mcfm-6.0/Bin
rm -f *.log
# should no longer be needed by lhapdf. hmmmm
if [ -e PDFsets ]; then
ls -ld PDFsets
else
ln -s `lhapdf-config --pdfsets-path` .
ls -ld PDFsets
fi
echo "running mcfm - please wait ..."
if [ -e mcfm ]; then
rm -rf W_*
# #### Wplus test executable ####
mcfm winput.DAT >& mcfm.log
mcfm winput.DAT >& mcfm.log
stand grid-30-Wplus_eta4.root
mv fout.root fout-Wplus.root
cd ..
fi
fi
}
install_nlojet() {
#############################
# INSTALL NLOJET PDF LIBRARY
#############################
cd $BASEDIR
echo "bld-pdf"
if [ "$1" = "clean" ]; then
rm -rf bld-pdf
fi
if [ "$1" = "nloclean" ]; then
rm -rf bld-pdf
fi
if [ -e bld-pdf ]; then
echo "bld-pdf already exists"
else
mkdir bld-pdf
if [ "$1" = "clean" ]; then
make clean
fi
cd bld-pdf
../lhpdf-1.0.0/configure --prefix=$INSTALLBASE
make
make install
fi
hash -r
######################
# INSTALL NLOJET
######################
cd $BASEDIR
echo "bld-nlo"
if [ -e bld-nlo ]; then
echo "bld-nlo already exists"
else
mkdir bld-nlo
cd bld-nlo
echo "nlojet"
../nlojet++-4.0.1/configure --prefix=$INSTALLBASE
if [ "$1" = "clean" ]; then
make clean
fi
make
make install
fi
hash -r
echo $PATH
echo "which create-nlojet-user"
# which create-nlojet-user
}
######################################
# INSTALL NLOJET GRID FILLING MODULES
######################################
install_nlojet_module() {
echo "jetmod"
if [ -e $BASEDIR/jetmod ]; then
echo "cd jetmod"
cd $BASEDIR/jetmod
else
echo "$BASEDIR/jetmod doesn't exist"
exit
fi
echo "building fillgrid..."
if [ "$1" = "clean" ]; then
make clean
fi
make install
hash -r
echo PATH is: $PATH
echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH
# recent LHAPDF should no longer need this
if [ -e PDFsets ]; then
ls -ld PDFsets
else
ln -s `lhapdf-config --pdfsets-path` .
ls -ld PDFsets
fi
}
##################################
# RUN NLOJET GRID FILLING MODULES
##################################
run_nlojet_module () {
cd $BASEDIR/jetmod
if [ -e output/weight_c.root ]; then
echo "nlojet already executed"
else
which nlojet++
# nlojet++ --calculate -u fillgrid.la --max-event 20000
# generate the grid phase space
nlojet++ --calculate -c full -u fillgrid.la --max-event 1000010
# now optimise it and generate the weights properly
nlojet++ --calculate -c full -u fillgrid.la --max-event 1000010
fi
if [ -e output/weight_c.root ]; then
# ./standalone output/weight_c.root
./stand output/weight_c.root
else
echo "nlojet grid code did not complete correctly"
fi
}
run_user () {
cd $BASEDIR/user
if [ "$1" = "clean" ]; then
make clean
fi
make all
echo "\nrunning executables..."
if [ -e ../jetmod/output/weight_c.root ]; then
./stand ../jetmod/output/weight_c.root
else
echo "weight file not found (../jetmod/output/weight_c.root)"
echo "have you already run nlojet++ ?"
fi
if [ -e fnl0004.tab ]; then
./fnlo fnl0004.tab
else
echo "fastnlo grid file (fnl0004.tab) missing"
fi
}
install_fastjet () {
cd $BASEDIR
if [ -e "$BASEDIR/fastjet-*" ]; then
echo "fastjet already installed"
else
FASTJETVER=`wget --quiet http://www.lpthe.jussieu.fr/~salam/fastjet/version.html -O - | grep '^[0-9]' -`
curl http://www.lpthe.jussieu.fr/~salam/fastjet/repo/fastjet-$FASTJETVER.tar.gz > /tmp/fastjet-$FASTJETVER.tar.gz
tar -xzf /tmp/fastjet-$FASTJETVER.tar.gz
if [ -e "$BASEDIR/fastjet-$FASTJETVER" ]; then
cd $BASEDIR/fastjet-$FASTJETVER
./configure --prefix=$INSTALLBASE FC=$FC CXXFLAGS="$CXXFLAGS" FFLAGS="$FFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
if [ "$1" = "clean" ]; then
make clean
fi
make install
fi
fi
}
###########################
# ACTUALLY RUN THE STAGES
###########################
hash -r
printflags
if [ "$PDF" = 1 ]; then install_pdf $ARGS; fi
if [ -e $INSTALLBASE/bin/hoppet-config ]; then
export HOPPETLIBS="` $INSTALLBASE/bin/hoppet-config --libs `"
export HOPPETINCS="` $INSTALLBASE/bin/hoppet-config --cxxflags `"
export HOPPETFLAG=" -DHOPPET "
fi
if [ "$APPLGRID" = 1 ]; then install_appl_grid $ARGS; fi
if [ "$MCFM" = 1 ]; then install_mcfm $ARGS; fi
if [ "$MCFM60" = 1 ]; then install_mcfm60 $ARGS; fi
if [ "$RMCFM" = 1 ]; then run_mcfm; fi
if [ "$RMCFM60" = 1 ]; then run_mcfm60; fi
if [ "$NLO" = 1 ]; then install_nlojet $ARGS; fi
FASTJETFOUND=`which fastjet-config`
if [ "$FASTJETFOUND" = "" ]; then
if [ "$FASTJET" = 1 ]; then install_fastjet $ARGS; fi
if [ -e $INSTALLBASE/bin/fastjet-config ]; then
export FASTJETLIBS="` $INSTALLBASE/bin/fastjet-config --libs `"
export FASTJETINCS="` $INSTALLBASE/bin/fastjet-config --cxxflags `"
export FASTJETFLAG=" -DFASTJET "
fi
else
if [ -e $INSTALLBASE/bin/fastjet-config ]; then
export FASTJETLIBS="` fastjet-config --libs `"
export FASTJETINCS="` fastjet-config --cxxflags `"
export FASTJETFLAG=" -DFASTJET "
fi
fi
if [ "$NLOMOD" = 1 ]; then install_nlojet_module $ARGS; fi
if [ "$RNLOMOD" = 1 ]; then run_nlojet_module; fi
if [ "$USERJ" = 1 ]; then run_user $ARGS; fi