18 #ifndef ROOT_Math_GenVector_RotationZYX
19 #define ROOT_Math_GenVector_RotationZYX 1
65 typedef double Scalar;
73 RotationZYX() : fPhi(0.0), fTheta(0.0), fPsi(0.0) { }
78 RotationZYX( Scalar phi, Scalar theta, Scalar psi ) :
79 fPhi(phi), fTheta(theta), fPsi(psi)
88 RotationZYX(IT begin, IT end) { SetComponents(begin,end); }
103 template <
class OtherRotation>
104 explicit RotationZYX(
const OtherRotation & r) {gv_detail::convert(r,*
this);}
110 template <
class OtherRotation>
111 RotationZYX & operator=( OtherRotation
const & r ) {
112 gv_detail::convert(r,*
this);
125 void SetComponents(IT begin, IT end) {
127 void SetComponents(IT begin, IT ) {
132 assert(begin == end);
142 void GetComponents(IT begin, IT end)
const {
144 void GetComponents(IT begin, IT )
const {
149 assert(begin == end);
156 void GetComponents(IT begin)
const {
165 void SetComponents(Scalar phi, Scalar theta, Scalar psi) {
166 fPhi=phi; fTheta=theta; fPsi=psi;
173 void GetComponents(Scalar & phi, Scalar & theta, Scalar & psi)
const {
174 phi=fPhi; theta=fTheta; psi=fPsi;
180 void SetPhi(Scalar phi) { fPhi=phi; Rectify(); }
185 Scalar Phi()
const {
return fPhi; }
190 void SetTheta(Scalar theta) { fTheta=theta; Rectify(); }
195 Scalar Theta()
const {
return fTheta; }
200 void SetPsi(Scalar psi) { fPsi=psi; Rectify(); }
205 Scalar Psi()
const {
return fPsi; }
213 template <
class CoordSystem,
class U>
214 DisplacementVector3D<CoordSystem,U>
215 operator() (
const DisplacementVector3D<CoordSystem,U> & v)
const {
216 return Rotation3D(*
this) ( v );
222 template <
class CoordSystem,
class U>
223 PositionVector3D<CoordSystem, U>
224 operator() (
const PositionVector3D<CoordSystem,U> & v)
const {
225 DisplacementVector3D< Cartesian3D<double>,U > xyz(v);
226 DisplacementVector3D< Cartesian3D<double>,U > rxyz = operator()(xyz);
227 return PositionVector3D<CoordSystem,U> ( rxyz );
233 template <
class CoordSystem>
234 LorentzVector<CoordSystem>
235 operator() (
const LorentzVector<CoordSystem> & v)
const {
236 DisplacementVector3D< Cartesian3D<double> > xyz(v.Vect());
237 xyz = operator()(xyz);
238 LorentzVector< PxPyPzE4D<double> > xyzt (xyz.X(), xyz.Y(), xyz.Z(), v.E());
239 return LorentzVector<CoordSystem> ( xyzt );
247 template <
class ForeignVector>
249 operator() (
const ForeignVector & v)
const {
250 DisplacementVector3D< Cartesian3D<double> > xyz(v);
251 DisplacementVector3D< Cartesian3D<double> > rxyz = operator()(xyz);
252 return ForeignVector ( rxyz.X(), rxyz.Y(), rxyz.Z() );
258 template <
class AVector>
260 AVector operator* (
const AVector & v)
const
262 return operator()(v);
273 RotationZYX Inverse()
const {
274 RotationZYX r(*
this);
285 RotationZYX operator * (
const RotationZYX & e)
const;
286 RotationZYX operator * (
const Rotation3D & r)
const;
287 RotationZYX operator * (
const AxisAngle & a)
const;
288 RotationZYX operator * (
const Quaternion & q)
const;
289 RotationZYX operator * (
const EulerAngles & q)
const;
290 RotationZYX operator * (
const RotationX & rx)
const;
291 RotationZYX operator * (
const RotationY & ry)
const;
292 RotationZYX operator * (
const RotationZ & rz)
const;
298 RotationZYX & operator *= (
const R & r) {
return *
this = (*this)*r; }
304 Scalar Distance (
const R & r )
const {
return gv_detail::dist(*
this,r);}
309 bool operator == (
const RotationZYX & rhs)
const {
310 if( fPhi != rhs.fPhi )
return false;
311 if( fTheta != rhs.fTheta )
return false;
312 if( fPsi != rhs.fPsi )
return false;
315 bool operator != (
const RotationZYX & rhs)
const {
316 return ! operator==(rhs);
325 static double Pi() {
return M_PI; }
334 typename RotationZYX::Scalar
335 Distance (
const RotationZYX& r1,
const R & r2) {
return gv_detail::dist(r1,r2);}
340 RotationZYX operator* (RotationX
const & r1, RotationZYX
const & r2);
341 RotationZYX operator* (RotationY
const & r1, RotationZYX
const & r2);
342 RotationZYX operator* (RotationZ
const & r1, RotationZYX
const & r2);
349 std::ostream & operator<< (std::ostream & os,
const RotationZYX & e);
355 #endif // ROOT_Math_GenVector_RotationZYX