42 const Double_t* translation = matrix.GetTranslation();
45 transform[0] = translation[
VGM::kDx] * Units::Length();
46 transform[1] = translation[
VGM::kDy] * Units::Length();
47 transform[2] = translation[
VGM::kDz] * Units::Length();
51 const Double_t* rm = matrix.GetRotationMatrix();
54 yx, yy, yz, zx, zy, zz;
67 if (HasReflection(matrix)) {
79 double cosb = sqrt(xx * xx + yx * yx);
80 if (cosb > 16 * FLT_EPSILON) {
81 angleX = atan2(zy, zz);
82 angleY = atan2(-zx, cosb);
83 angleZ = atan2(yx, xx);
86 angleX = atan2(-yz, yy);
87 angleY = atan2(-zx, cosb);
91 transform[
VGM::kAngleX] = angleX * TMath::RadToDeg() * Units::Angle();
92 transform[
VGM::kAngleY] = angleY * TMath::RadToDeg() * Units::Angle();
93 transform[
VGM::kAngleZ] = angleZ * TMath::RadToDeg() * Units::Angle();
98 if (matrix.IsReflection()) transform[
VGM::kReflZ] = 1.;
158 std::cerr <<
"RootGM::CreateTransform: " << std::endl;
159 std::cerr <<
"Wrong transform vector size. " << std::endl;
163 TGeoRotation* rootRotation =
new TGeoRotation();
164 rootRotation->RotateX(transform[
VGM::kAngleX] / Units::Angle());
165 rootRotation->RotateY(transform[
VGM::kAngleY] / Units::Angle());
166 rootRotation->RotateZ(transform[
VGM::kAngleZ] / Units::Angle());
168 if (HasReflection(transform)) {
170 const Double_t* matrix = rootRotation->GetRotationMatrix();
172 for (Int_t i = 0; i < 9; i++) matrix2[i] = matrix[i];
175 matrix2[2] = -matrix2[2];
176 matrix2[5] = -matrix2[5];
177 matrix2[8] = -matrix2[8];
180 rootRotation->SetMatrix(matrix2);
183 return new TGeoCombiTrans(transform[
VGM::kDx] / Units::Length(),
184 transform[
VGM::kDy] / Units::Length(),
185 transform[
VGM::kDz] / Units::Length(), rootRotation);
261 f = (e < 0) ? -e : e;
264 double utmp[3], vtmp[3];
269 x[0] = (from[0] > 0.0) ? from[0] : -from[0];
270 x[1] = (from[1] > 0.0) ? from[1] : -from[1];
271 x[2] = (from[2] > 0.0) ? from[2] : -from[2];
294 utmp[0] = x[0] - from[0];
295 utmp[1] = x[1] - from[1];
296 utmp[2] = x[2] - from[2];
297 vtmp[0] = x[0] - to[0];
298 vtmp[1] = x[1] - to[1];
299 vtmp[2] = x[2] - to[2];
301 c1 = 2.0 /
DOT(utmp, utmp);
302 c2 = 2.0 /
DOT(vtmp, vtmp);
303 c3 = c1 * c2 *
DOT(utmp, vtmp);
305 for (i = 0; i < 3; i++) {
306 for (j = 0; j < 3; j++) {
307 mtx[i][j] = -c1 * utmp[i] * utmp[j] - c2 * vtmp[i] * vtmp[j] +
308 c3 * vtmp[i] * utmp[j];
319 mtx[0][0] = e + h * v[0] * v[0];
320 mtx[0][1] = h * v[0] * v[1] - v[2];
321 mtx[0][2] = h * v[0] * v[2] + v[1];
323 mtx[1][0] = h * v[0] * v[1] + v[2];
324 mtx[1][1] = e + h * v[1] * v[1];
325 mtx[1][2] = h * v[1] * v[2] - v[0];
327 mtx[2][0] = h * v[0] * v[2] - v[1];
328 mtx[2][1] = h * v[1] * v[2] + v[0];
329 mtx[2][2] = e + h * v[2] * v[2];
332 double hvx, hvz, hvxy, hvxz, hvyz;
340 mtx[0][0] = e + hvx * v[0];
341 mtx[0][1] = hvxy - v[2];
342 mtx[0][2] = hvxz + v[1];
344 mtx[1][0] = hvxy + v[2];
345 mtx[1][1] = e + h * v[1] * v[1];
346 mtx[1][2] = hvyz - v[0];
348 mtx[2][0] = hvxz - v[1];
349 mtx[2][1] = hvyz + v[0];
350 mtx[2][2] = e + hvz * v[2];