46 |
|
float StackMax=CollapseStack(stack)->GetMaximum(); |
47 |
|
if(StackMax>hdata->GetMaximum()) hdata->SetMaximum(1.2*StackMax); |
48 |
|
hdata->Draw("e1"); |
49 |
< |
stack.Draw("same"); |
49 |
> |
stack.Draw("histo,same"); |
50 |
|
hdata->Draw("e1,same"); |
51 |
|
|
52 |
|
TLegend *kinleg = allsamples.allbglegend(); |
84 |
|
PurityPaveText->SetTextFont(42); |
85 |
|
PurityPaveText->SetTextSize(0.021); |
86 |
|
PurityPaveText->AddText(spurity.str().c_str()); |
87 |
< |
PurityPaveText->Draw(); |
87 |
> |
//PurityPaveText->Draw(); |
88 |
|
|
89 |
|
|
90 |
|
// TText *purity = new TText(0.8,0.6,spurity.str().c_str()); |
91 |
|
// purity->Draw(); |
92 |
|
cout << "DATA : " << hdata->Integral() << endl; |
93 |
|
|
94 |
< |
save_with_ratio(hdata,stack,pad->cd(),"WZ_study/"+saveas); |
94 |
> |
Save_With_Ratio(hdata,stack,pad->cd(),"WZ_study/"+saveas); |
95 |
> |
|
96 |
> |
float sumData=0; |
97 |
> |
float sumMC=0; |
98 |
> |
TH1F *cstack = CollapseStack(stack); |
99 |
> |
|
100 |
> |
for(int i=1;i<=hdata->GetNbinsX();i++) { |
101 |
> |
if(hdata->GetBinCenter(i)>=20 && hdata->GetBinCenter(i)<=70) { |
102 |
> |
sumData+=hdata->GetBinContent(i); |
103 |
> |
sumMC+=cstack->GetBinContent(i); |
104 |
> |
} |
105 |
> |
} |
106 |
> |
delete cstack; |
107 |
> |
cout << " [20,70] for " << saveas << " : " << sumData << " (data) vs " << sumMC << " (mc) " << endl; |
108 |
> |
|
109 |
> |
|
110 |
|
delete hdata; |
111 |
|
delete can; |
112 |
|
} |
136 |
|
if(mcordata==data) DrawPrelim(); |
137 |
|
else DrawMCPrelim(); |
138 |
|
|
139 |
< |
save_with_ratio(sfdata,ofdata,pad->cd(),"WZ_study/SF_vs_OF_plots/"+saveas); |
139 |
> |
Save_With_Ratio(sfdata,ofdata,pad->cd(),"WZ_study/SF_vs_OF_plots/"+saveas); |
140 |
|
delete sfdata; |
141 |
|
delete ofdata; |
142 |
|
delete can; |
225 |
|
leg->Draw(); |
226 |
|
DrawMCPrelim(); |
227 |
|
|
228 |
< |
save_with_ratio(sfmc,ofmc,pad->cd(),"WZ_study/OFSFcomparison_MC"); |
228 |
> |
Save_With_Ratio(sfmc,ofmc,pad->cd(),"WZ_study/OFSFcomparison_MC"); |
229 |
|
|
230 |
|
// WZ only |
231 |
|
TH1F *sfwz = allsamples.Draw("sfwz" ,"tri_submll",nbins,mll_low,mll_hi,"m_{l_{2}l_{3}} [GeV]", "events", BasicCut&&Selection&&TriLepSF,mc , luminosity,allsamples.FindSample("WZJetsTo3")); |
242 |
|
leg->Draw(); |
243 |
|
DrawMCPrelim(); |
244 |
|
|
245 |
< |
save_with_ratio(sfwz,ofwz,pad2->cd(),"WZ_study/OFSFcomparison_WZ"); |
245 |
> |
Save_With_Ratio(sfwz,ofwz,pad2->cd(),"WZ_study/OFSFcomparison_WZ"); |
246 |
|
|
247 |
|
// data |
248 |
|
TH1F *sfdata = allsamples.Draw("sfdata","tri_submll",nbins,mll_low,mll_hi,"m_{l_{2}l_{3}} [GeV]", "events", BasicCut&&Selection&&TriLepSF,data, luminosity); |
259 |
|
leg->Draw(); |
260 |
|
DrawPrelim(); |
261 |
|
|
262 |
< |
save_with_ratio(sfdata,ofdata,pad3->cd(),"WZ_study/OFSFcomparison_data"); |
262 |
> |
Save_With_Ratio(sfdata,ofdata,pad3->cd(),"WZ_study/OFSFcomparison_data"); |
263 |
|
|
264 |
|
delete can; |
265 |
|
|
268 |
|
|
269 |
|
dout << "RATIO : SF / OF = " << sfdata->Integral() / ofdata->Integral() << " +/- " << (sfdata->Integral()/ofdata->Integral()) * TMath::Sqrt(1/sfdata->Integral()+1/ofdata->Integral()) << " (stat) " << endl; |
270 |
|
|
271 |
< |
TriLeptons::Rsfof_CorrectionFactor=ofdata->Integral() / sfdata->Integral(); |
272 |
< |
TriLeptons::Rsfof_CorrectionFactor_Error=(ofdata->Integral()/sfdata->Integral()) * TMath::Sqrt(1/sfdata->Integral()+1/ofdata->Integral()); |
271 |
> |
TriLeptons::Rsfof_CorrectionFactor=ofwz->Integral() / sfwz->Integral(); |
272 |
> |
TriLeptons::Rsfof_CorrectionFactor_Error=(ofwz->Integral()/sfwz->Integral()) * TMath::Sqrt(1/sfwz->GetEntries()+1/ofwz->GetEntries()); |
273 |
> |
delete sfdata; |
274 |
> |
delete ofdata; |
275 |
> |
delete sfwz; |
276 |
> |
delete ofwz; |
277 |
|
|
278 |
|
} |
279 |
|
|
306 |
|
leg->AddEntry(noMatch,"incorrect match","l"); |
307 |
|
leg->Draw(); |
308 |
|
|
309 |
< |
save_with_ratio(goodMatch,noMatch,pad->cd(),"WZ_study/GenMatchComparison/"+SaveAs); |
309 |
> |
Save_With_Ratio(goodMatch,noMatch,pad->cd(),"WZ_study/GenMatchComparison/"+SaveAs); |
310 |
|
|
311 |
|
delete goodMatch; |
312 |
|
delete noMatch; |
343 |
|
leg->Draw(); |
344 |
|
DrawPrelim(); |
345 |
|
|
346 |
< |
save_with_ratio(goodMatch,noMatch,pad->cd(),"WZ_study/RecoMatchComparison/"+SaveAs); |
346 |
> |
Save_With_Ratio(goodMatch,noMatch,pad->cd(),"WZ_study/RecoMatchComparison/"+SaveAs); |
347 |
|
|
348 |
|
delete goodMatch; |
349 |
|
delete noMatch; |
481 |
|
|
482 |
|
delete can; |
483 |
|
|
484 |
< |
dout << "SF events: " << sfwz->Integral() << " (pure: " << sfwzpure->Integral() << ")" << endl; |
485 |
< |
dout << "OF events: " << ofwz->Integral() << " (pure: " << ofwzpure->Integral() << ")" << endl; |
484 |
> |
dout << "SF WZ events: " << sfwz->Integral() << " (correctly combined WZ: " << sfwzpure->Integral() << ")" << endl; |
485 |
> |
dout << "OF WZ events: " << ofwz->Integral() << " (correctly combined WZ: " << ofwzpure->Integral() << ")" << endl; |
486 |
|
|
487 |
|
dout << "RATIO : SF / OF = " << sfwz->Integral() / ofwz->Integral() << " +/- " << sfwz->Integral()/ofwz->Integral() * sqrt(1/sfwz->GetEntries() + 1/ofwz->GetEntries()) << endl; |
488 |
|
dout << " PURE: SF / OF = " << sfwzpure->Integral() / ofwzpure->Integral() << " +/- " << sfwzpure->Integral()/ofwzpure->Integral() * sqrt(1/sfwzpure->GetEntries() + 1/ofwzpure->GetEntries()) << endl; |
513 |
|
dout << "SF events: " << sfwz->Integral() << " +/- " << sqrt(sfwz->Integral()) << endl; |
514 |
|
dout << "OF events: " << ofwz->Integral() << " +/- " << sqrt(ofwz->Integral()) << endl; |
515 |
|
|
516 |
+ |
dout << "Correction factor : " << TriLeptons::Rsfof_CorrectionFactor << " +/- " << TriLeptons::Rsfof_CorrectionFactor_Error << endl; |
517 |
+ |
|
518 |
|
float rawstatuncert=sfwz->Integral()/ofwz->Integral() * sqrt(1/sfwz->GetEntries() + 1/ofwz->GetEntries()); |
519 |
|
float rawresult=sfwz->Integral() / ofwz->Integral(); |
520 |
|
dout << "UNCORRECTED RATIO : SF / OF = " << rawresult << " +/- " << rawstatuncert << endl; |
558 |
|
leg->AddEntry(MCTruth,"MC truth (norm.)","l"); |
559 |
|
leg->Draw(); |
560 |
|
DrawMCPrelim(); |
561 |
< |
save_with_ratio(MCTruth,Prediction,pad->cd(),"WZ_study/PredictionMethodFailure/"+saveas); |
561 |
> |
Save_With_Ratio(MCTruth,Prediction,pad->cd(),"WZ_study/PredictionMethodFailure/"+saveas); |
562 |
|
|
563 |
|
delete Prediction; |
564 |
|
delete MCTruth; |
590 |
|
TH1F *WZ_OF_OFZ = allsamples.Draw("WZ_OFZ" ,"tri_badsubmll",1,0.0,1000.0,"m_{l_{2}l_{3}} [GeV]", "events", FlavorBlindSelection&&OFZ ,mc,luminosity,allsamples.FindSample("WZJetsTo3")); |
591 |
|
TH1F *WZ_OF_any = allsamples.Draw("WZ_OF_any" ,"tri_badsubmll",1,0.0,1000.0,"m_{l_{2}l_{3}} [GeV]", "events", FlavorBlindSelection ,mc,luminosity,allsamples.FindSample("WZJetsTo3")); |
592 |
|
|
593 |
< |
dout << "Miscombination rate in WZ sample with Selection in place : " << 100 * WZ_OF_OFZ->Integral() / WZ_OF_any->Integral() << " % (" << WZ_OF_OFZ->Integral() << " / " << WZ_OF_any->Integral() << ")" << endl; |
594 |
< |
// dout << "This corresponds to an estimate in same flavor of : " << |
593 |
> |
TH1F *data_OF_OFZ = allsamples.Draw("data_OFZ" ,"tri_badsubmll",1,0.0,1000.0,"m_{l_{2}l_{3}} [GeV]", "events", FlavorBlindSelection&&OFZ ,data,luminosity); |
594 |
> |
TH1F *data_OF_any = allsamples.Draw("data_OF_any" ,"tri_badsubmll",1,0.0,1000.0,"m_{l_{2}l_{3}} [GeV]", "events", FlavorBlindSelection ,data,luminosity); |
595 |
> |
|
596 |
> |
dout << "Miscombination rate in WZ sample with selection in place : " << 100 * WZ_OF_OFZ->Integral() / WZ_OF_any->Integral() << " +/- " << 100*(WZ_OF_OFZ->Integral() / WZ_OF_any->Integral())* sqrt( 1.0/WZ_OF_OFZ->GetEntries() + 1.0/WZ_OF_any->GetEntries())<< " % (" << WZ_OF_OFZ->Integral() << " / " << WZ_OF_any->Integral() << ")" << endl; |
597 |
> |
dout << "Miscombination rate in DATA with selection in place : " << 100 * data_OF_OFZ->Integral() / data_OF_any->Integral() << " +/- " << 100*(data_OF_OFZ->Integral() / data_OF_any->Integral()) * sqrt( 1.0/data_OF_OFZ->Integral() + 1.0/data_OF_any->Integral() ) << " % (" << data_OF_OFZ->Integral() << " / " << data_OF_any->Integral() << ")" << endl; |
598 |
|
|
599 |
|
delete WZ_OF_any; |
600 |
|
delete WZ_OF_OFZ; |
662 |
|
|
663 |
|
|
664 |
|
void CarryOutWZStudy() { |
665 |
< |
TCut BasicCut("leptonNum>2&&tri_pt1>30&&tri_pt2>20&&tri_pt3>20"); |
666 |
< |
TCut Selection("abs(tri_mlll-91)>30 && tri_mT>40 && met[4] > 30 && abs(tri_mll-91)<10 && tri_submll > 10 && abs(tri_submll-91)>5"); |
665 |
> |
TCut BasicCut("tri_MatchFound&&leptonNum>2&&tri_pt1>30&&tri_pt2>20&&tri_pt3>20"); |
666 |
> |
TCut Selection("abs(tri_mlll-91)>30 && tri_mT>50 && met[4] > 30 && abs(tri_mll-91)<10 && tri_submll > 10 && abs(tri_submll-91)>5"); |
667 |
|
|
668 |
|
//OptimizeSelection(BasicCut); |
669 |
|
|
670 |
|
//ComputeMiscombinationRate(Selection, BasicCut); |
671 |
|
|
672 |
< |
ComputeNewMiscombinationRate(Selection, BasicCut); |
649 |
< |
return; |
672 |
> |
// ComputeNewMiscombinationRate(Selection, BasicCut); |
673 |
|
|
674 |
|
WZ_kin_plot("tri_mll",40,0,200,"m_{Z} [GeV]",BasicCut,"Inclusive/Zmass"); |
675 |
|
WZ_kin_plot("tri_mlll",40,0,400,"m_{ll} [GeV]",BasicCut,"Inclusive/TrileptonMass"); |
678 |
|
WZ_kin_plot("tri_pt1",40,0,400,"p_{T}^{1} [GeV]",BasicCut,"Inclusive/Pt1"); |
679 |
|
WZ_kin_plot("tri_pt2",40,0,400,"p_{T}^{2} [GeV]",BasicCut,"Inclusive/Pt2"); |
680 |
|
WZ_kin_plot("tri_pt3",40,0,400,"p_{T}^{3} [GeV]",BasicCut,"Inclusive/Pt3"); |
681 |
< |
|
681 |
> |
/* |
682 |
|
WZ_kin_plot("tri_mll",40,0,200,"m_{Z} [GeV]",BasicCut&&TCut("abs(tri_mlll-91)>30"),"Mlll_cut/Zmass"); |
683 |
|
WZ_kin_plot("tri_mlll",40,0,400,"m_{ll} [GeV]",BasicCut&&TCut("abs(tri_mlll-91)>30"),"Mlll_cut/TrileptonMass"); |
684 |
|
WZ_kin_plot("tri_mT",40,0,200,"m_{T} [GeV]",BasicCut&&TCut("abs(tri_mlll-91)>30"),"Mlll_cut/mT"); |
707 |
|
WZ_kin_plot("met[4]",40,0,200,"MET [GeV]",BasicCut&&TCut("tri_mT>40&&abs(tri_mlll-91)>30&&met[4]>30"),"CutFlow/MET__3_CutOn_MT_n_Mll_n_Met"); |
708 |
|
WZ_kin_plot("met[4]",40,0,200,"MET [GeV]",BasicCut&&TCut("tri_mT>40&&abs(tri_mlll-91)>30&&met[4]>30&&abs(tri_mll-91)<10"),"CutFlow/MET__4_CutOn_MT_n_Mll_n_Met_MllWindow"); |
709 |
|
|
710 |
< |
|
710 |
> |
*/ |
711 |
|
WZ_kin_plot("tri_mll",40,0,200,"m_{Z} [GeV]",BasicCut&&Selection,"Zmass"); |
712 |
|
WZ_kin_plot("tri_mlll",40,0,400,"m_{lll} [GeV]",BasicCut&&Selection,"TrileptonMass"); |
713 |
|
WZ_kin_plot("tri_mT",40,0,200,"m_{T} [GeV]",BasicCut&&Selection,"mT"); |
842 |
|
stringstream savethis; |
843 |
|
savethis << "WZ_study/DYResolution/Response" << 100*smearby << "Percent"; |
844 |
|
|
845 |
< |
save_with_ratio(histoSF,sum,pad->cd(),savethis.str()); |
845 |
> |
Save_With_Ratio(histoSF,sum,pad->cd(),savethis.str()); |
846 |
|
} |
847 |
|
|
848 |
|
gr->SetTitle("Chi2Diagram"); |
871 |
|
stack.Draw(); |
872 |
|
histoSF->Draw("e1,same"); |
873 |
|
DrawPrelim(); |
874 |
< |
save_with_ratio(histoSF,CollapseStack(stack),pad->cd(),"WZ_study/DYResolution/Result"); |
874 |
> |
Save_With_Ratio(histoSF,CollapseStack(stack),pad->cd(),"WZ_study/DYResolution/Result"); |
875 |
|
|
876 |
|
TFile *fr = new TFile("rumba.root","RECREATE"); |
877 |
|
gr->Write(); |
886 |
|
void WZstudy() { |
887 |
|
// ExtractDYMissingResolution(); |
888 |
|
|
889 |
+ |
cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)))"); |
890 |
|
switch_overunderflow(true); |
891 |
|
cout << "Essential cut is " << (const char*) essentialcut << endl; |
892 |
|
cout << "Going to set essential cut to new triggers" << endl; |
893 |
|
TCut essential_bkp = essentialcut; |
870 |
– |
write_warning(__FUNCTION__,"Need to define trigger requirement for WZ!"); |
894 |
|
essentialcut=TCut("mll>5||mll<6"); |
895 |
|
cout << "Essential cut is now " << (const char*) essentialcut << endl; |
896 |
|
|