-
Notifications
You must be signed in to change notification settings - Fork 3
/
env.sh
executable file
·87 lines (80 loc) · 2.46 KB
/
env.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
#!/bin/bash
if [ $# -ne 1 ] ; then
echo "Usage: ./env.sh env_name"
echo " env_name = { bbtt | hh | lcg }"
exit 1
fi
if ! [ -z ${ENV_NAME+x} ] ; then
echo "Another environment is already loaded. Please, exit from the current environment first."
exit 2
fi
function run_cmd {
"$@"
RESULT=$?
if [ $RESULT -ne 0 ] ; then
echo "Error while rinning '$@'"
exit 1
fi
}
function run_source {
echo $1
source setup.sh
RESULT=$?
if [ $RESULT -ne 0 ] ; then
echo "Error while rinning 'source setup.sh'"
exit 1
fi
}
export ENV_NAME=$1
if [ $# -ge 3 ] ; then
ENV_VARIANT=$2
else
ENV_VARIANT=base
fi
if [ $ENV_NAME = "bbtt" ] ; then
cmssw_ver=CMSSW_10_2_13
if ! [ -f $cmssw_ver/src/.installed ] ; then
echo "Installing an environment for the bbtt shape createion..."
export SCRAM_ARCH=slc7_amd64_gcc700
scram project CMSSW $cmssw_ver
run_cmd cd $cmssw_ver/src
run_cmd eval `scramv1 runtime -sh`
run_cmd git clone https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit.git HiggsAnalysis/CombinedLimit
run_cmd cd HiggsAnalysis/CombinedLimit
run_cmd git checkout v8.2.0
run_cmd cd ../..
run_cmd git clone https://github.com/cms-analysis/CombineHarvester.git CombineHarvester
run_cmd scram b -j4
run_cmd touch .installed
else
echo "Loading an environment for the bbtt shape createion..."
run_cmd cd $cmssw_ver/src
run_cmd eval `scramv1 runtime -sh`
fi
run_cmd ulimit -s unlimited
run_cmd cd ../..
export PYTHONPATH=$PWD/$PYTHONPATH
elif [ $ENV_NAME = "hh" ] ; then
if ! [ -f inference/.installed ] ; then
echo "Installing an environment for the HH statistical inference..."
run_cmd git clone --recursive ssh://[email protected]:7999/hh/tools/inference.git
run_cmd cd inference
run_source $ENV_VARIANT
run_cmd touch .installed
else
echo "Loading an environment for the HH statistical inference..."
run_cmd cd inference
run_source $ENV_VARIANT
fi
run_cmd cd ..
elif [ $ENV_NAME = "lcg" ] ; then
source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_99 x86_64-centos7-gcc10-opt
else
echo "Unknown environment '$ENV_NAME'. Supported environments: bbtt hh"
exit 3
fi
if [ $SHELL = "/bin/zsh" ] ; then
echo "Starting new $SHELL ..."
$SHELL
echo "Back to the original environment."
fi