Skip to content

Commit

Permalink
3 jet muktiplicity bins in tt
Browse files Browse the repository at this point in the history
  • Loading branch information
ccaillol committed Nov 13, 2019
1 parent c554470 commit be719b0
Show file tree
Hide file tree
Showing 9 changed files with 500 additions and 41 deletions.
40 changes: 39 additions & 1 deletion FFcode/bin/ControlPlots_tt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ int main(int argc, char** argv) {
TH1F* h0_met_iso = new TH1F ("h0_met_iso","h0_met_iso",40,0,200); h0_met_iso->Sumw2();
TH1F* h0_met_anti = new TH1F ("h0_met_anti","h0_met_anti",40,0,200); h0_met_anti->Sumw2();

TH1F* h0_tau1eta_iso = new TH1F ("h0_tau1eta_iso","h0_tau1eta_iso",21,-2.1,2.1); h0_tau1eta_iso->Sumw2();
TH1F* h0_tau1eta_anti = new TH1F ("h0_tau1eta_anti","h0_tau1eta_anti",21,-2.1,2.1); h0_tau1eta_anti->Sumw2();

TH1F* h0_j1pt_iso = new TH1F ("h0_j1pt_iso","h0_j1pt_iso",20,0,200); h0_j1pt_iso->Sumw2();
TH1F* h0_j1pt_anti = new TH1F ("h0_j1pt_anti","h0_j1pt_anti",20,0,200); h0_j1pt_anti->Sumw2();

TH1F* h0_tau2pt_iso = new TH1F ("h0_tau2pt_iso","h0_tau2pt_iso",30,0,150); h0_tau2pt_iso->Sumw2();
TH1F* h0_tau2pt_anti = new TH1F ("h0_tau2pt_anti","h0_tau2pt_anti",30,0,150); h0_tau2pt_anti->Sumw2();

Expand All @@ -283,6 +289,7 @@ int main(int argc, char** argv) {
TFile frawff("uncorrected_fakefactors_tt.root");
TF1* ff_qcd_0jet=(TF1*) frawff.Get("rawFF_tt_qcd_0jet");
TF1* ff_qcd_1jet=(TF1*) frawff.Get("rawFF_tt_qcd_1jet");
TF1* ff_qcd_2jet=(TF1*) frawff.Get("rawFF_tt_qcd_2jet");

TFile fmvisclosure ("FF_QCDcorrectionOSSS_tt.root");
TF1* mvisclosure=(TF1*) fmvisclosure.Get("closure_OSSS_mvis_tt_qcd");
Expand Down Expand Up @@ -528,7 +535,8 @@ int main(int argc, char** argv) {
float weight2=1.0;

float FF=get_raw_FF(mytau1.Pt(),ff_qcd_0jet)*get_mvis_closure((mytau1+mytau2).M(),mvisclosure)*get_mvis_closure(mytau2.Pt(),tau2closure);
if (njets>0) FF=get_raw_FF(mytau1.Pt(),ff_qcd_1jet)*get_mvis_closure((mytau1+mytau2).M(),mvisclosure)*get_mvis_closure(mytau2.Pt(),tau2closure);
if (njets==1) FF=get_raw_FF(mytau1.Pt(),ff_qcd_1jet)*get_mvis_closure((mytau1+mytau2).M(),mvisclosure)*get_mvis_closure(mytau2.Pt(),tau2closure);
else if (njets>1) FF=get_raw_FF(mytau1.Pt(),ff_qcd_2jet)*get_mvis_closure((mytau1+mytau2).M(),mvisclosure)*get_mvis_closure(mytau2.Pt(),tau2closure);

if (!is_includedInEmbedded){
if (isL or isT){
Expand Down Expand Up @@ -556,6 +564,16 @@ int main(int argc, char** argv) {
h0_met_iso->Fill(mymet.Pt(),aweight*weight2);
if (antiisoRegion && iso2 && q_1*q_2<0)
h0_met_anti->Fill(mymet.Pt(),aweight*weight2*FF);

if (signalRegion && iso2 && q_1*q_2<0)
h0_j1pt_iso->Fill(jpt_1,aweight*weight2);
if (antiisoRegion && iso2 && q_1*q_2<0)
h0_j1pt_anti->Fill(jpt_1,aweight*weight2*FF);

if (signalRegion && iso2 && q_1*q_2<0)
h0_tau1eta_iso->Fill(mytau1.Eta(),aweight*weight2);
if (antiisoRegion && iso2 && q_1*q_2<0)
h0_tau1eta_anti->Fill(mytau1.Eta(),aweight*weight2*FF);
}
}

Expand Down Expand Up @@ -583,6 +601,26 @@ int main(int argc, char** argv) {
h0_met_anti->SetName(name.c_str());
h0_met_anti->Write();

TDirectory *d0_tau1eta_iso =fout->mkdir("tt_tau1eta_iso");
d0_tau1eta_iso->cd();
h0_tau1eta_iso->SetName(name.c_str());
h0_tau1eta_iso->Write();

TDirectory *d0_tau1eta_anti =fout->mkdir("tt_tau1eta_anti");
d0_tau1eta_anti->cd();
h0_tau1eta_anti->SetName(name.c_str());
h0_tau1eta_anti->Write();

TDirectory *d0_j1pt_iso =fout->mkdir("tt_j1pt_iso");
d0_j1pt_iso->cd();
h0_j1pt_iso->SetName(name.c_str());
h0_j1pt_iso->Write();

TDirectory *d0_j1pt_anti =fout->mkdir("tt_j1pt_anti");
d0_j1pt_anti->cd();
h0_j1pt_anti->SetName(name.c_str());
h0_j1pt_anti->Write();

TDirectory *d0_tau2pt_iso =fout->mkdir("tt_tau2pt_iso");
d0_tau2pt_iso->cd();
h0_tau2pt_iso->SetName(name.c_str());
Expand Down
4 changes: 3 additions & 1 deletion FFcode/bin/OSSScorrection_tt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ int main(int argc, char** argv) {
TFile frawff("uncorrected_fakefactors_tt.root");
TF1* ff_qcd_0jet=(TF1*) frawff.Get("rawFF_tt_qcd_0jetSSloose");
TF1* ff_qcd_1jet=(TF1*) frawff.Get("rawFF_tt_qcd_1jetSSloose");
TF1* ff_qcd_2jet=(TF1*) frawff.Get("rawFF_tt_qcd_2jetSSloose");

TFile fmvisclosure ("FF_corrections_tt.root");
TF1* mvisclosure_qcdloose=(TF1*) fmvisclosure.Get("closure_mvis_tt_qcdloose");
Expand Down Expand Up @@ -515,7 +516,8 @@ int main(int argc, char** argv) {
float myvar=(mytau1+mytau2).M();

float ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_0jet);//*get_mvis_closure(mytau2.Pt(),tau2closure);//*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose);
if (njets>0) ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_1jet);//*get_mvis_closure(mytau2.Pt(),tau2closure);//*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose);
if (njets==1) ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_1jet);//*get_mvis_closure(mytau2.Pt(),tau2closure);//*get_mvis_closure((myele+mytau).M(),mvisclosure_qcdloose);
else if (njets>1) ff_qcd=get_raw_FF(mytau1.Pt(),ff_qcd_2jet);

if (!is_includedInEmbedded){

Expand Down
97 changes: 87 additions & 10 deletions FFcode/bin/RawFF_tt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,22 @@ int main(int argc, char** argv) {

int nbhist=1;

float bins_mtt0[] = {40,45,50,55,60,70,80,90,100,110,120,150};
float bins_mtt0[] = {40,42,44,46,48,50,52,54,56,58,60,65,70,75,80,90,100,110,120,150};
int binnum_mtt0 = sizeof(bins_mtt0)/sizeof(Float_t) - 1;

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* 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* 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();
Expand All @@ -297,6 +301,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/";

Expand Down Expand Up @@ -535,38 +543,54 @@ int main(int argc, char** argv) {
h0LT_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets==0 && iso2 && q_1*q_2>0)
h0LT_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>0 && iso2 && q_1*q_2>0)
if (signalRegion && njets==1 && iso2 && q_1*q_2>0)
h1LT_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>0 && iso2 && q_1*q_2>0)
if (antiisoRegion && njets==1 && iso2 && q_1*q_2>0)
h1LT_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>1 && iso2 && q_1*q_2>0)
h2LT_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>1 && iso2 && q_1*q_2>0)
h2LT_qcd_anti->Fill(myvar,aweight*weight2);

if (signalRegion && njets==0 && !iso2 && q_1*q_2>0)
h0SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets==0 && !iso2 && q_1*q_2>0)
h0SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>0 && !iso2 && q_1*q_2>0)
if (signalRegion && njets==1 && !iso2 && q_1*q_2>0)
h1SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>0 && !iso2 && q_1*q_2>0)
if (antiisoRegion && njets==1 && !iso2 && q_1*q_2>0)
h1SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>1 && !iso2 && q_1*q_2>0)
h2SSlooseLT_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>1 && !iso2 && q_1*q_2>0)
h2SSlooseLT_qcd_anti->Fill(myvar,aweight*weight2);
}
else{
if (signalRegion && njets==0 && iso2 && q_1*q_2>0)
h0J_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets==0 && iso2 && q_1*q_2>0)
h0J_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>0 && iso2 && q_1*q_2>0)
if (signalRegion && njets==1 && iso2 && q_1*q_2>0)
h1J_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>0 && iso2 && q_1*q_2>0)
if (antiisoRegion && njets==1 && iso2 && q_1*q_2>0)
h1J_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>1 && iso2 && q_1*q_2>0)
h2J_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>1 && iso2 && q_1*q_2>0)
h2J_qcd_anti->Fill(myvar,aweight*weight2);

