ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/DistributedModelCalculations/ShapeLimits/CreateModel.sh
(Generate patch)

Comparing UserCode/cbrown/Development/DistributedModelCalculations/ShapeLimits/CreateModel.sh (file contents):
Revision 1.4 by buchmann, Mon May 7 16:43:30 2012 UTC vs.
Revision 1.5 by buchmann, Thu May 17 20:01:40 2012 UTC

# Line 6 | Line 6 | if [ $# -lt 2 ]; then
6   fi
7  
8   echo -e "Have been supplied with the following arguments \n $1 \n $2 \n $3"
9 < ORIGDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
10 <
9 > ORIGDIR=`dirname "$0"`
10   cd ~/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/
11   origscramarch=$SCRAM_ARCH
12   origbase=$CMSSW_BASE
13 + export ORIGTMP=$TMP
14 + export ORIGTMPDIR=$TMPDIR
15 + export TMP=`dirname $1`
16 + export TMPDIR=`dirname $1`
17 +
18 + echo "Have set the temporary directory (TMP) to $TMP and tempdir to (TMPDIR) $TMPDIR"
19 +
20   export SCRAM_ARCH=slc5_amd64_gcc434
15 cd
21   cd /shome/buchmann/final_production_2011/CMSSW_4_2_8/src/
22   eval `scram ru -sh`
18 echo "Ready to create model file"
19 cd $1
20 python /shome/buchmann/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/CombinedLimit/scripts/text2workspace.py $2 -b -o $1/model.root
23   if [ $? -gt 0 ]; then
24 <  echo "SOMETHING FAILED"
25 <  failures=$4
24 <  if [ -e $failures ]; then
25 <    echo "~~~~ THIS IS THE FIRST FAILURE"
26 <    failures=0;
27 <  fi
28 <  
29 <  if [ $failures -lt 4 ]; then
30 <    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        Going to retry (failures so far: $failures)"
31 <    let "failures = failures + 1"
32 <    cd $ORIGDIR
33 <    bash $0 $1 $2 $3 $failures
34 <    exit
35 <  else
36 <    echo "There's something totally wrong ..."
37 <    exit -1
38 <  fi
39 <  
40 < else
41 <  echo "Success";
24 >  echo "SETTING UP THE ENVIRONMENT FAILED"
25 >  exit -1
26   fi
27  
28 < ls -ltrh $1
28 > #echo "Ready to create model file"
29 > cd $1
30 > #python /shome/buchmann/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/CombinedLimit/scripts/text2workspace.py $2 -b -o $1/model.root
31 > #if [ $? -gt 0 ]; then
32 > #  echo "SOMETHING FAILED"
33 > #  failures=$4
34 > #  if [ -e $failures ]; then
35 > #    echo "~~~~ THIS IS THE FIRST FAILURE"
36 > #    failures=0;
37 > #  fi
38 > #  
39 > #  if [ $failures -lt 4 ]; then
40 > #    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        Going to retry (failures so far: $failures)"
41 > #    let "failures = failures + 1"
42 > #    cd $ORIGDIR
43 > #    bash $0 $1 $2 $3 $failures
44 > #    exit
45 > #  else
46 > #    echo "There's something totally wrong ..."
47 > #    exit -1
48 > #  fi
49 > #  
50 > #else
51 > #  echo "Success";
52 > #fi
53 > #
54 > #ls -ltrh $1
55  
56  
57  
58   echo "                         ~~~~~~~~~~~~~                         "
59   echo "                       LIMIT COMPUTATION                         "
60   echo "                         ~~~~~~~~~~~~~                         "
61 <
61 > echo "Base: $CMSSW_BASE"
62   #$CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -t500 -s2
63  
64   #$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --frequentist --testStat LHC $1/model.root -H ProfileLikelihood
65  
66   echo "Ready to run limit!"
67  
68 < modelsource="model.root"
69 < if [[ $5 -gt 0 ]]; then
68 > #modelsource="model.root"
69 > #if [[ $5 -gt 0 ]]; then
70    modelsource="susydatacard.txt"
71 < fi
72 <  
71 > #fi
72 >
73 > echo "First guess : [$6 , $7]"
74 >
75   if [[ $3 -gt 1 ]]; then
76 < echo "Asymptotic is $3 (0) therefore doing FULL LIMITS"
76 > echo "Asymptotic is $3 (2) therefore doing FULL LIMITS"
77   # command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew -t1 --frequentist --testStat LHC $1/model.root -H ProfileLikelihood"
78 < command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --rule CLs --testStat LHC -H ProfileLikelihood --freq -T 1000 -i 8 --saveHybridResult --saveToys -v 1 -s 0 $1/${modelsource} "
78 > command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --rule CLs --testStat LHC -H ProfileLikelihood --freq -T 2000 -i 12 --saveHybridResult --saveToys -v 1 -s 0 $1/${modelsource} "
79   else
80   if [[ $3 -lt 1 ]]; then
81      echo "Asymptotic is $3 (0) therefore doing ASYMPTOTIC LIMITS"
82 <    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/${modelsource} -H ProfileLikelihood"
82 >    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/${modelsource} -H ProfileLikelihood -s 1"
83   else
84 <    echo "Asymptotic is $3 (0) therefore doing ASYMPTOTIC LIMITS but WITH initial guess"
85 <    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/${modelsource} -H ProfileLikelihood"
84 >    echo "Asymptotic is $3 (1) therefore doing ASYMPTOTIC LIMITS but WITH initial guess"
85 >    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/${modelsource} -H ProfileLikelihood -s 1 --rMin $6 --rMax $7"
86   fi
87   fi
88  
# Line 96 | Line 108 | if [[ $outfile == *INVALID* ]]; then
108    exit -1
109   fi
110  
111 < g++ $ORIGDIR/ReadAndSave.C -o ReadAndSave.exec `root-config --glibs --cflags`
111 > g++ $ORIGDIR/ReadAndSave.C -o `pwd`/ReadAndSave.exec `root-config --glibs --cflags`
112  
113   if [[ $3 -gt 1 ]]; then
114    startfile=$outfile
# Line 106 | Line 118 | if [[ $3 -gt 1 ]]; then
118    $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.5
119    $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.84
120    $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.975
121 <  hadd $outfile higgs*.root
121 >  hadd $outfile *.root
122   fi
123  
124   ./ReadAndSave.exec $1/$outfile $1/ShapeDropletResult.txt
125  
126   rm ReadAndSave.exec
127  
116 echo "$ORIGDIR/ReadAndSave.exec $1/$outfile $1/ShapeDropletResult.txt"
128   echo "Stored the droplet in $1/ShapeDropletResult.txt"
129 + rm $TMPDIR/rstat*
130  
131 <
132 <
121 <
122 <
131 > export TMP=$ORIGTMP
132 > export TMPDIR=$ORIGTMPDIR
133  
134  
135   origscramarch=$SCRAM_ARCH

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines