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