Belle II Software development
CompareTransformationsModule Class Reference
Inheritance diagram for CompareTransformationsModule:

Public Member Functions

def __init__ (self)
 
def initialize (self)
 
def event (self)
 

Public Attributes

 test_shift_z
 Shift of a sensor.
 

Detailed Description

Python module to compare transformations stored in GeoCache and computed by the hierarchy

Definition at line 28 of file GeoCacheHierarchy.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
 constructor 

Definition at line 31 of file GeoCacheHierarchy.py.

31 def __init__(self):
32 """ constructor """
33 super().__init__()
34
35 self.test_shift_z = 10.
36

Member Function Documentation

◆ event()

def event (   self)
 test that moving a ladder moves the sensor in the event processing 

Definition at line 58 of file GeoCacheHierarchy.py.

58 def event(self):
59 """ test that moving a ladder moves the sensor in the event processing """
61
62 original_global_sensor_z = cache.getSensorInfo(Belle2.VxdID("1.1.1")).pointToGlobal(ROOT.Math.XYZVector(0, 0, 0), True).Z()
63
64 # Now move ladder... we need a copy of the current alignment
65 alignment = Belle2.PyDBObj("VXDAlignment").obj().Clone()
66 # Set the ladder here, not the sensor
67 alignment.set(Belle2.VxdID("1.1.0").getID(), Belle2.VXDAlignment.dW, self.test_shift_z)
68 # and add the object to the database store. This will run the callback
69 Belle2.DBStore.Instance().addConstantOverride("VXDAlignment", alignment)
70
71 new_global_sensor_z = cache.getSensorInfo(Belle2.VxdID("1.1.1")).pointToGlobal(ROOT.Math.XYZVector(0, 0, 0), True).Z()
72
73 # expect that sensor moved with the ladder
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)
76
77
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50
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
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:28

◆ initialize()

def initialize (   self)
 module initialization - after geometry, so GeoCache is ready 

Definition at line 37 of file GeoCacheHierarchy.py.

37 def initialize(self):
38 """ module initialization - after geometry, so GeoCache is ready """
40
41 print("Now testing hierarchy can compute nominal sensor positions...")
42 # We check the trafos for EACH sensor
43 for sensor in cache.getListOfSensors():
44 # Nominal trafo stored by findVolumes() after geometry is created
45 nominal = cache.getSensorInfo(sensor).getTransformation(False)
46 # Trafo computed by the stored matrix chain in hierarchy (includes alignment,
47 # but as we use exp=0, run=0 we should always get zero alignment. Therefore
48 # we know both matrices have to be the same. Let's compare them element by element
49 reco = cache.getSensorInfo(sensor).getTransformation(True)
50
51 # First rotation component
52 for i in range(0, 9):
53 assert (abs(nominal.GetRotationMatrix()[i] - reco.GetRotationMatrix()[i]) < 1.e-14)
54 # Then translations
55 for i in range(0, 3):
56 assert (abs(nominal.GetTranslation()[i] - reco.GetTranslation()[i]) < 1.e-14)
57

Member Data Documentation

◆ test_shift_z

test_shift_z

Shift of a sensor.

Definition at line 35 of file GeoCacheHierarchy.py.


The documentation for this class was generated from the following file: