12 """ Test for the hierarchy in VXD
14 Ensure that hierarchy can compute the same global positions
15 of sensors as what is stored in GeoCache.
16 + checks, that moving a ladder really moves a sensor in expected manner
18 If anyone changes the geometry construction (e.g. ladder coordinate system)
19 and does not correctly change hierarchy filling, this test will fail.
26 from ROOT
import Belle2
30 """Python module to compare transformations stored in GeoCache and computed by the hierarchy"""
39 """ module initialization - after geometry, so GeoCache is ready """
42 print(
"Now testing hierarchy can compute nominal sensor positions...")
44 for sensor
in cache.getListOfSensors():
46 nominal = cache.get(sensor).getTransformation(
False)
50 reco = cache.get(sensor).getTransformation(
True)
54 assert(abs(nominal.GetRotationMatrix()[i] - reco.GetRotationMatrix()[i]) < 1.e-14)
57 assert(abs(nominal.GetTranslation()[i] - reco.GetTranslation()[i]) < 1.e-14)
60 """ test that moving a ladder moves the sensor in the event processing """
63 original_global_sensor_z = cache.get(
Belle2.VxdID(
"1.1.1")).pointToGlobal(ROOT.Math.XYZVector(0, 0, 0),
True).Z()
72 new_global_sensor_z = cache.get(
Belle2.VxdID(
"1.1.1")).pointToGlobal(ROOT.Math.XYZVector(0, 0, 0),
True).Z()
75 print(
"Now testing that moving a ladder moves a sensor correspondingly...")
76 assert(abs(new_global_sensor_z - original_global_sensor_z - self.
test_shift_ztest_shift_z) < 1.e-14)
79 main = b2.create_path()
81 main.add_module(
'EventInfoSetter')
82 main.add_module(
'Gearbox')
83 main.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.
int getID(const std::vector< double > &breaks, double t)
get id of the time point t