Belle II Software development
plot_run_dep.py
1#!/usr/bin/env python3
2
3
10
11
12from ROOT import TCanvas
13from ROOT import TGraphErrors
14import glob
15from qam import QAM
16from array import array
17x = array('d')
18dx = array('d')
19
20d0 = array('d')
21dd0 = array('d')
22z0 = array('d')
23dz0 = array('d')
24pt = array('d')
25dpt = array('d')
26
27# files = glob.glob('output_aug/qam.0*.root')
28files = glob.glob('/ghi/fs01/belle2/bdata/group/detector/CDC/qam/GCR1/build-2017-08-21/qam.0001.*.root')
29
30if files is None:
31 print('No files are found')
32 exit(1)
33
34for f in files:
35 run = int(f.split('.')[2])
36 qam = QAM(f)
37 rmsPt = qam.getRms('pt')
38 rmsD0 = qam.getRms('d0')
39 rmsZ0 = qam.getRms('z0')
40 x.append(run)
41 dx.append(0.0)
42 d0.append(rmsD0[0])
43 dd0.append(rmsD0[1])
44 z0.append(rmsZ0[0])
45 dz0.append(rmsZ0[1])
46 pt.append(rmsPt[0])
47 dpt.append(rmsPt[1])
48
49
50can = TCanvas('can', 'can', 800, 800)
51dgr = TGraphErrors(len(x), x, d0, dx, dd0)
52dgr.SetMarkerColorAlpha(2, 0.5)
53dgr.SetMarkerStyle(20)
54dgr.SetTitle('Run dependence')
55dgr.GetXaxis().SetTitle('run number')
56dgr.GetYaxis().SetTitle('RMS #Delta d_{0}')
57dgr.Draw('AP')
58
59can.Print('d0.png')
60
61zgr = TGraphErrors(len(x), x, z0, dx, dz0)
62zgr.SetMarkerColorAlpha(2, 0.5)
63zgr.SetMarkerStyle(20)
64zgr.SetTitle('Run dependence')
65zgr.GetXaxis().SetTitle('run number')
66zgr.GetYaxis().SetTitle('RMS #Delta z_{0}')
67zgr.Draw('AP')
68
69can.Print('z0.png')
70
71pgr = TGraphErrors(len(x), x, pt, dx, dpt)
72pgr.SetMarkerColorAlpha(2, 0.5)
73pgr.SetMarkerStyle(20)
74pgr.SetTitle('Run dependence')
75pgr.GetXaxis().SetTitle('run number')
76pgr.GetYaxis().SetTitle('RMS #Delta P_{t}')
77pgr.Draw('AP')
78
79can.Print('pt.png')
80
81'''
82import numpy as np
83import matplotlib.pylab as plt
84xx = np.array(x)
85yy = np.array(y)
86
87plt.plot(x,y,marker='o', color='r', alpha=0.4)
88plt.show()
89'''