15 from ROOT
import Belle2
22 Base class to calculate global deformation of the detector
26 """ Constructor, sets the scale of the transformation """
32 """ Return TVector3 with difference in global position induced by the deformation,
33 given the original x,y,z position as TVector3 or a list with length of 3.
37 d_rphiz = self.
_transform_transform(rphiz[0], rphiz[1], rphiz[2])
39 rphiz[0] += d_rphiz[0]
40 rphiz[1] += d_rphiz[1]
41 rphiz[2] += d_rphiz[2]
45 d_xyz = ROOT.TVector3(new_xyz[0] - xyz[0], new_xyz[1] - xyz[1], new_xyz[2] - xyz[2])
50 """ Fcn to be overriden by child classes, return vector (list of 3 numbers) of displacement """
53 """ Convert (x,y,z) to (r,phi,z) """
58 r = math.sqrt(x * x + y * y)
59 phi = math.atan2(y, x)
64 """ Convert (r,phi,z) to (x,y,z) """
67 y = rphiz[0] * math.sin(rphiz[1])
68 x = rphiz[0] * math.cos(rphiz[1])
73 """ radial expansion """
80 """ the transformation """
81 return [self.
scalescale * r, 0., 0.]
88 """ init with scale, optionally scale2 for 1/r dependency """
95 """ the transformation """
96 return [0., self.
scalescale * r + self.
scale2scale2 / r, 0.]
107 """ the transformation """
108 return [0., 0., self.
scalescale * r]
112 """ Elliptical distortion """
119 """ the transformation """
121 return [self.
scalescale * 1. / 2. * math.cos(2 * phi) * r, 0., 0.]
125 """ Clamshell deformation """
132 """ the transformation """
135 return [0., self.
scalescale * math.cos(phi), 0.]
139 """ Skew distortion """
146 """ the transformation """
147 return [0., 0., self.
scalescale * math.cos(phi) * r]
158 """ the transformation """
159 return [self.
scalescale * abs(z), 0., 0.]
163 """ Twist deformation """
170 """ the transformation """
171 return [0., self.
scalescale * z, 0.]
182 """ the transformation """
183 return [0., 0., self.
scalescale * z]
187 """ Module to create misalignment (first reads real sensor positions, then applies misalignment and returns DB payload)
188 TODO: random misalignment not finished...
191 def __init__(self, global_deformations=None, random_misalignments=None, iov=Belle2.IntervalOfValidity(0, 0, -1, -1)):
192 """ Constructor with with input misalignment """
204 """ module initialize - read geometry, apply misalignment, create and store payloads """
207 txt = open(
'generated_misalignment.txt',
'w')
208 txt.write(
'layer ladder sensor x_orig y_orig z_orig x y z u v w\n')
212 global_pos = info.pointToGlobal(ROOT.TVector3(0., 0., 0.))
214 delta = ROOT.TVector3(0., 0., 0.)
221 delta += deformation(global_pos)
224 delta = ROOT.TVector3(0., 0., 0.)
226 new_global_pos = global_pos + delta
227 new_local_pos = info.pointToLocal(new_global_pos)
236 for i
in range(0, 3):
237 if abs(new_local_pos[i]) < 1.e-14:
238 new_local_pos[i] = 0.
240 alignment.set(sensor.getID(), i + 1, new_local_pos[i])
248 '{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}\n'.format(
249 str(sensor.getLayerNumber()),
250 str(sensor.getLadderNumber()),
251 str(sensor.getSensorNumber()),
255 str(new_global_pos[0]),
256 str(new_global_pos[1]),
257 str(new_global_pos[2]),
258 str(new_local_pos[0]),
259 str(new_local_pos[1]),
260 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.