ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
cylindrical2D.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/definitions/algebra.hpp"
13#include "detray/definitions/detail/qualifiers.hpp"
14#include "detray/definitions/math.hpp"
15
16namespace detray {
17
19template <concepts::algebra algebra_t>
22 using algebra_type = algebra_t;
35
38
45 DETRAY_HOST_DEVICE
47 const point3_type &p,
48 const vector3_type & /*dir*/) {
49 const point3_type local3{trf.point_to_local(p)};
50 const scalar_type r{vector::perp(local3)};
51
52 return {r * vector::phi(local3), local3[2], r};
53 }
54
61 DETRAY_HOST_DEVICE
62 static inline loc_point global_to_local(const transform3_type &trf,
63 const point3_type &p,
64 const vector3_type & /*dir*/) {
65 const point3_type local3{trf.point_to_local(p)};
66
67 return {vector::perp(local3) * vector::phi(local3), local3[2]};
68 }
69
75 DETRAY_HOST_DEVICE static inline point3_type local_to_global(
76 const transform3_type &trf, const point3_type &p) {
77 const scalar_type r{p[2]};
78 const scalar_type phi{p[0] / r};
79 const scalar_type x{r * math::cos(phi)};
80 const scalar_type y{r * math::sin(phi)};
81 const scalar_type z{p[1]};
82
83 return trf.point_to_global(point3_type{x, y, z});
84 }
85
92 template <typename mask_t>
93 DETRAY_HOST_DEVICE static inline point3_type local_to_global(
94 const transform3_type &trf, const mask_t &mask, const loc_point &p,
95 const vector3_type & /*dir*/) {
97 trf, {p[0], p[1], mask[mask_t::shape::e_r]});
98 }
99
105 template <typename mask_t>
106 DETRAY_HOST_DEVICE static inline vector3_type normal(
107 const transform3_type &trf, const point2_type &p, const mask_t &mask) {
108 const scalar_type phi{p[0] / mask[mask_t::shape::e_r]};
109
110 // normal vector in global coordinate
111 return trf.vector_to_global(vector2_type{math::cos(phi), math::sin(phi)});
112 }
113
118 DETRAY_HOST_DEVICE static inline vector3_type normal(
119 const transform3_type &trf, const point3_type &p) {
120 const scalar_type phi{p[0] / p[2]};
121
122 // normal vector in global coordinate
123 return trf.vector_to_global(vector2_type{math::cos(phi), math::sin(phi)});
124 }
125
126}; // struct cylindrical2D
127
128} // namespace detray
Mask a region on a surface and link it to a volume.
Definition mask.hpp:46
Detray include(s).
Definition array_operators.hpp:18
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
get_vector2D_t< A, T > dvector2D
Two-dimensional vector type for algebra A and value type T.
Definition algebra.hpp:76
get_vector3D_t< A, T > dvector3D
Three-dimensional vector type for algebra A and value type T.
Definition algebra.hpp:80
get_transform3D_t< A, T > dtransform3D
Three-dimensional transform type for algebra A and value type T.
Definition algebra.hpp:84
get_point3D_t< A, T > dpoint3D
Three-dimensional point type for algebra A and value type T.
Definition algebra.hpp:72
get_point2D_t< A, T > dpoint2D
Two-dimensional point type for algebra A and value type T.
Definition algebra.hpp:68
Projection into a 2D cylindrical coordinate frame.
Definition cylindrical2D.hpp:20
static point3_type local_to_global(const transform3_type &trf, const point3_type &p)
This method transform from a local 3D cylindrical point to a point in the global cartesian 3D frame.
Definition cylindrical2D.hpp:75
static loc_point global_to_local(const transform3_type &trf, const point3_type &p, const vector3_type &)
This method transforms a point from a global cartesian 3D frame to a local 2D cylindrical point Conve...
Definition cylindrical2D.hpp:62
dvector3D< algebra_t > vector3_type
Three-dimensional vector type.
Definition cylindrical2D.hpp:32
static point3_type global_to_local_3D(const transform3_type &trf, const point3_type &p, const vector3_type &)
This method transforms a point from a global cartesian 3D frame to a local 3D cylindrical point Conve...
Definition cylindrical2D.hpp:46
dpoint2D< algebra_t > point2_type
Two-dimensional point type.
Definition cylindrical2D.hpp:26
dpoint3D< algebra_t > point3_type
Three-dimensional point type.
Definition cylindrical2D.hpp:28
point2_type loc_point
Local point type in 2D cylindrical coordinates.
Definition cylindrical2D.hpp:37
algebra_t algebra_type
Algebra backend used by this coordinate frame.
Definition cylindrical2D.hpp:22
static point3_type local_to_global(const transform3_type &trf, const mask_t &mask, const loc_point &p, const vector3_type &)
This method transform from a local 2D cylindrical point to a point in the global cartesian 3D frame.
Definition cylindrical2D.hpp:93
dtransform3D< algebra_t > transform3_type
Three-dimensional transform type.
Definition cylindrical2D.hpp:34
dscalar< algebra_t > scalar_type
Scalar type associated with the algebra backend.
Definition cylindrical2D.hpp:24
static vector3_type normal(const transform3_type &trf, const point2_type &p, const mask_t &mask)
Definition cylindrical2D.hpp:106
static vector3_type normal(const transform3_type &trf, const point3_type &p)
Definition cylindrical2D.hpp:118
dvector2D< algebra_t > vector2_type
Two-dimensional vector type.
Definition cylindrical2D.hpp:30