13 Alternative version with stacked bars
17 from ROOT
import TFile
18 from pylab
import plt, savefig, show, subplot
20 components = {
'Touschek_LER',
'Touschek_HER'}
23 dose_data = {
'Touschek_HER': {
36 3: 33.624 * np.pi / 180,
54 fileName =
'/data/belle2/BG/Feb2015/output/base_kekcc/base_touschek_histo.root'
55 print(
'reading from file ', fileName)
57 rootfile = TFile(fileName)
58 tree = rootfile.Get(
'bSummary')
60 nev = tree.GetEntries()
61 for iev
in range(0, nev):
64 dose_data[str(tree.component)][tree.layer][tree.ladder - 1, tree.sensor - 1] = 100 * tree.dose
68 component =
'Touschek_LER'
71 ladder_width = 2 * np.pi / layer_nladders[layer]
72 ladder_angles = np.linspace(layer_phi0[layer], layer_phi0[layer] + 2 * np.pi,
73 layer_nladders[layer], endpoint=
False)
74 bottoms = np.zeros(layer_nladders[layer])
75 ax = subplot(2, 2, layer - 2, polar=
True)
76 for sensor
in range(layer_nsensors[layer]):
79 dose_data[component][layer][:, sensor],
82 label=str(sensor + 1),
85 bottoms += dose_data[component][layer][:, sensor]
87 bar.set_facecolor(plt.cm.Paired(0.1 + 0.15 * sensor))
90 r_shift = 0.1 * max(bottoms)
91 for (i, r)
in zip(range(layer_nladders[layer]), bottoms):
102 for tick
in ax.yaxis.get_major_ticks():
103 tick.label.set_fontsize(7)
105 for tick
in ax.xaxis.get_major_ticks():
106 tick.label.set_fontsize(9)
108 fullscale = np.max(bottoms)
109 ax.set_ylim(-0.25 * fullscale, 1.2 * fullscale)
112 1.35 * np.max(bottoms),
119 ax.legend(title=
'Sensor', fontsize=9, bbox_to_anchor=(1.4, 0.5))
120 ax.set_title(
'Layer ' + str(layer), x=0.0, y=0.97)
122 savefig(
'layers.png')