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.1 by buchmann, Mon Apr 16 09:58:07 2012 UTC vs.
Revision 1.4 by buchmann, Mon May 7 16:43:30 2012 UTC

# Line 5 | Line 5 | if [ $# -lt 2 ]; then
5    echo " $0 (directory where datacard & histo root file are stored) (name of datacard, usually susydatacard.txt)"
6   fi
7  
8 < echo -e "Have been supplied with the following arguments \n $1 \n $2 \n"
9 < ORIGDIR=`pwd`
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 >
11   cd ~/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/
12   origscramarch=$SCRAM_ARCH
13   origbase=$CMSSW_BASE
# Line 19 | Line 20 | 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
21   if [ $? -gt 0 ]; then
22    echo "SOMETHING FAILED"
23 <  failures=$3
23 >  failures=$4
24    if [ -e $failures ]; then
25      echo "~~~~ THIS IS THE FIRST FAILURE"
26      failures=0;
# Line 29 | Line 30 | if [ $? -gt 0 ]; then
30      echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        Going to retry (failures so far: $failures)"
31      let "failures = failures + 1"
32      cd $ORIGDIR
33 <    bash $0 $1 $2 $failures
33 >    bash $0 $1 $2 $3 $failures
34      exit
35    else
36      echo "There's something totally wrong ..."
# Line 49 | Line 50 | echo "                       LIMIT COMPU
50   echo "                         ~~~~~~~~~~~~~                         "
51  
52   #$CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -t500 -s2
52 #combine -M HybridNew --frequentist --testStat LHC realistic-counting-experiment.txt -H ProfileLikelihood --fork 4
53
53  
54   #$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --frequentist --testStat LHC $1/model.root -H ProfileLikelihood
55 +
56   echo "Ready to run limit!"
57 < command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew -t1 --frequentist --testStat LHC $1/model.root -H ProfileLikelihood"
57 >
58 > modelsource="model.root"
59 > if [[ $5 -gt 0 ]]; then
60 >  modelsource="susydatacard.txt"
61 > fi
62 >  
63 > if [[ $3 -gt 1 ]]; then
64 > echo "Asymptotic is $3 (0) therefore doing FULL LIMITS"
65 > # command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew -t1 --frequentist --testStat LHC $1/model.root -H ProfileLikelihood"
66 > 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} "
67 > else
68 > if [[ $3 -lt 1 ]]; then
69 >    echo "Asymptotic is $3 (0) therefore doing ASYMPTOTIC LIMITS"
70 >    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/${modelsource} -H ProfileLikelihood"
71 > else
72 >    echo "Asymptotic is $3 (0) therefore doing ASYMPTOTIC LIMITS but WITH initial guess"
73 >    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/${modelsource} -H ProfileLikelihood"
74 > fi
75 > fi
76 >
77   echo "Going to run $command"
78 < time eval $command
78 > #time eval $command 3>&1 >&2 2>&3 3>&- | tee $1/log.txt
79 > time eval $command 2>&1 | tee $1/log.txt
80   echo "Done running limits"
81 + errorsencountered=`cat $1/log.txt | grep nan | wc -l`
82 + echo "DURING LIMIT COMPUTATOIN, AN ERROR LOG HAS BEEN WRITTEN TO $1/errorlog.txt which contains $errorsencountered not-a-value's"
83 + if [[ $errorsencountered -gt 20 ]]; then
84 + # something is seriously wrong, there's no point in continuing
85 +  exit -1
86 + fi
87 +
88   outfile="INVALID"
89   echo `pwd`
90   for i in `ls -ltrh | grep root | grep ombine | awk '{ print $9 }'`; do
# Line 71 | Line 98 | fi
98  
99   g++ $ORIGDIR/ReadAndSave.C -o ReadAndSave.exec `root-config --glibs --cflags`
100  
101 + if [[ $3 -gt 1 ]]; then
102 +  startfile=$outfile
103 +  outfile="allmerged.root"
104 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.16
105 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.025
106 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.5
107 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.84
108 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/${modelsource} -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.975
109 +  hadd $outfile higgs*.root
110 + fi
111 +
112   ./ReadAndSave.exec $1/$outfile $1/ShapeDropletResult.txt
113  
114   rm ReadAndSave.exec
# Line 79 | Line 117 | echo "$ORIGDIR/ReadAndSave.exec $1/$outf
117   echo "Stored the droplet in $1/ShapeDropletResult.txt"
118  
119  
120 < #$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic $1/model.root -t10
120 >
121  
122  
123  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines