// // plotter_skim.C // // // // // #include #include "TCanvas.h" #include "TAxis.h" #include "TH1.h" #include #include #include void plotter_stack() { // TCanvas *c1 = new TCanvas("c1","Canvas_1"); TCanvas *can =new TCanvas("plot","plot",700,800); gStyle->SetOptStat(0); gPad->SetLeftMargin(0.18); // gPad->SetLogy(1); can->SetTickx(1); can->SetTicky(1); TPad *pad1 = new TPad("pad1", "pad1", 0.00, 0.33, 1.00, 1.00); TPad *pad2 = new TPad("pad2", "pad2", 0.00, 0.00, 1.00, 0.33); pad1->SetLogy(); pad1->SetBottomMargin(0.00001); pad1->SetBorderMode(0); pad1->SetLeftMargin(0.14); pad1->SetTickx(1); pad1->SetTicky(1); pad2->SetTopMargin(0.00001); pad2->SetBottomMargin(0.4); pad2->SetBorderMode(0); pad2->SetLeftMargin(0.14); pad2->SetTickx(1); pad2->SetTicky(1); gStyle->SetOptTitle(kFALSE); pad1->Draw(); pad2->Draw(); pad1->cd(); // // // RS without BDT TFile *f1 = new TFile("RS_MC15ri_1ab_signal_woBDT.root"); TFile *f2 = new TFile("RS_MC15ri_1ab_bkg_woBDT.root"); TFile *f3 = new TFile("RS_data_421fb_total_woBDT.root"); //////////////////////////////////////////////// TH1F *h1; // Simulation signal TH1F *h2; // Simulation background TH1F *h3; // data TH1F *h4 = new TH1F("h4","ratio",200, -1, 1); // BDTG h1 = (TH1F*)f1->Get("BDTG"); h2 = (TH1F*)f2->Get("BDTG"); h3 = (TH1F*)f3->Get("BDTG"); // // h1 attributes h1->SetFillColor(kPink+1); h1->SetLineColor(kPink+1); // h1->SetMarkerStyle(20); h1->SetMarkerColor(kPink+1); h1->SetMinimum(1.); // h1->GetXaxis()->SetRangeUser(0, 90000); // // // h2 attributes h2->SetFillColor(kGreen+1); h2->SetLineColor(kGreen+1); // h2->SetMarkerStyle(20); h2->SetMarkerColor(kGreen+1); h2->SetMinimum(1.); // h2->GetXaxis()->SetRangeUser(0, 90000); // // h3 attributes h3->SetMarkerStyle(20); h3->SetMarkerSize(0.8); h3->SetLineColor(kBlack); h3->SetMinimum(1.); // h3->GetXaxis()->SetRangeUser(0, 90000); // // // stack histogram THStack *hs = new THStack("hs","Stacked 1D histograms"); hs->SetMinimum(0.0); hs->Add(h2); hs->Add(h1); // hs->Draw(); // hs->Draw("nostackb"); // hs->Draw("nostack"); // hs->Draw("pfc nostack"); hs->Draw("HIST E1 X0"); // hs->Draw("HIST"); TH1F *h = new TH1F(*((TH1F *)(hs->GetStack()->Last()))); // // Scale Double_t scale = (h->Integral())/(h3->Integral()); h3-> Scale(scale); h3->Draw("sames"); gPad->Update(); hs->GetXaxis()->SetTitle("BDTG"); hs->GetYaxis()->SetTitle("Candidates per 0.02"); hs->GetXaxis()->SetTitleSize(0.05); hs->GetYaxis()->SetTitleSize(0.05); hs->GetXaxis()->CenterTitle(); hs->GetYaxis()->CenterTitle(); // hs->SetMinimum(1.); TLegend *leg = new TLegend(0.62,0.62,0.76,0.84,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextAlign(12); leg->SetTextFont(42); leg->SetTextSize(0.03230543); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); leg->AddEntry(h1 ,"Simulation (signal)","f"); leg->AddEntry(h2,"Simulation (backgrond)","f"); leg->AddEntry(h3,"Data","P"); leg->Draw(); can->Update(); pad2->cd(); for(int l = 0; l< h3->GetNbinsX(); l++) { h4->SetBinContent(l+1, h3->GetBinContent(l+1)/h->GetBinContent(l+1)); } // h4->SetLineColor(kPink+9); h4->SetLineColor(kBlack); h4->GetXaxis()->SetTitle("BDTG"); h4->GetXaxis()->SetLabelSize(0.09); h4->GetXaxis()->SetTitleSize(0.10); h4->GetXaxis()->SetTickLength(0.08); h4->GetXaxis()->SetTitleOffset(1.163); h4->GetXaxis()->SetTitleFont(42); h4->GetYaxis()->SetTitle("Data/MC"); h4->GetYaxis()->SetLabelSize(0.08); h4->GetYaxis()->SetTitleSize(0.09); h4->GetYaxis()->SetTitleOffset(0.7); h4->GetYaxis()->SetNdivisions(404,kTRUE); h4->GetXaxis()->CenterTitle(); h4->GetYaxis()->CenterTitle(); h4->SetMarkerStyle(20); h4->SetMarkerSize(0.8); h4->SetStats(false); h4->SetMaximum(1.5); h4->SetMinimum(0.5); // h4->Draw("histo"); h4->Draw(); TLine *line = new TLine(); line->SetLineStyle(2); line->SetLineWidth(1); line->SetLineColor(kRed); line->DrawLine(h4->GetXaxis()->GetXmin(), 1 , h4->GetXaxis()->GetXmax(), 1 ); }