190 #define TOLERANCE (1.0E-6) 196 : fxx(1.0), fxy(0.0), fxz(0.0), fyx(0.0), fyy(1.0), fyz(0.0),
197 fzx(0.0), fzy(0.0), fzz(1.0) {}
210 Double_t myx, Double_t myy, Double_t myz,
211 Double_t mzx, Double_t mzy, Double_t mzz)
220 if (j == 0) {
return fxx; }
221 if (j == 1) {
return fxy; }
222 if (j == 2) {
return fxz; }
224 if (j == 0) {
return fyx; }
225 if (j == 1) {
return fyy; }
226 if (j == 2) {
return fyz; }
228 if (j == 0) {
return fzx; }
229 if (j == 1) {
return fzy; }
230 if (j == 2) {
return fzz; }
233 Warning(
"operator()(i,j)",
"bad indices (%d , %d)",i,j);
272 double mag2 = Q.
QMag2();
276 fxx = two_r2 + two_x2;
277 fyy = two_r2 + two_y2;
278 fzz = two_r2 + two_z2;
281 fxy = two_xy - two_zr;
282 fyx = two_xy + two_zr;
285 fxz = two_xz + two_yr;
286 fzx = two_xz - two_yr;
289 fyz = two_yz - two_xr;
290 fzy = two_yz + two_xr;
293 if (TMath::Abs(mag2-1) > 1
e-10) {
326 Double_t ll = axis.
Mag();
328 Warning(
"Rotate(angle,axis)",
" zero axis");
331 Double_t dx = axis.
X()/ll, dy = axis.
Y()/ll, dz = axis.
Z()/ll;
333 ca+(1-ca)*dx*dx, (1-ca)*dx*dy-sa*dz, (1-ca)*dx*dz+sa*dy,
334 (1-ca)*dy*dx+sa*dz, ca+(1-ca)*dy*dy, (1-ca)*dy*dz-sa*dx,
335 (1-ca)*dz*dx-sa*dy, (1-ca)*dz*dy+sa*dx, ca+(1-ca)*dz*dz );
396 Double_t del = 0.001;
399 if (TMath::Abs(newZ.
X()-w.
X()) > del ||
400 TMath::Abs(newZ.
Y()-w.
Y()) > del ||
401 TMath::Abs(newZ.
Z()-w.
Z()) > del ||
402 TMath::Abs(newX.
Mag2()-1.) > del ||
403 TMath::Abs(newY.
Mag2()-1.) > del ||
404 TMath::Abs(newZ.
Mag2()-1.) > del ||
405 TMath::Abs(newX.
Dot(newY)) > del ||
406 TMath::Abs(newY.
Dot(newZ)) > del ||
407 TMath::Abs(newZ.
Dot(newX)) > del) {
408 Warning(
"RotateAxes",
"bad axis vectors");
412 newX.
Y(), newY.
Y(), newZ.
Y(),
413 newX.
Z(), newY.
Z(), newZ.
Z()));
464 Double_t cosa1 = 1-cosa;
469 Double_t
x=0,
y=0,
z=0;
581 Double_t s2 = 1.0 -
fzz*
fzz;
583 Warning(
"GetPhi()",
" |fzz| > 1 ");
589 const Double_t cscTheta = 1/sinTheta;
590 Double_t cosAbsPhi =
fzy * cscTheta;
591 if ( TMath::Abs(cosAbsPhi) > 1 ) {
592 Warning(
"GetPhi()",
"finds | cos phi | > 1");
598 }
else if (
fzx < 0) {
600 }
else if (
fzy > 0) {
609 }
else if (
fxy < 0) {
645 double finalPsi = 0.0;
647 Double_t s2 = 1.0 -
fzz*
fzz;
649 Warning(
"GetPsi()",
" |fzz| > 1 ");
655 const Double_t cscTheta = 1/sinTheta;
656 Double_t cosAbsPsi = -
fyz * cscTheta;
657 if ( TMath::Abs(cosAbsPsi) > 1 ) {
658 Warning(
"GetPsi()",
"| cos psi | > 1 ");
664 }
else if (
fxz < 0) {
670 Double_t absPsi =
fxx;
671 if ( TMath::Abs(
fxx) > 1 ) {
672 Warning(
"GetPsi()",
"| fxx | > 1 ");
678 }
else if (
fyx < 0) {
769 Double_t zmag = zAxis.
Mag();
771 Warning(
"MakeBasis(X,Y,Z)",
"non-zero Z Axis is required");
775 Double_t xmag = xAxis.
Mag();
782 yAxis = zAxis.
Cross(xAxis)*(1.0/xmag);
783 Double_t ymag = yAxis.
Mag();
790 xAxis = yAxis.
Cross(zAxis);
Double_t Dot(const TVector3 &) const
TRotation & RotateYEulerAngles(Double_t phi, Double_t theta, Double_t psi)
Rotate using the y-convention.
Double_t PhiY() const
Return Phi.
TRotation & RotateZ(Double_t)
Rotate around z.
Quaternion is a 4-component mathematic object quite convenient when dealing with space rotation (or r...
TRotation & RotateX(Double_t)
Rotate around x.
Double_t operator()(int, int) const
Dereferencing operator const.
Double_t GetXPsi(void) const
Get psi angle.
void SetYPsi(Double_t)
Set YPsi.
you should not use this method at all Int_t y
TRotation & SetXAxis(const TVector3 &axis)
Set X axis.
TRotation & RotateAxes(const TVector3 &newX, const TVector3 &newY, const TVector3 &newZ)
Rotate axes.
Double_t PhiX() const
Return Phi.
void SetXPhi(Double_t)
Set XPhi.
TRotation & SetToIdentity()
void SetYTheta(Double_t)
Set YTheta.
Double_t ATan2(Double_t, Double_t)
void SetXTheta(Double_t)
Set XTheta.
TRotation & Rotate(Double_t, const TVector3 &)
Rotate along an axis.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t Int_t m
TVector3 is a general three vector class, which can be used for the description of different vectors ...
TRotation & Transform(const TRotation &)
TVector3 Cross(const TVector3 &) const
The TRotation class describes a rotation of objects of the TVector3 class.
TRotation & SetYAxis(const TVector3 &axis)
Set Y axis.
TRotation & RotateXEulerAngles(Double_t phi, Double_t theta, Double_t psi)
Rotate using the x-convention.
Double_t PhiZ() const
Return Phi.
* x
Deprecated and error prone model selection interface.
void AngleAxis(Double_t &, TVector3 &) const
Rotation defined by an angle and a vector.
Double_t GetYTheta(void) const
Return YTheta.
void SetYPhi(Double_t)
Set YPhi.
Double_t GetYPhi(void) const
Return YPhi.
Double_t GetXPhi(void) const
Return phi angle.
TVector3 Orthogonal() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
TRotation & RotateY(Double_t)
Rotate around y.
you should not use this method at all Int_t Int_t z
TRotation & SetYEulerAngles(Double_t phi, Double_t theta, Double_t psi)
Rotate using the y-convention.
void MakeBasis(TVector3 &xAxis, TVector3 &yAxis, TVector3 &zAxis) const
Make the Z axis into a unit variable.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
TRotation & SetZAxis(const TVector3 &axis)
Set Z axis.
TVector3 operator*(const TVector3 &) const
Double_t ThetaX() const
Return Theta.
Double_t Sqrt(Double_t x)
Double_t ThetaY() const
Return Theta.
Double_t GetXTheta(void) const
Return XTheta.
constexpr Double_t PiOver2()
void SetXPsi(Double_t)
Set XPsi.
Double_t GetYPsi(void) const
Return YPsi.
TRotation & SetXEulerAngles(Double_t phi, Double_t theta, Double_t psi)
Rotate using the x-convention (Landau and Lifshitz, Goldstein, &c) by doing the explicit rotations...
Double_t ThetaZ() const
Return Theta.