Crombie Tools
test.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 ##
4 # @file test.sh
5 #
6 # The tests to run on a new installation or
7 # while developing CrombieTools.
8 #
9 # @todo test all the useful things.
10 #
11 # @author Daniel Abercrombie
12 #
13 
14 fast=$1
15 
16 check () {
17 
18  code=$?
19  echo "Exit code: $code"
20  if [ $code -ne 0 ]
21  then
22  exit $code
23  fi
24 
25 }
26 
27 returnto=`pwd`
28 
29 if [ "$CROMBIEPATH" = "" ]
30 then
31  echo "Installation not complete!"
32  echo " Did you run ../install.sh and source your bash profile?"
33  exit 1
34 fi
35 
36 here=$CROMBIEPATH/old/test
37 
38 echo "Testing package installed at $CROMBIEPATH"
39 
40 cd $here
41 
42 if [ "$fast" != "fast" ] # Start from fresh directory
43 then # unless we only want to quickly
44  for toRemove in `ls` # check new features or tests
45  do
46  if [ -d $toRemove ] # Only remove directories
47  then # Leave all testing scripts
48  rm -rf $toRemove # and READMEs
49  fi
50  done
51  crombie clean
52 fi
53 
54 crombie workspace test
55 check
56 
57 cd $here/slimmer
58 
59 host=`hostname`
60 if [ "${host:0:6}" = "lxplus" ]
61 then
62  crombie submitlxbatch test
63  check
64  echo "Just kidding, I didn't really submit anything... At least, I shouldn't have ;^)"
65 fi
66 
67 cd $here/plotter
68 
69 source CrombiePlotterConfig.sh # This should source the slimming config too
70 
71 if [ "${host:0:6}" != "lxplus" ]
72 then
73  cd $here
74  mkdir $CrombieFullDir &> /dev/null
75 fi
76 
77 if [ ! -d $CrombieFullDir ]
78 then
79  echo "'crombie dumpeosfiles' should have made your out directory, but didn't!"
80 fi
81 
82 cd $here/slimmer
83 
84 outBase=$CrombieFullDir/$CrombieFileBase
85 for sample in "Data" "Signal" "MC1" "MC2" "MC3"
86 do
87  echo "Generating pretend $sample."
88  ./runSlimmer.py $sample.root ${outBase}_$sample.root
89  check
90  ls ${outBase}_$sample.root
91  $CrombieCheckerScript ${outBase}_$sample.root
92  check
93 done
94 
95 echo "Skimming with good runs!"
96 ./FlatSkimmer.sh
97 check
98 
99 cd $here
100 
101 mkdir txtoutput 2> /dev/null
102 echo "Running crombie diff"
103 crombie diff FullOut/ SkimOut/ | sort | tail -n 5 > txtoutput/diffoutput.txt
104 check
105 
106 cd $here/slimmer
107 
108 echo "Making correction histogram!"
109 ./makeHist.py
110 check
111 echo "Adding corrections to .root Files!"
112 ./corrector.py
113 check
114 
115 cd $here/plotter
116 
117 echo "Adding cross sections for fun."
118 ./AddXSec.py
119 check
120 echo "Reweighting by something."
121 ./reweight.py
122 check
123 echo "Applying reweight corrections."
124 ./corrector.py
125 check
126 
127 echo "Making stack plots."
128 ./Stack.py
129 check
130 
131 # Make limit tree
132 # Make stacks with MC configs
133 # Make stacks using limit trees
134 # Make parameter fit plots (2D and FitParameters)
135 # Traing BDTs
136 # Make ROC curves
137 # Plot Hists to show discriminators include normalization
138 # Include systematics
139 # Make more stack plots with BDT cuts
140 
141 echo "Making cutflow."
142 ./cutflow.py
143 check
144 
145 echo "Making brazilian plots."
146 ./Brazil.py
147 check
148 
149 cd $here/docs
150 
151 echo "Trying to make docs."
152 pdflatex test.tex &> /dev/null
153 pdflatex test.tex &> /dev/null
154 
155 mkdir figs 2> /dev/null
156 
157 cp $here/plotter/plots/* figs/.
158 
159 echo "Making backup slides."
160 crombie backupslides
161 check
162 
163 pdflatex \\nonstopmode\\input presentation.tex &> /dev/null
164 pdflatex \\nonstopmode\\input presentation.tex &> /dev/null
165 
166 echo "Done trying."
167 
168 cd $here
169 
170 ## Makes a huge mess because of global mutexes in RunParallel
171 # echo "Compiling everything left over."
172 # crombie compile
173 # check
174 
175 cd $returnto
176 
177 if [ "$fast" != "fast" ]
178 then
179  echo "-------------------------------------------------------------------"
180  echo "Making sure that rerunning doesn't overwrite files or recompile ..."
181  echo "-------------------------------------------------------------------"
182  crombie test fast
183  check
184 fi
185 
186 exit 0