From 0c0ec418be70996d0c9da4f4da8decf70708561f Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 25 Nov 2019 15:09:52 +0100 Subject: [PATCH] separate 1 and 2 jets in et/mt --- FFcode/bin/OSSScorrection_et.cc | 4 +- FFcode/bin/OSSScorrection_mt.cc | 4 +- FFcode/bin/RawFF_et.cc | 144 ++++- FFcode/bin/RawFF_mt.cc | 144 ++++- FFcode/bin/Set1_correction_et.cc | 1007 ++++++++++++++++++++++++++++-- FFcode/bin/Set1_correction_mt.cc | 996 ++++++++++++++++++++++++++++- FFcode/bin/Set1_correction_tt.cc | 247 ++++++++ FFcode/python/Closure.py | 191 ++++++ FFcode/python/Draw_closure_et.py | 395 ++++++++++++ FFcode/python/Draw_closure_tt.py | 134 +++- FFcode/python/FFmvisclosure.py | 152 ++--- FFcode/python/Subtract_prompt.py | 14 +- FFcode/scripts/MakeFFs.py | 16 +- Fit_FF_et.cc | 20 +- Fit_FF_mt.cc | 20 +- Fit_FFclosure_et.cc | 34 +- Fit_FFclosure_mt.cc | 37 +- 17 files changed, 3313 insertions(+), 246 deletions(-) create mode 100644 FFcode/python/Closure.py create mode 100755 FFcode/python/Draw_closure_et.py diff --git a/FFcode/bin/OSSScorrection_et.cc b/FFcode/bin/OSSScorrection_et.cc index 0917c32..76c32e9 100644 --- a/FFcode/bin/OSSScorrection_et.cc +++ b/FFcode/bin/OSSScorrection_et.cc @@ -376,6 +376,7 @@ int main(int argc, char** argv) { TFile frawff("uncorrected_fakefactors_et.root"); TF1* ff_qcd_0jet=(TF1*) frawff.Get("rawFF_et_qcd_0jetSSloose"); TF1* ff_qcd_1jet=(TF1*) frawff.Get("rawFF_et_qcd_1jetSSloose"); + TF1* ff_qcd_2jet=(TF1*) frawff.Get("rawFF_et_qcd_2jetSSloose"); TFile fmvisclosure ("FF_corrections_1.root"); TF1* mvisclosure_qcdloose=(TF1*) fmvisclosure.Get("closure_mvis_et_qcdloose"); @@ -634,7 +635,8 @@ int main(int argc, char** argv) { //if (myvar>300) myvar=299; float ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_0jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose); - if (njets>0) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose); + if (njets==1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose); + else if (njets>1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_2jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose); if (!is_includedInEmbedded){ diff --git a/FFcode/bin/OSSScorrection_mt.cc b/FFcode/bin/OSSScorrection_mt.cc index 343184c..87aff3e 100644 --- a/FFcode/bin/OSSScorrection_mt.cc +++ b/FFcode/bin/OSSScorrection_mt.cc @@ -415,6 +415,7 @@ int main(int argc, char** argv) { TFile frawff("uncorrected_fakefactors_mt.root"); TF1* ff_qcd_0jet=(TF1*) frawff.Get("rawFF_mt_qcd_0jetSSloose"); TF1* ff_qcd_1jet=(TF1*) frawff.Get("rawFF_mt_qcd_1jetSSloose"); + TF1* ff_qcd_2jet=(TF1*) frawff.Get("rawFF_mt_qcd_2jetSSloose"); TFile fmvisclosure ("FF_corrections_1.root"); TF1* mvisclosure_qcdloose=(TF1*) fmvisclosure.Get("closure_mvis_mt_qcdloose"); @@ -676,7 +677,8 @@ int main(int argc, char** argv) { //if (myvar>300) myvar=299; float ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_0jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcdloose); - if (njets>0) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcdloose); + if (njets==1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcdloose); + if (njets>1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_2jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcdloose); if (!is_includedInEmbedded){ diff --git a/FFcode/bin/RawFF_et.cc b/FFcode/bin/RawFF_et.cc index ff08175..31ae086 100644 --- a/FFcode/bin/RawFF_et.cc +++ b/FFcode/bin/RawFF_et.cc @@ -330,23 +330,31 @@ int main(int argc, char** argv) { TH1F* h0LT_qcd_iso = new TH1F ("h0LT_qcd_iso","h0LT_qcd_iso",binnum_mtt0,bins_mtt0); h0LT_qcd_iso->Sumw2(); TH1F* h1LT_qcd_iso = new TH1F ("h1LT_qcd_iso","h1LT_qcd_iso",binnum_mtt0,bins_mtt0); h1LT_qcd_iso->Sumw2(); + TH1F* h2LT_qcd_iso = new TH1F ("h2LT_qcd_iso","h2LT_qcd_iso",binnum_mtt0,bins_mtt0); h2LT_qcd_iso->Sumw2(); TH1F* h0LT_qcd_anti = new TH1F ("h0LT_qcd_anti","h0LT_qcd_anti",binnum_mtt0,bins_mtt0); h0LT_qcd_anti->Sumw2(); TH1F* h1LT_qcd_anti = new TH1F ("h1LT_qcd_anti","h1LT_qcd_anti",binnum_mtt0,bins_mtt0); h1LT_qcd_anti->Sumw2(); + TH1F* h2LT_qcd_anti = new TH1F ("h2LT_qcd_anti","h2LT_qcd_anti",binnum_mtt0,bins_mtt0); h2LT_qcd_anti->Sumw2(); TH1F* h0LT_w_iso = new TH1F ("h0LT_w_iso","h0LT_w_iso",binnum_mtt0,bins_mtt0); h0LT_w_iso->Sumw2(); TH1F* h1LT_w_iso = new TH1F ("h1LT_w_iso","h1LT_w_iso",binnum_mtt0,bins_mtt0); h1LT_w_iso->Sumw2(); + TH1F* h2LT_w_iso = new TH1F ("h2LT_w_iso","h2LT_w_iso",binnum_mtt0,bins_mtt0); h2LT_w_iso->Sumw2(); TH1F* h0LT_w_anti = new TH1F ("h0LT_w_anti","h0LT_w_anti",binnum_mtt0,bins_mtt0); h0LT_w_anti->Sumw2(); TH1F* h1LT_w_anti = new TH1F ("h1LT_w_anti","h1LT_w_anti",binnum_mtt0,bins_mtt0); h1LT_w_anti->Sumw2(); + TH1F* h2LT_w_anti = new TH1F ("h2LT_w_anti","h2LT_w_anti",binnum_mtt0,bins_mtt0); h2LT_w_anti->Sumw2(); TH1F* h0LT_tt_iso = new TH1F ("h0LT_tt_iso","h0LT_tt_iso",binnum_mtt0,bins_mtt0); h0LT_tt_iso->Sumw2(); TH1F* h0LT_tt_anti = new TH1F ("h0LT_tt_anti","h0LT_tt_anti",binnum_mtt0,bins_mtt0); h0LT_tt_anti->Sumw2(); TH1F* h0J_qcd_iso = new TH1F ("h0J_qcd_iso","h0J_qcd_iso",binnum_mtt0,bins_mtt0); h0J_qcd_iso->Sumw2(); TH1F* h1J_qcd_iso = new TH1F ("h1J_qcd_iso","h1J_qcd_iso",binnum_mtt0,bins_mtt0); h1J_qcd_iso->Sumw2(); + TH1F* h2J_qcd_iso = new TH1F ("h2J_qcd_iso","h2J_qcd_iso",binnum_mtt0,bins_mtt0); h2J_qcd_iso->Sumw2(); TH1F* h0J_qcd_anti = new TH1F ("h0J_qcd_anti","h0J_qcd_anti",binnum_mtt0,bins_mtt0); h0J_qcd_anti->Sumw2(); TH1F* h1J_qcd_anti = new TH1F ("h1J_qcd_anti","h1J_qcd_anti",binnum_mtt0,bins_mtt0); h1J_qcd_anti->Sumw2(); + TH1F* h2J_qcd_anti = new TH1F ("h2J_qcd_anti","h2J_qcd_anti",binnum_mtt0,bins_mtt0); h2J_qcd_anti->Sumw2(); TH1F* h0J_w_iso = new TH1F ("h0J_w_iso","h0J_w_iso",binnum_mtt0,bins_mtt0); h0J_w_iso->Sumw2(); TH1F* h1J_w_iso = new TH1F ("h1J_w_iso","h1J_w_iso",binnum_mtt0,bins_mtt0); h1J_w_iso->Sumw2(); + TH1F* h2J_w_iso = new TH1F ("h2J_w_iso","h2J_w_iso",binnum_mtt0,bins_mtt0); h2J_w_iso->Sumw2(); TH1F* h0J_w_anti = new TH1F ("h0J_w_anti","h0J_w_anti",binnum_mtt0,bins_mtt0); h0J_w_anti->Sumw2(); TH1F* h1J_w_anti = new TH1F ("h1J_w_anti","h1J_w_anti",binnum_mtt0,bins_mtt0); h1J_w_anti->Sumw2(); + TH1F* h2J_w_anti = new TH1F ("h2J_w_anti","h2J_w_anti",binnum_mtt0,bins_mtt0); h2J_w_anti->Sumw2(); TH1F* h0J_tt_iso = new TH1F ("h0J_tt_iso","h0J_tt_iso",binnum_mtt0,bins_mtt0); h0J_tt_iso->Sumw2(); TH1F* h0J_tt_anti = new TH1F ("h0J_tt_anti","h0J_tt_anti",binnum_mtt0,bins_mtt0); h0J_tt_anti->Sumw2(); @@ -358,6 +366,10 @@ int main(int argc, char** argv) { TH1F* h1SSlooseLT_qcd_anti = new TH1F ("h1SSlooseLT_qcd_anti","h1SSlooseLT_qcd_anti",binnum_mtt0,bins_mtt0); h1SSlooseLT_qcd_anti->Sumw2(); TH1F* h1SSlooseJ_qcd_iso = new TH1F ("h1SSlooseJ_qcd_iso","h1SSlooseJ_qcd_iso",binnum_mtt0,bins_mtt0); h1SSlooseJ_qcd_iso->Sumw2(); TH1F* h1SSlooseJ_qcd_anti = new TH1F ("h1SSlooseJ_qcd_anti","h1SSlooseJ_qcd_anti",binnum_mtt0,bins_mtt0); h1SSlooseJ_qcd_anti->Sumw2(); + TH1F* h2SSlooseLT_qcd_iso = new TH1F ("h2SSlooseLT_qcd_iso","h2SSlooseLT_qcd_iso",binnum_mtt0,bins_mtt0); h2SSlooseLT_qcd_iso->Sumw2(); + TH1F* h2SSlooseLT_qcd_anti = new TH1F ("h2SSlooseLT_qcd_anti","h2SSlooseLT_qcd_anti",binnum_mtt0,bins_mtt0); h2SSlooseLT_qcd_anti->Sumw2(); + TH1F* h2SSlooseJ_qcd_iso = new TH1F ("h2SSlooseJ_qcd_iso","h2SSlooseJ_qcd_iso",binnum_mtt0,bins_mtt0); h2SSlooseJ_qcd_iso->Sumw2(); + TH1F* h2SSlooseJ_qcd_anti = new TH1F ("h2SSlooseJ_qcd_anti","h2SSlooseJ_qcd_anti",binnum_mtt0,bins_mtt0); h2SSlooseJ_qcd_anti->Sumw2(); string datapath = string(std::getenv("CMSSW_BASE"))+"/src/ComputeFF2018/FFcode/data/"; @@ -676,28 +688,40 @@ int main(int argc, char** argv) { h0LT_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h0LT_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1LT_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1LT_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2LT_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2LT_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0LT_w_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0LT_w_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (signalRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1LT_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (antiisoRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1LT_w_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2LT_w_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2LT_w_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets>=0 && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0LT_tt_iso->Fill(myvar,aweight*weight2); @@ -709,28 +733,40 @@ int main(int argc, char** argv) { h0J_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h0J_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1J_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1J_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2J_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2J_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0J_w_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0J_w_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (signalRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1J_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (antiisoRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1J_w_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2J_w_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2J_w_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets>=0 && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0J_tt_iso->Fill(myvar,aweight*weight2); @@ -804,6 +840,34 @@ int main(int argc, char** argv) { h1J_qcd_anti->Write(); } + TDirectory *d2_qcd_iso =fout->mkdir("et_2jet_qcd_iso"); + d2_qcd_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_iso->SetName(name.c_str()); + h2LT_qcd_iso->Add(h2J_qcd_iso); + h2LT_qcd_iso->Write(); + } + else{ + h2LT_qcd_iso->SetName(name.c_str()+postfixLT); + h2LT_qcd_iso->Write(); + h2J_qcd_iso->SetName(name.c_str()+postfixJ); + h2J_qcd_iso->Write(); + } + + TDirectory *d2_qcd_anti =fout->mkdir("et_2jet_qcd_anti"); + d2_qcd_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_anti->SetName(name.c_str()); + h2LT_qcd_anti->Add(h2J_qcd_anti); + h2LT_qcd_anti->Write(); + } + else{ + h2LT_qcd_anti->SetName(name.c_str()+postfixLT); + h2LT_qcd_anti->Write(); + h2J_qcd_anti->SetName(name.c_str()+postfixJ); + h2J_qcd_anti->Write(); + } + TDirectory *d0SSloose_qcd_iso =fout->mkdir("et_0SSloose_qcd_iso"); d0SSloose_qcd_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -860,6 +924,34 @@ int main(int argc, char** argv) { h1SSlooseJ_qcd_anti->Write(); } + TDirectory *d2SSloose_qcd_iso =fout->mkdir("et_2SSloose_qcd_iso"); + d2SSloose_qcd_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2SSlooseLT_qcd_iso->SetName(name.c_str()); + h2SSlooseLT_qcd_iso->Add(h2SSlooseJ_qcd_iso); + h2SSlooseLT_qcd_iso->Write(); + } + else{ + h2SSlooseLT_qcd_iso->SetName(name.c_str()+postfixLT); + h2SSlooseLT_qcd_iso->Write(); + h2SSlooseJ_qcd_iso->SetName(name.c_str()+postfixJ); + h2SSlooseJ_qcd_iso->Write(); + } + + TDirectory *d2SSloose_qcd_anti =fout->mkdir("et_2SSloose_qcd_anti"); + d2SSloose_qcd_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2SSlooseLT_qcd_anti->SetName(name.c_str()); + h2SSlooseLT_qcd_anti->Add(h2SSlooseJ_qcd_anti); + h2SSlooseLT_qcd_anti->Write(); + } + else{ + h2SSlooseLT_qcd_anti->SetName(name.c_str()+postfixLT); + h2SSlooseLT_qcd_anti->Write(); + h2SSlooseJ_qcd_anti->SetName(name.c_str()+postfixJ); + h2SSlooseJ_qcd_anti->Write(); + } + TDirectory *d0_w_iso =fout->mkdir("et_0jet_w_iso"); d0_w_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -916,6 +1008,34 @@ int main(int argc, char** argv) { h1J_w_anti->Write(); } + TDirectory *d2_w_iso =fout->mkdir("et_2jet_w_iso"); + d2_w_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_iso->SetName(name.c_str()); + h2LT_w_iso->Add(h2J_w_iso); + h2LT_w_iso->Write(); + } + else{ + h2LT_w_iso->SetName(name.c_str()+postfixLT); + h2LT_w_iso->Write(); + h2J_w_iso->SetName(name.c_str()+postfixJ); + h2J_w_iso->Write(); + } + + TDirectory *d2_w_anti =fout->mkdir("et_2jet_w_anti"); + d2_w_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_anti->SetName(name.c_str()); + h2LT_w_anti->Add(h2J_w_anti); + h2LT_w_anti->Write(); + } + else{ + h2LT_w_anti->SetName(name.c_str()+postfixLT); + h2LT_w_anti->Write(); + h2J_w_anti->SetName(name.c_str()+postfixJ); + h2J_w_anti->Write(); + } + TDirectory *d0_tt_iso =fout->mkdir("et_0jet_tt_iso"); d0_tt_iso->cd(); if (sample=="data_obs" or sample=="W"){ diff --git a/FFcode/bin/RawFF_mt.cc b/FFcode/bin/RawFF_mt.cc index dc74447..8cc4000 100644 --- a/FFcode/bin/RawFF_mt.cc +++ b/FFcode/bin/RawFF_mt.cc @@ -349,23 +349,31 @@ int main(int argc, char** argv) { TH1F* h0LT_qcd_iso = new TH1F ("h0LT_qcd_iso","h0LT_qcd_iso",binnum_mtt0,bins_mtt0); h0LT_qcd_iso->Sumw2(); TH1F* h1LT_qcd_iso = new TH1F ("h1LT_qcd_iso","h1LT_qcd_iso",binnum_mtt0,bins_mtt0); h1LT_qcd_iso->Sumw2(); + TH1F* h2LT_qcd_iso = new TH1F ("h2LT_qcd_iso","h2LT_qcd_iso",binnum_mtt0,bins_mtt0); h2LT_qcd_iso->Sumw2(); TH1F* h0LT_qcd_anti = new TH1F ("h0LT_qcd_anti","h0LT_qcd_anti",binnum_mtt0,bins_mtt0); h0LT_qcd_anti->Sumw2(); TH1F* h1LT_qcd_anti = new TH1F ("h1LT_qcd_anti","h1LT_qcd_anti",binnum_mtt0,bins_mtt0); h1LT_qcd_anti->Sumw2(); + TH1F* h2LT_qcd_anti = new TH1F ("h2LT_qcd_anti","h2LT_qcd_anti",binnum_mtt0,bins_mtt0); h2LT_qcd_anti->Sumw2(); TH1F* h0LT_w_iso = new TH1F ("h0LT_w_iso","h0LT_w_iso",binnum_mtt0,bins_mtt0); h0LT_w_iso->Sumw2(); TH1F* h1LT_w_iso = new TH1F ("h1LT_w_iso","h1LT_w_iso",binnum_mtt0,bins_mtt0); h1LT_w_iso->Sumw2(); + TH1F* h2LT_w_iso = new TH1F ("h2LT_w_iso","h2LT_w_iso",binnum_mtt0,bins_mtt0); h2LT_w_iso->Sumw2(); TH1F* h0LT_w_anti = new TH1F ("h0LT_w_anti","h0LT_w_anti",binnum_mtt0,bins_mtt0); h0LT_w_anti->Sumw2(); TH1F* h1LT_w_anti = new TH1F ("h1LT_w_anti","h1LT_w_anti",binnum_mtt0,bins_mtt0); h1LT_w_anti->Sumw2(); + TH1F* h2LT_w_anti = new TH1F ("h2LT_w_anti","h2LT_w_anti",binnum_mtt0,bins_mtt0); h2LT_w_anti->Sumw2(); TH1F* h0LT_tt_iso = new TH1F ("h0LT_tt_iso","h0LT_tt_iso",binnum_mtt0,bins_mtt0); h0LT_tt_iso->Sumw2(); TH1F* h0LT_tt_anti = new TH1F ("h0LT_tt_anti","h0LT_tt_anti",binnum_mtt0,bins_mtt0); h0LT_tt_anti->Sumw2(); TH1F* h0J_qcd_iso = new TH1F ("h0J_qcd_iso","h0J_qcd_iso",binnum_mtt0,bins_mtt0); h0J_qcd_iso->Sumw2(); TH1F* h1J_qcd_iso = new TH1F ("h1J_qcd_iso","h1J_qcd_iso",binnum_mtt0,bins_mtt0); h1J_qcd_iso->Sumw2(); + TH1F* h2J_qcd_iso = new TH1F ("h2J_qcd_iso","h2J_qcd_iso",binnum_mtt0,bins_mtt0); h2J_qcd_iso->Sumw2(); TH1F* h0J_qcd_anti = new TH1F ("h0J_qcd_anti","h0J_qcd_anti",binnum_mtt0,bins_mtt0); h0J_qcd_anti->Sumw2(); TH1F* h1J_qcd_anti = new TH1F ("h1J_qcd_anti","h1J_qcd_anti",binnum_mtt0,bins_mtt0); h1J_qcd_anti->Sumw2(); + TH1F* h2J_qcd_anti = new TH1F ("h2J_qcd_anti","h2J_qcd_anti",binnum_mtt0,bins_mtt0); h2J_qcd_anti->Sumw2(); TH1F* h0J_w_iso = new TH1F ("h0J_w_iso","h0J_w_iso",binnum_mtt0,bins_mtt0); h0J_w_iso->Sumw2(); TH1F* h1J_w_iso = new TH1F ("h1J_w_iso","h1J_w_iso",binnum_mtt0,bins_mtt0); h1J_w_iso->Sumw2(); + TH1F* h2J_w_iso = new TH1F ("h2J_w_iso","h2J_w_iso",binnum_mtt0,bins_mtt0); h2J_w_iso->Sumw2(); TH1F* h0J_w_anti = new TH1F ("h0J_w_anti","h0J_w_anti",binnum_mtt0,bins_mtt0); h0J_w_anti->Sumw2(); TH1F* h1J_w_anti = new TH1F ("h1J_w_anti","h1J_w_anti",binnum_mtt0,bins_mtt0); h1J_w_anti->Sumw2(); + TH1F* h2J_w_anti = new TH1F ("h2J_w_anti","h2J_w_anti",binnum_mtt0,bins_mtt0); h2J_w_anti->Sumw2(); TH1F* h0J_tt_iso = new TH1F ("h0J_tt_iso","h0J_tt_iso",binnum_mtt0,bins_mtt0); h0J_tt_iso->Sumw2(); TH1F* h0J_tt_anti = new TH1F ("h0J_tt_anti","h0J_tt_anti",binnum_mtt0,bins_mtt0); h0J_tt_anti->Sumw2(); @@ -377,6 +385,10 @@ int main(int argc, char** argv) { TH1F* h1SSlooseLT_qcd_anti = new TH1F ("h1SSlooseLT_qcd_anti","h1SSlooseLT_qcd_anti",binnum_mtt0,bins_mtt0); h1SSlooseLT_qcd_anti->Sumw2(); TH1F* h1SSlooseJ_qcd_iso = new TH1F ("h1SSlooseJ_qcd_iso","h1SSlooseJ_qcd_iso",binnum_mtt0,bins_mtt0); h1SSlooseJ_qcd_iso->Sumw2(); TH1F* h1SSlooseJ_qcd_anti = new TH1F ("h1SSlooseJ_qcd_anti","h1SSlooseJ_qcd_anti",binnum_mtt0,bins_mtt0); h1SSlooseJ_qcd_anti->Sumw2(); + TH1F* h2SSlooseLT_qcd_iso = new TH1F ("h2SSlooseLT_qcd_iso","h2SSlooseLT_qcd_iso",binnum_mtt0,bins_mtt0); h2SSlooseLT_qcd_iso->Sumw2(); + TH1F* h2SSlooseLT_qcd_anti = new TH1F ("h2SSlooseLT_qcd_anti","h2SSlooseLT_qcd_anti",binnum_mtt0,bins_mtt0); h2SSlooseLT_qcd_anti->Sumw2(); + TH1F* h2SSlooseJ_qcd_iso = new TH1F ("h2SSlooseJ_qcd_iso","h2SSlooseJ_qcd_iso",binnum_mtt0,bins_mtt0); h2SSlooseJ_qcd_iso->Sumw2(); + TH1F* h2SSlooseJ_qcd_anti = new TH1F ("h2SSlooseJ_qcd_anti","h2SSlooseJ_qcd_anti",binnum_mtt0,bins_mtt0); h2SSlooseJ_qcd_anti->Sumw2(); string datapath = string(std::getenv("CMSSW_BASE"))+"/src/ComputeFF2018/FFcode/data/"; @@ -698,28 +710,40 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h0LT_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h0LT_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1LT_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1LT_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2LT_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2LT_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0LT_w_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0LT_w_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (signalRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1LT_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (antiisoRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1LT_w_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2LT_w_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2LT_w_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets>=0 && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0LT_tt_iso->Fill(myvar,aweight*weight2); @@ -731,28 +755,40 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h0J_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h0J_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1J_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) h1J_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2J_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h2J_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + if (antiisoRegion && njets==1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h1SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) + h2SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0J_w_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && njets==0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h0J_w_anti->Fill(myvar,aweight*weight2); - if (signalRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (signalRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1J_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && njets>0 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + if (antiisoRegion && njets==1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) h1J_w_anti->Fill(myvar,aweight*weight2); + if (signalRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2J_w_iso->Fill(myvar,aweight*weight2); + if (antiisoRegion && njets>1 && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h2J_w_anti->Fill(myvar,aweight*weight2); if (signalRegion && njets>=0 && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0J_tt_iso->Fill(myvar,aweight*weight2); @@ -811,7 +847,6 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h1J_qcd_iso->SetName(name.c_str()+postfixJ); h1J_qcd_iso->Write(); } - TDirectory *d1_qcd_anti =fout->mkdir("mt_1jet_qcd_anti"); d1_qcd_anti->cd(); if (sample=="data_obs" or sample=="W"){ @@ -826,6 +861,33 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h1J_qcd_anti->Write(); } + TDirectory *d2_qcd_iso =fout->mkdir("mt_2jet_qcd_iso"); + d2_qcd_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_iso->SetName(name.c_str()); + h2LT_qcd_iso->Add(h2J_qcd_iso); + h2LT_qcd_iso->Write(); + } + else{ + h2LT_qcd_iso->SetName(name.c_str()+postfixLT); + h2LT_qcd_iso->Write(); + h2J_qcd_iso->SetName(name.c_str()+postfixJ); + h2J_qcd_iso->Write(); + } + TDirectory *d2_qcd_anti =fout->mkdir("mt_2jet_qcd_anti"); + d2_qcd_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_anti->SetName(name.c_str()); + h2LT_qcd_anti->Add(h2J_qcd_anti); + h2LT_qcd_anti->Write(); + } + else{ + h2LT_qcd_anti->SetName(name.c_str()+postfixLT); + h2LT_qcd_anti->Write(); + h2J_qcd_anti->SetName(name.c_str()+postfixJ); + h2J_qcd_anti->Write(); + } + TDirectory *d0SSloose_qcd_iso =fout->mkdir("mt_0SSloose_qcd_iso"); d0SSloose_qcd_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -867,7 +929,6 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h1SSlooseJ_qcd_iso->SetName(name.c_str()+postfixJ); h1SSlooseJ_qcd_iso->Write(); } - TDirectory *d1SSloose_qcd_anti =fout->mkdir("mt_1SSloose_qcd_anti"); d1SSloose_qcd_anti->cd(); if (sample=="data_obs" or sample=="W"){ @@ -882,6 +943,33 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h1SSlooseJ_qcd_anti->Write(); } + TDirectory *d2SSloose_qcd_iso =fout->mkdir("mt_2SSloose_qcd_iso"); + d2SSloose_qcd_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2SSlooseLT_qcd_iso->SetName(name.c_str()); + h2SSlooseLT_qcd_iso->Add(h2SSlooseJ_qcd_iso); + h2SSlooseLT_qcd_iso->Write(); + } + else{ + h2SSlooseLT_qcd_iso->SetName(name.c_str()+postfixLT); + h2SSlooseLT_qcd_iso->Write(); + h2SSlooseJ_qcd_iso->SetName(name.c_str()+postfixJ); + h2SSlooseJ_qcd_iso->Write(); + } + TDirectory *d2SSloose_qcd_anti =fout->mkdir("mt_2SSloose_qcd_anti"); + d2SSloose_qcd_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2SSlooseLT_qcd_anti->SetName(name.c_str()); + h2SSlooseLT_qcd_anti->Add(h2SSlooseJ_qcd_anti); + h2SSlooseLT_qcd_anti->Write(); + } + else{ + h2SSlooseLT_qcd_anti->SetName(name.c_str()+postfixLT); + h2SSlooseLT_qcd_anti->Write(); + h2SSlooseJ_qcd_anti->SetName(name.c_str()+postfixJ); + h2SSlooseJ_qcd_anti->Write(); + } + TDirectory *d0_w_iso =fout->mkdir("mt_0jet_w_iso"); d0_w_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -923,7 +1011,6 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h1J_w_iso->SetName(name.c_str()+postfixJ); h1J_w_iso->Write(); } - TDirectory *d1_w_anti =fout->mkdir("mt_1jet_w_anti"); d1_w_anti->cd(); if (sample=="data_obs" or sample=="W"){ @@ -938,6 +1025,33 @@ if (trigger19 && signalRegion && njets==0 && iso_1>0.02 && iso_1<0.15 && nbtag== h1J_w_anti->Write(); } + TDirectory *d2_w_iso =fout->mkdir("mt_2jet_w_iso"); + d2_w_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_iso->SetName(name.c_str()); + h2LT_w_iso->Add(h2J_w_iso); + h2LT_w_iso->Write(); + } + else{ + h2LT_w_iso->SetName(name.c_str()+postfixLT); + h2LT_w_iso->Write(); + h2J_w_iso->SetName(name.c_str()+postfixJ); + h2J_w_iso->Write(); + } + TDirectory *d2_w_anti =fout->mkdir("mt_2jet_w_anti"); + d2_w_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_anti->SetName(name.c_str()); + h2LT_w_anti->Add(h2J_w_anti); + h2LT_w_anti->Write(); + } + else{ + h2LT_w_anti->SetName(name.c_str()+postfixLT); + h2LT_w_anti->Write(); + h2J_w_anti->SetName(name.c_str()+postfixJ); + h2J_w_anti->Write(); + } + TDirectory *d0_tt_iso =fout->mkdir("mt_0jet_tt_iso"); d0_tt_iso->cd(); if (sample=="data_obs" or sample=="W"){ diff --git a/FFcode/bin/Set1_correction_et.cc b/FFcode/bin/Set1_correction_et.cc index 070768c..0cf45c3 100644 --- a/FFcode/bin/Set1_correction_et.cc +++ b/FFcode/bin/Set1_correction_et.cc @@ -45,6 +45,7 @@ int main(int argc, char** argv) { std::string sample = *(argv + 3); std::string name = *(argv + 4); std::string year = *(argv + 5); + std::string apply_corrections = *(argv + 6); TFile *f_Double = new TFile(input.c_str()); cout<<"XXXXXXXXXXXXX "<Sumw2(); + TH1F* h0LT_qcd_mvis_anti = new TH1F ("h0LT_qcd_mvis_anti","h0LT_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h0LT_qcd_mvis_anti->Sumw2(); + TH1F* h0LT_w_mvis_iso = new TH1F ("h0LT_w_mvis_iso","h0LT_w_mvis_iso",binnum_mtt0,bins_mtt0); h0LT_w_mvis_iso->Sumw2(); + TH1F* h0LT_w_mvis_anti = new TH1F ("h0LT_w_mvis_anti","h0LT_w_mvis_anti",binnum_mtt0,bins_mtt0); h0LT_w_mvis_anti->Sumw2(); + TH1F* h0J_qcd_mvis_iso = new TH1F ("h0J_qcd_mvis_iso","h0J_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h0J_qcd_mvis_iso->Sumw2(); + TH1F* h0J_qcd_mvis_anti = new TH1F ("h0J_qcd_mvis_anti","h0J_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h0J_qcd_mvis_anti->Sumw2(); + TH1F* h0J_w_mvis_iso = new TH1F ("h0J_w_mvis_iso","h0J_w_mvis_iso",binnum_mtt0,bins_mtt0); h0J_w_mvis_iso->Sumw2(); + TH1F* h0J_w_mvis_anti = new TH1F ("h0J_w_mvis_anti","h0J_w_mvis_anti",binnum_mtt0,bins_mtt0); h0J_w_mvis_anti->Sumw2(); + + TH1F* h1LT_qcd_mvis_iso = new TH1F ("h1LT_qcd_mvis_iso","h1LT_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h1LT_qcd_mvis_iso->Sumw2(); + TH1F* h1LT_qcd_mvis_anti = new TH1F ("h1LT_qcd_mvis_anti","h1LT_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h1LT_qcd_mvis_anti->Sumw2(); + TH1F* h1LT_w_mvis_iso = new TH1F ("h1LT_w_mvis_iso","h1LT_w_mvis_iso",binnum_mtt0,bins_mtt0); h1LT_w_mvis_iso->Sumw2(); + TH1F* h1LT_w_mvis_anti = new TH1F ("h1LT_w_mvis_anti","h1LT_w_mvis_anti",binnum_mtt0,bins_mtt0); h1LT_w_mvis_anti->Sumw2(); + TH1F* h1J_qcd_mvis_iso = new TH1F ("h1J_qcd_mvis_iso","h1J_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h1J_qcd_mvis_iso->Sumw2(); + TH1F* h1J_qcd_mvis_anti = new TH1F ("h1J_qcd_mvis_anti","h1J_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h1J_qcd_mvis_anti->Sumw2(); + TH1F* h1J_w_mvis_iso = new TH1F ("h1J_w_mvis_iso","h1J_w_mvis_iso",binnum_mtt0,bins_mtt0); h1J_w_mvis_iso->Sumw2(); + TH1F* h1J_w_mvis_anti = new TH1F ("h1J_w_mvis_anti","h1J_w_mvis_anti",binnum_mtt0,bins_mtt0); h1J_w_mvis_anti->Sumw2(); + + TH1F* h2LT_qcd_mvis_iso = new TH1F ("h2LT_qcd_mvis_iso","h2LT_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h2LT_qcd_mvis_iso->Sumw2(); + TH1F* h2LT_qcd_mvis_anti = new TH1F ("h2LT_qcd_mvis_anti","h2LT_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h2LT_qcd_mvis_anti->Sumw2(); + TH1F* h2LT_w_mvis_iso = new TH1F ("h2LT_w_mvis_iso","h2LT_w_mvis_iso",binnum_mtt0,bins_mtt0); h2LT_w_mvis_iso->Sumw2(); + TH1F* h2LT_w_mvis_anti = new TH1F ("h2LT_w_mvis_anti","h2LT_w_mvis_anti",binnum_mtt0,bins_mtt0); h2LT_w_mvis_anti->Sumw2(); + TH1F* h2J_qcd_mvis_iso = new TH1F ("h2J_qcd_mvis_iso","h2J_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h2J_qcd_mvis_iso->Sumw2(); + TH1F* h2J_qcd_mvis_anti = new TH1F ("h2J_qcd_mvis_anti","h2J_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h2J_qcd_mvis_anti->Sumw2(); + TH1F* h2J_w_mvis_iso = new TH1F ("h2J_w_mvis_iso","h2J_w_mvis_iso",binnum_mtt0,bins_mtt0); h2J_w_mvis_iso->Sumw2(); + TH1F* h2J_w_mvis_anti = new TH1F ("h2J_w_mvis_anti","h2J_w_mvis_anti",binnum_mtt0,bins_mtt0); h2J_w_mvis_anti->Sumw2(); + + TH1F* h0LT_qcd_iso = new TH1F ("h0LT_qcd_iso","h0LT_qcd_iso",binnum_mtt0,bins_mtt0); h0LT_qcd_iso->Sumw2(); TH1F* h0LT_qcd_anti = new TH1F ("h0LT_qcd_anti","h0LT_qcd_anti",binnum_mtt0,bins_mtt0); h0LT_qcd_anti->Sumw2(); + TH1F* h0LT_qcd_taupt_iso = new TH1F ("h0LT_qcd_taupt_iso","h0LT_qcd_taupt_iso",binnum_taupt0,bins_taupt0); h0LT_qcd_taupt_iso->Sumw2(); + TH1F* h0LT_qcd_taupt_anti = new TH1F ("h0LT_qcd_taupt_anti","h0LT_qcd_taupt_anti",binnum_taupt0,bins_taupt0); h0LT_qcd_taupt_anti->Sumw2(); + TH1F* h0LT_qcd_pth_iso = new TH1F ("h0LT_qcd_pth_iso","h0LT_qcd_pth_iso",binnum_pth0,bins_pth0); h0LT_qcd_pth_iso->Sumw2(); + TH1F* h0LT_qcd_pth_anti = new TH1F ("h0LT_qcd_pth_anti","h0LT_qcd_pth_anti",binnum_pth0,bins_pth0); h0LT_qcd_pth_anti->Sumw2(); + TH1F* h0LT_qcd_mjj_iso = new TH1F ("h0LT_qcd_mjj_iso","h0LT_qcd_mjj_iso",binnum_mjj0,bins_mjj0); h0LT_qcd_mjj_iso->Sumw2(); + TH1F* h0LT_qcd_mjj_anti = new TH1F ("h0LT_qcd_mjj_anti","h0LT_qcd_mjj_anti",binnum_mjj0,bins_mjj0); h0LT_qcd_mjj_anti->Sumw2(); TH1F* h0SSlooseLT_qcd_iso = new TH1F ("h0SSlooseLT_qcd_iso","h0SSlooseLT_qcd_iso",binnum_mtt0,bins_mtt0); h0SSlooseLT_qcd_iso->Sumw2(); TH1F* h0SSlooseLT_qcd_anti = new TH1F ("h0SSlooseLT_qcd_anti","h0SSlooseLT_qcd_anti",binnum_mtt0,bins_mtt0); h0SSlooseLT_qcd_anti->Sumw2(); TH1F* h0LT_w_iso = new TH1F ("h0LT_w_iso","h0LT_w_iso",binnum_mtt0,bins_mtt0); h0LT_w_iso->Sumw2(); TH1F* h0LT_w_anti = new TH1F ("h0LT_w_anti","h0LT_w_anti",binnum_mtt0,bins_mtt0); h0LT_w_anti->Sumw2(); + TH1F* h0LT_w_taupt_iso = new TH1F ("h0LT_w_taupt_iso","h0LT_w_taupt_iso",binnum_taupt0,bins_taupt0); h0LT_w_taupt_iso->Sumw2(); + TH1F* h0LT_w_taupt_anti = new TH1F ("h0LT_w_taupt_anti","h0LT_w_taupt_anti",binnum_taupt0,bins_taupt0); h0LT_w_taupt_anti->Sumw2(); + TH1F* h0LT_w_pth_iso = new TH1F ("h0LT_w_pth_iso","h0LT_w_pth_iso",binnum_pth0,bins_pth0); h0LT_w_pth_iso->Sumw2(); + TH1F* h0LT_w_pth_anti = new TH1F ("h0LT_w_pth_anti","h0LT_w_pth_anti",binnum_pth0,bins_pth0); h0LT_w_pth_anti->Sumw2(); + TH1F* h0LT_w_mjj_iso = new TH1F ("h0LT_w_mjj_iso","h0LT_w_mjj_iso",binnum_mjj0,bins_mjj0); h0LT_w_mjj_iso->Sumw2(); + TH1F* h0LT_w_mjj_anti = new TH1F ("h0LT_w_mjj_anti","h0LT_w_mjj_anti",binnum_mjj0,bins_mjj0); h0LT_w_mjj_anti->Sumw2(); TH1F* h0LT_tt_iso = new TH1F ("h0LT_tt_iso","h0LT_tt_iso",binnum_mtt0,bins_mtt0); h0LT_tt_iso->Sumw2(); TH1F* h0LT_tt_anti = new TH1F ("h0LT_tt_anti","h0LT_tt_anti",binnum_mtt0,bins_mtt0); h0LT_tt_anti->Sumw2(); TH1F* h0J_qcd_iso = new TH1F ("h0J_qcd_iso","h0J_qcd_iso",binnum_mtt0,bins_mtt0); h0J_qcd_iso->Sumw2(); TH1F* h0J_qcd_anti = new TH1F ("h0J_qcd_anti","h0J_qcd_anti",binnum_mtt0,bins_mtt0); h0J_qcd_anti->Sumw2(); + TH1F* h0J_qcd_taupt_iso = new TH1F ("h0J_qcd_taupt_iso","h0J_qcd_taupt_iso",binnum_taupt0,bins_taupt0); h0J_qcd_taupt_iso->Sumw2(); + TH1F* h0J_qcd_taupt_anti = new TH1F ("h0J_qcd_taupt_anti","h0J_qcd_taupt_anti",binnum_taupt0,bins_taupt0); h0J_qcd_taupt_anti->Sumw2(); + TH1F* h0J_qcd_pth_iso = new TH1F ("h0J_qcd_pth_iso","h0J_qcd_pth_iso",binnum_pth0,bins_pth0); h0J_qcd_pth_iso->Sumw2(); + TH1F* h0J_qcd_pth_anti = new TH1F ("h0J_qcd_pth_anti","h0J_qcd_pth_anti",binnum_pth0,bins_pth0); h0J_qcd_pth_anti->Sumw2(); + TH1F* h0J_qcd_mjj_iso = new TH1F ("h0J_qcd_mjj_iso","h0J_qcd_mjj_iso",binnum_mjj0,bins_mjj0); h0J_qcd_mjj_iso->Sumw2(); + TH1F* h0J_qcd_mjj_anti = new TH1F ("h0J_qcd_mjj_anti","h0J_qcd_mjj_anti",binnum_mjj0,bins_mjj0); h0J_qcd_mjj_anti->Sumw2(); TH1F* h0SSlooseJ_qcd_iso = new TH1F ("h0SSlooseJ_qcd_iso","h0SSlooseJ_qcd_iso",binnum_mtt0,bins_mtt0); h0SSlooseJ_qcd_iso->Sumw2(); TH1F* h0SSlooseJ_qcd_anti = new TH1F ("h0SSlooseJ_qcd_anti","h0SSlooseJ_qcd_anti",binnum_mtt0,bins_mtt0); h0SSlooseJ_qcd_anti->Sumw2(); TH1F* h0J_w_iso = new TH1F ("h0J_w_iso","h0J_w_iso",binnum_mtt0,bins_mtt0); h0J_w_iso->Sumw2(); TH1F* h0J_w_anti = new TH1F ("h0J_w_anti","h0J_w_anti",binnum_mtt0,bins_mtt0); h0J_w_anti->Sumw2(); + TH1F* h0J_w_taupt_iso = new TH1F ("h0J_w_taupt_iso","h0J_w_taupt_iso",binnum_taupt0,bins_taupt0); h0J_w_taupt_iso->Sumw2(); + TH1F* h0J_w_taupt_anti = new TH1F ("h0J_w_taupt_anti","h0J_w_taupt_anti",binnum_taupt0,bins_taupt0); h0J_w_taupt_anti->Sumw2(); + TH1F* h0J_w_pth_iso = new TH1F ("h0J_w_pth_iso","h0J_w_pth_iso",binnum_pth0,bins_pth0); h0J_w_pth_iso->Sumw2(); + TH1F* h0J_w_pth_anti = new TH1F ("h0J_w_pth_anti","h0J_w_pth_anti",binnum_pth0,bins_pth0); h0J_w_pth_anti->Sumw2(); + TH1F* h0J_w_mjj_iso = new TH1F ("h0J_w_mjj_iso","h0J_w_mjj_iso",binnum_mjj0,bins_mjj0); h0J_w_mjj_iso->Sumw2(); + TH1F* h0J_w_mjj_anti = new TH1F ("h0J_w_mjj_anti","h0J_w_mjj_anti",binnum_mjj0,bins_mjj0); h0J_w_mjj_anti->Sumw2(); TH1F* h0J_tt_iso = new TH1F ("h0J_tt_iso","h0J_tt_iso",binnum_mtt0,bins_mtt0); h0J_tt_iso->Sumw2(); TH1F* h0J_tt_anti = new TH1F ("h0J_tt_anti","h0J_tt_anti",binnum_mtt0,bins_mtt0); h0J_tt_anti->Sumw2(); TH1F* hmt_w_iso = new TH1F ("hmt_w_iso","hmt_w_iso",binnum_mt,bins_mt); hmt_w_iso->Sumw2(); TH1F* hmt_w_anti = new TH1F ("hmt_w_anti","hmt_w_anti",binnum_mt,bins_mt); hmt_w_anti->Sumw2(); + TH2F* h0LT_qcd_cat0jetlow_iso = new TH2F ("h0LT_qcd_cat0jetlow_iso","h0LT_qcd_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_qcd_cat0jetlow_iso->Sumw2(); + TH2F* h0LT_qcd_cat0jetlow_anti = new TH2F ("h0LT_qcd_cat0jetlow_anti","h0LT_qcd_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_qcd_cat0jetlow_anti->Sumw2(); + TH2F* h0LT_w_cat0jetlow_iso = new TH2F ("h0LT_w_cat0jetlow_iso","h0LT_w_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_w_cat0jetlow_iso->Sumw2(); + TH2F* h0LT_w_cat0jetlow_anti = new TH2F ("h0LT_w_cat0jetlow_anti","h0LT_w_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_w_cat0jetlow_anti->Sumw2(); + TH2F* h0J_qcd_cat0jetlow_iso = new TH2F ("h0J_qcd_cat0jetlow_iso","h0J_qcd_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_qcd_cat0jetlow_iso->Sumw2(); + TH2F* h0J_qcd_cat0jetlow_anti = new TH2F ("h0J_qcd_cat0jetlow_anti","h0J_qcd_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_qcd_cat0jetlow_anti->Sumw2(); + TH2F* h0J_w_cat0jetlow_iso = new TH2F ("h0J_w_cat0jetlow_iso","h0J_w_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_w_cat0jetlow_iso->Sumw2(); + TH2F* h0J_w_cat0jetlow_anti = new TH2F ("h0J_w_cat0jetlow_anti","h0J_w_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_w_cat0jetlow_anti->Sumw2(); + + TH2F* h0LT_qcd_cat0jethigh_iso = new TH2F ("h0LT_qcd_cat0jethigh_iso","h0LT_qcd_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_qcd_cat0jethigh_iso->Sumw2(); + TH2F* h0LT_qcd_cat0jethigh_anti = new TH2F ("h0LT_qcd_cat0jethigh_anti","h0LT_qcd_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_qcd_cat0jethigh_anti->Sumw2(); + TH2F* h0LT_w_cat0jethigh_iso = new TH2F ("h0LT_w_cat0jethigh_iso","h0LT_w_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_w_cat0jethigh_iso->Sumw2(); + TH2F* h0LT_w_cat0jethigh_anti = new TH2F ("h0LT_w_cat0jethigh_anti","h0LT_w_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_w_cat0jethigh_anti->Sumw2(); + TH2F* h0J_qcd_cat0jethigh_iso = new TH2F ("h0J_qcd_cat0jethigh_iso","h0J_qcd_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_qcd_cat0jethigh_iso->Sumw2(); + TH2F* h0J_qcd_cat0jethigh_anti = new TH2F ("h0J_qcd_cat0jethigh_anti","h0J_qcd_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_qcd_cat0jethigh_anti->Sumw2(); + TH2F* h0J_w_cat0jethigh_iso = new TH2F ("h0J_w_cat0jethigh_iso","h0J_w_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_w_cat0jethigh_iso->Sumw2(); + TH2F* h0J_w_cat0jethigh_anti = new TH2F ("h0J_w_cat0jethigh_anti","h0J_w_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_w_cat0jethigh_anti->Sumw2(); + + TH2F* h0LT_qcd_catboosted1_iso = new TH2F ("h0LT_qcd_catboosted1_iso","h0LT_qcd_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_qcd_catboosted1_iso->Sumw2(); + TH2F* h0LT_qcd_catboosted1_anti = new TH2F ("h0LT_qcd_catboosted1_anti","h0LT_qcd_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_qcd_catboosted1_anti->Sumw2(); + TH2F* h0LT_w_catboosted1_iso = new TH2F ("h0LT_w_catboosted1_iso","h0LT_w_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_w_catboosted1_iso->Sumw2(); + TH2F* h0LT_w_catboosted1_anti = new TH2F ("h0LT_w_catboosted1_anti","h0LT_w_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_w_catboosted1_anti->Sumw2(); + TH2F* h0J_qcd_catboosted1_iso = new TH2F ("h0J_qcd_catboosted1_iso","h0J_qcd_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_qcd_catboosted1_iso->Sumw2(); + TH2F* h0J_qcd_catboosted1_anti = new TH2F ("h0J_qcd_catboosted1_anti","h0J_qcd_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_qcd_catboosted1_anti->Sumw2(); + TH2F* h0J_w_catboosted1_iso = new TH2F ("h0J_w_catboosted1_iso","h0J_w_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_w_catboosted1_iso->Sumw2(); + TH2F* h0J_w_catboosted1_anti = new TH2F ("h0J_w_catboosted1_anti","h0J_w_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_w_catboosted1_anti->Sumw2(); + + TH2F* h0LT_qcd_catboosted2_iso = new TH2F ("h0LT_qcd_catboosted2_iso","h0LT_qcd_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_qcd_catboosted2_iso->Sumw2(); + TH2F* h0LT_qcd_catboosted2_anti = new TH2F ("h0LT_qcd_catboosted2_anti","h0LT_qcd_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_qcd_catboosted2_anti->Sumw2(); + TH2F* h0LT_w_catboosted2_iso = new TH2F ("h0LT_w_catboosted2_iso","h0LT_w_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_w_catboosted2_iso->Sumw2(); + TH2F* h0LT_w_catboosted2_anti = new TH2F ("h0LT_w_catboosted2_anti","h0LT_w_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_w_catboosted2_anti->Sumw2(); + TH2F* h0J_qcd_catboosted2_iso = new TH2F ("h0J_qcd_catboosted2_iso","h0J_qcd_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_qcd_catboosted2_iso->Sumw2(); + TH2F* h0J_qcd_catboosted2_anti = new TH2F ("h0J_qcd_catboosted2_anti","h0J_qcd_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_qcd_catboosted2_anti->Sumw2(); + TH2F* h0J_w_catboosted2_iso = new TH2F ("h0J_w_catboosted2_iso","h0J_w_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_w_catboosted2_iso->Sumw2(); + TH2F* h0J_w_catboosted2_anti = new TH2F ("h0J_w_catboosted2_anti","h0J_w_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_w_catboosted2_anti->Sumw2(); + + TH2F* h0LT_qcd_catvbflow_iso = new TH2F ("h0LT_qcd_catvbflow_iso","h0LT_qcd_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_qcd_catvbflow_iso->Sumw2(); + TH2F* h0LT_qcd_catvbflow_anti = new TH2F ("h0LT_qcd_catvbflow_anti","h0LT_qcd_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_qcd_catvbflow_anti->Sumw2(); + TH2F* h0LT_w_catvbflow_iso = new TH2F ("h0LT_w_catvbflow_iso","h0LT_w_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_w_catvbflow_iso->Sumw2(); + TH2F* h0LT_w_catvbflow_anti = new TH2F ("h0LT_w_catvbflow_anti","h0LT_w_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_w_catvbflow_anti->Sumw2(); + TH2F* h0J_qcd_catvbflow_iso = new TH2F ("h0J_qcd_catvbflow_iso","h0J_qcd_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_qcd_catvbflow_iso->Sumw2(); + TH2F* h0J_qcd_catvbflow_anti = new TH2F ("h0J_qcd_catvbflow_anti","h0J_qcd_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_qcd_catvbflow_anti->Sumw2(); + TH2F* h0J_w_catvbflow_iso = new TH2F ("h0J_w_catvbflow_iso","h0J_w_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_w_catvbflow_iso->Sumw2(); + TH2F* h0J_w_catvbflow_anti = new TH2F ("h0J_w_catvbflow_anti","h0J_w_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_w_catvbflow_anti->Sumw2(); + + TH2F* h0LT_qcd_catvbfhigh_iso = new TH2F ("h0LT_qcd_catvbfhigh_iso","h0LT_qcd_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_qcd_catvbfhigh_iso->Sumw2(); + TH2F* h0LT_qcd_catvbfhigh_anti = new TH2F ("h0LT_qcd_catvbfhigh_anti","h0LT_qcd_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_qcd_catvbfhigh_anti->Sumw2(); + TH2F* h0LT_w_catvbfhigh_iso = new TH2F ("h0LT_w_catvbfhigh_iso","h0LT_w_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_w_catvbfhigh_iso->Sumw2(); + TH2F* h0LT_w_catvbfhigh_anti = new TH2F ("h0LT_w_catvbfhigh_anti","h0LT_w_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_w_catvbfhigh_anti->Sumw2(); + TH2F* h0J_qcd_catvbfhigh_iso = new TH2F ("h0J_qcd_catvbfhigh_iso","h0J_qcd_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_qcd_catvbfhigh_iso->Sumw2(); + TH2F* h0J_qcd_catvbfhigh_anti = new TH2F ("h0J_qcd_catvbfhigh_anti","h0J_qcd_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_qcd_catvbfhigh_anti->Sumw2(); + TH2F* h0J_w_catvbfhigh_iso = new TH2F ("h0J_w_catvbfhigh_iso","h0J_w_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_w_catvbfhigh_iso->Sumw2(); + TH2F* h0J_w_catvbfhigh_anti = new TH2F ("h0J_w_catvbfhigh_anti","h0J_w_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_w_catvbfhigh_anti->Sumw2(); + + string datapath = string(std::getenv("CMSSW_BASE"))+"/src/ComputeFF2018/FFcode/data/"; reweight::LumiReWeighting* LumiWeights_12; @@ -393,17 +537,30 @@ int main(int argc, char** argv) { TFile frawff("uncorrected_fakefactors_et.root"); TF1* ff_qcd_0jet=(TF1*) frawff.Get("rawFF_et_qcd_0jet"); TF1* ff_qcd_1jet=(TF1*) frawff.Get("rawFF_et_qcd_1jet"); + TF1* ff_qcd_2jet=(TF1*) frawff.Get("rawFF_et_qcd_2jet"); TF1* ff_looseSSqcd_0jet=(TF1*) frawff.Get("rawFF_et_qcd_0jetSSloose"); TF1* ff_looseSSqcd_1jet=(TF1*) frawff.Get("rawFF_et_qcd_1jetSSloose"); + TF1* ff_looseSSqcd_2jet=(TF1*) frawff.Get("rawFF_et_qcd_2jetSSloose"); TF1* ff_w_0jet=(TF1*) frawff.Get("rawFF_et_w_0jet"); TF1* ff_w_1jet=(TF1*) frawff.Get("rawFF_et_w_1jet"); + TF1* ff_w_2jet=(TF1*) frawff.Get("rawFF_et_w_2jet"); TF1* ff_wmc_0jet=(TF1*) frawff.Get("mc_rawFF_et_w_0jet"); TF1* ff_wmc_1jet=(TF1*) frawff.Get("mc_rawFF_et_w_1jet"); + TF1* ff_wmc_2jet=(TF1*) frawff.Get("mc_rawFF_et_w_2jet"); TF1* ff_tt_0jet=(TF1*) frawff.Get("rawFF_et_tt"); TF1* ff_ttmc_0jet=(TF1*) frawff.Get("mc_rawFF_et_tt"); TFile fmvisclosure ("FF_corrections_1.root"); TF1* mvisclosure_wmc=(TF1*) fmvisclosure.Get("closure_mvis_et_wmc"); + TF1* mvisclosure_qcd=(TF1*) fmvisclosure.Get("closure_mvis_et_qcd"); + TF1* mvisclosure_w=(TF1*) fmvisclosure.Get("closure_mvis_et_w"); + TF1* mvisclosure_tt=(TF1*) fmvisclosure.Get("closure_mvis_et_ttmc"); + TF1* mvisclosure_qcd0=(TF1*) fmvisclosure.Get("closure_mvis_et_0jet_qcd"); + TF1* mvisclosure_w0=(TF1*) fmvisclosure.Get("closure_mvis_et_0jet_w"); + TF1* mvisclosure_qcd1=(TF1*) fmvisclosure.Get("closure_mvis_et_1jet_qcd"); + TF1* mvisclosure_w1=(TF1*) fmvisclosure.Get("closure_mvis_et_1jet_w"); + TF1* mvisclosure_qcd2=(TF1*) fmvisclosure.Get("closure_mvis_et_2jet_qcd"); + TF1* mvisclosure_w2=(TF1*) fmvisclosure.Get("closure_mvis_et_2jet_w"); ScaleFactor * myScaleFactor_trgEle3235 = new ScaleFactor(); myScaleFactor_trgEle3235->init_ScaleFactor(string(std::getenv("CMSSW_BASE"))+"/src/LeptonEfficiencies/Electron/Run2018/Electron_Run2018_Ele32orEle35.root"); @@ -485,33 +642,11 @@ int main(int argc, char** argv) { - // Change here to change the ID!! - /*// MVA Tight - if (l2_decayMode!=0 && l2_decayMode!=1 && l2_decayMode!=10) continue; - if (!againstElectronTightMVA6_2 or !againstMuonLoose3_2) continue; - float signalRegion=(byTightIsolationMVArun2v2DBoldDMwLT_2); - float antiisoRegion=(byVLooseIsolationMVArun2v2DBoldDMwLT_2 && !byTightIsolationMVArun2v2DBoldDMwLT_2);*/ - - // Deep Tight - /*if (!byTightDeepVSe_2 or !byVLooseDeepVSmu_2) continue; - float signalRegion=(byTightDeepVSjet_2); - float antiisoRegion=(byVVVLooseDeepVSjet_2 && !byTightDeepVSjet_2);*/ - // Deep Medium if (!byTightDeepVSe_2 or !byVLooseDeepVSmu_2) continue; float signalRegion=(byMediumDeepVSjet_2); float antiisoRegion=(byVVVLooseDeepVSjet_2 && !byMediumDeepVSjet_2); - /*// Deep VTight - if (!byTightDeepVSe_2 or !byVLooseDeepVSmu_2) continue; - float signalRegion=(byVTightDeepVSjet_2); - float antiisoRegion=(byVVVLooseDeepVSjet_2 && !byVTightDeepVSjet_2);*/ - - /*// Deep Loose - if (!byTightDeepVSe_2 or !byVLooseDeepVSmu_2) continue; - float signalRegion=(byLooseDeepVSjet_2); - float antiisoRegion=(byVVVLooseDeepVSjet_2 && !byLooseDeepVSjet_2);*/ - TLorentzVector mytau; mytau.SetPtEtaPhiM(pt_2,eta_2,phi_2,m_2); TLorentzVector myele; @@ -664,16 +799,30 @@ int main(int argc, char** argv) { //if (myvar>300) myvar=299; float ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_0jet); - if (njets>0) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet); + if (njets==1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet); + else if (njets>1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_2jet); float ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_0jet); - if (njets>0) ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_1jet); + if (njets==1) ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_1jet); + else if (njets>1) ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_2jet); float ff_w=get_raw_FF(mytau.Pt(),ff_w_0jet); - if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_w_1jet); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_w_1jet); + else if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_w_2jet); float ff_tt=get_raw_FF(mytau.Pt(),ff_tt_0jet); + if (apply_corrections=="yes"){ + ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_0jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcd0); + if (njets==1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcd1); + else if (njets>1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_2jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_qcd2); + ff_w=get_raw_FF(mytau.Pt(),ff_w_0jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_w0); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_w_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_w1); + else if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_w_2jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_w2); + ff_tt=get_raw_FF(mytau.Pt(),ff_tt_0jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_tt); + } + if (name=="WMC"){ ff_w=get_raw_FF(mytau.Pt(),ff_wmc_0jet); - if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet); + else if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_2jet); mt=100; } @@ -683,53 +832,172 @@ int main(int argc, char** argv) { if (name=="WMC2"){ ff_w=get_raw_FF(mytau.Pt(),ff_wmc_0jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_wmc); - if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_wmc); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_wmc); + else if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_2jet)*get_mvis_closure((myele+mytau).M(),mvisclosure_wmc); } if (!is_includedInEmbedded){ + // W MC if (signalRegion && iso_1<0.15 && nbtag==0 && q_1*q_2<0) hmt_w_iso->Fill(mt,aweight*weight2); if (antiisoRegion && iso_1<0.15 && nbtag==0 && q_1*q_2<0) hmt_w_anti->Fill(mt,aweight*weight2*ff_w); if (isL or isT){ - if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) - h0LT_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) - h0LT_qcd_anti->Fill(myvar,aweight*weight2*ff_qcd); + // QCD + if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0LT_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1LT_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2LT_qcd_mvis_iso->Fill(myvar,aweight*weight2); + h0LT_qcd_iso->Fill(myvar,aweight*weight2); + h0LT_qcd_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0LT_qcd_pth_iso->Fill((myele+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0LT_qcd_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0LT_qcd_cat0jetlow_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()>10) h0LT_qcd_cat0jethigh_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==1) h0LT_qcd_catboosted1_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0LT_qcd_catboosted2_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0LT_qcd_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0LT_qcd_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + } + if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0LT_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets==1) h1LT_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets>1) h2LT_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + h0LT_qcd_anti->Fill(myvar,aweight*weight2*ff_qcd); + h0LT_qcd_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_qcd); + if (njets>0) h0LT_qcd_pth_anti->Fill((myele+mymet+mytau).Pt(),aweight*weight2*ff_qcd); + if (njets>1) h0LT_qcd_mjj_anti->Fill(mjj,aweight*weight2*ff_qcd); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0LT_qcd_cat0jetlow_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_qcd); + if (njets==0 && (myele+mytau+mymet).Pt()>10) h0LT_qcd_cat0jethigh_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_qcd); + if (njets==1) h0LT_qcd_catboosted1_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj<350) h0LT_qcd_catboosted2_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0LT_qcd_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0LT_qcd_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + } + + // QCD loose if (signalRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2*ff_looseSSqcd); - if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + + // W + if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0LT_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1LT_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2LT_w_mvis_iso->Fill(myvar,aweight*weight2); h0LT_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h0LT_w_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0LT_w_pth_iso->Fill((myele+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0LT_w_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0LT_w_cat0jetlow_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()>10) h0LT_w_cat0jethigh_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==1) h0LT_w_catboosted1_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0LT_w_catboosted2_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0LT_w_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0LT_w_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + } + if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0LT_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets==1) h1LT_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets>1) h2LT_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); h0LT_w_anti->Fill(myvar,aweight*weight2*ff_w); - + h0LT_w_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_w); + if (njets>0) h0LT_w_pth_anti->Fill((myele+mymet+mytau).Pt(),aweight*weight2*ff_w); + if (njets>1) h0LT_w_mjj_anti->Fill(mjj,aweight*weight2*ff_w); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0LT_w_cat0jetlow_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_w); + if (njets==0 && (myele+mytau+mymet).Pt()>10) h0LT_w_cat0jethigh_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_w); + if (njets==1) h0LT_w_catboosted1_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj<350) h0LT_w_catboosted2_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0LT_w_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0LT_w_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + } + + // TT if (signalRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0LT_tt_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0LT_tt_anti->Fill(myvar,aweight*weight2*ff_tt); + } else{ - if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0J_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1J_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2J_qcd_mvis_iso->Fill(myvar,aweight*weight2); h0J_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h0J_qcd_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0J_qcd_pth_iso->Fill((myele+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0J_qcd_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0J_qcd_cat0jetlow_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()>200) h0J_qcd_cat0jethigh_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==1) h0J_qcd_catboosted1_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0J_qcd_catboosted2_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0J_qcd_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0J_qcd_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + + } + if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0J_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets==1) h1J_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets>1) h2J_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); h0J_qcd_anti->Fill(myvar,aweight*weight2*ff_qcd); - + h0J_qcd_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_qcd); + if (njets>0) h0J_qcd_pth_anti->Fill((myele+mymet+mytau).Pt(),aweight*weight2*ff_qcd); + if (njets>1) h0J_qcd_mjj_anti->Fill(mjj,aweight*weight2*ff_qcd); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0J_qcd_cat0jetlow_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_qcd); + if (njets==0 && (myele+mytau+mymet).Pt()>200) h0J_qcd_cat0jethigh_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_qcd); + if (njets==1) h0J_qcd_catboosted1_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj<350) h0J_qcd_catboosted2_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0J_qcd_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0J_qcd_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + } + + // QCD loose if (signalRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2*ff_looseSSqcd); - if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + // W + if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0J_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1J_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2J_w_mvis_iso->Fill(myvar,aweight*weight2); h0J_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h0J_w_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0J_w_pth_iso->Fill((myele+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0J_w_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0J_w_cat0jetlow_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==0 && (myele+mytau+mymet).Pt()>200) h0J_w_cat0jethigh_iso->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2); + if (njets==1) h0J_w_catboosted1_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0J_w_catboosted2_iso->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0J_w_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0J_w_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + + } + if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0J_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets==1) h1J_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets>1) h2J_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); h0J_w_anti->Fill(myvar,aweight*weight2*ff_w); - + h0J_w_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_w); + if (njets>0) h0J_w_pth_anti->Fill((myele+mymet+mytau).Pt(),aweight*weight2*ff_w); + if (njets>1) h0J_w_mjj_anti->Fill(mjj,aweight*weight2*ff_w); + if (njets==0 && (myele+mytau+mymet).Pt()<10) h0J_w_cat0jetlow_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_w); + if (njets==0 && (myele+mytau+mymet).Pt()>200) h0J_w_cat0jethigh_anti->Fill(mytau.Pt(),(myele+mytau).M(),aweight*weight2*ff_w); + if (njets==1) h0J_w_catboosted1_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj<350) h0J_w_catboosted2_anti->Fill((myele+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()<200) h0J_w_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (myele+mytau+mymet).Pt()>200) h0J_w_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + + } + + // TT if (signalRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0J_tt_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) @@ -745,6 +1013,87 @@ int main(int argc, char** argv) { TString postfixJ="J"; TString postfixLT="LT"; + TDirectory *d0_qcd_mvis_iso =fout->mkdir("et_0jet_qcd_mvis_iso"); + d0_qcd_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mvis_iso->SetName(name.c_str()); + h0LT_qcd_mvis_iso->Add(h0J_qcd_mvis_iso); + h0LT_qcd_mvis_iso->Write(); + } + else{ + h0LT_qcd_mvis_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_mvis_iso->Write(); + h0J_qcd_mvis_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_mvis_iso->Write(); + } + TDirectory *d0_qcd_mvis_anti =fout->mkdir("et_0jet_qcd_mvis_anti"); + d0_qcd_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mvis_anti->SetName(name.c_str()); + h0LT_qcd_mvis_anti->Add(h0J_qcd_mvis_anti); + h0LT_qcd_mvis_anti->Write(); + } + else{ + h0LT_qcd_mvis_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_mvis_anti->Write(); + h0J_qcd_mvis_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_mvis_anti->Write(); + } + + TDirectory *d1_qcd_mvis_iso =fout->mkdir("et_1jet_qcd_mvis_iso"); + d1_qcd_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_qcd_mvis_iso->SetName(name.c_str()); + h1LT_qcd_mvis_iso->Add(h1J_qcd_mvis_iso); + h1LT_qcd_mvis_iso->Write(); + } + else{ + h1LT_qcd_mvis_iso->SetName(name.c_str()+postfixLT); + h1LT_qcd_mvis_iso->Write(); + h1J_qcd_mvis_iso->SetName(name.c_str()+postfixJ); + h1J_qcd_mvis_iso->Write(); + } + TDirectory *d1_qcd_mvis_anti =fout->mkdir("et_1jet_qcd_mvis_anti"); + d1_qcd_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_qcd_mvis_anti->SetName(name.c_str()); + h1LT_qcd_mvis_anti->Add(h1J_qcd_mvis_anti); + h1LT_qcd_mvis_anti->Write(); + } + else{ + h1LT_qcd_mvis_anti->SetName(name.c_str()+postfixLT); + h1LT_qcd_mvis_anti->Write(); + h1J_qcd_mvis_anti->SetName(name.c_str()+postfixJ); + h1J_qcd_mvis_anti->Write(); + } + + TDirectory *d2_qcd_mvis_iso =fout->mkdir("et_2jet_qcd_mvis_iso"); + d2_qcd_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_mvis_iso->SetName(name.c_str()); + h2LT_qcd_mvis_iso->Add(h2J_qcd_mvis_iso); + h2LT_qcd_mvis_iso->Write(); + } + else{ + h2LT_qcd_mvis_iso->SetName(name.c_str()+postfixLT); + h2LT_qcd_mvis_iso->Write(); + h2J_qcd_mvis_iso->SetName(name.c_str()+postfixJ); + h2J_qcd_mvis_iso->Write(); + } + TDirectory *d2_qcd_mvis_anti =fout->mkdir("et_2jet_qcd_mvis_anti"); + d2_qcd_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_mvis_anti->SetName(name.c_str()); + h2LT_qcd_mvis_anti->Add(h2J_qcd_mvis_anti); + h2LT_qcd_mvis_anti->Write(); + } + else{ + h2LT_qcd_mvis_anti->SetName(name.c_str()+postfixLT); + h2LT_qcd_mvis_anti->Write(); + h2J_qcd_mvis_anti->SetName(name.c_str()+postfixJ); + h2J_qcd_mvis_anti->Write(); + } + TDirectory *d0_qcd_iso =fout->mkdir("et_0jet_qcd_iso"); d0_qcd_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -758,10 +1107,8 @@ int main(int argc, char** argv) { h0J_qcd_iso->SetName(name.c_str()+postfixJ); h0J_qcd_iso->Write(); } - TDirectory *d0_qcd_anti =fout->mkdir("et_0jet_qcd_anti"); d0_qcd_anti->cd(); - if (sample=="data_obs" or sample=="W"){ h0LT_qcd_anti->SetName(name.c_str()); h0LT_qcd_anti->Add(h0J_qcd_anti); @@ -774,6 +1121,249 @@ int main(int argc, char** argv) { h0J_qcd_anti->Write(); } + TDirectory *d0_qcd_taupt_iso =fout->mkdir("et_0jet_qcd_taupt_iso"); + d0_qcd_taupt_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_taupt_iso->SetName(name.c_str()); + h0LT_qcd_taupt_iso->Add(h0J_qcd_taupt_iso); + h0LT_qcd_taupt_iso->Write(); + } + else{ + h0LT_qcd_taupt_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_taupt_iso->Write(); + h0J_qcd_taupt_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_taupt_iso->Write(); + } + TDirectory *d0_qcd_taupt_anti =fout->mkdir("et_0jet_qcd_taupt_anti"); + d0_qcd_taupt_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_taupt_anti->SetName(name.c_str()); + h0LT_qcd_taupt_anti->Add(h0J_qcd_taupt_anti); + h0LT_qcd_taupt_anti->Write(); + } + else{ + h0LT_qcd_taupt_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_taupt_anti->Write(); + h0J_qcd_taupt_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_taupt_anti->Write(); + } + + TDirectory *d0_qcd_pth_iso =fout->mkdir("et_0jet_qcd_pth_iso"); + d0_qcd_pth_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_pth_iso->SetName(name.c_str()); + h0LT_qcd_pth_iso->Add(h0J_qcd_pth_iso); + h0LT_qcd_pth_iso->Write(); + } + else{ + h0LT_qcd_pth_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_pth_iso->Write(); + h0J_qcd_pth_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_pth_iso->Write(); + } + TDirectory *d0_qcd_pth_anti =fout->mkdir("et_0jet_qcd_pth_anti"); + d0_qcd_pth_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_pth_anti->SetName(name.c_str()); + h0LT_qcd_pth_anti->Add(h0J_qcd_pth_anti); + h0LT_qcd_pth_anti->Write(); + } + else{ + h0LT_qcd_pth_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_pth_anti->Write(); + h0J_qcd_pth_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_pth_anti->Write(); + } + + TDirectory *d0_qcd_mjj_iso =fout->mkdir("et_0jet_qcd_mjj_iso"); + d0_qcd_mjj_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mjj_iso->SetName(name.c_str()); + h0LT_qcd_mjj_iso->Add(h0J_qcd_mjj_iso); + h0LT_qcd_mjj_iso->Write(); + } + else{ + h0LT_qcd_mjj_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_mjj_iso->Write(); + h0J_qcd_mjj_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_mjj_iso->Write(); + } + TDirectory *d0_qcd_mjj_anti =fout->mkdir("et_0jet_qcd_mjj_anti"); + d0_qcd_mjj_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mjj_anti->SetName(name.c_str()); + h0LT_qcd_mjj_anti->Add(h0J_qcd_mjj_anti); + h0LT_qcd_mjj_anti->Write(); + } + else{ + h0LT_qcd_mjj_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_mjj_anti->Write(); + h0J_qcd_mjj_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_mjj_anti->Write(); + } + + TDirectory *d0_qcd_cat0jetlow_iso =fout->mkdir("et_0jet_qcd_cat0jetlow_iso"); + d0_qcd_cat0jetlow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jetlow_iso->SetName(name.c_str()); + h0LT_qcd_cat0jetlow_iso->Add(h0J_qcd_cat0jetlow_iso); + h0LT_qcd_cat0jetlow_iso->Write(); + } + else{ + h0LT_qcd_cat0jetlow_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jetlow_iso->Write(); + h0J_qcd_cat0jetlow_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jetlow_iso->Write(); + } + TDirectory *d0_qcd_cat0jetlow_anti =fout->mkdir("et_0jet_qcd_cat0jetlow_anti"); + d0_qcd_cat0jetlow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jetlow_anti->SetName(name.c_str()); + h0LT_qcd_cat0jetlow_anti->Add(h0J_qcd_cat0jetlow_anti); + h0LT_qcd_cat0jetlow_anti->Write(); + } + else{ + h0LT_qcd_cat0jetlow_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jetlow_anti->Write(); + h0J_qcd_cat0jetlow_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jetlow_anti->Write(); + } + + TDirectory *d0_qcd_cat0jethigh_iso =fout->mkdir("et_0jet_qcd_cat0jethigh_iso"); + d0_qcd_cat0jethigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jethigh_iso->SetName(name.c_str()); + h0LT_qcd_cat0jethigh_iso->Add(h0J_qcd_cat0jethigh_iso); + h0LT_qcd_cat0jethigh_iso->Write(); + } + else{ + h0LT_qcd_cat0jethigh_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jethigh_iso->Write(); + h0J_qcd_cat0jethigh_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jethigh_iso->Write(); + } + TDirectory *d0_qcd_cat0jethigh_anti =fout->mkdir("et_0jet_qcd_cat0jethigh_anti"); + d0_qcd_cat0jethigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jethigh_anti->SetName(name.c_str()); + h0LT_qcd_cat0jethigh_anti->Add(h0J_qcd_cat0jethigh_anti); + h0LT_qcd_cat0jethigh_anti->Write(); + } + else{ + h0LT_qcd_cat0jethigh_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jethigh_anti->Write(); + h0J_qcd_cat0jethigh_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jethigh_anti->Write(); + } + + TDirectory *d0_qcd_catboosted1_iso =fout->mkdir("et_0jet_qcd_catboosted1_iso"); + d0_qcd_catboosted1_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted1_iso->SetName(name.c_str()); + h0LT_qcd_catboosted1_iso->Add(h0J_qcd_catboosted1_iso); + h0LT_qcd_catboosted1_iso->Write(); + } + else{ + h0LT_qcd_catboosted1_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted1_iso->Write(); + h0J_qcd_catboosted1_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted1_iso->Write(); + } + TDirectory *d0_qcd_catboosted1_anti =fout->mkdir("et_0jet_qcd_catboosted1_anti"); + d0_qcd_catboosted1_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted1_anti->SetName(name.c_str()); + h0LT_qcd_catboosted1_anti->Add(h0J_qcd_catboosted1_anti); + h0LT_qcd_catboosted1_anti->Write(); + } + else{ + h0LT_qcd_catboosted1_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted1_anti->Write(); + h0J_qcd_catboosted1_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted1_anti->Write(); + } + + TDirectory *d0_qcd_catboosted2_iso =fout->mkdir("et_0jet_qcd_catboosted2_iso"); + d0_qcd_catboosted2_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted2_iso->SetName(name.c_str()); + h0LT_qcd_catboosted2_iso->Add(h0J_qcd_catboosted2_iso); + h0LT_qcd_catboosted2_iso->Write(); + } + else{ + h0LT_qcd_catboosted2_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted2_iso->Write(); + h0J_qcd_catboosted2_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted2_iso->Write(); + } + TDirectory *d0_qcd_catboosted2_anti =fout->mkdir("et_0jet_qcd_catboosted2_anti"); + d0_qcd_catboosted2_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted2_anti->SetName(name.c_str()); + h0LT_qcd_catboosted2_anti->Add(h0J_qcd_catboosted2_anti); + h0LT_qcd_catboosted2_anti->Write(); + } + else{ + h0LT_qcd_catboosted2_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted2_anti->Write(); + h0J_qcd_catboosted2_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted2_anti->Write(); + } + + TDirectory *d0_qcd_catvbflow_iso =fout->mkdir("et_0jet_qcd_catvbflow_iso"); + d0_qcd_catvbflow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbflow_iso->SetName(name.c_str()); + h0LT_qcd_catvbflow_iso->Add(h0J_qcd_catvbflow_iso); + h0LT_qcd_catvbflow_iso->Write(); + } + else{ + h0LT_qcd_catvbflow_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbflow_iso->Write(); + h0J_qcd_catvbflow_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbflow_iso->Write(); + } + TDirectory *d0_qcd_catvbflow_anti =fout->mkdir("et_0jet_qcd_catvbflow_anti"); + d0_qcd_catvbflow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbflow_anti->SetName(name.c_str()); + h0LT_qcd_catvbflow_anti->Add(h0J_qcd_catvbflow_anti); + h0LT_qcd_catvbflow_anti->Write(); + } + else{ + h0LT_qcd_catvbflow_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbflow_anti->Write(); + h0J_qcd_catvbflow_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbflow_anti->Write(); + } + + TDirectory *d0_qcd_catvbfhigh_iso =fout->mkdir("et_0jet_qcd_catvbfhigh_iso"); + d0_qcd_catvbfhigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbfhigh_iso->SetName(name.c_str()); + h0LT_qcd_catvbfhigh_iso->Add(h0J_qcd_catvbfhigh_iso); + h0LT_qcd_catvbfhigh_iso->Write(); + } + else{ + h0LT_qcd_catvbfhigh_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbfhigh_iso->Write(); + h0J_qcd_catvbfhigh_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbfhigh_iso->Write(); + } + TDirectory *d0_qcd_catvbfhigh_anti =fout->mkdir("et_0jet_qcd_catvbfhigh_anti"); + d0_qcd_catvbfhigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbfhigh_anti->SetName(name.c_str()); + h0LT_qcd_catvbfhigh_anti->Add(h0J_qcd_catvbfhigh_anti); + h0LT_qcd_catvbfhigh_anti->Write(); + } + else{ + h0LT_qcd_catvbfhigh_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbfhigh_anti->Write(); + h0J_qcd_catvbfhigh_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbfhigh_anti->Write(); + } + TDirectory *d0looseSS_qcd_iso =fout->mkdir("et_0SSloose_qcd_iso"); d0looseSS_qcd_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -802,6 +1392,89 @@ int main(int argc, char** argv) { h0SSlooseJ_qcd_anti->SetName(name.c_str()+postfixJ); h0SSlooseJ_qcd_anti->Write(); } + + TDirectory *d0_w_mvis_iso =fout->mkdir("et_0jet_w_mvis_iso"); + d0_w_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mvis_iso->SetName(name.c_str()); + h0LT_w_mvis_iso->Add(h0J_w_mvis_iso); + h0LT_w_mvis_iso->Write(); + } + else{ + h0LT_w_mvis_iso->SetName(name.c_str()+postfixLT); + h0LT_w_mvis_iso->Write(); + h0J_w_mvis_iso->SetName(name.c_str()+postfixJ); + h0J_w_mvis_iso->Write(); + } + TDirectory *d0_w_mvis_anti =fout->mkdir("et_0jet_w_mvis_anti"); + d0_w_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mvis_anti->SetName(name.c_str()); + h0LT_w_mvis_anti->Add(h0J_w_mvis_anti); + h0LT_w_mvis_anti->Write(); + } + else{ + h0LT_w_mvis_anti->SetName(name.c_str()+postfixLT); + h0LT_w_mvis_anti->Write(); + h0J_w_mvis_anti->SetName(name.c_str()+postfixJ); + h0J_w_mvis_anti->Write(); + } + + TDirectory *d1_w_mvis_iso =fout->mkdir("et_1jet_w_mvis_iso"); + d1_w_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_w_mvis_iso->SetName(name.c_str()); + h1LT_w_mvis_iso->Add(h1J_w_mvis_iso); + h1LT_w_mvis_iso->Write(); + } + else{ + h1LT_w_mvis_iso->SetName(name.c_str()+postfixLT); + h1LT_w_mvis_iso->Write(); + h1J_w_mvis_iso->SetName(name.c_str()+postfixJ); + h1J_w_mvis_iso->Write(); + } + TDirectory *d1_w_mvis_anti =fout->mkdir("et_1jet_w_mvis_anti"); + d1_w_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_w_mvis_anti->SetName(name.c_str()); + h1LT_w_mvis_anti->Add(h1J_w_mvis_anti); + h1LT_w_mvis_anti->Write(); + } + else{ + h1LT_w_mvis_anti->SetName(name.c_str()+postfixLT); + h1LT_w_mvis_anti->Write(); + h1J_w_mvis_anti->SetName(name.c_str()+postfixJ); + h1J_w_mvis_anti->Write(); + } + + TDirectory *d2_w_mvis_iso =fout->mkdir("et_2jet_w_mvis_iso"); + d2_w_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_mvis_iso->SetName(name.c_str()); + h2LT_w_mvis_iso->Add(h2J_w_mvis_iso); + h2LT_w_mvis_iso->Write(); + } + else{ + h2LT_w_mvis_iso->SetName(name.c_str()+postfixLT); + h2LT_w_mvis_iso->Write(); + h2J_w_mvis_iso->SetName(name.c_str()+postfixJ); + h2J_w_mvis_iso->Write(); + } + TDirectory *d2_w_mvis_anti =fout->mkdir("et_2jet_w_mvis_anti"); + d2_w_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_mvis_anti->SetName(name.c_str()); + h2LT_w_mvis_anti->Add(h2J_w_mvis_anti); + h2LT_w_mvis_anti->Write(); + } + else{ + h2LT_w_mvis_anti->SetName(name.c_str()+postfixLT); + h2LT_w_mvis_anti->Write(); + h2J_w_mvis_anti->SetName(name.c_str()+postfixJ); + h2J_w_mvis_anti->Write(); + } + + TDirectory *d0_w_iso =fout->mkdir("et_0jet_w_iso"); d0_w_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -815,7 +1488,6 @@ int main(int argc, char** argv) { h0J_w_iso->SetName(name.c_str()+postfixJ); h0J_w_iso->Write(); } - TDirectory *d0_w_anti =fout->mkdir("et_0jet_w_anti"); d0_w_anti->cd(); if (sample=="data_obs" or sample=="W"){ @@ -830,6 +1502,253 @@ int main(int argc, char** argv) { h0J_w_anti->Write(); } + + + + TDirectory *d0_w_taupt_iso =fout->mkdir("et_0jet_w_taupt_iso"); + d0_w_taupt_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_taupt_iso->SetName(name.c_str()); + h0LT_w_taupt_iso->Add(h0J_w_taupt_iso); + h0LT_w_taupt_iso->Write(); + } + else{ + h0LT_w_taupt_iso->SetName(name.c_str()+postfixLT); + h0LT_w_taupt_iso->Write(); + h0J_w_taupt_iso->SetName(name.c_str()+postfixJ); + h0J_w_taupt_iso->Write(); + } + TDirectory *d0_w_taupt_anti =fout->mkdir("et_0jet_w_taupt_anti"); + d0_w_taupt_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_taupt_anti->SetName(name.c_str()); + h0LT_w_taupt_anti->Add(h0J_w_taupt_anti); + h0LT_w_taupt_anti->Write(); + } + else{ + h0LT_w_taupt_anti->SetName(name.c_str()+postfixLT); + h0LT_w_taupt_anti->Write(); + h0J_w_taupt_anti->SetName(name.c_str()+postfixJ); + h0J_w_taupt_anti->Write(); + } + + TDirectory *d0_w_pth_iso =fout->mkdir("et_0jet_w_pth_iso"); + d0_w_pth_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_pth_iso->SetName(name.c_str()); + h0LT_w_pth_iso->Add(h0J_w_pth_iso); + h0LT_w_pth_iso->Write(); + } + else{ + h0LT_w_pth_iso->SetName(name.c_str()+postfixLT); + h0LT_w_pth_iso->Write(); + h0J_w_pth_iso->SetName(name.c_str()+postfixJ); + h0J_w_pth_iso->Write(); + } + TDirectory *d0_w_pth_anti =fout->mkdir("et_0jet_w_pth_anti"); + d0_w_pth_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_pth_anti->SetName(name.c_str()); + h0LT_w_pth_anti->Add(h0J_w_pth_anti); + h0LT_w_pth_anti->Write(); + } + else{ + h0LT_w_pth_anti->SetName(name.c_str()+postfixLT); + h0LT_w_pth_anti->Write(); + h0J_w_pth_anti->SetName(name.c_str()+postfixJ); + h0J_w_pth_anti->Write(); + } + + TDirectory *d0_w_mjj_iso =fout->mkdir("et_0jet_w_mjj_iso"); + d0_w_mjj_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mjj_iso->SetName(name.c_str()); + h0LT_w_mjj_iso->Add(h0J_w_mjj_iso); + h0LT_w_mjj_iso->Write(); + } + else{ + h0LT_w_mjj_iso->SetName(name.c_str()+postfixLT); + h0LT_w_mjj_iso->Write(); + h0J_w_mjj_iso->SetName(name.c_str()+postfixJ); + h0J_w_mjj_iso->Write(); + } + TDirectory *d0_w_mjj_anti =fout->mkdir("et_0jet_w_mjj_anti"); + d0_w_mjj_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mjj_anti->SetName(name.c_str()); + h0LT_w_mjj_anti->Add(h0J_w_mjj_anti); + h0LT_w_mjj_anti->Write(); + } + else{ + h0LT_w_mjj_anti->SetName(name.c_str()+postfixLT); + h0LT_w_mjj_anti->Write(); + h0J_w_mjj_anti->SetName(name.c_str()+postfixJ); + h0J_w_mjj_anti->Write(); + } + + TDirectory *d0_w_cat0jetlow_iso =fout->mkdir("et_0jet_w_cat0jetlow_iso"); + d0_w_cat0jetlow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jetlow_iso->SetName(name.c_str()); + h0LT_w_cat0jetlow_iso->Add(h0J_w_cat0jetlow_iso); + h0LT_w_cat0jetlow_iso->Write(); + } + else{ + h0LT_w_cat0jetlow_iso->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jetlow_iso->Write(); + h0J_w_cat0jetlow_iso->SetName(name.c_str()+postfixJ); + h0J_w_cat0jetlow_iso->Write(); + } + TDirectory *d0_w_cat0jetlow_anti =fout->mkdir("et_0jet_w_cat0jetlow_anti"); + d0_w_cat0jetlow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jetlow_anti->SetName(name.c_str()); + h0LT_w_cat0jetlow_anti->Add(h0J_w_cat0jetlow_anti); + h0LT_w_cat0jetlow_anti->Write(); + } + else{ + h0LT_w_cat0jetlow_anti->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jetlow_anti->Write(); + h0J_w_cat0jetlow_anti->SetName(name.c_str()+postfixJ); + h0J_w_cat0jetlow_anti->Write(); + } + + TDirectory *d0_w_cat0jethigh_iso =fout->mkdir("et_0jet_w_cat0jethigh_iso"); + d0_w_cat0jethigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jethigh_iso->SetName(name.c_str()); + h0LT_w_cat0jethigh_iso->Add(h0J_w_cat0jethigh_iso); + h0LT_w_cat0jethigh_iso->Write(); + } + else{ + h0LT_w_cat0jethigh_iso->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jethigh_iso->Write(); + h0J_w_cat0jethigh_iso->SetName(name.c_str()+postfixJ); + h0J_w_cat0jethigh_iso->Write(); + } + TDirectory *d0_w_cat0jethigh_anti =fout->mkdir("et_0jet_w_cat0jethigh_anti"); + d0_w_cat0jethigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jethigh_anti->SetName(name.c_str()); + h0LT_w_cat0jethigh_anti->Add(h0J_w_cat0jethigh_anti); + h0LT_w_cat0jethigh_anti->Write(); + } + else{ + h0LT_w_cat0jethigh_anti->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jethigh_anti->Write(); + h0J_w_cat0jethigh_anti->SetName(name.c_str()+postfixJ); + h0J_w_cat0jethigh_anti->Write(); + } + + TDirectory *d0_w_catboosted1_iso =fout->mkdir("et_0jet_w_catboosted1_iso"); + d0_w_catboosted1_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted1_iso->SetName(name.c_str()); + h0LT_w_catboosted1_iso->Add(h0J_w_catboosted1_iso); + h0LT_w_catboosted1_iso->Write(); + } + else{ + h0LT_w_catboosted1_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted1_iso->Write(); + h0J_w_catboosted1_iso->SetName(name.c_str()+postfixJ); + h0J_w_catboosted1_iso->Write(); + } + TDirectory *d0_w_catboosted1_anti =fout->mkdir("et_0jet_w_catboosted1_anti"); + d0_w_catboosted1_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted1_anti->SetName(name.c_str()); + h0LT_w_catboosted1_anti->Add(h0J_w_catboosted1_anti); + h0LT_w_catboosted1_anti->Write(); + } + else{ + h0LT_w_catboosted1_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted1_anti->Write(); + h0J_w_catboosted1_anti->SetName(name.c_str()+postfixJ); + h0J_w_catboosted1_anti->Write(); + } + + TDirectory *d0_w_catboosted2_iso =fout->mkdir("et_0jet_w_catboosted2_iso"); + d0_w_catboosted2_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted2_iso->SetName(name.c_str()); + h0LT_w_catboosted2_iso->Add(h0J_w_catboosted2_iso); + h0LT_w_catboosted2_iso->Write(); + } + else{ + h0LT_w_catboosted2_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted2_iso->Write(); + h0J_w_catboosted2_iso->SetName(name.c_str()+postfixJ); + h0J_w_catboosted2_iso->Write(); + } + TDirectory *d0_w_catboosted2_anti =fout->mkdir("et_0jet_w_catboosted2_anti"); + d0_w_catboosted2_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted2_anti->SetName(name.c_str()); + h0LT_w_catboosted2_anti->Add(h0J_w_catboosted2_anti); + h0LT_w_catboosted2_anti->Write(); + } + else{ + h0LT_w_catboosted2_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted2_anti->Write(); + h0J_w_catboosted2_anti->SetName(name.c_str()+postfixJ); + h0J_w_catboosted2_anti->Write(); + } + + TDirectory *d0_w_catvbflow_iso =fout->mkdir("et_0jet_w_catvbflow_iso"); + d0_w_catvbflow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbflow_iso->SetName(name.c_str()); + h0LT_w_catvbflow_iso->Add(h0J_w_catvbflow_iso); + h0LT_w_catvbflow_iso->Write(); + } + else{ + h0LT_w_catvbflow_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catvbflow_iso->Write(); + h0J_w_catvbflow_iso->SetName(name.c_str()+postfixJ); + h0J_w_catvbflow_iso->Write(); + } + TDirectory *d0_w_catvbflow_anti =fout->mkdir("et_0jet_w_catvbflow_anti"); + d0_w_catvbflow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbflow_anti->SetName(name.c_str()); + h0LT_w_catvbflow_anti->Add(h0J_w_catvbflow_anti); + h0LT_w_catvbflow_anti->Write(); + } + else{ + h0LT_w_catvbflow_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catvbflow_anti->Write(); + h0J_w_catvbflow_anti->SetName(name.c_str()+postfixJ); + h0J_w_catvbflow_anti->Write(); + } + + TDirectory *d0_w_catvbfhigh_iso =fout->mkdir("et_0jet_w_catvbfhigh_iso"); + d0_w_catvbfhigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbfhigh_iso->SetName(name.c_str()); + h0LT_w_catvbfhigh_iso->Add(h0J_w_catvbfhigh_iso); + h0LT_w_catvbfhigh_iso->Write(); + } + else{ + h0LT_w_catvbfhigh_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catvbfhigh_iso->Write(); + h0J_w_catvbfhigh_iso->SetName(name.c_str()+postfixJ); + h0J_w_catvbfhigh_iso->Write(); + } + TDirectory *d0_w_catvbfhigh_anti =fout->mkdir("et_0jet_w_catvbfhigh_anti"); + d0_w_catvbfhigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbfhigh_anti->SetName(name.c_str()); + h0LT_w_catvbfhigh_anti->Add(h0J_w_catvbfhigh_anti); + h0LT_w_catvbfhigh_anti->Write(); + } + else{ + h0LT_w_catvbfhigh_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catvbfhigh_anti->Write(); + h0J_w_catvbfhigh_anti->SetName(name.c_str()+postfixJ); + h0J_w_catvbfhigh_anti->Write(); + } + + TDirectory *dmt_w_iso =fout->mkdir("et_mt_w_iso"); dmt_w_iso->cd(); hmt_w_iso->SetName(name.c_str()); diff --git a/FFcode/bin/Set1_correction_mt.cc b/FFcode/bin/Set1_correction_mt.cc index 03d803d..4ca1106 100644 --- a/FFcode/bin/Set1_correction_mt.cc +++ b/FFcode/bin/Set1_correction_mt.cc @@ -45,6 +45,7 @@ int main(int argc, char** argv) { std::string sample = *(argv + 3); std::string name = *(argv + 4); std::string year = *(argv + 5); + std::string apply_corrections = *(argv + 6); TFile *f_Double = new TFile(input.c_str()); cout<<"XXXXXXXXXXXXX "<Sumw2(); + TH1F* h0LT_qcd_mvis_anti = new TH1F ("h0LT_qcd_mvis_anti","h0LT_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h0LT_qcd_mvis_anti->Sumw2(); + TH1F* h0LT_w_mvis_iso = new TH1F ("h0LT_w_mvis_iso","h0LT_w_mvis_iso",binnum_mtt0,bins_mtt0); h0LT_w_mvis_iso->Sumw2(); + TH1F* h0LT_w_mvis_anti = new TH1F ("h0LT_w_mvis_anti","h0LT_w_mvis_anti",binnum_mtt0,bins_mtt0); h0LT_w_mvis_anti->Sumw2(); + TH1F* h0J_qcd_mvis_iso = new TH1F ("h0J_qcd_mvis_iso","h0J_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h0J_qcd_mvis_iso->Sumw2(); + TH1F* h0J_qcd_mvis_anti = new TH1F ("h0J_qcd_mvis_anti","h0J_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h0J_qcd_mvis_anti->Sumw2(); + TH1F* h0J_w_mvis_iso = new TH1F ("h0J_w_mvis_iso","h0J_w_mvis_iso",binnum_mtt0,bins_mtt0); h0J_w_mvis_iso->Sumw2(); + TH1F* h0J_w_mvis_anti = new TH1F ("h0J_w_mvis_anti","h0J_w_mvis_anti",binnum_mtt0,bins_mtt0); h0J_w_mvis_anti->Sumw2(); + + TH1F* h1LT_qcd_mvis_iso = new TH1F ("h1LT_qcd_mvis_iso","h1LT_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h1LT_qcd_mvis_iso->Sumw2(); + TH1F* h1LT_qcd_mvis_anti = new TH1F ("h1LT_qcd_mvis_anti","h1LT_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h1LT_qcd_mvis_anti->Sumw2(); + TH1F* h1LT_w_mvis_iso = new TH1F ("h1LT_w_mvis_iso","h1LT_w_mvis_iso",binnum_mtt0,bins_mtt0); h1LT_w_mvis_iso->Sumw2(); + TH1F* h1LT_w_mvis_anti = new TH1F ("h1LT_w_mvis_anti","h1LT_w_mvis_anti",binnum_mtt0,bins_mtt0); h1LT_w_mvis_anti->Sumw2(); + TH1F* h1J_qcd_mvis_iso = new TH1F ("h1J_qcd_mvis_iso","h1J_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h1J_qcd_mvis_iso->Sumw2(); + TH1F* h1J_qcd_mvis_anti = new TH1F ("h1J_qcd_mvis_anti","h1J_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h1J_qcd_mvis_anti->Sumw2(); + TH1F* h1J_w_mvis_iso = new TH1F ("h1J_w_mvis_iso","h1J_w_mvis_iso",binnum_mtt0,bins_mtt0); h1J_w_mvis_iso->Sumw2(); + TH1F* h1J_w_mvis_anti = new TH1F ("h1J_w_mvis_anti","h1J_w_mvis_anti",binnum_mtt0,bins_mtt0); h1J_w_mvis_anti->Sumw2(); + + TH1F* h2LT_qcd_mvis_iso = new TH1F ("h2LT_qcd_mvis_iso","h2LT_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h2LT_qcd_mvis_iso->Sumw2(); + TH1F* h2LT_qcd_mvis_anti = new TH1F ("h2LT_qcd_mvis_anti","h2LT_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h2LT_qcd_mvis_anti->Sumw2(); + TH1F* h2LT_w_mvis_iso = new TH1F ("h2LT_w_mvis_iso","h2LT_w_mvis_iso",binnum_mtt0,bins_mtt0); h2LT_w_mvis_iso->Sumw2(); + TH1F* h2LT_w_mvis_anti = new TH1F ("h2LT_w_mvis_anti","h2LT_w_mvis_anti",binnum_mtt0,bins_mtt0); h2LT_w_mvis_anti->Sumw2(); + TH1F* h2J_qcd_mvis_iso = new TH1F ("h2J_qcd_mvis_iso","h2J_qcd_mvis_iso",binnum_mtt0,bins_mtt0); h2J_qcd_mvis_iso->Sumw2(); + TH1F* h2J_qcd_mvis_anti = new TH1F ("h2J_qcd_mvis_anti","h2J_qcd_mvis_anti",binnum_mtt0,bins_mtt0); h2J_qcd_mvis_anti->Sumw2(); + TH1F* h2J_w_mvis_iso = new TH1F ("h2J_w_mvis_iso","h2J_w_mvis_iso",binnum_mtt0,bins_mtt0); h2J_w_mvis_iso->Sumw2(); + TH1F* h2J_w_mvis_anti = new TH1F ("h2J_w_mvis_anti","h2J_w_mvis_anti",binnum_mtt0,bins_mtt0); h2J_w_mvis_anti->Sumw2(); + TH1F* h0LT_qcd_iso = new TH1F ("h0LT_qcd_iso","h0LT_qcd_iso",binnum_mtt0,bins_mtt0); h0LT_qcd_iso->Sumw2(); TH1F* h0LT_qcd_anti = new TH1F ("h0LT_qcd_anti","h0LT_qcd_anti",binnum_mtt0,bins_mtt0); h0LT_qcd_anti->Sumw2(); + TH1F* h0LT_qcd_taupt_iso = new TH1F ("h0LT_qcd_taupt_iso","h0LT_qcd_taupt_iso",binnum_taupt0,bins_taupt0); h0LT_qcd_taupt_iso->Sumw2(); + TH1F* h0LT_qcd_taupt_anti = new TH1F ("h0LT_qcd_taupt_anti","h0LT_qcd_taupt_anti",binnum_taupt0,bins_taupt0); h0LT_qcd_taupt_anti->Sumw2(); + TH1F* h0LT_qcd_pth_iso = new TH1F ("h0LT_qcd_pth_iso","h0LT_qcd_pth_iso",binnum_pth0,bins_pth0); h0LT_qcd_pth_iso->Sumw2(); + TH1F* h0LT_qcd_pth_anti = new TH1F ("h0LT_qcd_pth_anti","h0LT_qcd_pth_anti",binnum_pth0,bins_pth0); h0LT_qcd_pth_anti->Sumw2(); + TH1F* h0LT_qcd_mjj_iso = new TH1F ("h0LT_qcd_mjj_iso","h0LT_qcd_mjj_iso",binnum_mjj0,bins_mjj0); h0LT_qcd_mjj_iso->Sumw2(); + TH1F* h0LT_qcd_mjj_anti = new TH1F ("h0LT_qcd_mjj_anti","h0LT_qcd_mjj_anti",binnum_mjj0,bins_mjj0); h0LT_qcd_mjj_anti->Sumw2(); TH1F* h0SSlooseLT_qcd_iso = new TH1F ("h0SSlooseLT_qcd_iso","h0SSlooseLT_qcd_iso",binnum_mtt0,bins_mtt0); h0SSlooseLT_qcd_iso->Sumw2(); TH1F* h0SSlooseLT_qcd_anti = new TH1F ("h0SSlooseLT_qcd_anti","h0SSlooseLT_qcd_anti",binnum_mtt0,bins_mtt0); h0SSlooseLT_qcd_anti->Sumw2(); TH1F* h0LT_w_iso = new TH1F ("h0LT_w_iso","h0LT_w_iso",binnum_mtt0,bins_mtt0); h0LT_w_iso->Sumw2(); TH1F* h0LT_w_anti = new TH1F ("h0LT_w_anti","h0LT_w_anti",binnum_mtt0,bins_mtt0); h0LT_w_anti->Sumw2(); + TH1F* h0LT_w_taupt_iso = new TH1F ("h0LT_w_taupt_iso","h0LT_w_taupt_iso",binnum_taupt0,bins_taupt0); h0LT_w_taupt_iso->Sumw2(); + TH1F* h0LT_w_taupt_anti = new TH1F ("h0LT_w_taupt_anti","h0LT_w_taupt_anti",binnum_taupt0,bins_taupt0); h0LT_w_taupt_anti->Sumw2(); + TH1F* h0LT_w_pth_iso = new TH1F ("h0LT_w_pth_iso","h0LT_w_pth_iso",binnum_pth0,bins_pth0); h0LT_w_pth_iso->Sumw2(); + TH1F* h0LT_w_pth_anti = new TH1F ("h0LT_w_pth_anti","h0LT_w_pth_anti",binnum_pth0,bins_pth0); h0LT_w_pth_anti->Sumw2(); + TH1F* h0LT_w_mjj_iso = new TH1F ("h0LT_w_mjj_iso","h0LT_w_mjj_iso",binnum_mjj0,bins_mjj0); h0LT_w_mjj_iso->Sumw2(); + TH1F* h0LT_w_mjj_anti = new TH1F ("h0LT_w_mjj_anti","h0LT_w_mjj_anti",binnum_mjj0,bins_mjj0); h0LT_w_mjj_anti->Sumw2(); TH1F* h0LT_tt_iso = new TH1F ("h0LT_tt_iso","h0LT_tt_iso",binnum_mtt0,bins_mtt0); h0LT_tt_iso->Sumw2(); TH1F* h0LT_tt_anti = new TH1F ("h0LT_tt_anti","h0LT_tt_anti",binnum_mtt0,bins_mtt0); h0LT_tt_anti->Sumw2(); TH1F* h0J_qcd_iso = new TH1F ("h0J_qcd_iso","h0J_qcd_iso",binnum_mtt0,bins_mtt0); h0J_qcd_iso->Sumw2(); TH1F* h0J_qcd_anti = new TH1F ("h0J_qcd_anti","h0J_qcd_anti",binnum_mtt0,bins_mtt0); h0J_qcd_anti->Sumw2(); + TH1F* h0J_qcd_taupt_iso = new TH1F ("h0J_qcd_taupt_iso","h0J_qcd_taupt_iso",binnum_taupt0,bins_taupt0); h0J_qcd_taupt_iso->Sumw2(); + TH1F* h0J_qcd_taupt_anti = new TH1F ("h0J_qcd_taupt_anti","h0J_qcd_taupt_anti",binnum_taupt0,bins_taupt0); h0J_qcd_taupt_anti->Sumw2(); + TH1F* h0J_qcd_pth_iso = new TH1F ("h0J_qcd_pth_iso","h0J_qcd_pth_iso",binnum_pth0,bins_pth0); h0J_qcd_pth_iso->Sumw2(); + TH1F* h0J_qcd_pth_anti = new TH1F ("h0J_qcd_pth_anti","h0J_qcd_pth_anti",binnum_pth0,bins_pth0); h0J_qcd_pth_anti->Sumw2(); + TH1F* h0J_qcd_mjj_iso = new TH1F ("h0J_qcd_mjj_iso","h0J_qcd_mjj_iso",binnum_mjj0,bins_mjj0); h0J_qcd_mjj_iso->Sumw2(); + TH1F* h0J_qcd_mjj_anti = new TH1F ("h0J_qcd_mjj_anti","h0J_qcd_mjj_anti",binnum_mjj0,bins_mjj0); h0J_qcd_mjj_anti->Sumw2(); TH1F* h0SSlooseJ_qcd_iso = new TH1F ("h0SSlooseJ_qcd_iso","h0SSlooseJ_qcd_iso",binnum_mtt0,bins_mtt0); h0SSlooseJ_qcd_iso->Sumw2(); TH1F* h0SSlooseJ_qcd_anti = new TH1F ("h0SSlooseJ_qcd_anti","h0SSlooseJ_qcd_anti",binnum_mtt0,bins_mtt0); h0SSlooseJ_qcd_anti->Sumw2(); TH1F* h0J_w_iso = new TH1F ("h0J_w_iso","h0J_w_iso",binnum_mtt0,bins_mtt0); h0J_w_iso->Sumw2(); TH1F* h0J_w_anti = new TH1F ("h0J_w_anti","h0J_w_anti",binnum_mtt0,bins_mtt0); h0J_w_anti->Sumw2(); + TH1F* h0J_w_taupt_iso = new TH1F ("h0J_w_taupt_iso","h0J_w_taupt_iso",binnum_taupt0,bins_taupt0); h0J_w_taupt_iso->Sumw2(); + TH1F* h0J_w_taupt_anti = new TH1F ("h0J_w_taupt_anti","h0J_w_taupt_anti",binnum_taupt0,bins_taupt0); h0J_w_taupt_anti->Sumw2(); + TH1F* h0J_w_pth_iso = new TH1F ("h0J_w_pth_iso","h0J_w_pth_iso",binnum_pth0,bins_pth0); h0J_w_pth_iso->Sumw2(); + TH1F* h0J_w_pth_anti = new TH1F ("h0J_w_pth_anti","h0J_w_pth_anti",binnum_pth0,bins_pth0); h0J_w_pth_anti->Sumw2(); + TH1F* h0J_w_mjj_iso = new TH1F ("h0J_w_mjj_iso","h0J_w_mjj_iso",binnum_mjj0,bins_mjj0); h0J_w_mjj_iso->Sumw2(); + TH1F* h0J_w_mjj_anti = new TH1F ("h0J_w_mjj_anti","h0J_w_mjj_anti",binnum_mjj0,bins_mjj0); h0J_w_mjj_anti->Sumw2(); TH1F* h0J_tt_iso = new TH1F ("h0J_tt_iso","h0J_tt_iso",binnum_mtt0,bins_mtt0); h0J_tt_iso->Sumw2(); TH1F* h0J_tt_anti = new TH1F ("h0J_tt_anti","h0J_tt_anti",binnum_mtt0,bins_mtt0); h0J_tt_anti->Sumw2(); TH1F* hmt_w_iso = new TH1F ("hmt_w_iso","hmt_w_iso",binnum_mt,bins_mt); hmt_w_iso->Sumw2(); TH1F* hmt_w_anti = new TH1F ("hmt_w_anti","hmt_w_anti",binnum_mt,bins_mt); hmt_w_anti->Sumw2(); + + TH2F* h0LT_qcd_cat0jetlow_iso = new TH2F ("h0LT_qcd_cat0jetlow_iso","h0LT_qcd_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_qcd_cat0jetlow_iso->Sumw2(); + TH2F* h0LT_qcd_cat0jetlow_anti = new TH2F ("h0LT_qcd_cat0jetlow_anti","h0LT_qcd_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_qcd_cat0jetlow_anti->Sumw2(); + TH2F* h0LT_w_cat0jetlow_iso = new TH2F ("h0LT_w_cat0jetlow_iso","h0LT_w_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_w_cat0jetlow_iso->Sumw2(); + TH2F* h0LT_w_cat0jetlow_anti = new TH2F ("h0LT_w_cat0jetlow_anti","h0LT_w_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0LT_w_cat0jetlow_anti->Sumw2(); + TH2F* h0J_qcd_cat0jetlow_iso = new TH2F ("h0J_qcd_cat0jetlow_iso","h0J_qcd_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_qcd_cat0jetlow_iso->Sumw2(); + TH2F* h0J_qcd_cat0jetlow_anti = new TH2F ("h0J_qcd_cat0jetlow_anti","h0J_qcd_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_qcd_cat0jetlow_anti->Sumw2(); + TH2F* h0J_w_cat0jetlow_iso = new TH2F ("h0J_w_cat0jetlow_iso","h0J_w_cat0jetlow_iso",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_w_cat0jetlow_iso->Sumw2(); + TH2F* h0J_w_cat0jetlow_anti = new TH2F ("h0J_w_cat0jetlow_anti","h0J_w_cat0jetlow_anti",binnum_cat0jetlow0,bins_cat0jetlow0,binnum_cat0jetlow1,bins_cat0jetlow1); h0J_w_cat0jetlow_anti->Sumw2(); + + TH2F* h0LT_qcd_cat0jethigh_iso = new TH2F ("h0LT_qcd_cat0jethigh_iso","h0LT_qcd_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_qcd_cat0jethigh_iso->Sumw2(); + TH2F* h0LT_qcd_cat0jethigh_anti = new TH2F ("h0LT_qcd_cat0jethigh_anti","h0LT_qcd_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_qcd_cat0jethigh_anti->Sumw2(); + TH2F* h0LT_w_cat0jethigh_iso = new TH2F ("h0LT_w_cat0jethigh_iso","h0LT_w_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_w_cat0jethigh_iso->Sumw2(); + TH2F* h0LT_w_cat0jethigh_anti = new TH2F ("h0LT_w_cat0jethigh_anti","h0LT_w_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0LT_w_cat0jethigh_anti->Sumw2(); + TH2F* h0J_qcd_cat0jethigh_iso = new TH2F ("h0J_qcd_cat0jethigh_iso","h0J_qcd_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_qcd_cat0jethigh_iso->Sumw2(); + TH2F* h0J_qcd_cat0jethigh_anti = new TH2F ("h0J_qcd_cat0jethigh_anti","h0J_qcd_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_qcd_cat0jethigh_anti->Sumw2(); + TH2F* h0J_w_cat0jethigh_iso = new TH2F ("h0J_w_cat0jethigh_iso","h0J_w_cat0jethigh_iso",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_w_cat0jethigh_iso->Sumw2(); + TH2F* h0J_w_cat0jethigh_anti = new TH2F ("h0J_w_cat0jethigh_anti","h0J_w_cat0jethigh_anti",binnum_cat0jethigh0,bins_cat0jethigh0,binnum_cat0jethigh1,bins_cat0jethigh1); h0J_w_cat0jethigh_anti->Sumw2(); + + TH2F* h0LT_qcd_catboosted1_iso = new TH2F ("h0LT_qcd_catboosted1_iso","h0LT_qcd_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_qcd_catboosted1_iso->Sumw2(); + TH2F* h0LT_qcd_catboosted1_anti = new TH2F ("h0LT_qcd_catboosted1_anti","h0LT_qcd_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_qcd_catboosted1_anti->Sumw2(); + TH2F* h0LT_w_catboosted1_iso = new TH2F ("h0LT_w_catboosted1_iso","h0LT_w_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_w_catboosted1_iso->Sumw2(); + TH2F* h0LT_w_catboosted1_anti = new TH2F ("h0LT_w_catboosted1_anti","h0LT_w_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0LT_w_catboosted1_anti->Sumw2(); + TH2F* h0J_qcd_catboosted1_iso = new TH2F ("h0J_qcd_catboosted1_iso","h0J_qcd_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_qcd_catboosted1_iso->Sumw2(); + TH2F* h0J_qcd_catboosted1_anti = new TH2F ("h0J_qcd_catboosted1_anti","h0J_qcd_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_qcd_catboosted1_anti->Sumw2(); + TH2F* h0J_w_catboosted1_iso = new TH2F ("h0J_w_catboosted1_iso","h0J_w_catboosted1_iso",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_w_catboosted1_iso->Sumw2(); + TH2F* h0J_w_catboosted1_anti = new TH2F ("h0J_w_catboosted1_anti","h0J_w_catboosted1_anti",binnum_catboosted10,bins_catboosted10,binnum_catboosted11,bins_catboosted11); h0J_w_catboosted1_anti->Sumw2(); + + TH2F* h0LT_qcd_catboosted2_iso = new TH2F ("h0LT_qcd_catboosted2_iso","h0LT_qcd_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_qcd_catboosted2_iso->Sumw2(); + TH2F* h0LT_qcd_catboosted2_anti = new TH2F ("h0LT_qcd_catboosted2_anti","h0LT_qcd_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_qcd_catboosted2_anti->Sumw2(); + TH2F* h0LT_w_catboosted2_iso = new TH2F ("h0LT_w_catboosted2_iso","h0LT_w_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_w_catboosted2_iso->Sumw2(); + TH2F* h0LT_w_catboosted2_anti = new TH2F ("h0LT_w_catboosted2_anti","h0LT_w_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0LT_w_catboosted2_anti->Sumw2(); + TH2F* h0J_qcd_catboosted2_iso = new TH2F ("h0J_qcd_catboosted2_iso","h0J_qcd_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_qcd_catboosted2_iso->Sumw2(); + TH2F* h0J_qcd_catboosted2_anti = new TH2F ("h0J_qcd_catboosted2_anti","h0J_qcd_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_qcd_catboosted2_anti->Sumw2(); + TH2F* h0J_w_catboosted2_iso = new TH2F ("h0J_w_catboosted2_iso","h0J_w_catboosted2_iso",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_w_catboosted2_iso->Sumw2(); + TH2F* h0J_w_catboosted2_anti = new TH2F ("h0J_w_catboosted2_anti","h0J_w_catboosted2_anti",binnum_catboosted20,bins_catboosted20,binnum_catboosted21,bins_catboosted21); h0J_w_catboosted2_anti->Sumw2(); + + TH2F* h0LT_qcd_catvbflow_iso = new TH2F ("h0LT_qcd_catvbflow_iso","h0LT_qcd_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_qcd_catvbflow_iso->Sumw2(); + TH2F* h0LT_qcd_catvbflow_anti = new TH2F ("h0LT_qcd_catvbflow_anti","h0LT_qcd_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_qcd_catvbflow_anti->Sumw2(); + TH2F* h0LT_w_catvbflow_iso = new TH2F ("h0LT_w_catvbflow_iso","h0LT_w_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_w_catvbflow_iso->Sumw2(); + TH2F* h0LT_w_catvbflow_anti = new TH2F ("h0LT_w_catvbflow_anti","h0LT_w_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0LT_w_catvbflow_anti->Sumw2(); + TH2F* h0J_qcd_catvbflow_iso = new TH2F ("h0J_qcd_catvbflow_iso","h0J_qcd_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_qcd_catvbflow_iso->Sumw2(); + TH2F* h0J_qcd_catvbflow_anti = new TH2F ("h0J_qcd_catvbflow_anti","h0J_qcd_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_qcd_catvbflow_anti->Sumw2(); + TH2F* h0J_w_catvbflow_iso = new TH2F ("h0J_w_catvbflow_iso","h0J_w_catvbflow_iso",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_w_catvbflow_iso->Sumw2(); + TH2F* h0J_w_catvbflow_anti = new TH2F ("h0J_w_catvbflow_anti","h0J_w_catvbflow_anti",binnum_catvbflow0,bins_catvbflow0,binnum_catvbflow1,bins_catvbflow1); h0J_w_catvbflow_anti->Sumw2(); + + TH2F* h0LT_qcd_catvbfhigh_iso = new TH2F ("h0LT_qcd_catvbfhigh_iso","h0LT_qcd_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_qcd_catvbfhigh_iso->Sumw2(); + TH2F* h0LT_qcd_catvbfhigh_anti = new TH2F ("h0LT_qcd_catvbfhigh_anti","h0LT_qcd_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_qcd_catvbfhigh_anti->Sumw2(); + TH2F* h0LT_w_catvbfhigh_iso = new TH2F ("h0LT_w_catvbfhigh_iso","h0LT_w_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_w_catvbfhigh_iso->Sumw2(); + TH2F* h0LT_w_catvbfhigh_anti = new TH2F ("h0LT_w_catvbfhigh_anti","h0LT_w_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0LT_w_catvbfhigh_anti->Sumw2(); + TH2F* h0J_qcd_catvbfhigh_iso = new TH2F ("h0J_qcd_catvbfhigh_iso","h0J_qcd_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_qcd_catvbfhigh_iso->Sumw2(); + TH2F* h0J_qcd_catvbfhigh_anti = new TH2F ("h0J_qcd_catvbfhigh_anti","h0J_qcd_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_qcd_catvbfhigh_anti->Sumw2(); + TH2F* h0J_w_catvbfhigh_iso = new TH2F ("h0J_w_catvbfhigh_iso","h0J_w_catvbfhigh_iso",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_w_catvbfhigh_iso->Sumw2(); + TH2F* h0J_w_catvbfhigh_anti = new TH2F ("h0J_w_catvbfhigh_anti","h0J_w_catvbfhigh_anti",binnum_catvbfhigh0,bins_catvbfhigh0,binnum_catvbfhigh1,bins_catvbfhigh1); h0J_w_catvbfhigh_anti->Sumw2(); string datapath = string(std::getenv("CMSSW_BASE"))+"/src/ComputeFF2018/FFcode/data/"; @@ -432,17 +574,31 @@ int main(int argc, char** argv) { TFile frawff("uncorrected_fakefactors_mt.root"); TF1* ff_qcd_0jet=(TF1*) frawff.Get("rawFF_mt_qcd_0jet"); TF1* ff_qcd_1jet=(TF1*) frawff.Get("rawFF_mt_qcd_1jet"); + TF1* ff_qcd_2jet=(TF1*) frawff.Get("rawFF_mt_qcd_2jet"); TF1* ff_looseSSqcd_0jet=(TF1*) frawff.Get("rawFF_mt_qcd_0jetSSloose"); TF1* ff_looseSSqcd_1jet=(TF1*) frawff.Get("rawFF_mt_qcd_1jetSSloose"); + TF1* ff_looseSSqcd_2jet=(TF1*) frawff.Get("rawFF_mt_qcd_2jetSSloose"); TF1* ff_w_0jet=(TF1*) frawff.Get("rawFF_mt_w_0jet"); TF1* ff_w_1jet=(TF1*) frawff.Get("rawFF_mt_w_1jet"); + TF1* ff_w_2jet=(TF1*) frawff.Get("rawFF_mt_w_2jet"); TF1* ff_wmc_0jet=(TF1*) frawff.Get("mc_rawFF_mt_w_0jet"); TF1* ff_wmc_1jet=(TF1*) frawff.Get("mc_rawFF_mt_w_1jet"); + TF1* ff_wmc_2jet=(TF1*) frawff.Get("mc_rawFF_mt_w_2jet"); TF1* ff_tt_0jet=(TF1*) frawff.Get("rawFF_mt_tt"); TF1* ff_ttmc_0jet=(TF1*) frawff.Get("mc_rawFF_mt_tt"); TFile fmvisclosure ("FF_corrections_1.root"); TF1* mvisclosure_wmc=(TF1*) fmvisclosure.Get("closure_mvis_mt_wmc"); + TF1* mvisclosure_qcd=(TF1*) fmvisclosure.Get("closure_mvis_mt_qcd"); + TF1* mvisclosure_w=(TF1*) fmvisclosure.Get("closure_mvis_mt_w"); + TF1* mvisclosure_tt=(TF1*) fmvisclosure.Get("closure_mvis_mt_ttmc"); + TF1* mvisclosure_qcd0=(TF1*) fmvisclosure.Get("closure_mvis_mt_0jet_qcd"); + TF1* mvisclosure_w0=(TF1*) fmvisclosure.Get("closure_mvis_mt_0jet_w"); + TF1* mvisclosure_qcd1=(TF1*) fmvisclosure.Get("closure_mvis_mt_1jet_qcd"); + TF1* mvisclosure_w1=(TF1*) fmvisclosure.Get("closure_mvis_mt_1jet_w"); + TF1* mvisclosure_qcd2=(TF1*) fmvisclosure.Get("closure_mvis_mt_2jet_qcd"); + TF1* mvisclosure_w2=(TF1*) fmvisclosure.Get("closure_mvis_mt_2jet_w"); + ScaleFactor * myScaleFactor_trgMu2427 = new ScaleFactor(); myScaleFactor_trgMu2427->init_ScaleFactor(string(std::getenv("CMSSW_BASE"))+"/src/LeptonEfficiencies/Muon/Run2018/Muon_Run2018_IsoMu24orIsoMu27.root"); @@ -702,16 +858,30 @@ int main(int argc, char** argv) { //if (myvar>300) myvar=299; float ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_0jet); - if (njets>0) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet); + if (njets==1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet); + if (njets>1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_2jet); float ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_0jet); - if (njets>0) ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_1jet); + if (njets==1) ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_1jet); + if (njets>1) ff_looseSSqcd=get_raw_FF(mytau.Pt(),ff_looseSSqcd_2jet); float ff_w=get_raw_FF(mytau.Pt(),ff_w_0jet); - if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_w_1jet); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_w_1jet); + if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_w_2jet); float ff_tt=get_raw_FF(mytau.Pt(),ff_tt_0jet); + if (apply_corrections=="yes"){ + ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_0jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcd0); + if (njets==1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_1jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcd1); + else if (njets>1) ff_qcd=get_raw_FF(mytau.Pt(),ff_qcd_2jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_qcd2); + ff_w=get_raw_FF(mytau.Pt(),ff_w_0jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_w0); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_w_1jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_w1); + else if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_w_2jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_w2); + ff_tt=get_raw_FF(mytau.Pt(),ff_tt_0jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_tt); + } + if (name=="WMC"){ ff_w=get_raw_FF(mytau.Pt(),ff_wmc_0jet); - if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet); + if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_2jet); mt=100; } @@ -721,60 +891,180 @@ int main(int argc, char** argv) { if (name=="WMC2"){ ff_w=get_raw_FF(mytau.Pt(),ff_wmc_0jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_wmc); - if (njets>0) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_wmc); + if (njets==1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_1jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_wmc); + if (njets>1) ff_w=get_raw_FF(mytau.Pt(),ff_wmc_2jet)*get_mvis_closure((mymu+mytau).M(),mvisclosure_wmc); } + if (!is_includedInEmbedded){ - if (signalRegion && iso_1<0.15 && nbtag==0 && q_1*q_2<0) + // W MC + if (signalRegion && iso_1<0.15 && nbtag==0 && q_1*q_2<0) hmt_w_iso->Fill(mt,aweight*weight2); if (antiisoRegion && iso_1<0.15 && nbtag==0 && q_1*q_2<0) hmt_w_anti->Fill(mt,aweight*weight2*ff_w); - if (isL or isT){ - if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) - h0LT_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + if (isL or isT){ + + // QCD + if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0LT_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1LT_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2LT_qcd_mvis_iso->Fill(myvar,aweight*weight2); + h0LT_qcd_iso->Fill(myvar,aweight*weight2); + h0LT_qcd_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0LT_qcd_pth_iso->Fill((mymu+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0LT_qcd_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0LT_qcd_cat0jetlow_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()>10) h0LT_qcd_cat0jethigh_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==1) h0LT_qcd_catboosted1_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0LT_qcd_catboosted2_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0LT_qcd_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0LT_qcd_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + } + if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0LT_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets==1) h1LT_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets>1) h2LT_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); h0LT_qcd_anti->Fill(myvar,aweight*weight2*ff_qcd); - + h0LT_qcd_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_qcd); + if (njets>0) h0LT_qcd_pth_anti->Fill((mymu+mymet+mytau).Pt(),aweight*weight2*ff_qcd); + if (njets>1) h0LT_qcd_mjj_anti->Fill(mjj,aweight*weight2*ff_qcd); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0LT_qcd_cat0jetlow_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_qcd); + if (njets==0 && (mymu+mytau+mymet).Pt()>10) h0LT_qcd_cat0jethigh_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_qcd); + if (njets==1) h0LT_qcd_catboosted1_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj<350) h0LT_qcd_catboosted2_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0LT_qcd_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0LT_qcd_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + } + + // QCD loose if (signalRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2*ff_looseSSqcd); - if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + + // W + if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0LT_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1LT_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2LT_w_mvis_iso->Fill(myvar,aweight*weight2); h0LT_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h0LT_w_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0LT_w_pth_iso->Fill((mymu+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0LT_w_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0LT_w_cat0jetlow_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()>10) h0LT_w_cat0jethigh_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==1) h0LT_w_catboosted1_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0LT_w_catboosted2_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0LT_w_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0LT_w_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + } + if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0LT_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets==1) h1LT_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets>1) h2LT_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); h0LT_w_anti->Fill(myvar,aweight*weight2*ff_w); - + h0LT_w_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_w); + if (njets>0) h0LT_w_pth_anti->Fill((mymu+mymet+mytau).Pt(),aweight*weight2*ff_w); + if (njets>1) h0LT_w_mjj_anti->Fill(mjj,aweight*weight2*ff_w); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0LT_w_cat0jetlow_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_w); + if (njets==0 && (mymu+mytau+mymet).Pt()>10) h0LT_w_cat0jethigh_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_w); + if (njets==1) h0LT_w_catboosted1_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj<350) h0LT_w_catboosted2_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0LT_w_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0LT_w_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + } + + // TT if (signalRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0LT_tt_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0LT_tt_anti->Fill(myvar,aweight*weight2*ff_tt); - } - else{ - if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + + } + else{ + if (signalRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0J_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1J_qcd_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2J_qcd_mvis_iso->Fill(myvar,aweight*weight2); h0J_qcd_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0) + h0J_qcd_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0J_qcd_pth_iso->Fill((mymu+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0J_qcd_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0J_qcd_cat0jetlow_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()>200) h0J_qcd_cat0jethigh_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==1) h0J_qcd_catboosted1_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0J_qcd_catboosted2_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0J_qcd_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0J_qcd_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + + } + if (antiisoRegion && iso_1>0.02 && iso_1<0.15 && nbtag==0 && mt<50 && q_1*q_2>0){ + if (njets==0) h0J_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets==1) h1J_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); + else if (njets>1) h2J_qcd_mvis_anti->Fill(myvar,aweight*weight2*ff_qcd); h0J_qcd_anti->Fill(myvar,aweight*weight2*ff_qcd); - + h0J_qcd_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_qcd); + if (njets>0) h0J_qcd_pth_anti->Fill((mymu+mymet+mytau).Pt(),aweight*weight2*ff_qcd); + if (njets>1) h0J_qcd_mjj_anti->Fill(mjj,aweight*weight2*ff_qcd); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0J_qcd_cat0jetlow_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_qcd); + if (njets==0 && (mymu+mytau+mymet).Pt()>200) h0J_qcd_cat0jethigh_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_qcd); + if (njets==1) h0J_qcd_catboosted1_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj<350) h0J_qcd_catboosted2_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0J_qcd_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0J_qcd_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_qcd); + } + + // QCD loose if (signalRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1>0.15 && iso_1<0.25 && nbtag==0 && mt<50 && q_1*q_2>0) h0SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2*ff_looseSSqcd); - if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + // W + if (signalRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0J_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets==1) h1J_w_mvis_iso->Fill(myvar,aweight*weight2); + else if (njets>1) h2J_w_mvis_iso->Fill(myvar,aweight*weight2); h0J_w_iso->Fill(myvar,aweight*weight2); - if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0) + h0J_w_taupt_iso->Fill(mytau.Pt(),aweight*weight2); + if (njets>0) h0J_w_pth_iso->Fill((mymu+mymet+mytau).Pt(),aweight*weight2); + if (njets>1) h0J_w_mjj_iso->Fill(mjj,aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0J_w_cat0jetlow_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==0 && (mymu+mytau+mymet).Pt()>200) h0J_w_cat0jethigh_iso->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2); + if (njets==1) h0J_w_catboosted1_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj<350) h0J_w_catboosted2_iso->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0J_w_catvbflow_iso->Fill(mjj,m_sv,aweight*weight2); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0J_w_catvbfhigh_iso->Fill(mjj,m_sv,aweight*weight2); + + } + if (antiisoRegion && iso_1<0.15 && nbtag==0 && mt>70 && q_1*q_2<0){ + if (njets==0) h0J_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets==1) h1J_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); + else if (njets>1) h2J_w_mvis_anti->Fill(myvar,aweight*weight2*ff_w); h0J_w_anti->Fill(myvar,aweight*weight2*ff_w); - + h0J_w_taupt_anti->Fill(mytau.Pt(),aweight*weight2*ff_w); + if (njets>0) h0J_w_pth_anti->Fill((mymu+mymet+mytau).Pt(),aweight*weight2*ff_w); + if (njets>1) h0J_w_mjj_anti->Fill(mjj,aweight*weight2*ff_w); + if (njets==0 && (mymu+mytau+mymet).Pt()<10) h0J_w_cat0jetlow_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_w); + if (njets==0 && (mymu+mytau+mymet).Pt()>200) h0J_w_cat0jethigh_anti->Fill(mytau.Pt(),(mymu+mytau).M(),aweight*weight2*ff_w); + if (njets==1) h0J_w_catboosted1_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj<350) h0J_w_catboosted2_anti->Fill((mymu+mytau+mymet).Pt(),m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()<200) h0J_w_catvbflow_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + if (njets>1 && mjj>350 && (mymu+mytau+mymet).Pt()>200) h0J_w_catvbfhigh_anti->Fill(mjj,m_sv,aweight*weight2*ff_w); + + } + + // TT if (signalRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0J_tt_iso->Fill(myvar,aweight*weight2); if (antiisoRegion && iso_1<0.15 && nbtag>0 && mt<50 && q_1*q_2<0) h0J_tt_anti->Fill(myvar,aweight*weight2*ff_tt); } + } - } } // end of loop over events TFile *fout = TFile::Open(output.c_str(), "RECREATE"); @@ -783,6 +1073,87 @@ int main(int argc, char** argv) { TString postfixJ="J"; TString postfixLT="LT"; + TDirectory *d0_qcd_mvis_iso =fout->mkdir("mt_0jet_qcd_mvis_iso"); + d0_qcd_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mvis_iso->SetName(name.c_str()); + h0LT_qcd_mvis_iso->Add(h0J_qcd_mvis_iso); + h0LT_qcd_mvis_iso->Write(); + } + else{ + h0LT_qcd_mvis_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_mvis_iso->Write(); + h0J_qcd_mvis_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_mvis_iso->Write(); + } + TDirectory *d0_qcd_mvis_anti =fout->mkdir("mt_0jet_qcd_mvis_anti"); + d0_qcd_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mvis_anti->SetName(name.c_str()); + h0LT_qcd_mvis_anti->Add(h0J_qcd_mvis_anti); + h0LT_qcd_mvis_anti->Write(); + } + else{ + h0LT_qcd_mvis_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_mvis_anti->Write(); + h0J_qcd_mvis_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_mvis_anti->Write(); + } + + TDirectory *d1_qcd_mvis_iso =fout->mkdir("mt_1jet_qcd_mvis_iso"); + d1_qcd_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_qcd_mvis_iso->SetName(name.c_str()); + h1LT_qcd_mvis_iso->Add(h1J_qcd_mvis_iso); + h1LT_qcd_mvis_iso->Write(); + } + else{ + h1LT_qcd_mvis_iso->SetName(name.c_str()+postfixLT); + h1LT_qcd_mvis_iso->Write(); + h1J_qcd_mvis_iso->SetName(name.c_str()+postfixJ); + h1J_qcd_mvis_iso->Write(); + } + TDirectory *d1_qcd_mvis_anti =fout->mkdir("mt_1jet_qcd_mvis_anti"); + d1_qcd_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_qcd_mvis_anti->SetName(name.c_str()); + h1LT_qcd_mvis_anti->Add(h1J_qcd_mvis_anti); + h1LT_qcd_mvis_anti->Write(); + } + else{ + h1LT_qcd_mvis_anti->SetName(name.c_str()+postfixLT); + h1LT_qcd_mvis_anti->Write(); + h1J_qcd_mvis_anti->SetName(name.c_str()+postfixJ); + h1J_qcd_mvis_anti->Write(); + } + + TDirectory *d2_qcd_mvis_iso =fout->mkdir("mt_2jet_qcd_mvis_iso"); + d2_qcd_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_mvis_iso->SetName(name.c_str()); + h2LT_qcd_mvis_iso->Add(h2J_qcd_mvis_iso); + h2LT_qcd_mvis_iso->Write(); + } + else{ + h2LT_qcd_mvis_iso->SetName(name.c_str()+postfixLT); + h2LT_qcd_mvis_iso->Write(); + h2J_qcd_mvis_iso->SetName(name.c_str()+postfixJ); + h2J_qcd_mvis_iso->Write(); + } + TDirectory *d2_qcd_mvis_anti =fout->mkdir("mt_2jet_qcd_mvis_anti"); + d2_qcd_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_qcd_mvis_anti->SetName(name.c_str()); + h2LT_qcd_mvis_anti->Add(h2J_qcd_mvis_anti); + h2LT_qcd_mvis_anti->Write(); + } + else{ + h2LT_qcd_mvis_anti->SetName(name.c_str()+postfixLT); + h2LT_qcd_mvis_anti->Write(); + h2J_qcd_mvis_anti->SetName(name.c_str()+postfixJ); + h2J_qcd_mvis_anti->Write(); + } + TDirectory *d0_qcd_iso =fout->mkdir("mt_0jet_qcd_iso"); d0_qcd_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -796,10 +1167,8 @@ int main(int argc, char** argv) { h0J_qcd_iso->SetName(name.c_str()+postfixJ); h0J_qcd_iso->Write(); } - TDirectory *d0_qcd_anti =fout->mkdir("mt_0jet_qcd_anti"); d0_qcd_anti->cd(); - if (sample=="data_obs" or sample=="W"){ h0LT_qcd_anti->SetName(name.c_str()); h0LT_qcd_anti->Add(h0J_qcd_anti); @@ -812,6 +1181,249 @@ int main(int argc, char** argv) { h0J_qcd_anti->Write(); } + TDirectory *d0_qcd_taupt_iso =fout->mkdir("mt_0jet_qcd_taupt_iso"); + d0_qcd_taupt_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_taupt_iso->SetName(name.c_str()); + h0LT_qcd_taupt_iso->Add(h0J_qcd_taupt_iso); + h0LT_qcd_taupt_iso->Write(); + } + else{ + h0LT_qcd_taupt_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_taupt_iso->Write(); + h0J_qcd_taupt_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_taupt_iso->Write(); + } + TDirectory *d0_qcd_taupt_anti =fout->mkdir("mt_0jet_qcd_taupt_anti"); + d0_qcd_taupt_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_taupt_anti->SetName(name.c_str()); + h0LT_qcd_taupt_anti->Add(h0J_qcd_taupt_anti); + h0LT_qcd_taupt_anti->Write(); + } + else{ + h0LT_qcd_taupt_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_taupt_anti->Write(); + h0J_qcd_taupt_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_taupt_anti->Write(); + } + + TDirectory *d0_qcd_pth_iso =fout->mkdir("mt_0jet_qcd_pth_iso"); + d0_qcd_pth_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_pth_iso->SetName(name.c_str()); + h0LT_qcd_pth_iso->Add(h0J_qcd_pth_iso); + h0LT_qcd_pth_iso->Write(); + } + else{ + h0LT_qcd_pth_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_pth_iso->Write(); + h0J_qcd_pth_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_pth_iso->Write(); + } + TDirectory *d0_qcd_pth_anti =fout->mkdir("mt_0jet_qcd_pth_anti"); + d0_qcd_pth_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_pth_anti->SetName(name.c_str()); + h0LT_qcd_pth_anti->Add(h0J_qcd_pth_anti); + h0LT_qcd_pth_anti->Write(); + } + else{ + h0LT_qcd_pth_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_pth_anti->Write(); + h0J_qcd_pth_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_pth_anti->Write(); + } + + TDirectory *d0_qcd_mjj_iso =fout->mkdir("mt_0jet_qcd_mjj_iso"); + d0_qcd_mjj_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mjj_iso->SetName(name.c_str()); + h0LT_qcd_mjj_iso->Add(h0J_qcd_mjj_iso); + h0LT_qcd_mjj_iso->Write(); + } + else{ + h0LT_qcd_mjj_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_mjj_iso->Write(); + h0J_qcd_mjj_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_mjj_iso->Write(); + } + TDirectory *d0_qcd_mjj_anti =fout->mkdir("mt_0jet_qcd_mjj_anti"); + d0_qcd_mjj_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_mjj_anti->SetName(name.c_str()); + h0LT_qcd_mjj_anti->Add(h0J_qcd_mjj_anti); + h0LT_qcd_mjj_anti->Write(); + } + else{ + h0LT_qcd_mjj_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_mjj_anti->Write(); + h0J_qcd_mjj_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_mjj_anti->Write(); + } + + TDirectory *d0_qcd_cat0jetlow_iso =fout->mkdir("mt_0jet_qcd_cat0jetlow_iso"); + d0_qcd_cat0jetlow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jetlow_iso->SetName(name.c_str()); + h0LT_qcd_cat0jetlow_iso->Add(h0J_qcd_cat0jetlow_iso); + h0LT_qcd_cat0jetlow_iso->Write(); + } + else{ + h0LT_qcd_cat0jetlow_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jetlow_iso->Write(); + h0J_qcd_cat0jetlow_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jetlow_iso->Write(); + } + TDirectory *d0_qcd_cat0jetlow_anti =fout->mkdir("mt_0jet_qcd_cat0jetlow_anti"); + d0_qcd_cat0jetlow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jetlow_anti->SetName(name.c_str()); + h0LT_qcd_cat0jetlow_anti->Add(h0J_qcd_cat0jetlow_anti); + h0LT_qcd_cat0jetlow_anti->Write(); + } + else{ + h0LT_qcd_cat0jetlow_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jetlow_anti->Write(); + h0J_qcd_cat0jetlow_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jetlow_anti->Write(); + } + + TDirectory *d0_qcd_cat0jethigh_iso =fout->mkdir("mt_0jet_qcd_cat0jethigh_iso"); + d0_qcd_cat0jethigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jethigh_iso->SetName(name.c_str()); + h0LT_qcd_cat0jethigh_iso->Add(h0J_qcd_cat0jethigh_iso); + h0LT_qcd_cat0jethigh_iso->Write(); + } + else{ + h0LT_qcd_cat0jethigh_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jethigh_iso->Write(); + h0J_qcd_cat0jethigh_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jethigh_iso->Write(); + } + TDirectory *d0_qcd_cat0jethigh_anti =fout->mkdir("mt_0jet_qcd_cat0jethigh_anti"); + d0_qcd_cat0jethigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jethigh_anti->SetName(name.c_str()); + h0LT_qcd_cat0jethigh_anti->Add(h0J_qcd_cat0jethigh_anti); + h0LT_qcd_cat0jethigh_anti->Write(); + } + else{ + h0LT_qcd_cat0jethigh_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jethigh_anti->Write(); + h0J_qcd_cat0jethigh_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jethigh_anti->Write(); + } + + TDirectory *d0_qcd_catboosted1_iso =fout->mkdir("mt_0jet_qcd_catboosted1_iso"); + d0_qcd_catboosted1_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted1_iso->SetName(name.c_str()); + h0LT_qcd_catboosted1_iso->Add(h0J_qcd_catboosted1_iso); + h0LT_qcd_catboosted1_iso->Write(); + } + else{ + h0LT_qcd_catboosted1_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted1_iso->Write(); + h0J_qcd_catboosted1_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted1_iso->Write(); + } + TDirectory *d0_qcd_catboosted1_anti =fout->mkdir("mt_0jet_qcd_catboosted1_anti"); + d0_qcd_catboosted1_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted1_anti->SetName(name.c_str()); + h0LT_qcd_catboosted1_anti->Add(h0J_qcd_catboosted1_anti); + h0LT_qcd_catboosted1_anti->Write(); + } + else{ + h0LT_qcd_catboosted1_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted1_anti->Write(); + h0J_qcd_catboosted1_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted1_anti->Write(); + } + + TDirectory *d0_qcd_catboosted2_iso =fout->mkdir("mt_0jet_qcd_catboosted2_iso"); + d0_qcd_catboosted2_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted2_iso->SetName(name.c_str()); + h0LT_qcd_catboosted2_iso->Add(h0J_qcd_catboosted2_iso); + h0LT_qcd_catboosted2_iso->Write(); + } + else{ + h0LT_qcd_catboosted2_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted2_iso->Write(); + h0J_qcd_catboosted2_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted2_iso->Write(); + } + TDirectory *d0_qcd_catboosted2_anti =fout->mkdir("mt_0jet_qcd_catboosted2_anti"); + d0_qcd_catboosted2_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted2_anti->SetName(name.c_str()); + h0LT_qcd_catboosted2_anti->Add(h0J_qcd_catboosted2_anti); + h0LT_qcd_catboosted2_anti->Write(); + } + else{ + h0LT_qcd_catboosted2_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted2_anti->Write(); + h0J_qcd_catboosted2_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted2_anti->Write(); + } + + TDirectory *d0_qcd_catvbflow_iso =fout->mkdir("mt_0jet_qcd_catvbflow_iso"); + d0_qcd_catvbflow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbflow_iso->SetName(name.c_str()); + h0LT_qcd_catvbflow_iso->Add(h0J_qcd_catvbflow_iso); + h0LT_qcd_catvbflow_iso->Write(); + } + else{ + h0LT_qcd_catvbflow_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbflow_iso->Write(); + h0J_qcd_catvbflow_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbflow_iso->Write(); + } + TDirectory *d0_qcd_catvbflow_anti =fout->mkdir("mt_0jet_qcd_catvbflow_anti"); + d0_qcd_catvbflow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbflow_anti->SetName(name.c_str()); + h0LT_qcd_catvbflow_anti->Add(h0J_qcd_catvbflow_anti); + h0LT_qcd_catvbflow_anti->Write(); + } + else{ + h0LT_qcd_catvbflow_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbflow_anti->Write(); + h0J_qcd_catvbflow_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbflow_anti->Write(); + } + + TDirectory *d0_qcd_catvbfhigh_iso =fout->mkdir("mt_0jet_qcd_catvbfhigh_iso"); + d0_qcd_catvbfhigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbfhigh_iso->SetName(name.c_str()); + h0LT_qcd_catvbfhigh_iso->Add(h0J_qcd_catvbfhigh_iso); + h0LT_qcd_catvbfhigh_iso->Write(); + } + else{ + h0LT_qcd_catvbfhigh_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbfhigh_iso->Write(); + h0J_qcd_catvbfhigh_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbfhigh_iso->Write(); + } + TDirectory *d0_qcd_catvbfhigh_anti =fout->mkdir("mt_0jet_qcd_catvbfhigh_anti"); + d0_qcd_catvbfhigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbfhigh_anti->SetName(name.c_str()); + h0LT_qcd_catvbfhigh_anti->Add(h0J_qcd_catvbfhigh_anti); + h0LT_qcd_catvbfhigh_anti->Write(); + } + else{ + h0LT_qcd_catvbfhigh_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbfhigh_anti->Write(); + h0J_qcd_catvbfhigh_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbfhigh_anti->Write(); + } + TDirectory *d0looseSS_qcd_iso =fout->mkdir("mt_0SSloose_qcd_iso"); d0looseSS_qcd_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -825,7 +1437,6 @@ int main(int argc, char** argv) { h0SSlooseJ_qcd_iso->SetName(name.c_str()+postfixJ); h0SSlooseJ_qcd_iso->Write(); } - TDirectory *d0looseSS_qcd_anti =fout->mkdir("mt_0SSloose_qcd_anti"); d0looseSS_qcd_anti->cd(); @@ -840,6 +1451,88 @@ int main(int argc, char** argv) { h0SSlooseJ_qcd_anti->SetName(name.c_str()+postfixJ); h0SSlooseJ_qcd_anti->Write(); } + + TDirectory *d0_w_mvis_iso =fout->mkdir("mt_0jet_w_mvis_iso"); + d0_w_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mvis_iso->SetName(name.c_str()); + h0LT_w_mvis_iso->Add(h0J_w_mvis_iso); + h0LT_w_mvis_iso->Write(); + } + else{ + h0LT_w_mvis_iso->SetName(name.c_str()+postfixLT); + h0LT_w_mvis_iso->Write(); + h0J_w_mvis_iso->SetName(name.c_str()+postfixJ); + h0J_w_mvis_iso->Write(); + } + TDirectory *d0_w_mvis_anti =fout->mkdir("mt_0jet_w_mvis_anti"); + d0_w_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mvis_anti->SetName(name.c_str()); + h0LT_w_mvis_anti->Add(h0J_w_mvis_anti); + h0LT_w_mvis_anti->Write(); + } + else{ + h0LT_w_mvis_anti->SetName(name.c_str()+postfixLT); + h0LT_w_mvis_anti->Write(); + h0J_w_mvis_anti->SetName(name.c_str()+postfixJ); + h0J_w_mvis_anti->Write(); + } + TDirectory *d1_w_mvis_iso =fout->mkdir("mt_1jet_w_mvis_iso"); + d1_w_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_w_mvis_iso->SetName(name.c_str()); + h1LT_w_mvis_iso->Add(h1J_w_mvis_iso); + h1LT_w_mvis_iso->Write(); + } + else{ + h1LT_w_mvis_iso->SetName(name.c_str()+postfixLT); + h1LT_w_mvis_iso->Write(); + h1J_w_mvis_iso->SetName(name.c_str()+postfixJ); + h1J_w_mvis_iso->Write(); + } + TDirectory *d1_w_mvis_anti =fout->mkdir("mt_1jet_w_mvis_anti"); + d1_w_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h1LT_w_mvis_anti->SetName(name.c_str()); + h1LT_w_mvis_anti->Add(h1J_w_mvis_anti); + h1LT_w_mvis_anti->Write(); + } + else{ + h1LT_w_mvis_anti->SetName(name.c_str()+postfixLT); + h1LT_w_mvis_anti->Write(); + h1J_w_mvis_anti->SetName(name.c_str()+postfixJ); + h1J_w_mvis_anti->Write(); + } + + TDirectory *d2_w_mvis_iso =fout->mkdir("mt_2jet_w_mvis_iso"); + d2_w_mvis_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_mvis_iso->SetName(name.c_str()); + h2LT_w_mvis_iso->Add(h2J_w_mvis_iso); + h2LT_w_mvis_iso->Write(); + } + else{ + h2LT_w_mvis_iso->SetName(name.c_str()+postfixLT); + h2LT_w_mvis_iso->Write(); + h2J_w_mvis_iso->SetName(name.c_str()+postfixJ); + h2J_w_mvis_iso->Write(); + } + TDirectory *d2_w_mvis_anti =fout->mkdir("mt_2jet_w_mvis_anti"); + d2_w_mvis_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h2LT_w_mvis_anti->SetName(name.c_str()); + h2LT_w_mvis_anti->Add(h2J_w_mvis_anti); + h2LT_w_mvis_anti->Write(); + } + else{ + h2LT_w_mvis_anti->SetName(name.c_str()+postfixLT); + h2LT_w_mvis_anti->Write(); + h2J_w_mvis_anti->SetName(name.c_str()+postfixJ); + h2J_w_mvis_anti->Write(); + } + + TDirectory *d0_w_iso =fout->mkdir("mt_0jet_w_iso"); d0_w_iso->cd(); if (sample=="data_obs" or sample=="W"){ @@ -853,7 +1546,6 @@ int main(int argc, char** argv) { h0J_w_iso->SetName(name.c_str()+postfixJ); h0J_w_iso->Write(); } - TDirectory *d0_w_anti =fout->mkdir("mt_0jet_w_anti"); d0_w_anti->cd(); if (sample=="data_obs" or sample=="W"){ @@ -868,6 +1560,250 @@ int main(int argc, char** argv) { h0J_w_anti->Write(); } + TDirectory *d0_w_taupt_iso =fout->mkdir("mt_0jet_w_taupt_iso"); + d0_w_taupt_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_taupt_iso->SetName(name.c_str()); + h0LT_w_taupt_iso->Add(h0J_w_taupt_iso); + h0LT_w_taupt_iso->Write(); + } + else{ + h0LT_w_taupt_iso->SetName(name.c_str()+postfixLT); + h0LT_w_taupt_iso->Write(); + h0J_w_taupt_iso->SetName(name.c_str()+postfixJ); + h0J_w_taupt_iso->Write(); + } + TDirectory *d0_w_taupt_anti =fout->mkdir("mt_0jet_w_taupt_anti"); + d0_w_taupt_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_taupt_anti->SetName(name.c_str()); + h0LT_w_taupt_anti->Add(h0J_w_taupt_anti); + h0LT_w_taupt_anti->Write(); + } + else{ + h0LT_w_taupt_anti->SetName(name.c_str()+postfixLT); + h0LT_w_taupt_anti->Write(); + h0J_w_taupt_anti->SetName(name.c_str()+postfixJ); + h0J_w_taupt_anti->Write(); + } + + TDirectory *d0_w_pth_iso =fout->mkdir("mt_0jet_w_pth_iso"); + d0_w_pth_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_pth_iso->SetName(name.c_str()); + h0LT_w_pth_iso->Add(h0J_w_pth_iso); + h0LT_w_pth_iso->Write(); + } + else{ + h0LT_w_pth_iso->SetName(name.c_str()+postfixLT); + h0LT_w_pth_iso->Write(); + h0J_w_pth_iso->SetName(name.c_str()+postfixJ); + h0J_w_pth_iso->Write(); + } + TDirectory *d0_w_pth_anti =fout->mkdir("mt_0jet_w_pth_anti"); + d0_w_pth_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_pth_anti->SetName(name.c_str()); + h0LT_w_pth_anti->Add(h0J_w_pth_anti); + h0LT_w_pth_anti->Write(); + } + else{ + h0LT_w_pth_anti->SetName(name.c_str()+postfixLT); + h0LT_w_pth_anti->Write(); + h0J_w_pth_anti->SetName(name.c_str()+postfixJ); + h0J_w_pth_anti->Write(); + } + + TDirectory *d0_w_mjj_iso =fout->mkdir("mt_0jet_w_mjj_iso"); + d0_w_mjj_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mjj_iso->SetName(name.c_str()); + h0LT_w_mjj_iso->Add(h0J_w_mjj_iso); + h0LT_w_mjj_iso->Write(); + } + else{ + h0LT_w_mjj_iso->SetName(name.c_str()+postfixLT); + h0LT_w_mjj_iso->Write(); + h0J_w_mjj_iso->SetName(name.c_str()+postfixJ); + h0J_w_mjj_iso->Write(); + } + TDirectory *d0_w_mjj_anti =fout->mkdir("mt_0jet_w_mjj_anti"); + d0_w_mjj_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_mjj_anti->SetName(name.c_str()); + h0LT_w_mjj_anti->Add(h0J_w_mjj_anti); + h0LT_w_mjj_anti->Write(); + } + else{ + h0LT_w_mjj_anti->SetName(name.c_str()+postfixLT); + h0LT_w_mjj_anti->Write(); + h0J_w_mjj_anti->SetName(name.c_str()+postfixJ); + h0J_w_mjj_anti->Write(); + } + + TDirectory *d0_w_cat0jetlow_iso =fout->mkdir("mt_0jet_w_cat0jetlow_iso"); + d0_w_cat0jetlow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jetlow_iso->SetName(name.c_str()); + h0LT_w_cat0jetlow_iso->Add(h0J_w_cat0jetlow_iso); + h0LT_w_cat0jetlow_iso->Write(); + } + else{ + h0LT_w_cat0jetlow_iso->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jetlow_iso->Write(); + h0J_w_cat0jetlow_iso->SetName(name.c_str()+postfixJ); + h0J_w_cat0jetlow_iso->Write(); + } + TDirectory *d0_w_cat0jetlow_anti =fout->mkdir("mt_0jet_w_cat0jetlow_anti"); + d0_w_cat0jetlow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jetlow_anti->SetName(name.c_str()); + h0LT_w_cat0jetlow_anti->Add(h0J_w_cat0jetlow_anti); + h0LT_w_cat0jetlow_anti->Write(); + } + else{ + h0LT_w_cat0jetlow_anti->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jetlow_anti->Write(); + h0J_w_cat0jetlow_anti->SetName(name.c_str()+postfixJ); + h0J_w_cat0jetlow_anti->Write(); + } + + TDirectory *d0_w_cat0jethigh_iso =fout->mkdir("mt_0jet_w_cat0jethigh_iso"); + d0_w_cat0jethigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jethigh_iso->SetName(name.c_str()); + h0LT_w_cat0jethigh_iso->Add(h0J_w_cat0jethigh_iso); + h0LT_w_cat0jethigh_iso->Write(); + } + else{ + h0LT_w_cat0jethigh_iso->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jethigh_iso->Write(); + h0J_w_cat0jethigh_iso->SetName(name.c_str()+postfixJ); + h0J_w_cat0jethigh_iso->Write(); + } + TDirectory *d0_w_cat0jethigh_anti =fout->mkdir("mt_0jet_w_cat0jethigh_anti"); + d0_w_cat0jethigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_cat0jethigh_anti->SetName(name.c_str()); + h0LT_w_cat0jethigh_anti->Add(h0J_w_cat0jethigh_anti); + h0LT_w_cat0jethigh_anti->Write(); + } + else{ + h0LT_w_cat0jethigh_anti->SetName(name.c_str()+postfixLT); + h0LT_w_cat0jethigh_anti->Write(); + h0J_w_cat0jethigh_anti->SetName(name.c_str()+postfixJ); + h0J_w_cat0jethigh_anti->Write(); + } + + TDirectory *d0_w_catboosted1_iso =fout->mkdir("mt_0jet_w_catboosted1_iso"); + d0_w_catboosted1_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted1_iso->SetName(name.c_str()); + h0LT_w_catboosted1_iso->Add(h0J_w_catboosted1_iso); + h0LT_w_catboosted1_iso->Write(); + } + else{ + h0LT_w_catboosted1_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted1_iso->Write(); + h0J_w_catboosted1_iso->SetName(name.c_str()+postfixJ); + h0J_w_catboosted1_iso->Write(); + } + TDirectory *d0_w_catboosted1_anti =fout->mkdir("mt_0jet_w_catboosted1_anti"); + d0_w_catboosted1_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted1_anti->SetName(name.c_str()); + h0LT_w_catboosted1_anti->Add(h0J_w_catboosted1_anti); + h0LT_w_catboosted1_anti->Write(); + } + else{ + h0LT_w_catboosted1_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted1_anti->Write(); + h0J_w_catboosted1_anti->SetName(name.c_str()+postfixJ); + h0J_w_catboosted1_anti->Write(); + } + + TDirectory *d0_w_catboosted2_iso =fout->mkdir("mt_0jet_w_catboosted2_iso"); + d0_w_catboosted2_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted2_iso->SetName(name.c_str()); + h0LT_w_catboosted2_iso->Add(h0J_w_catboosted2_iso); + h0LT_w_catboosted2_iso->Write(); + } + else{ + h0LT_w_catboosted2_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted2_iso->Write(); + h0J_w_catboosted2_iso->SetName(name.c_str()+postfixJ); + h0J_w_catboosted2_iso->Write(); + } + TDirectory *d0_w_catboosted2_anti =fout->mkdir("mt_0jet_w_catboosted2_anti"); + d0_w_catboosted2_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catboosted2_anti->SetName(name.c_str()); + h0LT_w_catboosted2_anti->Add(h0J_w_catboosted2_anti); + h0LT_w_catboosted2_anti->Write(); + } + else{ + h0LT_w_catboosted2_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catboosted2_anti->Write(); + h0J_w_catboosted2_anti->SetName(name.c_str()+postfixJ); + h0J_w_catboosted2_anti->Write(); + } + + TDirectory *d0_w_catvbflow_iso =fout->mkdir("mt_0jet_w_catvbflow_iso"); + d0_w_catvbflow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbflow_iso->SetName(name.c_str()); + h0LT_w_catvbflow_iso->Add(h0J_w_catvbflow_iso); + h0LT_w_catvbflow_iso->Write(); + } + else{ + h0LT_w_catvbflow_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catvbflow_iso->Write(); + h0J_w_catvbflow_iso->SetName(name.c_str()+postfixJ); + h0J_w_catvbflow_iso->Write(); + } + TDirectory *d0_w_catvbflow_anti =fout->mkdir("mt_0jet_w_catvbflow_anti"); + d0_w_catvbflow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbflow_anti->SetName(name.c_str()); + h0LT_w_catvbflow_anti->Add(h0J_w_catvbflow_anti); + h0LT_w_catvbflow_anti->Write(); + } + else{ + h0LT_w_catvbflow_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catvbflow_anti->Write(); + h0J_w_catvbflow_anti->SetName(name.c_str()+postfixJ); + h0J_w_catvbflow_anti->Write(); + } + + TDirectory *d0_w_catvbfhigh_iso =fout->mkdir("mt_0jet_w_catvbfhigh_iso"); + d0_w_catvbfhigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbfhigh_iso->SetName(name.c_str()); + h0LT_w_catvbfhigh_iso->Add(h0J_w_catvbfhigh_iso); + h0LT_w_catvbfhigh_iso->Write(); + } + else{ + h0LT_w_catvbfhigh_iso->SetName(name.c_str()+postfixLT); + h0LT_w_catvbfhigh_iso->Write(); + h0J_w_catvbfhigh_iso->SetName(name.c_str()+postfixJ); + h0J_w_catvbfhigh_iso->Write(); + } + TDirectory *d0_w_catvbfhigh_anti =fout->mkdir("mt_0jet_w_catvbfhigh_anti"); + d0_w_catvbfhigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_w_catvbfhigh_anti->SetName(name.c_str()); + h0LT_w_catvbfhigh_anti->Add(h0J_w_catvbfhigh_anti); + h0LT_w_catvbfhigh_anti->Write(); + } + else{ + h0LT_w_catvbfhigh_anti->SetName(name.c_str()+postfixLT); + h0LT_w_catvbfhigh_anti->Write(); + h0J_w_catvbfhigh_anti->SetName(name.c_str()+postfixJ); + h0J_w_catvbfhigh_anti->Write(); + } + + TDirectory *dmt_w_iso =fout->mkdir("mt_mt_w_iso"); dmt_w_iso->cd(); hmt_w_iso->SetName(name.c_str()); @@ -907,6 +1843,8 @@ int main(int argc, char** argv) { } + + fout->Close(); delete wmc; } diff --git a/FFcode/bin/Set1_correction_tt.cc b/FFcode/bin/Set1_correction_tt.cc index 83a70d7..b57898d 100644 --- a/FFcode/bin/Set1_correction_tt.cc +++ b/FFcode/bin/Set1_correction_tt.cc @@ -44,6 +44,7 @@ int main(int argc, char** argv) { std::string sample = *(argv + 3); std::string name = *(argv + 4); std::string year = *(argv + 5); + std::string apply_corrections = *(argv + 6); TFile *f_Double = new TFile(input.c_str()); cout<<"XXXXXXXXXXXXX "<Sumw2(); TH1F* h0SSlooseJ_qcd_tau1pt_anti = new TH1F ("h0SSlooseJ_qcd_tau1pt_anti","h0SSlooseJ_qcd_tau1pt_anti",binnum_mtttau1pt0,bins_mtttau1pt0); h0SSlooseJ_qcd_tau1pt_anti->Sumw2(); + TH2F* h0LT_qcd_cat0jet_iso = new TH2F ("h0LT_qcd_cat0jet_iso","h0LT_qcd_cat0jet_iso",binnum_mttcat0jet0,bins_mttcat0jet0,binnum_mttcat0jet1,bins_mttcat0jet1); h0LT_qcd_cat0jet_iso->Sumw2(); + TH2F* h0LT_qcd_cat0jet_anti = new TH2F ("h0LT_qcd_cat0jet_anti","h0LT_qcd_cat0jet_anti",binnum_mttcat0jet0,bins_mttcat0jet0,binnum_mttcat0jet1,bins_mttcat0jet1); h0LT_qcd_cat0jet_anti->Sumw2(); + TH2F* h0J_qcd_cat0jet_iso = new TH2F ("h0J_qcd_cat0jet_iso","h0J_qcd_cat0jet_iso",binnum_mttcat0jet0,bins_mttcat0jet0,binnum_mttcat0jet1,bins_mttcat0jet1); h0J_qcd_cat0jet_iso->Sumw2(); + TH2F* h0J_qcd_cat0jet_anti = new TH2F ("h0J_qcd_cat0jet_anti","h0J_qcd_cat0jet_anti",binnum_mttcat0jet0,bins_mttcat0jet0,binnum_mttcat0jet1,bins_mttcat0jet1); h0J_qcd_cat0jet_anti->Sumw2(); + + TH2F* h0LT_qcd_catboosted1_iso = new TH2F ("h0LT_qcd_catboosted1_iso","h0LT_qcd_catboosted1_iso",binnum_mttcatboosted10,bins_mttcatboosted10,binnum_mttcatboosted11,bins_mttcatboosted11); h0LT_qcd_catboosted1_iso->Sumw2(); + TH2F* h0LT_qcd_catboosted1_anti = new TH2F ("h0LT_qcd_catboosted1_anti","h0LT_qcd_catboosted1_anti",binnum_mttcatboosted10,bins_mttcatboosted10,binnum_mttcatboosted11,bins_mttcatboosted11); h0LT_qcd_catboosted1_anti->Sumw2(); + TH2F* h0J_qcd_catboosted1_iso = new TH2F ("h0J_qcd_catboosted1_iso","h0J_qcd_catboosted1_iso",binnum_mttcatboosted10,bins_mttcatboosted10,binnum_mttcatboosted11,bins_mttcatboosted11); h0J_qcd_catboosted1_iso->Sumw2(); + TH2F* h0J_qcd_catboosted1_anti = new TH2F ("h0J_qcd_catboosted1_anti","h0J_qcd_catboosted1_anti",binnum_mttcatboosted10,bins_mttcatboosted10,binnum_mttcatboosted11,bins_mttcatboosted11); h0J_qcd_catboosted1_anti->Sumw2(); + + TH2F* h0LT_qcd_catboosted2_iso = new TH2F ("h0LT_qcd_catboosted2_iso","h0LT_qcd_catboosted2_iso",binnum_mttcatboosted20,bins_mttcatboosted20,binnum_mttcatboosted21,bins_mttcatboosted21); h0LT_qcd_catboosted2_iso->Sumw2(); + TH2F* h0LT_qcd_catboosted2_anti = new TH2F ("h0LT_qcd_catboosted2_anti","h0LT_qcd_catboosted2_anti",binnum_mttcatboosted20,bins_mttcatboosted20,binnum_mttcatboosted21,bins_mttcatboosted21); h0LT_qcd_catboosted2_anti->Sumw2(); + TH2F* h0J_qcd_catboosted2_iso = new TH2F ("h0J_qcd_catboosted2_iso","h0J_qcd_catboosted2_iso",binnum_mttcatboosted20,bins_mttcatboosted20,binnum_mttcatboosted21,bins_mttcatboosted21); h0J_qcd_catboosted2_iso->Sumw2(); + TH2F* h0J_qcd_catboosted2_anti = new TH2F ("h0J_qcd_catboosted2_anti","h0J_qcd_catboosted2_anti",binnum_mttcatboosted20,bins_mttcatboosted20,binnum_mttcatboosted21,bins_mttcatboosted21); h0J_qcd_catboosted2_anti->Sumw2(); + + TH2F* h0LT_qcd_catvbflow_iso = new TH2F ("h0LT_qcd_catvbflow_iso","h0LT_qcd_catvbflow_iso",binnum_mttcatvbflow0,bins_mttcatvbflow0,binnum_mttcatvbflow1,bins_mttcatvbflow1); h0LT_qcd_catvbflow_iso->Sumw2(); + TH2F* h0LT_qcd_catvbflow_anti = new TH2F ("h0LT_qcd_catvbflow_anti","h0LT_qcd_catvbflow_anti",binnum_mttcatvbflow0,bins_mttcatvbflow0,binnum_mttcatvbflow1,bins_mttcatvbflow1); h0LT_qcd_catvbflow_anti->Sumw2(); + TH2F* h0J_qcd_catvbflow_iso = new TH2F ("h0J_qcd_catvbflow_iso","h0J_qcd_catvbflow_iso",binnum_mttcatvbflow0,bins_mttcatvbflow0,binnum_mttcatvbflow1,bins_mttcatvbflow1); h0J_qcd_catvbflow_iso->Sumw2(); + TH2F* h0J_qcd_catvbflow_anti = new TH2F ("h0J_qcd_catvbflow_anti","h0J_qcd_catvbflow_anti",binnum_mttcatvbflow0,bins_mttcatvbflow0,binnum_mttcatvbflow1,bins_mttcatvbflow1); h0J_qcd_catvbflow_anti->Sumw2(); + + TH2F* h0LT_qcd_catvbfhigh_iso = new TH2F ("h0LT_qcd_catvbfhigh_iso","h0LT_qcd_catvbfhigh_iso",binnum_mttcatvbfhigh0,bins_mttcatvbfhigh0,binnum_mttcatvbfhigh1,bins_mttcatvbfhigh1); h0LT_qcd_catvbfhigh_iso->Sumw2(); + TH2F* h0LT_qcd_catvbfhigh_anti = new TH2F ("h0LT_qcd_catvbfhigh_anti","h0LT_qcd_catvbfhigh_anti",binnum_mttcatvbfhigh0,bins_mttcatvbfhigh0,binnum_mttcatvbfhigh1,bins_mttcatvbfhigh1); h0LT_qcd_catvbfhigh_anti->Sumw2(); + TH2F* h0J_qcd_catvbfhigh_iso = new TH2F ("h0J_qcd_catvbfhigh_iso","h0J_qcd_catvbfhigh_iso",binnum_mttcatvbfhigh0,bins_mttcatvbfhigh0,binnum_mttcatvbfhigh1,bins_mttcatvbfhigh1); h0J_qcd_catvbfhigh_iso->Sumw2(); + TH2F* h0J_qcd_catvbfhigh_anti = new TH2F ("h0J_qcd_catvbfhigh_anti","h0J_qcd_catvbfhigh_anti",binnum_mttcatvbfhigh0,bins_mttcatvbfhigh0,binnum_mttcatvbfhigh1,bins_mttcatvbfhigh1); h0J_qcd_catvbfhigh_anti->Sumw2(); + TH1F* h0LT_qcd_tau2pt_iso = new TH1F ("h0LT_qcd_tau2pt_iso","h0LT_qcd_tau2pt_iso",binnum_mtttau2pt0,bins_mtttau2pt0); h0LT_qcd_tau2pt_iso->Sumw2(); TH1F* h0LT_qcd_tau2pt_anti = new TH1F ("h0LT_qcd_tau2pt_anti","h0LT_qcd_tau2pt_anti",binnum_mtttau2pt0,bins_mtttau2pt0); h0LT_qcd_tau2pt_anti->Sumw2(); TH1F* h0SSlooseLT_qcd_tau2pt_iso = new TH1F ("h0SSlooseLT_qcd_tau2pt_iso","h0SSlooseLT_qcd_tau2pt_iso",binnum_mtttau2pt0,bins_mtttau2pt0); h0SSlooseLT_qcd_tau2pt_iso->Sumw2(); @@ -426,6 +478,9 @@ int main(int argc, char** argv) { TF1* ff_looseSSqcd_1jet=(TF1*) frawff.Get("rawFF_tt_qcd_1jetSSloose"); TF1* ff_looseSSqcd_2jet=(TF1*) frawff.Get("rawFF_tt_qcd_2jetSSloose"); + TFile ftau2closure ("FF_corrections_1.root"); + TF1* tau2closure=(TF1*) ftau2closure.Get("closure_tau2pt_tt_qcd"); + TauTriggerSFs2017* etsf=new TauTriggerSFs2017(string(std::getenv("CMSSW_BASE"))+"/src/TauAnalysisTools/TauTriggerSFs/data/tauTriggerEfficiencies2018.root","ditau", "2018", "tight", "MVAv2"); if (year=="2017") etsf=new TauTriggerSFs2017(string(std::getenv("CMSSW_BASE"))+"/src/TauAnalysisTools/TauTriggerSFs/data/tauTriggerEfficiencies2017.root","ditau", "2017", "loose", "MVAv2"); else if (year=="2016") etsf=new TauTriggerSFs2017(string(std::getenv("CMSSW_BASE"))+"/src/TauAnalysisTools/TauTriggerSFs/data/tauTriggerEfficiencies2017.root","ditau", "2016", "tight", "MVAv2"); @@ -612,6 +667,12 @@ int main(int argc, char** argv) { if (njets==1) ff_looseSSqcd=get_raw_FF(mytau1.Pt(),ff_looseSSqcd_1jet); else if (njets>1) ff_looseSSqcd=get_raw_FF(mytau1.Pt(),ff_looseSSqcd_2jet); + if (apply_corrections=="yes"){ + ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_0jet)*get_mvis_closure(mytau2.Pt(),tau2closure); + if (njets==1) ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_1jet)*get_mvis_closure(mytau2.Pt(),tau2closure); + else if (njets>1) ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_2jet)*get_mvis_closure(mytau2.Pt(),tau2closure); + } + if (!is_includedInEmbedded){ if (isL or isT){ @@ -682,6 +743,31 @@ int main(int argc, char** argv) { if (antiisoRegion && !iso2 && q_1*q_2>0) h0SSlooseLT_qcd_tau1pt_anti->Fill(mytau1.Pt(),aweight*weight2*ff_looseSSqcd); + if (njets==0 && signalRegion && iso2 && q_1*q_2>0) + h0LT_qcd_cat0jet_iso->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2); + if (njets==0 && antiisoRegion && iso2 && q_1*q_2>0) + h0LT_qcd_cat0jet_anti->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (njets==1 && signalRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catboosted1_iso->Fill((mytau1+mytau2+mymet).Pt(),(mytau1+mytau2).M(),aweight*weight2); + if (njets==1 && antiisoRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catboosted1_anti->Fill((mytau1+mytau2+mymet).Pt(),(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (njets>1 && ((mytau1+mytau2+mymet).Pt()<100 or fabs(jeta_1-jeta_2)<2.5) && signalRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catboosted2_iso->Fill((mytau1+mytau2+mymet).Pt(),(mytau1+mytau2).M(),aweight*weight2); + if (njets>1 && ((mytau1+mytau2+mymet).Pt()<100 or fabs(jeta_1-jeta_2)<2.5) && antiisoRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catboosted2_anti->Fill((mytau1+mytau2+mymet).Pt(),(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (njets>1 && fabs(jeta_1-jeta_2)>2.5 && (mytau1+mytau2+mymet).Pt()>100 && (mytau1+mytau2+mymet).Pt()<200 && signalRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catvbflow_iso->Fill(mjj,(mytau1+mytau2).M(),aweight*weight2); + if (njets>1 && fabs(jeta_1-jeta_2)>2.5 && (mytau1+mytau2+mymet).Pt()>100 && (mytau1+mytau2+mymet).Pt()<200 && antiisoRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catvbflow_anti->Fill(mjj,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (njets>1 && fabs(jeta_1-jeta_2)>2.5 && (mytau1+mytau2+mymet).Pt()>100 && signalRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catvbfhigh_iso->Fill(mjj,(mytau1+mytau2).M(),aweight*weight2); + if (njets>1 && fabs(jeta_1-jeta_2)>2.5 && (mytau1+mytau2+mymet).Pt()>100 && antiisoRegion && iso2 && q_1*q_2>0) + h0LT_qcd_catvbfhigh_anti->Fill(mjj,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + if (signalRegion && iso2 && q_1*q_2>0) h0LT_qcd_tau2pt_iso->Fill(mytau2.Pt(),aweight*weight2); if (antiisoRegion && iso2 && q_1*q_2>0) @@ -710,6 +796,31 @@ int main(int argc, char** argv) { if (antiisoRegion && !iso2 && q_1*q_2>0) h0SSlooseJ_qcd_tau1pt_anti->Fill(mytau1.Pt(),aweight*weight2*ff_looseSSqcd); + if (signalRegion && iso2 && q_1*q_2>0) + h0J_qcd_cat0jet_iso->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2); + if (antiisoRegion && iso2 && q_1*q_2>0) + h0J_qcd_cat0jet_anti->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (signalRegion && iso2 && q_1*q_2>0) + h0J_qcd_catboosted1_iso->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2); + if (antiisoRegion && iso2 && q_1*q_2>0) + h0J_qcd_catboosted1_anti->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (signalRegion && iso2 && q_1*q_2>0) + h0J_qcd_catboosted2_iso->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2); + if (antiisoRegion && iso2 && q_1*q_2>0) + h0J_qcd_catboosted2_anti->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (signalRegion && iso2 && q_1*q_2>0) + h0J_qcd_catvbflow_iso->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2); + if (antiisoRegion && iso2 && q_1*q_2>0) + h0J_qcd_catvbflow_anti->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + + if (signalRegion && iso2 && q_1*q_2>0) + h0J_qcd_catvbfhigh_iso->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2); + if (antiisoRegion && iso2 && q_1*q_2>0) + h0J_qcd_catvbfhigh_anti->Fill(1.0,(mytau1+mytau2).M(),aweight*weight2*ff_qcd); + if (signalRegion && iso2 && q_1*q_2>0) h0J_qcd_met_iso->Fill(mymet.Pt(),aweight*weight2); if (antiisoRegion && iso2 && q_1*q_2>0) @@ -804,6 +915,142 @@ int main(int argc, char** argv) { h0J_qcd_tau1pt_anti->Write(); } + TDirectory *d0_qcd_cat0jet_iso =fout->mkdir("tt_0jet_qcd_cat0jet_iso"); + d0_qcd_cat0jet_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jet_iso->SetName(name.c_str()); + h0LT_qcd_cat0jet_iso->Add(h0J_qcd_cat0jet_iso); + h0LT_qcd_cat0jet_iso->Write(); + } + else{ + h0LT_qcd_cat0jet_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jet_iso->Write(); + h0J_qcd_cat0jet_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jet_iso->Write(); + } + TDirectory *d0_qcd_cat0jet_anti =fout->mkdir("tt_0jet_qcd_cat0jet_anti"); + d0_qcd_cat0jet_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_cat0jet_anti->SetName(name.c_str()); + h0LT_qcd_cat0jet_anti->Add(h0J_qcd_cat0jet_anti); + h0LT_qcd_cat0jet_anti->Write(); + } + else{ + h0LT_qcd_cat0jet_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_cat0jet_anti->Write(); + h0J_qcd_cat0jet_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_cat0jet_anti->Write(); + } + + TDirectory *d0_qcd_catboosted2_iso =fout->mkdir("tt_0jet_qcd_catboosted2_iso"); + d0_qcd_catboosted2_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted2_iso->SetName(name.c_str()); + h0LT_qcd_catboosted2_iso->Add(h0J_qcd_catboosted2_iso); + h0LT_qcd_catboosted2_iso->Write(); + } + else{ + h0LT_qcd_catboosted2_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted2_iso->Write(); + h0J_qcd_catboosted2_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted2_iso->Write(); + } + TDirectory *d0_qcd_catboosted2_anti =fout->mkdir("tt_0jet_qcd_catboosted2_anti"); + d0_qcd_catboosted2_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted2_anti->SetName(name.c_str()); + h0LT_qcd_catboosted2_anti->Add(h0J_qcd_catboosted2_anti); + h0LT_qcd_catboosted2_anti->Write(); + } + else{ + h0LT_qcd_catboosted2_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted2_anti->Write(); + h0J_qcd_catboosted2_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted2_anti->Write(); + } + + TDirectory *d0_qcd_catboosted1_iso =fout->mkdir("tt_0jet_qcd_catboosted1_iso"); + d0_qcd_catboosted1_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted1_iso->SetName(name.c_str()); + h0LT_qcd_catboosted1_iso->Add(h0J_qcd_catboosted1_iso); + h0LT_qcd_catboosted1_iso->Write(); + } + else{ + h0LT_qcd_catboosted1_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted1_iso->Write(); + h0J_qcd_catboosted1_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted1_iso->Write(); + } + TDirectory *d0_qcd_catboosted1_anti =fout->mkdir("tt_0jet_qcd_catboosted1_anti"); + d0_qcd_catboosted1_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catboosted1_anti->SetName(name.c_str()); + h0LT_qcd_catboosted1_anti->Add(h0J_qcd_catboosted1_anti); + h0LT_qcd_catboosted1_anti->Write(); + } + else{ + h0LT_qcd_catboosted1_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catboosted1_anti->Write(); + h0J_qcd_catboosted1_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catboosted1_anti->Write(); + } + + TDirectory *d0_qcd_catvbflow_iso =fout->mkdir("tt_0jet_qcd_catvbflow_iso"); + d0_qcd_catvbflow_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbflow_iso->SetName(name.c_str()); + h0LT_qcd_catvbflow_iso->Add(h0J_qcd_catvbflow_iso); + h0LT_qcd_catvbflow_iso->Write(); + } + else{ + h0LT_qcd_catvbflow_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbflow_iso->Write(); + h0J_qcd_catvbflow_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbflow_iso->Write(); + } + TDirectory *d0_qcd_catvbflow_anti =fout->mkdir("tt_0jet_qcd_catvbflow_anti"); + d0_qcd_catvbflow_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbflow_anti->SetName(name.c_str()); + h0LT_qcd_catvbflow_anti->Add(h0J_qcd_catvbflow_anti); + h0LT_qcd_catvbflow_anti->Write(); + } + else{ + h0LT_qcd_catvbflow_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbflow_anti->Write(); + h0J_qcd_catvbflow_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbflow_anti->Write(); + } + + TDirectory *d0_qcd_catvbfhigh_iso =fout->mkdir("tt_0jet_qcd_catvbfhigh_iso"); + d0_qcd_catvbfhigh_iso->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbfhigh_iso->SetName(name.c_str()); + h0LT_qcd_catvbfhigh_iso->Add(h0J_qcd_catvbfhigh_iso); + h0LT_qcd_catvbfhigh_iso->Write(); + } + else{ + h0LT_qcd_catvbfhigh_iso->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbfhigh_iso->Write(); + h0J_qcd_catvbfhigh_iso->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbfhigh_iso->Write(); + } + TDirectory *d0_qcd_catvbfhigh_anti =fout->mkdir("tt_0jet_qcd_catvbfhigh_anti"); + d0_qcd_catvbfhigh_anti->cd(); + if (sample=="data_obs" or sample=="W"){ + h0LT_qcd_catvbfhigh_anti->SetName(name.c_str()); + h0LT_qcd_catvbfhigh_anti->Add(h0J_qcd_catvbfhigh_anti); + h0LT_qcd_catvbfhigh_anti->Write(); + } + else{ + h0LT_qcd_catvbfhigh_anti->SetName(name.c_str()+postfixLT); + h0LT_qcd_catvbfhigh_anti->Write(); + h0J_qcd_catvbfhigh_anti->SetName(name.c_str()+postfixJ); + h0J_qcd_catvbfhigh_anti->Write(); + } + + TDirectory *d0_qcd_tau2pt_iso =fout->mkdir("tt_0jet_qcd_tau2pt_iso"); d0_qcd_tau2pt_iso->cd(); if (sample=="data_obs" or sample=="W"){ diff --git a/FFcode/python/Closure.py b/FFcode/python/Closure.py new file mode 100644 index 0000000..b44ab38 --- /dev/null +++ b/FFcode/python/Closure.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python +import argparse +import os +import ComputeFF2018.FFcode.Subtract_prompt as Subtract_prompt +import ComputeFF2018.FFcode.Subtract_prompt_tt as Subtract_prompt_tt + +def Closure(args): + if args.year == "2016": + if args.channel == "mt": + path = '/data/ccaillol/smhmt2016_svfitted_12oct/' + if args.channel == "et": + path = '/data/ccaillol/smhet2016_svfitted_12oct/' + if args.channel == "tt": + path = '/data/ccaillol/smhtt2016_12oct/' + elif args.year == "2017": + if args.channel == "mt": + path = '/data/ccaillol/smhmt2017_svfitted_12oct/' + if args.channel == "et": + path = '/data/ccaillol/smhet2017_svfitted_12oct/' + if args.channel == "tt": + path = '/data/ccaillol/smhtt2017_12oct/' + elif args.year == "2018": + if args.channel == "mt": + path = '/data/ccaillol/smhmt2018_svfitted_12oct/' + if args.channel == "et": + path = '/data/ccaillol/smhet2018_svfitted_12oct/' + if args.channel == "tt": + path = '/data/ccaillol/smhtt2018_12oct/' + + #figure out our executable and our output directory + if args.channel == 'mt': + executable = "Set1_correction_mt" + outputPath = os.environ['CMSSW_BASE']+'/src/ComputeFF2018/files_corr1FF_mt/' + elif args.channel == "et": + executable = "Set1_correction_et" + outputPath = os.environ['CMSSW_BASE']+'/src/ComputeFF2018/files_corr1FF_et/' + elif args.channel == "tt": + executable = "Set1_correction_tt" + outputPath = os.environ['CMSSW_BASE']+'/src/ComputeFF2018/files_corr1FF_tt/' + + if args.year == '2018': + commandParams = [ + [executable,path+'DataA.root',outputPath+'DataA.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year,'yes'], + [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year,'yes'], + [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year,'yes'], + [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year,'yes'], + [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year,'yes'], + [executable,path+'TTToHadronic.root',outputPath+'TTToHadronic.root','TTToHadronic','TT',args.year,'yes'], + [executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2Nu.root',' TTTo2L2Nu','TT',args.year,'yes'], + [executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonic.root','TTToSemiLeptonic','TT',args.year,'yes'], + [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year,'yes'], + [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year,'yes'], + [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year,'yes'], + [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year,'yes'], + [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year,'yes'], + [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year,'yes'], + [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year,'yes'], + ] + if args.channel == "et" or args.channel=="mt": + commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year,'yes']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year,'yes']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year,'yes']) + commandParams.append([executable,path+'TTToHadronic.root',outputPath+'TTToHadronicMC.root','TTToHadronic','TTMC',args.year,'yes']) + commandParams.append([executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2NuMC.root',' TTTo2L2Nu','TTMC',args.year,'yes']) + commandParams.append([executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonicMC.root','TTToSemiLeptonic','TTMC',args.year,'yes']) + haddFiles = { + "Data.root": [outputPath+"DataA.root",outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root"], + "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], + "TT.root": [outputPath+"TTToHadronic.root",outputPath+"TTToSemiLeptonic.root",outputPath+"TTTo2L2Nu.root"], + "VV.root": [outputPath+"WW.root",outputPath+"WZ.root",outputPath+"ZZ.root",outputPath+"ST_t_antitop.root",outputPath+"ST_t_top.root",outputPath+"ST_tW_antitop.root",outputPath+"ST_tW_top.root"] + } + if args.channel == "et" or args.channel=="mt": + haddFiles = { + "Data.root": [outputPath+"DataA.root",outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root"], + "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], + "TT.root": [outputPath+"TTToHadronic.root",outputPath+"TTToSemiLeptonic.root",outputPath+"TTTo2L2Nu.root"], + "VV.root": [outputPath+"WW.root",outputPath+"WZ.root",outputPath+"ZZ.root",outputPath+"ST_t_antitop.root",outputPath+"ST_t_top.root",outputPath+"ST_tW_antitop.root",outputPath+"ST_tW_top.root"], + "TTMC.root": [outputPath+"TTToHadronicMC.root",outputPath+"TTToSemiLeptonicMC.root",outputPath+"TTTo2L2NuMC.root"] + } + elif args.year =='2017': + commandParams = [ + [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataE.root',outputPath+'DataE.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataF.root',outputPath+'DataF.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year,'yes'], + [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year,'yes'], + [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year,'yes'], + [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year,'yes'], + [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year,'yes'], + [executable,path+'TTToHadronic.root',outputPath+'TTToHadronic.root','TTToHadronic','TT',args.year,'yes'], + [executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2Nu.root',' TTTo2L2Nu','TT',args.year,'yes'], + [executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonic.root','TTToSemiLeptonic','TT',args.year,'yes'], + [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year,'yes'], + [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year,'yes'], + [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year,'yes'], + [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year,'yes'], + [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year,'yes'], + [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year,'yes'], + [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year,'yes'] + ] + if args.channel == "et" or args.channel=="mt": + commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year,'yes']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year,'yes']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year,'yes']) + commandParams.append([executable,path+'TTToHadronic.root',outputPath+'TTToHadronicMC.root','TTToHadronic','TTMC',args.year,'yes']) + commandParams.append([executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2NuMC.root',' TTTo2L2Nu','TTMC',args.year,'yes']) + commandParams.append([executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonicMC.root','TTToSemiLeptonic','TTMC',args.year,'yes']) + haddFiles = { + "Data.root": [outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root",outputPath+"DataE.root",outputPath+"DataF.root"], + "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], + "TT.root": [outputPath+"TTToHadronic.root",outputPath+"TTToSemiLeptonic.root",outputPath+"TTTo2L2Nu.root"], + "VV.root": [outputPath+"WW.root",outputPath+"WZ.root",outputPath+"ZZ.root",outputPath+"ST_t_antitop.root",outputPath+"ST_t_top.root",outputPath+"ST_tW_antitop.root",outputPath+"ST_tW_top.root"] + } + if args.channel == "et" or args.channel=="mt": + haddFiles = { + "Data.root": [outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root",outputPath+"DataE.root",outputPath+"DataF.root"], + "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], + "TT.root": [outputPath+"TTToHadronic.root",outputPath+"TTToSemiLeptonic.root",outputPath+"TTTo2L2Nu.root"], + "VV.root": [outputPath+"WW.root",outputPath+"WZ.root",outputPath+"ZZ.root",outputPath+"ST_t_antitop.root",outputPath+"ST_t_top.root",outputPath+"ST_tW_antitop.root",outputPath+"ST_tW_top.root"], + "TTMC.root": [outputPath+"TTToHadronicMC.root",outputPath+"TTToSemiLeptonicMC.root",outputPath+"TTTo2L2NuMC.root"] + } + elif args.year =='2016': + commandParams = [ + [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataE.root',outputPath+'DataE.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataF.root',outputPath+'DataF.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataG.root',outputPath+'DataG.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DataH.root',outputPath+'DataH.root','data_obs','data_obs',args.year,'yes'], + [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year,'yes'], + [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year,'yes'], + [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year,'yes'], + [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year,'yes'], + [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year,'yes'], + [executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year,'yes'], + [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year,'yes'], + [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year,'yes'], + [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year,'yes'], + [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year,'yes'], + [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year,'yes'], + [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year,'yes'], + [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year,'yes'], + [executable,path+'ggH125.root',outputPath+'ggH_htt125.root','ggH_htt125','ggH_htt125',args.year,'yes'], + ] + if args.channel=="mt" or args.channel=="et": + commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year,'yes']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year,'yes']) + commandParams.append([executable,path+'TT.root',outputPath+'TTMC.root','TT','TTMC',args.year,'yes']) + haddFiles = { + "Data.root": [outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root",outputPath+"DataE.root",outputPath+"DataF.root",outputPath+"DataG.root",outputPath+"DataH.root"], + "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], + "VV.root": [outputPath+"WW.root",outputPath+"WZ.root",outputPath+"ZZ.root",outputPath+"ST_t_antitop.root",outputPath+"ST_t_top.root",outputPath+"ST_tW_antitop.root",outputPath+"ST_tW_top.root"] + } + #Run all sets + for command in commandParams: + commandString = '' + for element in command: + commandString+=element+' ' + os.system(commandString) + #hadd them + for haddedFile in haddFiles: + haddCommand = "hadd -f "+outputPath+haddedFile+' ' + for inputFile in haddFiles[haddedFile]: + haddCommand+=inputFile+' ' + os.system(haddCommand) + + #make the final mvisclosure file + finalMvisClosureCommand = "hadd -f mvisclosure_"+args.channel+"_afterCorrections.root " + finalMvisClosureCommand+=outputPath+"Data.root " + finalMvisClosureCommand+=outputPath+"DY.root " + if args.channel=="et" or args.channel=="mt": + finalMvisClosureCommand+=outputPath+"W.root " + finalMvisClosureCommand+=outputPath+"TT.root " + finalMvisClosureCommand+=outputPath+"VV.root " + os.system(finalMvisClosureCommand) + +if __name__=="__main__": + parser = argparse.ArgumentParser(description="Master fake factor making script") + parser.add_argument('--channel','-c',nargs="?",choices=['mt','et','tt'],help="Which channel?",required=True) + parser.add_argument('--year','-y',nargs="?",choices=["2016","2017","2018"],help="Which year?",required=True) + + args=parser.parse_args() + Closure(args) + diff --git a/FFcode/python/Draw_closure_et.py b/FFcode/python/Draw_closure_et.py new file mode 100755 index 0000000..372aee9 --- /dev/null +++ b/FFcode/python/Draw_closure_et.py @@ -0,0 +1,395 @@ +#!/usr/bin/env python +import ROOT +import re +from array import array +import argparse + +def add_lumi(datayear): + lowX=0.58 + lowY=0.835 + lumi = ROOT.TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC") + lumi.SetBorderSize( 0 ) + lumi.SetFillStyle( 0 ) + lumi.SetTextAlign( 12 ) + lumi.SetTextColor( 1 ) + lumi.SetTextSize(0.06) + lumi.SetTextFont ( 42 ) + if datayear=="2018": + lumi.AddText("2018, 59.7 fb^{-1} (13 TeV)") + elif datayear=="2017": + lumi.AddText("2017, 41.5 fb^{-1} (13 TeV)") + elif datayear=="2016": + lumi.AddText("2016, 35.9 fb^{-1} (13 TeV)") + return lumi + +def add_CMS(): + lowX=0.21 + lowY=0.70 + lumi = ROOT.TPaveText(lowX, lowY+0.06, lowX+0.15, lowY+0.16, "NDC") + lumi.SetTextFont(61) + lumi.SetTextSize(0.05) + lumi.SetBorderSize( 0 ) + lumi.SetFillStyle( 0 ) + lumi.SetTextAlign( 12 ) + lumi.SetTextColor( 1 ) + lumi.AddText("CMS Preliminary") + return lumi + +def add_Preliminary(): + lowX=0.21 + lowY=0.63 + lumi = ROOT.TPaveText(lowX, lowY+0.06, lowX+0.15, lowY+0.16, "NDC") + lumi.SetTextFont(52) + lumi.SetTextSize(0.06) + lumi.SetBorderSize( 0 ) + lumi.SetFillStyle( 0 ) + lumi.SetTextAlign( 12 ) + lumi.SetTextColor( 1 ) + lumi.AddText("Preliminary") + return lumi + +def make_legend(): + output = ROOT.TLegend(0.45, 0.64, 0.92, 0.86, "", "brNDC") + output.SetNColumns(2) + output.SetLineWidth(0) + output.SetLineStyle(0) + output.SetFillStyle(0) + output.SetBorderSize(0) + output.SetTextFont(62) + return output + +def Draw_closure_et(year,corrections,channel): + + ROOT.gStyle.SetFrameLineWidth(3) + ROOT.gStyle.SetLineWidth(3) + ROOT.gStyle.SetOptStat(0) + + c=ROOT.TCanvas("canvas","",0,0,600,600) + c.cd() + + + adapt=ROOT.gROOT.GetColor(12) + new_idx=ROOT.gROOT.GetListOfColors().GetSize() + 1 + trans=ROOT.TColor(new_idx, adapt.GetRed(), adapt.GetGreen(),adapt.GetBlue(), "",0.5) + + + categories=[channel+"_0jet_qcd_cat0jetlow_iso",channel+"_0jet_qcd_cat0jetlow_anti",channel+"_0jet_qcd_cat0jethigh_iso",channel+"_0jet_qcd_cat0jethigh_anti",channel+"_0jet_qcd_catboosted1_iso",channel+"_0jet_qcd_catboosted1_anti",channel+"_0jet_qcd_catboosted2_iso",channel+"_0jet_qcd_catboosted2_anti",channel+"_0jet_qcd_catvbflow_iso",channel+"_0jet_qcd_catvbflow_anti",channel+"_0jet_qcd_catvbfhigh_iso",channel+"_0jet_qcd_catvbfhigh_anti",channel+"_0jet_w_cat0jetlow_iso",channel+"_0jet_w_cat0jetlow_anti",channel+"_0jet_w_cat0jethigh_iso",channel+"_0jet_w_cat0jethigh_anti",channel+"_0jet_w_catboosted1_iso",channel+"_0jet_w_catboosted1_anti",channel+"_0jet_w_catboosted2_iso",channel+"_0jet_w_catboosted2_anti",channel+"_0jet_w_catvbflow_iso",channel+"_0jet_w_catvbflow_anti",channel+"_0jet_w_catvbfhigh_iso",channel+"_0jet_w_catvbfhigh_anti",channel+"_0jet_qcd_iso",channel+"_0jet_qcd_anti",channel+"_0jet_w_iso",channel+"_0jet_w_anti",channel+"_0jet_qcd_taupt_iso",channel+"_0jet_qcd_taupt_anti",channel+"_0jet_w_taupt_iso",channel+"_0jet_w_taupt_anti",channel+"_0jet_qcd_mjj_iso",channel+"_0jet_qcd_mjj_anti",channel+"_0jet_w_mjj_iso",channel+"_0jet_w_mjj_anti",channel+"_0jet_qcd_pth_iso",channel+"_0jet_qcd_pth_anti",channel+"_0jet_w_pth_iso",channel+"_0jet_w_pth_anti"] + ncat=40 + file=ROOT.TFile("mvisclosure_"+channel+".root","r") + if corrections=="after": + file=ROOT.TFile("mvisclosure_"+channel+"_afterCorrections.root","r") + + for i in range (0,ncat/2): + Data1=file.Get(categories[2*i]).Get("data_obs") + TT1=file.Get(categories[2*i]).Get("TTLT") + VV1=file.Get(categories[2*i]).Get("VVLT") + DY1=file.Get(categories[2*i]).Get("DYLT") + TTJ1=file.Get(categories[2*i]).Get("TTJ") + W1=file.Get(categories[2*i]).Get("W") + VVJ1=file.Get(categories[2*i]).Get("VVJ") + DYJ1=file.Get(categories[2*i]).Get("DYJ") + + DataA1=file.Get(categories[2*i+1]).Get("data_obs") + TTA1=file.Get(categories[2*i+1]).Get("TTLT") + VVA1=file.Get(categories[2*i+1]).Get("VVLT") + DYA1=file.Get(categories[2*i+1]).Get("DYLT") + TTJA1=file.Get(categories[2*i+1]).Get("TTJ") + WA1=file.Get(categories[2*i+1]).Get("W") + VVJA1=file.Get(categories[2*i+1]).Get("VVJ") + DYJA1=file.Get(categories[2*i+1]).Get("DYJ") + + print Data1.Integral(),DataA1.Integral() + + DataA=DataA1.Clone() + TTA=TTA1.Clone() + VVA=VVA1.Clone() + DYA=DYA1.Clone() + TTJA=TTJA1.Clone() + WA=WA1.Clone() + VVJA=VVJA1.Clone() + DYJA=DYJA1.Clone() + + Data=Data1.Clone() + TT=TT1.Clone() + VV=VV1.Clone() + DY=DY1.Clone() + TTJ=TTJ1.Clone() + W=W1.Clone() + VVJ=VVJ1.Clone() + DYJ=DYJ1.Clone() + + if "cat" in categories[2*i]: + DataA3=DataA.Clone() + TTA3=TTA.Clone() + VVA3=VVA.Clone() + DYA3=DYA.Clone() + DYJA3=DYJA.Clone() + TTJA3=TTJA.Clone() + WA3=WA.Clone() + VVJA3=VVJA.Clone() + Data3=Data.Clone() + TT3=TT.Clone() + VV3=VV.Clone() + DY3=DY.Clone() + DYJ3=DYJ.Clone() + TTJ3=TTJ.Clone() + W3=W.Clone() + VVJ3=VVJ.Clone() + nn=DataA3.GetSize() + nx=DataA3.GetXaxis().GetNbins() + ny=DataA3.GetYaxis().GetNbins() + Data=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TT=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VV=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DY=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TTJ=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + W=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VVJ=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DYJ=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DataA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TTA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VVA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DYA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TTJA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + WA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VVJA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DYJA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + dir1=nx + dir2=ny + l=0 + for j in range(1,dir1+1): + for k in range(1,dir2+1): + l=l+1 + n = DataA3.GetBin(j,k); + Data.SetBinContent(l,Data3.GetBinContent(n)) + Data.SetBinError(l,Data3.GetBinError(n)) + DY.SetBinContent(l,DY3.GetBinContent(n)) + DY.SetBinError(l,DY3.GetBinError(n)) + TT.SetBinContent(l,TT3.GetBinContent(n)) + TT.SetBinError(l,TT3.GetBinError(n)) + VV.SetBinContent(l,VV3.GetBinContent(n)) + VV.SetBinError(l,VV3.GetBinError(n)) + DYJ.SetBinContent(l,DYJ3.GetBinContent(n)) + DYJ.SetBinError(l,DYJ3.GetBinError(n)) + TTJ.SetBinContent(l,TTJ3.GetBinContent(n)) + TTJ.SetBinError(l,TTJ3.GetBinError(n)) + W.SetBinContent(l,W3.GetBinContent(n)) + W.SetBinError(l,W3.GetBinError(n)) + VVJ.SetBinContent(l,VVJ3.GetBinContent(n)) + VVJ.SetBinError(l,VVJ3.GetBinError(n)) + + DataA.SetBinContent(l,DataA3.GetBinContent(n)) + DataA.SetBinError(l,DataA3.GetBinError(n)) + DYA.SetBinContent(l,DYA3.GetBinContent(n)) + DYA.SetBinError(l,DYA3.GetBinError(n)) + TTA.SetBinContent(l,TTA3.GetBinContent(n)) + TTA.SetBinError(l,TTA3.GetBinError(n)) + VVA.SetBinContent(l,VVA3.GetBinContent(n)) + VVA.SetBinError(l,VVA3.GetBinError(n)) + DYJA.SetBinContent(l,DYJA3.GetBinContent(n)) + DYJA.SetBinError(l,DYJA3.GetBinError(n)) + TTJA.SetBinContent(l,TTJA3.GetBinContent(n)) + TTJA.SetBinError(l,TTJA3.GetBinError(n)) + WA.SetBinContent(l,WA3.GetBinContent(n)) + WA.SetBinError(l,WA3.GetBinError(n)) + VVJA.SetBinContent(l,VVJA3.GetBinContent(n)) + VVJA.SetBinError(l,VVJA3.GetBinError(n)) + + if "_qcd_" in categories[2*i]: + print WA.Integral(),DYJA.Integral() + DataA.Add(VVA,-1) + DataA.Add(VVJA,-1) + for j in range(1,WA.GetSize()): + WA.SetBinError(j,(WA.GetBinError(j)*WA.GetBinError(j)+0.20*0.20*WA.GetBinContent(j)*WA.GetBinContent(j))**0.5) + DataA.Add(WA,-1.0) + DataA.Add(TTA,-1) + DataA.Add(TTJA,-1) + DataA.Add(DYJA,-1) + for j in range(1,DYA.GetSize()): + DYA.SetBinError(j,(DYA.GetBinError(j)*DYA.GetBinError(j)+0.10*0.10*DYA.GetBinContent(j)*DYA.GetBinContent(j))**0.5) + DataA.Add(DYA,-1.0) + + Data.Add(VV,-1) + Data.Add(VVJ,-1) + for j in range(1,W.GetSize()): + W.SetBinError(j,(W.GetBinError(j)*W.GetBinError(j)+0.20*0.20*W.GetBinContent(j)*W.GetBinContent(j))**0.5) + Data.Add(W,-1.0) + Data.Add(TT,-1) + Data.Add(TTJ,-1) + Data.Add(DYJ,-1) + for j in range(1,DY.GetSize()): + DY.SetBinError(j,(DY.GetBinError(j)*DY.GetBinError(j)+0.10*0.10*DY.GetBinContent(j)*DY.GetBinContent(j))**0.5) + Data.Add(DY,-1.0) + + if "_w_" in categories[2*i]: + Data.Add(VV,-1) + Data.Add(VVJ,-1) + Data.Add(TT,-1) + Data.Add(TTJ,-1) + Data.Add(DYJ,-1) + for j in range(1,DY.GetSize()): + DY.SetBinError(j,(DY.GetBinError(j)*DY.GetBinError(j)+0.10*0.10*DY.GetBinContent(j)*DY.GetBinContent(j))**0.5) + Data.Add(DY,-1.0) + + DataA.Add(VVA,-1) + DataA.Add(VVJA,-1) + DataA.Add(TTA,-1) + DataA.Add(TTJA,-1) + DataA.Add(DYJA,-1) + for j in range(1,DYA.GetSize()): + DYA.SetBinError(j,(DYA.GetBinError(j)*DYA.GetBinError(j)+0.10*0.10*DYA.GetBinContent(j)*DYA.GetBinContent(j))**0.5) + DataA.Add(DYA,-1.0) + + Data.GetXaxis().SetTitle("") + Data.GetXaxis().SetTitleSize(0) + Data.GetXaxis().SetNdivisions(505) + Data.GetYaxis().SetLabelFont(42) + Data.GetYaxis().SetLabelOffset(0.01) + Data.GetYaxis().SetLabelSize(0.06) + Data.GetYaxis().SetTitleSize(0.075) + Data.GetYaxis().SetTitleOffset(1.18) + Data.SetTitle("") + Data.GetYaxis().SetTitle("Events/bin") + + DataA.SetFillColor(ROOT.TColor.GetColor("#12cadd")) + DataA.SetLineColor(1) + + Data.SetMarkerStyle(20) + Data.SetMarkerSize(1) + Data.SetLineColor(1) + Data.SetLineWidth(2) + + errorBand = DataA.Clone() + errorBand.SetMarkerSize(0) + errorBand.SetFillColor(new_idx) + errorBand.SetFillStyle(3001) + errorBand.SetLineWidth(1) + + pad1 = ROOT.TPad("pad1","pad1",0,0.35,1,1) + pad1.Draw() + pad1.cd() + pad1.SetFillColor(0) + pad1.SetBorderMode(0) + pad1.SetBorderSize(10) + pad1.SetTickx(1) + pad1.SetTicky(1) + pad1.SetLeftMargin(0.18) + pad1.SetRightMargin(0.05) + pad1.SetTopMargin(0.122) + pad1.SetBottomMargin(0.026) + pad1.SetFrameFillStyle(0) + pad1.SetFrameLineStyle(0) + pad1.SetFrameLineWidth(3) + pad1.SetFrameBorderMode(0) + pad1.SetFrameBorderSize(10) + + Data.GetXaxis().SetLabelSize(0) + Data.SetMaximum(max(Data.GetMaximum()*1.5,errorBand.GetMaximum()*1.5)) + Data.SetMinimum(0.0) + Data.Draw("e0") + DataA.Draw("histsame") + errorBand.Draw("e2same") + Data.Draw("e0same") + + categ2 = ROOT.TPaveText(0.65, 0.6+0.013, 0.93, 0.6+0.155, "NDC") + categ2.SetBorderSize( 0 ) + categ2.SetFillStyle( 0 ) + categ2.SetTextAlign( 12 ) + categ2.SetTextSize ( 0.05 ) + categ2.SetTextColor( 1 ) + categ2.SetTextFont ( 42 ) + categ2.AddText("KS prob. = %.5f" %(Data.KolmogorovTest(DataA))) + categ2.Draw("same") + + categ3 = ROOT.TPaveText(0.65, 0.5+0.013, 0.93, 0.5+0.12, "NDC") + categ3.SetBorderSize( 0 ) + categ3.SetFillStyle( 0 ) + categ3.SetTextAlign( 12 ) + categ3.SetTextSize ( 0.05 ) + categ3.SetTextColor( 1 ) + categ3.SetTextFont ( 42 ) + categ3.AddText("Observed: %.1f" %(Data.Integral())) + categ3.AddText("Predicted: %.1f" %(DataA.Integral())) + print Data.Integral(),DataA.Integral() + categ3.Draw("same") + + + legende=make_legend() + legende.AddEntry(Data,"Observed","elp") + legende.AddEntry(DataA,"Predicted","f") + legende.AddEntry(errorBand,"Stat. unc.","f") + legende.Draw() + + l1=add_lumi(year) + l1.Draw("same") + l2=add_CMS() + l2.Draw("same") + l3=add_Preliminary() + + pad1.RedrawAxis() + + c.cd() + pad2 = ROOT.TPad("pad2","pad2",0,0,1,0.35); + pad2.SetTopMargin(0.05); + pad2.SetBottomMargin(0.35); + pad2.SetLeftMargin(0.18); + pad2.SetRightMargin(0.05); + pad2.SetTickx(1) + pad2.SetTicky(1) + pad2.SetFrameLineWidth(3) + pad2.SetGridx() + pad2.SetGridy() + pad2.Draw() + pad2.cd() + h1=Data.Clone() + h1.SetMaximum(1.5)#FIXME(1.5) + h1.SetMinimum(0.5)#FIXME(0.5) + h1.SetMarkerStyle(20) + h3=errorBand.Clone() + hwoE=errorBand.Clone() + for iii in range (1,hwoE.GetSize()-2): + hwoE.SetBinError(iii,0) + h3.Sumw2() + h1.Sumw2() + h1.SetStats(0) + h1.Divide(hwoE) + h3.Divide(hwoE) + h1.GetXaxis().SetTitle("Bin number") + if i==12 or i==13: + h1.GetXaxis().SetTitle("m_{vis} (GeV)") + if i==14 or i==15: + h1.GetXaxis().SetTitle("#tau_{h} p_{T} (GeV)") + if i==16 or i==17: + h1.GetXaxis().SetTitle("m_{jj} (GeV)") + if i==18 or i==19: + h1.GetXaxis().SetTitle("Higgs p_{T} (GeV)") + + h1.GetXaxis().SetLabelSize(0.08) + h1.GetYaxis().SetLabelSize(0.08) + h1.GetYaxis().SetTitle("Obs./Exp.") + h1.GetXaxis().SetNdivisions(505) + h1.GetYaxis().SetNdivisions(5) + + h1.GetXaxis().SetTitleSize(0.15) + h1.GetYaxis().SetTitleSize(0.15) + h1.GetYaxis().SetTitleOffset(0.56) + h1.GetXaxis().SetTitleOffset(1.04) + h1.GetXaxis().SetLabelSize(0.11) + h1.GetYaxis().SetLabelSize(0.11) + h1.GetXaxis().SetTitleFont(42) + h1.GetYaxis().SetTitleFont(42) + + h1.Draw("e0p") + h3.Draw("e2same") + + c.cd() + pad1.Draw() + + ROOT.gPad.RedrawAxis() + + c.Modified() + if corrections=="after": + c.SaveAs("closure_compa_"+categories[2*i]+"_afterCorrections.pdf") + else: + c.SaveAs("closure_compa_"+categories[2*i]+".pdf") + diff --git a/FFcode/python/Draw_closure_tt.py b/FFcode/python/Draw_closure_tt.py index 2a1eca8..cfb691e 100755 --- a/FFcode/python/Draw_closure_tt.py +++ b/FFcode/python/Draw_closure_tt.py @@ -58,7 +58,7 @@ def make_legend(): output.SetTextFont(62) return output -def Draw_closure_tt(year): +def Draw_closure_tt(year,corrections): ROOT.gStyle.SetFrameLineWidth(3) ROOT.gStyle.SetLineWidth(3) @@ -73,27 +73,114 @@ def Draw_closure_tt(year): trans=ROOT.TColor(new_idx, adapt.GetRed(), adapt.GetGreen(),adapt.GetBlue(), "",0.5) - categories=["tt_0jet_qcd_mvis_iso","tt_0jet_qcd_mvis_anti","tt_0jet_qcd_tau1pt_iso","tt_0jet_qcd_tau1pt_anti","tt_0jet_qcd_tau2pt_iso","tt_0jet_qcd_tau2pt_anti","tt_0jet_qcd_met_iso","tt_0jet_qcd_met_anti","tt_0SSloose_qcd_mvis_iso","tt_0SSloose_qcd_mvis_anti","tt_0SSloose_qcd_tau1pt_iso","tt_0SSloose_qcd_tau1pt_anti","tt_0SSloose_qcd_tau2pt_iso","tt_0SSloose_qcd_tau2pt_anti","tt_0SSloose_qcd_met_iso","tt_0SSloose_qcd_met_anti","tt_0jet_qcd_j1pt_iso","tt_0jet_qcd_j1pt_anti","tt_0jet_qcd_tau1eta_iso","tt_0jet_qcd_tau1eta_anti","tt_0jet_qcd_pth_iso","tt_0jet_qcd_pth_anti","tt_0jet_qcd_mjj_iso","tt_0jet_qcd_mjj_anti"] - ncat=24 + categories=["tt_0jet_qcd_mvis_iso","tt_0jet_qcd_mvis_anti","tt_0jet_qcd_tau1pt_iso","tt_0jet_qcd_tau1pt_anti","tt_0jet_qcd_tau2pt_iso","tt_0jet_qcd_tau2pt_anti","tt_0jet_qcd_met_iso","tt_0jet_qcd_met_anti","tt_0SSloose_qcd_mvis_iso","tt_0SSloose_qcd_mvis_anti","tt_0SSloose_qcd_tau1pt_iso","tt_0SSloose_qcd_tau1pt_anti","tt_0SSloose_qcd_tau2pt_iso","tt_0SSloose_qcd_tau2pt_anti","tt_0SSloose_qcd_met_iso","tt_0SSloose_qcd_met_anti","tt_0jet_qcd_j1pt_iso","tt_0jet_qcd_j1pt_anti","tt_0jet_qcd_tau1eta_iso","tt_0jet_qcd_tau1eta_anti","tt_0jet_qcd_pth_iso","tt_0jet_qcd_pth_anti","tt_0jet_qcd_mjj_iso","tt_0jet_qcd_mjj_anti","tt_0jet_qcd_cat0jet_iso","tt_0jet_qcd_cat0jet_anti","tt_0jet_qcd_catboosted1_iso","tt_0jet_qcd_catboosted1_anti","tt_0jet_qcd_catboosted2_iso","tt_0jet_qcd_catboosted2_anti","tt_0jet_qcd_catvbflow_iso","tt_0jet_qcd_catvbflow_anti","tt_0jet_qcd_catvbfhigh_iso","tt_0jet_qcd_catvbfhigh_anti"] + ncat=34 file=ROOT.TFile("mvisclosure_tt.root","r") + if corrections=="after": + file=ROOT.TFile("mvisclosure_tt_afterCorrections.root","r") for i in range (0,ncat/2): - Data=file.Get(categories[2*i]).Get("data_obs") - TT=file.Get(categories[2*i]).Get("TTLT") - VV=file.Get(categories[2*i]).Get("STLT") - DY=file.Get(categories[2*i]).Get("DYLT") - TTJ=file.Get(categories[2*i]).Get("TTJ") - VVJ=file.Get(categories[2*i]).Get("STJ") - DYJ=file.Get(categories[2*i]).Get("DYJ") - - DataA=file.Get(categories[2*i+1]).Get("data_obs") - TTA=file.Get(categories[2*i+1]).Get("TTLT") - VVA=file.Get(categories[2*i+1]).Get("STLT") - DYA=file.Get(categories[2*i+1]).Get("DYLT") - TTJA=file.Get(categories[2*i+1]).Get("TTJ") - VVJA=file.Get(categories[2*i+1]).Get("STJ") - DYJA=file.Get(categories[2*i+1]).Get("DYJ") + Data1=file.Get(categories[2*i]).Get("data_obs") + TT1=file.Get(categories[2*i]).Get("TTLT") + VV1=file.Get(categories[2*i]).Get("STLT") + DY1=file.Get(categories[2*i]).Get("DYLT") + TTJ1=file.Get(categories[2*i]).Get("TTJ") + VVJ1=file.Get(categories[2*i]).Get("STJ") + DYJ1=file.Get(categories[2*i]).Get("DYJ") + DataA1=file.Get(categories[2*i+1]).Get("data_obs") + TTA1=file.Get(categories[2*i+1]).Get("TTLT") + VVA1=file.Get(categories[2*i+1]).Get("STLT") + DYA1=file.Get(categories[2*i+1]).Get("DYLT") + TTJA1=file.Get(categories[2*i+1]).Get("TTJ") + VVJA1=file.Get(categories[2*i+1]).Get("STJ") + DYJA1=file.Get(categories[2*i+1]).Get("DYJ") + + DataA=DataA1.Clone() + TTA=TTA1.Clone() + VVA=VVA1.Clone() + DYA=DYA1.Clone() + TTJA=TTJA1.Clone() + VVJA=VVJA1.Clone() + DYJA=DYJA1.Clone() + + Data=Data1.Clone() + TT=TT1.Clone() + VV=VV1.Clone() + DY=DY1.Clone() + TTJ=TTJ1.Clone() + VVJ=VVJ1.Clone() + DYJ=DYJ1.Clone() + + if "cat" in categories[2*i]: + DataA3=DataA.Clone() + TTA3=TTA.Clone() + VVA3=VVA.Clone() + DYA3=DYA.Clone() + DYJA3=DYJA.Clone() + TTJA3=TTJA.Clone() + VVJA3=VVJA.Clone() + Data3=Data.Clone() + TT3=TT.Clone() + VV3=VV.Clone() + DY3=DY.Clone() + DYJ3=DYJ.Clone() + TTJ3=TTJ.Clone() + VVJ3=VVJ.Clone() + nn=DataA3.GetSize() + nx=DataA3.GetXaxis().GetNbins() + ny=DataA3.GetYaxis().GetNbins() + Data=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TT=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VV=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DY=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TTJ=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VVJ=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DYJ=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DataA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TTA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VVA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DYA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + TTJA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + VVJA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + DYJA=ROOT.TH1F("h1d","h1d",nx*ny,0,nx*ny) + dir1=nx + dir2=ny + l=0 + for j in range(1,dir1+1): + for k in range(1,dir2+1): + l=l+1 + n = DataA3.GetBin(j,k); + Data.SetBinContent(l,Data3.GetBinContent(n)) + Data.SetBinError(l,Data3.GetBinError(n)) + DY.SetBinContent(l,DY3.GetBinContent(n)) + DY.SetBinError(l,DY3.GetBinError(n)) + TT.SetBinContent(l,TT3.GetBinContent(n)) + TT.SetBinError(l,TT3.GetBinError(n)) + VV.SetBinContent(l,VV3.GetBinContent(n)) + VV.SetBinError(l,VV3.GetBinError(n)) + DYJ.SetBinContent(l,DYJ3.GetBinContent(n)) + DYJ.SetBinError(l,DYJ3.GetBinError(n)) + TTJ.SetBinContent(l,TTJ3.GetBinContent(n)) + TTJ.SetBinError(l,TTJ3.GetBinError(n)) + VVJ.SetBinContent(l,VVJ3.GetBinContent(n)) + VVJ.SetBinError(l,VVJ3.GetBinError(n)) + + DataA.SetBinContent(l,DataA3.GetBinContent(n)) + DataA.SetBinError(l,DataA3.GetBinError(n)) + DYA.SetBinContent(l,DYA3.GetBinContent(n)) + DYA.SetBinError(l,DYA3.GetBinError(n)) + TTA.SetBinContent(l,TTA3.GetBinContent(n)) + TTA.SetBinError(l,TTA3.GetBinError(n)) + VVA.SetBinContent(l,VVA3.GetBinContent(n)) + VVA.SetBinError(l,VVA3.GetBinError(n)) + DYJA.SetBinContent(l,DYJA3.GetBinContent(n)) + DYJA.SetBinError(l,DYJA3.GetBinError(n)) + TTJA.SetBinContent(l,TTJA3.GetBinContent(n)) + TTJA.SetBinError(l,TTJA3.GetBinError(n)) + VVJA.SetBinContent(l,VVJA3.GetBinContent(n)) + VVJA.SetBinError(l,VVJA3.GetBinError(n)) + Data.Add(TT,-1) Data.Add(TTJ,-1) Data.Add(VV,-1) @@ -152,11 +239,11 @@ def Draw_closure_tt(year): Data.GetXaxis().SetLabelSize(0) Data.SetMaximum(max(Data.GetMaximum()*1.5,errorBand.GetMaximum()*1.5)) - Data.SetMinimum(0.1) - Data.Draw("e") + Data.SetMinimum(0.0) + Data.Draw("e0") DataA.Draw("histsame") errorBand.Draw("e2same") - Data.Draw("esame") + Data.Draw("e0same") legende=make_legend() legende.AddEntry(Data,"Observed","elp") @@ -231,5 +318,8 @@ def Draw_closure_tt(year): ROOT.gPad.RedrawAxis() c.Modified() - c.SaveAs("closure_compa_"+categories[2*i]+".pdf") + if corrections=="after": + c.SaveAs("closure_compa_"+categories[2*i]+"_afterCorrections.pdf") + else: + c.SaveAs("closure_compa_"+categories[2*i]+".pdf") diff --git a/FFcode/python/FFmvisclosure.py b/FFcode/python/FFmvisclosure.py index 4c39840..1ad9dc5 100644 --- a/FFcode/python/FFmvisclosure.py +++ b/FFcode/python/FFmvisclosure.py @@ -40,33 +40,33 @@ def FFmvisclosure(args): if args.year == '2018': commandParams = [ - [executable,path+'DataA.root',outputPath+'DataA.root','data_obs','data_obs',args.year], - [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year], - [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year], - [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year], - [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year], - [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year], - [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year], - [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year], - [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year], - [executable,path+'TTToHadronic.root',outputPath+'TTToHadronic.root','TTToHadronic','TT',args.year], - [executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2Nu.root',' TTTo2L2Nu','TT',args.year], - [executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonic.root','TTToSemiLeptonic','TT',args.year], - [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year], - [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year], - [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year], - [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year], - [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year], - [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year], - [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year], + [executable,path+'DataA.root',outputPath+'DataA.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year,'no'], + [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year,'no'], + [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year,'no'], + [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year,'no'], + [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year,'no'], + [executable,path+'TTToHadronic.root',outputPath+'TTToHadronic.root','TTToHadronic','TT',args.year,'no'], + [executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2Nu.root',' TTTo2L2Nu','TT',args.year,'no'], + [executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonic.root','TTToSemiLeptonic','TT',args.year,'no'], + [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year,'no'], + [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year,'no'], + [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year,'no'], + [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year,'no'], + [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year,'no'], + [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year,'no'], + [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year,'no'], ] if args.channel == "et" or args.channel=="mt": - commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year]) - commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year]) - commandParams.append([executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year]) - commandParams.append([executable,path+'TTToHadronic.root',outputPath+'TTToHadronicMC.root','TTToHadronic','TTMC',args.year]) - commandParams.append([executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2NuMC.root',' TTTo2L2Nu','TTMC',args.year]) - commandParams.append([executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonicMC.root','TTToSemiLeptonic','TTMC',args.year]) + commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year,'no']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year,'no']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year,'no']) + commandParams.append([executable,path+'TTToHadronic.root',outputPath+'TTToHadronicMC.root','TTToHadronic','TTMC',args.year,'no']) + commandParams.append([executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2NuMC.root',' TTTo2L2Nu','TTMC',args.year,'no']) + commandParams.append([executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonicMC.root','TTToSemiLeptonic','TTMC',args.year,'no']) haddFiles = { "Data.root": [outputPath+"DataA.root",outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root"], "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], @@ -83,34 +83,34 @@ def FFmvisclosure(args): } elif args.year=='2017': commandParams = [ - [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year], - [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year], - [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year], - [executable,path+'DataE.root',outputPath+'DataE.root','data_obs','data_obs',args.year], - [executable,path+'DataF.root',outputPath+'DataF.root','data_obs','data_obs',args.year], - [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year], - [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year], - [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year], - [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year], - [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year], - [executable,path+'TTToHadronic.root',outputPath+'TTToHadronic.root','TTToHadronic','TT',args.year], - [executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2Nu.root',' TTTo2L2Nu','TT',args.year], - [executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonic.root','TTToSemiLeptonic','TT',args.year], - [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year], - [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year], - [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year], - [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year], - [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year], - [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year], - [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year] + [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataE.root',outputPath+'DataE.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataF.root',outputPath+'DataF.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year,'no'], + [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year,'no'], + [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year,'no'], + [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year,'no'], + [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year,'no'], + [executable,path+'TTToHadronic.root',outputPath+'TTToHadronic.root','TTToHadronic','TT',args.year,'no'], + [executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2Nu.root',' TTTo2L2Nu','TT',args.year,'no'], + [executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonic.root','TTToSemiLeptonic','TT',args.year,'no'], + [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year,'no'], + [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year,'no'], + [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year,'no'], + [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year,'no'], + [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year,'no'], + [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year,'no'], + [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year,'no'] ] if args.channel == "et" or args.channel=="mt": - commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year]) - commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year]) - commandParams.append([executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year]) - commandParams.append([executable,path+'TTToHadronic.root',outputPath+'TTToHadronicMC.root','TTToHadronic','TTMC',args.year]) - commandParams.append([executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2NuMC.root',' TTTo2L2Nu','TTMC',args.year]) - commandParams.append([executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonicMC.root','TTToSemiLeptonic','TTMC',args.year]) + commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year,'no']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year,'no']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC2.root','W','WMC2',args.year,'no']) + commandParams.append([executable,path+'TTToHadronic.root',outputPath+'TTToHadronicMC.root','TTToHadronic','TTMC',args.year,'no']) + commandParams.append([executable,path+'TTTo2L2Nu.root',outputPath+'TTTo2L2NuMC.root',' TTTo2L2Nu','TTMC',args.year,'no']) + commandParams.append([executable,path+'TTToSemiLeptonic.root',outputPath+'TTToSemiLeptonicMC.root','TTToSemiLeptonic','TTMC',args.year,'no']) haddFiles = { "Data.root": [outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root",outputPath+"DataE.root",outputPath+"DataF.root"], "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], @@ -127,32 +127,32 @@ def FFmvisclosure(args): } elif args.year=='2016': commandParams = [ - [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year], - [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year], - [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year], - [executable,path+'DataE.root',outputPath+'DataE.root','data_obs','data_obs',args.year], - [executable,path+'DataF.root',outputPath+'DataF.root','data_obs','data_obs',args.year], - [executable,path+'DataG.root',outputPath+'DataG.root','data_obs','data_obs',args.year], - [executable,path+'DataH.root',outputPath+'DataH.root','data_obs','data_obs',args.year], - [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year], - [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year], - [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year], - [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year], - [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year], - [executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year], - [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year], - [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year], - [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year], - [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year], - [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year], - [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year], - [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year], - [executable,path+'ggH125.root',outputPath+'ggH_htt125.root','ggH_htt125','ggH_htt125',args.year], + [executable,path+'DataB.root',outputPath+'DataB.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataC.root',outputPath+'DataC.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataD.root',outputPath+'DataD.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataE.root',outputPath+'DataE.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataF.root',outputPath+'DataF.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataG.root',outputPath+'DataG.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DataH.root',outputPath+'DataH.root','data_obs','data_obs',args.year,'no'], + [executable,path+'DY.root',outputPath+'DYincl.root','DY','DY',args.year,'no'], + [executable,path+'DY1.root',outputPath+'DY1.root','DY','DY',args.year,'no'], + [executable,path+'DY2.root',outputPath+'DY2.root','DY','DY',args.year,'no'], + [executable,path+'DY3.root',outputPath+'DY3.root','DY','DY',args.year,'no'], + [executable,path+'DY4.root',outputPath+'DY4.root','DY','DY',args.year,'no'], + [executable,path+'TT.root',outputPath+'TT.root','TT','TT',args.year,'no'], + [executable,path+'WW.root',outputPath+'WW.root','WW','VV',args.year,'no'], + [executable,path+'WZ.root',outputPath+'WZ.root','WZ','VV',args.year,'no'], + [executable,path+'ZZ.root',outputPath+'ZZ.root','ZZ','VV',args.year,'no'], + [executable,path+'ST_t_antitop.root',outputPath+'ST_t_antitop.root','ST_t_antitop','ST',args.year,'no'], + [executable,path+'ST_t_top.root',outputPath+'ST_t_top.root','ST_t_top','ST',args.year,'no'], + [executable,path+'ST_tW_antitop.root',outputPath+'ST_tW_antitop.root','ST_tW_antitop','ST',args.year,'no'], + [executable,path+'ST_tW_top.root',outputPath+'ST_tW_top.root','ST_tW_top','ST',args.year,'no'], + [executable,path+'ggH125.root',outputPath+'ggH_htt125.root','ggH_htt125','ggH_htt125',args.year,'no'], ] if args.channel=="mt" or args.channel=="et": - commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year]) - commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year]) - commandParams.append([executable,path+'TT.root',outputPath+'TTMC.root','TT','TTMC',args.year]) + commandParams.append([executable,path+'Wall.root',outputPath+'W.root','W','W',args.year,'no']) + commandParams.append([executable,path+'Wall.root',outputPath+'WMC.root','W','WMC',args.year,'no']) + commandParams.append([executable,path+'TT.root',outputPath+'TTMC.root','TT','TTMC',args.year,'no']) haddFiles = { "Data.root": [outputPath+"DataB.root",outputPath+"DataC.root",outputPath+"DataD.root",outputPath+"DataE.root",outputPath+"DataF.root",outputPath+"DataG.root",outputPath+"DataH.root"], "DY.root": [outputPath+"DYincl.root",outputPath+"DY1.root",outputPath+"DY2.root",outputPath+"DY3.root",outputPath+"DY4.root"], @@ -179,7 +179,7 @@ def FFmvisclosure(args): #this one has to specifically be done here because the file for weighting doesn't even exist until the fits are done. if (args.channel=="et" or args.channel=="mt"): - os.system(executable+" "+path+"Wall.root"+" "+outputPath+"WMC2.root W WMC2 "+args.year) + os.system(executable+" "+path+"Wall.root"+" "+outputPath+"WMC2.root W WMC2 "+args.year+" no") #make the final mvisclosure file finalMvisClosureCommand = "hadd -f mvisclosure_"+args.channel+".root " diff --git a/FFcode/python/Subtract_prompt.py b/FFcode/python/Subtract_prompt.py index 29b9a01..5817aa7 100755 --- a/FFcode/python/Subtract_prompt.py +++ b/FFcode/python/Subtract_prompt.py @@ -13,12 +13,13 @@ def Subtract_prompt(directory,channel): fileW=ROOT.TFile(directory+"/W.root","r") #MC histogram with real leptons fileDataSub=ROOT.TFile(directory+"/DataSub.root","recreate") #Data without real leptons - dir_qcd=[channel+"_0jet_qcd_anti",channel+"_0jet_qcd_iso",channel+"_0SSloose_qcd_anti",channel+"_0SSloose_qcd_iso",channel+"_1jet_qcd_anti",channel+"_1jet_qcd_iso",channel+"_1SSloose_qcd_anti",channel+"_1SSloose_qcd_iso"] - ncat_qcd=8 + dir_qcd=[channel+"_0jet_qcd_anti",channel+"_0jet_qcd_iso",channel+"_0SSloose_qcd_anti",channel+"_0SSloose_qcd_iso",channel+"_1jet_qcd_anti",channel+"_1jet_qcd_iso",channel+"_1SSloose_qcd_anti",channel+"_1SSloose_qcd_iso",channel+"_2jet_qcd_anti",channel+"_2jet_qcd_iso",channel+"_2SSloose_qcd_anti",channel+"_2SSloose_qcd_iso"] + ncat_qcd=12 if "corr1" in directory: print("corr1 subtraction") - ncat_qcd=4 + dir_qcd=[channel+"_0jet_qcd_anti",channel+"_0jet_qcd_iso",channel+"_0SSloose_qcd_anti",channel+"_0SSloose_qcd_iso",channel+"_0jet_qcd_mvis_anti",channel+"_0jet_qcd_mvis_iso",channel+"_1jet_qcd_mvis_anti",channel+"_1jet_qcd_mvis_iso",channel+"_2jet_qcd_mvis_anti",channel+"_2jet_qcd_mvis_iso"] + ncat_qcd=10 if "OSSSF" in directory: print("OSSSF subtraction") @@ -49,10 +50,11 @@ def Subtract_prompt(directory,channel): Data.Write() - dir_w=[channel+"_0jet_w_anti",channel+"_0jet_w_iso",channel+"_1jet_w_anti",channel+"_1jet_w_iso"] - ncat_w=4 + dir_w=[channel+"_0jet_w_anti",channel+"_0jet_w_iso",channel+"_1jet_w_anti",channel+"_1jet_w_iso",channel+"_2jet_w_anti",channel+"_2jet_w_iso"] + ncat_w=6 if "corr1" in directory: - ncat_w=2 + dir_w=[channel+"_0jet_w_anti",channel+"_0jet_w_iso",channel+"_0jet_w_mvis_anti",channel+"_0jet_w_mvis_iso",channel+"_1jet_w_mvis_anti",channel+"_1jet_w_mvis_iso",channel+"_2jet_w_mvis_anti",channel+"_2jet_w_mvis_iso"] + ncat_w=8 if "OSSSF" in directory: ncat_w=0 diff --git a/FFcode/scripts/MakeFFs.py b/FFcode/scripts/MakeFFs.py index 36391ac..4a32c08 100755 --- a/FFcode/scripts/MakeFFs.py +++ b/FFcode/scripts/MakeFFs.py @@ -4,11 +4,13 @@ import os import ComputeFF2018.FFcode.RawFF as RawFF import ComputeFF2018.FFcode.FFmvisclosure as FFmvisclosure +import ComputeFF2018.FFcode.Closure as Closure import ComputeFF2018.FFcode.FFOSSScorrection as FFOSSScorrection import ComputeFF2018.FFcode.ControlPlots as ControlPlots import ComputeFF2018.FFcode.Draw_raw as Draw_raw import ComputeFF2018.FFcode.Draw_raw_tt as Draw_raw_tt import ComputeFF2018.FFcode.Draw_closure_tt as Draw_closure_tt +import ComputeFF2018.FFcode.Draw_closure_et as Draw_closure_et import ComputeFF2018.FFcode.Draw_control_tt as Draw_control_tt parser = argparse.ArgumentParser(description="Master fake factor making script") @@ -35,27 +37,30 @@ os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/files_corr1FF_"+args.channel+"/*.root") os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/FF_corrections_1.root") os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/FF_QCDcorrectionOSSS.root") -os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/uncorrected_fakefactors_mt.root") +os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/uncorrected_fakefactors_"+args.channel+".root") if args.channel=="tt": os.system("rm "+os.environ["CMSSW_BASE"]+"/src/ComputeFF2018/files_control_"+args.channel+"/*.root") RawFF.RawFF(args) FFmvisclosure.FFmvisclosure(args) +Closure.Closure(args) FFOSSScorrection.FFOSSScorrection(args) if args.channel=="tt": ControlPlots.ControlPlots(args) Draw_raw_tt.Draw_raw_tt("raw",args.year) - #Draw_raw_tt.Draw_raw_tt("mvisclosure",args.year) Draw_raw_tt.Draw_raw_tt("osss",args.year) - Draw_closure_tt.Draw_closure_tt(args.year) + Draw_closure_tt.Draw_closure_tt(args.year,"before") + Draw_closure_tt.Draw_closure_tt(args.year,"after") Draw_control_tt.Draw_control_tt(args.year) else: Draw_raw.Draw_raw("raw",args.year,args.channel) Draw_raw.Draw_raw("mvisclosure",args.year,args.channel) Draw_raw.Draw_raw("osss",args.year,args.channel) + Draw_closure_et.Draw_closure_et(args.year,"before",args.channel) + Draw_closure_et.Draw_closure_et(args.year,"after",args.channel) os.system("mv *.pdf plots_"+args.channel+"_"+args.year) @@ -64,7 +69,10 @@ os.mkdir(finalPath) os.system("cp uncorrected_fakefactors_"+args.channel+".root "+finalPath) os.system("cp FF_corrections_1.root "+finalPath) -os.system("cp FF_QCDcorrectionOSSS.root "+finalPath) +if args.channel=="et" or args.channel=="mt": + os.system("cp FF_QCDcorrectionOSSS.root "+finalPath) +if args.channel=="tt": + os.system("cp FF_QCDcorrectionOSSS_tt.root "+finalPath) os.system("cp raw_FF_"+args.channel+".root "+finalPath) os.system("cp mvisclosure_"+args.channel+".root "+finalPath) os.system("cp OSSScorr_"+args.channel+".root "+finalPath) diff --git a/Fit_FF_et.cc b/Fit_FF_et.cc index 3994fee..05848ba 100644 --- a/Fit_FF_et.cc +++ b/Fit_FF_et.cc @@ -232,18 +232,22 @@ void Fit_FF_et(int year) { TF1* m11 = M_FR(1, "Line2Par", "files_rawFF_et/DataSub.root", "et_0jet_qcd_iso", "et_0jet_qcd_anti", "rawFF_et_qcd_0jet", Fit_Value_tau, fMin, fMax, year); TF1* m12 = M_FR(2, "Line2Par", "files_rawFF_et/DataSub.root", "et_1jet_qcd_iso", "et_1jet_qcd_anti", "rawFF_et_qcd_1jet", Fit_Value_tau, fMin, fMax, year); - TF1* m13 = M_FR(3, "Line2Par", "files_rawFF_et/DataSub.root", "et_0jet_w_iso", "et_0jet_w_anti", "rawFF_et_w_0jet", Fit_Value_tau, fMin, fMax, year); - TF1* m14 = M_FR(4, "Line2Par", "files_rawFF_et/DataSub.root", "et_1jet_w_iso", "et_1jet_w_anti", "rawFF_et_w_1jet", Fit_Value_tau, fMin, fMax, year); - TF1* m15 = M_FR(5, "Line2Par", "files_rawFF_et/DataSub.root", "et_0jet_tt_iso", "et_0jet_tt_anti", "rawFF_et_tt", Fit_Value_tau, fMin, fMax, year); + TF1* m13 = M_FR(3, "Line2Par", "files_rawFF_et/DataSub.root", "et_2jet_qcd_iso", "et_2jet_qcd_anti", "rawFF_et_qcd_2jet", Fit_Value_tau, fMin, fMax, year); + TF1* m14 = M_FR(4, "Line2Par", "files_rawFF_et/DataSub.root", "et_0jet_w_iso", "et_0jet_w_anti", "rawFF_et_w_0jet", Fit_Value_tau, fMin, fMax, year); + TF1* m15 = M_FR(5, "Line2Par", "files_rawFF_et/DataSub.root", "et_1jet_w_iso", "et_1jet_w_anti", "rawFF_et_w_1jet", Fit_Value_tau, fMin, fMax, year); + TF1* m16 = M_FR(6, "Line2Par", "files_rawFF_et/DataSub.root", "et_2jet_w_iso", "et_2jet_w_anti", "rawFF_et_w_2jet", Fit_Value_tau, fMin, fMax, year); + TF1* m17 = M_FR(7, "Line2Par", "files_rawFF_et/DataSub.root", "et_0jet_tt_iso", "et_0jet_tt_anti", "rawFF_et_tt", Fit_Value_tau, fMin, fMax, year); - TF1* m16 = M_FR(6, "Line2Par", "files_rawFF_et/W.root", "et_0jet_w_iso/W", "et_0jet_w_anti/W", "mc_rawFF_et_w_0jet", Fit_Value_tau, fMin, fMax, year); - TF1* m17 = M_FR(7, "Line2Par", "files_rawFF_et/W.root", "et_1jet_w_iso/W", "et_1jet_w_anti/W", "mc_rawFF_et_w_1jet", Fit_Value_tau, fMin, fMax, year); + TF1* m18 = M_FR(8, "Line2Par", "files_rawFF_et/W.root", "et_0jet_w_iso/W", "et_0jet_w_anti/W", "mc_rawFF_et_w_0jet", Fit_Value_tau, fMin, fMax, year); + TF1* m19 = M_FR(9, "Line2Par", "files_rawFF_et/W.root", "et_1jet_w_iso/W", "et_1jet_w_anti/W", "mc_rawFF_et_w_1jet", Fit_Value_tau, fMin, fMax, year); + TF1* m20 = M_FR(10, "Line2Par", "files_rawFF_et/W.root", "et_2jet_w_iso/W", "et_2jet_w_anti/W", "mc_rawFF_et_w_2jet", Fit_Value_tau, fMin, fMax, year); - TF1* m18 = M_FR(8, "Line2Par", "files_rawFF_et/DataSub.root", "et_0SSloose_qcd_iso", "et_0SSloose_qcd_anti", "rawFF_et_qcd_0jetSSloose", Fit_Value_tau, fMin, fMax, year); - TF1* m19 = M_FR(9, "Line2Par", "files_rawFF_et/DataSub.root", "et_1SSloose_qcd_iso", "et_1SSloose_qcd_anti", "rawFF_et_qcd_1jetSSloose", Fit_Value_tau, fMin, fMax, year); + TF1* m21 = M_FR(11, "Line2Par", "files_rawFF_et/DataSub.root", "et_0SSloose_qcd_iso", "et_0SSloose_qcd_anti", "rawFF_et_qcd_0jetSSloose", Fit_Value_tau, fMin, fMax, year); + TF1* m22 = M_FR(12, "Line2Par", "files_rawFF_et/DataSub.root", "et_1SSloose_qcd_iso", "et_1SSloose_qcd_anti", "rawFF_et_qcd_1jetSSloose", Fit_Value_tau, fMin, fMax, year); + TF1* m23 = M_FR(13, "Line2Par", "files_rawFF_et/DataSub.root", "et_2SSloose_qcd_iso", "et_2SSloose_qcd_anti", "rawFF_et_qcd_2jetSSloose", Fit_Value_tau, fMin, fMax, year); - TF1* m20 = M_FR(11, "Line2Par", "files_rawFF_et/TT.root", "et_0jet_tt_iso/TTJ", "et_0jet_tt_anti/TTJ", "mc_rawFF_et_tt", Fit_Value_tau, fMin, fMax, year); + TF1* m24 = M_FR(14, "Line2Par", "files_rawFF_et/TT.root", "et_0jet_tt_iso/TTJ", "et_0jet_tt_anti/TTJ", "mc_rawFF_et_tt", Fit_Value_tau, fMin, fMax, year); } diff --git a/Fit_FF_mt.cc b/Fit_FF_mt.cc index fb41be9..78313af 100644 --- a/Fit_FF_mt.cc +++ b/Fit_FF_mt.cc @@ -248,18 +248,22 @@ void Fit_FF_mt(int year) { TF1* m11 = M_FR(1, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0jet_qcd_iso", "mt_0jet_qcd_anti", "rawFF_mt_qcd_0jet", Fit_Value_tau, fMin, fMax, year); TF1* m12 = M_FR(2, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_1jet_qcd_iso", "mt_1jet_qcd_anti", "rawFF_mt_qcd_1jet", Fit_Value_tau, fMin, fMax, year); - TF1* m13 = M_FR(3, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0jet_w_iso", "mt_0jet_w_anti", "rawFF_mt_w_0jet", Fit_Value_tau, fMin, fMax, year); - TF1* m14 = M_FR(4, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_1jet_w_iso", "mt_1jet_w_anti", "rawFF_mt_w_1jet", Fit_Value_tau, fMin, fMax, year); - TF1* m15 = M_FR(5, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0jet_tt_iso", "mt_0jet_tt_anti", "rawFF_mt_tt", Fit_Value_tau, fMin, fMax, year); + TF1* m13 = M_FR(3, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_2jet_qcd_iso", "mt_2jet_qcd_anti", "rawFF_mt_qcd_2jet", Fit_Value_tau, fMin, fMax, year); + TF1* m14 = M_FR(4, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0jet_w_iso", "mt_0jet_w_anti", "rawFF_mt_w_0jet", Fit_Value_tau, fMin, fMax, year); + TF1* m15 = M_FR(5, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_1jet_w_iso", "mt_1jet_w_anti", "rawFF_mt_w_1jet", Fit_Value_tau, fMin, fMax, year); + TF1* m16 = M_FR(6, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_2jet_w_iso", "mt_2jet_w_anti", "rawFF_mt_w_2jet", Fit_Value_tau, fMin, fMax, year); + TF1* m17 = M_FR(7, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0jet_tt_iso", "mt_0jet_tt_anti", "rawFF_mt_tt", Fit_Value_tau, fMin, fMax, year); - TF1* m16 = M_FR(6, "Line2Par", "files_rawFF_mt/W.root", "mt_0jet_w_iso/W", "mt_0jet_w_anti/W", "mc_rawFF_mt_w_0jet", Fit_Value_tau, fMin, fMax, year); - TF1* m17 = M_FR(7, "Line2Par", "files_rawFF_mt/W.root", "mt_1jet_w_iso/W", "mt_1jet_w_anti/W", "mc_rawFF_mt_w_1jet", Fit_Value_tau, fMin, fMax, year); + TF1* m18 = M_FR(8, "Line2Par", "files_rawFF_mt/W.root", "mt_0jet_w_iso/W", "mt_0jet_w_anti/W", "mc_rawFF_mt_w_0jet", Fit_Value_tau, fMin, fMax, year); + TF1* m19 = M_FR(9, "Line2Par", "files_rawFF_mt/W.root", "mt_1jet_w_iso/W", "mt_1jet_w_anti/W", "mc_rawFF_mt_w_1jet", Fit_Value_tau, fMin, fMax, year); + TF1* m20 = M_FR(10, "Line2Par", "files_rawFF_mt/W.root", "mt_2jet_w_iso/W", "mt_2jet_w_anti/W", "mc_rawFF_mt_w_2jet", Fit_Value_tau, fMin, fMax, year); - TF1* m18 = M_FR(8, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0SSloose_qcd_iso", "mt_0SSloose_qcd_anti", "rawFF_mt_qcd_0jetSSloose", Fit_Value_tau, fMin, fMax, year); - TF1* m19 = M_FR(9, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_1SSloose_qcd_iso", "mt_1SSloose_qcd_anti", "rawFF_mt_qcd_1jetSSloose", Fit_Value_tau, fMin, fMax, year); + TF1* m21 = M_FR(11, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_0SSloose_qcd_iso", "mt_0SSloose_qcd_anti", "rawFF_mt_qcd_0jetSSloose", Fit_Value_tau, fMin, fMax, year); + TF1* m22 = M_FR(12, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_1SSloose_qcd_iso", "mt_1SSloose_qcd_anti", "rawFF_mt_qcd_1jetSSloose", Fit_Value_tau, fMin, fMax, year); + TF1* m23 = M_FR(13, "Line2Par", "files_rawFF_mt/DataSub.root", "mt_2SSloose_qcd_iso", "mt_2SSloose_qcd_anti", "rawFF_mt_qcd_2jetSSloose", Fit_Value_tau, fMin, fMax, year); - TF1* m20 = M_FR(11, "Line2Par", "files_rawFF_mt/TT.root", "mt_0jet_tt_iso/TTJ", "mt_0jet_tt_anti/TTJ", "mc_rawFF_mt_tt", Fit_Value_tau, fMin, fMax, year); + TF1* m24 = M_FR(14, "Line2Par", "files_rawFF_mt/TT.root", "mt_0jet_tt_iso/TTJ", "mt_0jet_tt_anti/TTJ", "mc_rawFF_mt_tt", Fit_Value_tau, fMin, fMax, year); } diff --git a/Fit_FFclosure_et.cc b/Fit_FFclosure_et.cc index 587be84..d2ba401 100644 --- a/Fit_FFclosure_et.cc +++ b/Fit_FFclosure_et.cc @@ -64,7 +64,7 @@ double fitFunction(double x, double par0, double par1) { } Double_t fitFunc_Exp3Par(Double_t *x, Double_t *par) { - return par[0] + par[1]* (x[0]-40); +return par[0] + par[1]*(TMath::Exp(par[2] * (x[0]-50)-par[3])); } Double_t fitFunc_Line2Par(Double_t *x, Double_t *par) { @@ -99,13 +99,23 @@ TF1 *M_FR(int WP, std::string type, std::string files, std::string num, std::str const int nPar = 2; // number of parameters in the fit TF1 * theFit = new TF1("theFit", fitFunc_Line2Par, fMin, fMax, nPar); - if (name.find("et_w") < 140) theFit = new TF1("theFit", fitFunc_Line3Par, fMin, fMax, 3); + if ((name.find("et_w") < 140 or name.find("et_ttmc") < 140 or name.find("et_qcd") < 140) && name.find("et_qcdloose") > 140) theFit = new TF1("theFit", fitFunc_Line3Par, fMin, fMax, 3); + if (name.find("t_0jet_qcd") < 140) theFit = new TF1("theFit", fitFunc_Exp3Par, fMin, fMax, 4); + theFit->SetParameter(0, 1.0); theFit->SetParameter(1, 0.01); theFit->SetParameter(2, 0.00001); theFit->SetParameter(3, 0.00000001); + if (name.find("t_0jet_qcd") < 140){ + theFit->SetParameter(0, 0.85); + theFit->SetParameter(1, 0.8); + theFit->SetParameter(2, -0.1); + theFit->SetParameter(3, -0.3); + } + + float xAxisMax = 500; TGraph_FR->Fit("theFit", "R0"); @@ -132,7 +142,7 @@ TF1 *M_FR(int WP, std::string type, std::string files, std::string num, std::str theFit->Draw("SAME"); theFit->SetLineColor(2); - if (name.find("et_w") > 140) { + if (!((name.find("et_w") < 140 or name.find("et_ttmc") < 140 or name.find("et_qcd") < 140) && name.find("et_qcdloose") > 140)) { // Up and down fits Double_t TauLegParameters[2]; theFit->GetParameters(TauLegParameters); @@ -232,12 +242,18 @@ void Fit_FFclosure_et(int year) { Double_t fMin = 0; Double_t fMax = 1000; - TF1* m11 = M_FR(1, "Line2Par", "files_corr1FF_et/DataSub.root", "et_0jet_qcd_iso", "et_0jet_qcd_anti", "closure_mvis_et_qcd", Fit_Value_tau, fMin, fMax, year); - TF1* m12 = M_FR(2, "Line2Par", "files_corr1FF_et/DataSub.root", "et_0SSloose_qcd_iso", "et_0SSloose_qcd_anti", "closure_mvis_et_qcdloose", Fit_Value_tau, fMin, fMax, year); - TF1* m13 = M_FR(3, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0jet_w_iso", "et_0jet_w_anti", "closure_mvis_et_w", Fit_Value_tau, fMin, fMax, year); - TF1* m15 = M_FR(5, "Line2Par", "files_corr1FF_et/DataSub.root", "et_0jet_tt_iso", "et_0jet_tt_anti", "closure_mvis_et_tt", Fit_Value_tau, fMin, fMax, year); - TF1* m17 = M_FR(7, "Line3Par", "files_corr1FF_et/WMC.root", "et_0jet_w_iso/WMC", "et_0jet_w_anti/WMC", "closure_mvis_et_wmc", Fit_Value_tau, fMin, fMax, year); - TF1* m18 = M_FR(8, "Line2Par", "files_corr1FF_et/TTMC.root", "et_0jet_tt_iso/TTMCJ", "et_0jet_tt_anti/TTMCJ", "closure_mvis_et_ttmc", Fit_Value_tau, fMin, fMax, year); + TF1* m11 = M_FR(1, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0jet_qcd_iso", "et_0jet_qcd_anti", "closure_mvis_et_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m12 = M_FR(2, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0jet_qcd_mvis_iso", "et_0jet_qcd_mvis_anti", "closure_mvis_et_0jet_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m13 = M_FR(3, "Line3Par", "files_corr1FF_et/DataSub.root", "et_1jet_qcd_mvis_iso", "et_1jet_qcd_mvis_anti", "closure_mvis_et_1jet_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m14 = M_FR(4, "Line3Par", "files_corr1FF_et/DataSub.root", "et_2jet_qcd_mvis_iso", "et_2jet_qcd_mvis_anti", "closure_mvis_et_2jet_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m15 = M_FR(5, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0SSloose_qcd_iso", "et_0SSloose_qcd_anti", "closure_mvis_et_qcdloose", Fit_Value_tau, fMin, fMax, year); + TF1* m16 = M_FR(6, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0jet_w_iso", "et_0jet_w_anti", "closure_mvis_et_w", Fit_Value_tau, fMin, fMax, year); + TF1* m17 = M_FR(7, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0jet_w_mvis_iso", "et_0jet_w_mvis_anti", "closure_mvis_et_0jet_w", Fit_Value_tau, fMin, fMax, year); + TF1* m18 = M_FR(8, "Line3Par", "files_corr1FF_et/DataSub.root", "et_1jet_w_mvis_iso", "et_1jet_w_mvis_anti", "closure_mvis_et_1jet_w", Fit_Value_tau, fMin, fMax, year); + TF1* m19 = M_FR(9, "Line3Par", "files_corr1FF_et/DataSub.root", "et_2jet_w_mvis_iso", "et_2jet_w_mvis_anti", "closure_mvis_et_2jet_w", Fit_Value_tau, fMin, fMax, year); + TF1* m20 = M_FR(10, "Line3Par", "files_corr1FF_et/DataSub.root", "et_0jet_tt_iso", "et_0jet_tt_anti", "closure_mvis_et_tt", Fit_Value_tau, fMin, fMax, year); + TF1* m21 = M_FR(11, "Line3Par", "files_corr1FF_et/WMC.root", "et_0jet_w_iso/WMC", "et_0jet_w_anti/WMC", "closure_mvis_et_wmc", Fit_Value_tau, fMin, fMax, year); + TF1* m22 = M_FR(12, "Line3Par", "files_corr1FF_et/TTMC.root", "et_0jet_tt_iso/TTMCJ", "et_0jet_tt_anti/TTMCJ", "closure_mvis_et_ttmc", Fit_Value_tau, fMin, fMax, year); } diff --git a/Fit_FFclosure_mt.cc b/Fit_FFclosure_mt.cc index a218248..8db0725 100644 --- a/Fit_FFclosure_mt.cc +++ b/Fit_FFclosure_mt.cc @@ -64,7 +64,7 @@ double fitFunction(double x, double par0, double par1) { } Double_t fitFunc_Exp3Par(Double_t *x, Double_t *par) { - return par[0] + par[1]* (x[0]-40); + return par[0] + par[1]*(TMath::Exp(par[2] * (x[0]-50)-par[3])); } Double_t fitFunc_Line2Par(Double_t *x, Double_t *par) { @@ -99,13 +99,22 @@ TF1 *M_FR(int WP, std::string type, std::string files, std::string num, std::str const int nPar = 2; // number of parameters in the fit TF1 * theFit = new TF1("theFit", fitFunc_Line2Par, fMin, fMax, nPar); - if (name.find("mt_w") < 140) theFit = new TF1("theFit", fitFunc_Line3Par, fMin, fMax, 3); + if ((name.find("et_w") < 140 or name.find("et_ttmc") < 140 or name.find("et_qcd") < 140) && name.find("et_qcdloose") > 140) theFit = new TF1("theFit", fitFunc_Line3Par, fMin, fMax, 3); + if (name.find("t_0jet_qcd") < 140) theFit = new TF1("theFit", fitFunc_Exp3Par, fMin, fMax, 4); + theFit->SetParameter(0, 1.0); theFit->SetParameter(1, 0.01); theFit->SetParameter(2, 0.00001); theFit->SetParameter(3, 0.00000001); + if (name.find("t_0jet_qcd") < 140){ + theFit->SetParameter(0, 0.9); + theFit->SetParameter(1, 0.8); + theFit->SetParameter(2, -0.1); + theFit->SetParameter(3, -0.3); + } + float xAxisMax = 500; TGraph_FR->Fit("theFit", "R0"); @@ -115,8 +124,8 @@ TF1 *M_FR(int WP, std::string type, std::string files, std::string num, std::str //TGraph_FR->GetYaxis()->SetRangeUser(0.00,1.5*yg[0]); TGraph_FR->GetYaxis()->SetRangeUser(0.0,2.00); TGraph_FR->GetYaxis()->SetTitle("Correction"); - TGraph_FR->GetXaxis()->SetRangeUser(0, 350); - TGraph_FR->GetXaxis()->SetTitle("m_{vis}(e,#tau_{h}) (GeV)"); + TGraph_FR->GetXaxis()->SetRangeUser(0, 400); + TGraph_FR->GetXaxis()->SetTitle("m_{vis}(#mu,#tau_{h}) (GeV)"); TGraph_FR->SetTitle(""); TGraph_FR->Draw("PAE"); TGraph_FR->SetLineWidth(3); @@ -132,7 +141,7 @@ TF1 *M_FR(int WP, std::string type, std::string files, std::string num, std::str theFit->Draw("SAME"); theFit->SetLineColor(2); - if (name.find("mt_w") > 140) { + if (!((name.find("et_w") < 140 or name.find("et_ttmc") < 140 or name.find("et_qcd") < 140) && name.find("et_qcdloose") > 140)) { // Up and down fits Double_t TauLegParameters[2]; theFit->GetParameters(TauLegParameters); @@ -232,12 +241,18 @@ void Fit_FFclosure_mt(int year) { Double_t fMin = 0; Double_t fMax = 1000; - TF1* m11 = M_FR(1, "Line2Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_qcd_iso", "mt_0jet_qcd_anti", "closure_mvis_mt_qcd", Fit_Value_tau, fMin, fMax, year); - TF1* m12 = M_FR(2, "Line2Par", "files_corr1FF_mt/DataSub.root", "mt_0SSloose_qcd_iso", "mt_0SSloose_qcd_anti", "closure_mvis_mt_qcdloose", Fit_Value_tau, fMin, fMax, year); - TF1* m13 = M_FR(3, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_w_iso", "mt_0jet_w_anti", "closure_mvis_mt_w", Fit_Value_tau, fMin, fMax, year); - TF1* m15 = M_FR(5, "Line2Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_tt_iso", "mt_0jet_tt_anti", "closure_mvis_mt_tt", Fit_Value_tau, fMin, fMax, year); - TF1* m17 = M_FR(7, "Line3Par", "files_corr1FF_mt/WMC.root", "mt_0jet_w_iso/WMC", "mt_0jet_w_anti/WMC", "closure_mvis_mt_wmc", Fit_Value_tau, fMin, fMax, year); - TF1* m18 = M_FR(8, "Line2Par", "files_corr1FF_mt/TTMC.root", "mt_0jet_tt_iso/TTMCJ", "mt_0jet_tt_anti/TTMCJ", "closure_mvis_mt_ttmc", Fit_Value_tau, fMin, fMax, year); + TF1* m11 = M_FR(1, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_qcd_iso", "mt_0jet_qcd_anti", "closure_mvis_mt_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m12 = M_FR(2, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_qcd_mvis_iso", "mt_0jet_qcd_mvis_anti", "closure_mvis_mt_0jet_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m13 = M_FR(3, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_1jet_qcd_mvis_iso", "mt_1jet_qcd_mvis_anti", "closure_mvis_mt_1jet_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m14 = M_FR(4, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_2jet_qcd_mvis_iso", "mt_2jet_qcd_mvis_anti", "closure_mvis_mt_2jet_qcd", Fit_Value_tau, fMin, fMax, year); + TF1* m15 = M_FR(5, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0SSloose_qcd_iso", "mt_0SSloose_qcd_anti", "closure_mvis_mt_qcdloose", Fit_Value_tau, fMin, fMax, year); + TF1* m16 = M_FR(6, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_w_iso", "mt_0jet_w_anti", "closure_mvis_mt_w", Fit_Value_tau, fMin, fMax, year); + TF1* m17 = M_FR(7, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_w_mvis_iso", "mt_0jet_w_mvis_anti", "closure_mvis_mt_0jet_w", Fit_Value_tau, fMin, fMax, year); + TF1* m18 = M_FR(8, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_1jet_w_mvis_iso", "mt_1jet_w_mvis_anti", "closure_mvis_mt_1jet_w", Fit_Value_tau, fMin, fMax, year); + TF1* m19 = M_FR(9, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_2jet_w_mvis_iso", "mt_2jet_w_mvis_anti", "closure_mvis_mt_2jet_w", Fit_Value_tau, fMin, fMax, year); + TF1* m20 = M_FR(10, "Line3Par", "files_corr1FF_mt/DataSub.root", "mt_0jet_tt_iso", "mt_0jet_tt_anti", "closure_mvis_mt_tt", Fit_Value_tau, fMin, fMax, year); + TF1* m21 = M_FR(11, "Line3Par", "files_corr1FF_mt/WMC.root", "mt_0jet_w_iso/WMC", "mt_0jet_w_anti/WMC", "closure_mvis_mt_wmc", Fit_Value_tau, fMin, fMax, year); + TF1* m22 = M_FR(12, "Line3Par", "files_corr1FF_mt/TTMC.root", "mt_0jet_tt_iso/TTMCJ", "mt_0jet_tt_anti/TTMCJ", "closure_mvis_mt_ttmc", Fit_Value_tau, fMin, fMax, year); }