 |
Belle II Software
release-05-02-19
|
6 from ROOT
import Belle2
13 Base class to calculate global deformation of the detector
17 """ Constructor, sets the scale of the transformation """
23 """ Return TVector3 with difference in global position induced by the deformation,
24 given the original x,y,z position as TVector3 or a list with length of 3.
28 d_rphiz = self.
_transform(rphiz[0], rphiz[1], rphiz[2])
30 rphiz[0] += d_rphiz[0]
31 rphiz[1] += d_rphiz[1]
32 rphiz[2] += d_rphiz[2]
36 d_xyz = ROOT.TVector3(new_xyz[0] - xyz[0], new_xyz[1] - xyz[1], new_xyz[2] - xyz[2])
41 """ Fcn to be overriden by child classes, return vector (list of 3 numbers) of displacement """
44 """ Convert (x,y,z) to (r,phi,z) """
49 r = math.sqrt(x * x + y * y)
50 phi = math.atan2(y, x)
55 """ Convert (r,phi,z) to (x,y,z) """
58 y = rphiz[0] * math.sin(rphiz[1])
59 x = rphiz[0] * math.cos(rphiz[1])
64 """ radial expansion """
71 """ the transformation """
72 return [self.
scale * r, 0., 0.]
79 """ init with scale, optionally scale2 for 1/r dependency """
86 """ the transformation """
98 """ the transformation """
99 return [0., 0., self.
scale * r]
103 """ Elliptical distortion """
110 """ the transformation """
112 return [self.
scale * 1. / 2. * math.cos(2 * phi) * r, 0., 0.]
116 """ Clamshell deformation """
123 """ the transformation """
126 return [0., self.
scale * math.cos(phi), 0.]
130 """ Skew distortion """
137 """ the transformation """
138 return [0., 0., self.
scale * math.cos(phi) * r]
149 """ the transformation """
150 return [self.
scale * abs(z), 0., 0.]
154 """ Twist deformation """
161 """ the transformation """
162 return [0., self.
scale * z, 0.]
173 """ the transformation """
174 return [0., 0., self.
scale * z]
178 """ Module to create misalignment (first reads real sensor positions, then applies misalignment and returns DB payload)
179 TODO: random misalignment not finished...
182 def __init__(self, global_deformations=None, random_misalignments=None, iov=Belle2.IntervalOfValidity(0, 0, -1, -1)):
183 """ Constructor with with input misalignment """
195 """ module initialize - read geometry, apply misalignment, create and store payloads """
198 txt = open(
'generated_misalignment.txt',
'w')
199 txt.write(
'layer ladder sensor x_orig y_orig z_orig x y z u v w\n')
203 global_pos = info.pointToGlobal(ROOT.TVector3(0., 0., 0.))
205 delta = ROOT.TVector3(0., 0., 0.)
212 delta += deformation(global_pos)
215 delta = ROOT.TVector3(0., 0., 0.)
217 new_global_pos = global_pos + delta
218 new_local_pos = info.pointToLocal(new_global_pos)
227 for i
in range(0, 3):
228 if abs(new_local_pos[i]) < 1.e-14:
229 new_local_pos[i] = 0.
231 alignment.set(sensor.getID(), i + 1, new_local_pos[i])
239 '{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}\n'.format(
240 str(sensor.getLayerNumber()),
241 str(sensor.getLadderNumber()),
242 str(sensor.getSensorNumber()),
246 str(new_global_pos[0]),
247 str(new_global_pos[1]),
248 str(new_global_pos[2]),
249 str(new_local_pos[0]),
250 str(new_local_pos[1]),
251 str(new_local_pos[2])
Class to uniquely identify a any structure of the PXD and SVD.
def __init__(self, scale)
def __init__(self, scale)
def _transform(self, r, phi, z)
def __init__(self, scale)
def __init__(self, scale)
def __init__(self, scale)
random_misalignments
random misalignments
def _transform(self, r, phi, z)
def __init__(self, scale)
def _transform(self, r, phi, z)
def _transform(self, r, phi, z)
static GeoCache & getInstance()
Return a reference to the singleton instance.
def __init__(self, global_deformations=None, random_misalignments=None, iov=Belle2.IntervalOfValidity(0, 0, -1, -1))
def _transform(self, r, phi, z)
def _transform(self, r, phi, z)
def _transform(self, r, phi, z)
def __init__(self, scale)
static Database & Instance()
Instance of a singleton Database.
def _transform(self, r, phi, z)
iov
interval of validity for the generated payload
def __init__(self, scale)
def __init__(self, scale, scale2=0.)
scale2
second scale for 1/r member
global_deformations
systematic deformations
VXD alignment (and maybe some calibration) parameters.
def _transform(self, r, phi, z)