13<noexecute>Used as library.</noexecute>
20def create1DHist(name, title, n_bins, x_min, x_max, x_label, y_label):
21 h = R.TH1F(name, title, n_bins, x_min, x_max)
22 h.GetXaxis().SetTitle(x_label)
23 h.GetYaxis().SetTitle(y_label)
27def addDetails(h, descr, check, contact_str, isShifter):
28 h.GetListOfFunctions().Add(R.TNamed(
"Description", descr))
29 h.GetListOfFunctions().Add(R.TNamed(
"Check", check))
30 h.GetListOfFunctions().Add(R.TNamed(
"Contact", contact_str))
32 h.GetListOfFunctions().Add(R.TNamed(
"MetaOptions",
"shifter"))
36SVDContact =
"SVD Software Group, svd-software@belle2.org"
39cut_L3 = R.TCut(
'layer==3')
40cut_L4 = R.TCut(
'layer==4')
41cut_L5 = R.TCut(
'layer==5')
42cut_L6 = R.TCut(
'layer==6')
43cut_L456 = R.TCut(
'(layer==4)||(layer==5)||(layer==6)')
44cut_s = R.TCut(
'sensor_type==0')
45cut_b = R.TCut(
'sensor_type==1')
46cut_matched = R.TCut(
'matched==1')
47cut_reco = R.TCut(
'reconstructed==1')
48cut_U = R.TCut(
'strip_dir==0')
49cut_V = R.TCut(
'strip_dir==1')
50cut_notV = R.TCut(
'strip_dir!=1')
51cut_notU = R.TCut(
'strip_dir!=0')
52cut_size1 = R.TCut(
'(cluster_size==1)')
53cut_size2 = R.TCut(
'(cluster_size==2)')
54cut_size3plus = R.TCut(
'(cluster_size>2)')
58gD = ((cut_L3 + cut_b + cut_U,
'L3_barrel_U_side'),
59 (cut_L3 + cut_b + cut_V,
'L3_barrel_V_side'),
60 (cut_L456 + cut_b + cut_U,
'L456_barrel_U_side'),
61 (cut_L456 + cut_b + cut_V,
'L456_barrel_V_side'),
62 (cut_L456 + cut_s + cut_U,
'L456_slanted_U_side'),
63 (cut_L456 + cut_s + cut_V,
'L456_slanted_V_side'))
65gD2 = ((cut_L3 + cut_b,
'L3_barrel'),
66 (cut_L456 + cut_b,
'L456_barrel'),
67 (cut_L456 + cut_s,
'L456_slanted'))
70granulesLayersTypes = ((cut_L3 + cut_b,
'L3_barrel'),
71 (cut_L4 + cut_b,
'L4_barrel'),
72 (cut_L4 + cut_s,
'L4_slanted'),
73 (cut_L5 + cut_b,
'L5_barrel'),
74 (cut_L5 + cut_s,
'L5_slanted'),
75 (cut_L6 + cut_b,
'L6_barrel'),
76 (cut_L6 + cut_s,
'L6_slanted'))
79granulesTD = ((cut_L3,
'L3-L4'),
83granulesL3456 = ((cut_L3,
'L3456'),)
85g_L3_V = ((cut_L3 + cut_V,
'L3_V'),)
88def plotter(name, title, nbins, xmin, xmax, x_label, y_label,
91 descr, check, contact_str=SVDContact, isShifter=False):
93 hName = f
'{name}_{g[1]}'
94 h = create1DHist(hName, title, nbins, xmin, xmax, x_label, y_label)
98 selection = g[0] + cut
99 tree.Draw(f
'{expr}>>{hName}', selection,
'goff')
100 addDetails(h, descr, check, contact_str, isShifter)
101 h.SetTitle(f
'{title} ({g[1]})')
105def plotRegions(name, title, x_label, y_label,
107 tree, expr, cutALL, cut,
108 descr, check, contact_str=SVDContact, isShifter=False):
110 h = create1DHist(hName, title, len(granules), 1, len(granules) + 1, x_label, y_label)
111 h.GetYaxis().SetRangeUser(0, 1.4)
112 for i, g
in enumerate(granules, 1):
113 h.GetXaxis().SetBinLabel(i, g[1])
117 selectionALL = g[0] + cutALL
118 n_all = tree.Draw(f
'{expr}', selectionALL,
'goff')
122 selection = g[0] + cut
123 n_selected = tree.Draw(f
'{expr}', selectionALL + selection,
'goff')
124 h.SetBinContent(i, n_selected / n_all)
125 h.SetBinError(i, (n_selected / n_all) * (1 / n_selected + 1 / n_all)**0.5)
126 addDetails(h, descr, check, contact_str, isShifter)
127 h.SetTitle(f
'{title}')