//------------------------------------------------------------------------------ // DrawZPeak //------------------------------------------------------------------------------ void DrawZPeak(TString energy) { if (energy.Contains("7TeV")) { _lumiText = "4.9 fb^{-1} (7 TeV)"; } else { _lumiText = "19.6 fb^{-1} (8 TeV)"; } // Read the input file //---------------------------------------------------------------------------- TString name = "invMass2Lep_"; TFile* file = new TFile("rootfiles/" + name + energy + ".root", "read"); TH1F* data; TH1F* WZ; TH1F* fakes; TH1F* ZZ; TH1F* Zgamma; TH1F* WV; TH1F* VVV; TH1F* allmc; if (energy.Contains("7TeV")) { data = (TH1F*)file->Get("hZMass_Sel_datahist_COMB"); WZ = (TH1F*)file->Get("hZMass_Sel_wz_COMB"); fakes = (TH1F*)file->Get("hZMass_Sel_datadriven_COMB"); ZZ = (TH1F*)file->Get("hZMass_Sel_zz_COMB"); Zgamma = (TH1F*)file->Get("hZMass_Sel_zg_COMB"); WV = (TH1F*)file->Get("hZMass_Sel_wz_COMB"); VVV = (TH1F*)file->Get("hZMass_Sel_wz_COMB"); allmc = (TH1F*)file->Get("all_estimates_with_error_COMB"); } else if (energy.Contains("8TeV")) { data = (TH1F*)file->Get("h_data"); WZ = (TH1F*)file->Get("h_WZ"); fakes = (TH1F*)file->Get("h_Fakes"); ZZ = (TH1F*)file->Get("h_ZZ"); Zgamma = (TH1F*)file->Get("h_ZGamma"); WV = (TH1F*)file->Get("h_WV"); VVV = (TH1F*)file->Get("h_VVV"); allmc = (TH1F*)file->Get("h_All"); } WZ->SetFillColor(kOrange-2); WZ->SetLineColor(kOrange-2); Zgamma->SetFillColor(kRed+1); // kRed+2 Zgamma->SetLineColor(kRed+1); // kRed+2 ZZ->SetFillColor(kRed+1); ZZ->SetLineColor(kRed+1); fakes->SetFillColor(kGray+1); fakes->SetLineColor(kGray+1); data->SetMarkerStyle(kFullCircle); allmc->SetFillColor (kBlack); allmc->SetFillStyle (3345); allmc->SetLineColor (kWhite); allmc->SetLineWidth (0); allmc->SetMarkerColor(kOrange-2); allmc->SetMarkerSize (0); THStack* hs = new THStack(); if (energy.Contains("8TeV")) { WV->SetFillColor(kRed+1); // kAzure WV->SetLineColor(kRed+1); // kAzure VVV->SetFillColor(kRed+1); // kBlack VVV->SetLineColor(kRed+1); // kBlack hs->Add(VVV); hs->Add(WV); } hs->Add(Zgamma); hs->Add(ZZ); hs->Add(fakes); hs->Add(WZ); // Draw //---------------------------------------------------------------------------- TCanvas* canvas = new TCanvas(energy, energy); data->Draw("ep"); // Axis labels //---------------------------------------------------------------------------- TAxis* xaxis = data->GetXaxis(); TAxis* yaxis = data->GetYaxis(); xaxis->SetLabelFont ( 42); xaxis->SetLabelOffset(0.01); xaxis->SetLabelSize (0.05); xaxis->SetNdivisions ( 505); xaxis->SetTitleFont ( 42); xaxis->SetTitleOffset( 1.3); xaxis->SetTitleSize (0.05); yaxis->SetLabelFont ( 42); yaxis->SetLabelOffset(0.01); yaxis->SetLabelSize (0.05); yaxis->SetNdivisions ( 505); yaxis->SetTitleFont ( 42); yaxis->SetTitleOffset( 1.6); yaxis->SetTitleSize (0.05); xaxis->SetRangeUser(68, 112); xaxis->SetTitle("m_{#font[12]{ll}} (GeV)"); yaxis->SetTitle(Form("Events / %.0f GeV", data->GetBinWidth(0))); // Adjust scale //---------------------------------------------------------------------------- Float_t theMax = GetMaximumIncludingErrors(data); Float_t theMaxMC = GetMaximumIncludingErrors(allmc); if (theMaxMC > theMax) theMax = theMaxMC; data->SetMaximum(1.15 * theMax); // Legend //---------------------------------------------------------------------------- Double_t x0 = 0.635; Double_t y0 = 0.770; DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), data, " Data", "ep"); DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), WZ, " WZ", "f"); DrawTLegend(x0, y0, fakes, " Non-prompt leptons", "f"); DrawTLegend(x0, y0 - 1.*(_yoffset+0.001), ZZ, " MC background", "f"); DrawTLegend(x0, y0 - 2.*(_yoffset+0.001), allmc, " stat. #oplus syst.", "f"); // Finish it //---------------------------------------------------------------------------- data->SetTitle(""); DrawTLatex(_cmsTextFont, 0.215, 0.880, 0.055, 13, "CMS"); // DrawTLatex(_extraTextFont, 0.215, 0.826, 0.030, 13, "Preliminary"); DrawTLatex(_lumiTextFont, 0.940, 0.940, 0.040, 31, _lumiText); hs ->Draw("hist,same"); allmc->Draw("e2,same"); data ->Draw("ep,same"); canvas->GetFrame()->DrawClone(); canvas->RedrawAxis(); canvas->Update(); canvas->SaveAs("pdf/" + name + energy + ".pdf"); canvas->SaveAs("png/" + name + energy + ".png"); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // drawFigure7 // // parameter = "dg0" // parameter = "lam0" // parameter = "dk0" // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void drawFigure7(TString parameter = "dk0") { gInterpreter->ExecuteMacro("WZPaperStyle.C"); gSystem->mkdir("pdf", kTRUE); gSystem->mkdir("png", kTRUE); // Individual settings //---------------------------------------------------------------------------- if (parameter.Contains("dg0")) { xtitle = "#Delta#kappa^{Z}"; ytitle = "#lambda"; xmin = -0.5; xmax = 0.5; ymin = -0.039; ymax = 0.053; } else if (parameter.Contains("lam0")) { xtitle = "#Delta#kappa^{Z}"; ytitle = "#Deltag^{Z}_{1}"; xmin = -0.53; xmax = 0.53; ymin = -0.05; ymax = 0.09; } else if (parameter.Contains("dk0")) { xtitle = "#Deltag^{Z}_{1}"; ytitle = "#lambda"; xmin = -0.059; xmax = 0.059; ymin = -0.037; ymax = 0.052; } // Read the input file //---------------------------------------------------------------------------- TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read"); TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68"); TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95"); TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99"); TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95"); TGraph* bestFit = (TGraph*)file->Get("bestFit"); bestFit->SetMarkerSize(1.5); bestFit->SetMarkerStyle(34); TGraph* g_large = new TGraph(2); g_large->SetPoint(0, -1.0, 1.0); g_large->SetPoint(1, 1.0, 1.0); // Draw //---------------------------------------------------------------------------- TCanvas* canvas = new TCanvas("canvas", "canvas"); TMultiGraph* mg = new TMultiGraph(); mg->Add(cont_exp_68); mg->Add(cont_exp_95); mg->Add(cont_exp_99); mg->Add(cont_obs_95); mg->Add(bestFit, "p"); mg->Add(g_large); mg->Draw("ac"); mg->SetMinimum(ymin); mg->SetMaximum(ymax); // Axis labels //---------------------------------------------------------------------------- TAxis* xaxis = mg->GetXaxis(); TAxis* yaxis = mg->GetYaxis(); xaxis->SetLabelFont ( 42); xaxis->SetLabelOffset( 0.01); xaxis->SetLabelSize ( 0.05); xaxis->SetNdivisions ( 505); xaxis->SetTitle (xtitle); xaxis->SetTitleFont ( 42); xaxis->SetTitleOffset( 1.2); xaxis->SetTitleSize ( 0.05); xaxis->SetLimits(xmin, xmax); yaxis->SetLabelFont ( 42); yaxis->SetLabelOffset( 0.01); yaxis->SetLabelSize ( 0.05); yaxis->SetNdivisions ( 505); yaxis->SetTitle (ytitle); yaxis->SetTitleFont ( 42); yaxis->SetTitleOffset( 1.6); yaxis->SetTitleSize ( 0.05); canvas->Modified(); // Legend //---------------------------------------------------------------------------- Double_t x0 = 0.580; Double_t y0 = 0.755; DrawTLegend(x0 - 0.36, y0 + 2.*(_yoffset+0.001), (TH1F*)cont_exp_68, " Expected 68% CL", "l"); DrawTLegend(x0 - 0.36, y0 + 1.*(_yoffset+0.001), (TH1F*)cont_exp_95, " Expected 95% CL", "l"); DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), (TH1F*)cont_exp_99, " Expected 99% CL", "l"); DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), (TH1F*)cont_obs_95, " Observed 95% CL", "l"); DrawTLegend(x0, y0, (TH1F*)bestFit, " Best fit", "p"); // Finish it //---------------------------------------------------------------------------- DrawTLatex(_cmsTextFont, 0.190, 0.94, 0.055, 11, "CMS"); // DrawTLatex(_extraTextFont, 0.315, 0.94, 0.030, 11, "Preliminary"); DrawTLatex(_lumiTextFont, 0.940, 0.94, 0.040, 31, "19.6 fb^{-1} (8 TeV)"); canvas->SaveAs("pdf/lZ_dkg_2dlimit_" + parameter + "_2Dpol2_deltaNLL.pdf"); canvas->SaveAs("png/lZ_dkg_2dlimit_" + parameter + "_2Dpol2_deltaNLL.png"); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // drawFigure6 // // logy = 0 // logy = 1 // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void drawFigure6(Int_t logy = 0) { gInterpreter->ExecuteMacro("WZPaperStyle.C"); gSystem->mkdir("pdf", kTRUE); gSystem->mkdir("png", kTRUE); // Read the input file //---------------------------------------------------------------------------- TString name = "WZ_PtZ_plot_allCh_largeATGC"; TFile* file = new TFile("rootfiles/" + name + ".root", "read"); TCanvas* c1 = (TCanvas*)file->Get("c1_allCh"); TH1F* data = (TH1F*)c1->FindObject("histo_data_3e"); TH1F* aTGC_dk = (TH1F*)c1->FindObject("histo_aTGC_dk_3e"); TH1F* aTGC_lam = (TH1F*)c1->FindObject("histo_aTGC_lam_3e"); TH1F* aTGC_dg = (TH1F*)c1->FindObject("histo_aTGC_dg_3e"); TH1F* WZ = (TH1F*)c1->FindObject("histo_SM_3e"); TH1F* fakes = (TH1F*)c1->FindObject("fake_0"); TH1F* ZZ = (TH1F*)c1->FindObject("total_bkg_rebined_ZZ_0"); TH1F* Zgamma = (TH1F*)c1->FindObject("total_bkg_rebined_Zgamma_0"); TH1F* WV = (TH1F*)c1->FindObject("total_bkg_rebined_WV_0"); TH1F* VVV = (TH1F*)c1->FindObject("total_bkg_rebined_VVV_0"); WZ->SetFillColor(kOrange-2); WZ->SetLineColor(kOrange-2); Zgamma->SetFillColor(kRed+1); Zgamma->SetLineColor(kRed+1); ZZ->SetFillColor(kRed+1); ZZ->SetLineColor(kRed+1); fakes->SetFillColor(kGray+1); fakes->SetLineColor(kGray+1); WV->SetFillColor(kRed+1); WV->SetLineColor(kRed+1); VVV->SetFillColor(kRed+1); VVV->SetLineColor(kRed+1); // Draw //---------------------------------------------------------------------------- TCanvas* canvas = new TCanvas("canvas", "canvas"); canvas->SetLogy(logy); data->Draw("ep"); // Axis labels //---------------------------------------------------------------------------- TAxis* xaxis = data->GetXaxis(); TAxis* yaxis = data->GetYaxis(); xaxis->SetLabelFont ( 42); xaxis->SetLabelOffset(0.01); xaxis->SetLabelSize (0.05); xaxis->SetNdivisions ( 505); xaxis->SetTitleFont ( 42); xaxis->SetTitleOffset( 1.2); xaxis->SetTitleSize (0.05); yaxis->SetLabelFont ( 42); yaxis->SetLabelOffset(0.01); yaxis->SetLabelSize (0.05); yaxis->SetNdivisions ( 505); yaxis->SetTitleFont ( 42); yaxis->SetTitleOffset( 1.6); yaxis->SetTitleSize (0.05); xaxis->SetTitle("p_{T}^{Z} (GeV)"); yaxis->SetTitle(Form("Events / %.0f GeV", data->GetBinWidth(0))); // Adjust scale //---------------------------------------------------------------------------- Float_t theMax = GetMaximumIncludingErrors(data); Float_t theMaxMC = GetMaximumIncludingErrors(aTGC_dk); if (theMaxMC > theMax) theMax = theMaxMC; if (canvas->GetLogy()) { data->SetMaximum(15 * theMax); data->SetMinimum(1); } else { data->SetMaximum(1.2 * theMax); } // Legend //---------------------------------------------------------------------------- Double_t x0; Double_t y0; if (logy) { x0 = 0.630; y0 = 0.765; DrawTLegend(x0 - 0.37, y0 + 2.*(_yoffset+0.001), data, " Data", "ep"); DrawTLegend(x0 - 0.37, y0 + 1.*(_yoffset+0.001), aTGC_dk, " WZ aTGC (#Delta#kappa^{Z} = 0.6)", "l"); DrawTLegend(x0 - 0.37, y0, aTGC_dg, " WZ aTGC (#Deltag^{Z}_{1} = -0.06)", "l"); DrawTLegend(x0 - 0.37, y0 - 1.*(_yoffset+0.001), aTGC_lam, " WZ aTGC (#lambda = 0.04)", "l"); DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), WZ, " WZ", "f"); DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), fakes, " Non-prompt leptons", "f"); DrawTLegend(x0, y0, ZZ, " MC background", "f"); } else { x0 = 0.570; y0 = 0.755; DrawTLegend(x0, y0 + 2.*(_yoffset+0.001), data, " Data", "ep"); DrawTLegend(x0, y0 + 1.*(_yoffset+0.001), aTGC_dk, " WZ aTGC (#Delta#kappa^{Z} = 0.6)", "l"); DrawTLegend(x0, y0, aTGC_dg, " WZ aTGC (#Deltag^{Z}_{1} = -0.06)", "l"); DrawTLegend(x0, y0 - 1.*(_yoffset+0.001), aTGC_lam, " WZ aTGC (#lambda = 0.04)", "l"); DrawTLegend(x0, y0 - 2.*(_yoffset+0.001), WZ, " WZ", "f"); DrawTLegend(x0, y0 - 3.*(_yoffset+0.001), fakes, " Non-prompt leptons", "f"); DrawTLegend(x0, y0 - 4.*(_yoffset+0.001), ZZ, " MC background", "f"); } // Finish it //---------------------------------------------------------------------------- data->SetTitle(""); if (logy) { DrawTLatex(_cmsTextFont, 0.190, 0.94, 0.055, 11, "CMS"); // DrawTLatex(_extraTextFont, 0.315, 0.94, 0.030, 11, "Preliminary"); } else { DrawTLatex(_cmsTextFont, 0.215, 0.891, 0.055, 13, "CMS"); // DrawTLatex(_extraTextFont, 0.215, 0.837, 0.030, 13, "Preliminary"); } DrawTLatex(_lumiTextFont, 0.940, 0.94, 0.040, 31, "19.6 fb^{-1} (8 TeV)"); WZ ->Draw("hist,same"); aTGC_dk ->Draw("hist,same"); aTGC_lam->Draw("hist,same"); aTGC_dg ->Draw("hist,same"); fakes ->Draw("hist,same"); ZZ ->Draw("hist,same"); Zgamma ->Draw("hist,same"); WV ->Draw("hist,same"); VVV ->Draw("hist,same"); data ->Draw("ep,same"); canvas->GetFrame()->DrawClone(); canvas->RedrawAxis(); canvas->Update(); TString cname = name; if (logy) cname += "_log_range"; canvas->SaveAs("pdf/" + cname + ".pdf"); canvas->SaveAs("png/" + cname + ".png"); }