ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
concentric_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
20template <concepts::algebra algebra_t>
23 using algebra_type = algebra_t;
34
37
43 DETRAY_HOST_DEVICE
44 static inline point3_type global_to_local_3D(const transform3_type & /*trf*/,
45 const point3_type &p,
46 const vector3_type & /*dir*/) {
47 return {vector::phi(p), p[2], vector::perp(p)};
48 }
49
55 DETRAY_HOST_DEVICE
56 static inline loc_point global_to_local(const transform3_type & /*trf*/,
57 const point3_type &p,
58 const vector3_type & /*dir*/) {
59 return {vector::phi(p), p[2]};
60 }
61
66 DETRAY_HOST_DEVICE static inline point3_type local_to_global(
67 const transform3_type & /*trf*/, const point3_type &p) {
68 const scalar_type x{p[2] * math::cos(p[0])};
69 const scalar_type y{p[2] * math::sin(p[0])};
70 const scalar_type z{p[1]};
71
72 return point3_type{x, y, z};
73 }
74
80 template <typename mask_t>
81 DETRAY_HOST_DEVICE static inline point3_type local_to_global(
82 const transform3_type & /*trf*/, const mask_t &mask, const loc_point &p,
83 const vector3_type & /*dir*/) {
84 const scalar_type r{mask[mask_t::shape::e_r]};
85 const scalar_type x{r * math::cos(p[0])};
86 const scalar_type y{r * math::sin(p[0])};
87 const scalar_type z{p[1]};
88
89 return point3_type{x, y, z};
90 }
91
95 template <typename mask_t>
96 DETRAY_HOST_DEVICE static inline vector3_type normal(
97 const transform3_type & /*trf*/, const point2_type &p,
98 const mask_t & /*mask*/) {
99 // normal vector in global coordinates (concentric cylinders have no
100 // rotation)
101 return {math::cos(p[0]), math::sin(p[0]), static_cast<scalar_type>(0)};
102 }
103
107 DETRAY_HOST_DEVICE static inline vector3_type normal(
108 const transform3_type & /*trf*/, const point3_type &p) {
109 // normal vector in global coordinates (concentric cylinders have no
110 // rotation)
111 return {math::cos(p[0]), math::sin(p[0]), static_cast<scalar_type>(0)};
112 }
113
114}; // struct concentric_cylindrical2D
115
116} // 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_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 concentric cylindrical frame (No rotation in coordinate transformation).
Definition concentric_cylindrical2D.hpp:21
dscalar< algebra_t > scalar_type
Scalar type associated with the algebra backend.
Definition concentric_cylindrical2D.hpp:25
static vector3_type normal(const transform3_type &, const point2_type &p, const mask_t &)
Definition concentric_cylindrical2D.hpp:96
dpoint2D< algebra_t > point2_type
Two-dimensional point type.
Definition concentric_cylindrical2D.hpp:27
static vector3_type normal(const transform3_type &, const point3_type &p)
Definition concentric_cylindrical2D.hpp:107
algebra_t algebra_type
Algebra backend used by this coordinate frame.
Definition concentric_cylindrical2D.hpp:23
static point3_type local_to_global(const transform3_type &, const point3_type &p)
This method transforms from a local 3D cylindrical point to a point in the global cartesian 3D frame.
Definition concentric_cylindrical2D.hpp:66
dpoint3D< algebra_t > point3_type
Three-dimensional point type.
Definition concentric_cylindrical2D.hpp:29
static point3_type local_to_global(const transform3_type &, const mask_t &mask, const loc_point &p, const vector3_type &)
This method transforms from a local 2D cylindrical point to a point in the global cartesian 3D frame.
Definition concentric_cylindrical2D.hpp:81
static point3_type global_to_local_3D(const transform3_type &, 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 concentric_cylindrical2D.hpp:44
dvector3D< algebra_t > vector3_type
Three-dimensional vector type.
Definition concentric_cylindrical2D.hpp:31
dtransform3D< algebra_t > transform3_type
Three-dimensional transform type.
Definition concentric_cylindrical2D.hpp:33
static loc_point global_to_local(const transform3_type &, 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 concentric_cylindrical2D.hpp:56
point2_type loc_point
Local point type in 2D cylindrical coordinates.
Definition concentric_cylindrical2D.hpp:36