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.3 by buchmann, Fri Apr 27 07:09:25 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"
8 > echo -e "Have been supplied with the following arguments \n $1 \n $2 \n $3"
9   ORIGDIR=`pwd`
10   cd ~/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/
11   origscramarch=$SCRAM_ARCH
# Line 19 | Line 19 | cd $1
19   python /shome/buchmann/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/CombinedLimit/scripts/text2workspace.py $2 -b -o $1/model.root
20   if [ $? -gt 0 ]; then
21    echo "SOMETHING FAILED"
22 <  failures=$3
22 >  failures=$4
23    if [ -e $failures ]; then
24      echo "~~~~ THIS IS THE FIRST FAILURE"
25      failures=0;
# Line 29 | Line 29 | if [ $? -gt 0 ]; then
29      echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!        Going to retry (failures so far: $failures)"
30      let "failures = failures + 1"
31      cd $ORIGDIR
32 <    bash $0 $1 $2 $failures
32 >    bash $0 $1 $2 $3 $failures
33      exit
34    else
35      echo "There's something totally wrong ..."
# Line 49 | Line 49 | echo "                       LIMIT COMPU
49   echo "                         ~~~~~~~~~~~~~                         "
50  
51   #$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
52  
53   #$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --frequentist --testStat LHC $1/model.root -H ProfileLikelihood
54 +
55   echo "Ready to run limit!"
56 < command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew -t1 --frequentist --testStat LHC $1/model.root -H ProfileLikelihood"
56 > if [[ $3 -gt 1 ]]; then
57 > echo "Asymptotic is $3 (0) therefore doing FULL LIMITS"
58 > # command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew -t1 --frequentist --testStat LHC $1/model.root -H ProfileLikelihood"
59 > command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --rule CLs --testStat LHC --rMin $5 --rMax $6 --freq -T 1000 -i 8 --saveHybridResult --saveToys -v 1 -s 0 $1/model.root "
60 > else
61 > if [[ $3 -lt 1 ]]; then
62 >    echo "Asymptotic is $3 (0) therefore doing ASYMPTOTIC LIMITS"
63 >    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  -t1 $1/model.root -H ProfileLikelihood"
64 > else
65 >    echo "Asymptotic is $3 (0) therefore doing ASYMPTOTIC LIMITS but WITH initial guess"
66 >    command="$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic  --rMax $6 -t1 $1/model.root -H ProfileLikelihood"
67 > fi
68 > fi
69 >
70   echo "Going to run $command"
71 < time eval $command
71 > #time eval $command 3>&1 >&2 2>&3 3>&- | tee $1/log.txt
72 > time eval $command 2>&1 | tee $1/log.txt
73   echo "Done running limits"
74 + errorsencountered=`cat $1/log.txt | grep nan | wc -l`
75 + echo "DURING LIMIT COMPUTATOIN, AN ERROR LOG HAS BEEN WRITTEN TO $1/errorlog.txt which contains $errorsencountered not-a-value's"
76 + if [[ $errorsencountered -gt 20 ]]; then
77 + # something is seriously wrong, there's no point in continuing
78 +  exit -1
79 + fi
80 +
81   outfile="INVALID"
82   echo `pwd`
83   for i in `ls -ltrh | grep root | grep ombine | awk '{ print $9 }'`; do
# Line 71 | Line 91 | fi
91  
92   g++ $ORIGDIR/ReadAndSave.C -o ReadAndSave.exec `root-config --glibs --cflags`
93  
94 + if [[ $3 -gt 1 ]]; then
95 +  startfile=$outfile
96 +  outfile="allmerged.root"
97 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.16
98 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.025
99 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.5
100 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.84
101 +  $CMSSW_BASE/bin/$SCRAM_ARCH/combine $1/model.root -M HybridNew --freq --grid=$startfile --expectedFromGrid 0.975
102 +  hadd $outfile *.root
103 + fi
104 +
105   ./ReadAndSave.exec $1/$outfile $1/ShapeDropletResult.txt
106  
107   rm ReadAndSave.exec
# Line 79 | Line 110 | echo "$ORIGDIR/ReadAndSave.exec $1/$outf
110   echo "Stored the droplet in $1/ShapeDropletResult.txt"
111  
112  
113 < #$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic $1/model.root -t10
113 >
114  
115  
116  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines