14from ROOT
import Belle2
21 Base class to calculate global deformation of the detector
25 """ Constructor, sets the scale of the transformation """
31 """ Return TVector3 with difference in global position induced by the deformation,
32 given the original x,y,z position as TVector3
or a list
with length of 3.
36 d_rphiz = self._transform(rphiz[0], rphiz[1], rphiz[2])
38 rphiz[0] += d_rphiz[0]
39 rphiz[1] += d_rphiz[1]
40 rphiz[2] += d_rphiz[2]
44 d_xyz = ROOT.TVector3(new_xyz[0] - xyz[0], new_xyz[1] - xyz[1], new_xyz[2] - xyz[2])
49 """ Fcn to be overriden by child classes, return vector (list of 3 numbers) of displacement """
52 """ Convert (x,y,z) to (r,phi,z) """
57 r = math.sqrt(x * x + y * y)
58 phi = math.atan2(y, x)
63 """ Convert (r,phi,z) to (x,y,z) """
66 y = rphiz[0] * math.sin(rphiz[1])
67 x = rphiz[0] * math.cos(rphiz[1])
72 """ radial expansion """
79 """ the transformation """
80 return [self.
scale * r, 0., 0.]
87 """ init with scale, optionally scale2 for 1/r dependency """
94 """ the transformation """
106 """ the transformation """
107 return [0., 0., self.
scale * r]
111 """ Elliptical distortion """
118 """ the transformation """
120 return [self.
scale * 1. / 2. * math.cos(2 * phi) * r, 0., 0.]
124 """ Clamshell deformation """
131 """ the transformation """
134 return [0., self.
scale * math.cos(phi), 0.]
138 """ Skew distortion """
145 """ the transformation """
146 return [0., 0., self.
scale * math.cos(phi) * r]
157 """ the transformation """
158 return [self.
scale * abs(z), 0., 0.]
162 """ Twist deformation """
169 """ the transformation """
170 return [0., self.
scale * z, 0.]
181 """ the transformation """
182 return [0., 0., self.
scale * z]
186 """ Module to create misalignment (first reads real sensor positions, then applies misalignment and returns DB payload)
187 TODO: random misalignment not finished...
190 def __init__(self, global_deformations=None, random_misalignments=None, iov=Belle2.IntervalOfValidity(0, 0, -1, -1)):
191 """ Constructor with with input misalignment """
203 """ module initialize - read geometry, apply misalignment, create and store payloads """
206 txt = open(
'generated_misalignment.txt',
'w')
207 txt.write(
'layer ladder sensor x_orig y_orig z_orig x y z u v w\n')
211 global_pos = info.pointToGlobal(ROOT.TVector3(0., 0., 0.))
213 delta = ROOT.TVector3(0., 0., 0.)
220 delta += deformation(global_pos)
223 delta = ROOT.TVector3(0., 0., 0.)
225 new_global_pos = global_pos + delta
226 new_local_pos = info.pointToLocal(new_global_pos)
235 for i
in range(0, 3):
236 if abs(new_local_pos[i]) < 1.e-14:
237 new_local_pos[i] = 0.
239 alignment.set(sensor.getID(), i + 1, new_local_pos[i])
247 '{} {} {} {} {} {} {} {} {} {} {} {}\n'.format(
248 str(sensor.getLayerNumber()),
249 str(sensor.getLadderNumber()),
250 str(sensor.getSensorNumber()),
254 str(new_global_pos[0]),
255 str(new_global_pos[1]),
256 str(new_global_pos[2]),
257 str(new_local_pos[0]),
258 str(new_local_pos[1]),
259 str(new_local_pos[2])
VXD alignment (and maybe some calibration) parameters.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
global_deformations
systematic deformations
random_misalignments
random misalignments
def __init__(self, global_deformations=None, random_misalignments=None, iov=Belle2.IntervalOfValidity(0, 0, -1, -1))
iov
interval of validity for the generated payload
def __init__(self, scale, scale2=0.)
scale2
second scale for 1/r member
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
static Database & Instance()
Instance of a singleton Database.