1 |
bortigno |
1.5 |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
#Input argument:
|
4 |
|
|
#sample you want to run on. It has to match the naming in sample.info.
|
5 |
nmohr |
1.1 |
sample=$1
|
6 |
bortigno |
1.5 |
#sqrt(s) you want to run
|
7 |
nmohr |
1.4 |
energy=$2
|
8 |
bortigno |
1.5 |
|
9 |
peller |
1.9 |
task=$3
|
10 |
|
|
|
11 |
|
|
if [ $# -lt 3 ]
|
12 |
bortigno |
1.7 |
then
|
13 |
peller |
1.9 |
echo "ERROR: You passed " $# "arguments while the script needs at least 3 arguments."
|
14 |
bortigno |
1.7 |
echo "Exiting..."
|
15 |
|
|
echo " ---------------------------------- "
|
16 |
peller |
1.9 |
echo " Usage : ./runAll.sh sample energy task"
|
17 |
bortigno |
1.7 |
echo " ---------------------------------- "
|
18 |
|
|
exit
|
19 |
|
|
fi
|
20 |
|
|
|
21 |
bortigno |
1.5 |
#Set the environment for the batch job execution
|
22 |
peller |
1.8 |
|
23 |
|
|
#cd /shome/peller/CMSSW_5_2_4_patch4/src/
|
24 |
|
|
# this doesnt work for me..?
|
25 |
peller |
1.17 |
|
26 |
|
|
#cd $CMSSW_BASE/src/
|
27 |
|
|
#source /swshare/psit3/etc/profile.d/cms_ui_env.sh
|
28 |
|
|
#export SCRAM_ARCH="slc5_amd64_gcc462"
|
29 |
|
|
#source $VO_CMS_SW_DIR/cmsset_default.sh
|
30 |
|
|
#eval `scramv1 runtime -sh`
|
31 |
|
|
#export LD_LIBRARY_PATH=/swshare/glite/d-cache/dcap/lib/:$LD_LIBRARY_PATH
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
#source /swshare/psit3/etc/profile.d/cms_ui_env.sh
|
35 |
nmohr |
1.16 |
export LD_LIBRARY_PATH=/swshare/glite/d-cache/dcap/lib/:$LD_LIBRARY_PATH
|
36 |
peller |
1.17 |
#export SCRAM_ARCH="slc5_amd64_gcc462"
|
37 |
|
|
#source $VO_CMS_SW_DIR/cmsset_default.sh
|
38 |
|
|
#eval `scramv1 runtime -sh`
|
39 |
|
|
source /swshare/ROOT/root_v5.30.01_slc5_amd64/bin/thisroot.sh
|
40 |
peller |
1.15 |
|
41 |
|
|
mkdir $TMPDIR
|
42 |
bortigno |
1.5 |
|
43 |
peller |
1.17 |
printenv
|
44 |
|
|
|
45 |
bortigno |
1.5 |
#Path where the script write_regression_systematic.py and evaluateMVA.py are stored
|
46 |
|
|
#execute=$PWD/UserCode/VHbb/python/
|
47 |
peller |
1.8 |
#execute=/shome/peller/UserCode/VHbb/python/
|
48 |
bortigno |
1.7 |
#cd $execute
|
49 |
bortigno |
1.5 |
|
50 |
|
|
#back to the working dir
|
51 |
bortigno |
1.7 |
cd -
|
52 |
bortigno |
1.5 |
|
53 |
|
|
#Parsing the path form the config
|
54 |
nmohr |
1.4 |
pathAna=`python << EOF
|
55 |
|
|
import os
|
56 |
|
|
from BetterConfigParser import BetterConfigParser
|
57 |
|
|
config = BetterConfigParser()
|
58 |
|
|
config.read('./pathConfig$energy')
|
59 |
|
|
print config.get('Directories','samplepath')
|
60 |
|
|
EOF`
|
61 |
|
|
echo $pathAna
|
62 |
|
|
configFile=config$energy
|
63 |
bortigno |
1.5 |
|
64 |
peller |
1.17 |
storagesamples=`python << EOF
|
65 |
|
|
import os
|
66 |
|
|
from BetterConfigParser import BetterConfigParser
|
67 |
|
|
config = BetterConfigParser()
|
68 |
|
|
config.read('./pathConfig$energy')
|
69 |
|
|
print config.get('Directories','storagesamples')
|
70 |
|
|
EOF`
|
71 |
|
|
|
72 |
|
|
|
73 |
peller |
1.9 |
MVAList=`python << EOF
|
74 |
|
|
import os
|
75 |
|
|
from BetterConfigParser import BetterConfigParser
|
76 |
|
|
config = BetterConfigParser()
|
77 |
|
|
config.read('./config$energy')
|
78 |
|
|
print config.get('MVALists','List_for_submitscript')
|
79 |
|
|
EOF`
|
80 |
|
|
configFile=config$energy
|
81 |
|
|
|
82 |
|
|
|
83 |
bortigno |
1.5 |
#Create subdirs where processed samples will be stored
|
84 |
bortigno |
1.10 |
if [ ! -d $pathAna/env ]
|
85 |
|
|
then
|
86 |
|
|
mkdir $pathAna/env
|
87 |
|
|
fi
|
88 |
bortigno |
1.5 |
if [ ! -d $pathAna/env/sys ]
|
89 |
|
|
then
|
90 |
|
|
mkdir $pathAna/env/sys
|
91 |
|
|
fi
|
92 |
bortigno |
1.7 |
if [ ! -d $pathAna/env/sys/MVAout ]
|
93 |
bortigno |
1.5 |
then
|
94 |
|
|
mkdir $pathAna/env/sys/MVAout
|
95 |
|
|
fi
|
96 |
|
|
|
97 |
|
|
#Run the scripts
|
98 |
peller |
1.9 |
|
99 |
|
|
if [ $task = "prep" ]; then
|
100 |
peller |
1.17 |
./prepare_environment_with_config.py -I $storagesamples -O $pathAna/env/ -C ${energy}samples_nosplit.cfg
|
101 |
peller |
1.9 |
fi
|
102 |
|
|
if [ $task = "sys" ]; then
|
103 |
|
|
./write_regression_systematics.py -P $pathAna/env/ -S $sample -C $configFile -C pathConfig$energy
|
104 |
|
|
fi
|
105 |
|
|
if [ $task = "eval" ]; then
|
106 |
peller |
1.17 |
./evaluateMVA.py -D $MVAList -S $sample -U 0 -C ${configFile} -C pathConfig$energy
|
107 |
peller |
1.9 |
fi
|
108 |
nmohr |
1.14 |
if [ $task = "syseval" ]; then
|
109 |
|
|
./write_regression_systematics.py -P $pathAna/env/ -S $sample -C $configFile -C pathConfig$energy
|
110 |
|
|
./evaluateMVA.py -P $pathAna/env/sys/ -D $MVAList -S $sample -U 0 -C ${configFile} -C pathConfig$energy
|
111 |
|
|
fi
|
112 |
peller |
1.9 |
if [ $task = "plot" ]; then
|
113 |
nmohr |
1.14 |
./tree_stack.py -P $pathAna/env/sys/MVAout/ -C ${configFile} -C pathConfig$energy -R $sample
|
114 |
peller |
1.9 |
fi
|
115 |
|
|
if [ $task = "dc" ]; then
|
116 |
|
|
./workspace_datacard.py -P $pathAna/env/sys/MVAout/ -C ${configFile} -C pathConfig$energy -V $sample
|
117 |
|
|
fi
|
118 |
peller |
1.15 |
|
119 |
|
|
rm -rf $TMPDIR
|