#include #include #include #include #include void nt2() { TFile *f1 = TFile::Open("tt_final_new.root"); TH2D *h1; gDirectory->GetObject("third_tight_mu_pt_eta", h1); TH2D *h2; gDirectory->GetObject("third_loose_mu_pt_eta", h2); TH2D *nt2; gDirectory->GetObject("nt2_pt_eta", nt2); h1->Sumw2(kTRUE); h1->SetTitle("tight muons"); h2->Sumw2(kTRUE); h2->SetTitle("loose muons"); nt2->Sumw2(kTRUE); nt2->SetTitle("b-jets"); #if 1 /* 0 or 1 */ int nxg = 5, nyg = 10; // how many bins to merge int nxf = 2, nyf = 2; // the first bin to use / draw int nxl = 7, nyl = 9; // the last bin to use / draw h1->Rebin2D(nxg, nyg); h1->GetXaxis()->SetRange(nxf, nxl); h1->GetYaxis()->SetRange(nyf, nyl); h2->Rebin2D(nxg, nyg); h2->GetXaxis()->SetRange(nxf, nxl); h2->GetYaxis()->SetRange(nyf, nyl); nt2->Rebin2D(nxg, nyg); nt2->GetXaxis()->SetRange(nxf, nxl); nt2->GetYaxis()->SetRange(nyf, nyl); #endif /* 0 or 1 */ TH2D *f = ((TH2D*)(h1->Clone())); f->SetNameTitle("f", "tight/loose"); f->Divide(h2); double mul = 1.0; #if 0 /* 0 or 1 */ // use all entries if (h2->GetEntries() != 0.0) mul = h1->GetEntries() / h2->GetEntries(); #else /* 0 or 1 */ // use bins in the set bin ranges // if (h2->GetEffectiveEntries() != 0.0) mul = h1->GetEffectiveEntries() / h2->GetEffectiveEntries(); if (h2->Integral() != 0.0) mul = h1->Integral() / h2->Integral(); #endif /* 0 or 1 */ if (mul != 1.0) mul /= (1.0 - mul); TH2D *Nt3 = ((TH2D*)(nt2->Clone())); Nt3->SetNameTitle("Nt3", "normalized b-jets"); Nt3->Scale(mul); TCanvas *c1 = new TCanvas("c1", "c1", 800, 600); c1->Divide(2, 2); c1->cd(1); f->Draw("colz text e"); c1->cd(2); h1->Draw("colz text e"); c1->cd(3); nt2->Draw("colz text e"); c1->cd(4); Nt3->Draw("colz text e"); }