-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaneComp.py
More file actions
75 lines (55 loc) · 1.99 KB
/
planeComp.py
File metadata and controls
75 lines (55 loc) · 1.99 KB
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
# External Dependencies
import sys
import math
import numpy as np
import ROOT as root
# Internal Dependencies
from dataTypes import *
import driver
import efficiencyPurityPlot
import draw
def main(argv):
#saveOptions
directory = "img"
fileName = "plane4Compl"
########################################################
volume = DetectorVolume(1000.0, 1000.0)
wirePitchList = [[5.0,5.0], [5.0, 5.0, 5.0], [5.0,5.0,5.0,5.0], [5.0,5.0,5.0,5.0, 5.0]]
anglesList = list(map(lambda x: driver.generateAngles(len(x)), wirePitchList))
numberOfBlobs = 3
alphas = np.linspace(0.001, 1, 10)
numberOfIterations = 10000
c1 = root.TCanvas("PuriyEfficiencyCanvas",
"PuriyEfficiencyCanvas", 200, 10, 700, 500)
legendPosition=[0.141834,0.151899,0.315186,0.35443]
legend = root.TLegend(legendPosition[0], legendPosition[1], legendPosition[2], legendPosition[3])
graphs = []
colors = [root.kRed, root.kBlue, root.kGreen, 6]
mg = root.TMultiGraph()
for i, wirePitches in enumerate(wirePitchList):
g = efficiencyPurityPlot.efficiencyPurityGraph(volume, wirePitches, anglesList[i], numberOfBlobs, alphas, numberOfIterations)
legend.AddEntry(g,"Planes: " + str(len(wirePitches)),"l")
g.SetLineColor(colors[i])
mg.Add(g)
graphs.append(g)
mg.SetTitle("Efficiency vs Purity")
mg.GetYaxis().SetTitle("purity")
mg.GetXaxis().SetTitle("efficiency")
mg.GetYaxis().SetTitleSize(0.04)
mg.GetYaxis().SetTitleOffset(1.2)
mg.GetYaxis().SetLabelSize(0.04)
mg.GetXaxis().SetTitleSize(0.04)
mg.GetXaxis().SetTitleOffset(1)
mg.GetXaxis().SetLabelSize(0.04)
mg.Draw("a*c")
# g.Draw("A*")
legend.SetFillColor(root.kWhite)
legend.SetBorderSize(0)
legend.SetTextSize(0.043)
legend.Draw()
c1.Update()
if isinstance(fileName, str) and len(fileName)>0:
draw.saveImage(fileName,directory)
# root.gApplication.Run()
if __name__ == "__main__":
main(sys.argv)