-
Notifications
You must be signed in to change notification settings - Fork 9
/
install_standalone.sh
143 lines (124 loc) · 4.57 KB
/
install_standalone.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
#!/bin/bash
# set STANDALONE_INSTALL_DIR="your_complete_installation_path", e.g.:
export STANDALONE_INSTALL_DIR="your_installation_path"
# -----------------------------------------------
echo "installing in $STANDALONE_INSTALL_DIR"
cd $STANDALONE_INSTALL_DIR
mkdir -p build
# -------------------
# SIMULATION
echo "compile simulation"
cd $STANDALONE_INSTALL_DIR/IDEADetectorSIM/simulation/
# set the right PRJBASE in simulation/env.sh
string1="export PRJBASE=path_to_prjbase"
string2="export PRJBASE=\"$STANDALONE_INSTALL_DIR/IDEADetectorSIM\""
sed "s|$string1|$string2|g" ./env.sh_init > env.sh
### ### ### ### ### ### ### ### ###
### only for emergency: this is to run with a specific release of key4hep stack
# string1="source /cvmfs/sw.hsf.org/key4hep/setup.sh"
# string2="source $STANDALONE_INSTALL_DIR/IDEADetectorSIM/key4hep_setup.sh"
# sed -i "s|$string1|$string2|g" ./env.sh
### ### ### ### ### ### ### ### ##
source ./env.sh
mkdir build $SIM_INSTAL_DIR $SIM_OUTPUT_DIR
# compile
cd $STANDALONE_INSTALL_DIR/IDEADetectorSIM/simulation/build/
cmake -DCMAKE_INSTALL_PREFIX=$SIM_INSTAL_DIR -DCMAKE_CXX_FLAGS="-DMT_OFF" ../g4GMC
make
make install
cd $STANDALONE_INSTALL_DIR
# -------------------
# INSTALL EXTERNAL CODE LOCALLY
mkdir -p LOCAL LOCAL/ROME
echo ""
echo ""
echo ""
# -------------------
# GENFIT
echo "setup genfit"
for path in ${CMAKE_PREFIX_PATH//:/ }; do
if grep -q 'genfit' <<< "$path" ; then
export GENFIT=$path
fi
done
echo "GENFIT set to " $GENFIT
cd $STANDALONE_INSTALL_DIR
echo ""
echo ""
echo ""
# -------------------
# ROME
cd $STANDALONE_INSTALL_DIR/LOCAL/ROME
echo "download the ROME release"
git clone https://bitbucket.org/muegamma/rome3.git rome
cd $STANDALONE_INSTALL_DIR/LOCAL/ROME/rome
git checkout master
#git tag
#git checkout v3.2.15.1
export ROMESYS=$STANDALONE_INSTALL_DIR/LOCAL/ROME/rome
export PATH=$ROMESYS/bin:$PATH
cd $ROMESYS
make
ln -s $ROMESYS/src/strlcpy.cxx $ROMESYS/src/strlcpy.c
cd $STANDALONE_INSTALL_DIR
echo ""
echo ""
echo ""
# -------------------
# ANALYZER
cd $STANDALONE_INSTALL_DIR/IDEADetectorSIM/analyzer/
# set the right PRJBASE in analyzer/envGMC.sh
string1="export PRJBASE=path_to_prjbase"
string2="export PRJBASE=\"$STANDALONE_INSTALL_DIR/IDEADetectorSIM\""
sed "s|$string1|$string2|g" ./envGMC.sh_init > envGMC.sh
# set the right GENFIT2SYS in analyzer/envGMC.sh
string1="export GENFIT2SYS=path_to_genfit2"
string2="export GENFIT2SYS=$GENFIT"
sed -i "s|$string1|$string2|g" ./envGMC.sh
# set the right ROOTSYS in analyzer/envGMC.sh
string1="export ROOTSYS=path_to_root"
string2="export ROOTSYS=$ROOTSYS"
sed -i "s|$string1|$string2|g" ./envGMC.sh
# set the right ROMESYS in analyzer/envGMC.sh
string1="export ROMESYS=path_to_rome"
string2="export ROMESYS=$ROMESYS"
sed -i "s|$string1|$string2|g" ./envGMC.sh
#
source ./envGMC.sh
echo "compile analyzer"
cd $STANDALONE_INSTALL_DIR/IDEADetectorSIM/analyzer/GMC
$ROMESYS/bin/romebuilder.exe -i GMC.xml
#### Getting the gdml file from the ideadr box
wget https://cernbox.cern.ch/index.php/s/KxGYRFnkcob09z1/download -O g4-IDEA_reco.gdml
# set the right PATH in the xml files
string1="<SPValue>path_to_simulation</SPValue>"
string2="<SPValue>$STANDALONE_INSTALL_DIR/IDEADetectorSIM/simulation/g4GMC/config</SPValue>"
sed "s|$string1|$string2|g" ./geant4MC-IDEA.xml_init > geant4MC-IDEA.xml
sed "s|$string1|$string2|g" ./geant4MC-IDEA-fit.xml_init > geant4MC-IDEA-fit.xml
ln -s $STANDALONE_INSTALL_DIR/IDEADetectorSIM/analyzer/GMC/geant4MC-IDEA.xml $STANDALONE_INSTALL_DIR/build
ln -s $STANDALONE_INSTALL_DIR/IDEADetectorSIM/analyzer/GMC/geant4MC-IDEA-fit.xml $STANDALONE_INSTALL_DIR/build
ln -s $STANDALONE_INSTALL_DIR/IDEADetectorSIM/analyzer/GMC/g4-IDEA_reco.gdml $STANDALONE_INSTALL_DIR/build
ln -s $STANDALONE_INSTALL_DIR/IDEADetectorSIM/analyzer/GMC/gmcanalyzer.exe $STANDALONE_INSTALL_DIR/build
cd $STANDALONE_INSTALL_DIR
########## Compile tools for calorimeter
mkdir -p build/AnalysisTools
cd build/AnalysisTools
cmake -DCMAKE_INSTALL_PREFIX=$STANDALONE_INSTALL_DIR/build $STANDALONE_INSTALL_DIR/IDEADetectorSIM/DRCalo/Analysis/AnalysisTools
make
make install
##### checkout SiPM digitization package
cd $STANDALONE_INSTALL_DIR
mkdir -p build/DRCalo_DRDigitization
cd build/DRCalo_DRDigitization
cmake -DCMAKE_INSTALL_PREFIX=$STANDALONE_INSTALL_DIR/build $STANDALONE_INSTALL_DIR/IDEADetectorSIM/DRCalo/Digitization/DRDigitization
make
make install
# -------------------
# CONVERTER
echo "compile converter"
cd $STANDALONE_INSTALL_DIR/IDEADetectorSIM/converter
cmake -DCMAKE_INSTALL_PREFIX=$STANDALONE_INSTALL_DIR/build .
make
make install
cd $STANDALONE_INSTALL_DIR
echo "finished installation in $STANDALONE_INSTALL_DIR"