Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type unrolling jacobian transformation and covariance transport #295

Merged
merged 79 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
0d0b934
Backup
beomki-yeo Aug 25, 2022
262e36f
Backup
beomki-yeo Aug 25, 2022
9a063e9
Backup
beomki-yeo Aug 29, 2022
c4d5fd1
backup
beomki-yeo Aug 30, 2022
6b7f773
Backup
beomki-yeo Aug 30, 2022
48c85c3
Backup
beomki-yeo Aug 30, 2022
43180dd
backup
beomki-yeo Aug 30, 2022
86db88f
Backup
beomki-yeo Aug 30, 2022
3ed761f
Put field into the state
beomki-yeo Aug 30, 2022
f1d9ce0
remove default constructor
beomki-yeo Aug 30, 2022
cbf4cd0
Resolve conflicts
beomki-yeo Aug 30, 2022
a7c2017
Resolve conflicts
beomki-yeo Aug 30, 2022
740f78e
Resolve conflicts
beomki-yeo Aug 31, 2022
09426a7
Backup
beomki-yeo Sep 1, 2022
9d381a5
Add unit test for jacobian transformation
beomki-yeo Sep 2, 2022
913f605
Backup
beomki-yeo Sep 2, 2022
20933cc
Backup
beomki-yeo Sep 3, 2022
172aecb
Backup
beomki-yeo Sep 6, 2022
39d6334
Backup
beomki-yeo Sep 7, 2022
dc516e8
Remove unused files
beomki-yeo Sep 7, 2022
c18ea8d
Remove unused files
beomki-yeo Sep 7, 2022
933527b
Fix some
beomki-yeo Sep 7, 2022
e5c0272
Change some file names
beomki-yeo Sep 7, 2022
bc3c552
Fix bug
beomki-yeo Sep 7, 2022
fc81a0e
Pass the test
beomki-yeo Sep 7, 2022
56b8952
Fix some
beomki-yeo Sep 7, 2022
e4eb991
FIx a bug
beomki-yeo Sep 7, 2022
a9b33a0
Backup
beomki-yeo Sep 10, 2022
945266b
Add line stepper covariance transport
beomki-yeo Sep 12, 2022
f559af7
Remove comments
beomki-yeo Sep 12, 2022
2bc6191
FIx unused parameter
beomki-yeo Sep 12, 2022
8b99787
Backup
beomki-yeo Sep 14, 2022
30e7647
Remove free dir to bound pos derivative
beomki-yeo Sep 14, 2022
2216649
Fix warning
beomki-yeo Sep 14, 2022
f532715
Fix a bug
beomki-yeo Sep 14, 2022
5010589
Some fix
beomki-yeo Sep 14, 2022
6a4d3e2
Remove comments
beomki-yeo Sep 14, 2022
08fdfe1
Change actor name
beomki-yeo Sep 20, 2022
b4ac3b0
remove file
beomki-yeo Sep 20, 2022
49673ff
Small fix
beomki-yeo Sep 21, 2022
9a99d57
change field into pointer
beomki-yeo Sep 23, 2022
4fc888f
Fix constructor
beomki-yeo Sep 24, 2022
224d497
Fix conflict
beomki-yeo Sep 24, 2022
14e7230
FIx bug
beomki-yeo Sep 24, 2022
367b7b7
Remove unused file
beomki-yeo Sep 26, 2022
5f309de
Merge branch 'main' of https://github.com/acts-project/detray into fi…
beomki-yeo Sep 28, 2022
ad404f8
Editing create telescope detector
beomki-yeo Sep 28, 2022
8c9ced7
Remove unused file
beomki-yeo Sep 28, 2022
03b4a3d
Use ray/helix for telescope geometry
beomki-yeo Sep 29, 2022
35da5e1
Change actor name
beomki-yeo Sep 29, 2022
9169aa0
Clang format
beomki-yeo Sep 29, 2022
6cec025
Merge branch 'main' of https://github.com/acts-project/detray into fi…
beomki-yeo Oct 4, 2022
1c38ba2
Rewrite tests
beomki-yeo Oct 7, 2022
d108369
Fix a bug
beomki-yeo Oct 7, 2022
d46bfc5
Merge branch 'main' of https://github.com/acts-project/detray into fi…
beomki-yeo Oct 7, 2022
612be89
Merge branch 'main' of https://github.com/acts-project/detray into ad…
beomki-yeo Oct 7, 2022
9e7b64a
Add path correction unit test for polar and cylindrical coordinate
beomki-yeo Oct 8, 2022
347db57
Merge branch 'main' of https://github.com/acts-project/detray into fi…
beomki-yeo Oct 11, 2022
fa2e34c
Rebasing
beomki-yeo Oct 11, 2022
53dd622
Remove unused file
beomki-yeo Oct 11, 2022
f9295fe
Remove leftovers
beomki-yeo Oct 11, 2022
38a36fb
Remove leftover
beomki-yeo Oct 11, 2022
1a6c847
Remove left over
beomki-yeo Oct 11, 2022
112e9c0
Fix a warning
beomki-yeo Oct 11, 2022
bfc3ac7
const qualifier
beomki-yeo Oct 12, 2022
6b439f5
Fix a warning
beomki-yeo Oct 12, 2022
578d113
Clang format
beomki-yeo Oct 12, 2022
72c2502
Fix conflicts
beomki-yeo Oct 13, 2022
3e9eaeb
Remove unused tests
beomki-yeo Oct 13, 2022
a5c784d
Remove unused cuda tests
beomki-yeo Oct 13, 2022
090d6a8
Rebasing
beomki-yeo Oct 13, 2022
8ff7186
Change the varaibles name
beomki-yeo Oct 13, 2022
1028072
Small fixes
beomki-yeo Oct 13, 2022
ce1dede
Merge branch 'main' of https://github.com/acts-project/detray into ad…
beomki-yeo Oct 14, 2022
95321e6
Comment out print
beomki-yeo Oct 15, 2022
228dd1c
Add a qualifier to invalid_values
beomki-yeo Oct 16, 2022
7fd96b4
Remove unused file
beomki-yeo Oct 16, 2022
34a3a3f
Remove unused file
beomki-yeo Oct 16, 2022
f7e4272
Merge branch 'add-qualifier' into add-jacobian-transformation
beomki-yeo Oct 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ detray_add_library( detray_core core
"include/detray/materials/material_slab.hpp"
"include/detray/materials/predefined_materials.hpp"
# propagator include(s)
"include/detray/propagator/aborters.hpp"
"include/detray/propagator/actors/aborters.hpp"
"include/detray/propagator/actors/parameter_transporter.hpp"
"include/detray/propagator/actors/parameter_resetter.hpp"
"include/detray/propagator/actor_chain.hpp"
"include/detray/propagator/base_actor.hpp"
"include/detray/propagator/base_stepper.hpp"
"include/detray/propagator/constrained_step.hpp"
"include/detray/propagator/detail/covariance_engine.hpp"
"include/detray/propagator/detail/jacobian_engine.hpp"
"include/detray/propagator/line_stepper.hpp"
"include/detray/propagator/navigation_policies.hpp"
"include/detray/propagator/navigator.hpp"
Expand Down Expand Up @@ -107,7 +107,6 @@ detray_add_library( detray_core core
"include/detray/tools/local_object_finder.hpp"
# tracks include(s)
"include/detray/tracks/detail/track_helper.hpp"
"include/detray/tracks/detail/trigonometrics.hpp"
"include/detray/tracks/bound_track_parameters.hpp"
"include/detray/tracks/free_track_parameters.hpp"
"include/detray/tracks/tracks.hpp"
Expand Down
94 changes: 69 additions & 25 deletions core/include/detray/coordinates/cartesian2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,31 @@ struct cartesian2 final : public coordinate_base<cartesian2, transform3_t> {
/// @name Type definitions for the struct
/// @{

/// Base type
// Base type
using base_type = coordinate_base<cartesian2, transform3_t>;
/// Sclar type
// Sclar type
using scalar_type = typename base_type::scalar_type;
/// Point in 2D space
// Point in 2D space
using point2 = typename base_type::point2;
/// Point in 3D space
// Point in 3D space
using point3 = typename base_type::point3;
/// Vector in 3D space
// Vector in 3D space
using vector3 = typename base_type::vector3;
/// Matrix actor
// Matrix operator
using matrix_operator = typename base_type::matrix_operator;
/// Matrix size type
// Rotation Matrix
using rotation_matrix = typename base_type::rotation_matrix;
// Matrix size type
using size_type = typename base_type::size_type;
/// 2D matrix type
// 2D matrix type
template <size_type ROWS, size_type COLS>
using matrix_type = typename base_type::template matrix_type<ROWS, COLS>;

// Trigonometrics
using trigonometrics = typename base_type::trigonometrics;
// Vector types
using bound_vector = typename base_type::bound_vector;
using free_vector = typename base_type::free_vector;
// Matrix types
using free_to_bound_matrix = typename base_type::free_to_bound_matrix;
using bound_to_free_matrix = typename base_type::bound_to_free_matrix;

/// @}

Expand All @@ -63,40 +65,82 @@ struct cartesian2 final : public coordinate_base<cartesian2, transform3_t> {
/** This method transform from a point from global cartesian 3D frame to a
* local 2D cartesian point */
DETRAY_HOST_DEVICE
inline point2 global_to_local(const transform3_t &trf, const point3 &p,
inline point2 global_to_local(const transform3_t &trf3, const point3 &p,
const vector3 & /*d*/) const {
const auto local3 = trf.point_to_local(p);
const auto local3 = trf3.point_to_local(p);
return this->operator()(local3);
}

/** This method transform from a local 2D cartesian point to a point global
* cartesian 3D frame*/
template <typename mask_t>
DETRAY_HOST_DEVICE inline point3 local_to_global(
const transform3_t &trf, const mask_t & /*mask*/, const point2 &p,
const transform3_t &trf3, const mask_t & /*mask*/, const point2 &p,
const vector3 & /*d*/) const {
return trf.point_to_global(point3{p[0], p[1], 0.});
return trf3.point_to_global(point3{p[0], p[1], 0.});
}

DETRAY_HOST_DEVICE
inline matrix_type<3, 2> bound_to_free_rotation(
const transform3_t &trf3, const trigonometrics & /*t*/) {
template <typename mask_t>
DETRAY_HOST_DEVICE inline vector3 normal(const transform3_t &trf3,
const mask_t & /*mask*/,
const point3 & /*pos*/,
const vector3 & /*dir*/) const {
vector3 ret;
const matrix_type<3, 1> n =
matrix_operator().template block<3, 1>(trf3.matrix(), 0, 2);
ret[0] = matrix_operator().element(n, 0, 0);
ret[1] = matrix_operator().element(n, 1, 0);
ret[2] = matrix_operator().element(n, 2, 0);
return ret;
}

template <typename mask_t>
DETRAY_HOST_DEVICE inline rotation_matrix reference_frame(
const transform3_t &trf3, const mask_t & /*mask*/,
const point3 & /*pos*/, const vector3 & /*dir*/) const {
return trf3.rotation();
}

template <typename mask_t>
DETRAY_HOST_DEVICE inline void set_bound_pos_to_free_pos_derivative(
bound_to_free_matrix &bound_to_free_jacobian, const transform3_t &trf3,
const mask_t &mask, const point3 &pos, const vector3 &dir) const {

const rotation_matrix frame = reference_frame(trf3, mask, pos, dir);

// Get d(x,y,z)/d(loc0, loc1)
return matrix_operator().template block<3, 2>(trf3.matrix(), 0, 0);
const matrix_type<3, 2> bound_pos_to_free_pos_derivative =
matrix_operator().template block<3, 2>(frame, 0, 0);

matrix_operator().template set_block(bound_to_free_jacobian,
bound_pos_to_free_pos_derivative,
e_free_pos0, e_bound_loc0);
}

DETRAY_HOST_DEVICE
inline matrix_type<2, 3> free_to_bound_rotation(
const transform3_t &trf3, const trigonometrics & /*t*/) {
template <typename mask_t>
DETRAY_HOST_DEVICE inline void set_free_pos_to_bound_pos_derivative(
free_to_bound_matrix &free_to_bound_jacobian, const transform3_t &trf3,
const mask_t &mask, const point3 &pos, const vector3 &dir) const {

// Get transpose of transform3 matrix
const auto trf3T = matrix_operator().transpose(trf3);
const rotation_matrix frame = reference_frame(trf3, mask, pos, dir);
const rotation_matrix frameT = matrix_operator().transpose(frame);

// Get d(loc0, loc1)/d(x,y,z)
return matrix_operator().template block<2, 3>(trf3T.matrix(), 0, 0);
const matrix_type<2, 3> free_pos_to_bound_pos_derivative =
matrix_operator().template block<2, 3>(frameT, 0, 0);

matrix_operator().template set_block(free_to_bound_jacobian,
free_pos_to_bound_pos_derivative,
e_bound_loc0, e_free_pos0);
}

template <typename mask_t>
DETRAY_HOST_DEVICE inline void set_bound_angle_to_free_pos_derivative(
bound_to_free_matrix & /*bound_to_free_jacobian*/,
const transform3_t & /*trf3*/, const mask_t & /*mask*/,
const point3 & /*pos*/, const vector3 & /*dir*/) const {
// Do nothing
}
}; // struct cartesian2

} // namespace detray
Loading