1 |
akalinow |
1.1 |
#!/usr/bin/env python
|
2 |
|
|
|
3 |
cwiok |
1.2 |
import os, commands, sys
|
4 |
akalinow |
1.1 |
from array import array
|
5 |
|
|
import ROOT
|
6 |
|
|
|
7 |
cwiok |
1.2 |
if __name__ == "__main__":
|
8 |
|
|
if len(sys.argv[1:]) != 1:
|
9 |
|
|
print "\nUsage "+sys.argv[0]+" <file>"
|
10 |
|
|
print "where <file> is a text file with 2 columns:"
|
11 |
|
|
print "RUN_NUMBER PRESSURE[mbar]\n"
|
12 |
|
|
exit()
|
13 |
akalinow |
1.1 |
|
14 |
cwiok |
1.2 |
###Read data from txt file
|
15 |
|
|
#file = open('pressure_twiki_160406-172268.dat')
|
16 |
|
|
file = open(sys.argv[1])
|
17 |
|
|
counter = 0
|
18 |
|
|
runs = []
|
19 |
|
|
pressure = []
|
20 |
|
|
for line in file:
|
21 |
|
|
print line.split()
|
22 |
cwiok |
1.3 |
if(len(line.split())>0):
|
23 |
|
|
runs.append(float(line.split()[0]))
|
24 |
|
|
if(len(line.split())>1):
|
25 |
|
|
pressure.append(float(line.split()[1]))
|
26 |
|
|
else:
|
27 |
|
|
pressure.append(0.0)
|
28 |
|
|
counter+=1
|
29 |
akalinow |
1.1 |
|
30 |
cwiok |
1.2 |
x = array("d",runs)
|
31 |
|
|
y = array("d",pressure)
|
32 |
akalinow |
1.1 |
|
33 |
cwiok |
1.2 |
###Define efficiency map histogram
|
34 |
|
|
myFile = ROOT.TFile("PressureGraph.root","RECREATE")
|
35 |
|
|
myGraph = ROOT.TGraph(len(runs),x,y)
|
36 |
cwiok |
1.3 |
myGraph.SetName("Graph")
|
37 |
akalinow |
1.1 |
|
38 |
cwiok |
1.2 |
myGraph.Write()
|
39 |
|
|
myFile.Write()
|
40 |
|
|
myFile.Close()
|