1 |
+ |
#!/bin/bash |
2 |
+ |
|
3 |
+ |
#Input argument: |
4 |
+ |
#sample you want to run on. It has to match the naming in sample.info. |
5 |
|
sample=$1 |
6 |
< |
cd /shome/nmohr/CMSSW_5_3_2/src/ |
6 |
> |
#sqrt(s) you want to run |
7 |
> |
energy=$2 |
8 |
> |
|
9 |
> |
task=$3 |
10 |
> |
|
11 |
> |
if [ $# -lt 3 ] |
12 |
> |
then |
13 |
> |
echo "ERROR: You passed " $# "arguments while the script needs at least 3 arguments." |
14 |
> |
echo "Exiting..." |
15 |
> |
echo " ---------------------------------- " |
16 |
> |
echo " Usage : ./runAll.sh sample energy task" |
17 |
> |
echo " ---------------------------------- " |
18 |
> |
exit |
19 |
> |
fi |
20 |
> |
|
21 |
> |
#Set the environment for the batch job execution |
22 |
> |
|
23 |
> |
#cd /shome/peller/CMSSW_5_2_4_patch4/src/ |
24 |
> |
# this doesnt work for me..? |
25 |
> |
cd $CMSSW_BASE/src/ |
26 |
|
source /swshare/psit3/etc/profile.d/cms_ui_env.sh |
27 |
|
export SCRAM_ARCH="slc5_amd64_gcc462" |
28 |
|
source $VO_CMS_SW_DIR/cmsset_default.sh |
29 |
|
eval `scramv1 runtime -sh` |
30 |
|
unset TMP |
31 |
|
unset TMPDIR |
32 |
< |
pathAna=/shome/nmohr/VHbbAnalysis/EDMNtuple_step2/May5/ |
33 |
< |
execute=/shome/nmohr/CMSSW_5_3_2/src/UserCode/VHbb/python/ |
34 |
< |
configFile=config7TeV |
35 |
< |
mkdir $pathAna/env/sys |
36 |
< |
cd $execute |
37 |
< |
./write_regression_systematics.py -P $pathAna/env/ -S $sample -C $configFile |
38 |
< |
mkdir $pathAna/env/sys/MVAout |
39 |
< |
./evaluateMVA.py -P $pathAna/env/sys/ -D RTight_ZH110_may,RTight_ZH115_may,RTight_ZH120_may,RTight_ZH125_may,RTight_ZH130_may,RTight_ZH135_may,RMed_ZH110_may,RMed_ZH115_may,RMed_ZH120_may,RMed_ZH125_may,RMed_ZH130_may,RMed_ZH135_may -S $sample -U 0 -C ${configFile} |
40 |
< |
./showinfo.py $pathAna/env/sys |
32 |
> |
|
33 |
> |
#Path where the script write_regression_systematic.py and evaluateMVA.py are stored |
34 |
> |
#execute=$PWD/UserCode/VHbb/python/ |
35 |
> |
#execute=/shome/peller/UserCode/VHbb/python/ |
36 |
> |
#cd $execute |
37 |
> |
|
38 |
> |
#back to the working dir |
39 |
> |
cd - |
40 |
> |
|
41 |
> |
#Parsing the path form the config |
42 |
> |
pathAna=`python << EOF |
43 |
> |
import os |
44 |
> |
from BetterConfigParser import BetterConfigParser |
45 |
> |
config = BetterConfigParser() |
46 |
> |
config.read('./pathConfig$energy') |
47 |
> |
print config.get('Directories','samplepath') |
48 |
> |
EOF` |
49 |
> |
echo $pathAna |
50 |
> |
configFile=config$energy |
51 |
> |
|
52 |
> |
MVAList=`python << EOF |
53 |
> |
import os |
54 |
> |
from BetterConfigParser import BetterConfigParser |
55 |
> |
config = BetterConfigParser() |
56 |
> |
config.read('./config$energy') |
57 |
> |
print config.get('MVALists','List_for_submitscript') |
58 |
> |
EOF` |
59 |
> |
configFile=config$energy |
60 |
> |
|
61 |
> |
|
62 |
> |
#Create subdirs where processed samples will be stored |
63 |
> |
if [ ! -d $pathAna/env ] |
64 |
> |
then |
65 |
> |
mkdir $pathAna/env |
66 |
> |
fi |
67 |
> |
if [ ! -d $pathAna/env/sys ] |
68 |
> |
then |
69 |
> |
mkdir $pathAna/env/sys |
70 |
> |
fi |
71 |
> |
if [ ! -d $pathAna/env/sys/MVAout ] |
72 |
> |
then |
73 |
> |
mkdir $pathAna/env/sys/MVAout |
74 |
> |
fi |
75 |
> |
|
76 |
> |
#Create the link to th sample information in the new sudfolders. |
77 |
> |
#It always update the link. |
78 |
> |
ln -s -f $pathAna/env/samples.info $pathAna/env/sys/samples.info |
79 |
> |
ln -s -f $pathAna/env/samples.info $pathAna/env/sys/MVAout/samples.info |
80 |
> |
|
81 |
> |
#Run the scripts |
82 |
> |
|
83 |
> |
if [ $task = "prep" ]; then |
84 |
> |
./prepare_environment_with_config.py -I $pathAna -O $pathAna/env/ -C ${energy}samples_nosplit.cfg |
85 |
> |
fi |
86 |
> |
if [ $task = "sys" ]; then |
87 |
> |
./write_regression_systematics.py -P $pathAna/env/ -S $sample -C $configFile -C pathConfig$energy |
88 |
> |
fi |
89 |
> |
if [ $task = "eval" ]; then |
90 |
> |
./evaluateMVA.py -P $pathAna/env/sys/ -D $MVAList -S $sample -U 0 -C ${configFile} -C pathConfig$energy |
91 |
> |
fi |
92 |
> |
if [ $task = "syseval" ]; then |
93 |
> |
./write_regression_systematics.py -P $pathAna/env/ -S $sample -C $configFile -C pathConfig$energy |
94 |
> |
./evaluateMVA.py -P $pathAna/env/sys/ -D $MVAList -S $sample -U 0 -C ${configFile} -C pathConfig$energy |
95 |
> |
fi |
96 |
> |
if [ $task = "plot" ]; then |
97 |
> |
./tree_stack.py -P $pathAna/env/sys/MVAout/ -C ${configFile} -C pathConfig$energy -R $sample |
98 |
> |
fi |
99 |
> |
if [ $task = "dc" ]; then |
100 |
> |
./workspace_datacard.py -P $pathAna/env/sys/MVAout/ -C ${configFile} -C pathConfig$energy -V $sample |
101 |
> |
fi |