Hi experts,
I divided the canvas into 4 small canvas, for each smaller canvas, they are divided into top and bottom pad. But when I try to draw the signal and background THStack on the top pad, it’s not shown and also the legend. I have done the test, the signal hist of the THStack can be drawn. In the picture, the black dots stand for data hist. The Blue hist can be ignored. And the signal and background hists are not blank.
The related code part is shown and the whole code is attached.
Could you please give me some advice? Thank you very much .
1 stack_signal = ROOT.THStack("stack_signal","stack_signal mode")
0 stack_background = ROOT.THStack("stack_background","stack_background mode")
1
2 stack_signal.Add(hist_ggH)
3 stack_signal.Add(hist_VBFH)
4 stack_signal.Add(hist_VH)
5 stack_signal.Add(hist_ttH)
6
7 stack_background.Add(hist_Zll_jet)
8 stack_background.Add(hist_ll_gamma)
9
10
11 # print(hist_ggH.GetName())
12
13 stack_background.Draw("h")
14 # hist_ggH.Draw("h, same")
15 # stack_background.SetMinimum(0)
16 # stack_background.SetMaximum(1000)
17 # stack_signal.Draw("hist,same,nostack")
18 stack_signal.Draw("h,NOCLEAR,same")
19 # stack_signal.Draw("h,same")
20 # hist_data.Draw("PE same")
21 if new_iso_tight is not None:
22 new_iso_tight.Draw("P,same")
23 new_iso_tight.SetMarkerColor(ROOT.kBlue)
24
25 if i==0:
26 stack_background.GetYaxis().SetTitle("Events / 4 GeV")
27 stack_background.GetYaxis().SetTitleOffset(0.7)
28 stack_background.GetYaxis().SetTitleSize(0.07)
29 if i==19:
30 stack_background.GetYaxis().SetTitle("Events / 0.32 ")
31 stack_background.GetYaxis().SetTitleOffset(0.7)
32 stack_background.GetYaxis().SetTitleSize(0.07)
33 if i==21 or i==22:
34 stack_background.GetYaxis().SetTitle("Events / 1.00 GeV")
35 stack_background.GetYaxis().SetTitleOffset(0.7)
36 stack_background.GetYaxis().SetTitleSize(0.07)
37 if i==25:
38 stack_background.GetYaxis().SetTitle("Events / 0.16 ")
39 stack_background.GetYaxis().SetTitleOffset(0.7)
40 stack_background.GetYaxis().SetTitleSize(0.07)
41 if i==27 or i==28:
42 stack_background.GetYaxis().SetTitle("Events / 4 GeV")
43 stack_background.GetYaxis().SetTitleOffset(0.7)
44 stack_background.GetYaxis().SetTitleSize(0.07)
45 if i==30:
46 stack_background.GetYaxis().SetTitle("Events / 2 GeV")
47 stack_background.GetYaxis().SetTitleOffset(0.7)
48 stack_background.GetYaxis().SetTitleSize(0.07)
49
50 # # stack_background.GetXaxis().SetLabelSize(0)
51 # # stack_background.GetXaxis().SetTitleSize(0)
52
53
54 sig_content1 = hist_ggH.GetBinContent(hist_ggH.GetMaximumBin())
55 sig_content2 = hist_VBFH.GetBinContent(hist_VBFH.GetMaximumBin())
56 sig_content3 = hist_VH.GetBinContent(hist_VH.GetMaximumBin())
57 sig_content4 = hist_ttH.GetBinContent(hist_ttH.GetMaximumBin())
58 sig_content = sig_content1 + sig_content2 + sig_content3 + sig_content4
59
60 bkg_content1 = hist_Zll_jet.GetBinContent(hist_Zll_jet.GetMaximumBin())
61 bkg_content2 = hist_ll_gamma.GetBinContent(hist_ll_gamma.GetMaximumBin())
62 bkg_content = bkg_content1 + bkg_content2
63
64
65 hist_data.Draw("PE same")
get_and_draw_jets_to_gamma_fake_factor.py (21.5 KB)