1414
1515#include " ITS3Align/MisalignmentParameters.h"
1616#include " MathUtils/LegendrePols.h"
17+ #include " GPUCommonMath.h"
1718
1819#include < filesystem>
1920
@@ -26,57 +27,31 @@ class Deformations
2627 // init deformations from the parameter file
2728 void init (const std::filesystem::path&);
2829
29- double getDeformationX (unsigned int id, double u, double v) const { return getDeformation<0 >(id, u, v); }
30- double getDeformationY (unsigned int id, double u, double v) const { return getDeformation<1 >(id, u, v); }
31- double getDeformationZ (unsigned int id, double u, double v) const { return getDeformation<2 >(id, u, v); }
32- double getDeformation (unsigned int id, unsigned int axis, double u, double v) const
30+ std::tuple<double , double , double > getDeformation (unsigned int id, double radius, double phi, double z, double u, double v, double fac = 1.0 ) const
3331 {
34- if (axis == 0 ) {
35- return mLegX [id](u, v);
36- } else if (axis == 1 ) {
37- return mLegY [id](u, v) ;
38- } else {
39- return mLegZ [id](u, v );
40- }
32+ // Calculate f_def(phi,z) = ((r+dr)*cos(phi), (r+dr)*sin(phi), z)^T + (dx, dy, dz)^T
33+ const double dr = mLegendre [id](u, v);
34+ const double drr = radius + dr * fac;
35+ double sn, cs ;
36+ o2::gpu::GPUCommonMath::SinCosd (phi, sn, cs);
37+ const auto & global = mParams . getGlobal (id );
38+ return {drr * cs + global. getX () * fac, drr * sn + global. getY () * fac, z + global. getZ () * fac};
4139 }
42- std::array<double , 3 > getDeformation (unsigned int id, double u, double v) const
43- {
44- return {getDeformation<0 >(id, u, v),
45- getDeformation<1 >(id, u, v),
46- getDeformation<2 >(id, u, v)};
47- }
48- std::array<unsigned int , 3 > getOrders (unsigned int id) const
49- {
50- return {mLegX [id].NOrder (), mLegY [id].NOrder (), mLegZ [id].NOrder ()};
51- }
52- const o2::math_utils::Legendre2DPolynominal& getLegendre (unsigned int id, unsigned int axis) const
40+
41+ double getDeformation (unsigned int id, double u, double v)
5342 {
54- if (axis == 0 ) {
55- return mLegX [id];
56- } else if (axis == 1 ) {
57- return mLegY [id];
58- } else {
59- return mLegZ [id];
60- }
43+ return mLegendre [id](u, v);
6144 }
6245
46+ const o2::math_utils::Legendre2DPolynominal& getLegendre (unsigned int id) { return mLegendre [id]; }
47+
48+ unsigned int getOrder (unsigned int id) { return mLegendre [id].NOrder (); }
49+
6350 private:
64- template <int axis>
65- double getDeformation (unsigned int id, double u, double v) const
66- {
67- if constexpr (axis == 0 ) {
68- return mLegX [id](u, v);
69- } else if constexpr (axis == 1 ) {
70- return mLegY [id](u, v);
71- } else {
72- return mLegZ [id](u, v);
73- }
74- }
51+ MisalignmentParameters mParams ;
7552
76- // 3 Legendre polynominals to model deformations in x,y,z; parameterized by normalized phi (u) and z (v) coordinates
77- std::array<o2::math_utils::Legendre2DPolynominal, 6 > mLegX ;
78- std::array<o2::math_utils::Legendre2DPolynominal, 6 > mLegY ;
79- std::array<o2::math_utils::Legendre2DPolynominal, 6 > mLegZ ;
53+ // Legendre polynominals to model deformations in radius; parameterized by normalized phi (u) and z (v) coordinates
54+ std::array<o2::math_utils::Legendre2DPolynominal, 6 > mLegendre ;
8055};
8156
8257} // namespace o2::its3::align
0 commit comments