Belle II Software development
test_geotools.py
1
8
9import basf2
10from ROOT import Belle2
11import b2test_utils
12
13# ====================================================================
14# This test checks the numberingg schemes used in VXD DQM utility class.
15# It builds a single event to have geometry in place, and only checks
16# that ID->list index->ID works for sensor and chip lists.
17# ====================================================================
18
19
20class CheckNumbering(basf2.Module):
21 """This module creates a DQMCommonUtils object and tests sensor
22 and chip numbering schemes."""
23
24 def __init__(self):
25 """ constructor """
26 super().__init__()
27
28 def initialize(self):
29 """ Initialize the DQMCommonUtils class here. It builds
30 its lookup arrrays, so we want to do it only once."""
31
33 if not self.gTools:
34 basf2.B2FATAL("GeoTools not available!")
35
36 def event(self):
37 """ We test sensor and chip numbering by going from ID to
38 list number to ID."""
39 #
40 # 0. General parameters
41 #
42 # 0a. Layer counts
43 if (self.gTools.getNumberOfLayers() != 6):
44 basf2.B2ERROR(f'Layer count failure: \n {self.gTools.getNumberOfLayers()} layers reported, 6 actually.')
45 if (self.gTools.getNumberOfPXDLayers() != 2):
46 basf2.B2ERROR(f'PXD layer count failure: \n {self.gTools.getNumberOfPXDLayers()} layers reported, 2 actually.')
47 if (self.gTools.getNumberOfSVDLayers() != 4):
48 basf2.B2ERROR(f'SVD layer count failure: \n {self.gTools.getNumberOfSVDLayers()} layers reported, 4 actually.')
49 # 0b. Layer numbers
50 layers = self.gTools.getLayers()
51 expected_layers = [1, 2, 3, 4, 5, 6]
52 match = True
53 for l1, l2 in zip(layers, expected_layers):
54 if l1 != l2:
55 match = False
56 break
57 if not match:
58 l1_string = ' '.join([str(x) for x in layers])
59 l2_string = ' '.join([str(x) for x in expected_layers])
60 basf2.B2ERROR(f'Layer numbers do not match, expected {l2_string}, got {l1_string}!')
61
62 layers = self.gTools.getPXDLayers()
63 expected_layers = [1, 2]
64 match = True
65 for l1, l2 in zip(layers, expected_layers):
66 if l1 != l2:
67 match = False
68 break
69 if not match:
70 l1_string = ' '.join([str(x) for x in layers])
71 l2_string = ' '.join([str(x) for x in expected_layers])
72 basf2.B2ERROR(f'PXD layer numbers do not match, expected {l2_string}, got {l1_string}!')
73
74 layers = self.gTools.getSVDLayers()
75 expected_layers = [3, 4, 5, 6]
76 match = True
77 for l1, l2 in zip(layers, expected_layers):
78 if l1 != l2:
79 match = False
80 break
81 if not match:
82 l1_string = ' '.join([str(x) for x in layers])
83 l2_string = ' '.join([str(x) for x in expected_layers])
84 basf2.B2ERROR(f'SVD layer numbers do not match, expected {l2_string}, got {l1_string}!')
85
86 # 0c. Layer ranges
87 if (self.gTools.getFirstLayer() != 1):
88 basf2.B2ERROR(f'First layer number is 1, reported {self.gTools.getFirstLayer()}.')
89 if (self.gTools.getLastLayer() != 6):
90 basf2.B2ERROR(f'Last layer number is 6, reported {self.gTools.getLastLayer()}.')
91 if (self.gTools.getFirstPXDLayer() != 1):
92 basf2.B2ERROR(f'First PXD layer number is 1, reported {self.gTools.getFirstPXDLayer()}.')
93 if (self.gTools.getLastPXDLayer() != 2):
94 basf2.B2ERROR(f'Last PXD layer number is 2, reported {self.gTools.getLastPXDLayer()}.')
95 if (self.gTools.getFirstSVDLayer() != 3):
96 basf2.B2ERROR(f'First SVD layer number is 3, reported {self.gTools.getFirstSVDLayer()}.')
97 if (self.gTools.getLastSVDLayer() != 6):
98 basf2.B2ERROR(f'Last SVD layer number is 6, reported {self.gTools.getLastSVDLayer()}.')
99 # 0d. Sensor indexing range
100 # PXD
101 # First PXD sensor should be (first PXD layer)/1/1,
102 idOfFirstPXDSensor = self.gTools.getSensorIDFromPXDIndex(0)
103 layer = idOfFirstPXDSensor.getLayerNumber()
104 ladder = idOfFirstPXDSensor.getLadderNumber()
105 sensor = idOfFirstPXDSensor.getSensorNumber()
106 if layer != self.gTools.getFirstPXDLayer() or ladder != 1 or sensor != 1:
107 basf2.B2ERROR('Mismatch in first PXD sensor placement:\n' +
108 f'Expected {layer}/{ladder}/{sensor}\nGot: {self.gTools.getFirstPXDLayer()}/{1}/{1}')
109 idOfLastPXDSensor = self.gTools.getSensorIDFromPXDIndex(self.gTools.getNumberOfPXDSensors() - 1)
110 layer = idOfLastPXDSensor.getLayerNumber()
111 if layer != self.gTools.getLastPXDLayer():
112 basf2.B2ERROR('Mismatch in last PXD sensor placement:\n' +
113 f'Expected layer {layer} got layer {self.gTools.getLastPXDLayer()}')
114 # SVD
115 # First SVD sensor should be (first PXD layer)/1/1,
116 idOfFirstSVDSensor = self.gTools.getSensorIDFromSVDIndex(0)
117 layer = idOfFirstSVDSensor.getLayerNumber()
118 ladder = idOfFirstSVDSensor.getLadderNumber()
119 sensor = idOfFirstSVDSensor.getSensorNumber()
120 if layer != self.gTools.getFirstSVDLayer() or ladder != 1 or sensor != 1:
121 basf2.B2ERROR('Mismatch in first SVD sensor placement:\n' +
122 f'Expected {layer}/{ladder}/{sensor}\nGot: {self.gTools.getFirstSVDLayer()}/{1}/{1}')
123 idOfLastSVDSensor = self.gTools.getSensorIDFromSVDIndex(self.gTools.getNumberOfSVDSensors() - 1)
124 layer = idOfLastSVDSensor.getLayerNumber()
125 if layer != self.gTools.getLastSVDLayer():
126 basf2.B2ERROR('Mismatch in last SVD sensor placement:\n' +
127 f'Expected layer {layer} got layer {self.gTools.getLastSVDLayer()}')
128 #
129 # 1. General sensor indexing
130 #
131 # 1a. Basic loop
132 init_sensorID = Belle2.VxdID(3, 1, 1)
133 init_sensor_index = self.gTools.getSensorIndex(init_sensorID)
134 ret_sensorID = self.gTools.getSensorIDFromIndex(init_sensor_index)
135 if init_sensorID.getID() != ret_sensorID.getID():
136 basf2.B2ERROR(
137 f"Sensor index failure: \n Initial id: {init_sensorID} \n VXD index: {init_sensor_index} \n Retrieved id: " +
138 f"{ret_sensorID}.")
139 # 1b. Neighbourhood test
140 next_sensorID = self.gTools.getSensorIDFromIndex(init_sensor_index + 1)
141 next_expected_sensorID = Belle2.VxdID(init_sensorID)
142 next_expected_sensorID.setSensorNumber(init_sensorID.getSensorNumber() + 1)
143 if next_expected_sensorID.getID() != next_sensorID.getID():
144 basf2.B2ERROR('Sensor index neighbourhood test failure: \n' +
145 f'Initial id: {init_sensorID} \n Expected id: {next_expected_sensorID} \n Actaul id: ' +
146 f'{next_sensorID} \n Index: {init_sensor_index + 1}.')
147
148 # 1c. Sensor counting
149 num_sensors_expected = 212
150 if (self.gTools.getNumberOfSensors() != num_sensors_expected):
151 basf2.B2ERROR('Number of sensors mismatch: \n' +
152 f'Expected: {num_sensors_expected}, got {self.gTools.getNumberOfSensors()}.')
153 #
154 # 2. PXD sensor indexing
155 #
156 # 2a. Basic loop
157 init_sensorID = Belle2.VxdID(1, 2, 1)
158 init_sensor_index = self.gTools.getPXDSensorIndex(
159 init_sensorID.getLayerNumber(),
160 init_sensorID.getLadderNumber(),
161 init_sensorID.getSensorNumber())
162 ret_sensorID = self.gTools.getSensorIDFromPXDIndex(init_sensor_index)
163 if init_sensorID.getID() != ret_sensorID.getID():
164 basf2.B2ERROR(
165 f"PXD sensor index failure: \n Initial id: {init_sensorID} \n VXD index: {init_sensor_index} \n " +
166 f"Retrieved id: {ret_sensorID}.")
167 # 2b. Neighbourhood test
168 next_sensorID = self.gTools.getSensorIDFromPXDIndex(init_sensor_index + 1)
169 next_expected_sensorID = Belle2.VxdID(init_sensorID)
170 next_expected_sensorID.setSensorNumber(init_sensorID.getSensorNumber() + 1)
171 if next_expected_sensorID.getID() != next_sensorID.getID():
172 basf2.B2ERROR(
173 'PXD sensor index neighbourhood test failure: \n' +
174 f'Initial id: {init_sensorID} \n Expected id: {next_expected_sensorID} \n Actual id: {next_sensorID} \n ' +
175 f'Index: {init_sensor_index + 1}.')
176 # 2c. Sensor counting
177 num_sensors_expected = 40
178 if (self.gTools.getNumberOfPXDSensors() != num_sensors_expected):
179 basf2.B2ERROR('Number of PXD sensors mismatch: \n' +
180 f'Expected: {num_sensors_expected}, got {self.gTools.getNumberOfPXDSensors()}.')
181 #
182 # 3. SVD sensor indexing
183 #
184 # 2a. Basic loop
185 init_sensorID = Belle2.VxdID(4, 2, 1)
186 init_sensor_index = self.gTools.getSVDSensorIndex(
187 init_sensorID.getLayerNumber(),
188 init_sensorID.getLadderNumber(),
189 init_sensorID.getSensorNumber())
190 ret_sensorID = self.gTools.getSensorIDFromSVDIndex(init_sensor_index)
191 if init_sensorID.getID() != ret_sensorID.getID():
192 basf2.B2ERROR(
193 f"SVD sensor index failure: \n Initial id: {init_sensorID} \n VXD index: {init_sensor_index} \n " +
194 f"Retrieved id: {ret_sensorID}.")
195 # 2b. Neighbourhood test
196 next_sensorID = self.gTools.getSensorIDFromSVDIndex(init_sensor_index + 1)
197 next_expected_sensorID = Belle2.VxdID(init_sensorID)
198 next_expected_sensorID.setSensorNumber(init_sensorID.getSensorNumber() + 1)
199 if next_expected_sensorID.getID() != next_sensorID.getID():
200 basf2.B2ERROR(
201 f'SVD sensor index neighbourhood test failure: \nInitial id: {init_sensorID} \n Expected id: ' +
202 f'{next_expected_sensorID} \n Actaul id: {next_sensorID} \n Index: {init_sensor_index + 1}.')
203 # 3c. Sensor counting
204 num_sensors_expected = 172
205 if (self.gTools.getNumberOfSVDSensors() != num_sensors_expected):
206 basf2.B2ERROR('Number of SVD sensors mismatch: \n' +
207 f'Expected: {num_sensors_expected}, got {self.gTools.getNumberOfSVDSensors()}.')
208 #
209 # 4. Layer indexing
210 #
211 # 4a. Basic loop
212 init_layer = 4
213 init_layer_index = self.gTools.getLayerIndex(init_layer)
214 ret_layer = self.gTools.getLayerNumberFromLayerIndex(init_layer_index)
215 if init_layer != ret_layer:
216 basf2.B2ERROR(
217 f"Layer index failure: \n Initial: {init_layer} \n Index: {init_layer_index} \n Retrieved: {ret_layer}.")
218 # 2b. Neighbourhood test
219 next_layer = self.gTools.getLayerNumberFromLayerIndex(init_layer_index + 1)
220 next_expected_layer = init_layer + 1
221 if next_layer != next_expected_layer:
222 basf2.B2ERROR(
223 f"Layer index neighbourhood test failure: \n Initial id: {init_layer} \n Expected: " +
224 f"{next_expected_layer} \n Actaul: {next_layer} \n Index: {init_layer_index + 1}.")
225 #
226 # 5. PXD chip indexing
227 #
228 # 5a. Chip-on-sensor counts
229 if self.gTools.getTotalPXDChips() != 400:
230 basf2.B2ERROR('PXD chip count mismatch: \n' +
231 f'Expected: {2120}, got {self.gTools.getTotalPXDChips()}.'
232 )
233 if self.gTools.getNumberOfPXDUSideChips() != 4:
234 basf2.B2ERROR('PXD u-side chip count mismatch: \n' +
235 f'Expected: {4}, got {self.gTools.getNumberOfPXDUSideChips()}.'
236 )
237 if self.gTools.getNumberOfPXDVSideChips() != 6:
238 basf2.B2ERROR('PXD v-side chip count mismatch: \n' +
239 f'Expected: {6}, got {self.gTools.getNumberOfPXDVSideChips()}.'
240 )
241 if self.gTools.getTotalSVDChips() != 1748:
242 basf2.B2ERROR('SVD chip count mismatch: \n' +
243 f'Expected: {2148}, got {self.gTools.getTotalSVDChips()}.'
244 )
245 if self.gTools.getNumberOfSVDUSideChips() != 6:
246 basf2.B2ERROR('SVD u-side chip count mismatch: \n' +
247 f'Expected: {6}, got {self.gTools.getNumberOfSVDUSideChips()}.'
248 )
249 if self.gTools.getNumberOfSVDVSideChips(3) != 6:
250 basf2.B2ERROR('SVD v-side chip count mismatch: \n' +
251 f'Expected: {6}, got {self.gTools.getNumberOfSVDVSideChips(3)}.'
252 )
253 if self.gTools.getNumberOfSVDVSideChips(4) != 4:
254 basf2.B2ERROR('SVD v-side chip count mismatch: \n' +
255 f'Expected: {4}, got {self.gTools.getNumberOfSVDVSideChips(4)}.'
256 )
257 # 5b. PXD chip indexing - loop
258 init_layer = 1
259 init_ladder = 2
260 init_sensor = 1
261 init_uSide = True
262 init_chipNo = 4
263 index_with_vxdid = self.gTools.getPXDChipIndex(Belle2.VxdID(init_layer, init_ladder, init_sensor), init_uSide, init_chipNo)
264 index_with_llss = self.gTools.getPXDChipIndex(init_layer, init_ladder, init_sensor, init_uSide, init_chipNo)
265 if index_with_vxdid != index_with_llss:
266 basf2.B2ERROR('Mismatch between VxdID-based and layer-ladder-sensor based index:\n' +
267 f'VxdID-based: {index_with_vxdid}\nlayer-ladder-sensor: {index_with_llss}'
268 )
269 returned_chipID = self.gTools.getChipIDFromPXDIndex(index_with_vxdid)
270 returned_layer = returned_chipID.getLayerNumber()
271 returned_ladder = returned_chipID.getLadderNumber()
272 returned_sensor = returned_chipID.getSensorNumber()
273 returned_uSide = self.gTools.isPXDSideU(returned_chipID)
274 returned_chipNo = self.gTools.getPXDChipNumber(returned_chipID)
275 match = (init_layer == returned_layer) and \
276 (init_ladder == returned_ladder) and \
277 (init_sensor == returned_sensor) and \
278 (init_uSide == returned_uSide) and \
279 (init_chipNo == returned_chipNo)
280 if not match:
281 basf2.B2ERROR('Mismatch in PXD chip indexing:\n' +
282 f'Initial: {init_layer} {init_ladder} {init_sensor} {init_uSide} {init_chipNo}\n' +
283 f'Final: {returned_layer} {returned_ladder} {returned_sensor} {returned_uSide} {returned_chipNo}.'
284 )
285 # 5c. PXD chip indexing - neighbourhood
286 # We are expecting same sensor, v-side, chip 0
287 expected_layer = init_layer
288 expected_ladder = init_ladder
289 expected_sensor = init_sensor
290 expected_uSide = False
291 expected_chipNo = 1
292 neighbour_chipID = self.gTools.getChipIDFromPXDIndex(index_with_vxdid + 1)
293 neighbour_layer = neighbour_chipID.getLayerNumber()
294 neighbour_ladder = neighbour_chipID.getLadderNumber()
295 neighbour_sensor = neighbour_chipID.getSensorNumber()
296 neighbour_uSide = self.gTools.isPXDSideU(neighbour_chipID)
297 neighbour_chipNo = self.gTools.getPXDChipNumber(neighbour_chipID)
298 match = (expected_layer == neighbour_layer) and \
299 (expected_ladder == neighbour_ladder) and \
300 (expected_sensor == neighbour_sensor) and \
301 (expected_uSide == neighbour_uSide) and \
302 (expected_chipNo == neighbour_chipNo)
303 if not match:
304 basf2.B2ERROR('Mismatch in PXD chip index neighbourship:\n' +
305 f'Expected: {expected_layer} {expected_ladder} {expected_sensor} {expected_uSide} {expected_chipNo}\n' +
306 f'Obtained: {neighbour_layer} {neighbour_ladder} {neighbour_sensor} {neighbour_uSide} {neighbour_chipNo}.'
307 )
308
309 # 5d. SVD chip indexing - loop
310 init_layer = 3
311 init_ladder = 2
312 init_sensor = 1
313 init_uSide = True
314 init_chipNo = 6
315 index_with_vxdid = self.gTools.getSVDChipIndex(Belle2.VxdID(init_layer, init_ladder, init_sensor), init_uSide, init_chipNo)
316 index_with_llss = self.gTools.getSVDChipIndex(init_layer, init_ladder, init_sensor, init_uSide, init_chipNo)
317 if index_with_vxdid != index_with_llss:
318 basf2.B2ERROR('Mismatch between VxdID-based and layer-ladder-sensor based index:\n' +
319 f'VxdID-based: {index_with_vxdid}\nlayer-ladder-sensor: {index_with_llss}'
320 )
321 returned_chipID = self.gTools.getChipIDFromSVDIndex(index_with_vxdid)
322 returned_layer = returned_chipID.getLayerNumber()
323 returned_ladder = returned_chipID.getLadderNumber()
324 returned_sensor = returned_chipID.getSensorNumber()
325 returned_uSide = self.gTools.isSVDSideU(returned_chipID)
326 returned_chipNo = self.gTools.getSVDChipNumber(returned_chipID)
327 match = (init_layer == returned_layer) and \
328 (init_ladder == returned_ladder) and \
329 (init_sensor == returned_sensor) and \
330 (init_uSide == returned_uSide) and \
331 (init_chipNo == returned_chipNo)
332 if not match:
333 basf2.B2ERROR('Mismatch in SVD chip indexing:\n' +
334 f'Initial: {init_layer} {init_ladder} {init_sensor} {init_uSide} {init_chipNo}\n' +
335 f'Final: {returned_layer} {returned_ladder} {returned_sensor} {returned_uSide} {returned_chipNo}.'
336 )
337 # 5e. SVD chip indexing - neighbourhood
338 # We are expecting same sensor, v-side, chip 0
339 expected_layer = init_layer
340 expected_ladder = init_ladder
341 expected_sensor = init_sensor
342 expected_uSide = False
343 expected_chipNo = 1
344 neighbour_chipID = self.gTools.getChipIDFromSVDIndex(index_with_vxdid + 1)
345 neighbour_layer = neighbour_chipID.getLayerNumber()
346 neighbour_ladder = neighbour_chipID.getLadderNumber()
347 neighbour_sensor = neighbour_chipID.getSensorNumber()
348 neighbour_uSide = self.gTools.isSVDSideU(neighbour_chipID)
349 neighbour_chipNo = self.gTools.getSVDChipNumber(neighbour_chipID)
350 match = (expected_layer == neighbour_layer) and \
351 (expected_ladder == neighbour_ladder) and \
352 (expected_sensor == neighbour_sensor) and \
353 (expected_uSide == neighbour_uSide) and \
354 (expected_chipNo == neighbour_chipNo)
355 if not match:
356 basf2.B2ERROR('Mismatch in SVD chip index neighbourship:\n' +
357 f'Expected: {expected_layer} {expected_ladder} {expected_sensor} {expected_uSide} {expected_chipNo}\n' +
358 f'Obtained: {neighbour_layer} {neighbour_ladder} {neighbour_sensor} {neighbour_uSide} {neighbour_chipNo}.'
359 )
360 # 5f. Test of PXD chip assignment
361 # We want to see that the first and last chips have correct placement.
362 indexOfFirstPXDChip = 0
363 # First chip must be on first PXD layer, 1st ladder, 1st sensor, u-sie,
364 # chip 0.
365 idOfFirstPXDChip = self.gTools.getChipIDFromPXDIndex(indexOfFirstPXDChip)
366 firstChipLayer = idOfFirstPXDChip.getLayerNumber()
367 firstChipLadder = idOfFirstPXDChip.getLadderNumber()
368 firstChipSensor = idOfFirstPXDChip.getSensorNumber()
369 firstChipUSide = self.gTools.isPXDSideU(idOfFirstPXDChip)
370 firstChipNo = self.gTools.getPXDChipNumber(idOfFirstPXDChip)
371 if (firstChipLayer != self.gTools.getFirstPXDLayer() or
372 firstChipLadder != 1 or
373 firstChipSensor != 1 or
374 not firstChipUSide or
375 firstChipNo != 1):
376 basf2.B2ERROR(
377 f"Wrong 1st PXD chip assignment:\nExpected {self.gTools.getFirstPXDLayer()}/{1}/{1} side u chip {1},\nGot " +
378 f"{firstChipLayer}/{firstChipLadder}/{firstChipSensor} side {'u' if firstChipUSide else 'v'} chip {firstChipNo}")
379 indexOfLastPXDChip = self.gTools.getTotalPXDChips() - 1
380 # Last chip must be on last PXD layer, v-sie, chip 6.
381 idOfLastPXDChip = self.gTools.getChipIDFromPXDIndex(indexOfLastPXDChip)
382 lastChipLayer = idOfLastPXDChip.getLayerNumber()
383 lastChipUSide = self.gTools.isPXDSideU(idOfLastPXDChip)
384 lastChipNo = self.gTools.getPXDChipNumber(idOfLastPXDChip)
385 expectedLastChipNo = self.gTools.getNumberOfPXDVSideChips(self.gTools.getLastPXDLayer())
386 if (lastChipLayer != self.gTools.getLastPXDLayer() or
387 lastChipUSide or
388 lastChipNo != expectedLastChipNo):
389 basf2.B2ERROR(
390 'Wrong last PXD chip assignment:\n' +
391 f"Expected layer {self.gTools.getLastPXDLayer()} side v chip {expectedLastChipNo},\nGot layer " +
392 f"{lastChipLayer} side {'u' if lastChipUSide else 'v'} chip {lastChipNo}")
393 # 5g. Test of SVD chip assignment
394 # We want to see that the first and last chips have correct placement.
395 indexOfFirstSVDChip = 0
396 # First chip must be on first SVD layer, 1st ladder, 1st sensor, u-sie,
397 # chip 0.
398 idOfFirstSVDChip = self.gTools.getChipIDFromSVDIndex(indexOfFirstSVDChip)
399 firstChipLayer = idOfFirstSVDChip.getLayerNumber()
400 firstChipLadder = idOfFirstSVDChip.getLadderNumber()
401 firstChipSensor = idOfFirstSVDChip.getSensorNumber()
402 firstChipUSide = self.gTools.isSVDSideU(idOfFirstSVDChip)
403 firstChipNo = self.gTools.getSVDChipNumber(idOfFirstSVDChip)
404 if (firstChipLayer != self.gTools.getFirstSVDLayer() or
405 firstChipLadder != 1 or
406 firstChipSensor != 1 or
407 not firstChipUSide or
408 firstChipNo != 1):
409 basf2.B2ERROR(
410 f"Wrong 1st SVD chip assignment:\nExpected {self.gTools.getFirstSVDLayer()}/{1}/{1} side u chip {1},\nGot " +
411 f"{firstChipLayer}/{firstChipLadder}/{firstChipSensor} side {'u' if firstChipUSide else 'v'} chip {firstChipNo}")
412 indexOfLastSVDChip = self.gTools.getTotalSVDChips() - 1
413 # Last chip must be on last SVD layer, v-sie, chip 6.
414 idOfLastSVDChip = self.gTools.getChipIDFromSVDIndex(indexOfLastSVDChip)
415 lastChipLayer = idOfLastSVDChip.getLayerNumber()
416 lastChipUSide = self.gTools.isSVDSideU(idOfLastSVDChip)
417 lastChipNo = self.gTools.getSVDChipNumber(idOfLastSVDChip)
418 expectedLastChipNo = self.gTools.getNumberOfSVDVSideChips(self.gTools.getLastSVDLayer())
419 if (lastChipLayer != self.gTools.getLastSVDLayer() or
420 lastChipUSide or
421 lastChipNo != expectedLastChipNo):
422 basf2.B2ERROR(
423 'Wrong last SVD chip assignment:\n' +
424 f"Expected layer {self.gTools.getLastSVDLayer()} side v chip {expectedLastChipNo},\nGot layer " +
425 f"{lastChipLayer} side {'u' if lastChipUSide else 'v'} chip {lastChipNo}")
426
427 # END OF TESTS
428
429
430if __name__ == "__main__":
431
433
434 basf2.B2INFO('Setting up a basf2 run...')
435
436 check_numbering = basf2.create_path()
437 check_numbering.add_module('EventInfoSetter', expList=[0], runList=[0], evtNumList=[1])
438 check_numbering.add_module('Gearbox')
439 check_numbering.add_module('Geometry', components=['MagneticField', 'PXD', 'SVD'])
440 check_numbering.add_module(CheckNumbering())
441 # with b2test_utils.show_only_errors():
442 b2test_utils.safe_process(check_numbering)
443
444 basf2.B2INFO('Test complete.')
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
gTools
Reference to GeoTools class.
def clean_working_directory()
Definition: __init__.py:189
def safe_process(*args, **kwargs)
Definition: __init__.py:236