Analysis Software
Documentation for sPHENIX simulation 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 template <typename value_t, size_t DIM>
12  : m_origin(origin), m_dir(dir.normalized()), m_idir(1 / m_dir.array()) {}
13 template <typename value_t, size_t DIM>
14 std::ostream& Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const {
15  os << "Ray(";
16  for (size_t i = 0; i < DIM; i++) {
17  if (i > 0) {
18  os << ", ";
19  }
20  os << m_origin[i];
21  }
22  os << " -> ";
23  for (size_t i = 0; i < DIM; i++) {
24  if (i > 0) {
25  os << ", ";
26  }
27  os << m_dir[i];
28  }
29  os << ")";
30 
31  return os;
32 }
33 
34 template <typename value_t, size_t DIM>
36  const transform_type& trf) const {
37  return Ray<value_t, DIM>(trf * m_origin, trf.rotation() * m_dir);
38 }
39 
40 template <typename value_t, size_t DIM>
41 template <size_t D, std::enable_if_t<D == 3, int>>
43  value_type far_distance) const {
44  static_assert(DIM == 3, "OBJ is only supported in 3D");
45 
46  helper.line(m_origin, (m_origin + m_dir * far_distance).eval());
47 }
48 
49 template <typename U, size_t V>
50 std::ostream& operator<<(std::ostream& os, const Acts::Ray<U, V>& ray) {
51  ray.dump(os);
52  return os;
53 }