11#include <framework/geometry/B2Vector3.h>
14#include <TMatrixDSym.h>
18#include <Math/Vector3D.h>
26 namespace RotationTools {
32 inline TMatrixD toMatrix(TRotation r)
35 for (
int i = 0; i < 3; ++i)
36 for (
int j = 0; j < 3; ++j)
47 inline TMatrixD getRotationMatrixZtoZp(ROOT::Math::XYZVector zPrime)
49 ROOT::Math::XYZVector zAxis(0, 0, 1);
50 zPrime = zPrime.Unit();
51 ROOT::Math::XYZVector rotAxis = zAxis.Cross(zPrime);
52 double angle = asin(
sqrt(rotAxis.Mag2()));
55 r.Rotate(angle, TVector3(rotAxis.x(), rotAxis.y(), rotAxis.z()));
66 inline TMatrixD getRotationMatrixXY(
double angleX,
double angleY)
82 inline TMatrixD rotateTensor(
const B2Vector3D& vTo,
const TMatrixD& orgMat)
84 TMatrixD r = getRotationMatrixZtoZp(vTo);
85 TMatrixD rT = r; rT.T();
86 return r * orgMat * rT;
95 inline TMatrixD rotateTensorInv(
const ROOT::Math::XYZVector& vTo,
const TMatrixD& orgMat)
97 TMatrixD r = getRotationMatrixZtoZp(vTo);
98 TMatrixD rT = r; rT.T();
99 return rT * orgMat * r;
109 inline TMatrixDSym toSymMatrix(
const TMatrixD& m)
111 TMatrixDSym mS(m.GetNrows());
112 for (
int i = 0; i < m.GetNrows(); ++i)
113 for (
int j = 0; j < m.GetNcols(); ++j) {
114 mS(i, j) = (m(i, j) + m(j, i)) / 2;
126 return TVectorD(0, 2, v.X(), v.Y(), v.Z(),
"END");
B2Vector3< DataType > Unit() const
Unit vector parallel to this.
B2Vector3< double > B2Vector3D
typedef for common usage with double
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.