-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotAfterNodes.py
More file actions
60 lines (55 loc) · 1.57 KB
/
plotAfterNodes.py
File metadata and controls
60 lines (55 loc) · 1.57 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
from ROOT import *
import sys
if (len(sys.argv) < 2) :
print "need to provide a file name"
exit(1)
fileName=sys.argv[1]
openedFile=open(fileName,'r')
lines=openedFile.readlines()
graphs=[]
oneGraph= TGraph()
#count number of tgraphs
counter=0
#count number of lines read
counterLinesRead=0
for line in lines:
#print line[0]
#print line
tokens=line.split("(")
#print tokens[0]
#print tokens[1]
#print tokens[2]
if (int(tokens[0].strip())==0 and counterLinesRead!=0):
theCanvas=TCanvas("TGraph","TGraph",0,0,500,500)
oneGraph.GetYaxis().SetRangeUser(-.05,.05);
oneGraph.GetXaxis().SetLimits(-.05,.05);
oneGraph.SetMarkerStyle(8)
oneGraph.SetTitle("theTitle")
oneGraph.Draw("AP")
#theCanvas.Print("temp%d.pdf"%counter)
theCanvas.SaveAs("temp%d.png"%counter)
print "hi"
theCanvas.Clear()
oneGraph= TGraph()
counter+=1
counterLinesRead+=1
#tokens[2]=tokens[2].strip(')')
tokens[2]=tokens[2].strip().strip(')')
#parameters[0-5]=(x,px,y,py,z,pz)
#parameters[0]=x
#parameters[1]=px
#parameters[2]=y
#parameters[3]=py
#parameters[4]=z
#parameters[5]=pz
parameters=tokens[2].split(',')
#print tokens[2]
oneGraph.SetPoint(oneGraph.GetN(),float(parameters[0]),float(parameters[2]))
if (False):
theCanvas=TCanvas("TGraph","TGraph",0,0,500,500)
oneGraph.SetTitle("theTitle")
oneGraph.Draw("AP")
theCanvas.Print("temp%d.png"%counter)
print "hi"
theCanvas.Clear()
oneGraph= TGraph()