forked from sPHENIX-Collaboration/acts
/
TrapezoidBounds.cpp
51 lines (42 loc) · 1.7 KB
/
TrapezoidBounds.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// This file is part of the Acts project.
//
// Copyright (C) 2016-2020 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "Acts/Surfaces/TrapezoidBounds.hpp"
#include <cmath>
#include <iomanip>
#include <iostream>
Acts::TrapezoidBounds::~TrapezoidBounds() = default;
Acts::SurfaceBounds::BoundsType Acts::TrapezoidBounds::type() const {
return SurfaceBounds::eTrapezoid;
}
bool Acts::TrapezoidBounds::inside(const Acts::Vector2D& lposition,
const Acts::BoundaryCheck& bcheck) const {
return bcheck.isInside(lposition, vertices());
}
double Acts::TrapezoidBounds::distanceToBoundary(
const Acts::Vector2D& lposition) const {
return BoundaryCheck(true).distance(lposition, vertices());
}
std::vector<Acts::Vector2D> Acts::TrapezoidBounds::vertices(
unsigned int /*lseg*/) const {
double minhx = get(TrapezoidBounds::eHalfLengthXnegY);
double maxhx = get(TrapezoidBounds::eHalfLengthXposY);
double hy = get(TrapezoidBounds::eHalfLengthY);
return {{-minhx, -hy}, {minhx, -hy}, {maxhx, hy}, {-maxhx, hy}};
}
const Acts::RectangleBounds& Acts::TrapezoidBounds::boundingBox() const {
return m_boundingBox;
}
std::ostream& Acts::TrapezoidBounds::toStream(std::ostream& sl) const {
sl << std::setiosflags(std::ios::fixed);
sl << std::setprecision(7);
sl << "Acts::TrapezoidBounds: (halfXnegY, halfXposY, halfY) = "
<< "(" << get(eHalfLengthXnegY) << ", " << get(eHalfLengthXposY) << ", "
<< get(eHalfLengthY) << ")";
sl << std::setprecision(-1);
return sl;
}