EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ray.ipp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Ray.ipp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2019 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 http://mozilla.org/MPL/2.0/.
8 
10 
11 template <typename value_t, size_t DIM>
13  : m_origin(origin), m_dir(dir.normalized()), m_idir(1 / m_dir.array()) {}
14 template <typename value_t, size_t DIM>
15 std::ostream& Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const {
16  os << "Ray(";
17  for (size_t i = 0; i < DIM; i++) {
18  if (i > 0) {
19  os << ", ";
20  }
21  os << m_origin[i];
22  }
23  os << " -> ";
24  for (size_t i = 0; i < DIM; i++) {
25  if (i > 0) {
26  os << ", ";
27  }
28  os << m_dir[i];
29  }
30  os << ")";
31 
32  return os;
33 }
34 
35 template <typename value_t, size_t DIM>
37  const transform_type& trf) const {
38  return Ray<value_t, DIM>(trf * m_origin, trf.rotation() * m_dir);
39 }
40 
41 template <typename value_t, size_t DIM>
42 template <size_t D, std::enable_if_t<D == 3, int>>
44  value_type far_distance) const {
45  static_assert(DIM == 3, "OBJ is only supported in 3D");
46 
47  helper.line(m_origin, (m_origin + m_dir * far_distance).eval());
48 }
49 
50 template <typename U, size_t V>
51 std::ostream& operator<<(std::ostream& os, const Acts::Ray<U, V>& ray) {
52  ray.dump(os);
53  return os;
54 }