1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
#include <getopt.h>
|
5 |
|
|
#include <stdio.h>
|
6 |
|
|
#include <stdlib.h>
|
7 |
|
|
#include "Modules/GeneralToolBox.C"
|
8 |
|
|
#include "Modules/SampleClass.C"
|
9 |
|
|
#include "Modules/setTDRStyle.C"
|
10 |
|
|
#include "Modules/Setup.C"
|
11 |
|
|
#include "Modules/Poisson_Calculator.C"
|
12 |
|
|
#include "Modules/ActiveSamples.C"
|
13 |
|
|
#include "Modules/PeakFinder.C"
|
14 |
|
|
#include "Modules/UpperLimitsWithShape.C"
|
15 |
|
|
#include "Modules/Plotting_Functions.C"
|
16 |
|
|
#include "Modules/LimitCalculation.C"
|
17 |
|
|
#include "Modules/ResultModule.C"
|
18 |
buchmann |
1.4 |
#include "Modules/CrossSectionReader.C"
|
19 |
buchmann |
1.1 |
#include "Modules/Systematics.C"
|
20 |
buchmann |
1.10 |
#include "Modules/SugarCoating.C"
|
21 |
|
|
#include "Modules/ExclusionPlot.C"
|
22 |
buchmann |
1.1 |
#include "Modules/SUSYScan.C"
|
23 |
|
|
|
24 |
buchmann |
1.10 |
|
25 |
|
|
|
26 |
buchmann |
1.1 |
#include <TCut.h>
|
27 |
|
|
#include <TROOT.h>
|
28 |
|
|
#include <TCanvas.h>
|
29 |
|
|
#include <TMath.h>
|
30 |
|
|
#include <TColor.h>
|
31 |
|
|
#include <TPaveText.h>
|
32 |
|
|
#include <TRandom.h>
|
33 |
|
|
#include <TH1.h>
|
34 |
|
|
#include <TH2.h>
|
35 |
|
|
#include <TF1.h>
|
36 |
|
|
#include <TSQLResult.h>
|
37 |
|
|
|
38 |
|
|
#ifndef Verbosity
|
39 |
|
|
#define Verbosity 0
|
40 |
|
|
#endif
|
41 |
|
|
#ifndef HUSH
|
42 |
|
|
#define HUSH 1
|
43 |
|
|
#endif
|
44 |
|
|
|
45 |
|
|
using namespace PlottingSetup;
|
46 |
|
|
|
47 |
|
|
void usage(int passed=0 ) {
|
48 |
|
|
std::cout << "USAGE : " << std::endl;
|
49 |
|
|
std::cout << "You can use different options when running this program : " << std::endl;
|
50 |
|
|
std::cout << std::endl;
|
51 |
|
|
std::cout << "\033[1;34m all\033[0m \t\t All processes of the standard workflow" << std::endl;
|
52 |
|
|
std::cout << "\033[1;34m peak\033[0m \t\t Peak finding" << std::endl;
|
53 |
|
|
std::cout << "\033[1;34m kin\033[0m \t\t Kinematic plots" << std::endl;
|
54 |
|
|
std::cout << "\033[1;34m pfkin\033[0m \t Kinematic plots for PF variables" << std::endl;
|
55 |
|
|
std::cout << "\033[1;34m region\033[0m \t Region comparison plots" << std::endl;
|
56 |
|
|
std::cout << "\033[1;34m lepton\033[0m \t Lepton comparison plots" << std::endl;
|
57 |
|
|
std::cout << "\033[1;34m jzb\033[0m \t\t JZB plots" << std::endl;
|
58 |
|
|
std::cout << "\033[1;34m pred\033[0m \t\t Prediction plots" << std::endl;
|
59 |
|
|
std::cout << "\033[1;34m ratio\033[0m \t Ratio plots (standalone ratio plot)" << std::endl;
|
60 |
|
|
std::cout << "\033[1;34m signalbg\033[0m \t Signal vs. background plots (shape comparison)" << std::endl;
|
61 |
|
|
std::cout << "\033[1;34m ttbar\033[0m \t TTbar sideband comparison" << std::endl;
|
62 |
|
|
std::cout << "\033[1;34m zjets\033[0m \t ZJets plots" << std::endl;
|
63 |
buchmann |
1.7 |
std::cout << "\033[1;34m diboson\033[0m \t Diboson plots" << std::endl;
|
64 |
buchmann |
1.1 |
std::cout << "\033[1;34m results\033[0m \t Compute results (JZB>X)" << std::endl;
|
65 |
|
|
std::cout << "\033[1;34m syst\033[0m \t\t Compute systematics" << std::endl;
|
66 |
|
|
std::cout << "\033[1;34m eff\033[0m \t\t Compute all (partial) efficiencies" << std::endl;
|
67 |
|
|
std::cout << "\033[1;34m shapes\033[0m \t Prepare ROOT files for computing limits using shapes" << std::endl;
|
68 |
|
|
std::cout << "\033[1;34m counting\033[0m \t Establish limits with counting experiment" << std::endl;
|
69 |
buchmann |
1.14 |
std::cout << "\033[1;34m shapelimit\033[0m \t Establish limits with shapes" << std::endl;
|
70 |
buchmann |
1.15 |
std::cout << "\033[1;34m qcd\033[0m \t\t Show that QCD is negligible" << endl;
|
71 |
buchmann |
1.1 |
std::cout << "\033[1;34m response\033[0m \t Compute response correction" << std::endl;
|
72 |
|
|
std::cout << "\033[1;34m pickup\033[0m \t Pick up interesting events" << std::endl;
|
73 |
|
|
std::cout << "\033[1;34m yields\033[0m \t Compute MC yields for this lumi" << std::endl;
|
74 |
|
|
std::cout << "\033[1;34m sideassess\033[0m\t Assessment of the mass sidebands definition in the data" << std::endl;
|
75 |
|
|
std::cout << "\033[1;34m jes\033[0m \t\t Make Jet Energy Scale (JES) plot" << std::endl;
|
76 |
buchmann |
1.15 |
std::cout << "\033[1;34m effcurve\033[0m \t\t Make JZB efficiency plot" << std::endl;
|
77 |
buchmann |
1.1 |
std::cout << "\033[1;34m save\033[0m \t\t Save results in a template file (for reuse when establishing limits for scans)" << std::endl;
|
78 |
|
|
std::cout << "\033[1;34m png\033[0m \t\t Save all plots as pngs (also available: --pdf, --root, --eps, --C) standard: png&pdf" << std::endl;
|
79 |
|
|
std::cout << "\033[1;34m offpeak\033[0m \t Sets offpeak to true (i.e. carry out off-peak analysis!)" << std::endl;
|
80 |
|
|
std::cout << "\033[1;34m onpeak\033[0m \t Sets onpeak to true (i.e. carry out standard on-peak analysis!)" << std::endl;
|
81 |
buchmann |
1.16 |
std::cout << "\033[1;34m btagged (b)\033[0m \t Sets DoBTag to true (i.e. carry out b tagged analysis)" << std::endl;
|
82 |
buchmann |
1.2 |
std::cout << "\033[1;34m jzbcuts\033[0m \t Sets the jzb cuts (please provide them in the format 50,100,150,200 and so on (comma separated)" << endl;
|
83 |
|
|
std::cout << "\033[1;34m ptsanity\033[0m \t Checks whether all samples have the correct pt range (additional canvas for you to check)" << endl;
|
84 |
buchmann |
1.15 |
std::cout << "\033[1;34m mlls\033[0m \t Draw dilepton invariant mass for all signals" << endl;
|
85 |
buchmann |
1.1 |
std::cout << std::endl;
|
86 |
|
|
std::cout << "\033[1;34m dir (d)\033[0m\t Directory where all plots will be saved" << std::endl;
|
87 |
|
|
std::cout << "\033[1;34m public \033[0m\t Switch to be activated when using the algorithm in public (no branding etc.)" << std::endl;
|
88 |
|
|
std::cout << std::endl;
|
89 |
|
|
std::cout << std::endl;
|
90 |
|
|
std::cout << "\033[1;34m met\033[0m \t\t Compute obs/pred for met cut vs jzb cut (in data, lm4 and lm8)" << std::endl;
|
91 |
buchmann |
1.15 |
std::cout << "\033[1;34m metvsjzb\033[0m \t\t Produce MET:JZB plots" << std::endl;
|
92 |
buchmann |
1.1 |
std::cout << std::endl;
|
93 |
|
|
std::cout << std::endl;
|
94 |
|
|
std::cout << "\033[1;34m paper\033[0m \t\t Switch paper mode on (no \" Preliminary \" on plots)" << std::endl;
|
95 |
buchmann |
1.15 |
std::cout << "\033[1;34m approved\033[0m \t\t Only approved plots" << std::endl;
|
96 |
buchmann |
1.1 |
exit(-1);
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
int main (int argc, char ** argv)
|
100 |
|
|
{
|
101 |
|
|
int do_all = false;/// DONE
|
102 |
|
|
int do_peak_finding = false; /// DONE
|
103 |
|
|
int do_kinematic_variables = false; ///DONE
|
104 |
|
|
int do_kinematic_PF_variables = false; ///DONE
|
105 |
|
|
int do_region_comparison = false; /// Comparison between signal and control regions
|
106 |
|
|
int do_lepton_comparison = false; ///DONE
|
107 |
|
|
int do_jzb_plots = false; /// DONE
|
108 |
|
|
int do_pred = false; /// DONE
|
109 |
|
|
bool overlay_signal = false; /// Overlay LM4 signal to predictions
|
110 |
|
|
int do_ratio = false; /// DONE ------------------------------------------- still need to adapt the legend!
|
111 |
|
|
int do_signal_bg_comparison_plot = false; /// DONE
|
112 |
|
|
int do_ttbar_comparison = false; /// DONE
|
113 |
|
|
int do_jzb_efficiency_curve = false; /// DONE
|
114 |
|
|
int do_zjets_comparison = false; /// DONE
|
115 |
buchmann |
1.7 |
int do_diboson_plots = false;
|
116 |
buchmann |
1.1 |
// int calculate_pred_and_observed = false; /// DONE -- now rerouted to the new way of computing results
|
117 |
|
|
// int calculate_yields = false; ///DONE /// superfluous (replaced by get_new_results)
|
118 |
|
|
int get_new_results = false; ///DONE
|
119 |
|
|
bool dopoisson = false;//should we calculate stat err with poisson? ///DONE
|
120 |
|
|
bool verbose = false;//prints out a lot more information ... ///DONE
|
121 |
|
|
//--------------------------------------------
|
122 |
|
|
// Systematics and limits
|
123 |
|
|
int do_compute_systematics=false; /// DONE (might want to add something related to the peak?)
|
124 |
|
|
bool requireZ=true; // should we require a Z for MC efficiency?
|
125 |
|
|
int do_compute_efficiency=false; /// DONE (might want to add something related to the peak?)
|
126 |
|
|
int do_prepare_limits_using_shapes=false; /// ALMOST DONE **************************************
|
127 |
|
|
int do_compute_upper_limits_from_counting_experiment=false; /// DONE
|
128 |
|
|
bool doobserved=false; // want to get the observed limit as well?
|
129 |
|
|
int doquick=1; // this will cause the number of predicted/observed events to hurry up (0 = do mc and all results, 1 = all results but no mc, 2 = don't save results in library and don't compute mc stuff)
|
130 |
buchmann |
1.14 |
int do_compute_upper_limits_from_shapes=false;
|
131 |
buchmann |
1.1 |
|
132 |
|
|
//--------------------------------------------
|
133 |
|
|
// More not-so-standard stuff
|
134 |
|
|
int do_model_scan=false; // this can take days - use the grid version!
|
135 |
|
|
int do_zjet_ttbar_shapes=false; /// DONE
|
136 |
|
|
int do_test=false;/// DONE (just any test you wish)
|
137 |
|
|
int do_pick_up_events=false; ///DONE
|
138 |
|
|
|
139 |
|
|
//--------------------------------------------
|
140 |
|
|
// To be run manually !
|
141 |
|
|
int do_response_correction=false; ///DONE
|
142 |
|
|
//use this to find out the correction factor; originally this was done automatically but now you should do this separately and update Modules/Setup.C
|
143 |
|
|
|
144 |
|
|
int do_sideband_assessment=false;
|
145 |
buchmann |
1.2 |
int do_qcd=false;
|
146 |
buchmann |
1.1 |
|
147 |
|
|
int do_save_template=false;
|
148 |
|
|
int do_mc_yields=false; // compute MC yields
|
149 |
|
|
int do_metjzb=false;
|
150 |
|
|
|
151 |
|
|
int savepdf=true;
|
152 |
|
|
int saveC=true;
|
153 |
|
|
int saveRoot=true;
|
154 |
|
|
int savepng=true;
|
155 |
|
|
int saveeps=false;
|
156 |
|
|
|
157 |
buchmann |
1.3 |
int dooffpeak=true;
|
158 |
buchmann |
1.1 |
int doonpeak=false;
|
159 |
buchmann |
1.16 |
int dobtag=false;
|
160 |
buchmann |
1.1 |
|
161 |
|
|
int do_JES=false;
|
162 |
buchmann |
1.2 |
int do_ptsanity=false;
|
163 |
buchmann |
1.3 |
int do_mlls=false;
|
164 |
buchmann |
1.5 |
int do_met_vs_jzb=false;
|
165 |
buchmann |
1.1 |
|
166 |
|
|
std::string directory="";
|
167 |
|
|
int option_iterator;
|
168 |
|
|
int option_counter=0;
|
169 |
|
|
bool moreoptions=true;
|
170 |
|
|
|
171 |
|
|
string jzbcuts_string="";
|
172 |
|
|
|
173 |
|
|
while(moreoptions) {
|
174 |
|
|
static struct option long_options[] =
|
175 |
|
|
{
|
176 |
|
|
/* These options set a flag. */
|
177 |
|
|
{"all", no_argument, &do_all, 1},
|
178 |
|
|
{"peak", no_argument, &do_peak_finding, 1},
|
179 |
|
|
{"kin", no_argument, &do_kinematic_variables, 1},
|
180 |
|
|
{"pfkin", no_argument, &do_kinematic_PF_variables, 1},
|
181 |
|
|
{"region", no_argument, &do_region_comparison, 1},
|
182 |
|
|
{"lepton", no_argument, &do_lepton_comparison, 1},
|
183 |
|
|
{"jzb", no_argument, &do_jzb_plots, 1},
|
184 |
|
|
{"pred", no_argument, &do_pred, 1},
|
185 |
|
|
{"ratio", no_argument, &do_ratio, 1},
|
186 |
|
|
{"signalbg", no_argument, &do_signal_bg_comparison_plot, 1},
|
187 |
|
|
{"ttbar", no_argument, &do_ttbar_comparison, 1},
|
188 |
|
|
{"zjets", no_argument, &do_zjets_comparison, 1},
|
189 |
buchmann |
1.7 |
{"diboson", no_argument, &do_diboson_plots, 1},
|
190 |
buchmann |
1.1 |
{"results", no_argument, &get_new_results, 1},
|
191 |
|
|
{"syst", no_argument, &do_compute_systematics, 1},
|
192 |
|
|
{"eff", no_argument, &do_compute_efficiency, 1},
|
193 |
|
|
{"shapes", no_argument, &do_prepare_limits_using_shapes, 1},
|
194 |
|
|
{"counting", no_argument, &do_compute_upper_limits_from_counting_experiment, 1},
|
195 |
buchmann |
1.14 |
{"shapelimit",no_argument, &do_compute_upper_limits_from_shapes, 1},
|
196 |
buchmann |
1.2 |
{"ptsanity", no_argument, &do_ptsanity, 1},
|
197 |
buchmann |
1.1 |
{"response", no_argument, &do_response_correction, 1},
|
198 |
|
|
{"pickup", no_argument, &do_pick_up_events, 1},
|
199 |
|
|
{"yields", no_argument, &do_mc_yields, 1},
|
200 |
|
|
{"sideassess",no_argument, &do_sideband_assessment, 1},
|
201 |
buchmann |
1.5 |
{"metvsjzb", no_argument, &do_met_vs_jzb, 1},
|
202 |
buchmann |
1.2 |
{"qcd", no_argument, &do_qcd, 1},
|
203 |
buchmann |
1.1 |
{"save", no_argument, &do_save_template,1},
|
204 |
|
|
{"png", no_argument, &savepng,1},
|
205 |
|
|
{"eps", no_argument, &saveeps,1},
|
206 |
|
|
{"pdf", no_argument, &savepdf,1},
|
207 |
|
|
{"root", no_argument, &saveRoot,1},
|
208 |
|
|
{"C", no_argument, &saveC,1},
|
209 |
|
|
{"offpeak", no_argument, &dooffpeak,1},
|
210 |
|
|
{"onpeak", no_argument, &doonpeak,1},
|
211 |
buchmann |
1.16 |
{"btagged", no_argument, &dobtag,1},
|
212 |
buchmann |
1.1 |
{"met", no_argument, &do_metjzb,1},
|
213 |
|
|
{"jes", no_argument, &do_JES,1},
|
214 |
|
|
{"effcurve", no_argument, &do_jzb_efficiency_curve,1},
|
215 |
|
|
{"public", no_argument, &PlottingSetup::publicmode,1},
|
216 |
|
|
{"paper", no_argument, &PlottingSetup::PaperMode,1},
|
217 |
buchmann |
1.9 |
{"approved", no_argument, &PlottingSetup::Approved,1},
|
218 |
buchmann |
1.3 |
{"mlls", no_argument, &do_mlls,1},
|
219 |
buchmann |
1.1 |
/* The following options store values.*/
|
220 |
|
|
{"jzbcuts", required_argument, 0, 'j'},
|
221 |
|
|
{"dir", required_argument, 0, 'd'},
|
222 |
|
|
{0, 0, 0, 0}
|
223 |
|
|
};
|
224 |
|
|
int option_index = 0;
|
225 |
buchmann |
1.16 |
option_iterator = getopt_long(argc, argv, "abd:j:",long_options, &option_index);
|
226 |
buchmann |
1.1 |
if(option_iterator == -1) moreoptions=false;
|
227 |
|
|
else {
|
228 |
|
|
option_counter++;
|
229 |
|
|
switch (option_iterator)
|
230 |
|
|
{
|
231 |
|
|
case 0:
|
232 |
|
|
if (long_options[option_index].flag != 0)
|
233 |
|
|
break;
|
234 |
|
|
printf ("option %s", long_options[option_index].name);
|
235 |
|
|
if (optarg)
|
236 |
|
|
printf (" with arg %s", optarg);
|
237 |
|
|
printf ("\n");
|
238 |
|
|
break;
|
239 |
|
|
case 'a':
|
240 |
|
|
do_all=true;
|
241 |
|
|
break;
|
242 |
buchmann |
1.16 |
case 'b':
|
243 |
|
|
dobtag=true;
|
244 |
|
|
break;
|
245 |
buchmann |
1.1 |
case 'd':
|
246 |
|
|
directory=(std::string)optarg;
|
247 |
|
|
std::cout<<"Option directory was passed with argument " << optarg << std::endl;
|
248 |
|
|
break;
|
249 |
|
|
case 'j':
|
250 |
|
|
jzbcuts_string=(std::string)optarg;
|
251 |
|
|
std::cout<<"JZB cuts were manually defined:" << optarg << std::endl;
|
252 |
|
|
break;
|
253 |
|
|
case '?':
|
254 |
|
|
usage(option_iterator);
|
255 |
|
|
break;
|
256 |
|
|
default:
|
257 |
|
|
usage(option_iterator);
|
258 |
|
|
}
|
259 |
|
|
}
|
260 |
|
|
}
|
261 |
|
|
|
262 |
|
|
if(directory!="") PlottingSetup::directoryname=directory;
|
263 |
|
|
if(dooffpeak) PlottingSetup::RestrictToMassPeak=false;
|
264 |
|
|
if(doonpeak) PlottingSetup::RestrictToMassPeak=true;
|
265 |
buchmann |
1.16 |
if(dobtag) PlottingSetup::DoBTag=true;
|
266 |
buchmann |
1.1 |
if(option_counter==0) usage();
|
267 |
|
|
|
268 |
buchmann |
1.16 |
|
269 |
|
|
|
270 |
buchmann |
1.1 |
///----------------------------------- BELOW THIS LINE: NO MORE OPTIONS BUT ACTUAL FUNCTION CALLS! ---------------------------------------------------------
|
271 |
|
|
gROOT->SetStyle("Plain");
|
272 |
|
|
bool do_fat_line=false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2
|
273 |
|
|
setTDRStyle(do_fat_line);
|
274 |
|
|
gStyle->SetTextFont(42);
|
275 |
|
|
bool showList=true;
|
276 |
|
|
set_directory(directoryname);//Indicate the directory name where you'd like to save the output files in Setup.C
|
277 |
|
|
set_treename("events");//you can set the treename here to be used; options are "events" (for reco) for "PFevents" (for particle flow)
|
278 |
|
|
// define_samples(showList,allsamples);
|
279 |
buchmann |
1.2 |
define_samples(showList,allsamples,signalsamples,scansample,raresample,systsamples,qcdsamples);
|
280 |
buchmann |
1.1 |
setlumi(luminosity);
|
281 |
|
|
setessentialcut(essential);//this sets the essential cut; this one is used in the draw command so it is AUTOMATICALLY applied everywhere. IMPORTANT: Do NOT store weights here!
|
282 |
|
|
stringstream resultsummary;
|
283 |
|
|
|
284 |
buchmann |
1.11 |
write_analysis_type(PlottingSetup::RestrictToMassPeak,PlottingSetup::DoBTag);
|
285 |
buchmann |
1.1 |
do_png(savepng);
|
286 |
|
|
do_pdf(savepdf);
|
287 |
|
|
do_eps(saveeps);
|
288 |
|
|
do_C(saveC);
|
289 |
|
|
do_root(saveRoot);
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
global_ratio_binning.push_back(0);
|
293 |
|
|
global_ratio_binning.push_back(5);
|
294 |
|
|
global_ratio_binning.push_back(10);
|
295 |
|
|
global_ratio_binning.push_back(20);
|
296 |
|
|
global_ratio_binning.push_back(50);
|
297 |
|
|
global_ratio_binning.push_back(100);
|
298 |
|
|
global_ratio_binning.push_back(200);
|
299 |
|
|
global_ratio_binning.push_back(400);
|
300 |
|
|
//global_ratio_binning.push_back(500);
|
301 |
|
|
|
302 |
|
|
//these are the JZB cuts defining our search regions
|
303 |
|
|
vector<float> jzb_cut; //starting where, please?
|
304 |
|
|
if(jzbcuts_string=="") {
|
305 |
|
|
jzb_cut.push_back(50);
|
306 |
|
|
// jzb_cut.push_back(75);
|
307 |
|
|
jzb_cut.push_back(100);
|
308 |
|
|
// jzb_cut.push_back(125);
|
309 |
|
|
jzb_cut.push_back(150);
|
310 |
|
|
// jzb_cut.push_back(175);
|
311 |
|
|
jzb_cut.push_back(200);
|
312 |
|
|
// jzb_cut.push_back(225);
|
313 |
|
|
jzb_cut.push_back(250);
|
314 |
|
|
// jzb_cut.push_back(275);
|
315 |
|
|
// jzb_cut.push_back(300);
|
316 |
|
|
} else {
|
317 |
|
|
manually_set_jzb_cuts(jzb_cut,jzbcuts_string);
|
318 |
|
|
if(jzb_cut.size()==0) {
|
319 |
|
|
write_error(__FUNCTION__,"There are no jzb cuts!");
|
320 |
|
|
return -1;
|
321 |
|
|
}
|
322 |
|
|
}
|
323 |
|
|
|
324 |
|
|
todo();
|
325 |
buchmann |
1.2 |
|
326 |
buchmann |
1.1 |
//**** part 1 : peak finding
|
327 |
|
|
float MCPeak=0,MCPeakError=0,DataPeak=0,DataPeakError=0,MCSigma=10,DataSigma=10;
|
328 |
|
|
method=Kostasmethod;//Kostasmethod;//dogaus3sigma;// options: dogaus,doKM,dogaus2sigma,dogaus3sigma
|
329 |
buchmann |
1.8 |
//write_warning(__FUNCTION__,"NOT DOING ANY PEAK FINDING ATM");
|
330 |
buchmann |
1.14 |
if(do_peak_finding||PlottingSetup::Approved||do_mlls||do_zjets_comparison||do_sideband_assessment||do_metjzb||do_zjet_ttbar_shapes||do_diboson_plots||do_region_comparison||do_jzb_plots||do_lepton_comparison||do_signal_bg_comparison_plot||do_pred||do_ratio||do_mc_yields||do_save_template||do_compute_upper_limits_from_counting_experiment||do_compute_upper_limits_from_shapes||do_compute_systematics||do_model_scan||do_prepare_limits_using_shapes||do_all||get_new_results||do_ttbar_comparison||do_kinematic_variables||do_kinematic_PF_variables) find_peaks(MCPeak,MCPeakError, DataPeak, DataPeakError,MCSigma,DataSigma,resultsummary);
|
331 |
buchmann |
1.1 |
|
332 |
|
|
stringstream datajzb;
|
333 |
|
|
if(DataPeak>0) datajzb<<"("<<jzbvariabledata<<"-"<<TMath::Abs(DataPeak)<<")";
|
334 |
|
|
else datajzb<<"("<<jzbvariabledata<<"+"<<TMath::Abs(DataPeak)<<")";
|
335 |
|
|
stringstream mcjzb;
|
336 |
|
|
if(MCPeak>0) mcjzb<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeak)<<")";
|
337 |
|
|
else mcjzb<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeak)<<")";
|
338 |
|
|
|
339 |
|
|
dout << "With peak correction, we get : " << endl;
|
340 |
|
|
dout << " Data : " << datajzb.str() << endl;
|
341 |
|
|
dout << " MC : " << mcjzb.str() << endl;
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
|
345 |
|
|
//**** part 2 : kinematic plots
|
346 |
buchmann |
1.9 |
if(do_kinematic_variables||(do_all&&!PlottingSetup::Approved)) do_kinematic_plots(mcjzb.str(),datajzb.str());
|
347 |
buchmann |
1.1 |
if(do_kinematic_PF_variables) do_kinematic_PF_plots(mcjzb.str(),datajzb.str());
|
348 |
|
|
|
349 |
|
|
//**** part 3: Leptonic comparison (ee vs mm, eemm vs emu)
|
350 |
buchmann |
1.9 |
if(do_lepton_comparison||(do_all&&!PlottingSetup::Approved)) lepton_comparison_plots();
|
351 |
buchmann |
1.1 |
|
352 |
|
|
|
353 |
|
|
//**** part 3b: comparison between control regions (SFZPJZBPOS,SFZPJZBNEG,...)
|
354 |
buchmann |
1.9 |
if (do_region_comparison||(do_all&&!PlottingSetup::Approved)) region_comparison_plots(mcjzb.str(),datajzb.str(),jzb_cut);
|
355 |
buchmann |
1.1 |
|
356 |
|
|
//**** part 4: JZB plots (OSOF, OSSF)
|
357 |
|
|
if(do_jzb_plots||do_all) jzb_plots(mcjzb.str(),datajzb.str(),global_ratio_binning);
|
358 |
|
|
|
359 |
|
|
//**** part 5 : Prediction plots
|
360 |
|
|
if(do_pred||do_all) do_prediction_plots(mcjzb.str(),datajzb.str(),DataSigma,MCSigma,overlay_signal);
|
361 |
|
|
|
362 |
|
|
//**** part 6: Ratio plots
|
363 |
buchmann |
1.9 |
if(do_ratio||(do_all&&!PlottingSetup::Approved)) do_ratio_plots(mcjzb.str(),datajzb.str(),global_ratio_binning);
|
364 |
buchmann |
1.1 |
|
365 |
|
|
//**** part 7: Some systematics plots
|
366 |
buchmann |
1.9 |
if(do_signal_bg_comparison_plot||(do_all&&!PlottingSetup::Approved)) signal_bg_comparison();
|
367 |
|
|
if(do_ttbar_comparison||(do_all&&!PlottingSetup::Approved)) ttbar_sidebands_comparison(mcjzb.str(),global_ratio_binning);
|
368 |
buchmann |
1.13 |
if(do_zjets_comparison||(do_all&&!PlottingSetup::Approved)) zjets_prediction_comparison(mcjzb.str());
|
369 |
buchmann |
1.7 |
|
370 |
|
|
if(do_diboson_plots) diboson_plots(mcjzb.str(),datajzb.str(),global_ratio_binning);
|
371 |
buchmann |
1.1 |
|
372 |
buchmann |
1.9 |
if(do_JES||(do_all&&!PlottingSetup::Approved)) make_JES_plot();
|
373 |
buchmann |
1.1 |
|
374 |
buchmann |
1.9 |
if (do_jzb_efficiency_curve) plot_jzb_sel_eff(mcjzb.str(),signalsamples,jzb_cut);
|
375 |
buchmann |
1.1 |
|
376 |
|
|
//**** part 8: observed and predicted!
|
377 |
|
|
if(do_all||get_new_results) doquick=0;
|
378 |
|
|
if(do_save_template) doquick=2;
|
379 |
|
|
if(do_all||do_save_template||do_compute_upper_limits_from_counting_experiment||do_model_scan||get_new_results) get_result(mcjzb.str(),datajzb.str(),DataPeakError,MCPeakError,jzb_cut,verbose,dopoisson,doquick);
|
380 |
|
|
|
381 |
|
|
vector<float>jzb_shape_limit_bins;
|
382 |
buchmann |
1.14 |
jzb_shape_limit_bins.push_back(50);
|
383 |
|
|
jzb_shape_limit_bins.push_back(65.05);
|
384 |
|
|
jzb_shape_limit_bins.push_back(73.4);
|
385 |
|
|
jzb_shape_limit_bins.push_back(88.7);
|
386 |
|
|
jzb_shape_limit_bins.push_back(115.25);
|
387 |
buchmann |
1.12 |
jzb_shape_limit_bins.push_back(200);
|
388 |
|
|
// jzb_shape_limit_bins.push_back(250);
|
389 |
buchmann |
1.1 |
if(do_prepare_limits_using_shapes) prepare_limits(mcjzb.str(),datajzb.str(),DataPeakError,MCPeakError,jzb_shape_limit_bins);
|
390 |
|
|
|
391 |
|
|
//------------------------ end of standard functions
|
392 |
|
|
|
393 |
|
|
// if(calculate_yields||do_all) calculate_all_yields(mcjzb.str(),jzb_cut); // now outdated - get_results now replaces this.
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
vector<vector<float> > all_systematics;
|
397 |
|
|
vector<vector<float> > all_efficiency;
|
398 |
|
|
|
399 |
|
|
if(do_compute_systematics||do_compute_upper_limits_from_counting_experiment||do_all) all_systematics=compute_systematics(mcjzb.str(),MCPeakError,alwaysflip,datajzb.str(),signalsamples,jzb_cut,requireZ);
|
400 |
|
|
// if(do_compute_efficiency) compute_efficiency(mcjzb.str(),allsamples, 50, -200, 300);
|
401 |
|
|
if(do_compute_efficiency) write_warning(__FUNCTION__,"efficiency computation deactivated");
|
402 |
|
|
|
403 |
|
|
if(do_compute_upper_limits_from_counting_experiment||do_all) compute_upper_limits_from_counting_experiment(all_systematics,jzb_cut,mcjzb.str(),doobserved,alwaysflip);
|
404 |
|
|
|
405 |
|
|
//------------------------ end of analysis parts - below: special applications
|
406 |
|
|
|
407 |
buchmann |
1.5 |
if(do_model_scan) scan_SUSY_parameter_space(mcjzb.str(),datajzb.str(),jzb_cut,requireZ,MCPeakError,DataPeakError);
|
408 |
buchmann |
1.1 |
|
409 |
|
|
if(do_zjet_ttbar_shapes) draw_ttbar_and_zjets_shape(mcjzb.str(),datajzb.str());
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
//now do predicted and observed.
|
413 |
|
|
//to that end, we need to consider systematics!
|
414 |
|
|
// systematics come from:
|
415 |
|
|
// Poisson error on pred. contributions (easy)
|
416 |
|
|
// +20%/-40% from MC closure test
|
417 |
|
|
// from peak position --> whenever we want to investigate systematics, peak position must have been set!
|
418 |
|
|
|
419 |
|
|
//jzb response correction
|
420 |
|
|
if(do_response_correction) {
|
421 |
|
|
find_correction_factors(jzbvariabledata,jzbvariablemc);
|
422 |
|
|
dout << "Please update Modules/Setup.C to reflect the following values (round them first ... )" <<endl;
|
423 |
|
|
dout << "Corrected JZB variable definition " << endl << " Data: " << jzbvariabledata << " and MC: " << jzbvariablemc << endl;
|
424 |
|
|
dout << endl;
|
425 |
|
|
dout << "If you're feeling lazy, copy & paste this : " << endl;
|
426 |
|
|
dout << " string jzbvariabledata=\""<<jzbvariabledata<<"\";"<<endl;
|
427 |
|
|
dout << " string jzbvariablemc=\"" <<jzbvariablemc<<"\";"<<endl;
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
if(do_pick_up_events) {
|
431 |
|
|
|
432 |
|
|
dout << "Observed: " << endl;
|
433 |
|
|
pick_up_events((const char*)(cutmass&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
|
434 |
|
|
dout << "Predicted (JZB<-100) OSSF" << endl;
|
435 |
|
|
pick_up_events((const char*)(cutmass&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
|
436 |
|
|
dout << "Predicted (emu, JZB>100) OSOF" << endl;
|
437 |
|
|
pick_up_events((const char*)(cutmass&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
|
438 |
|
|
dout << "Predicted (emu, JZB<-100) OSOF" << endl;
|
439 |
|
|
pick_up_events((const char*)(cutmass&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
|
440 |
|
|
dout << "Predicted (SB SF, JZB>100) OSSF" << endl;
|
441 |
|
|
pick_up_events((const char*)(sidebandcut&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
|
442 |
|
|
dout << "Predicted (SB SF, JZB<-100) OSSF" << endl;
|
443 |
|
|
pick_up_events((const char*)(sidebandcut&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
|
444 |
|
|
dout << "Predicted (SB emu, JZB>100) OSOF" << endl;
|
445 |
|
|
pick_up_events((const char*)(sidebandcut&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
|
446 |
|
|
dout << "Predicted (SB emu, JZB<-100) OSOF" << endl;
|
447 |
|
|
pick_up_events((const char*)(cutOSOF&&cutnJets&&basiccut&&sidebandcut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
|
448 |
|
|
}
|
449 |
|
|
|
450 |
buchmann |
1.14 |
if(do_save_template||do_compute_upper_limits_from_shapes) {
|
451 |
|
|
write_error(__FUNCTION__,"Currently commented out shape storage");
|
452 |
buchmann |
1.16 |
save_template(mcjzb.str(),datajzb.str(),jzb_cut,MCPeakError,DataPeakError,jzb_shape_limit_bins);
|
453 |
|
|
PrepareDataShapes(mcjzb.str(), datajzb.str(), jzb_shape_limit_bins, DataPeakError);
|
454 |
buchmann |
1.6 |
}
|
455 |
buchmann |
1.14 |
|
456 |
|
|
if(do_compute_upper_limits_from_shapes) compute_upper_limits_from_shapes(mcjzb.str(),datajzb.str(),jzb_cut,requireZ, MCPeakError, DataPeakError);
|
457 |
buchmann |
1.1 |
|
458 |
|
|
if(do_sideband_assessment) sideband_assessment(datajzb.str(),30.0,50.0);
|
459 |
|
|
|
460 |
|
|
if(do_mc_yields) compute_MC_yields(mcjzb.str(),jzb_cut);
|
461 |
|
|
|
462 |
|
|
if(do_metjzb) met_jzb_cut(datajzb.str(),mcjzb.str(),jzb_cut);
|
463 |
|
|
|
464 |
buchmann |
1.2 |
if(do_qcd||do_all) qcd_plots(datajzb.str(),mcjzb.str(),jzb_cut);
|
465 |
|
|
|
466 |
buchmann |
1.3 |
if(do_mlls) do_mlls_plot(mcjzb.str());
|
467 |
|
|
|
468 |
buchmann |
1.2 |
if(do_ptsanity) check_ptsanity();
|
469 |
buchmann |
1.3 |
|
470 |
buchmann |
1.5 |
if(do_met_vs_jzb) met_vs_jzb_plots();
|
471 |
buchmann |
1.1 |
if(do_test) test();
|
472 |
|
|
|
473 |
|
|
return 0;
|
474 |
|
|
}
|
475 |
|
|
|
476 |
|
|
|