28 def makePdf(name, hists, prefix):
31 if prefix !=
'' and prefix[-1] !=
'_':
35 if isinstance(hists, list):
39 hist.Scale( 1./
float(hist.GetEntries()) )
40 hist.SetYTitle(
'Normalized to Unity')
41 if hist.GetMaximum() > maxY
and (
'Electron' in hist.GetName()
or 'Pion' in hist.GetName()
or 'Muon' in hist.GetName()):
42 maxY = hist.GetMaximum()
43 maxEntries = hist.GetEntries()
48 legend = ROOT.TLegend(.6, .65, .85, .89)
49 legend.SetFillColor(0)
50 legend.SetBorderSize(0)
51 legend.SetTextFont(102)
52 legend.SetTextSize(0.04)
54 canvas = ROOT.TCanvas(
'whoCares'+name ,
'name', 1600,1200)
58 for index,hist
in enumerate(hists):
65 if 'Electron' in hist.GetName():
66 legend.AddEntry(hist,
'#splitline{Electrons}{'+
str(
int(hist.GetEntries()))+
' events}',
'f')
67 hist.SetLineColor(ElectronColor)
68 hist.SetMaximum(1.2*maxY )
70 elif 'Muon' in hist.GetName():
71 legend.AddEntry(hist,
'#splitline{Muons}{'+
str(
int(hist.GetEntries()))+
' events}',
'f')
72 hist.SetLineColor(MuonColor)
73 hist.SetMaximum(1.2*maxY )
75 elif 'Pion' in hist.GetName():
76 legend.AddEntry(hist,
'#splitline{Pions}{'+
str(
int(hist.GetEntries()))+
' events}',
'f')
77 hist.SetLineColor(PionColor)
78 hist.SetMaximum(1.2*maxY )
80 elif 'DarkPhoton' in hist.GetName()
or 'darkPhoton' in hist.GetName():
81 hist.SetLineColor(DarkPhotonColor)
85 elif 'Scalar' in hist.GetName()
or 'scalar' in hist.GetName():
86 hist.SetLineColor(ScalarColor)
90 hist.Draw(drawOptions)
95 canvas.SaveAs(prefix+name+
'.pdf')
97 if not 'darkPhoton' in name:
98 name =
'darkPhoton'+name
100 makePdf(name, darkphotonhist, prefix)
103 if not 'scalar' in name:
106 makePdf(name, scalarhist, prefix)
109 canvas = ROOT.TCanvas(
'whoCares2'+name ,
'name', 1600,1200)
112 canvas.SaveAs(prefix+name+
'.pdf')