-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopmass_reco.py
79 lines (63 loc) · 2.39 KB
/
topmass_reco.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import ROOT
#---------------- *Open the ROOT files and get the histogram from each file* ----------
fIn1 = ROOT.TFile.Open("/home/msahil/work/madgraph/MG5_aMC_v2_9_15/template_tttxtx_wminus_fullyHadronic_signal/Events/run_01_decayed_1/unweighted_events.root")
h1 = fIn1.Get("top_quark0_mass")
h2 = fIn1.Get("top_quark1_mass")
h3 = fIn1.Get("top_quark2_mass")
h4 = fIn1.Get("top_quark3_mass")
h1.SetLineWidth(2)
h2.SetLineWidth(2)
h3.SetLineWidth(2)
h4.SetLineWidth(2)
#--------------------------- *Scale the histograms by the unit area*-------------------
factor = 1.0
h1.Scale(factor/h1.Integral())
h2.Scale(factor/h2.Integral())
h3.Scale(factor/h3.Integral())
h4.Scale(factor/h4.Integral())
#--------------------------- *Create a new canvas and draw the histograms* ------------
canvas = ROOT.TCanvas("canvas", "Top mass", 800, 600)
h1.SetLineColor(ROOT.kRed)
h2.SetLineColor(ROOT.kBlue)
h3.SetLineColor(ROOT.kGreen)
h4.SetLineColor(ROOT.kBlack)
#1.GetXaxis().SetRangeUser(0, 100) # Set x-axis limits for hist1
#h1.GetYaxis().SetRangeUser(0,2000) # Set y-axis limits for hist1
h1.Draw("hist")
h2.Draw("hist same")
h3.Draw("hist same")
h4.Draw("hist same")
#-------------------------------- *Add the title and axis labels* ---------------------
h1.SetTitle("Top Quark mass")
h1.GetXaxis().SetTitle("m_{t} [GeV]")
h1.GetYaxis().SetTitle("Normalized")
h1.GetXaxis().SetRangeUser(160, 185)
h1.SetStats(0)
tex1 = ROOT.TLatex(0.153,0.92,"t#bar{t}t#bar{t}W signal")
tex1.SetNDC()
tex1.SetTextAngle(0)
tex1.SetTextFont(42)
tex1.SetTextSize(0.04)
tex1.SetTextAlign(11)
tex1.Draw()
tex2 = ROOT.TLatex(0.730,0.92,"\sqrt{s} = {13TeV}")
tex2.SetNDC()
tex2.SetTextAngle(0)
tex2.SetTextFont(42)
tex2.SetTextAlign(11)
tex2.SetTextSize(0.04)
tex2.Draw()
#--------------------------------------- *Add a legend* -------------------------------
legend = ROOT.TLegend(0.7, 0.7, 0.9, 0.85)
legend.AddEntry(h1, "top1 mass", "f")
legend.AddEntry(h2, "top2 mass", "f")
legend.AddEntry(h3, "top3 mass", "f")
legend.AddEntry(h4, "top4 mass", "f")
legend.SetBorderSize(0)
legend.Draw()
#-------------------------------------- *Show the canvas* -----------------------------
#canvas.SetLogy()
canvas.Draw()
canvas.SaveAs("/home/msahil/work/analysis/fourtop_wminus/presentation_1/presentation_images/partons_plots/Top_Quark_Mass.png")
input("press enter to exit....")
#-------------------------------------------- *End* -----------------------------------