7 def create1DHist(name, title, n_bins, x_min, x_max, x_label, y_label):
8 h = R.TH1F(name, title, n_bins, x_min, x_max)
9 h.GetXaxis().SetTitle(x_label)
10 h.GetYaxis().SetTitle(y_label)
14 def addDetails(h, descr, check, contact_str, isShifter):
15 h.GetListOfFunctions().Add(R.TNamed(
"Description", descr))
16 h.GetListOfFunctions().Add(R.TNamed(
"Check", check))
17 h.GetListOfFunctions().Add(R.TNamed(
"Contact", contact_str))
19 h.GetListOfFunctions().Add(R.TNamed(
"MetaOptions",
"shifter"))
22 SVDContact =
"SVD Software Group, svd-software@belle2.org"
26 cut_L3 = R.TCut(
'layer==3')
27 cut_L4 = R.TCut(
'layer==4')
28 cut_L5 = R.TCut(
'layer==5')
29 cut_L6 = R.TCut(
'layer==6')
30 cut_L456 = R.TCut(
'(layer==4)||(layer==5)||(layer==6)')
31 cut_s = R.TCut(
'sensor_type==0')
32 cut_b = R.TCut(
'sensor_type==1')
33 cut_U = R.TCut(
'strip_dir==0')
34 cut_V = R.TCut(
'strip_dir==1')
35 cut_noU = R.TCut(
'strip_dir!=0')
36 cut_noV = R.TCut(
'strip_dir!=1')
37 cut_Usize1 = R.TCut(
'(cluster_size==1)&&(strip_dir==0)')
38 cut_Vsize1 = R.TCut(
'(cluster_size==1)&&(strip_dir==1)')
39 cut_Usize2 = R.TCut(
'(cluster_size==2)&&(strip_dir==0)')
40 cut_Vsize2 = R.TCut(
'(cluster_size==2)&&(strip_dir==1)')
41 cut_Usize3plus = R.TCut(
'(cluster_size>2)&&(strip_dir==0)')
42 cut_Vsize3plus = R.TCut(
'(cluster_size>2)&&(strip_dir==1)')
43 cut_oneTH = R.TCut(
'cluster_truehits_number==1')
44 cut_noUV = R.TCut(
'strip_dir==-1')
48 gD = ((cut_L3+cut_b+cut_U,
'L3_barrel_U_side'),
49 (cut_L3+cut_b+cut_V,
'L3_barrel_V_side'),
50 (cut_L456+cut_b+cut_U,
'L456_barrel_U_side'),
51 (cut_L456+cut_b+cut_V,
'L456_barrel_V_side'),
52 (cut_L456+cut_s+cut_U,
'L456_slanted_U_side'),
53 (cut_L456+cut_s+cut_V,
'L456_slanted_V_side'))
55 gD2 = ((cut_L3+cut_b,
'L3_barrel'),
56 (cut_L456+cut_b,
'L456_barrel'),
57 (cut_L456+cut_s,
'L456_slanted'))
60 granulesLayersTypes = ((cut_L3+cut_b,
'L3_barrel'),
61 (cut_L4+cut_b,
'L4_barrel'),
62 (cut_L4+cut_s,
'L4_slanted'),
63 (cut_L5+cut_b,
'L5_barrel'),
64 (cut_L5+cut_s,
'L5_slanted'),
65 (cut_L6+cut_b,
'L6_barrel'),
66 (cut_L6+cut_s,
'L6_slanted'))
69 granulesTD = ((cut_L3,
'L3-L4'),
73 granulesL3456 = ((cut_L3,
'L3456'),)
76 def ploter(name, title, nbins, xmin, xmax, x_label, y_label,
79 descr, check, contact_str=SVDContact, isShifter=False):
81 hName = f
'{name}_{g[1]}'
82 h = create1DHist(hName, title, nbins, xmin, xmax, x_label, y_label)
86 selection = g[0] + cut
87 tree.Draw(f
'{expr}>>{hName}', selection,
'goff')
88 addDetails(h, descr, check, contact_str, isShifter)
89 h.SetTitle(f
'{title} ({g[1]})')
93 def plotRegions(name, title, x_label, y_label,
95 tree, expr, cutALL, cut,
96 descr, check, contact_str=SVDContact, isShifter=False):
98 h = create1DHist(hName, title, len(granules), 1, len(granules)+1, x_label, y_label)
99 h.GetYaxis().SetRangeUser(0, 1.4)
100 for i, g
in enumerate(granules, 1):
101 h.GetXaxis().SetBinLabel(i, g[1])
105 selectionALL = g[0] + cutALL
106 n_all = tree.Draw(f
'{expr}', selectionALL,
'goff')
110 selection = g[0] + cut
111 n_selected = tree.Draw(f
'{expr}', selectionALL+selection,
'goff')
112 h.SetBinContent(i, n_selected/n_all)
113 h.SetBinError(i, (n_selected/n_all)*(1/n_selected+1/n_all)**0.5)
114 addDetails(h, descr, check, contact_str, isShifter)
115 h.SetTitle(f
'{title}')