if (signalRegion && njets==0 && !iso2 && q_1*q_2>0)
h0SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets==0 && !iso2 && q_1*q_2>0)
h0SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>0 && !iso2 && q_1*q_2>0)
if (signalRegion && njets==1 && !iso2 && q_1*q_2>0)
h1SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>0 && !iso2 && q_1*q_2>0)
if (antiisoRegion && njets==1 && !iso2 && q_1*q_2>0)
h1SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2);
if (signalRegion && njets>1 && !iso2 && q_1*q_2>0)
h2SSlooseJ_qcd_iso->Fill(myvar,aweight*weight2);
if (antiisoRegion && njets>1 && !iso2 && q_1*q_2>0)
h2SSlooseJ_qcd_anti->Fill(myvar,aweight*weight2);

}

Expand Down Expand Up @@ -636,6 +660,33 @@ int main(int argc, char** argv) {
h1J_qcd_anti->Write();
}

TDirectory *d2_qcd_iso =fout->mkdir("tt_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("tt_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("tt_0SSloose_qcd_iso");
d0SSloose_qcd_iso->cd();
if (sample=="data_obs" or sample=="W"){
Expand Down Expand Up @@ -677,7 +728,6 @@ int main(int argc, char** argv) {
h1SSlooseJ_qcd_iso->SetName(name.c_str()+postfixJ);
h1SSlooseJ_qcd_iso->Write();
}

TDirectory *d1SSloose_qcd_anti =fout->mkdir("tt_1SSloose_qcd_anti");
d1SSloose_qcd_anti->cd();
if (sample=="data_obs" or sample=="W"){
Expand All @@ -692,6 +742,33 @@ int main(int argc, char** argv) {
h1SSlooseJ_qcd_anti->Write();
}

TDirectory *d2SSloose_qcd_iso =fout->mkdir("tt_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("tt_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();
}

fout->Close();
delete wmc;
}
Expand Down
Loading

0 comments on commit be719b0

Please sign in to comment.