void fakeratio_tqz1() { TFile *f = new TFile("May26_2.root"); TTree *t2 = (TTree*)f->Get("demo/AnaTree"); // TH2F *h2 = new TH2F("h2","hist_vetoMu",100,0,300,100,-3,3); // TH2F *h1 = new TH2F("h1","hist_SelMu",100,0,300,100,-3,3); // TH2F *h = new TH2F("h3","hist_ratio",100,0,300,100,-3,3); // h2->GetXaxis()->SetTitle("VetoMu_pt"); // h2->GetYaxis()->SetTitle("VetoMu_eta"); // h1->GetXaxis()->SetTitle("SelMu_pt"); // h1->GetYaxis()->SetTitle("SelMu_eta"); t2->Draw("VetoMu_eta:VetoMu_pt >> h2","","goff"); t2->Draw("SelMu_eta:SelMu_pt >> h1","","goff"); TCanvas *c1 = new TCanvas("c1","c1",800,600) ; c1->Divide(2,2); c1->cd(1); { double bins_x[] = {10, 20, 40, 70, 100}; double bins_y[] = {0, 1, 1.5, 2.5}; TH2F *h1 = new TH2F("tight mu", "tight muons;tight_Pt_{T}^{} [GeV/c];#eta", (sizeof(bins_x) / sizeof(double) - 1), bins_x, (sizeof(bins_y) / sizeof(double) - 1), bins_y); for (int i = 1; i <= h1->GetNbinsX(); i++) for (int j = 1; j <= h1->GetNbinsY(); j++) h1->SetBinContent(i, j, (i * i + j * j * j)); h1->Draw("colz texte"); } h1->Draw("colz texte"); c1->cd(2); { double bins_x[] = {10, 20, 40, 70, 100}; double bins_y[] = {0, 1, 1.5, 2.5}; TH2F *h2 = new TH2F("tight mu", "tight muons;tight_Pt_{T}^{} [GeV/c];#eta", (sizeof(bins_x) / sizeof(double) - 1), bins_x, (sizeof(bins_y) / sizeof(double) - 1), bins_y); for (int i = 1; i <= h2->GetNbinsX(); i++) for (int j = 1; j <= h2->GetNbinsY(); j++) h2->SetBinContent(i, j, (i * i + j * j * j)); h2->Draw("colz texte"); } h2->Draw("colz texte"); h = (TH2F*)h1->Clone(); // h->GetXaxis()->SetTitle("pt "); // h->GetYaxis()->SetTitle("eta "); // h->SetTitle("fake_h1/h2_without cuts"); h->Divide(h2); c1->cd(3); h->Draw("colz texte"); { double bins_x[] = {10, 20, 40, 70, 100}; double bins_y[] = {0, 1, 1.5, 2.5}; TH2F *h = new TH2F("ratio", "tight/loose;Pt_{T}^{} [GeV/c];#eta", (sizeof(bins_x) / sizeof(double) - 1), bins_x, (sizeof(bins_y) / sizeof(double) - 1), bins_y); for (int i = 1; i <= h->GetNbinsX(); i++) for (int j = 1; j <= h->GetNbinsY(); j++) h->SetBinContent(i, j, (i * i + j * j * j)); h->Draw("colz texte"); } }