Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:40

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Surfaces/DiamondBounds.hpp"
0010 
0011 #include <iomanip>
0012 #include <iostream>
0013 
0014 Acts::SurfaceBounds::BoundsType Acts::DiamondBounds::type() const {
0015   return SurfaceBounds::eDiamond;
0016 }
0017 
0018 bool Acts::DiamondBounds::inside(const Acts::Vector2& lposition,
0019                                  const Acts::BoundaryCheck& bcheck) const {
0020   return bcheck.isInside(lposition, vertices());
0021 }
0022 
0023 std::vector<Acts::Vector2> Acts::DiamondBounds::vertices(
0024     unsigned int /*lseg*/) const {
0025   // Vertices starting at lower left (min rel. phi)
0026   // counter-clockwise
0027   double x1 = get(DiamondBounds::eHalfLengthXnegY);
0028   double y1 = get(DiamondBounds::eHalfLengthYneg);
0029   double x2 = get(DiamondBounds::eHalfLengthXzeroY);
0030   double y2 = 0.;
0031   double x3 = get(DiamondBounds::eHalfLengthXposY);
0032   double y3 = get(DiamondBounds::eHalfLengthYpos);
0033   return {{-x1, -y1}, {x1, -y1}, {x2, y2}, {x3, y3}, {-x3, y3}, {-x2, y2}};
0034 }
0035 
0036 const Acts::RectangleBounds& Acts::DiamondBounds::boundingBox() const {
0037   return m_boundingBox;
0038 }
0039 
0040 std::ostream& Acts::DiamondBounds::toStream(std::ostream& sl) const {
0041   sl << std::setiosflags(std::ios::fixed);
0042   sl << std::setprecision(7);
0043   sl << "Acts::DiamondBounds: (halfXatYneg, halfXatYzero, halfXatYpos, "
0044         "halfYneg, halfYpos) = ";
0045   sl << "(" << get(DiamondBounds::eHalfLengthXnegY) << ", "
0046      << get(DiamondBounds::eHalfLengthXzeroY) << ", "
0047      << get(DiamondBounds::eHalfLengthXposY) << ", "
0048      << get(DiamondBounds::eHalfLengthYneg) << ", "
0049      << get(DiamondBounds::eHalfLengthYpos) << ")";
0050   sl << std::setprecision(-1);
0051   return sl;
0052 }