1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
|
5 |
|
|
#include <TCut.h>
|
6 |
|
|
#include <TROOT.h>
|
7 |
|
|
#include <TCanvas.h>
|
8 |
|
|
#include <TMath.h>
|
9 |
|
|
#include <TColor.h>
|
10 |
|
|
#include <TPaveText.h>
|
11 |
|
|
#include <TRandom.h>
|
12 |
|
|
#include <TH1.h>
|
13 |
|
|
#include <TH2.h>
|
14 |
|
|
#include <TF1.h>
|
15 |
|
|
#include <TSQLResult.h>
|
16 |
|
|
#include <TProfile.h>
|
17 |
|
|
#include <TLegendEntry.h>
|
18 |
|
|
|
19 |
|
|
using namespace std;
|
20 |
|
|
|
21 |
|
|
using namespace PlottingSetup;
|
22 |
|
|
|
23 |
|
|
void todo() {
|
24 |
|
|
dout << "My to do list: " << endl;
|
25 |
|
|
dout << " - ExperimentalModule::Poisson_ratio_plot : Get the second part to work!" << endl;
|
26 |
buchmann |
1.5 |
dout << " - compare_onpeak_offpeak_signal_distributions: Implement this function ... " << endl;
|
27 |
buchmann |
1.1 |
dout << "Info : The trigger requirement is currently set to " << (const char*) passtrig << endl;
|
28 |
buchmann |
1.4 |
dout << "Info : The pt requirement is currently set to " << (const char*) passtrig << endl;
|
29 |
|
|
dout << "Info : The mll requirement is currently set to " << (const char*) cutmass << endl;
|
30 |
|
|
dout << "Info : The lepton requirement is currently set to " << (const char*) leptoncut << endl;
|
31 |
buchmann |
1.1 |
}
|
32 |
|
|
|
33 |
|
|
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &DataSigma, stringstream &result, bool doPUreweighting = true )
|
34 |
|
|
{
|
35 |
|
|
// Temporarily switch off PU reweighting, if asked
|
36 |
|
|
TCut weightbackup=cutWeight;
|
37 |
|
|
if ( !doPUreweighting ) cutWeight="1.0";
|
38 |
|
|
|
39 |
|
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations");
|
40 |
|
|
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity);
|
41 |
|
|
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity);
|
42 |
|
|
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity);
|
43 |
|
|
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity);
|
44 |
|
|
TH1F *rawttbarjzbeemmMC;
|
45 |
|
|
|
46 |
|
|
if(method==doKM) {
|
47 |
|
|
//we only need this histo for the KM fitting...
|
48 |
|
|
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,100, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("TTJet"));
|
49 |
|
|
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method);
|
50 |
|
|
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method);
|
51 |
|
|
}
|
52 |
|
|
else {
|
53 |
|
|
TH1F *reducedMC = (TH1F*)rawJZBeemmMC->Clone();
|
54 |
|
|
TH1F *reducedData = (TH1F*)rawJZBeemmData->Clone();
|
55 |
|
|
reducedMC->Add(rawJZBemMC,-1);
|
56 |
|
|
reducedData->Add(rawJZBemData,-1);
|
57 |
|
|
//this is Kostas' way of doing it - we subtract em to get rid of some of the ttbar contribution (in reality, of flavor-symmetric contribution)
|
58 |
|
|
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method);
|
59 |
|
|
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method);
|
60 |
|
|
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
// Revert to original PU reweighting
|
64 |
|
|
if ( !doPUreweighting ) cutWeight = weightbackup;
|
65 |
|
|
|
66 |
|
|
// MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method);
|
67 |
|
|
// DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method);
|
68 |
|
|
dout << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl;
|
69 |
|
|
result << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl;
|
70 |
|
|
dout << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl;
|
71 |
|
|
result << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl;
|
72 |
|
|
delete tempcan;
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) {
|
76 |
|
|
|
77 |
|
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
|
78 |
|
|
|
79 |
|
|
TH1F *datahistoOSSF = allsamples.Draw("datahistoOSSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&cutnJets&&basiccut,data,luminosity);
|
80 |
|
|
THStack mcstackOSSF = allsamples.DrawStack("mcstackOSSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&cutnJets&&basiccut,mc,luminosity);
|
81 |
|
|
TH1F *datahistoOSOF = allsamples.Draw("datahistoOSOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&cutnJets&&basiccut,data,luminosity);
|
82 |
|
|
|
83 |
|
|
if(logscale) ckin->SetLogy(1);
|
84 |
|
|
datahistoOSSF->SetMarkerSize(DataMarkerSize);
|
85 |
|
|
datahistoOSSF->GetXaxis()->SetTitle(xlabel.c_str());
|
86 |
|
|
datahistoOSSF->GetXaxis()->CenterTitle();
|
87 |
|
|
datahistoOSSF->GetYaxis()->SetTitle("events");
|
88 |
|
|
datahistoOSSF->GetYaxis()->CenterTitle();
|
89 |
|
|
datahistoOSOF->SetMarkerSize(DataMarkerSize);
|
90 |
|
|
datahistoOSSF->SetMarkerSize(DataMarkerSize);
|
91 |
|
|
datahistoOSSF->Draw();
|
92 |
|
|
|
93 |
|
|
mcstackOSSF.Draw("same");
|
94 |
|
|
datahistoOSSF->Draw("same");
|
95 |
|
|
|
96 |
|
|
datahistoOSOF->SetMarkerColor(TColor::GetColor("#FE642E"));
|
97 |
|
|
datahistoOSOF->SetLineColor(kRed);
|
98 |
|
|
datahistoOSOF->SetMarkerStyle(21);
|
99 |
|
|
datahistoOSOF->Draw("same");
|
100 |
|
|
|
101 |
|
|
// Try to re-arrange legend...
|
102 |
|
|
TLegend *bgleg = allsamples.allbglegend("",datahistoOSSF);
|
103 |
|
|
TLegend *kinleg = make_legend();
|
104 |
|
|
kinleg->AddEntry(datahistoOSSF,"SF (data)","p");
|
105 |
|
|
kinleg->AddEntry(datahistoOSOF,"OF (data)","p");
|
106 |
|
|
TIter next(bgleg->GetListOfPrimitives());
|
107 |
|
|
TObject* obj;
|
108 |
|
|
// Copy the nice bkgd legend skipping the "data"
|
109 |
|
|
while ( obj = next() )
|
110 |
|
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") )
|
111 |
|
|
kinleg->GetListOfPrimitives()->Add(obj);
|
112 |
|
|
|
113 |
|
|
kinleg->Draw();
|
114 |
|
|
CompleteSave(ckin,"kin/mll_ossf_osof_distribution");
|
115 |
|
|
|
116 |
|
|
delete datahistoOSOF;
|
117 |
|
|
delete datahistoOSSF;
|
118 |
|
|
delete ckin;
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
void draw_ratio_plot(TH1* hdata, THStack& hmc, float ymin=0.5, float ymax=1.5) {
|
123 |
|
|
|
124 |
|
|
// Make a histogram from stack
|
125 |
|
|
TIter next(hmc.GetHists());
|
126 |
|
|
TObject* obj;
|
127 |
|
|
TH1* hratio = NULL;
|
128 |
|
|
while ( obj = next() ) {
|
129 |
|
|
if ( !hratio ) {
|
130 |
|
|
hratio = (TH1*)obj->Clone();
|
131 |
|
|
hratio->SetName("hratio");
|
132 |
|
|
} else hratio->Add( (TH1*)obj );
|
133 |
|
|
}
|
134 |
|
|
hratio->Divide(hdata);
|
135 |
|
|
hratio->SetMaximum(ymax);
|
136 |
|
|
hratio->SetMinimum(ymin);
|
137 |
|
|
hratio->SetMarkerStyle(2);
|
138 |
|
|
hratio->SetLineWidth(1);
|
139 |
|
|
hratio->GetYaxis()->SetLabelSize(0.08);
|
140 |
|
|
hratio->GetXaxis()->SetLabelSize(0.0);
|
141 |
|
|
|
142 |
|
|
TPad* rpad = new TPad("rpad","",0.15,0.73,0.4,0.88);
|
143 |
|
|
rpad->SetTopMargin(0.0);
|
144 |
|
|
rpad->SetBottomMargin(0.0);
|
145 |
|
|
rpad->SetRightMargin(0.0);
|
146 |
|
|
rpad->Draw();
|
147 |
|
|
rpad->cd();
|
148 |
|
|
// hratio->GetXaxis()->SetNdivisions(0);
|
149 |
|
|
hratio->GetYaxis()->SetNdivisions(502,false);
|
150 |
|
|
hratio->Draw("e1x0");
|
151 |
|
|
|
152 |
|
|
TF1* oneline = new TF1("","1.0",0,1000);
|
153 |
|
|
oneline->SetLineColor(kBlue);
|
154 |
|
|
oneline->SetLineStyle(1);
|
155 |
|
|
oneline->SetLineWidth(1);
|
156 |
|
|
oneline->Draw("same");
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
float lastrange_min=0;
|
160 |
|
|
float lastrange_max=0;
|
161 |
|
|
|
162 |
|
|
void make_kin_plot(string variable, string addcut, int nbins, float min, float max, bool logscale,
|
163 |
|
|
string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false ) {
|
164 |
|
|
// TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)");
|
165 |
|
|
TCut ibasiccut=basiccut;
|
166 |
|
|
bool draw_separation_lines=false;
|
167 |
|
|
|
168 |
|
|
if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998";
|
169 |
|
|
|
170 |
|
|
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str();
|
171 |
|
|
|
172 |
|
|
//Step 1: Adapt the variable (if we're dealing with PF we need to adapt the variable!)
|
173 |
|
|
if(isPF) {
|
174 |
|
|
if(variable=="mll") variable="pfmll[0]";
|
175 |
|
|
if(variable=="jetpt[0]") variable="pfJetGoodPt[0]";
|
176 |
|
|
if(variable=="jeteta[0]") variable="pfJetGoodEta[0]";
|
177 |
|
|
if(variable=="pt") variable="pfpt[0]";
|
178 |
|
|
if(variable=="pt1") variable="pfpt1[0]";
|
179 |
|
|
if(variable=="pt2") variable="pfpt2[0]";
|
180 |
|
|
if(variable=="eta1") variable="pfeta1[0]";
|
181 |
|
|
if(variable=="jzb[1]") variable="pfjzb[0]";
|
182 |
|
|
//if(variable=="pfJetGoodNum") variable="pfJetGoodNum"; // pointless.
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
//Step 2: Refine the cut
|
186 |
|
|
TCut cut;
|
187 |
|
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
|
188 |
|
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut;
|
189 |
|
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
|
190 |
|
|
if(filename=="mll") {
|
191 |
|
|
cut=cutOSSF&&cutnJets&&ibasiccut;
|
192 |
|
|
draw_separation_lines=true;
|
193 |
|
|
}
|
194 |
|
|
if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
|
195 |
|
|
if(filename=="mll_osof") {
|
196 |
|
|
cut=cutOSOF&&cutnJets&&ibasiccut;
|
197 |
|
|
draw_separation_lines=true;
|
198 |
|
|
}
|
199 |
|
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
|
200 |
|
|
if(filename=="mll_aboveJZB100") cut=cutOSSF&&cutnJets&&ibasiccut;
|
201 |
|
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF;
|
202 |
|
|
if(filename=="mll_inclusive_osof") cut=cutOSOF;
|
203 |
|
|
if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0";
|
204 |
|
|
if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1";
|
205 |
|
|
if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
|
206 |
|
|
if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
|
207 |
|
|
|
208 |
|
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
|
209 |
|
|
ckin->SetLogy(logscale);
|
210 |
|
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
|
211 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
212 |
|
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity);
|
213 |
|
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum());
|
214 |
|
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum());
|
215 |
|
|
if(filename=="mll_inclusive") datahisto->SetMinimum(1);
|
216 |
|
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum());
|
217 |
|
|
if(filename=="mll_osof") datahisto->SetMinimum(9);
|
218 |
|
|
|
219 |
|
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum());
|
220 |
|
|
datahisto->Draw("e1");
|
221 |
|
|
ckin->Update();
|
222 |
|
|
if(loadlastminmax) {
|
223 |
|
|
datahisto->SetMinimum(lastrange_min);
|
224 |
|
|
datahisto->SetMaximum(lastrange_max);
|
225 |
|
|
if(logscale) {
|
226 |
|
|
datahisto->SetMinimum(pow(10,lastrange_min));
|
227 |
|
|
datahisto->SetMaximum(pow(10,lastrange_max));
|
228 |
|
|
}
|
229 |
|
|
}
|
230 |
|
|
|
231 |
|
|
mcstack.Draw("same");
|
232 |
|
|
datahisto->Draw("same,e1");
|
233 |
|
|
TLegend *kinleg = allsamples.allbglegend();
|
234 |
|
|
kinleg->Draw();
|
235 |
|
|
if(filename=="mll_osof") {
|
236 |
|
|
kinleg->SetHeader("Opposite flavor");
|
237 |
|
|
kinleg->SetX1(0.58);
|
238 |
|
|
}
|
239 |
|
|
if(filename=="mll") {
|
240 |
|
|
kinleg->SetHeader("Same flavor");
|
241 |
|
|
kinleg->SetX1(0.58);
|
242 |
|
|
}
|
243 |
|
|
TText* write_cut = write_cut_on_canvas(decipher_cut(cut,basicqualitycut));
|
244 |
|
|
write_cut->Draw();
|
245 |
|
|
TText* write_variable = write_text(0.99,0.01,variable);
|
246 |
|
|
write_variable->SetTextAlign(31);
|
247 |
|
|
write_variable->SetTextSize(0.02);
|
248 |
|
|
|
249 |
|
|
TLine *lowerboundary;
|
250 |
|
|
TLine *upperboundary;
|
251 |
|
|
|
252 |
|
|
if(RestrictToMassPeak&&draw_separation_lines) {
|
253 |
|
|
Color_t linecolor=kBlue;
|
254 |
|
|
float linemin=pow(10,ckin->GetUymin());
|
255 |
|
|
if(filename=="mll_osof") linemin=pow(10,lastrange_min);
|
256 |
|
|
lowerboundary = new TLine(71,linemin,71,datahisto->GetMaximum());
|
257 |
|
|
upperboundary = new TLine(111,linemin,111,datahisto->GetMaximum());
|
258 |
|
|
lowerboundary->SetLineColor(linecolor);
|
259 |
|
|
lowerboundary->SetLineStyle(2);
|
260 |
|
|
upperboundary->SetLineColor(linecolor);
|
261 |
|
|
upperboundary->SetLineStyle(2);
|
262 |
|
|
}
|
263 |
|
|
|
264 |
|
|
lastrange_min=ckin->GetUymin();
|
265 |
|
|
lastrange_max=ckin->GetUymax();
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
if ( plotratio ) {
|
269 |
|
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
|
270 |
|
|
kinpad->cd();
|
271 |
|
|
kinpad->SetLogy(logscale);
|
272 |
|
|
datahisto->Draw("e1");
|
273 |
|
|
mcstack.Draw("same");
|
274 |
|
|
datahisto->Draw("same,e1");
|
275 |
|
|
datahisto->Draw("same,axis");
|
276 |
|
|
if(RestrictToMassPeak&&draw_separation_lines) {
|
277 |
|
|
lowerboundary->Draw("same");
|
278 |
|
|
upperboundary->Draw("same");
|
279 |
|
|
}
|
280 |
|
|
|
281 |
|
|
kinleg->Draw();
|
282 |
|
|
write_cut->Draw();
|
283 |
|
|
DrawPrelim();
|
284 |
|
|
string saveas="kin/"+filename;
|
285 |
|
|
if(isPF) saveas="kin/"+filename+"__PF";
|
286 |
|
|
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
|
287 |
|
|
// if(isPF) CompleteSave(with_ratio,"kin/"+filename+"__PF_withratio");
|
288 |
|
|
// else CompleteSave(with_ratio,"kin/"+filename+"_withratio");
|
289 |
|
|
// delete with_ratio;
|
290 |
|
|
} else {
|
291 |
|
|
if(isPF) CompleteSave(ckin,"kin/"+filename+"__PF");
|
292 |
|
|
else CompleteSave(ckin,"kin/"+filename);
|
293 |
|
|
}
|
294 |
|
|
datahisto->Delete();
|
295 |
|
|
delete ckin;
|
296 |
|
|
}
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
void make_JES_plot() {
|
300 |
|
|
|
301 |
|
|
int nbins=10;
|
302 |
|
|
float min=-0.5;
|
303 |
|
|
float max = 9.5;
|
304 |
|
|
bool logscale=true;
|
305 |
|
|
string xlabel="nJets";
|
306 |
|
|
TCut cut=cutmass&&cutOSSF&&basiccut;
|
307 |
|
|
|
308 |
|
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
|
309 |
|
|
ckin->SetLogy(logscale);
|
310 |
|
|
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity);
|
311 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
312 |
|
|
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity);
|
313 |
|
|
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum315",nbins,min,max, xlabel, "events",cut,mc,luminosity);
|
314 |
|
|
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum285",nbins,min,max, xlabel, "events",cut,mc,luminosity);
|
315 |
|
|
|
316 |
|
|
datahisto->SetMinimum(1);
|
317 |
|
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style
|
318 |
|
|
|
319 |
|
|
float xs[nbins],ys[nbins],exs[nbins],eys[nbins];
|
320 |
|
|
for(int i=1;i<JESup->GetNbinsX();i++) {
|
321 |
|
|
float up=JESup->GetBinContent(i);
|
322 |
|
|
float dn=JESdn->GetBinContent(i);
|
323 |
|
|
xs[i]=JESup->GetBinCenter(i);
|
324 |
|
|
ys[i]=0.5*(up+dn);
|
325 |
|
|
exs[i]=0.5*JESup->GetBinWidth(i);
|
326 |
|
|
eys[i]=0.5*TMath::Abs(up-dn);
|
327 |
|
|
}
|
328 |
|
|
|
329 |
|
|
TGraphAsymmErrors *JESunc = new TGraphAsymmErrors(nbins, xs,ys,exs,exs,eys,eys);
|
330 |
|
|
JESunc->SetFillColor(TColor::GetColor("#00ADE1"));
|
331 |
|
|
JESunc->SetFillStyle(3002);
|
332 |
|
|
datahisto->Draw("e1");
|
333 |
|
|
mcstack.Draw("same");
|
334 |
|
|
JESunc->Draw("2");
|
335 |
|
|
datahisto->Draw("same,e1");
|
336 |
|
|
TLegend *kinleg = allsamples.allbglegend();
|
337 |
|
|
kinleg->AddEntry(JESunc,"JES uncertainty","f");
|
338 |
|
|
kinleg->Draw();
|
339 |
|
|
CompleteSave(ckin,"Systematics/JES");
|
340 |
|
|
datahisto->Delete();
|
341 |
|
|
delete ckin;
|
342 |
|
|
|
343 |
|
|
}
|
344 |
|
|
|
345 |
|
|
void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
|
346 |
|
|
{
|
347 |
|
|
bool dolog=true;
|
348 |
|
|
bool nolog=false;
|
349 |
|
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
|
350 |
|
|
float mll_low=40;
|
351 |
buchmann |
1.2 |
float mll_hi=160;
|
352 |
|
|
if(!PlottingSetup::RestrictToMassPeak) {
|
353 |
|
|
mll_low=30;
|
354 |
|
|
mll_hi=180;
|
355 |
|
|
}
|
356 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
|
357 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
|
358 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
|
359 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true);
|
360 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
|
361 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
|
362 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
|
363 |
|
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
|
364 |
buchmann |
1.1 |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
|
365 |
|
|
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
|
366 |
|
|
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
|
367 |
|
|
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF);
|
368 |
|
|
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF);
|
369 |
|
|
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF);
|
370 |
|
|
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF);
|
371 |
|
|
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF);
|
372 |
|
|
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF);
|
373 |
|
|
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
|
374 |
buchmann |
1.2 |
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
|
375 |
buchmann |
1.1 |
stringstream jzbcut;
|
376 |
|
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
|
377 |
buchmann |
1.2 |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
|
378 |
buchmann |
1.1 |
}
|
379 |
|
|
|
380 |
|
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb,
|
381 |
|
|
int nbins, float xmin, float xmax, bool log,
|
382 |
|
|
float ymin=0, float ymax=0, bool leftJustified=false ) {
|
383 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed!
|
384 |
|
|
|
385 |
|
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!)
|
386 |
|
|
if(weightbackup==TCut("1.0")||weightbackup==TCut("1")) write_warning(__FUNCTION__,"WATCH OUT THE WEIGHT HAS POSSIBLY NOT BEEN RESET!!!! PLEASE CHANGE LINE "+any2string(__LINE__));
|
387 |
|
|
if(var=="numVtx") cutWeight=TCut("1.0");
|
388 |
|
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) };
|
389 |
|
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) };
|
390 |
|
|
|
391 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed!
|
392 |
|
|
int nRegions=4;
|
393 |
|
|
if(!PlottingSetup::RestrictToMassPeak) {
|
394 |
|
|
nRegions=2;
|
395 |
|
|
}
|
396 |
|
|
|
397 |
|
|
string sRegions[] = { "SFZP","OFZP","SFSB","OFSB" };
|
398 |
|
|
TCut kRegions[] = { cutOSSF&&cutnJets&&cutmass, cutOSOF&&cutnJets&&cutmass,
|
399 |
|
|
cutOSSF&&cutnJets&&sidebandcut, cutOSOF&&cutnJets&&sidebandcut };
|
400 |
|
|
|
401 |
|
|
//find ymax
|
402 |
|
|
TH1F *Refdatahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[0]&&jzbData[0],data,luminosity);
|
403 |
|
|
ymax=int((Refdatahisto->GetMaximum()+2*TMath::Sqrt(Refdatahisto->GetMaximum()))*1.2+0.5);
|
404 |
|
|
delete Refdatahisto;
|
405 |
|
|
|
406 |
|
|
for ( int iregion=0; iregion<nRegions; ++iregion )
|
407 |
|
|
for ( int ijzb=0; ijzb<2; ++ijzb ) {
|
408 |
|
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400);
|
409 |
|
|
ccomp->SetLogy(log);
|
410 |
|
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity);
|
411 |
|
|
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM4"));
|
412 |
|
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity);
|
413 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
414 |
|
|
if (ymax>ymin) datahisto->SetMaximum(ymax);
|
415 |
|
|
lm4histo->SetLineStyle(2);
|
416 |
|
|
datahisto->Draw("e1");
|
417 |
|
|
mcstack.Draw("same");
|
418 |
|
|
datahisto->Draw("same,e1");
|
419 |
|
|
// lm4histo->Draw("hist,same");
|
420 |
|
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str());
|
421 |
|
|
if ( leftJustified ) {
|
422 |
|
|
Float_t w = kinleg->GetX2()-kinleg->GetX1();
|
423 |
|
|
kinleg->SetX1(0.2);
|
424 |
|
|
kinleg->SetX2(0.2+w);
|
425 |
|
|
}
|
426 |
|
|
// kinleg->AddEntry(lm4histo,"LM4","l");
|
427 |
|
|
kinleg->Draw();
|
428 |
|
|
TText* write_variable = write_text(0.99,0.01,var);
|
429 |
|
|
write_variable->SetTextAlign(31);
|
430 |
|
|
write_variable->SetTextSize(0.02);
|
431 |
|
|
ccomp->RedrawAxis();
|
432 |
|
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos"));
|
433 |
|
|
delete datahisto;
|
434 |
|
|
delete ccomp;
|
435 |
|
|
delete lm4histo;
|
436 |
|
|
}
|
437 |
|
|
cutWeight=weightbackup;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
void region_comparison_plots(string mcjzb, string datajzb, vector<float> jzb_cuts) {
|
442 |
|
|
dout << "Creating comparison plots for signal and control regions" << endl;
|
443 |
|
|
// Compare a few quantities in the signal region and all 7 control regions
|
444 |
|
|
|
445 |
|
|
switch_overunderflow(true); // switching overflow/underflow bins on
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed
|
449 |
|
|
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) {
|
450 |
|
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut
|
451 |
|
|
float mll_low=50;float mll_high=170;
|
452 |
|
|
if(!PlottingSetup::RestrictToMassPeak) {
|
453 |
|
|
mll_high=200;
|
454 |
|
|
mll_low=50;
|
455 |
|
|
}
|
456 |
|
|
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.);
|
457 |
|
|
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.);
|
458 |
|
|
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.);
|
459 |
|
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.);
|
460 |
|
|
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.);
|
461 |
|
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true);
|
462 |
|
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true);
|
463 |
|
|
}
|
464 |
|
|
|
465 |
|
|
switch_overunderflow(false); // switching overflow/underflow bins off
|
466 |
|
|
}
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
void do_kinematic_PF_plots(string mcjzb, string datajzb)
|
471 |
|
|
{
|
472 |
|
|
do_kinematic_plots(mcjzb,datajzb,true);
|
473 |
|
|
}
|
474 |
|
|
|
475 |
|
|
void signal_bg_comparison()
|
476 |
|
|
{
|
477 |
|
|
TCanvas *can = new TCanvas("can","Signal Background Comparison Canvas");
|
478 |
|
|
can->SetLogy(1);
|
479 |
|
|
|
480 |
|
|
int sbg_nbins=130;
|
481 |
|
|
float sbg_min=-500; //-110;
|
482 |
|
|
float sbg_max=800; //jzbHigh;
|
483 |
|
|
|
484 |
|
|
float simulatedlumi=luminosity;//in pb please - adjust to your likings
|
485 |
|
|
|
486 |
buchmann |
1.3 |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/DY"));
|
487 |
buchmann |
1.7 |
TH1F *JZBplotLM4;
|
488 |
|
|
if(PlottingSetup::RestrictToMassPeak) JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4"));
|
489 |
|
|
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3"));
|
490 |
buchmann |
1.1 |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets"));
|
491 |
|
|
|
492 |
|
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet"));
|
493 |
|
|
JZBplotZJETs->SetFillColor(allsamples.GetColor("DY"));
|
494 |
|
|
JZBplotZJETs->SetLineColor(kBlack);
|
495 |
|
|
JZBplotLM4->SetLineStyle(2);
|
496 |
|
|
JZBplotZJETs->SetMaximum(JZBplotZJETs->GetMaximum()*5);
|
497 |
|
|
JZBplotZJETs->SetMinimum(1);
|
498 |
|
|
|
499 |
|
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum());
|
500 |
|
|
JZBplotTtbar->SetMinimum(0.01);
|
501 |
|
|
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets"));
|
502 |
|
|
JZBplotTtbar->DrawClone("histo");
|
503 |
|
|
JZBplotZJETs->Draw("histo,same");
|
504 |
|
|
JZBplotTtbar->SetFillColor(0);
|
505 |
|
|
JZBplotTtbar->DrawClone("histo,same");
|
506 |
|
|
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets"));
|
507 |
|
|
JZBplotLM4->Draw("histo,same");
|
508 |
buchmann |
1.7 |
write_warning(__FUNCTION__,"Please remove this line!");JZBplotLM4->Draw("histo");cout << JZBplotLM4->Integral() << endl;
|
509 |
buchmann |
1.1 |
|
510 |
|
|
|
511 |
|
|
TLegend *signal_bg_comparison_leg2 = make_legend("",0.55,0.75,false);
|
512 |
|
|
signal_bg_comparison_leg2->AddEntry(JZBplotZJETs,"Z+Jets","f");
|
513 |
|
|
signal_bg_comparison_leg2->AddEntry(JZBplotTtbar,"t#bar{t}","f");
|
514 |
buchmann |
1.7 |
if(PlottingSetup::RestrictToMassPeak) signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f");
|
515 |
|
|
else signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM3","f");
|
516 |
buchmann |
1.1 |
signal_bg_comparison_leg2->Draw();
|
517 |
|
|
DrawMCPrelim(simulatedlumi);
|
518 |
|
|
CompleteSave(can,"jzb_bg_vs_signal_distribution");
|
519 |
|
|
|
520 |
|
|
// Define illustrative set of SMS points
|
521 |
|
|
TCut kSMS1("MassGlu==250&&MassLSP==75");
|
522 |
|
|
TCut kSMS2("MassGlu==800&&MassLSP==200");
|
523 |
|
|
TCut kSMS3("MassGlu==1050&&MassLSP==850");
|
524 |
|
|
TCut kSMS4("MassGlu==1200&&MassLSP==100");
|
525 |
|
|
|
526 |
|
|
//If the scan samples haven't been loaded yet, this is a good point to load them (all of them!)
|
527 |
|
|
if((scansample.collection).size()<2) define_SMS_sample(false, allsamples, signalsamples, scansample, true); // loading ALL zones for the scans, not only the basic one.
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
TH1F *JZBplotSMS1 = scansample.Draw("JZBplotSMS1",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&kSMS1,mc,simulatedlumi,scansample.FindSample("t"));
|
531 |
|
|
JZBplotSMS1->Scale(JZBplotLM4->Integral()/JZBplotSMS1->Integral());
|
532 |
|
|
|
533 |
|
|
TH1F *JZBplotSMS2 = scansample.Draw("JZBplotSMS2",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&kSMS2,mc,simulatedlumi,scansample.FindSample("t"));
|
534 |
|
|
JZBplotSMS2->Scale(JZBplotLM4->Integral()/JZBplotSMS2->Integral());
|
535 |
|
|
|
536 |
|
|
TH1F *JZBplotSMS3 = scansample.Draw("JZBplotSMS3",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&kSMS3,mc,simulatedlumi,scansample.FindSample("t"));
|
537 |
|
|
JZBplotSMS3->Scale(JZBplotLM4->Integral()/JZBplotSMS3->Integral());
|
538 |
|
|
|
539 |
|
|
TH1F *JZBplotSMS4 = scansample.Draw("JZBplotSMS4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&kSMS4,mc,simulatedlumi,scansample.FindSample("t"));
|
540 |
|
|
JZBplotSMS4->Scale(JZBplotLM4->Integral()/JZBplotSMS4->Integral());
|
541 |
|
|
|
542 |
|
|
// Draw all plots overlaid
|
543 |
|
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum());
|
544 |
|
|
JZBplotTtbar->SetMinimum(0.01);
|
545 |
|
|
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets"));
|
546 |
|
|
JZBplotTtbar->DrawClone("histo");
|
547 |
|
|
JZBplotZJETs->Draw("histo,same");
|
548 |
|
|
JZBplotTtbar->SetFillColor(0);
|
549 |
|
|
JZBplotTtbar->DrawClone("histo,same");
|
550 |
|
|
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets"));
|
551 |
|
|
|
552 |
|
|
JZBplotSMS1->SetLineColor(kRed+1);
|
553 |
|
|
JZBplotSMS2->SetLineColor(kBlue+1);
|
554 |
|
|
JZBplotSMS3->SetLineColor(kRed+1);
|
555 |
|
|
JZBplotSMS4->SetLineColor(kBlue+1);
|
556 |
|
|
JZBplotSMS3->SetLineStyle(2);
|
557 |
|
|
JZBplotSMS4->SetLineStyle(2);
|
558 |
|
|
|
559 |
|
|
JZBplotSMS1->Draw("histo,same");
|
560 |
|
|
JZBplotSMS2->Draw("histo,same");
|
561 |
|
|
JZBplotSMS3->Draw("histo,same");
|
562 |
|
|
JZBplotSMS4->Draw("histo,same");
|
563 |
|
|
JZBplotLM4->SetLineColor(kGreen);JZBplotLM4->Draw("histo,same");
|
564 |
|
|
TLegend *signal_bg_comparison_leg6 = make_legend("",0.55,0.55,false);
|
565 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotZJETs,"Z+Jets","f");
|
566 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotTtbar,"t#bar{t}","f");
|
567 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotSMS1,"","");
|
568 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotSMS1,"SMS parameters","");
|
569 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotSMS1,"(250,75) [GeV]","f");
|
570 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotSMS2,"(800,200) [GeV]","f");
|
571 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotSMS3,"(1050,850) [GeV]","f");
|
572 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotSMS4,"(1200,100) [GeV]","f");
|
573 |
|
|
signal_bg_comparison_leg6->AddEntry(JZBplotLM4,"LM4","f");
|
574 |
|
|
signal_bg_comparison_leg6->Draw();
|
575 |
|
|
DrawMCPrelim(simulatedlumi);
|
576 |
|
|
CompleteSave(can,"jzb_bg_vs_signal_distribution_SMS__summary");
|
577 |
|
|
|
578 |
|
|
while((scansample.collection).size() > 1) scansample.RemoveLastSample();
|
579 |
|
|
|
580 |
|
|
}
|
581 |
|
|
|
582 |
|
|
vector<TF1*> do_cb_fit_to_plot(TH1F *histo, float Sigma, float doingfitacrosstheboard=false) {
|
583 |
|
|
TF1 *BpredFunc = new TF1("BpredFunc",InvCrystalBall,0,1000,5);
|
584 |
|
|
BpredFunc->SetParameter(0,histo->GetBinContent(1));
|
585 |
|
|
if(doingfitacrosstheboard) BpredFunc->SetParameter(0,histo->GetMaximum());
|
586 |
|
|
BpredFunc->SetParameter(1,0.);
|
587 |
|
|
if(method==1) BpredFunc->SetParameter(2,10*Sigma);//KM
|
588 |
|
|
else BpredFunc->SetParameter(2,Sigma);//Gaussian based methods
|
589 |
|
|
if(method==-99) BpredFunc->SetParameter(2,2.0*Sigma);//Kostas
|
590 |
|
|
BpredFunc->SetParameter(3,1.8);
|
591 |
|
|
BpredFunc->SetParameter(4,2.5);
|
592 |
|
|
histo->Fit(BpredFunc,"QN0");
|
593 |
|
|
BpredFunc->SetLineColor(kBlue);
|
594 |
|
|
|
595 |
|
|
TF1 *BpredFuncP = new TF1("BpredFuncP",InvCrystalBallP,-1000,histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX()),5);
|
596 |
|
|
TF1 *BpredFuncN = new TF1("BpredFuncN",InvCrystalBallN,-1000,histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX()),5);
|
597 |
|
|
|
598 |
|
|
BpredFuncP->SetParameters(BpredFunc->GetParameters());
|
599 |
|
|
BpredFuncP->SetLineColor(kBlue);
|
600 |
|
|
BpredFuncP->SetLineStyle(2);
|
601 |
|
|
|
602 |
|
|
BpredFuncN->SetParameters(BpredFunc->GetParameters());
|
603 |
|
|
BpredFuncN->SetLineColor(kBlue);
|
604 |
|
|
BpredFuncN->SetLineStyle(2);
|
605 |
|
|
|
606 |
|
|
vector<TF1*> functions;
|
607 |
|
|
functions.push_back(BpredFuncN);
|
608 |
|
|
functions.push_back(BpredFunc);
|
609 |
|
|
functions.push_back(BpredFuncP);
|
610 |
|
|
return functions;
|
611 |
|
|
}
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
TF1* do_logpar_fit_to_plot(TH1F *osof) {
|
615 |
|
|
TCanvas *logpar_fit_can = new TCanvas("logpar_fit_can","Fit canvas for LogPar");
|
616 |
|
|
TF1 *logparfunc = new TF1("logparfunc",LogParabola,0,300,3);
|
617 |
|
|
TF1 *logparfunc2 = new TF1("logparfunc2",LogParabola,0,(osof->GetXaxis()->GetBinLowEdge(osof->GetNbinsX())+osof->GetXaxis()->GetBinWidth(osof->GetNbinsX())),3);
|
618 |
|
|
TF1 *logparfuncN = new TF1("logparfuncN",LogParabolaN,0,(osof->GetXaxis()->GetBinLowEdge(osof->GetNbinsX())+osof->GetXaxis()->GetBinWidth(osof->GetNbinsX())),3);
|
619 |
|
|
TF1 *logparfuncP = new TF1("logparfuncP",LogParabolaP,0,(osof->GetXaxis()->GetBinLowEdge(osof->GetNbinsX())+osof->GetXaxis()->GetBinWidth(osof->GetNbinsX())),3);
|
620 |
|
|
osof->SetMinimum(0);
|
621 |
|
|
osof->Fit(logparfunc,"QR");
|
622 |
|
|
osof->Draw();
|
623 |
|
|
logparfunc->SetLineWidth(2);
|
624 |
|
|
logparfunc2->SetParameters(logparfunc->GetParameters());
|
625 |
|
|
logparfuncN->SetParameters(logparfunc->GetParameters());
|
626 |
|
|
logparfuncP->SetParameters(logparfunc->GetParameters());
|
627 |
|
|
stringstream fitinfo;
|
628 |
|
|
fitinfo << "#Chi^{2} / NDF : " << logparfunc->GetChisquare() << " / " << logparfunc->GetNDF();
|
629 |
|
|
TText *writefitinfo = write_text(0.8,0.8,fitinfo.str());
|
630 |
|
|
writefitinfo->SetTextSize(0.03);
|
631 |
|
|
DrawPrelim();
|
632 |
|
|
writefitinfo->Draw();
|
633 |
|
|
logparfunc->Draw("same");
|
634 |
|
|
logparfunc2->Draw("same");
|
635 |
|
|
logparfuncN->SetLineStyle(2);
|
636 |
|
|
logparfuncP->SetLineStyle(2);
|
637 |
|
|
logparfuncN->Draw("same");
|
638 |
|
|
logparfuncP->Draw("same");
|
639 |
|
|
CompleteSave(logpar_fit_can,"MakingOfBpredFunction/Bpred_Data_LogPar_Fit_To_TTbarPred");
|
640 |
|
|
delete logpar_fit_can;
|
641 |
|
|
return logparfunc2;
|
642 |
|
|
}
|
643 |
|
|
|
644 |
|
|
vector<TF1*> do_extended_fit_to_plot(TH1F *prediction, TH1F *Tprediction, TH1F *ossf, TH1F *osof,int isdata) {
|
645 |
|
|
/* there are mainly two background contributions: Z+Jets (a) and ttbar (b). So:
|
646 |
|
|
a) The case is clear - we take the OSSF prediction - OSOF prediction, and fit a crystal ball function to it. We then extract the CB parameters.
|
647 |
|
|
b) For ttbar, we use the OSOF distribution and look at the [10,100] GeV JZB range, and fit our log parabola. We then extract the LP parameters.
|
648 |
|
|
Once we have these two components, we use the combined parameters to get the final function and we're done.
|
649 |
|
|
*/
|
650 |
|
|
//Step 1: take the OSSF prediction - OSOF prediction, and fit a crystal ball function to it
|
651 |
|
|
TH1F *step1cb = (TH1F*)ossf->Clone("step1cb");
|
652 |
|
|
step1cb->Add(osof,-1);
|
653 |
|
|
vector<TF1*> functions = do_cb_fit_to_plot(step1cb,PlottingSetup::JZBPeakWidthData);
|
654 |
|
|
TF1 *zjetscrystalball = functions[1];
|
655 |
|
|
|
656 |
|
|
//Step 2: use the OSOF distribution and look at the [10,100] GeV JZB range, and fit our log parabola
|
657 |
|
|
// TH1F *ttbarprediction=(TH1F*)prediction->Clone("ttbarprediction");
|
658 |
|
|
// ttbarprediction->Add(ossf,-1);//without the Z+Jets estimate, this is really just the ttbar estimate!
|
659 |
|
|
// the line above is not necessary anymore as we're now looking at a prediction without Z+Jets, and not multiplied with (1.0/3)
|
660 |
|
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction);
|
661 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
|
662 |
|
|
if(PlottingSetup::RestrictToMassPeak) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3);
|
663 |
|
|
|
664 |
|
|
|
665 |
|
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
|
666 |
|
|
TF1 *ttbarlogparN = new TF1("ttbarlogparN",LogParabolaN,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
|
667 |
|
|
|
668 |
|
|
//and now fuse the two!
|
669 |
|
|
TF1 *kmlp = new TF1("kmlp", CrystalBallPlusLogParabola, 0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
|
670 |
|
|
TF1 *kmlpP= new TF1("kmlpP",CrystalBallPlusLogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
|
671 |
|
|
TF1 *kmlpN= new TF1("kmlpN",CrystalBallPlusLogParabolaN,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
|
672 |
|
|
double kmlp_pars[10];
|
673 |
|
|
for(int i=0;i<5;i++) kmlp_pars[i]=zjetscrystalball->GetParameter(i);
|
674 |
|
|
for(int i=0;i<3;i++) kmlp_pars[5+i]=ttbarlogpar->GetParameter(i);
|
675 |
|
|
ttbarlogparP->SetParameters(ttbarlogpar->GetParameters());
|
676 |
|
|
ttbarlogparN->SetParameters(ttbarlogpar->GetParameters());
|
677 |
|
|
kmlp->SetParameters(kmlp_pars);
|
678 |
|
|
prediction->Fit(kmlp,"Q");//fitting the final result (done this in the past but kicked it)
|
679 |
|
|
/*
|
680 |
|
|
if you want to start from scratch (without the partial fitting and only fitting the whole thing, some good start values could be :
|
681 |
|
|
*/
|
682 |
|
|
kmlp_pars[0]=kmlp->GetParameter(0);
|
683 |
|
|
kmlp_pars[1]=3.6198;
|
684 |
|
|
kmlp_pars[2]=16.4664;
|
685 |
|
|
kmlp_pars[3]=1.92253;
|
686 |
|
|
kmlp_pars[4]=3.56099;
|
687 |
|
|
kmlp_pars[5]=5.83;
|
688 |
|
|
kmlp_pars[6]=0.000757479;
|
689 |
|
|
kmlp_pars[7]=95.6157;
|
690 |
|
|
kmlp_pars[8]=0;
|
691 |
|
|
kmlp_pars[9]=0;
|
692 |
|
|
kmlp->SetParameters(kmlp_pars);
|
693 |
|
|
/**/
|
694 |
|
|
prediction->Fit(kmlp,"Q");//fitting the final result (done this in the past but kicked it)
|
695 |
|
|
|
696 |
|
|
kmlpP->SetParameters(kmlp->GetParameters());
|
697 |
|
|
kmlpN->SetParameters(kmlp->GetParameters());
|
698 |
|
|
|
699 |
|
|
// now that we're done, let's save all of this so we can have a look at it afterwards.
|
700 |
|
|
TCanvas *can = new TCanvas("can","Prediction Fit Canvas");
|
701 |
|
|
can->SetLogy(1);
|
702 |
|
|
prediction->SetMarkerColor(kRed);
|
703 |
|
|
prediction->Draw();
|
704 |
|
|
|
705 |
|
|
kmlp->SetLineColor(TColor::GetColor("#04B404"));
|
706 |
|
|
kmlpP->SetLineColor(TColor::GetColor("#04B404"));
|
707 |
|
|
kmlpN->SetLineColor(TColor::GetColor("#04B404"));
|
708 |
|
|
kmlp->Draw("same");
|
709 |
|
|
kmlpN->SetLineStyle(2);
|
710 |
|
|
kmlpP->SetLineStyle(2);
|
711 |
|
|
kmlpN->Draw("same");
|
712 |
|
|
kmlpP->Draw("same");
|
713 |
|
|
|
714 |
|
|
ttbarlogpar->SetLineColor(TColor::GetColor("#CC2EFA"));//purple
|
715 |
|
|
ttbarlogpar->Draw("same");
|
716 |
|
|
ttbarlogparP->SetLineColor(TColor::GetColor("#CC2EFA"));//purple
|
717 |
|
|
ttbarlogparN->SetLineColor(TColor::GetColor("#CC2EFA"));//purple
|
718 |
|
|
ttbarlogparP->SetLineStyle(2);
|
719 |
|
|
ttbarlogparN->SetLineStyle(2);
|
720 |
|
|
ttbarlogparP->Draw("same");
|
721 |
|
|
ttbarlogparN->Draw("same");
|
722 |
|
|
|
723 |
|
|
functions[0]->Draw("same");functions[1]->Draw("same");functions[2]->Draw("same");
|
724 |
|
|
|
725 |
|
|
TLegend *analyticalBpredLEG = make_legend("",0.5,0.55);
|
726 |
|
|
analyticalBpredLEG->AddEntry(prediction,"predicted","p");
|
727 |
|
|
analyticalBpredLEG->AddEntry(functions[1],"Crystal Ball fit","l");
|
728 |
|
|
analyticalBpredLEG->AddEntry(functions[0],"1#sigma Crystal Ball fit","l");
|
729 |
|
|
analyticalBpredLEG->AddEntry(ttbarlogparN,"TTbar fit","l");
|
730 |
|
|
analyticalBpredLEG->AddEntry(ttbarlogpar,"1#sigma TTbar fit","l");
|
731 |
|
|
analyticalBpredLEG->AddEntry(kmlp,"Combined function","l");
|
732 |
|
|
analyticalBpredLEG->AddEntry(kmlpN,"1#sigma combined function","l");
|
733 |
|
|
analyticalBpredLEG->Draw("same");
|
734 |
|
|
|
735 |
|
|
if(isdata==0) CompleteSave(can,"MakingOfBpredFunction/Bpred_MC_Analytical_Function_Composition");
|
736 |
|
|
if(isdata==1) CompleteSave(can,"MakingOfBpredFunction/Bpred_data_Analytical_Function_Composition");
|
737 |
|
|
if(isdata==2) CompleteSave(can,"MakingOfBpredFunction/Bpred_MCBnS_Analytical_Function_Composition");
|
738 |
|
|
delete can;
|
739 |
|
|
|
740 |
|
|
//and finally: prep return functions
|
741 |
|
|
vector<TF1*> return_functions;
|
742 |
|
|
return_functions.push_back(kmlpN);
|
743 |
|
|
return_functions.push_back(kmlp);
|
744 |
|
|
return_functions.push_back(kmlpP);
|
745 |
|
|
|
746 |
|
|
return_functions.push_back(ttbarlogparN);
|
747 |
|
|
return_functions.push_back(ttbarlogpar);
|
748 |
|
|
return_functions.push_back(ttbarlogparP);
|
749 |
|
|
|
750 |
|
|
return_functions.push_back(functions[0]);
|
751 |
|
|
return_functions.push_back(functions[1]);
|
752 |
|
|
return_functions.push_back(functions[2]);
|
753 |
|
|
|
754 |
|
|
return return_functions;
|
755 |
|
|
}
|
756 |
|
|
|
757 |
|
|
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false )
|
758 |
|
|
{
|
759 |
|
|
bool is_data=false;
|
760 |
|
|
bool use_signal=false;
|
761 |
|
|
if(use_data==1) is_data=true;
|
762 |
|
|
if(use_data==2) use_signal=true;
|
763 |
|
|
int nbins=50;//100;
|
764 |
|
|
if(is_data) nbins=50;
|
765 |
|
|
float low=0;
|
766 |
|
|
float hi=500;
|
767 |
|
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high);
|
768 |
|
|
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
769 |
|
|
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
770 |
|
|
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
771 |
|
|
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
772 |
|
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle());
|
773 |
|
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle());
|
774 |
|
|
blankback->GetXaxis()->CenterTitle();
|
775 |
|
|
blankback->GetYaxis()->CenterTitle();
|
776 |
|
|
|
777 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
|
778 |
|
|
TH1F *RcorrJZBSBem;
|
779 |
|
|
TH1F *LcorrJZBSBem;
|
780 |
|
|
TH1F *RcorrJZBSBeemm;
|
781 |
|
|
TH1F *LcorrJZBSBeemm;
|
782 |
|
|
|
783 |
|
|
TH1F *RcorrJZBeemmNoS;
|
784 |
|
|
|
785 |
|
|
//these are for the ratio
|
786 |
|
|
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
787 |
|
|
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
788 |
|
|
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
789 |
|
|
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
790 |
|
|
|
791 |
|
|
TH1F *JRcorrJZBSBem;
|
792 |
|
|
TH1F *JLcorrJZBSBem;
|
793 |
|
|
TH1F *JRcorrJZBSBeemm;
|
794 |
|
|
TH1F *JLcorrJZBSBeemm;
|
795 |
|
|
|
796 |
|
|
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false);
|
797 |
|
|
|
798 |
|
|
|
799 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
800 |
|
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
801 |
|
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
802 |
|
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
803 |
|
|
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
804 |
|
|
|
805 |
|
|
//these are for the ratio
|
806 |
|
|
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
807 |
|
|
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
808 |
|
|
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
809 |
|
|
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
810 |
|
|
|
811 |
|
|
}
|
812 |
|
|
|
813 |
|
|
TH1F *lm4RcorrJZBeemm;
|
814 |
|
|
if(overlay_signal || use_data == 2 ) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM4"));
|
815 |
|
|
|
816 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
|
817 |
|
|
|
818 |
|
|
TH1F *Zjetspred = (TH1F*)LcorrJZBeemm->Clone("Zjetspred");
|
819 |
|
|
TH1F *TTbarpred = (TH1F*)RcorrJZBem->Clone("TTbarpred");
|
820 |
|
|
|
821 |
|
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
|
822 |
|
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred");
|
823 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
824 |
|
|
Bpred->Add(RcorrJZBem,1.0/3.);
|
825 |
|
|
Bpred->Add(LcorrJZBem,-1.0/3.);
|
826 |
|
|
Bpred->Add(RcorrJZBSBem,1.0/3.);
|
827 |
|
|
Bpred->Add(LcorrJZBSBem,-1.0/3.);
|
828 |
|
|
Bpred->Add(RcorrJZBSBeemm,1.0/3.);
|
829 |
|
|
Bpred->Add(LcorrJZBSBeemm,-1.0/3.);
|
830 |
|
|
|
831 |
|
|
TTbarpred->Scale(1.0/3);
|
832 |
|
|
Zjetspred->Add(LcorrJZBem,-1.0/3.);
|
833 |
|
|
Zjetspred->Add(LcorrJZBSBem,-1.0/3.);
|
834 |
|
|
TTbarpred->Add(RcorrJZBSBem,1.0/3.);
|
835 |
|
|
Zjetspred->Add(LcorrJZBSBeemm,-1.0/3.);
|
836 |
|
|
TTbarpred->Add(RcorrJZBSBeemm,1.0/3.);
|
837 |
|
|
|
838 |
|
|
//these are for the ratio
|
839 |
|
|
JBpred->Add(JRcorrJZBem,1.0/3.);
|
840 |
|
|
JBpred->Add(JLcorrJZBem,-1.0/3.);
|
841 |
|
|
JBpred->Add(JRcorrJZBSBem,1.0/3.);
|
842 |
|
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.);
|
843 |
|
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.);
|
844 |
|
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.);
|
845 |
|
|
} else {
|
846 |
|
|
Bpred->Add(RcorrJZBem,1.0);
|
847 |
|
|
Bpred->Add(LcorrJZBem,-1.0);
|
848 |
|
|
|
849 |
|
|
Zjetspred->Add(LcorrJZBem,-1.0);
|
850 |
|
|
|
851 |
|
|
//these are for the ratio
|
852 |
|
|
JBpred->Add(JRcorrJZBem,1.0);
|
853 |
|
|
JBpred->Add(JLcorrJZBem,-1.0);
|
854 |
|
|
}
|
855 |
|
|
|
856 |
|
|
|
857 |
|
|
|
858 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
|
859 |
|
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
|
860 |
|
|
Tpred->Add(LcorrJZBem,-1.0);
|
861 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
862 |
|
|
Tpred->Add(RcorrJZBSBem,1.0);
|
863 |
|
|
Tpred->Add(LcorrJZBSBem,-1.0);
|
864 |
|
|
Tpred->Add(RcorrJZBSBeemm,1.0);
|
865 |
|
|
Tpred->Add(LcorrJZBSBeemm,-1.0);
|
866 |
|
|
}
|
867 |
|
|
|
868 |
|
|
globalcanvas->cd();
|
869 |
|
|
globalcanvas->SetLogy(1);
|
870 |
|
|
|
871 |
|
|
RcorrJZBeemm->SetMarkerStyle(20);
|
872 |
|
|
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high);
|
873 |
|
|
RcorrJZBeemm->SetMinimum(0.1);
|
874 |
|
|
|
875 |
|
|
Bpred->SetLineColor(kRed);
|
876 |
|
|
Bpred->SetStats(0);
|
877 |
|
|
|
878 |
|
|
int versok=false;
|
879 |
|
|
if(gROOT->GetVersionInt()>=53000) versok=true;
|
880 |
|
|
|
881 |
|
|
|
882 |
|
|
if ( overlay_signal || use_data==2 ) lm4RcorrJZBeemm->SetLineColor(TColor::GetColor("#088A08"));
|
883 |
|
|
RcorrJZBeemm->SetMarkerSize(DataMarkerSize);
|
884 |
|
|
|
885 |
|
|
TLegend *legBpred = make_legend("",0.6,0.55);
|
886 |
|
|
TLegend *legBpred2 = make_legend("",0.6,0.55);
|
887 |
|
|
|
888 |
|
|
|
889 |
|
|
vector<TF1*> analytical_function;
|
890 |
|
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
|
891 |
|
|
kinpad->cd();
|
892 |
|
|
kinpad->SetLogy(1);
|
893 |
|
|
|
894 |
|
|
string Bpredsaveas="Bpred_Data";
|
895 |
|
|
blankback->SetMaximum(5*RcorrJZBeemm->GetMaximum());
|
896 |
|
|
blankback->SetMinimum(0.1);
|
897 |
|
|
if(use_data!=1) blankback->SetMinimum(0.1);
|
898 |
|
|
blankback->Draw();
|
899 |
|
|
if(use_data==1)
|
900 |
|
|
{
|
901 |
|
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data);
|
902 |
|
|
kinpad->cd();//necessary because the extended fit function creates its own canvas
|
903 |
|
|
RcorrJZBeemm->Draw("e1x0,same");
|
904 |
|
|
|
905 |
|
|
Bpred->Draw("hist,same");
|
906 |
|
|
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
|
907 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
908 |
|
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p");
|
909 |
|
|
legBpred->AddEntry(Bpred,"predicted","l");
|
910 |
|
|
legBpred->AddEntry(analytical_function[1],"predicted fit","l");
|
911 |
|
|
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l");
|
912 |
|
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
|
913 |
|
|
legBpred->Draw();
|
914 |
|
|
DrawPrelim();
|
915 |
|
|
|
916 |
|
|
//this plot shows what the prediction is composed of
|
917 |
|
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv");
|
918 |
|
|
specialcanv->SetLogy(1);
|
919 |
|
|
Zjetspred->SetFillColor(kYellow);
|
920 |
|
|
Zjetspred->SetLineColor(kYellow);
|
921 |
|
|
TTbarpred->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0]));
|
922 |
|
|
TTbarpred->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0]));
|
923 |
|
|
THStack predcomposition("predcomposition","prediction composition");
|
924 |
|
|
predcomposition.Add(TTbarpred);
|
925 |
|
|
predcomposition.Add(Zjetspred);
|
926 |
|
|
blankback->Draw();
|
927 |
|
|
RcorrJZBeemm->Draw("e1x0,same");
|
928 |
|
|
predcomposition.Draw("histo,same");//
|
929 |
|
|
Bpred->Draw("hist,same");
|
930 |
|
|
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
|
931 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
932 |
|
|
legBpred->Draw();
|
933 |
|
|
DrawPrelim();
|
934 |
|
|
TLegend *specialleg = new TLegend(0.6,0.4,0.89,0.55);
|
935 |
|
|
specialleg->SetFillColor(kWhite);specialleg->SetLineColor(kWhite);
|
936 |
|
|
specialleg->AddEntry(Zjetspred,"Z+Jets prediction","f");
|
937 |
|
|
specialleg->AddEntry(TTbarpred,"t#bar{t} prediction","f");
|
938 |
|
|
specialleg->Draw("same");
|
939 |
|
|
CompleteSave(specialcanv,"Bpred_Data_____PredictionComposition");
|
940 |
|
|
|
941 |
|
|
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal);
|
942 |
|
|
blankback->Draw();
|
943 |
|
|
kostack.Draw("same");
|
944 |
|
|
Bpred->Draw("hist,same");
|
945 |
|
|
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
|
946 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
947 |
|
|
legBpred->Draw();
|
948 |
|
|
DrawPrelim();
|
949 |
|
|
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC");
|
950 |
|
|
|
951 |
|
|
delete specialcanv;
|
952 |
|
|
delete specialleg;
|
953 |
|
|
delete Zjetspred;
|
954 |
|
|
delete TTbarpred;
|
955 |
|
|
|
956 |
|
|
kinpad->cd();
|
957 |
|
|
}
|
958 |
|
|
if(use_data==0) {
|
959 |
|
|
RcorrJZBeemm->Draw("e1x0,same");
|
960 |
|
|
Bpred->Draw("hist,same");
|
961 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
962 |
|
|
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p");
|
963 |
|
|
legBpred->AddEntry(Bpred,"MC predicted","l");
|
964 |
|
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18
|
965 |
|
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18
|
966 |
|
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
|
967 |
|
|
legBpred->Draw();
|
968 |
|
|
DrawMCPrelim();
|
969 |
|
|
Bpredsaveas="Bpred_MC";
|
970 |
|
|
// CompleteSave(globalcanvas,"Bpred_MC"); // done below in save_with_ratio
|
971 |
|
|
}
|
972 |
|
|
if(use_data==2) {
|
973 |
|
|
RcorrJZBeemm->Draw("e1x0,same");
|
974 |
|
|
Bpred->Draw("hist,same");
|
975 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
976 |
|
|
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p");
|
977 |
|
|
legBpred->AddEntry(Bpred,"MC predicted","l");
|
978 |
|
|
legBpred2->AddEntry(RcorrJZBeemm,"MC observed","p");
|
979 |
|
|
legBpred2->AddEntry(Bpred,"MC predicted","l");
|
980 |
|
|
{
|
981 |
|
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 --> now only allowed for root >=v5.30
|
982 |
|
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 --> now only allowed for root >=v5.30
|
983 |
|
|
legBpred->Draw();
|
984 |
|
|
DrawMCPrelim();
|
985 |
|
|
Bpredsaveas="Bpred_MCwithS";
|
986 |
|
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio
|
987 |
|
|
}
|
988 |
|
|
{
|
989 |
|
|
RcorrJZBeemmNoS->SetLineStyle(2);
|
990 |
|
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l");
|
991 |
|
|
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l");
|
992 |
|
|
legBpred2->Draw();
|
993 |
|
|
RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B"));
|
994 |
|
|
RcorrJZBeemmNoS->Draw("histo,same");
|
995 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
996 |
|
|
lm4RcorrJZBeemm->Draw("histo,same");
|
997 |
|
|
DrawMCPrelim();
|
998 |
|
|
Bpredsaveas="Bpred_MCwithS__plus";
|
999 |
|
|
// CompleteSave(globalcanvas,"Bpred_MCwithS__plus"); // done below in save_with_ratio
|
1000 |
|
|
}
|
1001 |
|
|
}
|
1002 |
|
|
|
1003 |
|
|
|
1004 |
|
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title
|
1005 |
|
|
string ytitle("ratio");
|
1006 |
|
|
if ( use_data==1 ) ytitle = "data/pred";
|
1007 |
|
|
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle);
|
1008 |
|
|
|
1009 |
|
|
|
1010 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
|
1011 |
|
|
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!)
|
1012 |
|
|
if(!PlottingSetup::RestrictToMassPeak) return;
|
1013 |
|
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem");
|
1014 |
|
|
Bpredem->Add(RcorrJZBem);
|
1015 |
|
|
Bpredem->Add(LcorrJZBem,-1);
|
1016 |
|
|
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem");
|
1017 |
|
|
BpredSBem->Add(RcorrJZBSBem);
|
1018 |
|
|
Bpred->Add(LcorrJZBSBem,-1);
|
1019 |
|
|
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm");
|
1020 |
|
|
BpredSBeemm->Add(RcorrJZBSBeemm);
|
1021 |
|
|
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0);
|
1022 |
|
|
globalcanvas->cd();
|
1023 |
|
|
globalcanvas->SetLogy(1);
|
1024 |
|
|
|
1025 |
|
|
RcorrJZBeemm->SetMarkerStyle(20);
|
1026 |
|
|
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high);
|
1027 |
|
|
blankback->Draw();
|
1028 |
|
|
RcorrJZBeemm->Draw("e1x0,same");
|
1029 |
|
|
RcorrJZBeemm->SetMarkerSize(DataMarkerSize);
|
1030 |
|
|
|
1031 |
|
|
Bpredem->SetLineColor(kRed+1);
|
1032 |
|
|
Bpredem->SetStats(0);
|
1033 |
|
|
Bpredem->Draw("hist,same");
|
1034 |
|
|
|
1035 |
|
|
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138"));
|
1036 |
|
|
BpredSBem->SetLineStyle(2);
|
1037 |
|
|
BpredSBem->Draw("hist,same");
|
1038 |
|
|
|
1039 |
|
|
BpredSBeemm->SetLineColor(kBlue+1);
|
1040 |
|
|
BpredSBeemm->SetLineStyle(3);
|
1041 |
|
|
BpredSBeemm->Draw("hist,same");
|
1042 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
1043 |
|
|
|
1044 |
|
|
TLegend *legBpredc = make_legend("",0.6,0.55);
|
1045 |
|
|
if(use_data==1)
|
1046 |
|
|
{
|
1047 |
|
|
legBpredc->AddEntry(RcorrJZBeemm,"observed","p");
|
1048 |
|
|
legBpredc->AddEntry(Bpredem,"OFZP","l");
|
1049 |
|
|
legBpredc->AddEntry(BpredSBem,"OFSB","l");
|
1050 |
|
|
legBpredc->AddEntry(BpredSBeemm,"SFSB","l");
|
1051 |
|
|
legBpredc->Draw();
|
1052 |
|
|
CompleteSave(globalcanvas,"Bpred_Data_comparison");
|
1053 |
|
|
}
|
1054 |
|
|
if(use_data==0) {
|
1055 |
|
|
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p");
|
1056 |
|
|
legBpredc->AddEntry(Bpredem,"MC OFZP","l");
|
1057 |
|
|
legBpredc->AddEntry(BpredSBem,"MC OFSB","l");
|
1058 |
|
|
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l");
|
1059 |
|
|
legBpredc->Draw();
|
1060 |
|
|
CompleteSave(globalcanvas,"Bpred_MC_comparison");
|
1061 |
|
|
}
|
1062 |
|
|
if(use_data==2) {
|
1063 |
|
|
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p");
|
1064 |
|
|
legBpredc->AddEntry(Bpredem,"MC OFZP","l");
|
1065 |
|
|
legBpredc->AddEntry(BpredSBem,"MC OFSB","l");
|
1066 |
|
|
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l");
|
1067 |
|
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
|
1068 |
|
|
legBpredc->Draw();
|
1069 |
|
|
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison");
|
1070 |
|
|
}
|
1071 |
|
|
delete RcorrJZBeemm;
|
1072 |
|
|
delete LcorrJZBeemm;
|
1073 |
|
|
delete RcorrJZBem;
|
1074 |
|
|
delete LcorrJZBem;
|
1075 |
|
|
|
1076 |
|
|
delete JRcorrJZBeemm;
|
1077 |
|
|
delete JLcorrJZBeemm;
|
1078 |
|
|
delete JRcorrJZBem;
|
1079 |
|
|
delete JLcorrJZBem;
|
1080 |
|
|
|
1081 |
|
|
delete blankback;
|
1082 |
|
|
|
1083 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
1084 |
|
|
delete RcorrJZBSBem;
|
1085 |
|
|
delete LcorrJZBSBem;
|
1086 |
|
|
delete RcorrJZBSBeemm;
|
1087 |
|
|
delete LcorrJZBSBeemm;
|
1088 |
|
|
|
1089 |
|
|
delete JRcorrJZBSBem;
|
1090 |
|
|
delete JLcorrJZBSBem;
|
1091 |
|
|
delete JRcorrJZBSBeemm;
|
1092 |
|
|
delete JLcorrJZBSBeemm;
|
1093 |
|
|
}
|
1094 |
|
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm;
|
1095 |
|
|
}
|
1096 |
|
|
|
1097 |
|
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) {
|
1098 |
|
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas");
|
1099 |
|
|
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal);
|
1100 |
|
|
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal);
|
1101 |
|
|
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal);
|
1102 |
|
|
}
|
1103 |
|
|
|
1104 |
|
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) {
|
1105 |
|
|
bool do_data=0;
|
1106 |
|
|
bool dosignal=0;
|
1107 |
|
|
if(is_data==1) do_data=1;
|
1108 |
|
|
if(is_data==2) dosignal=1;
|
1109 |
|
|
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
|
1110 |
|
|
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
|
1111 |
|
|
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
|
1112 |
|
|
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
|
1113 |
|
|
|
1114 |
|
|
TH1F *RcorrJZBSBem;
|
1115 |
|
|
TH1F *LcorrJZBSBem;
|
1116 |
|
|
TH1F *RcorrJZBSBeemm;
|
1117 |
|
|
TH1F *LcorrJZBSbeemm;
|
1118 |
|
|
|
1119 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
1120 |
|
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
|
1121 |
|
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
|
1122 |
|
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
|
1123 |
|
|
LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
|
1124 |
|
|
}
|
1125 |
|
|
|
1126 |
|
|
|
1127 |
|
|
|
1128 |
|
|
|
1129 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
|
1130 |
|
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
|
1131 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
1132 |
|
|
Bpred->Add(RcorrJZBem,1.0/3);
|
1133 |
|
|
Bpred->Add(LcorrJZBem,-1.0/3);
|
1134 |
|
|
Bpred->Add(RcorrJZBSBem,1.0/3);
|
1135 |
|
|
Bpred->Add(LcorrJZBSBem,-1.0/3);
|
1136 |
|
|
Bpred->Add(RcorrJZBSBeemm,1.0/3);
|
1137 |
|
|
Bpred->Add(LcorrJZBSbeemm,-1.0/3);
|
1138 |
|
|
} else {
|
1139 |
|
|
Bpred->Add(RcorrJZBem,1.0);
|
1140 |
|
|
Bpred->Add(LcorrJZBem,-1.0);
|
1141 |
|
|
}
|
1142 |
|
|
|
1143 |
|
|
can->cd();
|
1144 |
|
|
can->SetLogy(0);
|
1145 |
|
|
Bpred->SetLineColor(kRed);
|
1146 |
|
|
Bpred->SetStats(0);
|
1147 |
|
|
if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high);
|
1148 |
|
|
TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting");
|
1149 |
|
|
JZBratioforfitting->Divide(Bpred);
|
1150 |
|
|
TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false);
|
1151 |
|
|
|
1152 |
|
|
|
1153 |
|
|
JZBratio->SetTitle("");
|
1154 |
|
|
JZBratio->GetYaxis()->SetRangeUser(0.0,9.0);
|
1155 |
|
|
// if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh );
|
1156 |
|
|
|
1157 |
|
|
TF1 *pol0 = new TF1("pol0","[0]",0,1000);
|
1158 |
|
|
TF1 *pol0d = new TF1("pol0","[0]",0,1000);
|
1159 |
|
|
// straightline_fit->SetParameter(0,1);
|
1160 |
|
|
JZBratioforfitting->Fit(pol0,"Q0R","",0,30);
|
1161 |
|
|
pol0d->SetParameter(0,pol0->GetParameter(0));
|
1162 |
|
|
|
1163 |
|
|
JZBratio->GetYaxis()->SetTitle("Observed/Predicted");
|
1164 |
|
|
JZBratio->GetXaxis()->SetTitle("JZB [GeV]");
|
1165 |
|
|
if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high);
|
1166 |
|
|
JZBratio->GetYaxis()->SetNdivisions(519);
|
1167 |
|
|
JZBratio->GetYaxis()->SetRangeUser(0.0,4.0);
|
1168 |
|
|
JZBratio->GetYaxis()->CenterTitle();
|
1169 |
|
|
JZBratio->GetXaxis()->CenterTitle();
|
1170 |
|
|
JZBratio->SetMarkerSize(DataMarkerSize);
|
1171 |
|
|
JZBratio->Draw("AP");
|
1172 |
|
|
/////----------------------------
|
1173 |
|
|
TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC");
|
1174 |
|
|
writeresult->SetFillStyle(4000);
|
1175 |
|
|
writeresult->SetFillColor(kWhite);
|
1176 |
|
|
writeresult->SetTextFont(42);
|
1177 |
|
|
writeresult->SetTextSize(0.03);
|
1178 |
|
|
writeresult->SetTextAlign(12);
|
1179 |
|
|
ostringstream jzb_agreement_data_text;
|
1180 |
|
|
jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) << pol0->GetParError(0);
|
1181 |
|
|
if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data
|
1182 |
|
|
if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal
|
1183 |
|
|
/* if(is_data) writeresult->AddText("Data closure test");
|
1184 |
|
|
else writeresult->AddText("MC closure test");
|
1185 |
|
|
*/
|
1186 |
|
|
writeresult->AddText(jzb_agreement_data_text.str().c_str());
|
1187 |
|
|
// writeresult->Draw("same");
|
1188 |
|
|
// pol0d->Draw("same");
|
1189 |
|
|
TF1 *topline = new TF1("","1.5",0,1000);
|
1190 |
|
|
TF1 *bottomline = new TF1("","0.5",0,1000);
|
1191 |
|
|
topline->SetLineColor(kBlue);
|
1192 |
|
|
topline->SetLineStyle(2);
|
1193 |
|
|
bottomline->SetLineColor(kBlue);
|
1194 |
|
|
bottomline->SetLineStyle(2);
|
1195 |
|
|
// topline->Draw("same");
|
1196 |
|
|
// bottomline->Draw("same");
|
1197 |
|
|
TF1 *oneline = new TF1("","1.0",0,1000);
|
1198 |
|
|
oneline->SetLineColor(kBlue);
|
1199 |
|
|
oneline->SetLineStyle(1);
|
1200 |
|
|
oneline->Draw("same");
|
1201 |
|
|
TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well.
|
1202 |
|
|
if(is_data==1) DrawPrelim();
|
1203 |
|
|
else DrawMCPrelim();
|
1204 |
|
|
TLegend *leg = new TLegend(0.55,0.75,0.89,0.89);
|
1205 |
|
|
leg->SetTextFont(42);
|
1206 |
|
|
leg->SetTextSize(0.04);
|
1207 |
|
|
// if(is_data==1) leg->SetHeader("Ratio (data)");
|
1208 |
|
|
// else leg->SetHeader("Ratio (MC)");
|
1209 |
|
|
|
1210 |
|
|
TString MCtitle("MC ");
|
1211 |
|
|
if (is_data==1) MCtitle = "";
|
1212 |
|
|
|
1213 |
|
|
leg->SetFillStyle(4000);
|
1214 |
|
|
leg->SetFillColor(kWhite);
|
1215 |
|
|
leg->SetTextFont(42);
|
1216 |
|
|
// leg->AddEntry(topline,"+20\% sys envelope","l");
|
1217 |
|
|
leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p");
|
1218 |
|
|
leg->AddEntry(oneline,"ratio = 1","l");
|
1219 |
|
|
// leg->AddEntry(pol0d,"fit in [0,30] GeV","l");
|
1220 |
|
|
// leg->AddEntry(bottomline,"#pm50% envelope","l");
|
1221 |
|
|
|
1222 |
|
|
|
1223 |
|
|
//leg->Draw("same"); // no longer drawing legend
|
1224 |
|
|
|
1225 |
|
|
if(is_data==1) CompleteSave(can, "jzb_ratio_data");
|
1226 |
|
|
if(is_data==0) CompleteSave(can, "jzb_ratio_mc");
|
1227 |
|
|
if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal!
|
1228 |
|
|
|
1229 |
|
|
delete RcorrJZBeemm;
|
1230 |
|
|
delete LcorrJZBeemm;
|
1231 |
|
|
delete RcorrJZBem;
|
1232 |
|
|
delete LcorrJZBem;
|
1233 |
|
|
|
1234 |
|
|
delete RcorrJZBSBem;
|
1235 |
|
|
delete LcorrJZBSBem;
|
1236 |
|
|
delete RcorrJZBSBeemm;
|
1237 |
|
|
delete LcorrJZBSbeemm;
|
1238 |
|
|
}
|
1239 |
|
|
|
1240 |
|
|
void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) {
|
1241 |
|
|
TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas");
|
1242 |
|
|
globalc->SetLogy(0);
|
1243 |
|
|
|
1244 |
|
|
do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh );
|
1245 |
|
|
do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh );
|
1246 |
|
|
do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh );
|
1247 |
|
|
}
|
1248 |
|
|
|
1249 |
|
|
string give_jzb_expression(float peak, int type) {
|
1250 |
|
|
stringstream val;
|
1251 |
|
|
if(type==data) {
|
1252 |
|
|
if(peak<0) val << jzbvariabledata << "+" << TMath::Abs(peak);
|
1253 |
|
|
if(peak>0) val << jzbvariabledata << "-" << TMath::Abs(peak);
|
1254 |
|
|
if(peak==0) val << jzbvariabledata;
|
1255 |
|
|
}
|
1256 |
|
|
if(type==mc) {
|
1257 |
|
|
if(peak<0) val << jzbvariablemc << "+" << TMath::Abs(peak);
|
1258 |
|
|
if(peak>0) val << jzbvariablemc << "-" << TMath::Abs(peak);
|
1259 |
|
|
if(peak==0) val << jzbvariablemc;
|
1260 |
|
|
}
|
1261 |
|
|
return val.str();
|
1262 |
|
|
}
|
1263 |
|
|
|
1264 |
|
|
|
1265 |
|
|
void lepton_comparison_plots() {
|
1266 |
|
|
Float_t ymin = 1.e-5, ymax = 0.25;
|
1267 |
|
|
TCanvas *can = new TCanvas("can","Lepton Comparison Canvas");
|
1268 |
|
|
can->SetLogy(1);
|
1269 |
buchmann |
1.3 |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY"));
|
1270 |
|
|
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY"));
|
1271 |
buchmann |
1.1 |
eemc->SetLineColor(kBlue);
|
1272 |
|
|
mmmc->SetLineColor(kRed);
|
1273 |
|
|
eemc->SetMinimum(0.1);
|
1274 |
|
|
eemc->SetMaximum(10*eemc->GetMaximum());
|
1275 |
|
|
eemc->Draw("histo");
|
1276 |
|
|
mmmc->Draw("histo,same");
|
1277 |
|
|
TLegend *leg = make_legend();
|
1278 |
|
|
leg->AddEntry(eemc,"ZJets->ee (MC)","l");
|
1279 |
|
|
leg->AddEntry(mmmc,"ZJets->#mu#mu (MC)","l");
|
1280 |
|
|
leg->Draw("same");
|
1281 |
|
|
CompleteSave(can, "lepton_comparison/mll_effratio_mc");
|
1282 |
|
|
|
1283 |
|
|
TH1F *eed = allsamples.Draw("eed","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",data, luminosity);
|
1284 |
|
|
TH1F *mmd = allsamples.Draw("mmd","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",data, luminosity);
|
1285 |
|
|
eed->SetLineColor(kBlue);
|
1286 |
|
|
mmd->SetLineColor(kRed);
|
1287 |
|
|
eed->SetMinimum(0.1);
|
1288 |
|
|
eed->SetMaximum(10*eed->GetMaximum());
|
1289 |
|
|
eed->Draw("histo");
|
1290 |
|
|
mmd->Draw("histo,same");
|
1291 |
|
|
TLegend *leg2 = make_legend();
|
1292 |
|
|
leg2->AddEntry(eed,"ZJets->ee (data)","l");
|
1293 |
|
|
leg2->AddEntry(mmd,"ZJets->#mu#mu (data)","l");
|
1294 |
|
|
leg2->Draw();
|
1295 |
|
|
CompleteSave(can, "lepton_comparison/mll_effratio_data");
|
1296 |
|
|
|
1297 |
|
|
TH1F *jeed = allsamples.Draw("jeed",jzbvariabledata, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",data, luminosity);
|
1298 |
|
|
TH1F *jmmd = allsamples.Draw("jmmd",jzbvariabledata, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",data, luminosity);
|
1299 |
|
|
TH1F *jeemmd = allsamples.Draw("jeemmd",jzbvariabledata,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutOSSF&&cutnJets,data, luminosity);
|
1300 |
|
|
dout << "ee : " << jeed->GetMean() << "+/-" << jeed->GetMeanError() << endl;
|
1301 |
|
|
dout << "ee : " << jmmd->GetMean() << "+/-" << jmmd->GetMeanError() << endl;
|
1302 |
|
|
dout << "eemd : " << jeemmd->GetMean() << "+/-" << jeemmd->GetMeanError() << endl;
|
1303 |
|
|
jeemmd->SetLineColor(kBlack);
|
1304 |
|
|
jeemmd->SetMarkerStyle(25);
|
1305 |
|
|
jeed->SetLineColor(kBlue);
|
1306 |
|
|
jmmd->SetLineColor(kRed);
|
1307 |
|
|
jeed->SetMinimum(0.1);
|
1308 |
|
|
jeed->SetMaximum(10*eed->GetMaximum());
|
1309 |
|
|
TH1* njeemmd = jeemmd->DrawNormalized();
|
1310 |
|
|
njeemmd->SetMinimum(ymin);
|
1311 |
|
|
njeemmd->SetMaximum(ymax);
|
1312 |
|
|
|
1313 |
|
|
jeed->DrawNormalized("histo,same");
|
1314 |
|
|
jmmd->DrawNormalized("histo,same");
|
1315 |
|
|
jeemmd->DrawNormalized("same");
|
1316 |
|
|
TLegend *jleg2 = make_legend(" ");
|
1317 |
|
|
jleg2->AddEntry(jeemmd,"ee and #mu#mu","p");
|
1318 |
|
|
jleg2->AddEntry(jeed,"ee","l");
|
1319 |
|
|
jleg2->AddEntry(jmmd,"#mu#mu","l");
|
1320 |
|
|
jleg2->Draw();
|
1321 |
|
|
CompleteSave(can,"lepton_comparison/jzb_effratio_data");
|
1322 |
|
|
|
1323 |
|
|
TPad *eemmpad = new TPad("eemmpad","eemmpad",0,0,1,1);
|
1324 |
|
|
eemmpad->cd();
|
1325 |
|
|
eemmpad->SetLogy(1);
|
1326 |
|
|
jeed->Draw("histo");
|
1327 |
|
|
jmmd->Draw("histo,same");
|
1328 |
|
|
TLegend *eemmlegend = make_legend(" ");
|
1329 |
|
|
eemmlegend->AddEntry(jeed,"ee","l");
|
1330 |
|
|
eemmlegend->AddEntry(jmmd,"#mu#mu","l");
|
1331 |
|
|
eemmlegend->Draw();
|
1332 |
|
|
DrawPrelim();
|
1333 |
|
|
save_with_ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data");
|
1334 |
|
|
|
1335 |
buchmann |
1.3 |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY"));
|
1336 |
|
|
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY"));
|
1337 |
|
|
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("/DY"));
|
1338 |
buchmann |
1.1 |
dout << "Z+Jets ee : " << zjeed->GetMean() << "+/-" << zjeed->GetMeanError() << endl;
|
1339 |
|
|
dout << "Z+Jets ee : " << zjmmd->GetMean() << "+/-" << zjmmd->GetMeanError() << endl;
|
1340 |
|
|
dout << "Z+Jets eemd : " << zjeemmd->GetMean() << "+/-" << zjeemmd->GetMeanError() << endl;
|
1341 |
|
|
zjeemmd->SetLineColor(kBlack);
|
1342 |
|
|
zjeemmd->SetMarkerStyle(25);
|
1343 |
|
|
zjeed->SetLineColor(kBlue);
|
1344 |
|
|
zjmmd->SetLineColor(kRed);
|
1345 |
|
|
zjeed->SetMinimum(0.1);
|
1346 |
|
|
zjeed->SetMaximum(10*eed->GetMaximum());
|
1347 |
|
|
|
1348 |
|
|
TH1* nzjeemmd = zjeemmd->DrawNormalized();
|
1349 |
|
|
nzjeemmd->SetMinimum(ymin);
|
1350 |
|
|
nzjeemmd->SetMaximum(ymax);
|
1351 |
|
|
zjeed->DrawNormalized("histo,same");
|
1352 |
|
|
zjmmd->DrawNormalized("histo,same");
|
1353 |
|
|
zjeemmd->DrawNormalized("same");
|
1354 |
|
|
TLegend *zjleg2 = make_legend("Z+jets MC");
|
1355 |
|
|
zjleg2->AddEntry(jeemmd,"ee and #mu#mu","p");
|
1356 |
|
|
zjleg2->AddEntry(jeed,"ee","l");
|
1357 |
|
|
zjleg2->AddEntry(jmmd,"#mu#mu","l");
|
1358 |
|
|
zjleg2->Draw();
|
1359 |
|
|
CompleteSave(can,"lepton_comparison/jzb_effratio_ZJets");
|
1360 |
|
|
|
1361 |
|
|
TH1F *ld = allsamples.Draw("ld","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets,data, luminosity);
|
1362 |
|
|
ld->DrawNormalized("e1");
|
1363 |
|
|
eed->DrawNormalized("histo,same");
|
1364 |
|
|
mmd->DrawNormalized("histo,same");
|
1365 |
|
|
TLegend *leg3 = make_legend();
|
1366 |
|
|
leg3->AddEntry(ld,"ZJets->ll (data)","p");
|
1367 |
|
|
leg3->AddEntry(eed,"ZJets->ee (data)","l");
|
1368 |
|
|
leg3->AddEntry(mmd,"ZJets->#mu#mu (data)","l");
|
1369 |
|
|
leg3->Draw();
|
1370 |
|
|
CompleteSave(can,"lepton_comparison/mll_effratio_data__all_compared");
|
1371 |
|
|
/*
|
1372 |
|
|
TH1F *jzbld = allsamples.Draw("jzbld",jzbvariable,75,-150,150, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity);
|
1373 |
|
|
TH1F *jzbemd = allsamples.Draw("jzbemd",jzbvariable,75,-150,150, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity);
|
1374 |
|
|
*/
|
1375 |
|
|
TH1F *jzbld = allsamples.Draw("jzbld",jzbvariabledata,int((jzbHigh+110)/5),-110,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity);
|
1376 |
|
|
TH1F *jzbemd = allsamples.Draw("jzbemd",jzbvariabledata,int((jzbHigh+110)/5),-110,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity);
|
1377 |
|
|
jzbld->SetMarkerColor(kBlack);
|
1378 |
|
|
jzbld->SetMarkerStyle(26);
|
1379 |
|
|
jzbemd->SetMarkerStyle(25);
|
1380 |
|
|
jzbemd->SetMarkerColor(kRed);
|
1381 |
|
|
jzbemd->SetLineColor(kRed);
|
1382 |
|
|
jzbld->SetMinimum(0.35);
|
1383 |
|
|
jzbld->Draw("e1");
|
1384 |
|
|
jzbemd->Draw("e1,same");
|
1385 |
|
|
TLegend *leg4 = make_legend();
|
1386 |
|
|
leg4->AddEntry(jzbld,"SFZP","p");
|
1387 |
|
|
leg4->AddEntry(jzbemd,"OFZP","p");
|
1388 |
|
|
leg4->AddEntry((TObject*)0,"",""); //causes segmentation violation
|
1389 |
|
|
leg4->AddEntry((TObject*)0,"",""); //causes segmentation violation
|
1390 |
|
|
leg4->Draw();
|
1391 |
|
|
CompleteSave(can,"lepton_comparison/jzb_eemumu_emu_data");
|
1392 |
|
|
|
1393 |
|
|
TH1F *ttbarjzbld = allsamples.Draw("ttbarjzbld",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity,allsamples.FindSample("TTJet"));
|
1394 |
|
|
TH1F *ttbarjzbemd = allsamples.Draw("ttbarjzbemd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity,allsamples.FindSample("TTJet"));
|
1395 |
|
|
ttbarjzbld->SetLineColor(allsamples.GetColor("TTJet"));
|
1396 |
|
|
ttbarjzbemd->SetLineColor(allsamples.GetColor("TTJet"));
|
1397 |
|
|
ttbarjzbld->Draw("histo");
|
1398 |
|
|
ttbarjzbemd->SetLineStyle(2);
|
1399 |
|
|
ttbarjzbemd->Draw("histo,same");
|
1400 |
|
|
TLegend *leg5 = make_legend();
|
1401 |
|
|
leg5->AddEntry(ttbarjzbld,"t#bar{t}->(ee or #mu#mu)","l");
|
1402 |
|
|
leg5->AddEntry(ttbarjzbemd,"t#bar{t}->e#mu","l");
|
1403 |
|
|
leg5->Draw();
|
1404 |
|
|
CompleteSave(can,"lepton_comparison/ttbar_emu_mc");
|
1405 |
|
|
|
1406 |
|
|
}
|
1407 |
|
|
|
1408 |
|
|
bool is_OF(TCut cut) {
|
1409 |
|
|
string scut = (const char*) cut;
|
1410 |
|
|
if((int)scut.find("id1!=id2")>-1) return true;
|
1411 |
|
|
if((int)scut.find("id1==id2")>-1) return false;
|
1412 |
|
|
return false;
|
1413 |
|
|
}
|
1414 |
|
|
|
1415 |
|
|
bool is_ZP(TCut cut) {
|
1416 |
|
|
string scut = (const char*) cut;
|
1417 |
|
|
if((int)scut.find("91")>-1) return true;
|
1418 |
|
|
return false;
|
1419 |
|
|
}
|
1420 |
|
|
|
1421 |
|
|
|
1422 |
|
|
void draw_pure_jzb_histo(TCut cut,string datavariable, string mcvariable, string savename, TCanvas *can,vector<float> binning) {
|
1423 |
|
|
TPad *jzbpad = new TPad("jzbpad","jzbpad",0,0,1,1);
|
1424 |
|
|
jzbpad->cd();
|
1425 |
|
|
jzbpad->SetLogy(1);
|
1426 |
|
|
string xlabel="JZB [GeV]";
|
1427 |
|
|
|
1428 |
|
|
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,binning, xlabel, "events",cut,data,luminosity);
|
1429 |
|
|
THStack mcstack = allsamples.DrawStack("mcstack",mcvariable,binning, xlabel, "events",cut,mc,luminosity);
|
1430 |
|
|
|
1431 |
|
|
datahisto->SetMinimum(0.1);
|
1432 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
1433 |
|
|
datahisto->Draw("e1");
|
1434 |
|
|
mcstack.Draw("same");
|
1435 |
|
|
datahisto->Draw("same,e1");
|
1436 |
|
|
|
1437 |
|
|
TLegend *leg;
|
1438 |
|
|
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto);
|
1439 |
|
|
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto);
|
1440 |
|
|
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto);
|
1441 |
|
|
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto);
|
1442 |
|
|
else {
|
1443 |
|
|
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl;
|
1444 |
|
|
exit(-1);
|
1445 |
|
|
}
|
1446 |
|
|
leg->Draw();
|
1447 |
|
|
string write_cut = decipher_cut(cut,"");
|
1448 |
|
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str());
|
1449 |
|
|
writeline1->SetTextSize(0.035);
|
1450 |
|
|
writeline1->Draw();
|
1451 |
|
|
save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename));
|
1452 |
|
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1);
|
1453 |
|
|
jzbpad2->cd();
|
1454 |
|
|
jzbpad2->SetLogy(1);
|
1455 |
|
|
datahisto->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]);
|
1456 |
|
|
datahisto->SetMinimum(0.1);
|
1457 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
1458 |
|
|
datahisto->Draw("e1");
|
1459 |
|
|
mcstack.Draw("same");
|
1460 |
|
|
datahisto->Draw("same,e1");
|
1461 |
|
|
leg->SetHeader("");
|
1462 |
|
|
leg->Draw();
|
1463 |
|
|
writeline1->SetTextSize(0.035);
|
1464 |
|
|
writeline1->Draw();
|
1465 |
|
|
DrawPrelim();
|
1466 |
|
|
save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+""));
|
1467 |
|
|
datahisto->Delete();
|
1468 |
|
|
mcstack.Delete();
|
1469 |
|
|
}
|
1470 |
|
|
|
1471 |
|
|
Double_t GausR(Double_t *x, Double_t *par) {
|
1472 |
|
|
return gRandom->Gaus(x[0],par[0]);
|
1473 |
|
|
}
|
1474 |
|
|
|
1475 |
|
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
|
1476 |
|
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas");
|
1477 |
|
|
float max=jzbHigh ;
|
1478 |
|
|
float min=-120;
|
1479 |
|
|
int nbins=(int)((max-min)/5.0); // we want 5 GeV/bin
|
1480 |
|
|
int coarserbins=int(nbins/2.0);
|
1481 |
|
|
int rebinnedbins=int(nbins/4.0);
|
1482 |
|
|
|
1483 |
|
|
vector<float>binning;vector<float>coarse_binning;vector<float>coarsest_binning;
|
1484 |
|
|
for(int i=0;i<=nbins;i++)binning.push_back(min+i*(max-min)/((float)nbins));
|
1485 |
|
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins));
|
1486 |
|
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins));
|
1487 |
|
|
|
1488 |
|
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning);
|
1489 |
|
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning);
|
1490 |
|
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning);
|
1491 |
|
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning);
|
1492 |
|
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning);
|
1493 |
|
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning);
|
1494 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
|
1495 |
|
|
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
|
1496 |
|
|
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
|
1497 |
|
|
|
1498 |
|
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning);
|
1499 |
|
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning);
|
1500 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
|
1501 |
|
|
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
|
1502 |
|
|
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
|
1503 |
|
|
|
1504 |
|
|
// draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning);
|
1505 |
|
|
// draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarsest",can,coarsest_binning);
|
1506 |
|
|
// flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
|
1507 |
|
|
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning);
|
1508 |
|
|
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning);
|
1509 |
|
|
}
|
1510 |
|
|
|
1511 |
|
|
|
1512 |
|
|
void calculate_all_yields(string mcdrawcommand,vector<float> jzb_cuts) {
|
1513 |
|
|
dout << "Calculating background yields in MC:" << endl;
|
1514 |
|
|
jzb_cuts.push_back(14000);
|
1515 |
|
|
TH1F *allbgs = allsamples.Draw("allbgs",jzbvariablemc,jzb_cuts, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc,luminosity);
|
1516 |
|
|
float cumulative=0;
|
1517 |
|
|
for(int i=allbgs->GetNbinsX();i>=1;i--) {
|
1518 |
|
|
cumulative+=allbgs->GetBinContent(i);
|
1519 |
|
|
dout << "Above " << allbgs->GetBinLowEdge(i) << " GeV/c : " << cumulative << endl;
|
1520 |
|
|
}
|
1521 |
|
|
}
|
1522 |
|
|
|
1523 |
|
|
|
1524 |
|
|
TCut give_jzb_expression(string mcjzb, float jzbcut, string posneg="pos") {
|
1525 |
|
|
stringstream res;
|
1526 |
|
|
res << "(" << mcjzb;
|
1527 |
|
|
if(posneg=="pos") res << ">";
|
1528 |
|
|
else res << "<-";
|
1529 |
|
|
res << jzbcut << ")";
|
1530 |
|
|
return TCut(res.str().c_str());
|
1531 |
|
|
}
|
1532 |
|
|
|
1533 |
|
|
string sigdig(float number, int nsigdig=3, float min=0) {
|
1534 |
|
|
//this function tries to extract n significant digits, and if the number is below (min), it returns "<min"
|
1535 |
|
|
if(number<min) return "< "+any2string(min);
|
1536 |
|
|
stringstream sol;
|
1537 |
|
|
sol << setprecision(nsigdig) << number;
|
1538 |
|
|
|
1539 |
|
|
return sol.str();
|
1540 |
|
|
}
|
1541 |
|
|
|
1542 |
|
|
string jzb_tex_command(string region, string posneg) {
|
1543 |
|
|
if(posneg=="pos") posneg="POS";
|
1544 |
|
|
else posneg="NEG";
|
1545 |
|
|
stringstream texcommand;
|
1546 |
|
|
texcommand<<"\\"<<region <<"JZB"<<posneg;
|
1547 |
|
|
return texcommand.str();
|
1548 |
|
|
}
|
1549 |
|
|
// \SFZPJZBPOS
|
1550 |
|
|
// Sample & \OFZPJZBPOS & \OFZPJZBNEG & \SFZPJZBPOS & \SFZPJZBNEG & \OFSBJZBPOS & \OFSBJZBNEG & \SFSBJZBPOS & \SFSBJZBNEG \\\hline
|
1551 |
|
|
|
1552 |
|
|
void compute_MC_yields(string mcjzb,vector<float> jzb_cuts) {
|
1553 |
|
|
dout << "Calculating background yields in MC:" << endl;
|
1554 |
|
|
|
1555 |
|
|
TCanvas *yica = new TCanvas("yica","yield canvas");
|
1556 |
|
|
|
1557 |
|
|
int nRegions=4;
|
1558 |
|
|
if(!PlottingSetup::RestrictToMassPeak) nRegions=2;
|
1559 |
|
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"};
|
1560 |
|
|
string posneg[] = {"pos","neg"};
|
1561 |
|
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut};
|
1562 |
|
|
|
1563 |
|
|
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) {
|
1564 |
|
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") };
|
1565 |
|
|
dout << "_________________________________________________________" << endl;
|
1566 |
|
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl;
|
1567 |
|
|
for(int isample=0;isample<(allsamples.collection).size();isample++) {
|
1568 |
|
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & ";
|
1569 |
|
|
else dout << "Sample & ";
|
1570 |
|
|
for(int iregion=0;iregion<nRegions;iregion++) {
|
1571 |
|
|
for(int ipos=0;ipos<2;ipos++) {
|
1572 |
|
|
if((allsamples.collection)[isample].is_data) dout << jzb_tex_command(tsRegions[iregion],posneg[ipos]) << " & ";
|
1573 |
|
|
else {
|
1574 |
|
|
vector<int> specific;specific.push_back(isample);
|
1575 |
|
|
TH1F *shisto = allsamples.Draw("shisto","mll",1,0,500,"tester","events",tkRegions[iregion]&&jzbMC[ipos],mc,luminosity,specific);
|
1576 |
|
|
dout << sigdig(shisto->Integral(),3,0.05) <<" & ";
|
1577 |
|
|
delete shisto;
|
1578 |
|
|
}
|
1579 |
|
|
}//end of ipos
|
1580 |
|
|
}//end of iregion
|
1581 |
|
|
dout << " \\\\" << endl;
|
1582 |
|
|
}//end of isample
|
1583 |
|
|
}//end of ijzb
|
1584 |
|
|
dout << " \\hline" << endl;
|
1585 |
|
|
|
1586 |
|
|
delete yica;
|
1587 |
|
|
}
|
1588 |
|
|
|
1589 |
|
|
void draw_ttbar_and_zjets_shape_for_one_configuration(string mcjzb, string datajzb, int leptontype=-1, int scenario=0,bool floating=false) {
|
1590 |
|
|
//Step 1: Establishing cuts
|
1591 |
|
|
stringstream jetcutstring;
|
1592 |
|
|
string writescenario="";
|
1593 |
|
|
|
1594 |
|
|
if(scenario==0) jetcutstring << "(pfJetGoodNum>=3)&&"<<(const char*) basicqualitycut;
|
1595 |
|
|
if(scenario==1) jetcutstring << "(pfJetPt[0]>50&&pfJetPt[1]>50)&&"<<(const char*)basicqualitycut;
|
1596 |
|
|
TCut jetcut(jetcutstring.str().c_str());
|
1597 |
|
|
string leptoncut="mll>0";
|
1598 |
|
|
if(leptontype==0||leptontype==1) {
|
1599 |
|
|
if(leptontype==0) {
|
1600 |
|
|
leptoncut="id1==0";
|
1601 |
|
|
writescenario="__ee";
|
1602 |
|
|
}
|
1603 |
|
|
else {
|
1604 |
|
|
leptoncut="id1==1";
|
1605 |
|
|
writescenario="__ee";
|
1606 |
|
|
}
|
1607 |
|
|
}
|
1608 |
|
|
TCut lepcut(leptoncut.c_str());
|
1609 |
|
|
|
1610 |
|
|
TCanvas *c5 = new TCanvas("c5","c5",1500,500);
|
1611 |
|
|
TCanvas *c6 = new TCanvas("c6","c6");
|
1612 |
|
|
c5->Divide(3,1);
|
1613 |
|
|
|
1614 |
|
|
//STEP 2: Extract Zjets shape in data
|
1615 |
|
|
c5->cd(1);
|
1616 |
|
|
c5->cd(1)->SetLogy(1);
|
1617 |
|
|
TCut massat40("mll>40");
|
1618 |
|
|
TH1F *ossfleft = allsamples.Draw("ossfleft", "-"+datajzb,40,0,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,data,luminosity);
|
1619 |
|
|
TH1F *osofleft = allsamples.Draw("osofleft", "-"+datajzb,40,0,200, "JZB [GeV]", "events", massat40&&cutOSOF&&jetcut&&lepcut,data,luminosity);
|
1620 |
|
|
ossfleft->SetLineColor(kRed);
|
1621 |
|
|
ossfleft->SetMarkerColor(kRed);
|
1622 |
|
|
ossfleft->Add(osofleft,-1);
|
1623 |
|
|
vector<TF1*> functions = do_cb_fit_to_plot(ossfleft,10);
|
1624 |
|
|
ossfleft->SetMarkerSize(DataMarkerSize);
|
1625 |
|
|
ossfleft->Draw();
|
1626 |
|
|
functions[0]->Draw("same");functions[1]->Draw("same");functions[2]->Draw("same");
|
1627 |
|
|
TF1 *zjetsfunc = (TF1*) functions[1]->Clone();
|
1628 |
|
|
TF1 *zjetsfuncN = (TF1*) functions[0]->Clone();
|
1629 |
|
|
TF1 *zjetsfuncP = (TF1*) functions[2]->Clone();
|
1630 |
|
|
zjetsfunc->Draw("same");zjetsfuncN->Draw("same");zjetsfuncP->Draw("same");
|
1631 |
|
|
TLegend *leg1 = new TLegend(0.6,0.6,0.89,0.80);
|
1632 |
|
|
leg1->SetFillColor(kWhite);
|
1633 |
|
|
leg1->SetLineColor(kWhite);
|
1634 |
|
|
leg1->AddEntry(ossfleft,"OSSF (sub),JZB<peak","p");
|
1635 |
|
|
leg1->AddEntry(zjetsfunc,"OSSF fit ('zjets')","l");
|
1636 |
|
|
leg1->Draw("same");
|
1637 |
|
|
TText *titleleft = write_title("Extracting Z+Jets shape");
|
1638 |
|
|
titleleft->Draw();
|
1639 |
|
|
|
1640 |
|
|
//Step 3: Extract ttbar shape (in data or MC?)
|
1641 |
|
|
c5->cd(2);
|
1642 |
|
|
c5->cd(2)->SetLogy(1);
|
1643 |
|
|
TH1F *osof;
|
1644 |
|
|
TText *titlecenter;
|
1645 |
|
|
bool frommc=false;
|
1646 |
|
|
if(frommc) {
|
1647 |
|
|
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TTJets"));
|
1648 |
|
|
titlecenter = write_title("Extracting ttbar shape (from ossf MC)");
|
1649 |
|
|
}
|
1650 |
|
|
else {
|
1651 |
|
|
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSOF&&jetcut&&lepcut,data,luminosity);
|
1652 |
|
|
titlecenter = write_title("Extracting ttbar shape (from osof data)");
|
1653 |
|
|
}
|
1654 |
|
|
osof->SetMarkerSize(DataMarkerSize);
|
1655 |
|
|
osof->Draw();
|
1656 |
|
|
vector<TF1*> ttbarfunctions = do_cb_fit_to_plot(osof,35,true);
|
1657 |
|
|
ttbarfunctions[0]->SetLineColor(kRed); ttbarfunctions[0]->SetLineStyle(2); ttbarfunctions[0]->Draw("same");
|
1658 |
|
|
ttbarfunctions[1]->SetLineColor(kRed); ttbarfunctions[1]->Draw("same");
|
1659 |
|
|
ttbarfunctions[2]->SetLineColor(kRed); ttbarfunctions[2]->SetLineStyle(2); ttbarfunctions[2]->Draw("same");
|
1660 |
|
|
|
1661 |
|
|
TLegend *leg2 = new TLegend(0.15,0.8,0.4,0.89);
|
1662 |
|
|
leg2->SetFillColor(kWhite);
|
1663 |
|
|
leg2->SetLineColor(kWhite);
|
1664 |
|
|
if(frommc) {
|
1665 |
|
|
leg2->AddEntry(osof,"t#bar{t} OSSF, MC","p");
|
1666 |
|
|
leg2->AddEntry(ttbarfunctions[1],"Fit to t#bar{t} OSSF,MC","l");
|
1667 |
|
|
} else {
|
1668 |
|
|
leg2->AddEntry(osof,"OSOF","p");
|
1669 |
|
|
leg2->AddEntry(ttbarfunctions[1],"Fit to OSOF","l");
|
1670 |
|
|
}
|
1671 |
|
|
leg2->Draw("same");
|
1672 |
|
|
titlecenter->Draw();
|
1673 |
|
|
|
1674 |
|
|
//--------------------------------------------------------------------------------------------------------------------------------
|
1675 |
|
|
//STEP 4: Present it!
|
1676 |
|
|
// actually: if we wanna let it float we need to do that first :-)
|
1677 |
|
|
c5->cd(3);
|
1678 |
|
|
c5->cd(3)->SetLogy(1);
|
1679 |
|
|
TH1F *observed = allsamples.Draw("observed",datajzb,100,0,500, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,data,luminosity);
|
1680 |
|
|
observed->SetMarkerSize(DataMarkerSize);
|
1681 |
|
|
|
1682 |
|
|
TF1 *logparc = new TF1("logparc",InvCrystalBall,0,1000,5); logparc->SetLineColor(kRed);
|
1683 |
|
|
TF1 *logparcn = new TF1("logparcn",InvCrystalBallN,0,1000,5); logparcn->SetLineColor(kRed); logparcn->SetLineStyle(2);
|
1684 |
|
|
TF1 *logparcp = new TF1("logparcp",InvCrystalBallP,0,1000,5); logparcp->SetLineColor(kRed); logparcp->SetLineStyle(2);
|
1685 |
|
|
|
1686 |
|
|
TF1 *zjetsc = new TF1("zjetsc",InvCrystalBall,0,1000,5); zjetsc->SetLineColor(kBlue);
|
1687 |
|
|
TF1 *zjetscn = new TF1("zjetscn",InvCrystalBallN,0,1000,5); zjetscn->SetLineColor(kBlue); zjetscn->SetLineStyle(2);
|
1688 |
|
|
TF1 *zjetscp = new TF1("zjetscp",InvCrystalBallP,0,1000,5); zjetscp->SetLineColor(kBlue); zjetscp->SetLineStyle(2);
|
1689 |
|
|
|
1690 |
|
|
TF1 *ZplusJetsplusTTbar = new TF1("ZplusJetsplusTTbar", DoubleInvCrystalBall,0,1000,10); ZplusJetsplusTTbar->SetLineColor(kBlue);
|
1691 |
|
|
TF1 *ZplusJetsplusTTbarP= new TF1("ZplusJetsplusTTbarP",DoubleInvCrystalBallP,0,1000,10); ZplusJetsplusTTbarP->SetLineColor(kBlue); ZplusJetsplusTTbarP->SetLineStyle(2);
|
1692 |
|
|
TF1 *ZplusJetsplusTTbarN= new TF1("ZplusJetsplusTTbarN",DoubleInvCrystalBallN,0,1000,10); ZplusJetsplusTTbarN->SetLineColor(kBlue); ZplusJetsplusTTbarN->SetLineStyle(2);
|
1693 |
|
|
|
1694 |
|
|
zjetsc->SetParameters(zjetsfunc->GetParameters());
|
1695 |
|
|
zjetscp->SetParameters(zjetsfunc->GetParameters());
|
1696 |
|
|
zjetscn->SetParameters(zjetsfunc->GetParameters());
|
1697 |
|
|
|
1698 |
|
|
TH1F *observeda = allsamples.Draw("observeda",datajzb,53,80,jzbHigh, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,data,luminosity);
|
1699 |
|
|
//blublu
|
1700 |
|
|
logparc->SetParameters(ttbarfunctions[1]->GetParameters());
|
1701 |
|
|
logparcn->SetParameters(ttbarfunctions[1]->GetParameters());
|
1702 |
|
|
logparcp->SetParameters(ttbarfunctions[1]->GetParameters());
|
1703 |
|
|
if(floating) {
|
1704 |
|
|
dout << "TTbar contribution assumed (before fitting) : " << logparc->GetParameter(0) << endl;
|
1705 |
|
|
logparc->SetParameters(ttbarfunctions[1]->GetParameters());
|
1706 |
|
|
for(int i=0;i<10;i++) {
|
1707 |
|
|
if(i<5) ZplusJetsplusTTbar->FixParameter(i,zjetsfunc->GetParameter(i));
|
1708 |
|
|
if(i>=5) {
|
1709 |
|
|
if (i>5) ZplusJetsplusTTbar->FixParameter(i,logparc->GetParameter(i-5));
|
1710 |
|
|
if (i==5) ZplusJetsplusTTbar->SetParameter(i,logparc->GetParameter(i-5));
|
1711 |
|
|
}
|
1712 |
|
|
}//end of setting parameters
|
1713 |
|
|
observeda->Draw("same");
|
1714 |
|
|
ZplusJetsplusTTbar->Draw("same");
|
1715 |
|
|
observeda->Fit(ZplusJetsplusTTbar);
|
1716 |
|
|
dout << "--> Quality of Z+Jets / TTbar fit : chi2/ndf = " << ZplusJetsplusTTbar->GetChisquare() << "/" << ZplusJetsplusTTbar->GetNDF() << endl;
|
1717 |
|
|
ZplusJetsplusTTbar->Draw("same");
|
1718 |
|
|
ZplusJetsplusTTbarP->SetParameters(ZplusJetsplusTTbar->GetParameters());
|
1719 |
|
|
ZplusJetsplusTTbarN->SetParameters(ZplusJetsplusTTbar->GetParameters());
|
1720 |
|
|
dout << "TTbar contribution found (after fitting) : " << ZplusJetsplusTTbar->GetParameter(5) << endl;
|
1721 |
|
|
float factor = ZplusJetsplusTTbar->GetParameter(5) / logparc->GetParameter(0);
|
1722 |
|
|
dout << "FACTOR: " << factor << endl;
|
1723 |
|
|
logparc->SetParameter(0,factor*ttbarfunctions[1]->GetParameter(0));
|
1724 |
|
|
logparcn->SetParameter(0,factor*ttbarfunctions[1]->GetParameter(0));
|
1725 |
|
|
logparcp->SetParameter(0,factor*ttbarfunctions[1]->GetParameter(0));
|
1726 |
|
|
}
|
1727 |
|
|
|
1728 |
|
|
c5->cd(3);
|
1729 |
|
|
c5->cd(3)->SetLogy(1);
|
1730 |
|
|
observed->Draw();
|
1731 |
|
|
zjetsc->Draw("same");zjetscn->Draw("same");zjetscp->Draw("same");
|
1732 |
|
|
logparc->Draw("same");
|
1733 |
|
|
logparcn->Draw("same");
|
1734 |
|
|
logparcp->Draw("same");
|
1735 |
|
|
|
1736 |
|
|
TLegend *leg3 = new TLegend(0.6,0.6,0.89,0.80);
|
1737 |
|
|
leg3->SetFillColor(kWhite);
|
1738 |
|
|
leg3->SetLineColor(kWhite);
|
1739 |
|
|
leg3->AddEntry(observed,"OSSF,JZB>peak","p");
|
1740 |
|
|
leg3->AddEntry(ttbarfunctions[1],"OSOF fit ('ttbar')","l");
|
1741 |
|
|
leg3->AddEntry(zjetsfunc,"OSSF,JZB<0 fit ('zjets')","l");
|
1742 |
|
|
leg3->Draw("same");
|
1743 |
|
|
TText *titleright = write_title("Summary of shapes and observed shape");
|
1744 |
|
|
titleright->Draw();
|
1745 |
|
|
|
1746 |
|
|
c6->cd()->SetLogy(1);
|
1747 |
|
|
observed->Draw();
|
1748 |
|
|
zjetsc->Draw("same");zjetscn->Draw("same");zjetscp->Draw("same");
|
1749 |
|
|
logparc->Draw("same");
|
1750 |
|
|
logparcn->Draw("same");
|
1751 |
|
|
logparcp->Draw("same");
|
1752 |
|
|
leg3->Draw("same");
|
1753 |
|
|
titleright->Draw();
|
1754 |
|
|
|
1755 |
|
|
if(scenario==0) {
|
1756 |
|
|
CompleteSave(c5,"Shapes2/Making_of___3jetsabove30"+writescenario);
|
1757 |
|
|
CompleteSave(c5->cd(1),"Shapes2/Making_of___3jetsabove30"+writescenario+"__cd1");
|
1758 |
|
|
CompleteSave(c5->cd(2),"Shapes2/Making_of___3jetsabove30"+writescenario+"__cd2");
|
1759 |
|
|
CompleteSave(c5->cd(3),"Shapes2/Making_of___3jetsabove30"+writescenario+"__cd3");
|
1760 |
|
|
CompleteSave(c6,"Shapes2/Background_Shapes___3jetsabove30"+writescenario);
|
1761 |
|
|
} else {
|
1762 |
|
|
CompleteSave(c5,"Shapes2/Making_of___2jetsabove50"+writescenario);
|
1763 |
|
|
CompleteSave(c5->cd(1),"Shapes2/Making_of___2jetsabove50"+writescenario+"__cd1");
|
1764 |
|
|
CompleteSave(c5->cd(2),"Shapes2/Making_of___2jetsabove50"+writescenario+"__cd2");
|
1765 |
|
|
CompleteSave(c5->cd(3),"Shapes2/Making_of___2jetsabove50"+writescenario+"__cd3");
|
1766 |
|
|
CompleteSave(c6,"Shapes2/Background_Shapes___2jetsabove50"+writescenario);
|
1767 |
|
|
}
|
1768 |
|
|
dout << "Statistics about our fits: " << endl;
|
1769 |
|
|
dout << "Z+Jets shape: Chi2/ndf = " << zjetsfunc->GetChisquare() << "/" << ossfleft->GetNbinsX() << endl;
|
1770 |
|
|
dout << "ttbar shape: Chi2/ndf = " << ttbarfunctions[1]->GetChisquare() << "/" << osof->GetNbinsX() << endl;
|
1771 |
|
|
|
1772 |
|
|
c6->cd();
|
1773 |
|
|
TLegend *additionallegend = new TLegend(0.6,0.6,0.89,0.89);
|
1774 |
|
|
additionallegend->SetFillColor(kWhite);
|
1775 |
|
|
additionallegend->SetLineColor(kWhite);
|
1776 |
|
|
additionallegend->AddEntry(observed,"Data","p");
|
1777 |
|
|
additionallegend->AddEntry(ZplusJetsplusTTbar,"Fitted Z+jets & TTbar","l");
|
1778 |
|
|
additionallegend->AddEntry(zjetsc,"Z+jets","l");
|
1779 |
|
|
additionallegend->AddEntry(logparc,"TTbar","l");
|
1780 |
|
|
observed->Draw();
|
1781 |
|
|
ZplusJetsplusTTbar->SetLineColor(kGreen);
|
1782 |
|
|
ZplusJetsplusTTbarP->SetLineColor(kGreen);
|
1783 |
|
|
ZplusJetsplusTTbarN->SetLineColor(kGreen);
|
1784 |
|
|
ZplusJetsplusTTbarP->SetLineStyle(2);
|
1785 |
|
|
ZplusJetsplusTTbarN->SetLineStyle(2);
|
1786 |
|
|
TF1 *ZplusJetsplusTTbar2 = new TF1("ZplusJetsplusTTbar2",DoubleInvCrystalBall,0,1000,10);
|
1787 |
|
|
ZplusJetsplusTTbar2->SetParameters(ZplusJetsplusTTbar->GetParameters());
|
1788 |
|
|
ZplusJetsplusTTbar2->SetLineColor(kGreen);
|
1789 |
|
|
ZplusJetsplusTTbarP->SetFillColor(TColor::GetColor("#81F781"));
|
1790 |
|
|
ZplusJetsplusTTbarN->SetFillColor(kWhite);
|
1791 |
|
|
ZplusJetsplusTTbarP->Draw("fcsame");
|
1792 |
|
|
ZplusJetsplusTTbarN->Draw("fcsame");
|
1793 |
|
|
TH1F *hZplusJetsplusTTbar = (TH1F*)ZplusJetsplusTTbar2->GetHistogram();
|
1794 |
|
|
TH1F *hZplusJetsplusTTbarN = (TH1F*)ZplusJetsplusTTbarN->GetHistogram();
|
1795 |
|
|
TH1F *hZplusJetsplusTTbarP = (TH1F*)ZplusJetsplusTTbarP->GetHistogram();
|
1796 |
|
|
hZplusJetsplusTTbar->SetMarkerSize(0);
|
1797 |
|
|
hZplusJetsplusTTbarP->SetMarkerSize(0);
|
1798 |
|
|
hZplusJetsplusTTbarN->SetMarkerSize(0);
|
1799 |
|
|
for (int i=1;i<=hZplusJetsplusTTbar->GetNbinsX();i++) {
|
1800 |
|
|
float newerror=hZplusJetsplusTTbarP->GetBinContent(i)-hZplusJetsplusTTbar->GetBinContent(i);
|
1801 |
|
|
hZplusJetsplusTTbar->SetBinError(i,newerror);
|
1802 |
|
|
if(hZplusJetsplusTTbar->GetBinContent(i)<0.05) hZplusJetsplusTTbar->SetBinContent(i,0); //avoiding a displaying probolem
|
1803 |
|
|
}
|
1804 |
|
|
hZplusJetsplusTTbarP->SetFillColor(kGreen);
|
1805 |
|
|
hZplusJetsplusTTbarN->SetFillColor(kWhite);
|
1806 |
|
|
hZplusJetsplusTTbarN->Draw("same");
|
1807 |
|
|
|
1808 |
|
|
ZplusJetsplusTTbar2->SetMarkerSize(0);
|
1809 |
|
|
ZplusJetsplusTTbar2->Draw("same");
|
1810 |
|
|
|
1811 |
|
|
zjetsc->Draw("same");zjetscn->Draw("same");zjetscp->Draw("same");
|
1812 |
|
|
logparc->Draw("same");
|
1813 |
|
|
logparcn->Draw("same");
|
1814 |
|
|
logparcp->Draw("same");
|
1815 |
|
|
additionallegend->Draw("same");
|
1816 |
|
|
if(scenario==0) {
|
1817 |
|
|
CompleteSave(c6,"Shapes2/Background_Shapes___3jetsabove30__allfits__"+writescenario);
|
1818 |
|
|
} else {
|
1819 |
|
|
CompleteSave(c6,"Shapes2/Background_Shapes___2jetsabove50__allfits__"+writescenario);
|
1820 |
|
|
}
|
1821 |
|
|
//--------------------------------------------------------------------------------------------------------------------------------
|
1822 |
|
|
}
|
1823 |
|
|
|
1824 |
|
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) {
|
1825 |
|
|
int all_leptons=-1;
|
1826 |
|
|
int electrons_only=0;
|
1827 |
|
|
int mu_only=1;
|
1828 |
|
|
int twojetswith50gev=1;
|
1829 |
|
|
int threejetswith30gev=0;
|
1830 |
|
|
/*
|
1831 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev);
|
1832 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev);
|
1833 |
|
|
|
1834 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,electrons_only,twojetswith50gev);
|
1835 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,electrons_only,threejetswith30gev);
|
1836 |
|
|
|
1837 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,mu_only,twojetswith50gev);
|
1838 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,mu_only,threejetswith30gev);
|
1839 |
|
|
*/
|
1840 |
|
|
|
1841 |
|
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true);
|
1842 |
|
|
}
|
1843 |
|
|
|
1844 |
|
|
void find_correction_factors(string &jzbvardata,string &jzbvarmc) {
|
1845 |
|
|
//first: colorful plots
|
1846 |
|
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction");
|
1847 |
|
|
cancorr->SetLogz();
|
1848 |
|
|
cancorr->SetRightMargin(0.13);
|
1849 |
|
|
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak
|
1850 |
|
|
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)");
|
1851 |
|
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5);
|
1852 |
|
|
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation);
|
1853 |
|
|
niceresponseplotd->SetStats(0);
|
1854 |
|
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]");
|
1855 |
|
|
niceresponseplotd->GetYaxis()->SetTitle("Response");
|
1856 |
|
|
niceresponseplotd->GetXaxis()->CenterTitle();
|
1857 |
|
|
niceresponseplotd->GetYaxis()->CenterTitle();
|
1858 |
|
|
niceresponseplotd->Draw("COLZ");
|
1859 |
|
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX();
|
1860 |
|
|
profd->SetMarkerSize(DataMarkerSize);
|
1861 |
|
|
profd->Fit("pol0","","same,e1",30,400);
|
1862 |
|
|
DrawPrelim();
|
1863 |
|
|
TText* title = write_text(0.5,0.7,"Data");
|
1864 |
|
|
title->SetTextAlign(12);
|
1865 |
|
|
title->Draw();
|
1866 |
|
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0");
|
1867 |
|
|
float datacorrection=datapol->GetParameter(0);
|
1868 |
|
|
stringstream dataresstring;
|
1869 |
|
|
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %";
|
1870 |
|
|
TText* restitle = write_text(0.5,0.65,dataresstring.str());
|
1871 |
|
|
restitle->SetTextAlign(12);
|
1872 |
|
|
restitle->SetTextSize(0.03);
|
1873 |
|
|
restitle->Draw();
|
1874 |
|
|
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data");
|
1875 |
|
|
|
1876 |
|
|
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5);
|
1877 |
|
|
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation);
|
1878 |
|
|
niceresponseplotm->SetStats(0);
|
1879 |
|
|
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]");
|
1880 |
|
|
niceresponseplotm->GetYaxis()->SetTitle("Response");
|
1881 |
|
|
niceresponseplotm->GetXaxis()->CenterTitle();
|
1882 |
|
|
niceresponseplotm->GetYaxis()->CenterTitle();
|
1883 |
|
|
niceresponseplotm->Draw("COLZ");
|
1884 |
|
|
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same");
|
1885 |
|
|
TProfile * profm = (TProfile*)niceresponseplotm->ProfileX();
|
1886 |
|
|
profm->SetMarkerSize(DataMarkerSize);
|
1887 |
|
|
profm->Fit("pol0","","same,e1",30,400);
|
1888 |
|
|
DrawMCPrelim();
|
1889 |
|
|
title = write_text(0.5,0.7,"MC simulation");
|
1890 |
|
|
title->SetTextAlign(12);
|
1891 |
|
|
title->Draw();
|
1892 |
|
|
TF1 *mcpol=(TF1*)profm->GetFunction("pol0");
|
1893 |
|
|
float mccorrection=mcpol->GetParameter(0);
|
1894 |
|
|
stringstream mcresstring;
|
1895 |
|
|
mcresstring<<"Response: "<<std::setprecision(2)<<100*mccorrection<<" %";
|
1896 |
|
|
TText* mcrestitle = write_text(0.5,0.65,mcresstring.str());
|
1897 |
|
|
mcrestitle->SetTextAlign(12);
|
1898 |
|
|
mcrestitle->SetTextSize(0.03);
|
1899 |
|
|
mcrestitle->Draw();
|
1900 |
|
|
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_MC");
|
1901 |
|
|
|
1902 |
|
|
|
1903 |
|
|
//Step 2: Getting the result
|
1904 |
|
|
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)");
|
1905 |
|
|
stringstream jzbvardatas;
|
1906 |
|
|
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)";
|
1907 |
|
|
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)";
|
1908 |
|
|
jzbvardata=jzbvardatas.str();
|
1909 |
|
|
stringstream jzbvarmcs;
|
1910 |
|
|
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)";
|
1911 |
|
|
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)";
|
1912 |
|
|
jzbvarmc=jzbvarmcs.str();
|
1913 |
|
|
dout << "JZB Z pt correction summary : " << endl;
|
1914 |
|
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl;
|
1915 |
|
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl;
|
1916 |
|
|
}
|
1917 |
|
|
|
1918 |
|
|
void pick_up_events(string cut) {
|
1919 |
|
|
dout << "Picking up events with cut " << cut << endl;
|
1920 |
|
|
allsamples.PickUpEvents(cut);
|
1921 |
|
|
}
|
1922 |
|
|
|
1923 |
|
|
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError) {
|
1924 |
|
|
dout << "Saving configuration template!" << endl;
|
1925 |
|
|
ofstream configfile;
|
1926 |
|
|
configfile.open("../DistributedModelCalculations/last_configuration.C");
|
1927 |
|
|
configfile<<"#include <iostream>\n";
|
1928 |
|
|
configfile<<"#include <vector>\n";
|
1929 |
|
|
configfile<<"#ifndef SampleClassLoaded\n";
|
1930 |
|
|
configfile<<"#include \"SampleClass.C\"\n";
|
1931 |
|
|
configfile<<"#endif\n";
|
1932 |
|
|
configfile<<"#define SetupLoaded\n";
|
1933 |
|
|
configfile<<"#ifndef ResultLibraryClassLoaded\n";
|
1934 |
|
|
configfile<<"#include \"ResultLibraryClass.C\"\n";
|
1935 |
|
|
configfile<<"#endif\n";
|
1936 |
|
|
|
1937 |
|
|
configfile<<"\nusing namespace std;\n\n";
|
1938 |
|
|
|
1939 |
|
|
configfile<<"namespace PlottingSetup { \n";
|
1940 |
|
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n";
|
1941 |
|
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n";
|
1942 |
|
|
configfile<<"vector<float>jzb_cuts;\n";
|
1943 |
|
|
configfile<<"float MCPeakError=-999;\n";
|
1944 |
|
|
configfile<<"}\n\n";
|
1945 |
|
|
|
1946 |
|
|
configfile<<"void read_config() {\n";
|
1947 |
|
|
configfile<<"datajzb=\""<<datajzb<<"\";\n";
|
1948 |
|
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n";
|
1949 |
|
|
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n\n";
|
1950 |
|
|
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1951 |
|
|
configfile<<"\n\n";
|
1952 |
|
|
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1953 |
|
|
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1954 |
|
|
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1955 |
|
|
configfile<<"\n\n";
|
1956 |
|
|
for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1957 |
|
|
for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1958 |
|
|
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
|
1959 |
|
|
configfile<<"\n\n";
|
1960 |
|
|
configfile<<"luminosity="<<luminosity<<";\n";
|
1961 |
buchmann |
1.5 |
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n";
|
1962 |
buchmann |
1.1 |
|
1963 |
|
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n";
|
1964 |
|
|
|
1965 |
|
|
configfile.close();
|
1966 |
|
|
|
1967 |
|
|
}
|
1968 |
|
|
|
1969 |
|
|
float get_nonzero_minimum(TH1F *histo) {
|
1970 |
|
|
float min=histo->GetMaximum();
|
1971 |
|
|
for(int ibin=1;ibin<=histo->GetNbinsX();ibin++) {
|
1972 |
|
|
float curcont=histo->GetBinContent(ibin);
|
1973 |
|
|
if(curcont<min&&curcont>0) min=curcont;
|
1974 |
|
|
}
|
1975 |
|
|
return min;
|
1976 |
|
|
}
|
1977 |
|
|
|
1978 |
|
|
void draw_all_ttbar_histos(TCanvas *can, vector<TH1F*> histos, string drawoption="", float manualmin=-9) {
|
1979 |
|
|
can->cd();
|
1980 |
|
|
float min=1;
|
1981 |
|
|
float max=histos[0]->GetMaximum();
|
1982 |
|
|
if(manualmin>=0) min=manualmin;
|
1983 |
|
|
else {
|
1984 |
|
|
for(int i=1;i<histos.size();i++) {
|
1985 |
|
|
float curmin=get_nonzero_minimum(histos[i]);
|
1986 |
|
|
float curmax=histos[i]->GetMaximum();
|
1987 |
|
|
if(curmin<min) min=curmin;
|
1988 |
|
|
if(curmax>max) max=curmax;
|
1989 |
|
|
}
|
1990 |
|
|
}
|
1991 |
|
|
histos[0]->GetYaxis()->SetRangeUser(min,4*max);
|
1992 |
|
|
histos[0]->Draw(drawoption.c_str());
|
1993 |
|
|
stringstream drawopt;
|
1994 |
|
|
drawopt << drawoption << ",same";
|
1995 |
|
|
for(int i=1;i<histos.size();i++) {
|
1996 |
|
|
histos[i]->Draw(drawopt.str().c_str());
|
1997 |
|
|
}
|
1998 |
|
|
}
|
1999 |
|
|
|
2000 |
|
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring) {
|
2001 |
|
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value
|
2002 |
|
|
//in the case of the OFF peak analysis, we compare our control region to the real value
|
2003 |
|
|
TCut weightbackup=cutWeight;
|
2004 |
|
|
cutWeight="1.0";
|
2005 |
|
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings
|
2006 |
|
|
|
2007 |
|
|
|
2008 |
|
|
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2009 |
|
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2010 |
|
|
TH1F *TSem;
|
2011 |
|
|
TH1F *nTSem;
|
2012 |
|
|
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2013 |
|
|
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2014 |
|
|
TH1F *TSeemm;
|
2015 |
|
|
TH1F *nTSeemm;
|
2016 |
|
|
|
2017 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2018 |
|
|
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2019 |
|
|
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2020 |
|
|
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2021 |
|
|
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
|
2022 |
|
|
}
|
2023 |
|
|
|
2024 |
|
|
TCanvas *tcan = new TCanvas("tcan","tcan");
|
2025 |
|
|
|
2026 |
|
|
tcan->SetLogy(1);
|
2027 |
|
|
|
2028 |
|
|
TZeemm->SetLineColor(kBlack);
|
2029 |
|
|
TZem->SetLineColor(kRed);
|
2030 |
|
|
TZeemm->SetMarkerColor(kBlack);
|
2031 |
|
|
TZem->SetMarkerColor(kRed);
|
2032 |
|
|
|
2033 |
|
|
|
2034 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2035 |
|
|
TSem->SetLineColor(TColor::GetColor("#00A616"));
|
2036 |
|
|
TSeemm->SetLineColor(kMagenta+2);
|
2037 |
|
|
TSem->SetMarkerColor(TColor::GetColor("#00A616"));
|
2038 |
|
|
TSeemm->SetMarkerColor(kMagenta+2);
|
2039 |
|
|
TSem->SetLineStyle(2);
|
2040 |
|
|
TSeemm->SetLineStyle(3);
|
2041 |
|
|
}
|
2042 |
|
|
|
2043 |
|
|
vector<TH1F*> histos;
|
2044 |
|
|
histos.push_back(TZem);
|
2045 |
|
|
histos.push_back(TZeemm);
|
2046 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2047 |
|
|
histos.push_back(TSem);
|
2048 |
|
|
histos.push_back(TSeemm);
|
2049 |
|
|
}
|
2050 |
|
|
draw_all_ttbar_histos(tcan,histos,"histo",0.04);
|
2051 |
|
|
|
2052 |
|
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false);
|
2053 |
|
|
leg->AddEntry(TZeemm,"SFZP","l");
|
2054 |
|
|
leg->AddEntry(TZem,"OFZP","l");
|
2055 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2056 |
|
|
leg->AddEntry(TSeemm,"SFSB","l");
|
2057 |
|
|
leg->AddEntry(TSem,"OFSB","l");
|
2058 |
|
|
}
|
2059 |
|
|
leg->Draw("same");
|
2060 |
|
|
DrawMCPrelim(simulatedlumi);
|
2061 |
|
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison");
|
2062 |
|
|
|
2063 |
|
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy");
|
2064 |
|
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
|
2065 |
|
|
TH1F *TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy");
|
2066 |
|
|
TH1F *TSemcopy = (TH1F*)TSem->Clone("TSemcopy");
|
2067 |
|
|
|
2068 |
|
|
TZem->Divide(TZeemm);
|
2069 |
|
|
TZem->SetMarkerStyle(21);
|
2070 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2071 |
|
|
TSem->Divide(TZeemm);
|
2072 |
|
|
TSeemm->Divide(TZeemm);
|
2073 |
|
|
TSem->SetMarkerStyle(24);
|
2074 |
|
|
TSeemm->SetMarkerStyle(32);
|
2075 |
|
|
}
|
2076 |
|
|
|
2077 |
|
|
tcan->SetLogy(0);
|
2078 |
|
|
TZem->GetYaxis()->SetRangeUser(0,2.5);
|
2079 |
|
|
TZem->GetYaxis()->SetTitle("ratio");
|
2080 |
|
|
TZem->Draw();
|
2081 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2082 |
|
|
TSem->Draw("same");
|
2083 |
|
|
TSeemm->Draw("same");
|
2084 |
|
|
}
|
2085 |
|
|
|
2086 |
|
|
float linepos=0.25;
|
2087 |
|
|
if(PlottingSetup::RestrictToMassPeak) linepos=0.25;
|
2088 |
|
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos);
|
2089 |
|
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0);
|
2090 |
|
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos);
|
2091 |
|
|
|
2092 |
|
|
top->SetLineColor(kBlue);top->SetLineStyle(2);
|
2093 |
|
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2);
|
2094 |
|
|
center->SetLineColor(kBlue);
|
2095 |
|
|
|
2096 |
|
|
top->Draw("same");
|
2097 |
|
|
center->Draw("same");
|
2098 |
|
|
bottom->Draw("same");
|
2099 |
|
|
|
2100 |
|
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false);
|
2101 |
|
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple");
|
2102 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2103 |
|
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple");
|
2104 |
|
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple");
|
2105 |
|
|
}
|
2106 |
|
|
leg2->AddEntry(bottom,"syst. envelope","l");
|
2107 |
|
|
leg2->SetX1(0.25);leg2->SetX2(0.6);
|
2108 |
|
|
leg2->SetY1(0.65);
|
2109 |
|
|
|
2110 |
|
|
leg2->Draw("same");
|
2111 |
|
|
|
2112 |
|
|
DrawMCPrelim(simulatedlumi);
|
2113 |
|
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio");
|
2114 |
|
|
|
2115 |
|
|
|
2116 |
|
|
|
2117 |
|
|
///-------------- second part: only look at the quantity we actually care about!
|
2118 |
|
|
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp");
|
2119 |
|
|
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp");
|
2120 |
|
|
rightsfzp->Add(leftsfzp,-1);
|
2121 |
|
|
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp");
|
2122 |
|
|
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp");
|
2123 |
|
|
rightofzp->Add(leftofzp,-1);
|
2124 |
|
|
TH1F *leftofsb;
|
2125 |
|
|
TH1F *rightofsb;
|
2126 |
|
|
TH1F *leftsfsb;
|
2127 |
|
|
TH1F *rightsfsb;
|
2128 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2129 |
|
|
leftofsb = (TH1F*)nTSem->Clone("leftofsb");
|
2130 |
|
|
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb");
|
2131 |
|
|
rightofsb->Add(leftofsb,-1);
|
2132 |
|
|
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb");
|
2133 |
|
|
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb");
|
2134 |
|
|
rightsfsb->Add(leftsfsb,-1);
|
2135 |
|
|
}
|
2136 |
|
|
|
2137 |
|
|
tcan->SetLogy(1);
|
2138 |
|
|
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]);
|
2139 |
|
|
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV");
|
2140 |
|
|
rightsfzp->Draw("histo");
|
2141 |
|
|
rightofzp->Draw("histo,same");
|
2142 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2143 |
|
|
rightofsb->Draw("histo,same");
|
2144 |
|
|
rightsfsb->Draw("histo,same");
|
2145 |
|
|
}
|
2146 |
|
|
DrawMCPrelim(simulatedlumi);
|
2147 |
|
|
|
2148 |
|
|
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false);
|
2149 |
|
|
legA->AddEntry(rightsfzp,"SFZP","l");
|
2150 |
|
|
legA->AddEntry(rightofzp,"OFZP","l");
|
2151 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2152 |
|
|
legA->AddEntry(rightofsb,"SFSB","l");
|
2153 |
|
|
legA->AddEntry(rightsfsb,"OFSB","l");
|
2154 |
|
|
}
|
2155 |
|
|
legA->Draw();
|
2156 |
|
|
|
2157 |
|
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison");
|
2158 |
|
|
|
2159 |
|
|
tcan->SetLogy(0);
|
2160 |
|
|
rightofzp->Divide(rightsfzp);
|
2161 |
|
|
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]);
|
2162 |
|
|
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0);
|
2163 |
|
|
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio");
|
2164 |
|
|
rightofzp->Draw();
|
2165 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2166 |
|
|
rightofsb->Divide(rightsfzp);
|
2167 |
|
|
rightsfsb->Divide(rightsfzp);
|
2168 |
|
|
rightofsb->Draw("same");
|
2169 |
|
|
rightsfsb->Draw("same");
|
2170 |
|
|
}
|
2171 |
|
|
|
2172 |
|
|
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos);
|
2173 |
|
|
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0);
|
2174 |
|
|
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos);
|
2175 |
|
|
|
2176 |
|
|
top2->SetLineColor(kBlue);top2->SetLineStyle(2);
|
2177 |
|
|
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2);
|
2178 |
|
|
center2->SetLineColor(kBlue);
|
2179 |
|
|
|
2180 |
|
|
top2->Draw("same");
|
2181 |
|
|
center2->Draw("same");
|
2182 |
|
|
bottom2->Draw("same");
|
2183 |
|
|
|
2184 |
|
|
rightofzp->SetMarkerStyle(21);
|
2185 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2186 |
|
|
rightofsb->SetMarkerStyle(24);
|
2187 |
|
|
rightsfsb->SetMarkerStyle(32);
|
2188 |
|
|
}
|
2189 |
|
|
|
2190 |
|
|
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false);
|
2191 |
|
|
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple");
|
2192 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2193 |
|
|
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple");
|
2194 |
|
|
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple");
|
2195 |
|
|
}
|
2196 |
|
|
leg3->AddEntry(bottom,"syst. envelope","l");
|
2197 |
|
|
leg3->SetX1(0.25);leg3->SetX2(0.6);
|
2198 |
|
|
leg3->SetY1(0.65);
|
2199 |
|
|
|
2200 |
|
|
leg3->Draw("same");
|
2201 |
|
|
|
2202 |
|
|
DrawMCPrelim(simulatedlumi);
|
2203 |
|
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio");
|
2204 |
|
|
|
2205 |
|
|
delete TZem;
|
2206 |
|
|
delete nTZem;
|
2207 |
|
|
delete TZeemm;
|
2208 |
|
|
delete nTZeemm;
|
2209 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2210 |
|
|
delete TSem;
|
2211 |
|
|
delete nTSem;
|
2212 |
|
|
delete TSeemm;
|
2213 |
|
|
delete nTSeemm;
|
2214 |
|
|
}
|
2215 |
|
|
|
2216 |
|
|
delete tcan;
|
2217 |
|
|
cutWeight=weightbackup;
|
2218 |
|
|
}
|
2219 |
|
|
|
2220 |
|
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) {
|
2221 |
|
|
vector<float> nicer_binning;
|
2222 |
|
|
nicer_binning.push_back(-125);
|
2223 |
|
|
nicer_binning.push_back(-100);
|
2224 |
|
|
nicer_binning.push_back(-75);
|
2225 |
|
|
nicer_binning.push_back(-50);
|
2226 |
|
|
nicer_binning.push_back(-25);
|
2227 |
|
|
nicer_binning.push_back(0);
|
2228 |
|
|
nicer_binning.push_back(25);
|
2229 |
|
|
nicer_binning.push_back(50);
|
2230 |
|
|
nicer_binning.push_back(75);
|
2231 |
|
|
nicer_binning.push_back(100);
|
2232 |
|
|
nicer_binning.push_back(125);
|
2233 |
|
|
nicer_binning.push_back(150);
|
2234 |
|
|
nicer_binning.push_back(175);
|
2235 |
|
|
nicer_binning.push_back(200);
|
2236 |
|
|
nicer_binning.push_back(230);
|
2237 |
|
|
nicer_binning.push_back(280);
|
2238 |
|
|
nicer_binning.push_back(400);
|
2239 |
|
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/");
|
2240 |
|
|
}
|
2241 |
|
|
|
2242 |
|
|
|
2243 |
|
|
void zjets_prediction_comparison() {
|
2244 |
|
|
// Do it without PU re-weighting
|
2245 |
|
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0;
|
2246 |
|
|
stringstream resultsNoPU;
|
2247 |
|
|
|
2248 |
|
|
stringstream mcjzbnoPU;
|
2249 |
|
|
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false);
|
2250 |
|
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")";
|
2251 |
|
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")";
|
2252 |
|
|
|
2253 |
|
|
string mcjzb = mcjzbnoPU.str();
|
2254 |
|
|
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl;
|
2255 |
|
|
|
2256 |
|
|
TCut weightbackup=cutWeight;
|
2257 |
|
|
cutWeight="1.0";
|
2258 |
|
|
float sbg_min=0.;
|
2259 |
|
|
float sbg_max=100.;
|
2260 |
|
|
int sbg_nbins=5;
|
2261 |
|
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings
|
2262 |
|
|
|
2263 |
|
|
TCut kPos((mcjzb+">0").c_str());
|
2264 |
|
|
TCut kNeg((mcjzb+"<0").c_str());
|
2265 |
|
|
string var( "abs("+mcjzb+")" );
|
2266 |
|
|
|
2267 |
|
|
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2");
|
2268 |
|
|
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",
|
2269 |
buchmann |
1.3 |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
|
2270 |
buchmann |
1.1 |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",
|
2271 |
buchmann |
1.3 |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
|
2272 |
buchmann |
1.1 |
hJZBpos->SetLineColor(kBlack);
|
2273 |
|
|
hJZBneg->SetLineColor(kRed);
|
2274 |
|
|
|
2275 |
|
|
Int_t nbins = 5;
|
2276 |
|
|
Float_t xmax = 100.;
|
2277 |
|
|
|
2278 |
|
|
|
2279 |
|
|
TCanvas *zcan = new TCanvas("zcan","zcan");
|
2280 |
|
|
zcan->SetLogy(1);
|
2281 |
|
|
|
2282 |
|
|
hJZBpos->Draw("e1");
|
2283 |
|
|
hJZBneg->Draw("same,hist");
|
2284 |
|
|
hJZBpos->Draw("same,e1"); // So it's on top...
|
2285 |
|
|
|
2286 |
|
|
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false);
|
2287 |
|
|
leg->AddEntry(hJZBpos,"Observed","pe");
|
2288 |
|
|
leg->AddEntry(hJZBneg,"Predicted","l");
|
2289 |
|
|
leg->Draw("same");
|
2290 |
|
|
DrawMCPrelim(simulatedlumi);
|
2291 |
|
|
CompleteSave(zcan,"Systematics/zjets_prediction");
|
2292 |
|
|
|
2293 |
|
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio");
|
2294 |
|
|
hratio->Divide(hJZBneg);
|
2295 |
|
|
|
2296 |
|
|
zcan->SetLogy(0);
|
2297 |
|
|
hratio->GetYaxis()->SetRangeUser(0,2.5);
|
2298 |
|
|
hratio->GetYaxis()->SetTitle("Observed/Predicted");
|
2299 |
|
|
hratio->Draw("e1");
|
2300 |
|
|
|
2301 |
|
|
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25);
|
2302 |
|
|
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0);
|
2303 |
|
|
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75);
|
2304 |
|
|
|
2305 |
|
|
|
2306 |
|
|
top->SetLineColor(kBlue);top->SetLineStyle(2);
|
2307 |
|
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2);
|
2308 |
|
|
center->SetLineColor(kBlue);
|
2309 |
|
|
|
2310 |
|
|
top->Draw("same");
|
2311 |
|
|
center->Draw("same");
|
2312 |
|
|
bottom->Draw("same");
|
2313 |
|
|
|
2314 |
|
|
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false);
|
2315 |
|
|
leg2->AddEntry(hratio,"obs / pred","pe");
|
2316 |
|
|
leg2->AddEntry(bottom,"syst. envelope","l");
|
2317 |
|
|
leg2->Draw("same");
|
2318 |
|
|
DrawMCPrelim(simulatedlumi);
|
2319 |
|
|
CompleteSave(zcan,"Systematics/zjets_prediction_ratio");
|
2320 |
|
|
|
2321 |
|
|
delete zcan;
|
2322 |
|
|
cutWeight=weightbackup;
|
2323 |
|
|
|
2324 |
|
|
}
|
2325 |
|
|
|
2326 |
|
|
|
2327 |
|
|
|
2328 |
|
|
void sideband_assessment(string datajzb, float min=30.0, float max=50.0) {
|
2329 |
|
|
tout << endl << endl;
|
2330 |
|
|
stringstream bordercut;
|
2331 |
|
|
bordercut << "(TMath::Abs(" << datajzb << ")<" << max << ")&&(TMath::Abs(" << datajzb << ")>" << min << ")";
|
2332 |
|
|
tout << bordercut.str().c_str() << endl;
|
2333 |
|
|
TH1F *ofsb = allsamples.Draw("ofsb",datajzb,100, 0,100, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&bordercut.str().c_str(),data, luminosity);
|
2334 |
|
|
TH1F *ofzp = allsamples.Draw("ofzp",datajzb,100, 0,100, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&bordercut.str().c_str(),data, luminosity);
|
2335 |
|
|
float OFSB = ofsb->Integral();
|
2336 |
|
|
float OFZP = ofzp->Integral();
|
2337 |
|
|
|
2338 |
|
|
tout << "\\begin{table}[hbtp]" << endl;
|
2339 |
|
|
tout << "\\renewcommand{\\arraystretch}{1.3}" << endl;
|
2340 |
|
|
tout << "\\begin{center}" << endl;
|
2341 |
|
|
tout << "\\caption{Total number of events observed in the auxiliary region $|JZB|>"<<min<<"\\GeV \\cup |JZB|<"<<max<<"\\GeV$ for the {\\OFZP} and {\\OFSB}.}\\label{tab:auxcounts}" << endl;
|
2342 |
|
|
tout << "\\begin{tabular}{l|cc}" << endl;
|
2343 |
|
|
tout << "\\hline" << endl;
|
2344 |
|
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl;
|
2345 |
|
|
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl;
|
2346 |
|
|
tout << "\\end{tabular}" << endl;
|
2347 |
|
|
tout << "\\end{center}" << endl;
|
2348 |
|
|
tout << "\\end{table}" << endl;
|
2349 |
|
|
|
2350 |
|
|
|
2351 |
|
|
}
|
2352 |
|
|
|
2353 |
|
|
void make_table(samplecollection &coll, string jzbexpr, bool is_data, vector<float> jzb_cuts, string subselection="none") {
|
2354 |
|
|
|
2355 |
|
|
vector<float> jzbcutprediction;
|
2356 |
|
|
vector<float> metcutprediction;
|
2357 |
|
|
|
2358 |
|
|
vector<float> jzbcutobservation;
|
2359 |
|
|
vector<float> metcutobservation;
|
2360 |
|
|
|
2361 |
|
|
TCanvas *cannie = new TCanvas("cannie","cannie");
|
2362 |
|
|
|
2363 |
|
|
for(int icut=0;icut<jzb_cuts.size();icut++) {
|
2364 |
|
|
float currcut=jzb_cuts[icut];
|
2365 |
|
|
int nbins=1;float low=currcut;
|
2366 |
|
|
vector<int> mysample;
|
2367 |
|
|
if(subselection!="none") mysample=coll.FindSample(subselection);
|
2368 |
|
|
TH1F *RcorrJZBeemm = coll.Draw("RcorrJZBeemm",jzbexpr,1,currcut,14000, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
|
2369 |
|
|
TH1F *LcorrJZBeemm = coll.Draw("LcorrJZBeemm",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
|
2370 |
|
|
TH1F *RcorrJZBem = coll.Draw("RcorrJZBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
|
2371 |
|
|
TH1F *LcorrJZBem = coll.Draw("LcorrJZBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
|
2372 |
|
|
|
2373 |
|
|
TH1F *RcorrJZBSBem;
|
2374 |
|
|
TH1F *LcorrJZBSBem;
|
2375 |
|
|
TH1F *RcorrJZBSBeemm;
|
2376 |
|
|
TH1F *LcorrJZBSBeemm;
|
2377 |
|
|
|
2378 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2379 |
|
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
|
2380 |
|
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
|
2381 |
|
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
|
2382 |
|
|
LcorrJZBSBeemm = coll.Draw("LcorrJZBSBeemm",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
|
2383 |
|
|
}
|
2384 |
|
|
|
2385 |
|
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
|
2386 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2387 |
|
|
Bpred->Add(RcorrJZBem,1.0/3.);
|
2388 |
|
|
Bpred->Add(LcorrJZBem,-1.0/3.);
|
2389 |
|
|
Bpred->Add(RcorrJZBSBem,1.0/3.);
|
2390 |
|
|
Bpred->Add(LcorrJZBSBem,-1.0/3.);
|
2391 |
|
|
Bpred->Add(RcorrJZBSBeemm,1.0/3.);
|
2392 |
|
|
Bpred->Add(LcorrJZBSBeemm,-1.0/3.);
|
2393 |
|
|
} else {
|
2394 |
|
|
Bpred->Add(RcorrJZBem,1.0);
|
2395 |
|
|
Bpred->Add(LcorrJZBem,-1.0);
|
2396 |
|
|
}
|
2397 |
|
|
|
2398 |
|
|
jzbcutobservation.push_back(RcorrJZBeemm->Integral());
|
2399 |
|
|
jzbcutprediction.push_back(Bpred->Integral());
|
2400 |
|
|
|
2401 |
|
|
delete RcorrJZBeemm;
|
2402 |
|
|
delete LcorrJZBeemm;
|
2403 |
|
|
delete RcorrJZBem;
|
2404 |
|
|
delete LcorrJZBem;
|
2405 |
|
|
delete RcorrJZBSBem;
|
2406 |
|
|
delete LcorrJZBSBem;
|
2407 |
|
|
delete RcorrJZBSBeemm;
|
2408 |
|
|
delete LcorrJZBSBeemm;
|
2409 |
|
|
|
2410 |
|
|
TH1F *MetObs = coll.Draw("MetObs",("met[4]"),nbins,low,14000, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
|
2411 |
|
|
TH1F *MetPred = coll.Draw("MetPred",("met[4]"),nbins,low,14000, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
|
2412 |
|
|
|
2413 |
|
|
metcutobservation.push_back(MetObs->Integral());
|
2414 |
|
|
metcutprediction.push_back(MetPred->Integral());
|
2415 |
|
|
delete MetObs;
|
2416 |
|
|
delete MetPred;
|
2417 |
|
|
}//end of cut loop
|
2418 |
|
|
|
2419 |
|
|
//prediction part
|
2420 |
|
|
if(is_data) cout << "Data prediction & ";
|
2421 |
|
|
if(subselection!="none") cout << subselection << " prediction &";
|
2422 |
|
|
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & ";
|
2423 |
|
|
|
2424 |
|
|
cout << endl;
|
2425 |
|
|
//observation part
|
2426 |
|
|
if(is_data) cout << "Data observation & ";
|
2427 |
|
|
if(subselection!="none") cout << subselection << " observation &";
|
2428 |
|
|
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & ";
|
2429 |
|
|
cout << endl;
|
2430 |
|
|
cout << "_________________________________________________________________" << endl;
|
2431 |
|
|
delete cannie;
|
2432 |
|
|
}
|
2433 |
|
|
|
2434 |
|
|
void met_jzb_cut(string datajzb, string mcjzb, vector<float> jzb_cut) {
|
2435 |
|
|
/*we want a table like this:
|
2436 |
|
|
__________________ 50 | 100 | ...
|
2437 |
|
|
| Data prediction | a vs b | a vs b | ...
|
2438 |
|
|
| Data observed | a vs b | a vs b | ...
|
2439 |
|
|
--------------------------------------
|
2440 |
|
|
--------------------------------------
|
2441 |
|
|
| LM4 prediction | a vs b | a vs b | ...
|
2442 |
|
|
| LM4 observed | a vs b | a vs b | ...
|
2443 |
|
|
| LM8 prediction | a vs b | a vs b | ...
|
2444 |
|
|
| LM8 observed | a vs b | a vs b | ...
|
2445 |
|
|
|
2446 |
|
|
where a is the result for a jzb cut at X, and b is the result for a met cut at X
|
2447 |
|
|
*/
|
2448 |
|
|
make_table(allsamples,datajzb, true,jzb_cut,"none");
|
2449 |
|
|
make_table(signalsamples,mcjzb, false,jzb_cut,"LM4");
|
2450 |
|
|
make_table(signalsamples,mcjzb, false,jzb_cut,"LM8");
|
2451 |
|
|
}
|
2452 |
|
|
|
2453 |
|
|
|
2454 |
|
|
//________________________________________________________________________________________
|
2455 |
|
|
// JZB Efficiency plot (efficiency of passing reco. JZB cut as function of generator JZB cut)
|
2456 |
|
|
void JZBSelEff(string mcjzb, TTree* events, string informalname, vector<float> jzb_bins) {
|
2457 |
|
|
|
2458 |
|
|
float min = 0, max = 400;
|
2459 |
|
|
float xbins[] = {min,10,20,30,40,50,60,70,80,90,100,110,120,140,150,160,170,180,190,200,210,220,250,300,max,max+100};
|
2460 |
|
|
int nbins = sizeof(xbins)/sizeof(float)-1;
|
2461 |
|
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 };
|
2462 |
|
|
|
2463 |
|
|
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins);
|
2464 |
|
|
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins);
|
2465 |
|
|
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins);
|
2466 |
|
|
|
2467 |
|
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF);
|
2468 |
|
|
TCut kreco(cutmass);
|
2469 |
|
|
|
2470 |
|
|
TF1* func = new TF1("func","0.5*[2]*(TMath::Erf((x-[1])/[0])+1)",min,max);
|
2471 |
|
|
func->SetParNames("epsilon","x_{1/2}","sigma");
|
2472 |
|
|
func->SetParameter(0,50.);
|
2473 |
|
|
func->SetParameter(1,0.);
|
2474 |
|
|
func->SetParameter(2,1.);
|
2475 |
|
|
gStyle->SetOptStat(0);
|
2476 |
|
|
gStyle->SetOptFit(0);
|
2477 |
|
|
|
2478 |
|
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600);
|
2479 |
|
|
can->SetGridx(1);
|
2480 |
|
|
can->SetGridy(1);
|
2481 |
|
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5);
|
2482 |
|
|
|
2483 |
|
|
|
2484 |
|
|
|
2485 |
|
|
for ( int icut=0; icut<jzb_bins.size(); ++icut ) {
|
2486 |
|
|
|
2487 |
|
|
ostringstream selection;
|
2488 |
|
|
selection << mcjzb << ">" << jzb_bins[icut];
|
2489 |
|
|
TCut ksel(selection.str().c_str());
|
2490 |
|
|
events->Draw("genJZB>>hgen", kgen&&kreco, "goff");
|
2491 |
|
|
events->Draw("genJZB>>hreco",kgen&&kreco&&ksel,"goff");
|
2492 |
|
|
|
2493 |
|
|
// Loop over steps to get efficiency curve
|
2494 |
|
|
for ( Int_t iBin = 0; iBin<nbins-1; ++iBin ) {
|
2495 |
|
|
Float_t eff = hreco->GetBinContent(iBin+1)/hgen->GetBinContent(iBin+1);
|
2496 |
|
|
heff->SetBinContent(iBin+1,eff);
|
2497 |
|
|
heff->SetBinError(iBin+1,TMath::Sqrt(eff*(1-eff)/hgen->GetBinContent(iBin+1)));
|
2498 |
|
|
}
|
2499 |
|
|
|
2500 |
|
|
heff->GetXaxis()->SetRangeUser(min, max);
|
2501 |
|
|
heff->SetMarkerStyle(markers[icut]);
|
2502 |
|
|
heff->Fit("func","Q+","same");
|
2503 |
|
|
|
2504 |
|
|
// Print values
|
2505 |
|
|
dout << "+++ For " << selection.str() << std::endl;
|
2506 |
|
|
for ( int i=0; i<func->GetNpar(); ++i )
|
2507 |
|
|
dout << " " << func->GetParName(i) << " " << func->GetParameter(i) << " \\pm " << func->GetParError(i) << std::endl;
|
2508 |
|
|
char hname[256]; sprintf(hname,"heff%d",icut);
|
2509 |
|
|
|
2510 |
|
|
// Store plot
|
2511 |
|
|
TH1F* h = (TH1F*)heff->Clone(hname);
|
2512 |
|
|
if ( icut) h->Draw("same");
|
2513 |
|
|
else h->Draw();
|
2514 |
|
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]);
|
2515 |
|
|
leg->AddEntry(h,htitle,"p");
|
2516 |
|
|
|
2517 |
|
|
}
|
2518 |
|
|
|
2519 |
|
|
leg->Draw();
|
2520 |
|
|
DrawMCPrelim(0.0);
|
2521 |
|
|
CompleteSave(can, "Systematics/jzb_efficiency_curve"+informalname );
|
2522 |
|
|
|
2523 |
|
|
delete hgen;
|
2524 |
|
|
delete hreco;
|
2525 |
|
|
delete heff;
|
2526 |
|
|
}
|
2527 |
|
|
|
2528 |
|
|
//________________________________________________________________________________________
|
2529 |
|
|
// Calls the above function for each signal sample
|
2530 |
|
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins )
|
2531 |
|
|
{
|
2532 |
|
|
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) {
|
2533 |
|
|
dout << "JZB selection efficiency curve: " << std::endl;
|
2534 |
|
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples
|
2535 |
|
|
}
|
2536 |
|
|
}
|
2537 |
buchmann |
1.3 |
|
2538 |
|
|
void qcd_plots(string datajzb, string mcjzb, vector<float> bins) {
|
2539 |
|
|
// What this function aims to do:
|
2540 |
|
|
// Illustrate cut flow for QCD (requiring only one lepton, requiring etc.)
|
2541 |
|
|
// Illustrate how little QCD is left over! i.e. make some pointless JZB plot with only QCD to visualize the fact that there's not much really.
|
2542 |
|
|
TCanvas *can = new TCanvas("can","can");
|
2543 |
|
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
|
2544 |
|
|
kinpad->cd();
|
2545 |
|
|
|
2546 |
|
|
string jzb=mcjzb;
|
2547 |
|
|
|
2548 |
|
|
float hi=400;
|
2549 |
|
|
bool use_signal=false;
|
2550 |
|
|
bool use_data=false;
|
2551 |
|
|
|
2552 |
|
|
bool is_data=false;
|
2553 |
|
|
int nbins=50;//100;
|
2554 |
|
|
float low=0;
|
2555 |
|
|
float high=500;
|
2556 |
|
|
int versok=false;
|
2557 |
|
|
if(gROOT->GetVersionInt()>=53000) versok=true;
|
2558 |
|
|
|
2559 |
|
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high);
|
2560 |
|
|
TH1F *RcorrJZBeemm = qcdsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2561 |
|
|
TH1F *LcorrJZBeemm = qcdsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2562 |
|
|
TH1F *RcorrJZBem = qcdsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2563 |
|
|
TH1F *LcorrJZBem = qcdsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2564 |
|
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle());
|
2565 |
|
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle());
|
2566 |
|
|
blankback->GetXaxis()->CenterTitle();
|
2567 |
|
|
blankback->GetYaxis()->CenterTitle();
|
2568 |
|
|
|
2569 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
|
2570 |
|
|
TH1F *RcorrJZBSBem;
|
2571 |
|
|
TH1F *LcorrJZBSBem;
|
2572 |
|
|
TH1F *RcorrJZBSBeemm;
|
2573 |
|
|
TH1F *LcorrJZBSBeemm;
|
2574 |
|
|
|
2575 |
|
|
TH1F *RcorrJZBeemmNoS;
|
2576 |
|
|
|
2577 |
|
|
//these are for the ratio
|
2578 |
|
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2579 |
|
|
TH1F *JLcorrJZBeemm = qcdsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2580 |
|
|
TH1F *JRcorrJZBem = qcdsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2581 |
|
|
TH1F *JLcorrJZBem = qcdsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2582 |
|
|
|
2583 |
|
|
TH1F *JRcorrJZBSBem;
|
2584 |
|
|
TH1F *JLcorrJZBSBem;
|
2585 |
|
|
TH1F *JRcorrJZBSBeemm;
|
2586 |
|
|
TH1F *JLcorrJZBSBeemm;
|
2587 |
|
|
|
2588 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2589 |
|
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2590 |
|
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2591 |
|
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2592 |
|
|
LcorrJZBSBeemm = qcdsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2593 |
|
|
|
2594 |
|
|
//these are for the ratio
|
2595 |
|
|
JRcorrJZBSBem = qcdsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2596 |
|
|
JLcorrJZBSBem = qcdsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
|
2597 |
|
|
JRcorrJZBSBeemm = qcdsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2598 |
|
|
JLcorrJZBSBeemm = qcdsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
|
2599 |
|
|
|
2600 |
|
|
}
|
2601 |
|
|
|
2602 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
|
2603 |
|
|
|
2604 |
|
|
TH1F *Zjetspred = (TH1F*)LcorrJZBeemm->Clone("Zjetspred");
|
2605 |
|
|
TH1F *TTbarpred = (TH1F*)RcorrJZBem->Clone("TTbarpred");
|
2606 |
|
|
|
2607 |
|
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
|
2608 |
|
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred");
|
2609 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2610 |
|
|
Bpred->Add(RcorrJZBem,1.0/3.);
|
2611 |
|
|
Bpred->Add(LcorrJZBem,-1.0/3.);
|
2612 |
|
|
Bpred->Add(RcorrJZBSBem,1.0/3.);
|
2613 |
|
|
Bpred->Add(LcorrJZBSBem,-1.0/3.);
|
2614 |
|
|
Bpred->Add(RcorrJZBSBeemm,1.0/3.);
|
2615 |
|
|
Bpred->Add(LcorrJZBSBeemm,-1.0/3.);
|
2616 |
|
|
|
2617 |
|
|
TTbarpred->Scale(1.0/3);
|
2618 |
|
|
Zjetspred->Add(LcorrJZBem,-1.0/3.);
|
2619 |
|
|
Zjetspred->Add(LcorrJZBSBem,-1.0/3.);
|
2620 |
|
|
TTbarpred->Add(RcorrJZBSBem,1.0/3.);
|
2621 |
|
|
Zjetspred->Add(LcorrJZBSBeemm,-1.0/3.);
|
2622 |
|
|
TTbarpred->Add(RcorrJZBSBeemm,1.0/3.);
|
2623 |
|
|
|
2624 |
|
|
//these are for the ratio
|
2625 |
|
|
JBpred->Add(JRcorrJZBem,1.0/3.);
|
2626 |
|
|
JBpred->Add(JLcorrJZBem,-1.0/3.);
|
2627 |
|
|
JBpred->Add(JRcorrJZBSBem,1.0/3.);
|
2628 |
|
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.);
|
2629 |
|
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.);
|
2630 |
|
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.);
|
2631 |
|
|
} else {
|
2632 |
|
|
Bpred->Add(RcorrJZBem,1.0);
|
2633 |
|
|
Bpred->Add(LcorrJZBem,-1.0);
|
2634 |
|
|
|
2635 |
|
|
Zjetspred->Add(LcorrJZBem,-1.0);
|
2636 |
|
|
|
2637 |
|
|
//these are for the ratio
|
2638 |
|
|
JBpred->Add(JRcorrJZBem,1.0);
|
2639 |
|
|
JBpred->Add(JLcorrJZBem,-1.0);
|
2640 |
|
|
}
|
2641 |
|
|
|
2642 |
|
|
|
2643 |
|
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
|
2644 |
buchmann |
1.1 |
|
2645 |
buchmann |
1.3 |
TLegend *legBpred = make_legend("",0.6,0.55,false);
|
2646 |
|
|
RcorrJZBeemm->Draw("e1x0,same");
|
2647 |
|
|
Bpred->Draw("hist,same");
|
2648 |
|
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
|
2649 |
|
|
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p");
|
2650 |
|
|
legBpred->AddEntry(Bpred,"MC predicted","l");
|
2651 |
|
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18
|
2652 |
|
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18
|
2653 |
|
|
legBpred->Draw();
|
2654 |
|
|
DrawMCPrelim();
|
2655 |
|
|
|
2656 |
|
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title
|
2657 |
|
|
string ytitle("ratio");
|
2658 |
|
|
if ( use_data==1 ) ytitle = "data/pred";
|
2659 |
|
|
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle);
|
2660 |
|
|
|
2661 |
|
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity);
|
2662 |
|
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity);
|
2663 |
|
|
TH1F *osof = qcdsamples.Draw("osof","pfJetGoodNum",1,0,100, "internal code", "events", cutOSOF ,mc, luminosity);
|
2664 |
|
|
TH1F *njossf = qcdsamples.Draw("njossf","pfJetGoodNum",1,0,100, "internal code", "events", cutnJets&&cutOSSF ,mc, luminosity);
|
2665 |
|
|
TH1F *njosof = qcdsamples.Draw("njosof","pfJetGoodNum",1,0,100, "internal code", "events", cutnJets&&cutOSOF ,mc, luminosity);
|
2666 |
|
|
|
2667 |
|
|
dout << "______________________________________________" << endl;
|
2668 |
|
|
dout << "QCD contribution: " << endl;
|
2669 |
|
|
dout << "Total number of events: " << allevents->Integral() << endl;
|
2670 |
|
|
dout << "OSSF events: " << ossf->Integral() << endl;
|
2671 |
|
|
dout << "OSOF events: " << osof->Integral() << endl;
|
2672 |
|
|
dout << "OSSF events with >=3 jets:" << njossf->Integral() << endl;
|
2673 |
|
|
dout << "OSOF events with >=3 jets:" << njosof->Integral() << endl;
|
2674 |
|
|
dout << "(note that no mass requirement has been imposed)" << endl;
|
2675 |
|
|
|
2676 |
|
|
dout << "______________________________________________" << endl;
|
2677 |
|
|
dout << "How QCD shows up in the different regions: " << endl;
|
2678 |
|
|
dout << "OSSF: " << endl;
|
2679 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2680 |
|
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
|
2681 |
|
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl;
|
2682 |
|
|
} else {
|
2683 |
|
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
|
2684 |
|
|
}
|
2685 |
|
|
dout << "OSOF: " << endl;
|
2686 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2687 |
|
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
|
2688 |
|
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl;
|
2689 |
|
|
} else {
|
2690 |
|
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
|
2691 |
|
|
}
|
2692 |
|
|
dout << "Therefore: " << endl;
|
2693 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2694 |
|
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) ";
|
2695 |
|
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) ";
|
2696 |
|
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) ";
|
2697 |
|
|
dout << " = " << LcorrJZBeemm->Integral() + (1.0/3)*(RcorrJZBSBeemm->Integral() - LcorrJZBSBeemm->Integral() + RcorrJZBem->Integral() - LcorrJZBem->Integral() + RcorrJZBSBem->Integral() - LcorrJZBSBem->Integral()) << endl;
|
2698 |
|
|
} else {
|
2699 |
|
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral();
|
2700 |
|
|
dout << " + (" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) ";
|
2701 |
|
|
dout << " = " << LcorrJZBeemm->Integral() + RcorrJZBem->Integral() - LcorrJZBem->Integral() << endl;
|
2702 |
|
|
}
|
2703 |
|
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl;
|
2704 |
|
|
|
2705 |
|
|
dout << endl;
|
2706 |
|
|
for(int i=0;i<bins.size();i++) {
|
2707 |
|
|
dout << " JZB > " << bins[i] << " : " << endl;
|
2708 |
|
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
|
2709 |
|
|
if(PlottingSetup::RestrictToMassPeak) {
|
2710 |
|
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + (1.0/3)*(RcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX())) << endl;
|
2711 |
|
|
} else {
|
2712 |
|
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
|
2713 |
|
|
}
|
2714 |
|
|
}
|
2715 |
|
|
|
2716 |
|
|
delete can;
|
2717 |
|
|
delete allevents;
|
2718 |
|
|
if(ossf) delete ossf;
|
2719 |
|
|
if(RcorrJZBem) delete RcorrJZBem;
|
2720 |
|
|
if(LcorrJZBem) delete LcorrJZBem;
|
2721 |
|
|
if(RcorrJZBeemm) delete RcorrJZBeemm;
|
2722 |
|
|
if(LcorrJZBeemm) delete LcorrJZBeemm;
|
2723 |
|
|
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem;
|
2724 |
|
|
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem;
|
2725 |
|
|
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
|
2726 |
|
|
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
|
2727 |
|
|
}
|
2728 |
buchmann |
1.1 |
|
2729 |
buchmann |
1.4 |
void check_ptsanity() {
|
2730 |
|
|
TCanvas *ptsancan = new TCanvas("ptsancan","ptsancan",600,1800);
|
2731 |
|
|
TH1F *individualpt1histos[allsamples.collection.size()];
|
2732 |
|
|
TH1F *individualpt2histos[allsamples.collection.size()];
|
2733 |
|
|
TH1F *fpt1 = new TH1F("fpt1","fpt1",50,0,50);
|
2734 |
|
|
fpt1->GetYaxis()->SetRangeUser(0,1);
|
2735 |
|
|
fpt1->GetXaxis()->SetTitle("p_{T,1}");
|
2736 |
|
|
fpt1->GetXaxis()->CenterTitle();
|
2737 |
|
|
|
2738 |
|
|
TH1F *fpt2 = new TH1F("fpt2","fpt2",50,0,50);
|
2739 |
|
|
fpt2->GetXaxis()->SetTitle("p_{T,2}");
|
2740 |
|
|
fpt2->GetXaxis()->CenterTitle();
|
2741 |
|
|
|
2742 |
|
|
ptsancan->Divide(1,3);
|
2743 |
|
|
ptsancan->cd(1);
|
2744 |
|
|
float maxpt1entry=0;
|
2745 |
|
|
float maxpt2entry=0;
|
2746 |
|
|
|
2747 |
|
|
TLegend *leg = make_legend();
|
2748 |
|
|
leg->SetX1(0.0);
|
2749 |
|
|
leg->SetY1(0.0);
|
2750 |
|
|
leg->SetX2(1.0);
|
2751 |
|
|
leg->SetY2(1.0);
|
2752 |
|
|
|
2753 |
|
|
|
2754 |
|
|
for(int isample=0;isample<allsamples.collection.size();isample++) {
|
2755 |
|
|
string nowname=(allsamples.collection)[isample].filename;
|
2756 |
|
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl;
|
2757 |
|
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname));
|
2758 |
|
|
individualpt2histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt2",50,0,50, "p_{T,2}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname));
|
2759 |
|
|
individualpt1histos[isample]->SetLineColor(isample+1);
|
2760 |
|
|
individualpt2histos[isample]->SetLineColor(isample+1);
|
2761 |
|
|
float currmaxpt1entry=individualpt1histos[isample]->GetMaximum()/individualpt1histos[isample]->Integral();
|
2762 |
|
|
float currmaxpt2entry=individualpt2histos[isample]->GetMaximum()/individualpt2histos[isample]->Integral();
|
2763 |
|
|
cout << " pt 1 histo contains; " << individualpt1histos[isample]->Integral() << endl;
|
2764 |
|
|
cout << " pt 2 histo contains; " << individualpt2histos[isample]->Integral() << endl;
|
2765 |
|
|
if(currmaxpt1entry>maxpt1entry)maxpt1entry=currmaxpt1entry;
|
2766 |
|
|
if(currmaxpt2entry>maxpt2entry)maxpt2entry=currmaxpt2entry;
|
2767 |
|
|
leg->AddEntry(individualpt2histos[isample],((allsamples.collection)[isample].filename).c_str(),"f");
|
2768 |
|
|
}
|
2769 |
|
|
|
2770 |
|
|
fpt1->GetYaxis()->SetRangeUser(0,maxpt1entry);
|
2771 |
|
|
fpt2->GetYaxis()->SetRangeUser(0,maxpt2entry);
|
2772 |
|
|
|
2773 |
|
|
ptsancan->cd(1);
|
2774 |
|
|
fpt1->Draw();
|
2775 |
|
|
ptsancan->cd(2);
|
2776 |
|
|
fpt2->Draw();
|
2777 |
|
|
|
2778 |
|
|
for(int isample=0;isample<allsamples.collection.size();isample++) {
|
2779 |
|
|
ptsancan->cd(1);
|
2780 |
|
|
individualpt1histos[isample]->DrawNormalized("same,histo");
|
2781 |
|
|
ptsancan->cd(2);
|
2782 |
|
|
individualpt2histos[isample]->DrawNormalized("same,histo");
|
2783 |
|
|
}
|
2784 |
|
|
ptsancan->cd(3);
|
2785 |
|
|
leg->Draw();
|
2786 |
|
|
CompleteSave(ptsancan,"PtSanityCheck");
|
2787 |
|
|
|
2788 |
|
|
delete ptsancan;
|
2789 |
|
|
}
|
2790 |
|
|
|
2791 |
buchmann |
1.6 |
void do_mlls_plot(string mcjzb) {
|
2792 |
|
|
cout << "At this point we'd plot the mll distribution" << endl;
|
2793 |
|
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan");
|
2794 |
|
|
for(int isig=0;isig<(signalsamples.collection).size();isig++) {
|
2795 |
|
|
if(!(signalsamples.collection)[isig].events) continue;
|
2796 |
|
|
string nowname=(signalsamples.collection)[isig].filename;
|
2797 |
|
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname));
|
2798 |
|
|
// TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events","",mc,luminosity,signalsamples.FindSample(nowname));
|
2799 |
|
|
mll->SetLineColor(TColor::GetColor("#04B404"));
|
2800 |
|
|
stringstream poscutS;
|
2801 |
|
|
poscutS << "((" << mcjzb <<")>50)";
|
2802 |
|
|
TCut poscut(poscutS.str().c_str());
|
2803 |
|
|
TH1F *mllP = signalsamples.Draw("mllhistoP","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets&&poscut,mc,luminosity,signalsamples.FindSample(nowname));
|
2804 |
|
|
mllP->SetLineColor(TColor::GetColor("#0040FF"));
|
2805 |
|
|
mll->Draw("histo");
|
2806 |
|
|
mllP->Draw("histo,same");
|
2807 |
|
|
TLegend *leg = make_legend();
|
2808 |
|
|
leg->SetY1(0.8);
|
2809 |
|
|
leg->AddEntry(mll,(signalsamples.collection)[isig].samplename.c_str(),"L");
|
2810 |
|
|
leg->AddEntry(mllP,((signalsamples.collection)[isig].samplename+", JZB>50").c_str(),"L");
|
2811 |
|
|
leg->Draw();
|
2812 |
|
|
TLine *lin = new TLine(71.2,0,71.2,mll->GetMaximum());
|
2813 |
|
|
TLine *lin2 = new TLine(111.2,0,111.2,mll->GetMaximum());
|
2814 |
|
|
lin->Draw("same");
|
2815 |
|
|
lin2->Draw("same");
|
2816 |
|
|
|
2817 |
|
|
CompleteSave(sigcan,"MllShape/"+(signalsamples.collection)[isig].samplename);
|
2818 |
|
|
delete mll;
|
2819 |
|
|
delete mllP;
|
2820 |
|
|
}
|
2821 |
|
|
}
|
2822 |
|
|
|
2823 |
buchmann |
1.1 |
void test() {
|
2824 |
|
|
|
2825 |
|
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv");
|
2826 |
|
|
testcanv->cd();
|
2827 |
|
|
switch_overunderflow(true);
|
2828 |
|
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity);
|
2829 |
|
|
switch_overunderflow(false);
|
2830 |
|
|
ptdistr->Draw();
|
2831 |
|
|
testcanv->SaveAs("test.png");
|
2832 |
|
|
dout << "HELLO there!" << endl;
|
2833 |
|
|
|
2834 |
|
|
}
|