Belle II Software  release-05-02-19
parameters.py
1 from ROOT import Belle2
2 
3 
4 def cdc_layers(layers=None):
5  if layers is None:
6  layers = [l for l in range(0, 56)]
7 
8  result = []
9 
10  wire = 511
11  for layer in layers:
12  for param in [1, 2, 6, 11, 12, 16]:
13  wireid = Belle2.WireID(layer, wire).getEWire()
14  label = Belle2.GlobalLabel()
15  label.construct(Belle2.CDCAlignment.getGlobalUniqueID(), wireid, param)
16  result.append(label.label())
17 
18  return result
19 
20 
21 def cdc_wires():
22  wires_in_layer = [
23  160, 160, 160, 160, 160, 160, 160, 160,
24  160, 160, 160, 160, 160, 160,
25  192, 192, 192, 192, 192, 192,
26  224, 224, 224, 224, 224, 224,
27  256, 256, 256, 256, 256, 256,
28  288, 288, 288, 288, 288, 288,
29  320, 320, 320, 320, 320, 320,
30  352, 352, 352, 352, 352, 352,
31  384, 384, 384, 384, 384, 384]
32 
33  result = []
34 
35  for layer in range(0, 56):
36  for wire in range(0, wires_in_layer[layer]):
37  # Unique id of CDCAlignment db object
39 
40  wireid = Belle2.WireID(layer, wire).getEWire()
41  label = Belle2.GlobalLabel()
42 
43  label.construct(cdcid, wireid, Belle2.CDCAlignment.wireBwdX)
44  result.append(label.label())
45 
46  label.construct(cdcid, wireid, Belle2.CDCAlignment.wireFwdX)
47  result.append(label.label())
48 
49  label.construct(cdcid, wireid, Belle2.CDCAlignment.wireBwdY)
50  result.append(label.label())
51 
52  label.construct(cdcid, wireid, Belle2.CDCAlignment.wireFwdY)
53  result.append(label.label())
54 
55  return result
56 
57 
58 def cdc_t0s():
59  wires_in_layer = [
60  160, 160, 160, 160, 160, 160, 160, 160,
61  160, 160, 160, 160, 160, 160,
62  192, 192, 192, 192, 192, 192,
63  224, 224, 224, 224, 224, 224,
64  256, 256, 256, 256, 256, 256,
65  288, 288, 288, 288, 288, 288,
66  320, 320, 320, 320, 320, 320,
67  352, 352, 352, 352, 352, 352,
68  384, 384, 384, 384, 384, 384]
69 
70  result = []
71 
72  for layer in range(0, 56):
73  for wire in range(0, wires_in_layer[layer]):
74  label = Belle2.GlobalLabel()
75  label.construct(Belle2.CDCTimeZeros.getGlobalUniqueID(), Belle2.WireID(layer, wire).getEWire(), 0)
76  result.append(label.label())
77 
78  return result
79 
80 
81 def vxd_halfshells(pxd=True, svd=True, parameters=None, ying=True, yang=True, pat=True, mat=True):
82  if parameters is None:
83  parameters = [1, 2, 3, 4, 5, 6]
84 
85  result = []
86 
87  shells = []
88  _ying = Belle2.VxdID(1, 0, 0, 1)
89  _yang = Belle2.VxdID(1, 0, 0, 2)
90  _pat = Belle2.VxdID(3, 0, 0, 1)
91  _mat = Belle2.VxdID(3, 0, 0, 2)
92 
93  if pxd:
94  if ying:
95  shells.append(_ying)
96  if yang:
97  shells.append(_yang)
98  if svd:
99  if pat:
100  shells.append(_pat)
101  if mat:
102  shells.append(_mat)
103 
104  for vxdid in shells:
105  for param in parameters:
106  vxdid = Belle2.VxdID(vxdid).getID()
107  label = Belle2.GlobalLabel()
108  label.construct(Belle2.VXDAlignment.getGlobalUniqueID(), vxdid, param)
109  result.append(label.label())
110 
111  return result
112 
113 
114 def beamspot():
115 
116  result = []
117 
118  for param in [1, 2, 3]:
119  label = Belle2.GlobalLabel()
120  label.construct(Belle2.BeamSpot.getGlobalUniqueID(), 0, param)
121  result.append(label.label())
122 
123  return result
124 
125 
126 def vxd_ladders(layers=None, parameters=None):
127  if layers is None:
128  layers = [1, 2, 3, 4, 5, 6]
129  if parameters is None:
130  parameters = [1, 2, 3, 4, 5, 6]
131 
132  result = []
133 
134  ladders = [8, 12, 7, 10, 12, 16]
135 
136  for layer in layers:
137  for ladder in range(1, ladders[layer - 1] + 1):
138  for ipar in parameters:
139  label = Belle2.GlobalLabel()
140  label.construct(Belle2.VXDAlignment.getGlobalUniqueID(), Belle2.VxdID(layer, ladder, 0).getID(), ipar)
141  result.append(label.label())
142 
143  return result
144 
145 
146 def vxd_sensors(layers=None, rigid=True, surface=True, surface2=True, surface3=True, surface4=True, parameters=None):
147  if layers is None:
148  layers = [1, 2, 3, 4, 5, 6]
149 
150  params_rigid = [1, 2, 3, 4, 5, 6]
151  params_surface2 = [31, 32, 33]
152  params_surface3 = [41, 42, 43, 44]
153  params_surface4 = [51, 52, 53, 54, 55]
154 
155  params = []
156  if rigid:
157  params += params_rigid
158 
159  if surface:
160  if surface2:
161  params += params_surface2
162  if surface3:
163  params += params_surface3
164  if surface4:
165  params += params_surface4
166 
167  # Allow full override by user
168  if parameters:
169  params = parameters
170 
171  result = []
172 
173  ladders = [8, 12, 7, 10, 12, 16]
174  sensors = [2, 2, 2, 3, 4, 5]
175 
176  for layer in layers:
177  for ladder in range(1, ladders[layer - 1] + 1):
178  for sensor in range(1, sensors[layer - 1] + 1):
179  for param in params:
180  label = Belle2.GlobalLabel()
181  label.construct(Belle2.VXDAlignment.getGlobalUniqueID(), Belle2.VxdID(layer, ladder, sensor).getID(), param)
182  result.append(label.label())
183  return result
184 
185 
186 def vxd():
187  return vxd_sensors() + vxd_ladders() + vxd_halfshells()
188 
189 
190 def pxd():
191  return vxd_sensors(layers=[1, 2]) + vxd_ladders(layers=[1, 2]) + vxd_halfshells(pxd=True, svd=False)
192 
193 
194 def svd():
195  return vxd_sensors(layers=[3, 4, 5, 6]) + vxd_ladders(layers=[3, 4, 5, 6]) + vxd_halfshells(pxd=False, svd=True)
196 
197 
198 def all():
199  # TODO: klm
200  return beamspot() + pxd() + svd() + cdc_layers() + cdc_wires() + cdc_t0s()
201 
202 
203 if __name__ == '__main__':
204  print("Number of available parameters:")
205  print("BeamSpot:", len(beamspot()))
206  print("PXD:", len(pxd()))
207  print("SVD:", len(svd()))
208  print("( VXD:", len(vxd()), ")")
209  assert(len(vxd()) == len(pxd()) + len(svd()))
210  print("CDC layers:", len(cdc_layers()))
211  print("CDC wires:", len(cdc_wires()))
212  print("CDC T0s:", len(cdc_t0s()))
213  print("TOTAL:", len(all()))
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::getID
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:71
Belle2::VXDAlignment::getGlobalUniqueID
static unsigned short getGlobalUniqueID()
Get global unique id.
Definition: VXDAlignment.h:57
Belle2::GlobalLabel
Class to convert to/from global labels for Millepede II to/from detector & parameter identificators.
Definition: GlobalLabel.h:51
beamspot
Definition: beamspot.py:1
svd
Definition: __init__.py:1
pxd
Definition: __init__.py:1
Belle2::CDCAlignment::getGlobalUniqueID
static unsigned short getGlobalUniqueID()
Get global unique id.
Definition: CDCAlignment.h:119
Belle2::CDCTimeZeros::getGlobalUniqueID
static unsigned short getGlobalUniqueID()
Get global unique id.
Definition: CDCTimeZeros.h:150
Belle2::BeamSpot::getGlobalUniqueID
static unsigned short getGlobalUniqueID()
Return unique ID of BeamSpot in global Millepede calibration (1)
Definition: BeamSpot.h:101