ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RectangleBounds.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RectangleBounds.hpp
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
9
#pragma once
10
11
#include "
Acts/Surfaces/PlanarBounds.hpp
"
12
#include "
Acts/Utilities/Definitions.hpp
"
13
14
#include <array>
15
#include <vector>
16
17
namespace
Acts {
18
24
class
RectangleBounds
:
public
PlanarBounds
{
25
public
:
26
enum
BoundValues
:
int
{
27
eMinX
= 0,
28
eMinY
= 1,
29
eMaxX
= 2,
30
eMaxY
= 3,
31
eSize
= 4
32
};
33
34
RectangleBounds
() =
delete
;
35
40
RectangleBounds
(
double
halfX
,
double
halfY
) noexcept(
false
)
41
:
m_min
({-
halfX
, -
halfY
}),
m_max
({
halfX
,
halfY
}) {
42
checkConsistency
();
43
}
44
48
RectangleBounds
(
const
std::array<double, eSize>&
values
) noexcept(
false
)
49
:
m_min
({
values
[
eMinX
],
values
[
eMinY
]}),
50
m_max
({
values
[
eMaxX
],
values
[
eMaxY
]}) {
51
checkConsistency
();
52
}
53
58
RectangleBounds
(
const
Vector2D
&
min
,
const
Vector2D
&
max
) noexcept(
false
)
59
:
m_min
(
min
),
m_max
(
max
) {
60
checkConsistency
();
61
}
62
63
~RectangleBounds
()
override
=
default
;
64
65
BoundsType
type
() const final;
66
67
std::vector<
double
>
values
() const final;
68
76
bool
inside
(const
Vector2D
& lposition,
77
const
BoundaryCheck
& bcheck) const final;
78
83
double
distanceToBoundary
(const
Vector2D
& lposition) const final;
84
93
std::vector<
Vector2D
>
vertices
(
unsigned
int
lseg = 1) const final;
94
95
// Bounding box representation
96
const
RectangleBounds
&
boundingBox
() const final;
97
101
std::ostream&
toStream
(std::ostream& sl) const final;
102
105
double
get
(
BoundValues
bValue) const;
106
108
double
halfLengthX
() const;
109
111
double
halfLengthY
() const;
112
115
const
Vector2D
&
min
() const;
116
119
const
Vector2D
&
max
() const;
120
121
private:
122
Vector2D
m_min
;
123
Vector2D
m_max
;
124
127
void
checkConsistency
() noexcept(
false
);
128
};
129
130
inline
SurfaceBounds
::
BoundsType
RectangleBounds
::
type
()
const
{
131
return
SurfaceBounds::eRectangle
;
132
}
133
134
inline
const
Vector2D
&
RectangleBounds::min
()
const
{
135
return
m_min
;
136
}
137
138
inline
const
Vector2D
&
RectangleBounds::max
()
const
{
139
return
m_max
;
140
}
141
142
inline
double
RectangleBounds::halfLengthX
()
const
{
143
return
0.5 * (
m_max
.x() -
m_min
.x());
144
}
145
146
inline
double
RectangleBounds::halfLengthY
()
const
{
147
return
0.5 * (
m_max
.y() -
m_min
.y());
148
}
149
150
inline
std::vector<double>
RectangleBounds::values
()
const
{
151
return
{
m_min
.x(),
m_min
.y(),
m_max
.x(),
m_max
.y()};
152
}
153
154
inline
double
RectangleBounds::get
(
BoundValues
bValue)
const
{
155
switch
(bValue) {
156
case
eMinX
:
157
return
m_min
.x();
158
case
eMinY
:
159
return
m_min
.y();
160
case
eMaxX
:
161
return
m_max
.x();
162
}
163
return
m_max
.y();
164
}
165
166
inline
void
RectangleBounds::checkConsistency
() noexcept(
false
) {
167
if
(
get
(
eMinX
) >
get
(
eMaxX
)) {
168
throw
std::invalid_argument(
"RectangleBounds: invalid local x setup"
);
169
}
170
if
(
get
(
eMinY
) >
get
(
eMaxY
)) {
171
throw
std::invalid_argument(
"RectangleBounds: invalid local y setup"
);
172
}
173
}
174
175
}
// namespace Acts
acts
blob
master
Core
include
Acts
Surfaces
RectangleBounds.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:21
using
1.8.2 with
ECCE GitHub integration