1 |
#!/bin/bash
|
2 |
|
3 |
if [ $# -lt 2 ]; then
|
4 |
echo "This script is called automatically when trying to compute limits using shapes. it is called as follows:"
|
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`
|
10 |
cd ~/final_production_2011/CMSSW_4_2_8/src/HiggsAnalysis/
|
11 |
origscramarch=$SCRAM_ARCH
|
12 |
origbase=$CMSSW_BASE
|
13 |
export SCRAM_ARCH=slc5_amd64_gcc434
|
14 |
cd
|
15 |
cd /shome/buchmann/final_production_2011/CMSSW_4_2_8/src/
|
16 |
eval `scram ru -sh`
|
17 |
echo "Ready to create model file"
|
18 |
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
|
23 |
if [ -e $failures ]; then
|
24 |
echo "~~~~ THIS IS THE FIRST FAILURE"
|
25 |
failures=0;
|
26 |
fi
|
27 |
|
28 |
if [ $failures -lt 4 ]; then
|
29 |
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Going to retry (failures so far: $failures)"
|
30 |
let "failures = failures + 1"
|
31 |
cd $ORIGDIR
|
32 |
bash $0 $1 $2 $failures
|
33 |
exit
|
34 |
else
|
35 |
echo "There's something totally wrong ..."
|
36 |
exit -1
|
37 |
fi
|
38 |
|
39 |
else
|
40 |
echo "Success";
|
41 |
fi
|
42 |
|
43 |
ls -ltrh $1
|
44 |
|
45 |
|
46 |
|
47 |
echo " ~~~~~~~~~~~~~ "
|
48 |
echo " LIMIT COMPUTATION "
|
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 |
|
54 |
|
55 |
#$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M HybridNew --frequentist --testStat LHC $1/model.root -H ProfileLikelihood
|
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"
|
58 |
echo "Going to run $command"
|
59 |
time eval $command
|
60 |
echo "Done running limits"
|
61 |
outfile="INVALID"
|
62 |
echo `pwd`
|
63 |
for i in `ls -ltrh | grep root | grep ombine | awk '{ print $9 }'`; do
|
64 |
outfile=$i
|
65 |
done
|
66 |
if [[ $outfile == *INVALID* ]]; then
|
67 |
echo "THERE WAS NO OUTPUT FROM THE LIMIT COMPUTATION ..."
|
68 |
ls -ltrh
|
69 |
exit -1
|
70 |
fi
|
71 |
|
72 |
g++ $ORIGDIR/ReadAndSave.C -o ReadAndSave.exec `root-config --glibs --cflags`
|
73 |
|
74 |
./ReadAndSave.exec $1/$outfile $1/ShapeDropletResult.txt
|
75 |
|
76 |
rm ReadAndSave.exec
|
77 |
|
78 |
echo "$ORIGDIR/ReadAndSave.exec $1/$outfile $1/ShapeDropletResult.txt"
|
79 |
echo "Stored the droplet in $1/ShapeDropletResult.txt"
|
80 |
|
81 |
|
82 |
#$CMSSW_BASE/bin/$SCRAM_ARCH/combine -M Asymptotic $1/model.root -t10
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
origscramarch=$SCRAM_ARCH
|
88 |
export SCRAM_ARCH=$origscramarch
|
89 |
cd $origbase
|
90 |
eval `scram ru -sh`
|