TCanvas *c1 = new TCanvas("cn","cn",50,50,800,600); #include #include #include #include #include #include #include #include #include #include #include #include #include #include "TMath.h" #include #include #include #include #include void stack_z_try() { TFile *f1 = new TFile ("/afs/cern.ch/work/n/nmajeed/private/CMSSW_7_3_0/my_work/ttbar/tt_final_new.root"); TFile *f2 = new TFile ("/afs/cern.ch/work/n/nmajeed/private/CMSSW_7_3_0/my_work/WZ/wz_fi.root"); TFile *f3 = new TFile ("/afs/cern.ch/work/n/nmajeed/private/CMSSW_7_3_0/my_work/Tqz/tqz_final_new.root"); TFile *f4 = new TFile ("/afs/cern.ch/work/n/nmajeed/private/CMSSW_7_3_0/my_work/DY/dy_fi_new.root"); TH1D *z_ttbar = (TH1D*)f1->Get("Z_Inv_mass"); TH1D *z_wz = (TH1D*)f2->Get("Z_Inv_mass"); TH1D *z_tqz = (TH1D*)f3->Get("Z_Inv_mass"); TH1D *z_dy = (TH1D*)f4->Get("Z_Inv_mass"); z_ttbar->GetXaxis()->SetRangeUser(60,120); z_wz->GetXaxis()->SetRangeUser(60,120); z_tqz->GetXaxis()->SetRangeUser(60,120); z_dy->GetXaxis()->SetRangeUser(60,120); int r=1; z_ttbar->Rebin(r); z_wz->Rebin(r); z_tqz->Rebin(r); z_dy->Rebin(r); z_ttbar->SetLineColor(kBlack); z_ttbar->SetFillColor(kCyan+3); z_wz->SetLineColor(kBlack); z_wz->SetFillColor(kOrange+7); z_tqz->SetLineColor(kBlack); z_tqz->SetFillColor(kOrange); z_dy->SetLineColor(kBlack); z_dy->SetFillColor(kRed); THStack *hs = new THStack("hs",""); hs->Add(z_ttbar); hs->Add(z_wz); hs->Add(z_tqz); hs->Add(z_dy); hs->GetXaxis()->SetRangeUser(60.,120.); hs->Draw("HIST"); TLegend *leg = new TLegend( 0.6449843,0.65038,0.8377743,0.8838219,NULL,"brNDC"); leg->SetFillColor(0); leg->SetBorderSize(0); leg->SetTextFont(42); leg->SetTextSize(0.03); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetMargin(0.44); leg->SetNColumns(2); leg->SetColumnSeparation(.4); leg->AddEntry(z_ttbar,"t#bar{t}","f"); leg->AddEntry(z_wz,"WZJets","f"); leg->AddEntry(z_tqz,"tZq","f"); leg->AddEntry(z_dy,"dy","f"); leg->Draw(); TLatex * tex1 = new TLatex(0.836,0.936,"#sqrt[]{s}=13TeV, L_{int}= 36 fb^{-1}"); tex1->SetNDC(); tex1->SetTextAlign(31); tex1->SetTextFont(42); tex1->SetTextSize(0.042); tex1->SetLineWidth(2); tex1->Draw(); TLatex * tex3 = new TLatex(0.25,0.936," Z Invariant mass"); tex3->SetNDC(); tex3->SetTextAlign(10); tex3->SetTextFont(52); tex3->SetTextSize(0.05); tex3->SetLineWidth(2); tex3->Draw(); c1->SaveAs("z_invariant_mass_changes.pdf"); }