{ gROOT->SetStyle("Plain"); gStyle->SetOptStat(kFALSE); TFile *bkg1top = TFile::Open("SingleS_P+MET_50PU_TopJets_top_his.root"); TFile *bkg2top = TFile::Open("SingleS_P+MET_50PU_TTbar_top_his.root"); TFile *bkg3top = TFile::Open("SingleS_P+MET_50PU_DiBoson_top_his.root"); TFile *bkg4top = TFile::Open("SingleS_P+MET_50PU_BosonJets_top_his.root"); TFile *sgnl4top = TFile::Open("SingleS_P+MET_50PU_TDR4_top_his.root"); gROOT->cd(); TH1F *MET2_50PU_TopJets= (TH1F*) bkg1top->Get("hMET2"); TH1F *MET2_50PU_TTbar= (TH1F*) bkg2top->Get("hMET2"); TH1F *MET2_50PU_DiBoson= (TH1F*) bkg3top->Get("hMET2"); TH1F *MET2_50PU_BosonJets= (TH1F*) bkg4top->Get("hMET2"); TH1F *MET2_50PU_TDR4= (TH1F*) sgnl4top->Get("hMET2"); THStack hs16("hs16",""); MET2_50PU_DiBoson->SetFillColor(kRed); hs16.Add(MET2_50PU_DiBoson); MET2_50PU_TopJets->SetFillColor(kAzure+1); hs16.Add(MET2_50PU_TopJets); MET2_50PU_BosonJets->SetFillColor(kYellow); hs16.Add(MET2_50PU_BosonJets); MET2_50PU_TTbar->SetFillColor(kBlue); hs16.Add(MET2_50PU_TTbar); TFile *file = new TFile ("stacked_plots/stack_MET2_50PU.root","RECREATE"); TCanvas *c16 = new TCanvas("c16","stack_MET2",800,20,1000,800) ; c16->SetLogy(); hs16->Draw(); hs16->GetHistogram()->GetXaxis()->SetTitle("MET [GeV]"); hs16->GetHistogram()->GetYaxis()->SetTitle("Events/20 GeV"); // https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=14412 hs16->GetXaxis()->SetRangeUser(500, 2000); if (hs16->GetMinimum() > MET2_50PU_TDR4->GetMinimum()) hs16->SetMinimum(MET2_50PU_TDR4->GetMinimum()); if (hs16->GetMaximum() < MET2_50PU_TDR4->GetMaximum()) hs16->SetMaximum(MET2_50PU_TDR4->GetMaximum()); MET2_50PU_TDR4->SetLineStyle(2); MET2_50PU_TDR4->SetLineColor(1); MET2_50PU_TDR4->SetLineWidth(4); MET2_50PU_TDR4->Draw("SAME"); TLegend *pl = new TLegend(0.7, 0.7, 0.9, 0.9); pl->SetTextSize(0.02); pl->SetFillColor(0); pl->AddEntry(MET2_50PU_TDR4, "STC4", "lep"); pl->AddEntry(MET2_50PU_TTbar, "t#bar{t}+jets", "lpf"); pl->AddEntry(MET2_50PU_TopJets, "Single top+jets", "lpf"); pl->AddEntry(MET2_50PU_DiBoson, "VV", "lpf"); pl->AddEntry(MET2_50PU_BosonJets, "V+jets", "lpf"); pl->SetFillColor(0); pl->SetLineColor(2); pl->Draw(); TLatex T16; T16.SetTextSize(0.03); T16.DrawLatexNDC(.11,.92, "Delphes samples #sqrt{s}=14 TeV, #int Ldt=300 fb^{-1}, 50 pile-up"); c16->Write(); }