13 <noexecute>Used as library.</noexecute>
20 def 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)
27 def 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"))
36 SVDContact =
"SVD Software Group, svd-software@belle2.org"
40 cut_L3 = R.TCut(
'layer==3')
41 cut_L4 = R.TCut(
'layer==4')
42 cut_L5 = R.TCut(
'layer==5')
43 cut_L6 = R.TCut(
'layer==6')
44 cut_L456 = R.TCut(
'(layer==4)||(layer==5)||(layer==6)')
45 cut_s = R.TCut(
'sensor_type==0')
46 cut_b = R.TCut(
'sensor_type==1')
47 cut_U = R.TCut(
'strip_dir==0')
48 cut_V = R.TCut(
'strip_dir==1')
49 cut_noU = R.TCut(
'strip_dir!=0')
50 cut_noV = R.TCut(
'strip_dir!=1')
51 cut_size1 = R.TCut(
'(cluster_size==1)')
52 cut_size2 = R.TCut(
'(cluster_size==2)')
53 cut_size3plus = R.TCut(
'(cluster_size>2)')
54 cut_oneTH = R.TCut(
'cluster_truehits_number==1')
55 cut_noUV = R.TCut(
'strip_dir==-1')
59 gD = ((cut_L3 + cut_b + cut_U,
'L3_barrel_U_side'),
60 (cut_L3 + cut_b + cut_V,
'L3_barrel_V_side'),
61 (cut_L456 + cut_b + cut_U,
'L456_barrel_U_side'),
62 (cut_L456 + cut_b + cut_V,
'L456_barrel_V_side'),
63 (cut_L456 + cut_s + cut_U,
'L456_slanted_U_side'),
64 (cut_L456 + cut_s + cut_V,
'L456_slanted_V_side'))
66 gD2 = ((cut_L3 + cut_b,
'L3_barrel'),
67 (cut_L456 + cut_b,
'L456_barrel'),
68 (cut_L456 + cut_s,
'L456_slanted'))
71 granulesLayersTypes = ((cut_L3 + cut_b,
'L3_barrel'),
72 (cut_L4 + cut_b,
'L4_barrel'),
73 (cut_L4 + cut_s,
'L4_slanted'),
74 (cut_L5 + cut_b,
'L5_barrel'),
75 (cut_L5 + cut_s,
'L5_slanted'),
76 (cut_L6 + cut_b,
'L6_barrel'),
77 (cut_L6 + cut_s,
'L6_slanted'))
80 granulesTD = ((cut_L3,
'L3-L4'),
84 granulesL3456 = ((cut_L3,
'L3456'),)
86 g_L3_V = ((cut_L3 + cut_V,
'L3_V'),)
89 def plotter(name, title, nbins, xmin, xmax, x_label, y_label,
92 descr, check, contact_str=SVDContact, isShifter=False):
94 hName = f
'{name}_{g[1]}'
95 h = create1DHist(hName, title, nbins, xmin, xmax, x_label, y_label)
99 selection = g[0] + cut
100 tree.Draw(f
'{expr}>>{hName}', selection,
'goff')
101 addDetails(h, descr, check, contact_str, isShifter)
102 h.SetTitle(f
'{title} ({g[1]})')
106 def plotRegions(name, title, x_label, y_label,
108 tree, expr, cutALL, cut,
109 descr, check, contact_str=SVDContact, isShifter=False):
111 h = create1DHist(hName, title, len(granules), 1, len(granules) + 1, x_label, y_label)
112 h.GetYaxis().SetRangeUser(0, 1.4)
113 for i, g
in enumerate(granules, 1):
114 h.GetXaxis().SetBinLabel(i, g[1])
118 selectionALL = g[0] + cutALL
119 n_all = tree.Draw(f
'{expr}', selectionALL,
'goff')
123 selection = g[0] + cut
124 n_selected = tree.Draw(f
'{expr}', selectionALL + selection,
'goff')
125 h.SetBinContent(i, n_selected / n_all)
126 h.SetBinError(i, (n_selected / n_all) * (1 / n_selected + 1 / n_all)**0.5)
127 addDetails(h, descr, check, contact_str, isShifter)
128 h.SetTitle(f
'{title}')