ATLAS Offline Software
Loading...
Searching...
No Matches
plotmaker Namespace Reference

Functions

 make2DPdf (name, hist, prefix)
 makePdf (name, hists, prefix)

Variables

int ScalarColor = ROOT.kPink+4
int DarkPhotonColor = ROOT.kAzure-3
int ElectronColor = ROOT.kRed-3
int MuonColor = ROOT.kBlue-3
int PionColor = ROOT.kGreen-3
 parser = optparse.OptionParser()
 dest
 help
 default
 options
 args
 hist_file = ROOT.TFile.Open(options.hist_file_in, 'r')
dict hist1DDict
dict hist2DDict = { 'decayZR2D': None, 'decayEtaR2D':None }
 keys = hist_file.GetListOfKeys()
 keyName = key.GetName()
 hist = ROOT.TH1F()

Function Documentation

◆ make2DPdf()

plotmaker.make2DPdf ( name,
hist,
prefix )

Definition at line 17 of file plotmaker.py.

17def make2DPdf(name, hist, prefix):
18 if not hist:
19 return
20 canvas = ROOT.TCanvas('whoCares'+name , 'name', 1600,1600)
21 canvas.cd(0)
22 hist.Draw('COLZ')
23 if prefix != '':
24 prefix += '_'
25 pass
26 canvas.SaveAs(prefix+name+'.pdf')
27

◆ makePdf()

plotmaker.makePdf ( name,
hists,
prefix )

Definition at line 28 of file plotmaker.py.

28def makePdf(name, hists, prefix):
29 if len(hists) == 0:
30 return
31 if prefix != '' and prefix[-1] != '_':
32 prefix += '_'
33 pass
34
35 if isinstance(hists, list):
36 maxY = -999
37 maxEntries = -999
38 for hist in hists:
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()
44 pass
45 hist.SetLineWidth(2)
46 pass
47
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)
53
54 canvas = ROOT.TCanvas('whoCares'+name , 'name', 1600,1200)
55 canvas.cd(0)
56 scalarhist = None
57 darkphotonhist = None
58 for index,hist in enumerate(hists):
59 #print hist.GetName()
60 drawOptions = 'HIST'
61 if index!=0:
62 drawOptions += 'SAME'
63 pass
64
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 )
69 pass
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 )
74 pass
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 )
79 pass
80 elif 'DarkPhoton' in hist.GetName() or 'darkPhoton' in hist.GetName():
81 hist.SetLineColor(DarkPhotonColor)
82 darkphotonhist = hist
83 continue
84 pass
85 elif 'Scalar' in hist.GetName() or 'scalar' in hist.GetName():
86 hist.SetLineColor(ScalarColor)
87 scalarhist = hist
88 continue
89 pass
90 hist.Draw(drawOptions)
91 pass
92 if legend.GetNRows():
93 legend.Draw()
94 pass
95 canvas.SaveAs(prefix+name+'.pdf')
96 if darkphotonhist:
97 if not 'darkPhoton' in name:
98 name = 'darkPhoton'+name
99 pass
100 makePdf(name, darkphotonhist, prefix)
101 pass
102 if scalarhist:
103 if not 'scalar' in name:
104 name = 'scalar'+name
105 pass
106 makePdf(name, scalarhist, prefix)
107 pass
108 else:
109 canvas = ROOT.TCanvas('whoCares2'+name , 'name', 1600,1200)
110 canvas.cd(0)
111 hists.Draw('HIST')
112 canvas.SaveAs(prefix+name+'.pdf')
113
114

Variable Documentation

◆ args

plotmaker.args

Definition at line 122 of file plotmaker.py.

◆ DarkPhotonColor

int plotmaker.DarkPhotonColor = ROOT.kAzure-3

Definition at line 12 of file plotmaker.py.

◆ default

plotmaker.default

Definition at line 119 of file plotmaker.py.

◆ dest

plotmaker.dest

Definition at line 118 of file plotmaker.py.

◆ ElectronColor

int plotmaker.ElectronColor = ROOT.kRed-3

Definition at line 13 of file plotmaker.py.

◆ help

plotmaker.help

Definition at line 118 of file plotmaker.py.

◆ hist

plotmaker.hist = ROOT.TH1F()

Definition at line 148 of file plotmaker.py.

◆ hist1DDict

dict plotmaker.hist1DDict
Initial value:
1= { 'darkPhotonPt': [], 'darkPhotonEta':[], 'darkPhotonPhi': [], 'Polarization': [],
2 'scalarPt': [], 'scalarEta':[], 'scalarPhi': [],
3 'decayR1D': [], 'decayZ1D':[],
4 'OpeningR':[], 'OpeningPhi':[], 'OpeningEta':[],
5 'ptBalance':[], 'subLeadingPt':[], 'leadingPt':[]}

Definition at line 135 of file plotmaker.py.

◆ hist2DDict

dict plotmaker.hist2DDict = { 'decayZR2D': None, 'decayEtaR2D':None }

Definition at line 141 of file plotmaker.py.

◆ hist_file

plotmaker.hist_file = ROOT.TFile.Open(options.hist_file_in, 'r')

Definition at line 129 of file plotmaker.py.

◆ keyName

plotmaker.keyName = key.GetName()

Definition at line 145 of file plotmaker.py.

◆ keys

plotmaker.keys = hist_file.GetListOfKeys()

Definition at line 143 of file plotmaker.py.

◆ MuonColor

int plotmaker.MuonColor = ROOT.kBlue-3

Definition at line 14 of file plotmaker.py.

◆ options

plotmaker.options

Definition at line 122 of file plotmaker.py.

◆ parser

plotmaker.parser = optparse.OptionParser()

Definition at line 117 of file plotmaker.py.

◆ PionColor

int plotmaker.PionColor = ROOT.kGreen-3

Definition at line 15 of file plotmaker.py.

◆ ScalarColor

int plotmaker.ScalarColor = ROOT.kPink+4

Definition at line 11 of file plotmaker.py.