19 #include "TGeoMatrix.h"
21 using namespace DD4hep::Geometry;
28 return new TGeoTranslation(
"", pos.X(), pos.Y(), pos.Z());
51 pos.GetCoordinates(t);
60 Double_t* r = tr.GetRotationMatrix();
69 trans.GetDecomposition(rot, pos);
95 return &
_transform(*(
new TGeoHMatrix()), trans);
100 return &
_transform(*(
new TGeoHMatrix()), pos, rot);
105 const Double_t* t = matrix->GetTranslation();
106 if ( matrix->IsRotation() ) {
107 const Double_t* r = matrix->GetRotationMatrix();
109 r[3],r[4],r[5],t[1]*MM_2_CM,
110 r[6],r[7],r[8],t[2]*MM_2_CM);
113 0e0,0e0,0e0,t[1]*MM_2_CM,
114 0e0,0e0,0e0,t[2]*MM_2_CM);
122 Double_t cosb = std::sqrt(r[0]*r[0] + r[1]*r[1]);
123 if (cosb > 0.00001) {
124 return XYZAngles(atan2(r[5], r[8]), atan2(-r[2], cosb), atan2(r[1], r[0]));
126 return XYZAngles(atan2(-r[7], r[4]),atan2(-r[2], cosb),0);
130 trafo.GetDecomposition(rot,pos);
135 trafo.GetDecomposition(r,pos);
136 rot.SetXYZ(r.Psi(),r.Theta(),r.Phi());
140 trafo.GetDecomposition(rot,pos);
145 trafo.GetDecomposition(r,pos);
146 rot.SetXYZ(r.Psi(),r.Theta(),r.Phi());
TGeoTranslation * _translation(const Geometry::Position &pos)
Convert a Position object to a TGeoTranslation
TGeoRotation * _rotationZYX(const Geometry::RotationZYX &rot)
Convert a RotationZYX object to a TGeoRotation
XYZAngles _XYZangles(const double *matrix)
Convert a 3x3 rotation matrix to XYZAngles
void _decompose(const Geometry::Transform3D &trafo, Geometry::Position &pos, Geometry::RotationZYX &rot)
Decompose a generic Transform3D into a translation (Position) and a RotationZYX
ROOT::Math::RotationZYX RotationZYX
TGeoIdentity * identityTransform()
Access the TGeo identity transformation
ROOT::Math::Rotation3D Rotation3D
TGeoRotation * _rotation3D(const Geometry::Rotation3D &rot)
Convert a Rotation3D object to a TGeoRotation
TGeoHMatrix * _transform(const Geometry::Transform3D &trans)
Convert a Transform3D object to a TGeoHMatrix
ROOT::Math::XYZVector Position
ROOT::Math::Translation3D Translation3D
ROOT::Math::EulerAngles EulerAngles
ROOT::Math::Transform3D Transform3D