Skip to content

Commit 685f3a7

Browse files
MichaelLettrichdavidrohr
authored andcommitted
[math_utils] Cartesian into math_utils ns
Move all classes from the `Cartesian` header to the `math_utils` namespace. Change all affected code.
1 parent 5ba6426 commit 685f3a7

114 files changed

Lines changed: 422 additions & 403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Analysis/Core/include/Analysis/trackUtilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ o2::track::TrackParCov getTrackParCov(const T& track)
4949
template <typename T>
5050
o2::dataformats::VertexBase getPrimaryVertex(const T& collision)
5151
{
52-
Point3D<float> vtxXYZ(collision.posX(), collision.posY(), collision.posZ());
52+
o2::math_utils::Point3D<float> vtxXYZ(collision.posX(), collision.posY(), collision.posZ());
5353
std::array<float, 6> vtxCov{collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()};
5454
return o2::dataformats::VertexBase{std::move(vtxXYZ), std::move(vtxCov)};
5555
}

Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct SelectTracks {
5555
void process(aod::Collision const& collision,
5656
soa::Join<aod::Tracks, aod::TracksCov, aod::TracksExtra> const& tracks)
5757
{
58-
Point3D<float> vtxXYZ(collision.posX(), collision.posY(), collision.posZ());
58+
math_utils::Point3D<float> vtxXYZ(collision.posX(), collision.posY(), collision.posZ());
5959
for (auto& track : tracks) {
6060
int status_2prong = 1; // selection flag
6161
int status_3prong = 1; // selection flag

Common/Field/include/Field/MagFieldFast.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class MagFieldFast
5050

5151
bool Field(const double xyz[3], double bxyz[3]) const;
5252
bool Field(const float xyz[3], float bxyz[3]) const;
53-
bool Field(const Point3D<float> xyz, float bxyz[3]) const;
53+
bool Field(const math_utils::Point3D<float> xyz, float bxyz[3]) const;
5454
bool GetBcomp(EDim comp, const double xyz[3], double& b) const;
5555
bool GetBcomp(EDim comp, const float xyz[3], float& b) const;
56-
bool GetBcomp(EDim comp, const Point3D<float> xyz, double& b) const;
57-
bool GetBcomp(EDim comp, const Point3D<float> xyz, float& b) const;
56+
bool GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, double& b) const;
57+
bool GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, float& b) const;
5858

5959
bool GetBx(const double xyz[3], double& bx) const { return GetBcomp(kX, xyz, bx); }
6060
bool GetBx(const float xyz[3], float& bx) const { return GetBcomp(kX, xyz, bx); }

Common/Field/src/MagFieldFast.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool MagFieldFast::GetBcomp(EDim comp, const double xyz[3], double& b) const
138138
}
139139

140140
//_______________________________________________________________________
141-
bool MagFieldFast::GetBcomp(EDim comp, const Point3D<float> xyz, double& b) const
141+
bool MagFieldFast::GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, double& b) const
142142
{
143143
// get field
144144
int zSeg, rSeg, quadrant;
@@ -152,7 +152,7 @@ bool MagFieldFast::GetBcomp(EDim comp, const Point3D<float> xyz, double& b) cons
152152
}
153153

154154
//_______________________________________________________________________
155-
bool MagFieldFast::GetBcomp(EDim comp, const Point3D<float> xyz, float& b) const
155+
bool MagFieldFast::GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, float& b) const
156156
{
157157
// get field
158158
int zSeg, rSeg, quadrant;
@@ -196,7 +196,7 @@ bool MagFieldFast::Field(const float xyz[3], float bxyz[3]) const
196196
}
197197

