11""" Test for the hierarchy in VXD
13Ensure that hierarchy can compute the same global positions
14of sensors as what is stored in GeoCache.
15+ checks, that moving a ladder really moves a sensor in expected manner
17If anyone changes the geometry construction (e.g. ladder coordinate system)
18and does not correctly change hierarchy filling, this test will fail.
25from ROOT
import Belle2
29 """Python module to compare transformations stored in GeoCache and computed by the hierarchy"""
38 """ module initialization - after geometry, so GeoCache is ready """
41 print(
"Now testing hierarchy can compute nominal sensor positions...")
43 for sensor
in cache.getListOfSensors():
45 nominal = cache.getSensorInfo(sensor).getTransformation(
False)
49 reco = cache.getSensorInfo(sensor).getTransformation(
True)
53 assert (abs(nominal.GetRotationMatrix()[i] - reco.GetRotationMatrix()[i]) < 1.e-14)
56 assert (abs(nominal.GetTranslation()[i] - reco.GetTranslation()[i]) < 1.e-14)
59 """ test that moving a ladder moves the sensor in the event processing """
62 original_global_sensor_z = cache.getSensorInfo(
Belle2.VxdID(
"1.1.1")).pointToGlobal(ROOT.Math.XYZVector(0, 0, 0),
True).Z()
71 new_global_sensor_z = cache.getSensorInfo(
Belle2.VxdID(
"1.1.1")).pointToGlobal(ROOT.Math.XYZVector(0, 0, 0),
True).Z()
74 print(
"Now testing that moving a ladder moves a sensor correspondingly...")
75 assert (abs(new_global_sensor_z - original_global_sensor_z - self.
test_shift_z) < 1.e-14)
78main = b2.create_path()
80main.add_module(
'EventInfoSetter')
81main.add_module(
'Gearbox')
82main.add_module(
'Geometry')
Class to access a DBObjPtr from Python.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.
static DBStore & Instance()
Instance of a singleton DBStore.