ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/runAll.sh
Revision: 1.20
Committed: Wed Jan 16 10:50:30 2013 UTC (12 years, 3 months ago) by bortigno
Content type: application/x-sh
Branch: MAIN
Changes since 1.19: +14 -11 lines
Log Message:
env sys and MVAout path grouped in variables, to make it easier to change the env/sys/MVAout path if needed. Still hardcoded though.

File Contents

# User Rev Content
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 nmohr 1.18 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_PRELOAD="libglobus_gssapi_gsi_gcc64pthr.so.0":${LD_PRELOAD}
32 peller 1.15
33     mkdir $TMPDIR
34 bortigno 1.5
35 peller 1.17 printenv
36    
37 bortigno 1.5 #Path where the script write_regression_systematic.py and evaluateMVA.py are stored
38     #execute=$PWD/UserCode/VHbb/python/
39 peller 1.8 #execute=/shome/peller/UserCode/VHbb/python/
40 bortigno 1.7 #cd $execute
41 bortigno 1.5
42     #back to the working dir
43 bortigno 1.7 cd -
44 bortigno 1.5
45     #Parsing the path form the config
46 nmohr 1.4 pathAna=`python << EOF
47     import os
48     from BetterConfigParser import BetterConfigParser
49     config = BetterConfigParser()
50     config.read('./pathConfig$energy')
51     print config.get('Directories','samplepath')
52     EOF`
53     echo $pathAna
54     configFile=config$energy
55 bortigno 1.5
56 peller 1.17 storagesamples=`python << EOF
57     import os
58     from BetterConfigParser import BetterConfigParser
59     config = BetterConfigParser()
60     config.read('./pathConfig$energy')
61 nmohr 1.18 print config.get('Directories','samplepath')
62 peller 1.17 EOF`
63    
64    
65 peller 1.9 MVAList=`python << EOF
66     import os
67     from BetterConfigParser import BetterConfigParser
68     config = BetterConfigParser()
69     config.read('./config$energy')
70     print config.get('MVALists','List_for_submitscript')
71     EOF`
72     configFile=config$energy
73    
74 bortigno 1.20 pathAnaEnv=$pathAna/env
75     pathAnaSys=$pathAnaEnv/sys
76     pathAnaMVAout=$pathAnaSys/MVAout
77 peller 1.9
78 bortigno 1.5 #Create subdirs where processed samples will be stored
79 bortigno 1.20 if [ ! -d $pathAnaEnv ]
80 bortigno 1.10 then
81 bortigno 1.20 mkdir $pathAnaEnv
82 bortigno 1.10 fi
83 bortigno 1.20 if [ ! -d $pathAnaSys ]
84 bortigno 1.5 then
85 bortigno 1.20 mkdir $pathAnaSys
86 bortigno 1.5 fi
87 bortigno 1.20 if [ ! -d $pathAnaMVAout ]
88 bortigno 1.5 then
89 bortigno 1.20 mkdir $pathAnaMVAout
90 bortigno 1.5 fi
91    
92     #Run the scripts
93 peller 1.9
94     if [ $task = "prep" ]; then
95 bortigno 1.20 ./prepare_environment_with_config.py -I $storagesamples -O $pathAnaEnv/ -C ${energy}samples_nosplit.cfg
96 peller 1.9 fi
97     if [ $task = "sys" ]; then
98 bortigno 1.20 ./write_regression_systematics.py -P $pathAnaEnv/ -S $sample -C $configFile -C pathConfig$energy
99 peller 1.9 fi
100     if [ $task = "eval" ]; then
101 peller 1.17 ./evaluateMVA.py -D $MVAList -S $sample -U 0 -C ${configFile} -C pathConfig$energy
102 peller 1.9 fi
103 nmohr 1.14 if [ $task = "syseval" ]; then
104 bortigno 1.20 ./write_regression_systematics.py -P $pathAnaEnv/ -S $sample -C $configFile -C pathConfig$energy
105 bortigno 1.19 ./evaluateMVA.py -D $MVAList -S $sample -U 0 -C ${configFile} -C pathConfig$energy
106 nmohr 1.14 fi
107 peller 1.9 if [ $task = "plot" ]; then
108 bortigno 1.20 ./tree_stack.py -P $pathAnaMVAout/ -C ${configFile} -C pathConfig$energy -R $sample
109 peller 1.9 fi
110     if [ $task = "dc" ]; then
111 bortigno 1.20 ./workspace_datacard.py -P $pathAnaMVAout/ -C ${configFile} -C pathConfig$energy -V $sample
112 peller 1.9 fi
113 peller 1.15
114     rm -rf $TMPDIR