1515#ifndef ALICEO2_CARTESIAN3D_H
1616#define ALICEO2_CARTESIAN3D_H
1717
18+ #include < Math/GenVector/DisplacementVector3D.h>
19+ #include < Math/GenVector/PositionVector3D.h>
1820#include < Math/GenVector/Rotation3D.h>
1921#include < Math/GenVector/Transform3D.h>
2022#include < Math/GenVector/Translation3D.h>
2123#include < Rtypes.h>
2224#include < TGeoMatrix.h>
23- #include < Math/GenVector/DisplacementVector3D.h>
24- #include < Math/GenVector/PositionVector3D.h>
25- #include " MathUtils/Cartesian2D.h"
2625#include < iostream>
27-
26+ # include " MathUtils/Cartesian2D.h "
2827
2928template <typename T>
3029using Point3D = ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<T>, ROOT::Math::DefaultCoordinateSystemTag>;
@@ -34,27 +33,22 @@ using Vector3D = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<T>, RO
3433
3534namespace o2
3635{
37- namespace Base
38- {
39-
40- // / predefined transformations: Tracking->Local, Tracking->Global, Local->Global etc
36+ // / predefined transformations: Tracking->Local, Tracking->Global, Local->Global etc
4137// / The IDs must be < 32
4238
4339struct TransformType {
4440 static constexpr int L2G = 0 ;
4541 static constexpr int T2L = 1 ;
4642 static constexpr int T2G = 2 ;
47- static constexpr int T2GRot = 3 ;
48- }; // / transformation types
49-
43+ static constexpr int T2GRot = 3 ;
44+ }; // / transformation types
5045
5146class Rotation2D
5247{
5348 //
5449 // class to perform rotation of 3D (around Z) and 2D points
5550
5651 public:
57-
5852 Rotation2D () = default ;
5953 Rotation2D (float cs, float sn) : mCos (cs), mSin (sn) {}
6054 Rotation2D (float phiZ) : mCos (cos(phiZ)), mSin (sin(phiZ)) {}
@@ -74,68 +68,67 @@ class Rotation2D
7468 mSin = sn;
7569 }
7670
77- void getComponents (float & cs, float & sn) const
71+ void getComponents (float & cs, float & sn) const
7872 {
7973 cs = mCos ;
8074 sn = mSin ;
8175 }
82-
76+
8377 template <typename T>
8478 Point3D<T> operator ()(const Point3D<T>& v) const
8579 { // local->master
86- return Point3D<T>( v.X ()* mCos - v.Y ()* mSin , v.X ()* mSin + v.Y ()* mCos , v.Z () );
80+ return Point3D<T>(v.X () * mCos - v.Y () * mSin , v.X () * mSin + v.Y () * mCos , v.Z ());
8781 }
8882
8983 template <typename T>
9084 Point3D<T> operator ^(const Point3D<T>& v) const
9185 { // master->local
92- return Point3D<T>( v.X ()* mCos + v.Y ()* mSin , -v.X ()* mSin + v.Y ()* mCos , v.Z () );
86+ return Point3D<T>(v.X () * mCos + v.Y () * mSin , -v.X () * mSin + v.Y () * mCos , v.Z ());
9387 }
9488
9589 template <typename T>
9690 Vector3D<T> operator ()(const Vector3D<T>& v) const
9791 { // local->master
98- return Vector3D<T>( v.X ()* mCos - v.Y ()* mSin , v.X ()* mSin + v.Y ()* mCos , v.Z () );
92+ return Vector3D<T>(v.X () * mCos - v.Y () * mSin , v.X () * mSin + v.Y () * mCos , v.Z ());
9993 }
10094
10195 template <typename T>
10296 Vector3D<T> operator ^(const Vector3D<T>& v) const
10397 { // master->local
104- return Vector3D<T>( v.X ()* mCos + v.Y ()* mSin , -v.X ()* mSin + v.Y ()* mCos , v.Z () );
98+ return Vector3D<T>(v.X () * mCos + v.Y () * mSin , -v.X () * mSin + v.Y () * mCos , v.Z ());
10599 }
106100
107101 template <typename T>
108102 Point2D<T> operator ()(const Point2D<T>& v) const
109103 { // local->master
110- return Point2D<T>( v.X ()* mCos - v.Y ()* mSin , v.X ()* mSin + v.Y ()* mCos );
104+ return Point2D<T>(v.X () * mCos - v.Y () * mSin , v.X () * mSin + v.Y () * mCos );
111105 }
112106
113107 template <typename T>
114108 Point2D<T> operator ^(const Point2D<T>& v) const
115109 { // master->local
116- return Point2D<T>( v.X ()* mCos + v.Y ()* mSin , -v.X ()* mSin + v.Y ()* mCos );
110+ return Point2D<T>(v.X () * mCos + v.Y () * mSin , -v.X () * mSin + v.Y () * mCos );
117111 }
118112
119113 template <typename T>
120114 Vector2D<T> operator ()(const Vector2D<T>& v) const
121115 { // local->master
122- return Vector2D<T>( v.X ()* mCos - v.Y ()* mSin , v.X ()* mSin + v.Y ()* mCos );
116+ return Vector2D<T>(v.X () * mCos - v.Y () * mSin , v.X () * mSin + v.Y () * mCos );
123117 }
124118
125119 template <typename T>
126120 Vector2D<T> operator ^(const Vector2D<T>& v) const
127121 { // master->local
128- return Vector2D<T>( v.X ()* mCos + v.Y ()* mSin , -v.X ()* mSin + v.Y ()* mCos );
122+ return Vector2D<T>(v.X () * mCos + v.Y () * mSin , -v.X () * mSin + v.Y () * mCos );
129123 }
130-
124+
131125 private:
132-
133- float mCos = 1 .f; // /< cos of rotation angle
134- float mSin = 0 .f; // /< sin of rotation angle
126+ float mCos = 1 .f; // /< cos of rotation angle
127+ float mSin = 0 .f; // /< sin of rotation angle
135128
136- ClassDefNV (Rotation2D,1 );
129+ ClassDefNV (Rotation2D, 1 );
137130};
138-
131+
139132class Transform3D : public ROOT ::Math::Transform3D
140133{
141134 //
@@ -154,25 +147,28 @@ class Transform3D : public ROOT::Math::Transform3D
154147
155148 // inherit assignment operators of the base class
156149 using ROOT::Math::Transform3D::operator =;
157-
150+
158151 // to avoid conflict between the base Transform3D(const ForeignMatrix & m) and
159152 // Transform3D(const TGeoMatrix &m) constructors we cannot inherit base c-tors,
160153 // therefore we redefine them here
161154 Transform3D (const ROOT::Math::Rotation3D& r, const Vector& v) : ROOT::Math::Transform3D(r, v) {}
162155 Transform3D (const ROOT::Math::Rotation3D& r, const ROOT::Math::Translation3D& t) : ROOT::Math::Transform3D(r, t) {}
163156 template <class IT >
164- Transform3D (IT begin, IT end) : ROOT::Math::Transform3D(begin, end) {}
157+ Transform3D (IT begin, IT end) : ROOT::Math::Transform3D(begin, end)
158+ {
159+ }
165160
166161 // conversion operator to TGeoHMatrix
167- operator TGeoHMatrix&() const {
162+ operator TGeoHMatrix&() const
163+ {
168164 static TGeoHMatrix tmp;
169- double rot[9 ],tra[3 ];
170- GetComponents (rot[0 ],rot[1 ],rot[2 ],tra[0 ],rot[3 ],rot[4 ],rot[5 ],tra[1 ],rot[6 ],rot[7 ],rot[8 ],tra[2 ]);
165+ double rot[9 ], tra[3 ];
166+ GetComponents (rot[0 ], rot[1 ], rot[2 ], tra[0 ], rot[3 ], rot[4 ], rot[5 ], tra[1 ], rot[6 ], rot[7 ], rot[8 ], tra[2 ]);
171167 tmp.SetRotation (rot);
172168 tmp.SetTranslation (tra);
173169 return tmp;
174170 }
175-
171+
176172 void set (const TGeoMatrix& m); // set parameters from TGeoMatrix
177173
178174 using ROOT::Math::Transform3D::operator ();
@@ -227,9 +223,7 @@ class Transform3D : public ROOT::Math::Transform3D
227223 ClassDefNV (Transform3D, 1 )
228224};
229225}
230- }
231-
232- std::ostream &operator <<(std::ostream &os, const o2::Base::Rotation2D &t);
233226
227+ std::ostream& operator <<(std::ostream& os, const o2::Rotation2D& t);
234228
235229#endif
0 commit comments