-
Notifications
You must be signed in to change notification settings - Fork 1
/
genie_edep.3_04_00.20230606.def
142 lines (114 loc) · 4.92 KB
/
genie_edep.3_04_00.20230606.def
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
Bootstrap: localimage
From: images/root_v6.14.06_pythia6.sif
%files
%post
## Update the compiler
set -e
source scl_source enable devtoolset-7 || true
## Needed for G4:
yum -y install xerces-c xerces-c-devel
## This should be set as desired!
export NCORES=7
## Set up paths for things already in the container
export GEN_DIR=/opt/generators
export ROOTSYS=/opt/generators/root/install
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:/usr/lib64:$LD_LIBRARY_PATH
export PYTHONPATH=${ROOTSYS}/lib:${PYTHONPATH}
## Now LHAPDF (old version)
mkdir ${GEN_DIR}/LHAPDF
cd ${GEN_DIR}/LHAPDF
wget https://lhapdf.hepforge.org/downloads/old/lhapdf-5.9.1.tar.gz
tar xzf lhapdf-5.9.1.tar.gz
rm lhapdf-5.9.1.tar.gz
mkdir lhapdf-5.9.1_build
cd lhapdf-5.9.1
./configure --prefix=${PWD}/../lhapdf-5.9.1_build
make -j ${NCORES} && make install
## Get the GENIE code
## NOTE Make sure that the %environment section has the right GENIE_VERSION!
export GENIE_VERSION=R-3_04_00
mkdir -p ${GEN_DIR}/GENIE
git clone -b ${GENIE_VERSION} https://github.com/GENIE-MC/Generator.git ${GEN_DIR}/GENIE/${GENIE_VERSION}
export GENIE=${GEN_DIR}/GENIE/${GENIE_VERSION}
cd ${GENIE}
sed -i 's/g77/gfortran/g' src/make/Make.include
export LHAPATH=${GEN_DIR}/LHAPDF/lhapdf-5.9.1_build/include/LHAPDF
export PYTHIA6=${GEN_DIR}/root/lib
export GSL_LIB=/usr/lib64
export GSL_INC=/usr/include
export LHAPDF_INC=${GEN_DIR}/LHAPDF/lhapdf-5.9.1_build/include
export LHAPDF_LIB=${GEN_DIR}/LHAPDF/lhapdf-5.9.1_build/lib
export LIBXML2_INC=/usr/include/libxml2
export LIBXML2_LIB=/usr/lib64
## Need to copy a file from GENIE into LHAPDF... pretty mad!
cp ${GENIE}/data/evgen/pdfs/GRV98lo_patched.LHgrid ${LHAPATH}/.
## Configure GENIE
./configure --enable-fnal \
--with-pythia6-lib=${PYTHIA6} \
--with-lhapdf-inc=$LHAPDF_INC \
--with-lhapdf-lib=$LHAPDF_LIB \
--with-libxml2-inc=$LIBXML2_INC \
--with-libxml2-lib=$LIBXML2_LIB
make -j ${NCORES}
make install
export PATH=$GENIE/bin:${PATH}
export LD_LIBRARY_PATH=$LIBXML2_LIB:$LHAPDF_LIB:$PYTHIA6:$GENIE/lib:$LD_LIBRARY_PATH
## Shut GENIE up when it runs
cp ${GENIE}/config/Messenger_whisper.xml ${GENIE}/config/Messenger.xml
## Have to mess around with the file to actually shut it up though...
sed -i '$ d' ${GENIE}/config/Messenger.xml
echo ' <priority msgstream="ResonanceDecay"> FATAL </priority>' >> ${GENIE}/config/Messenger.xml
echo ' <priority msgstream="Pythia6Decay"> FATAL </priority>' >> ${GENIE}/config/Messenger.xml
echo ' <priority msgstream="INukeNucleonCorr"> FATAL </priority>' >> ${GENIE}/config/Messenger.xml
echo ' <priority msgstream="gevgen_fnal"> FATAL </priority>' >> ${GENIE}/config/Messenger.xml
echo '</messenger_config>' >> ${GENIE}/config/Messenger.xml
## Get DK2NU sorted
cd ${GEN_DIR}
git clone https://github.com/NuSoftHEP/dk2nu.git
export DK2NU=${GEN_DIR}/dk2nu
export LIBXML2INC=/usr/include/libxml2
cd ${DK2NU}
make all
## Get the G4 source code
cd ${GEN_DIR}
git clone -b v10.7.2 https://github.com/Geant4/geant4.git geant4
mkdir geant4/install geant4/build
cd geant4/build
cmake -DCMAKE_INSTALL_PREFIX=../install \
-DGEANT4_INSTALL_DATA=ON \
-DGEANT4_USE_GDML=ON ../
make -j${NCORES} && make install
source ${GEN_DIR}/geant4/install/bin/geant4.sh
## Now edep-sim, use a fork with some specific changes in
cd ${GEN_DIR}
git clone https://github.com/lbl-neutrino/edep-sim.git
cd edep-sim
git checkout a0c0af5cabe0b05012ed495b9113563d34d8d4cd
# ^ doesn't support <arb8> (G4GenericTrap, TGeoArb8)
cd ${GEN_DIR}/edep-sim/build
mkdir ../install
cmake -DCMAKE_INSTALL_PREFIX=../install ../
make -j${NCORES} && make install
%environment
source scl_source enable devtoolset-7
export GEN_DIR=/opt/generators
export GENIE=${GEN_DIR}/GENIE/R-3_04_00
export LHAPATH=${GEN_DIR}/LHAPDF/lhapdf-5.9.1_build/include/LHAPDF
export PYTHIA6=${GEN_DIR}/root/lib
export GSL_LIB=/usr/lib64
export GSL_INC=/usr/include
export LHAPDF_INC=${GEN_DIR}/LHAPDF/lhapdf-5.9.1_build/include
export LHAPDF_LIB=${GEN_DIR}/LHAPDF/lhapdf-5.9.1_build/lib
export LIBXML2_INC=/usr/include/libxml2
export LIBXML2_LIB=/usr/lib64
export PATH=$GENIE/bin:$PATH
export LD_LIBRARY_PATH=$LIBXML2_LIB:$LHAPDF_LIB:$PYTHIA6:$GENIE/lib:$LD_LIBRARY_PATH
export GXMLPATH=${GENIE}/genie_xsec
export DK2NU=${GEN_DIR}/dk2nu
export LD_LIBRARY_PATH=${DK2NU}/lib:${LD_LIBRARY_PATH}
## Use G4's script because it sets so many variables
cd ${GEN_DIR}/geant4/install/bin; source geant4.sh; cd -
export EDEPSIM=${GEN_DIR}/edep-sim/install
export PATH=${EDEPSIM}/bin:${PATH}
export LD_LIBRARY_PATH=${EDEPSIM}/lib:${LD_LIBRARY_PATH}