Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestSpacePoint.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TestSpacePoint.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 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 
9 // Local include(s).
10 #include "TestSpacePoint.hpp"
11 
12 // System include(s).
13 #include <cmath>
14 #include <iostream>
15 #include <limits>
16 
18 static constexpr float allowedDiff = std::numeric_limits<float>::epsilon() * 4;
19 
20 bool operator==(const TestSpacePoint& a, const TestSpacePoint& b) {
21  return ((std::abs(a.m_x - b.m_x) < allowedDiff) &&
22  (std::abs(a.m_y - b.m_y) < allowedDiff) &&
23  (std::abs(a.m_z - b.m_z) < allowedDiff));
24 }
25 
26 std::ostream& operator<<(std::ostream& out, const TestSpacePoint& sp) {
27  out << "[surface: " << sp.m_surface << ", x: " << sp.m_x << ", y: " << sp.m_y
28  << ", z: " << sp.m_z << "]";
29  return out;
30 }