4 """ Test for the hierarchy in VXD
6 Ensure that hierarchy can compute the same global positions
7 of sensors as what is stored in GeoCache.
8 + checks, that moving a ladder really moves a sensor in expected manner
10 If anyone changes the geometry construction (e.g. ladder coordinate system)
11 and does not correctly change hierarchy filling, this test will fail.
19 from ROOT
import Belle2
23 """Python module to compare transformations stored in GeoCache and computed by the hierarchy"""
32 """ module initialization - after geometry, so GeoCache is ready """
35 print(
"Now testing hierarchy can compute nominal sensor positions...")
37 for sensor
in cache.getListOfSensors():
39 nominal = cache.get(sensor).getTransformation(
False)
43 reco = cache.get(sensor).getTransformation(
True)
47 assert(abs(nominal.GetRotationMatrix()[i] - reco.GetRotationMatrix()[i]) < 1.e-14)
50 assert(abs(nominal.GetTranslation()[i] - reco.GetTranslation()[i]) < 1.e-14)
53 """ test that moving a ladder moves the sensor in the event processing """
56 original_global_sensor_z = cache.get(
Belle2.VxdID(
"1.1.1")).pointToGlobal(ROOT.TVector3(0, 0, 0),
True)[2]
65 new_global_sensor_z = cache.get(
Belle2.VxdID(
"1.1.1")).pointToGlobal(ROOT.TVector3(0, 0, 0),
True)[2]
68 print(
"Now testing that moving a ladder moves a sensor correspondingly...")
69 assert(abs(new_global_sensor_z - original_global_sensor_z - self.
test_shift_z) < 1.e-14)
74 main.add_module(
'EventInfoSetter')
75 main.add_module(
'Gearbox')
76 main.add_module(
'Geometry', components=[
'PXD',
'SVD'])