ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RectangleBounds.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RectangleBounds.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-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 
11 
12 #include <cmath>
13 #include <iomanip>
14 #include <iostream>
15 
17  const Acts::BoundaryCheck& bcheck) const {
18  return bcheck.isInside(lposition, m_min, m_max);
19 }
20 
22  const Acts::Vector2D& lposition) const {
23  return BoundaryCheck(true).distance(lposition, min(), max());
24 }
25 
26 std::vector<Acts::Vector2D> Acts::RectangleBounds::vertices(
27  unsigned int /*lseg*/) const {
28  // counter-clockwise starting from bottom-left corner
29  return {m_min, {m_max.x(), m_min.y()}, m_max, {m_min.x(), m_max.y()}};
30 }
31 
33  return (*this);
34 }
35 
36 // ostream operator overload
37 std::ostream& Acts::RectangleBounds::toStream(std::ostream& sl) const {
38  sl << std::setiosflags(std::ios::fixed);
39  sl << std::setprecision(7);
40  sl << "Acts::RectangleBounds: (hlX, hlY) = "
41  << "(" << 0.5 * (get(eMaxX) - get(eMinX)) << ", "
42  << 0.5 * (get(eMaxY) - get(eMinY)) << ")";
43  sl << "\n(lower left, upper right):\n";
44  sl << min().transpose() << "\n" << max().transpose();
45  sl << std::setprecision(-1);
46  return sl;
47 }