forked from jalmond/LQanalyzer
/
setup.sh
executable file
·147 lines (118 loc) · 5.16 KB
/
setup.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
#! /bin/sh
# $Id: setup.sh 1 01/12/2013 jalmond $
###################################################################################
# @Project: LQAnalyzer/SKTree - ROOT-based analysis framework for Korea CMS group #
# #
# @author John Almond <jalmond@cern.ch> - SNU #
# #
# Script that has to be sourced before compiling/running SFrame. #
# #
##################################################################################
# Greet the user
echo "Setting up environment for compiling/running LQAnalzer with SKTree"
if [ $LQANALYZER_DIR ]; then
echo LQANALYZER_DIR is already defined, use a clean shell
return 1
fi
## variables that are specific to your machine: Change if noy listed
if [ "$HOSTNAME" = "cms2.snu.ac.kr" ] || [ "$HOSTNAME" = "cms1.snu.ac.kr" ]; then
export root_setup="/usr/local/bin/thisroot.sh"
else
export root_setup=$HOME"/root/root/bin/thisroot.sh"
fi
# speficy the LQANALYZER_DIR base directory, i.e., the directory in which this file lives
export LQANALYZER_DIR=${PWD}
export LQANALYZER_FILE_DIR="/data1/LQAnalyzer_rootfiles_for_analysis/Dec14/"
# Modify to describe your directory structure.
# all directories are below the LQAnalyser base directory specified above
### setup paths to be used in analysis code
export LQANALYZER_ANALYSIS_PATH=${LQANALYZER_DIR}/LQAnalysis/
export LQANALYZER_SRC_PATH=${LQANALYZER_DIR}/LQAnalysis/src/
export LQANALYZER_INCLUDE_PATH=${LQANALYZER_DIR}/LQAnalysis/include/
export LQANALYZER_CORE_PATH=${LQANALYZER_DIR}/LQCore/
if [[ "$HOSTNAME" == "cms1" ]]
then
export OBJ=obj/slc6_cms1
export LQANALYZER_LIB_PATH=${LQANALYZER_DIR}/LQLib/slc6_cms1
elif [[ "$HOSTNAME" == "cms5" || "$HOSTNAME" == "cms6" ]]
then
export OBJ=obj/slc6
export LQANALYZER_LIB_PATH=${LQANALYZER_DIR}/LQLib/slc6/
elif [[ "$HOSTNAME" == "cms3" ]]
then
export OBJ=obj/slc5_cms3
export LQANALYZER_LIB_PATH=${LQANALYZER_DIR}/LQLib/slc5_cms3/
else
export OBJ=obj/slc5
export LQANALYZER_LIB_PATH=${LQANALYZER_DIR}/LQLib/slc5/
fi
export LQANALYZER_OLDLIB_PATH=${LQANALYZER_DIR}/LQLib/
export LQANALYZER_RUN_PATH=${LQANALYZER_DIR}/LQRun/
export LQANALYZER_BIN_PATH=${LQANALYZER_DIR}/bin/
### set SKTree path
export SKTREE_INCLUDE_PATH=${LQANALYZER_DIR}/LQCore/SKTree/include/
## setup directory to store analysis rootfiles
export FILEDIR=${LQANALYZER_DIR}/data/rootfiles/
if [ ! -d ${LQANALYZER_OLDLIB_PATH} ]; then
echo Directory ${LQANALYZER_OLDLIB_PATH} does not exist ... creating it
mkdir ${LQANALYZER_OLDLIB_PATH}
fi
if [ ! -d ${LQANALYZER_LIB_PATH} ]; then
echo Directory ${LQANALYZER_LIB_PATH} does not exist ... creating it
mkdir ${LQANALYZER_LIB_PATH}
file="${LQANALYZER_OLDLIB_PATH}/libAnalysisCore.so"
if [ -f "$file" ]; then
echo Old lib dir ${LQANALYZER_OLDLIB_PATH} is redundant. Will remove these library
rm ${LQANALYZER_OLDLIB_PATH}/*.so
rm ${LQANALYZER_OLDLIB_PATH}/*map
rm ${LQANALYZER_CORE_PATH}/*/obj/*.o
rm -r ${LQANALYZER_CORE_PATH}/*/obj/dep/
rm ${LQANALYZER_ANALYSIS_PATH}/*/obj/*.o
rm -r ${LQANALYZER_ANALYSIS_PATH}/*/obj/dep/
fi
fi
### Load useful functions
source ${LQANALYZER_BIN_PATH}/cleanup.sh
### make directories that git does not allow to store
python ${LQANALYZER_BIN_PATH}/SetUpWorkSpace.py
export LQANALYZER_OUTPUT_PATH=${LQANALYZER_DIR}/data/output/
export LQANALYZER_LOG_PATH=${LQANALYZER_DIR}/data/logfiles/
# Setup root area and other paths
if [[ `which root-config` == "" ]]; then
echo "Warning: ROOT environment doesn't seem to be configured!"
source $root_setup
if [[ `which root-config` == "" ]]; then
echo "Error: ROOT environment cannot be configured!"
else echo "Setup root enviroment "
fi
fi
if [ -z ${ROOTSYS} ] ; then
echo "Warning: ROOT environment doesn't seem to be configured!"
echo "Add these lines to your ~/.bashrc file to remove this warning in future."
echo ""
echo "source /usr/local/bin/thisroot.sh"
echo ""
export ROOTSYS=/usr/local
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib/root:
if [ -z ${ROOTSYS} ] ; then
echo "Error: ROOT environment cannot be configured!"
else echo "Setup root enviroment for user."
fi
fi
if [[ `root-config --platform` == "macosx" ]]; then
# With Fink ROOT installations, DYLD_LIBRARY_PATH doesn't have
# to be defined for ROOT to work. So let's leave the test for it...
export DYLD_LIBRARY_PATH=${LQANALYZER_LIB_PATH}:${DYLD_LIBRARY_PATH}
else
if [ ! $LD_LIBRARY_PATH ]; then
echo "Warning: so far you haven't setup your ROOT enviroment properly (no LD_LIBRARY_PATH): FrameWork will not work"
fi
export LD_LIBRARY_PATH=${LQANALYZER_LIB_PATH}:${LD_LIBRARY_PATH}
fi
export PATH=${LQANALYZER_BIN_PATH}:${PATH}
export PYTHONPATH=${LQANALYZER_DIR}/python:${PYTHONPATH}
export PAR_PATH=./:${LQANALYZER_LIB_PATH}
python bin/local_check.py
echo "Running analysis from" $HOSTNAME " in directory: "
#clean up all emacs tmp files
clean_emacs