33 |
|
|
34 |
|
|
35 |
|
|
36 |
< |
void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &DataSigma, stringstream &result, bool doPUreweighting = true, string saveas="") |
36 |
> |
void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="") |
37 |
|
{ |
38 |
|
// Temporarily switch off PU reweighting, if asked |
39 |
|
TCut weightbackup=cutWeight; |
52 |
|
if(method==doKM) { |
53 |
|
//we only need this histo for the KM fitting... |
54 |
|
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
55 |
< |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method,saveas); |
56 |
< |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method,saveas); |
55 |
> |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
56 |
> |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
57 |
|
delete rawttbarjzbeemmMC; |
58 |
|
} |
59 |
|
else { |
62 |
|
reducedMC->Add(rawJZBemMC,-1); |
63 |
|
reducedData->Add(rawJZBemData,-1); |
64 |
|
//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) |
65 |
< |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method,saveas); |
66 |
< |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method,saveas); |
65 |
> |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
66 |
> |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
67 |
|
delete reducedMC; |
68 |
|
delete reducedData; |
69 |
|
} |
73 |
|
|
74 |
|
// MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
75 |
|
// DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
76 |
< |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
77 |
< |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
78 |
< |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
79 |
< |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
76 |
> |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
77 |
> |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
78 |
> |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
79 |
> |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
80 |
|
delete rawJZBeemmData; |
81 |
|
delete rawJZBeemmMC; |
82 |
|
delete rawJZBemData; |
86 |
|
|
87 |
|
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
88 |
|
{ |
89 |
< |
|
89 |
> |
switch_overunderflow(false); |
90 |
> |
|
91 |
|
bool DoInvidualeemmPeaks=false; |
92 |
|
|
93 |
|
float mcpeak, datapeak; |
99 |
|
float datammpeak,dataeepeak; |
100 |
|
float datammpeakerr,dataeepeakerr; |
101 |
|
|
102 |
< |
float mcSigma, dataSigma; |
102 |
> |
float mcSigma,mcSigmaError, dataSigma, dataSigmaError; |
103 |
|
|
104 |
|
dout << "Finding global peak : " << endl; |
105 |
< |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,""); |
105 |
> |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
106 |
|
|
107 |
|
if(DoInvidualeemmPeaks) { |
108 |
|
dout << "Finding peak for electrons : " << endl; |
109 |
< |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
109 |
> |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
110 |
|
dout << "Finding peak for muons : " << endl; |
111 |
< |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
111 |
> |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu"); |
112 |
|
|
113 |
|
datajzb << "(" << jzbvariabledata; |
114 |
|
mcjzb << "(" << jzbvariablemc; |
148 |
|
|
149 |
|
mcjzb << ")"; |
150 |
|
} |
151 |
< |
|
151 |
> |
|
152 |
> |
switch_overunderflow(true); |
153 |
|
|
154 |
|
} |
155 |
|
|
156 |
< |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold) { |
156 |
> |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) { |
157 |
|
float min=70.0; |
158 |
|
float max=115.0; |
159 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
160 |
|
min=20; |
161 |
< |
max=200; |
161 |
> |
max=300; |
162 |
|
} |
163 |
< |
int nbins=int((max-min)/5); |
163 |
> |
int nbins=int((max-min)/binWidth); |
164 |
|
|
165 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
166 |
|
|
190 |
|
|
191 |
|
// TH1F *RcorrJZBeemmNoS; |
192 |
|
|
193 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
193 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
194 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
195 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
196 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
197 |
|
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
198 |
|
} |
199 |
|
|
200 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
201 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
202 |
< |
Bpred->Add(RcorrJZBem,1.0/3.); |
203 |
< |
Bpred->Add(LcorrJZBem,-1.0/3.); |
204 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
205 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
206 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
207 |
< |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
208 |
< |
} else { |
209 |
< |
Bpred->Add(RcorrJZBem,1.0); |
210 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
211 |
< |
} |
212 |
< |
|
200 |
> |
// Separate predictions |
201 |
> |
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
202 |
> |
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
203 |
> |
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
204 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
205 |
> |
OFP->Scale(1.0/3.0); |
206 |
> |
OFP->Add(RcorrJZBSBem,1.0/3.); |
207 |
> |
OFP->Add(RcorrJZBSBeemm,1.0/3.); |
208 |
> |
OFN->Scale(1.0/3.0); |
209 |
> |
OFN->Add(LcorrJZBSBem,1.0/3.); |
210 |
> |
OFN->Add(LcorrJZBSBeemm,1.0/3.); |
211 |
> |
} |
212 |
> |
|
213 |
> |
TH1F* Bpred = (TH1F*)SFN->Clone("Bpred"); |
214 |
> |
Bpred->Add(OFP); |
215 |
> |
Bpred->Add(OFN,-1); |
216 |
|
Bpred->SetLineColor(kRed); |
217 |
|
|
218 |
+ |
RcorrJZBeemm->SetTitleOffset(1.3,"y"); |
219 |
|
RcorrJZBeemm->Draw(); |
220 |
|
mcRcorrJZBeemm.Draw("same"); |
221 |
|
Bpred->Draw("histo,same"); |
231 |
|
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
232 |
|
CompleteSave(ckin,saveas.str()); |
233 |
|
|
234 |
< |
|
234 |
> |
// Draw all predictions overlayed |
235 |
> |
unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it |
236 |
> |
SFN->SetLineColor(kGreen+2); |
237 |
> |
SFN->SetLineStyle(2); |
238 |
> |
SFN->SetLineWidth(w); |
239 |
> |
OFP->SetLineColor(kBlue+2); |
240 |
> |
OFP->SetLineStyle(2); |
241 |
> |
OFP->SetLineWidth(w); |
242 |
> |
OFN->SetLineColor(kMagenta+2); |
243 |
> |
OFN->SetLineStyle(3); |
244 |
> |
OFN->SetLineWidth(w); |
245 |
|
|
246 |
|
RcorrJZBeemm->Draw(); |
247 |
+ |
SFN->Draw("histo,same"); |
248 |
+ |
OFP->Draw("histo,same"); |
249 |
+ |
OFN->Draw("histo,same"); |
250 |
|
Bpred->Draw("histo,same"); |
251 |
|
RcorrJZBeemm->Draw("same"); |
252 |
|
|
253 |
< |
TLegend *leg2 = make_legend(); |
254 |
< |
leg2->SetX1(0.58); |
236 |
< |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
253 |
> |
TLegend *leg2 = make_legend("",0.52,0.7); |
254 |
> |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
255 |
|
leg2->AddEntry(Bpred,"predicted (data)","l"); |
256 |
+ |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
257 |
+ |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
258 |
+ |
leg2->AddEntry(OFP, " OF JZB>0","l"); |
259 |
|
leg2->Draw("same"); |
260 |
|
|
261 |
|
saveas.str(""); |
262 |
|
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
263 |
|
CompleteSave(ckin,saveas.str()); |
264 |
|
|
244 |
– |
|
245 |
– |
|
265 |
|
delete RcorrJZBeemm; |
266 |
|
delete LcorrJZBeemm; |
267 |
|
delete RcorrJZBem; |
268 |
|
delete LcorrJZBem; |
269 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
269 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
270 |
|
delete RcorrJZBSBeemm; |
271 |
|
delete LcorrJZBSBeemm; |
272 |
|
delete RcorrJZBSBem; |
359 |
|
oneline->SetLineWidth(1); |
360 |
|
oneline->Draw("same"); |
361 |
|
} |
362 |
+ |
float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale, |
363 |
+ |
string xlabel, string filename, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) { |
364 |
+ |
|
365 |
+ |
TCut ibasiccut=basiccut; |
366 |
+ |
bool draw_separation_lines=false; |
367 |
+ |
|
368 |
+ |
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str(); |
369 |
+ |
|
370 |
+ |
TCut cutSF; |
371 |
+ |
TCut cutOF; |
372 |
+ |
|
373 |
+ |
cutOF = cutOSOF&&cutnJets&&ibasiccut; |
374 |
+ |
cutSF = cutOSSF&&cutnJets&&ibasiccut; |
375 |
+ |
|
376 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
377 |
+ |
ckin->SetLogy(logscale); |
378 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity); |
379 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity); |
380 |
+ |
string signal("LM3"); |
381 |
+ |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
382 |
+ |
int idx = signalsamples.FindSample(signal)[0]; |
383 |
+ |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
384 |
+ |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
385 |
+ |
signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
386 |
+ |
signalhisto->SetLineStyle(2); |
387 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
388 |
+ |
datahistoOF->SetLineColor(kRed); |
389 |
+ |
|
390 |
+ |
if ( !logscale ) { |
391 |
+ |
datahistoSF->SetMinimum(0); // Defaults |
392 |
+ |
} else { |
393 |
+ |
datahistoSF->SetMinimum(0.5); |
394 |
+ |
} |
395 |
+ |
if (ymax<0) { |
396 |
+ |
if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
397 |
+ |
else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum()); |
398 |
+ |
} else { |
399 |
+ |
datahistoSF->SetMaximum(ymax); |
400 |
+ |
} |
401 |
+ |
|
402 |
+ |
float ymaxSet = datahistoSF->GetMaximum(); |
403 |
+ |
|
404 |
+ |
datahistoSF->GetXaxis()->SetTitle(xlabel.c_str()); |
405 |
+ |
datahistoSF->GetYaxis()->SetTitle("Events"); |
406 |
+ |
datahistoSF->GetXaxis()->CenterTitle(); |
407 |
+ |
datahistoSF->GetYaxis()->CenterTitle(); |
408 |
+ |
|
409 |
+ |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2); |
410 |
+ |
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
411 |
+ |
if (datahistoOF->Integral()>0) { |
412 |
+ |
mleg->AddEntry(datahistoOF, "Opposite-flavor", "L"); |
413 |
+ |
} else { |
414 |
+ |
mleg->AddEntry((TObject*)0, "", ""); |
415 |
+ |
} |
416 |
+ |
mleg->AddEntry(signalhisto, "LM3", "L"); |
417 |
+ |
|
418 |
+ |
datahistoSF->Draw("E1"); |
419 |
+ |
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
420 |
+ |
signalhisto->Draw("HIST,SAMES"); |
421 |
+ |
mleg->Draw(); |
422 |
+ |
DrawPrelim(); |
423 |
+ |
CompleteSave(ckin, "SFOF/" + filename); |
424 |
+ |
|
425 |
+ |
datahistoSF->Delete(); |
426 |
+ |
datahistoOF->Delete(); |
427 |
+ |
signalhisto->Delete(); |
428 |
+ |
delete mleg; |
429 |
+ |
delete ckin; |
430 |
+ |
|
431 |
+ |
return ymaxSet; |
432 |
+ |
|
433 |
+ |
} |
434 |
+ |
|
435 |
+ |
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, string xlabel, string filename, |
436 |
+ |
bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) { |
437 |
+ |
|
438 |
+ |
string mllcuts[] = { "mll>20","mll>20&&mll<70", "mll>75&&mll<105", "mll>120" }; |
439 |
+ |
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "75 < m_{ll} < 105 GeV", "m_{ll} > 120 GeV" }; |
440 |
+ |
string plotname[] = {"_all","_low","_peak","_high"}; |
441 |
+ |
float ymax; |
442 |
+ |
for ( int i=0; i<4; ++i ) { |
443 |
+ |
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
444 |
+ |
if ( i==0 ) { |
445 |
+ |
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
446 |
+ |
filename+plotname[i], plotratio, loadlastminmax, legendPosition ); |
447 |
+ |
} else { |
448 |
+ |
make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
449 |
+ |
filename+plotname[i], plotratio, loadlastminmax, legendPosition ); |
450 |
+ |
} |
451 |
+ |
make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
452 |
+ |
filename+plotname[i]+"_mm", plotratio, loadlastminmax, legendPosition ); |
453 |
+ |
make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
454 |
+ |
filename+plotname[i]+"_ee", plotratio, loadlastminmax, legendPosition ); |
455 |
+ |
} |
456 |
+ |
|
457 |
+ |
} |
458 |
+ |
|
459 |
|
|
460 |
|
float lastrange_min=0; |
461 |
|
float lastrange_max=0; |
514 |
|
ckin->SetLogy(logscale); |
515 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
516 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
517 |
< |
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
517 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
518 |
> |
else datahisto->SetMinimum(0.5); |
519 |
> |
// Custom max. |
520 |
> |
if(variable=="TMath::Abs(pfJetDphiMet[0])") datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
521 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
522 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
523 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
524 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
525 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
526 |
< |
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
527 |
< |
datahisto->Draw("e1"); |
528 |
< |
ckin->Update(); |
526 |
> |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
527 |
> |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
528 |
> |
|
529 |
> |
cout << "******** Cut used : " << (const char*) cut << endl; |
530 |
|
if(loadlastminmax) { |
531 |
|
datahisto->SetMinimum(lastrange_min); |
532 |
|
datahisto->SetMaximum(lastrange_max); |
536 |
|
} |
537 |
|
} |
538 |
|
|
539 |
+ |
// Draw signal by hand (for some reason I don't manage to use the sample class: it adds it to the stack!) |
540 |
+ |
string signal("LM3"); |
541 |
+ |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
542 |
+ |
int idx = signalsamples.FindSample(signal)[0]; |
543 |
+ |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
544 |
+ |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
545 |
+ |
signalhisto->SetLineColor(kOrange); |
546 |
+ |
|
547 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
548 |
+ |
datahisto->Draw("e1"); |
549 |
+ |
ckin->Update(); |
550 |
|
mcstack.Draw("same"); |
551 |
+ |
|
552 |
|
datahisto->Draw("same,e1"); |
553 |
|
TLegend *kinleg = allsamples.allbglegend(); |
554 |
|
kinleg->Draw(); |
591 |
|
kinpad->SetLogy(logscale); |
592 |
|
datahisto->Draw("e1"); |
593 |
|
mcstack.Draw("same"); |
594 |
+ |
signalhisto->Draw("same"); |
595 |
|
datahisto->Draw("same,e1"); |
596 |
|
datahisto->Draw("same,axis"); |
597 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
599 |
|
upperboundary->Draw("same"); |
600 |
|
} |
601 |
|
|
602 |
+ |
kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
603 |
|
kinleg->Draw(); |
604 |
|
write_cut->Draw(); |
605 |
|
DrawPrelim(); |
617 |
|
delete ckin; |
618 |
|
} |
619 |
|
|
620 |
< |
void make_JES_plot() { |
620 |
> |
void make_JES_plot(TCut cut, string name) { |
621 |
|
|
622 |
|
int nbins=10; |
623 |
|
float min=-0.5; |
624 |
|
float max = 9.5; |
625 |
|
bool logscale=true; |
626 |
|
string xlabel="nJets"; |
493 |
– |
TCut cut=cutmass&&cutOSSF&&basiccut; |
627 |
|
|
628 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
629 |
|
ckin->SetLogy(logscale); |
630 |
< |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
630 |
> |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,data,luminosity); |
631 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
632 |
< |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
633 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNump1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
634 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNumn1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
632 |
> |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
633 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum40p1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
634 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum40n1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
635 |
|
|
636 |
|
datahisto->SetMinimum(1); |
637 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
656 |
|
TLegend *kinleg = allsamples.allbglegend(); |
657 |
|
kinleg->AddEntry(JESunc,"JES uncertainty","f"); |
658 |
|
kinleg->Draw(); |
659 |
< |
CompleteSave(ckin,"Systematics/JES"); |
659 |
> |
CompleteSave(ckin,"Systematics/JES"+name); |
660 |
|
datahisto->Delete(); |
661 |
|
delete ckin; |
662 |
|
|
671 |
|
float mll_hi=160; |
672 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
673 |
|
mll_low=20; |
674 |
< |
mll_hi=210; |
674 |
> |
mll_hi=300; |
675 |
|
} |
676 |
< |
|
677 |
< |
make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true); |
676 |
> |
/* |
677 |
> |
make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll", false, false); |
678 |
> |
make_OFSF_plots("pfJetGoodNum40", "met[4]>100", 7, 3, 10, true, "#(jets)", "njets", false, false); |
679 |
> |
make_OFSF_plots("pt1", "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1", false, false); |
680 |
> |
make_OFSF_plots("pt2", "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2", false, false); |
681 |
> |
make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", false, false, 0.15); |
682 |
> |
make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", false, false, 0.15); |
683 |
> |
make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", false, false, 0.2); |
684 |
> |
make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", false, false, 0.2); |
685 |
> |
make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", false, false, 0.2); |
686 |
> |
make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", false, false, 0.0); |
687 |
> |
make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", false, false, 0.2); |
688 |
> |
make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", false, false, 0.2); |
689 |
> |
make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", false, false, 0.2); |
690 |
> |
make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilc", false, false, 0.2); |
691 |
> |
make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijc", false, false, 0.2); |
692 |
> |
make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", "dphilco", false, false, 0.2); |
693 |
> |
make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "met[4]>100", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijco", false, false, 0.2); |
694 |
> |
|
695 |
> |
make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true); |
696 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
697 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
698 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
699 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
700 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
701 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
702 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
703 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
704 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
705 |
< |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
706 |
< |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
707 |
< |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
708 |
< |
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
709 |
< |
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
559 |
< |
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
560 |
< |
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
561 |
< |
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
700 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
701 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
702 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
703 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
704 |
> |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
705 |
> |
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
706 |
> |
|
707 |
> |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
708 |
> |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
709 |
> |
|
710 |
|
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
711 |
|
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
712 |
|
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
713 |
< |
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
713 |
> |
|
714 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
715 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
716 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
717 |
> |
*/ |
718 |
> |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
719 |
> |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
720 |
> |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
721 |
> |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
722 |
> |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
723 |
|
stringstream jzbcut; |
724 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
725 |
|
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
738 |
|
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
739 |
|
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true); |
740 |
|
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true); |
741 |
< |
|
742 |
< |
|
741 |
> |
|
742 |
> |
make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100_ll",doPF,true); |
743 |
> |
//make_kin_plot("mll","met[4]>150&&id1==0",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ee} [GeV] (MET>150GeV)","mll_met150_ee",doPF,true); |
744 |
> |
//make_kin_plot("mll","met[4]>150&&id1==1",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{#mu#mu} [GeV] (MET>150GeV)","mll_met150_mm",doPF,true); |
745 |
> |
|
746 |
|
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
747 |
|
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
748 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
749 |
|
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
750 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
751 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
752 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
753 |
< |
|
754 |
< |
make_JES_plot(); |
750 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
751 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
752 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
753 |
> |
|
754 |
> |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
755 |
> |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
756 |
> |
|
757 |
> |
string regioncut[4] = {"mll>0&&","mll>20&&mll<70&&","mll>70&&mll<110&&","mll>110&&"}; |
758 |
> |
string regionname[4] = {"global","lowmass","Zregion","highmass"}; |
759 |
> |
bool StoreRatioPlots=false; |
760 |
> |
for(int iregion=0;iregion<4;iregion++) { |
761 |
> |
cout << regionname[iregion] << " : " << regioncut[iregion] << endl; |
762 |
> |
|
763 |
> |
//Z properties |
764 |
> |
make_kin_plot("pt","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{ee} [GeV] (MET>100GeV)","Z/ZPT_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
765 |
> |
make_kin_plot("pt","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{#mu#mu} [GeV] (MET>100GeV)","Z/ZPT_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
766 |
> |
|
767 |
> |
make_kin_plot("phi","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{ee} (MET>100GeV)","Z/ZPhi_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
768 |
> |
make_kin_plot("phi","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu#mu} (MET>100GeV)","Z/ZPhi_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
769 |
> |
|
770 |
> |
make_kin_plot("eta","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{ee} (MET>100GeV)","Z/ZEta_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
771 |
> |
make_kin_plot("eta","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu#mu} (MET>100GeV)","Z/ZEta_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
772 |
> |
|
773 |
> |
// lepton properties |
774 |
> |
make_kin_plot("pt1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e1} [GeV] (MET>100GeV)","Lepton/LeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
775 |
> |
make_kin_plot("pt1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu1} [GeV] (MET>100GeV)","Lepton/LeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
776 |
> |
make_kin_plot("pt2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e2} [GeV] (MET>100GeV)","Lepton/SubLeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
777 |
> |
make_kin_plot("pt2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu2} [GeV] (MET>100GeV)","Lepton/SubLeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
778 |
> |
|
779 |
> |
make_kin_plot("phi1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e1} (MET>100GeV)","Lepton/LeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
780 |
> |
make_kin_plot("phi1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu1} (MET>100GeV)","Lepton/LeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
781 |
> |
make_kin_plot("phi2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e2} (MET>100GeV)","Lepton/SubLeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
782 |
> |
make_kin_plot("phi2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
783 |
> |
|
784 |
> |
make_kin_plot("eta1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e1} (MET>100GeV)","Lepton/LeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
785 |
> |
make_kin_plot("eta1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu1} (MET>100GeV)","Lepton/LeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
786 |
> |
make_kin_plot("eta2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e2} (MET>100GeV)","Lepton/SubLeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
787 |
> |
make_kin_plot("eta2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
788 |
> |
|
789 |
> |
|
790 |
> |
} |
791 |
> |
|
792 |
|
} |
793 |
|
|
794 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
795 |
|
int nbins, float xmin, float xmax, bool log, |
796 |
|
float ymin=0, float ymax=0, bool leftJustified=false ) { |
797 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
797 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
798 |
|
|
799 |
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!) |
800 |
|
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__)); |
801 |
< |
if(var=="numVtx") cutWeight=TCut("1.0"); |
801 |
> |
//if(var=="numVtx") cutWeight=TCut("1.0"); |
802 |
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) }; |
803 |
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) }; |
804 |
|
|
805 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed! |
806 |
|
int nRegions=4; |
807 |
< |
if(!PlottingSetup::RestrictToMassPeak) { |
807 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
808 |
|
nRegions=2; |
809 |
|
} |
810 |
|
|
822 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
823 |
|
ccomp->SetLogy(log); |
824 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
825 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM")); |
825 |
> |
TH1F *lm3histo = signalsamples.Draw("lm3histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb],data,luminosity,signalsamples.FindSample("LM3")); |
826 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
827 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
828 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
829 |
< |
lm4histo->SetLineStyle(2); |
829 |
> |
lm3histo->SetLineStyle(2); |
830 |
|
datahisto->Draw("e1"); |
831 |
|
mcstack.Draw("same"); |
832 |
|
datahisto->Draw("same,e1"); |
833 |
< |
// lm4histo->Draw("hist,same"); |
833 |
> |
lm3histo->Draw("hist,same"); |
834 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
835 |
|
if ( leftJustified ) { |
836 |
|
Float_t w = kinleg->GetX2()-kinleg->GetX1(); |
837 |
|
kinleg->SetX1(0.2); |
838 |
|
kinleg->SetX2(0.2+w); |
839 |
|
} |
840 |
< |
// kinleg->AddEntry(lm4histo,"LM4","l"); |
840 |
> |
kinleg->AddEntry(lm3histo,"LM3","l"); |
841 |
|
kinleg->Draw(); |
842 |
|
TText* write_variable = write_text(0.99,0.01,var); |
843 |
|
write_variable->SetTextAlign(31); |
846 |
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos")); |
847 |
|
delete datahisto; |
848 |
|
delete ccomp; |
849 |
< |
delete lm4histo; |
849 |
> |
delete lm3histo; |
850 |
|
} |
851 |
|
cutWeight=weightbackup; |
852 |
|
} |
864 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
865 |
|
float mll_low=50;float mll_high=170; |
866 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
867 |
< |
mll_high=200; |
868 |
< |
mll_low=50; |
867 |
> |
mll_high=300; |
868 |
> |
mll_low=20; |
869 |
|
} |
870 |
< |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.); |
870 |
> |
make_comp_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",jzbcut,mcjzb,datajzb,100,0,10,true); |
871 |
> |
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
872 |
> |
|
873 |
> |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
874 |
|
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
875 |
< |
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
875 |
> |
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
876 |
> |
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
877 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
878 |
< |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.); |
878 |
> |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,40,0.,40.,false,0,16.); |
879 |
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
880 |
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
881 |
+ |
make_comp_plot("eta1","#eta_1","eta1",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
882 |
+ |
make_comp_plot("eta2","#eta_2","eta2",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
883 |
|
} |
884 |
|
|
885 |
|
switch_overunderflow(false); // switching overflow/underflow bins off |
1078 |
|
// 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) |
1079 |
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction); |
1080 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1081 |
< |
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); |
1081 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
1082 |
|
|
1083 |
|
|
1084 |
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8); |
1219 |
|
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); |
1220 |
|
|
1221 |
|
|
1222 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1222 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1223 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1224 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1225 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1246 |
|
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
1247 |
|
ClearHisto(BpredSys); |
1248 |
|
|
1249 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1249 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1250 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
1251 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
1252 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
1301 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
1302 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1303 |
|
Tpred->Add(LcorrJZBem,-1.0); |
1304 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1304 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1305 |
|
Tpred->Add(RcorrJZBSBem,1.0); |
1306 |
|
Tpred->Add(LcorrJZBSBem,-1.0); |
1307 |
|
Tpred->Add(RcorrJZBSBeemm,1.0); |
1394 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1395 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1396 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1397 |
< |
if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1397 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1398 |
|
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
1399 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1400 |
|
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1482 |
|
string ytitle("ratio"); |
1483 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1484 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1485 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,true,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1485 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1486 |
|
|
1487 |
|
|
1488 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1489 |
|
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1490 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1490 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1491 |
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1492 |
|
Bpredem->Add(RcorrJZBem); |
1493 |
|
Bpredem->Add(LcorrJZBem,-1); |
1566 |
|
delete blankback; |
1567 |
|
|
1568 |
|
delete BpredSys; |
1569 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1569 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1570 |
|
delete RcorrJZBSBem; |
1571 |
|
delete LcorrJZBSBem; |
1572 |
|
delete RcorrJZBSBeemm; |
1607 |
|
TH1F *RcorrJZBSBeemm; |
1608 |
|
TH1F *LcorrJZBSbeemm; |
1609 |
|
|
1610 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1610 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1611 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1612 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1613 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1619 |
|
|
1620 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1621 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1622 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1622 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1623 |
|
Bpred->Add(RcorrJZBem,1.0/3); |
1624 |
|
Bpred->Add(LcorrJZBem,-1.0/3); |
1625 |
|
Bpred->Add(RcorrJZBSBem,1.0/3); |
1926 |
|
datahisto->Draw("same,e1"); |
1927 |
|
|
1928 |
|
TLegend *leg; |
1929 |
< |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
1930 |
< |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
1931 |
< |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
1932 |
< |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
1933 |
< |
else { |
1934 |
< |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
1935 |
< |
exit(-1); |
1936 |
< |
} |
1929 |
> |
if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
1930 |
> |
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
1931 |
> |
else leg = allsamples.allbglegend("Same flavor",datahisto); |
1932 |
> |
} else { |
1933 |
> |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
1934 |
> |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
1935 |
> |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
1936 |
> |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
1937 |
> |
else { |
1938 |
> |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
1939 |
> |
exit(-1); |
1940 |
> |
} |
1941 |
> |
} |
1942 |
|
leg->Draw(); |
1943 |
|
string write_cut = decipher_cut(cut,""); |
1944 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1989 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
1990 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
1991 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
1992 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1993 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1992 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1993 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1994 |
|
|
1995 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
1996 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
1997 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1998 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1997 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1998 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1999 |
|
|
2000 |
|
delete dican; |
2001 |
|
} |
2096 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
2097 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
2098 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2099 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
2100 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1892 |
< |
|
2099 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
2100 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
2101 |
|
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm",can,binning); |
2102 |
|
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarse",can,coarse_binning); |
2103 |
+ |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarsest",can,coarsest_binning); |
2104 |
|
|
2105 |
|
} |
2106 |
|
|
2108 |
|
if ( !PlottingSetup::Approved ) { |
2109 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
2110 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2111 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
2112 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
2111 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
2112 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
2113 |
|
} |
2114 |
|
delete can; |
2115 |
|
} |
2161 |
|
TCanvas *yica = new TCanvas("yica","yield canvas"); |
2162 |
|
|
2163 |
|
int nRegions=4; |
2164 |
< |
if(!PlottingSetup::RestrictToMassPeak) nRegions=2; |
2164 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
2165 |
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"}; |
2166 |
|
string posneg[] = {"pos","neg"}; |
2167 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
2452 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2453 |
|
cancorr->SetLogz(); |
2454 |
|
cancorr->SetRightMargin(0.13); |
2455 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"&&SpecialCut&&passtrig); |
2455 |
> |
TCut zptforresponsepresentation(Restrmasscut&&SpecialCut&&passtrig); |
2456 |
> |
|
2457 |
|
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2458 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2459 |
+ |
niceresponseplotd->Sumw2(); |
2460 |
+ |
TH2F* emuResponse = (TH2F*)niceresponseplotd->Clone("emuResponse"); |
2461 |
|
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2462 |
|
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2463 |
|
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2464 |
|
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2465 |
|
|
2466 |
|
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2467 |
< |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
2467 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
2468 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
2469 |
|
} |
2470 |
< |
|
2470 |
> |
niceresponseplotd->Add(emuResponse,-1); |
2471 |
> |
|
2472 |
|
niceresponseplotd->SetStats(0); |
2473 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2474 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
2476 |
|
niceresponseplotd->GetYaxis()->CenterTitle(); |
2477 |
|
niceresponseplotd->Draw("COLZ"); |
2478 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2479 |
+ |
profd->Rebin(2); |
2480 |
|
profd->SetMarkerSize(DataMarkerSize); |
2481 |
|
profd->Fit("pol0","","same,e1",100,400); |
2482 |
|
DrawPrelim(); |
2496 |
|
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
2497 |
|
delete cancorr; |
2498 |
|
delete niceresponseplotd; |
2499 |
+ |
delete profd; |
2500 |
|
return correction; |
2501 |
|
} |
2502 |
|
|
2609 |
|
configfile<<"\n\n"; |
2610 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2611 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2612 |
+ |
configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n"; |
2613 |
|
|
2614 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
2615 |
|
|
2657 |
|
|
2658 |
|
|
2659 |
|
if(!doPURW) { |
2660 |
+ |
dout << "Not doing PU reweighting for ttbar closure test" << endl; |
2661 |
|
cutWeight="1.0"; |
2662 |
|
// Do it without PU re-weighting |
2663 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2667 |
|
|
2668 |
|
stringstream mcjzbnoPU; |
2669 |
|
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2670 |
< |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2453 |
< |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2454 |
< |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzbnoPU.str() << endl; |
2455 |
< |
|
2456 |
< |
mcjzb = mcjzbnoPU.str(); |
2457 |
< |
|
2670 |
> |
mcjzb = noPUmcjzb.str(); |
2671 |
|
} |
2672 |
|
|
2673 |
< |
|
2461 |
< |
|
2462 |
< |
|
2463 |
< |
|
2464 |
< |
|
2673 |
> |
|
2674 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2675 |
|
|
2676 |
< |
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2676 |
> |
TH1F *TZem = systsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2677 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2678 |
|
TH1F *TSem; |
2679 |
|
TH1F *nTSem; |
2680 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2680 |
> |
TH1F *TZeemm = systsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2681 |
|
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2682 |
|
TH1F *TSeemm; |
2683 |
|
TH1F *nTSeemm; |
2684 |
|
|
2685 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2686 |
< |
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2687 |
< |
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2688 |
< |
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2685 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2686 |
> |
TSem = systsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2687 |
> |
nTSem = systsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2688 |
> |
TSeemm = systsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2689 |
|
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2690 |
|
} |
2691 |
|
|
2692 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
2484 |
– |
|
2693 |
|
tcan->SetLogy(1); |
2694 |
|
|
2695 |
|
TZeemm->SetLineColor(kBlack); |
2698 |
|
TZem->SetMarkerColor(kRed); |
2699 |
|
|
2700 |
|
|
2701 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2701 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2702 |
|
TSem->SetLineColor(TColor::GetColor("#00A616")); |
2703 |
|
TSeemm->SetLineColor(kMagenta+2); |
2704 |
|
TSem->SetMarkerColor(TColor::GetColor("#00A616")); |
2712 |
|
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2713 |
|
histos.push_back(TZem); |
2714 |
|
histos.push_back(TZeemm); |
2715 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2715 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2716 |
|
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2717 |
|
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2718 |
|
histos.push_back(TSem); |
2719 |
|
histos.push_back(TSeemm); |
2720 |
|
} |
2721 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",0.04); |
2721 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",1); |
2722 |
|
|
2723 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
2724 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
2725 |
|
leg->AddEntry(TZem,"OFZP","l"); |
2726 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2726 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2727 |
|
leg->AddEntry(TSeemm,"SFSB","l"); |
2728 |
|
leg->AddEntry(TSem,"OFSB","l"); |
2729 |
|
} |
2734 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2735 |
|
TH1F *TSeemmcopy; |
2736 |
|
TH1F *TSemcopy; |
2737 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2737 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2738 |
|
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2739 |
|
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2740 |
|
} |
2741 |
|
|
2742 |
|
TZem->Divide(TZeemm); |
2743 |
|
TZem->SetMarkerStyle(21); |
2744 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2744 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2745 |
|
TSem->Divide(TZeemm); |
2746 |
|
TSeemm->Divide(TZeemm); |
2747 |
|
TSem->SetMarkerStyle(24); |
2748 |
|
TSeemm->SetMarkerStyle(32); |
2749 |
< |
} |
2749 |
> |
} |
2750 |
|
|
2751 |
|
tcan->SetLogy(0); |
2752 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
2753 |
|
TZem->GetYaxis()->SetTitle("ratio"); |
2754 |
|
TZem->Draw(); |
2755 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2755 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2756 |
|
TSem->Draw("same"); |
2757 |
|
TSeemm->Draw("same"); |
2758 |
|
} |
2782 |
|
|
2783 |
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2784 |
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
2785 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2785 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2786 |
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple"); |
2787 |
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple"); |
2788 |
|
} |
2795 |
|
DrawMCPrelim(simulatedlumi); |
2796 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2797 |
|
|
2798 |
+ |
if (0) { // Turn this off: we don't need this |
2799 |
|
|
2800 |
< |
///-------------- second part: only look at the quantity we actually care about! |
2801 |
< |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2802 |
< |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2803 |
< |
rightsfzp->Add(leftsfzp,-1); |
2804 |
< |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
2805 |
< |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
2806 |
< |
rightofzp->Add(leftofzp,-1); |
2807 |
< |
TH1F *leftofsb; |
2808 |
< |
TH1F *rightofsb; |
2809 |
< |
TH1F *leftsfsb; |
2810 |
< |
TH1F *rightsfsb; |
2811 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2812 |
< |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
2813 |
< |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
2814 |
< |
rightofsb->Add(leftofsb,-1); |
2815 |
< |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
2816 |
< |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
2817 |
< |
rightsfsb->Add(leftsfsb,-1); |
2818 |
< |
} |
2800 |
> |
///-------------- second part: only look at the quantity we actually care about! |
2801 |
> |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2802 |
> |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2803 |
> |
rightsfzp->Add(leftsfzp,-1); |
2804 |
> |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
2805 |
> |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
2806 |
> |
rightofzp->Add(leftofzp,-1); |
2807 |
> |
TH1F *leftofsb; |
2808 |
> |
TH1F *rightofsb; |
2809 |
> |
TH1F *leftsfsb; |
2810 |
> |
TH1F *rightsfsb; |
2811 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2812 |
> |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
2813 |
> |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
2814 |
> |
rightofsb->Add(leftofsb,-1); |
2815 |
> |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
2816 |
> |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
2817 |
> |
rightsfsb->Add(leftsfsb,-1); |
2818 |
> |
} |
2819 |
|
|
2820 |
< |
tcan->SetLogy(1); |
2821 |
< |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
2822 |
< |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
2823 |
< |
rightsfzp->Draw("histo"); |
2824 |
< |
rightofzp->Draw("histo,same"); |
2825 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2826 |
< |
rightofsb->Draw("histo,same"); |
2827 |
< |
rightsfsb->Draw("histo,same"); |
2828 |
< |
} |
2829 |
< |
DrawMCPrelim(simulatedlumi); |
2820 |
> |
tcan->SetLogy(1); |
2821 |
> |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
2822 |
> |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
2823 |
> |
rightsfzp->Draw("histo"); |
2824 |
> |
rightofzp->Draw("histo,same"); |
2825 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2826 |
> |
rightofsb->Draw("histo,same"); |
2827 |
> |
rightsfsb->Draw("histo,same"); |
2828 |
> |
} |
2829 |
> |
DrawMCPrelim(simulatedlumi); |
2830 |
|
|
2831 |
< |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
2832 |
< |
legA->AddEntry(rightsfzp,"SFZP","l"); |
2833 |
< |
legA->AddEntry(rightofzp,"OFZP","l"); |
2834 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2835 |
< |
legA->AddEntry(rightofsb,"SFSB","l"); |
2836 |
< |
legA->AddEntry(rightsfsb,"OFSB","l"); |
2837 |
< |
} |
2838 |
< |
legA->Draw(); |
2831 |
> |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
2832 |
> |
legA->AddEntry(rightsfzp,"SFZP","l"); |
2833 |
> |
legA->AddEntry(rightofzp,"OFZP","l"); |
2834 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2835 |
> |
legA->AddEntry(rightofsb,"SFSB","l"); |
2836 |
> |
legA->AddEntry(rightsfsb,"OFSB","l"); |
2837 |
> |
} |
2838 |
> |
legA->Draw(); |
2839 |
|
|
2840 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
2840 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
2841 |
|
|
2842 |
< |
tcan->SetLogy(0); |
2843 |
< |
rightofzp->Divide(rightsfzp); |
2844 |
< |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2845 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
2846 |
< |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2847 |
< |
rightofzp->Draw(); |
2848 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2849 |
< |
rightofsb->Divide(rightsfzp); |
2850 |
< |
rightsfsb->Divide(rightsfzp); |
2851 |
< |
rightofsb->Draw("same"); |
2852 |
< |
rightsfsb->Draw("same"); |
2853 |
< |
} |
2854 |
< |
|
2855 |
< |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2856 |
< |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
2857 |
< |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2858 |
< |
|
2859 |
< |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2860 |
< |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2861 |
< |
center2->SetLineColor(kBlue); |
2862 |
< |
|
2863 |
< |
top2->Draw("same"); |
2864 |
< |
center2->Draw("same"); |
2865 |
< |
bottom2->Draw("same"); |
2866 |
< |
|
2867 |
< |
rightofzp->SetMarkerStyle(21); |
2868 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2869 |
< |
rightofsb->SetMarkerStyle(24); |
2870 |
< |
rightsfsb->SetMarkerStyle(32); |
2871 |
< |
} |
2872 |
< |
|
2873 |
< |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2874 |
< |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2875 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2876 |
< |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2877 |
< |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
2878 |
< |
} |
2879 |
< |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2880 |
< |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2881 |
< |
leg3->SetY1(0.65); |
2842 |
> |
tcan->SetLogy(0); |
2843 |
> |
rightofzp->Divide(rightsfzp); |
2844 |
> |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2845 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
2846 |
> |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2847 |
> |
rightofzp->Draw(); |
2848 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2849 |
> |
rightofsb->Divide(rightsfzp); |
2850 |
> |
rightsfsb->Divide(rightsfzp); |
2851 |
> |
rightofsb->Draw("same"); |
2852 |
> |
rightsfsb->Draw("same"); |
2853 |
> |
} |
2854 |
> |
|
2855 |
> |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2856 |
> |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
2857 |
> |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2858 |
> |
|
2859 |
> |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2860 |
> |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2861 |
> |
center2->SetLineColor(kBlue); |
2862 |
> |
|
2863 |
> |
top2->Draw("same"); |
2864 |
> |
center2->Draw("same"); |
2865 |
> |
bottom2->Draw("same"); |
2866 |
> |
|
2867 |
> |
rightofzp->SetMarkerStyle(21); |
2868 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2869 |
> |
rightofsb->SetMarkerStyle(24); |
2870 |
> |
rightsfsb->SetMarkerStyle(32); |
2871 |
> |
} |
2872 |
> |
|
2873 |
> |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2874 |
> |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2875 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2876 |
> |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2877 |
> |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
2878 |
> |
} |
2879 |
> |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2880 |
> |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2881 |
> |
leg3->SetY1(0.65); |
2882 |
|
|
2883 |
< |
leg3->Draw("same"); |
2883 |
> |
leg3->Draw("same"); |
2884 |
|
|
2885 |
< |
DrawMCPrelim(simulatedlumi); |
2886 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
2885 |
> |
DrawMCPrelim(simulatedlumi); |
2886 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
2887 |
> |
|
2888 |
> |
} |
2889 |
|
|
2890 |
|
delete TZem; |
2891 |
|
delete nTZem; |
2892 |
|
delete TZeemm; |
2893 |
|
delete nTZeemm; |
2894 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2894 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2895 |
|
delete TSem; |
2896 |
|
delete nTSem; |
2897 |
|
delete TSeemm; |
2932 |
|
nicer_binning.push_back(100); |
2933 |
|
nicer_binning.push_back(125); |
2934 |
|
nicer_binning.push_back(150); |
2935 |
< |
nicer_binning.push_back(175); |
2935 |
> |
//nicer_binning.push_back(175); |
2936 |
|
nicer_binning.push_back(200); |
2937 |
< |
nicer_binning.push_back(230); |
2938 |
< |
nicer_binning.push_back(280); |
2937 |
> |
nicer_binning.push_back(250); |
2938 |
> |
nicer_binning.push_back(300); |
2939 |
|
nicer_binning.push_back(400); |
2940 |
|
|
2941 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2944 |
|
|
2945 |
|
void zjets_prediction_comparison(string mcjzbWithPUa) { |
2946 |
|
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2947 |
< |
zcan->SetLogy(1); |
2947 |
> |
// zcan->SetLogy(1); |
2948 |
|
TCut weightbackup=cutWeight; |
2949 |
< |
|
2950 |
< |
|
2951 |
< |
// Do it without PU re-weighting |
2952 |
< |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2953 |
< |
stringstream resultsNoPU; |
2954 |
< |
stringstream noPUdatajzb; |
2955 |
< |
stringstream noPUmcjzb; |
2956 |
< |
|
2957 |
< |
stringstream mcjzbnoPU; |
2958 |
< |
// void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
2959 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2960 |
< |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2961 |
< |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2962 |
< |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzbnoPU.str() << endl; |
2963 |
< |
|
2964 |
< |
string mcjzb = mcjzbnoPU.str(); |
2965 |
< |
|
2966 |
< |
cutWeight="1.0"; |
2949 |
> |
|
2950 |
> |
bool UsePURW=false; |
2951 |
> |
|
2952 |
> |
|
2953 |
> |
string mcjzb; |
2954 |
> |
if(UsePURW) { |
2955 |
> |
mcjzb=mcjzbWithPUa; |
2956 |
> |
} else { |
2957 |
> |
// Do it without PU re-weighting |
2958 |
> |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2959 |
> |
stringstream resultsNoPU; |
2960 |
> |
stringstream noPUdatajzb; |
2961 |
> |
stringstream noPUmcjzb; |
2962 |
> |
|
2963 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb); |
2964 |
> |
dout << "The peak corrected JZB expression for MC without pileup is : " << noPUmcjzb.str() << endl; |
2965 |
> |
|
2966 |
> |
mcjzb = noPUmcjzb.str(); |
2967 |
> |
|
2968 |
> |
cutWeight="1.0"; |
2969 |
> |
} |
2970 |
|
|
2971 |
|
|
2972 |
|
vector<float> binning; |
2974 |
|
binning.push_back(10); |
2975 |
|
binning.push_back(20); |
2976 |
|
binning.push_back(40); |
2977 |
< |
// binning.push_back(80); |
2977 |
> |
binning.push_back(60); |
2978 |
> |
// binning.push_back(50); |
2979 |
> |
// binning.push_back(60); |
2980 |
> |
// binning.push_back(70); |
2981 |
> |
// binning.push_back(80); |
2982 |
> |
// binning.push_back(90); |
2983 |
|
binning.push_back(100); |
2984 |
< |
// float sbg_min=0.; |
2766 |
< |
// float sbg_max=100.; |
2767 |
< |
// int sbg_nbins=5; |
2984 |
> |
|
2985 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
2986 |
|
|
2987 |
|
TCut kPos((mcjzb+">0").c_str()); |
2988 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2989 |
|
string var( "abs("+mcjzb+")" ); |
2990 |
+ |
|
2991 |
+ |
TCut notTau("abs(genMID1)!=15"); |
2992 |
+ |
TCut ONLYTau("mll>20"); |
2993 |
+ |
|
2994 |
|
|
2995 |
< |
TCut kcut(cutmass&&cutOSSF&&cutnJets); |
2996 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2997 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2995 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2996 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2997 |
> |
|
2998 |
|
hJZBpos->SetLineColor(kBlack); |
2999 |
|
hJZBneg->SetLineColor(kRed); |
3000 |
|
|
3003 |
|
hJZBneg->Draw("same,hist"); |
3004 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
3005 |
|
|
3006 |
< |
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false); |
3006 |
> |
TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
3007 |
|
leg->AddEntry(hJZBpos,"Observed","pe"); |
3008 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
3009 |
|
leg->Draw("same"); |
3010 |
|
DrawMCPrelim(simulatedlumi); |
3011 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction"); |
3011 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"); |
3012 |
|
|
3013 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
3014 |
|
hratio->Divide(hJZBneg); |
3015 |
|
|
3016 |
|
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
3017 |
< |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << endl; |
3017 |
> |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl; |
3018 |
|
} |
3019 |
|
|
3020 |
|
zcan->SetLogy(0); |
3021 |
< |
hratio->GetYaxis()->SetRangeUser(0,2.5); |
3021 |
> |
hratio->GetYaxis()->SetRangeUser(0,2.0); |
3022 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3023 |
|
hratio->Draw("e1"); |
3024 |
|
|
3035 |
|
center->Draw("same"); |
3036 |
|
bottom->Draw("same"); |
3037 |
|
|
3038 |
< |
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false); |
3038 |
> |
TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
3039 |
|
leg2->AddEntry(hratio,"obs / pred","pe"); |
3040 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
3041 |
|
leg2->Draw("same"); |
3042 |
|
DrawMCPrelim(simulatedlumi); |
3043 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction_ratio"); |
3043 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"); |
3044 |
> |
|
3045 |
> |
TCut reducedNJets(cutnJets); |
3046 |
> |
|
3047 |
> |
TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3048 |
> |
TH1F *LcorrJZBeemm = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3049 |
> |
TH1F *RcorrJZBem = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3050 |
> |
TH1F *LcorrJZBem = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3051 |
> |
|
3052 |
> |
TH1F *RcorrJZBSBem; |
3053 |
> |
TH1F *LcorrJZBSBem; |
3054 |
> |
TH1F *RcorrJZBSBeemm; |
3055 |
> |
TH1F *LcorrJZBSBeemm; |
3056 |
> |
|
3057 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3058 |
> |
RcorrJZBSBem = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3059 |
> |
LcorrJZBSBem = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3060 |
> |
RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3061 |
> |
LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3062 |
> |
} |
3063 |
> |
|
3064 |
> |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3065 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3066 |
> |
Bpred->Add(RcorrJZBem,1.0/3.); |
3067 |
> |
Bpred->Add(LcorrJZBem,-1.0/3.); |
3068 |
> |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3069 |
> |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
3070 |
> |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
3071 |
> |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
3072 |
> |
} else { |
3073 |
> |
Bpred->Add(RcorrJZBem,1.0); |
3074 |
> |
Bpred->Add(LcorrJZBem,-1.0); |
3075 |
> |
} |
3076 |
> |
|
3077 |
> |
Bpred->SetLineColor(kRed); |
3078 |
> |
|
3079 |
> |
TAUhJZBpos->SetLineColor(kBlack); |
3080 |
> |
Bpred->SetLineColor(kRed); |
3081 |
> |
|
3082 |
> |
TAUhJZBpos->SetMinimum(1.0); |
3083 |
> |
TAUhJZBpos->Draw("e1"); |
3084 |
> |
Bpred->Draw("same,hist"); |
3085 |
> |
TAUhJZBpos->Draw("same,e1"); |
3086 |
> |
|
3087 |
> |
TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false); |
3088 |
> |
TAUleg->AddEntry(TAUhJZBpos,"Observed","pe"); |
3089 |
> |
TAUleg->AddEntry(Bpred,"Predicted","l"); |
3090 |
> |
TAUleg->Draw("same"); |
3091 |
> |
DrawMCPrelim(simulatedlumi); |
3092 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction"); |
3093 |
> |
|
3094 |
> |
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
3095 |
> |
TAUhratio->Divide(Bpred); |
3096 |
> |
|
3097 |
> |
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
3098 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
3099 |
> |
} |
3100 |
> |
|
3101 |
> |
zcan->SetLogy(0); |
3102 |
> |
TAUhratio->GetYaxis()->SetRangeUser(0,2.5); |
3103 |
> |
TAUhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3104 |
> |
TAUhratio->Draw("e1"); |
3105 |
> |
|
3106 |
> |
top->Draw("same"); |
3107 |
> |
center->Draw("same"); |
3108 |
> |
bottom->Draw("same"); |
3109 |
> |
|
3110 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false); |
3111 |
> |
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
3112 |
> |
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
3113 |
> |
TAUleg2->Draw("same"); |
3114 |
> |
DrawMCPrelim(simulatedlumi); |
3115 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"); |
3116 |
> |
|
3117 |
> |
delete Bpred; |
3118 |
> |
delete TAUhJZBpos; |
3119 |
> |
delete LcorrJZBeemm; |
3120 |
> |
delete RcorrJZBem; |
3121 |
> |
delete LcorrJZBem; |
3122 |
> |
|
3123 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3124 |
> |
delete RcorrJZBSBem; |
3125 |
> |
delete LcorrJZBSBem; |
3126 |
> |
delete RcorrJZBSBeemm; |
3127 |
> |
delete LcorrJZBSBeemm; |
3128 |
> |
} |
3129 |
> |
|
3130 |
|
|
3131 |
|
delete zcan; |
3132 |
|
cutWeight=weightbackup; |
3185 |
|
TH1F *RcorrJZBSBeemm; |
3186 |
|
TH1F *LcorrJZBSBeemm; |
3187 |
|
|
3188 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3188 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3189 |
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
3190 |
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
3191 |
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample); |
3193 |
|
} |
3194 |
|
|
3195 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3196 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3196 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3197 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3198 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3199 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3404 |
|
TH1F *JRcorrJZBSBeemm; |
3405 |
|
TH1F *JLcorrJZBSBeemm; |
3406 |
|
|
3407 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3407 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3408 |
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3409 |
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3410 |
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3425 |
|
|
3426 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3427 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
3428 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3428 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3429 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3430 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3431 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3495 |
|
dout << "______________________________________________" << endl; |
3496 |
|
dout << "How QCD shows up in the different regions: " << endl; |
3497 |
|
dout << "OSSF: " << endl; |
3498 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3498 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3499 |
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3500 |
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
3501 |
|
} else { |
3502 |
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3503 |
|
} |
3504 |
|
dout << "OSOF: " << endl; |
3505 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3505 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3506 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3507 |
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
3508 |
|
} else { |
3509 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3510 |
|
} |
3511 |
|
dout << "Therefore: " << endl; |
3512 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3512 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3513 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
3514 |
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
3515 |
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
3525 |
|
for(int i=0;i<(int)bins.size();i++) { |
3526 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
3527 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3528 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3528 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3529 |
|
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; |
3530 |
|
} else { |
3531 |
|
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; |
3539 |
|
if(LcorrJZBem) delete LcorrJZBem; |
3540 |
|
if(RcorrJZBeemm) delete RcorrJZBeemm; |
3541 |
|
if(LcorrJZBeemm) delete LcorrJZBeemm; |
3542 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
3543 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
3544 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3545 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3542 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem; |
3543 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem; |
3544 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3545 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3546 |
|
} |
3547 |
|
|
3548 |
|
void check_ptsanity() { |
3639 |
|
} |
3640 |
|
} |
3641 |
|
|
3642 |
< |
void met_vs_jzb_plots() { |
3642 |
> |
void met_vs_jzb_plots(string datajzb, string mcjzb) { |
3643 |
|
|
3644 |
|
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
3645 |
|
canmetjzb->SetRightMargin(0.16); |
3648 |
|
findme.push_back("DY"); |
3649 |
|
findme.push_back("TTJets"); |
3650 |
|
findme.push_back("LM"); |
3651 |
< |
|
3651 |
> |
/* |
3652 |
|
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3653 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3654 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3655 |
|
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3656 |
< |
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3657 |
< |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3656 |
> |
dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3657 |
> |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets); |
3658 |
|
} |
3659 |
|
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
3660 |
|
metvsjzb->SetStats(0); |
3668 |
|
title->Draw(); |
3669 |
|
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
3670 |
|
} |
3671 |
+ |
*/ |
3672 |
+ |
|
3673 |
+ |
dout << "About to produce MET plot for DY split up by JZB" << endl; |
3674 |
+ |
|
3675 |
+ |
int nbins=14; |
3676 |
+ |
float low=0; |
3677 |
+ |
float high=140; |
3678 |
+ |
|
3679 |
+ |
stringstream sLEFT; |
3680 |
+ |
sLEFT << "((" << mcjzb << ")<0)"; |
3681 |
+ |
TCut LEFT(sLEFT.str().c_str()); |
3682 |
+ |
stringstream sRIGHT; |
3683 |
+ |
sRIGHT << "((" << mcjzb << ")>0)"; |
3684 |
+ |
TCut RIGHT(sRIGHT.str().c_str()); |
3685 |
+ |
|
3686 |
+ |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3687 |
+ |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3688 |
+ |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3689 |
+ |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3690 |
+ |
|
3691 |
+ |
|
3692 |
+ |
TH1F *Bpred = (TH1F*)metleft->Clone("Bpred"); |
3693 |
+ |
Bpred->Add(metleftO,-1); |
3694 |
+ |
Bpred->Add(metrightO); |
3695 |
+ |
TH1F *obs = (TH1F*)metright->Clone("obs"); |
3696 |
+ |
|
3697 |
+ |
metleft->Add(metleftO,-1); |
3698 |
+ |
metright->Add(metrightO,-1); |
3699 |
+ |
|
3700 |
+ |
metleft->SetLineColor(kRed); |
3701 |
+ |
metright->SetLineColor(kBlack); |
3702 |
+ |
TPad *metpad = new TPad("metpad","metpad",0,0,1,1); |
3703 |
+ |
metpad->cd(); |
3704 |
+ |
metpad->SetLogy(1); |
3705 |
+ |
metleft->Draw("histo"); |
3706 |
+ |
metright->Draw("same"); |
3707 |
+ |
TLegend *lg = make_legend(); |
3708 |
+ |
lg->SetX1(0.5); |
3709 |
+ |
lg->SetY1(0.7); |
3710 |
+ |
lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P"); |
3711 |
+ |
lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L"); |
3712 |
+ |
lg->SetHeader("DY"); |
3713 |
+ |
|
3714 |
+ |
lg->Draw(); |
3715 |
+ |
save_with_ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
3716 |
+ |
|
3717 |
+ |
TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1); |
3718 |
+ |
metpad3->cd(); |
3719 |
+ |
metpad3->SetLogy(1); |
3720 |
+ |
Bpred->SetLineColor(kRed); |
3721 |
+ |
Bpred->Draw("histo"); |
3722 |
+ |
obs->SetLineColor(kBlack); |
3723 |
+ |
obs->Draw("same"); |
3724 |
+ |
TLegend *lg2 = make_legend(); |
3725 |
+ |
lg2->SetX1(0.5); |
3726 |
+ |
lg2->SetY1(0.7); |
3727 |
+ |
lg2->AddEntry(obs,"observed","P"); |
3728 |
+ |
lg2->AddEntry(Bpred,"predicted","L"); |
3729 |
+ |
lg2->SetHeader("DY"); |
3730 |
+ |
|
3731 |
+ |
lg2->Draw(); |
3732 |
+ |
|
3733 |
+ |
save_with_ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET"); |
3734 |
+ |
|
3735 |
+ |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
3736 |
+ |
metpad2->cd(); |
3737 |
+ |
metpad2->SetLogy(1); |
3738 |
+ |
|
3739 |
+ |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3740 |
+ |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3741 |
+ |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3742 |
+ |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3743 |
+ |
|
3744 |
+ |
metlefta->Add(metleftOa,-1); |
3745 |
+ |
metrighta->Add(metrightOa,-1); |
3746 |
+ |
|
3747 |
+ |
metlefta->SetLineColor(kRed); |
3748 |
+ |
metpad2->cd(); |
3749 |
+ |
metlefta->Draw("histo"); |
3750 |
+ |
metrighta->Draw("same"); |
3751 |
+ |
lg->Draw(); |
3752 |
+ |
save_with_ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
3753 |
+ |
|
3754 |
+ |
delete Bpred; |
3755 |
+ |
delete obs; |
3756 |
+ |
|
3757 |
+ |
float newhigh=300; |
3758 |
+ |
int newNBins=30; |
3759 |
+ |
|
3760 |
+ |
TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1); |
3761 |
+ |
TH1F *Ametleft = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity); |
3762 |
+ |
TH1F *AmetleftO = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity); |
3763 |
+ |
TH1F *Ametright = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity); |
3764 |
+ |
TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity); |
3765 |
+ |
|
3766 |
+ |
TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred"); |
3767 |
+ |
aBpred->Add(AmetleftO,-1); |
3768 |
+ |
aBpred->Add(AmetrightO); |
3769 |
+ |
aBpred->SetLineColor(kRed); |
3770 |
+ |
|
3771 |
+ |
TH1F *aobs = (TH1F*)Ametright->Clone("aobs"); |
3772 |
+ |
metpad4->cd(); |
3773 |
+ |
metpad4->SetLogy(1); |
3774 |
+ |
aobs->Draw(); |
3775 |
+ |
aBpred->Draw("histo,same"); |
3776 |
+ |
aobs->Draw("same"); |
3777 |
+ |
lg->SetHeader("All MC"); |
3778 |
+ |
lg->Draw(); |
3779 |
+ |
save_with_ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES"); |
3780 |
+ |
|
3781 |
+ |
|
3782 |
+ |
delete lg; |
3783 |
+ |
delete canmetjzb; |
3784 |
+ |
delete metleft; |
3785 |
+ |
delete metleftO; |
3786 |
+ |
delete metright; |
3787 |
+ |
delete metrightO; |
3788 |
|
} |
3789 |
|
|
3790 |
|
|