Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:05

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // Project include(s)
0012 #include "detray/definitions/algebra.hpp"
0013 #include "detray/definitions/math.hpp"
0014 #include "detray/geometry/surface.hpp"
0015 
0016 namespace detray {
0017 
0018 /// Helper to get the incidence angle of a direction vector on a surface
0019 ///
0020 /// @param ctx the geometric context
0021 /// @param sf the geometric surface
0022 /// @param dir normalized direction vector (e.g. direction of a track)
0023 /// @param loc the local/bound position on the surface
0024 ///
0025 /// @returns the cosine of the incidence angle given a local/bound position
0026 template <typename detector_t, concepts::point point_t>
0027 DETRAY_HOST_DEVICE constexpr dscalar<typename detector_t::algebra_type>
0028 cos_angle(const typename detector_t::geometry_context &ctx,
0029           geometry::surface<detector_t> sf,
0030           const dvector3D<typename detector_t::algebra_type> &dir,
0031           const point_t &loc) {
0032   return math::fabs(vector::dot(dir, sf.normal(ctx, loc)));
0033 }
0034 
0035 }  // namespace detray