198198
//_______________________________________________________________________
199-
bool MagFieldFast::Field(const Point3D<float> xyz, float bxyz[3]) const
199+
bool MagFieldFast::Field(const math_utils::Point3D<float> xyz, float bxyz[3]) const
200200
{
201201
// get field
202202
int zSeg, rSeg, quadrant;

Common/MathUtils/include/MathUtils/Cartesian.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
#include <TGeoMatrix.h>
2727
#include <iosfwd>
2828

29+
namespace o2
30+
{
31+
32+
namespace math_utils
33+
{
34+
2935
template <typename T>
3036
using Point2D = ROOT::Math::PositionVector2D<ROOT::Math::Cartesian2D<T>, ROOT::Math::DefaultCoordinateSystemTag>;
3137
template <typename T>
@@ -38,8 +44,6 @@ using Vector3D = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<T>, RO
3844

3945
// more typedefs can follow
4046

41-
namespace o2
42-
{
4347
/// predefined transformations: Tracking->Local, Tracking->Global, Local->Global etc
4448
/// The IDs must be < 32
4549

@@ -229,9 +233,10 @@ class Transform3D : public ROOT::Math::Transform3D
229233

230234
ClassDefNV(Transform3D, 1);
231235
};
236+
} // namespace math_utils
232237
} // namespace o2
233238

234-
std::ostream& operator<<(std::ostream& os, const o2::Rotation2D& t);
239+
std::ostream& operator<<(std::ostream& os, const o2::math_utils::Rotation2D& t);
235240

236241
namespace std
237242
{
@@ -248,7 +253,7 @@ namespace std
248253
/// This is a workaround, we will also make suggestions to fix the cause in ROOT itself
249254
/// TODO: delete once it is fixed in ROOT
250255
template <typename T>
251-
struct is_trivially_copyable<Point3D<T>> : std::true_type {
256+
struct is_trivially_copyable<o2::math_utils::Point3D<T>> : std::true_type {
252257
};
253258
} // namespace std
254259
#endif

Common/MathUtils/src/Cartesian.cxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
#include <iostream>
1212
#include "MathUtils/Cartesian.h"
1313

14-
using namespace o2;
14+
ClassImp(o2::math_utils::Transform3D);
15+
ClassImp(o2::math_utils::Rotation2D);
1516

16-
ClassImp(o2::Transform3D);
17-
ClassImp(o2::Rotation2D);
17+
namespace o2
18+
{
19+
namespace math_utils
20+
{
1821

1922
//_________________________________________________
2023
Transform3D::Transform3D(const TGeoMatrix& m)
@@ -45,8 +48,11 @@ void Transform3D::print() const
4548
std::cout << *this << std::endl;
4649
}
4750

51+
} // namespace math_utils
52+
} // namespace o2
53+
4854
//_________________________________________________
49-
std::ostream& operator<<(std::ostream& os, const o2::Rotation2D& t)
55+
std::ostream& operator<<(std::ostream& os, const o2::math_utils::Rotation2D& t)
5056
{
5157
float cs, sn;
5258
t.getComponents(cs, sn);

Common/MathUtils/src/MathUtilsLinkDef.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#pragma link off all globals;
1313
#pragma link off all classes;
1414
#pragma link off all functions;
15-
#pragma link C++ enum o2::TransformType;
15+
#pragma link C++ enum o2::math_utils::TransformType;
1616

1717
#pragma link C++ class o2::math_utils::Chebyshev3D + ;
1818
#pragma link C++ class o2::math_utils::Chebyshev3DCalc + ;
@@ -29,8 +29,8 @@
2929
#pragma link C++ function o2::math_utils::math_base::getStatisticsData < double>;
3030
#pragma link C++ function o2::math_utils::math_base::getStatisticsData < short>;
3131

32-
#pragma link C++ class o2::Transform3D + ;
33-
#pragma link C++ class o2::Rotation2D + ;
32+
#pragma link C++ class o2::math_utils::Transform3D + ;
33+
#pragma link C++ class o2::math_utils::Rotation2D + ;
3434
#pragma link C++ class o2::base::CachingTF1 + ;
3535

3636
#pragma link C++ class o2::utils::CircleXY + ;

Common/MathUtils/test/testCartesian.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ BOOST_AUTO_TEST_CASE(Cartesian_test)
2929
TGeoHMatrix hmat = trag;
3030
hmat *= rotg;
3131

32-
Transform3D tr(hmat);
33-
Point3D<double> pd(10., 20., 30.);
34-
Point3D<float> pf(10.f, 20.f, 30.f);
32+
math_utils::Transform3D tr(hmat);
33+
math_utils::Point3D<double> pd(10., 20., 30.);
34+
math_utils::Point3D<float> pf(10.f, 20.f, 30.f);
3535
//
3636
// local to master
3737
auto pdt = tr(pd); // operator form
38-
Point3D<float> pft;
38+
math_utils::Point3D<float> pft;
3939
tr.LocalToMaster(pf, pft); // TGeoHMatrix form
4040

4141
std::cout << "Create Transform3D " << std::endl
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(Cartesian_test)
5656

5757
// inverse transform
5858
auto pfti = tr ^ (pft); // operator form
59-
Point3D<double> pdti;
59+
math_utils::Point3D<double> pdti;
6060
tr.MasterToLocal(pdt, pdti); // TGeoHMatrix form
6161

6262
std::cout << " Transforming back to local" << std::endl;
@@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(Cartesian_test)
7575

7676
BOOST_AUTO_TEST_CASE(Point3D_messageable)
7777
{
78-
using ElementType = Point3D<int>;
78+
using ElementType = math_utils::Point3D<int>;
7979
static_assert(std::is_trivially_copyable<ElementType>::value == true);
8080
std::vector<ElementType> pts(10);
8181
auto makeElement = [](int idx) {

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetMatrixCache.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace detectors
2828
{
2929
/// MatrixCache is a vector of cached transform matrices (per sensor) for specific Transformation type
3030

31-
template <typename T = o2::Transform3D>
31+
template <typename T = o2::math_utils::Transform3D>
3232
class MatrixCache
3333
{
3434
// matrices (per sensor) for specific transformation type
@@ -73,8 +73,8 @@ class MatrixCache
7373
class DetMatrixCache
7474
{
7575
public:
76-
typedef o2::Transform3D Mat3D;
77-
typedef o2::Rotation2D Rot2D;
76+
typedef o2::math_utils::Transform3D Mat3D;
77+
typedef o2::math_utils::Rotation2D Rot2D;
7878

7979
DetMatrixCache() = default;
8080
DetMatrixCache(const o2::detectors::DetID& id) : mDetID(id) {}
@@ -129,8 +129,8 @@ class DetMatrixCache
129129
class DetMatrixCacheIndirect : private DetMatrixCache
130130
{
131131
public:
132-
typedef o2::Transform3D Mat3D;
133-
typedef o2::Rotation2D Rot2D;
132+
typedef o2::math_utils::Transform3D Mat3D;
133+
typedef o2::math_utils::Rotation2D Rot2D;
134134

135135
DetMatrixCacheIndirect() = default;
136136
DetMatrixCacheIndirect(const o2::detectors::DetID& id) : DetMatrixCache(id) {}

DataFormats/Detectors/Common/src/DetMatrixCache.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
using namespace o2::detectors;
1616
using namespace o2::utils;
1717

18-
ClassImp(o2::detectors::MatrixCache<o2::Transform3D>);
19-
ClassImp(o2::detectors::MatrixCache<o2::Rotation2D>);
18+
ClassImp(o2::detectors::MatrixCache<o2::math_utils::Transform3D>);
19+
ClassImp(o2::detectors::MatrixCache<o2::math_utils::Rotation2D>);
2020
ClassImp(o2::detectors::DetMatrixCache);
2121

2222
//_______________________________________________________

0 commit comments

Comments
 (0)