17 #include "GaudiKernel/MsgStream.h"
18 #include "GaudiKernel/SystemOfUnits.h"
27 , m_baseBounds(nullptr)
34 std::vector<std::pair<float, float>> xyVtx,
38 , m_baseBounds(nullptr)
44 m_xyVtx.assign(xyVtx.begin(), xyVtx.end());
49 std::vector<std::pair<double, double>> xyVtx,
53 , m_baseBounds(nullptr)
59 m_xyVtx.assign(xyVtx.begin(), xyVtx.end());
65 , m_halfZ(trabo.m_halfZ)
66 , m_baseBounds(nullptr)
67 , m_ordering(trabo.m_ordering)
69 m_objectAccessor(trabo.m_objectAccessor)
87 m_xyVtx.resize(trabo.
m_xyVtx.size());
97 const std::vector<const Trk::Surface*>*
101 std::vector<const Trk::Surface*>* retsf =
102 new std::vector<const Trk::Surface*>;
110 retsf->push_back(xyPlane);
117 retsf->push_back(xymPlane);
120 for (
unsigned int iv = 0; iv < m_xyVtx.size(); iv++) {
121 if (iv != m_xyVtx.size() - 1)
122 retsf->push_back(sideSurf(
transform, iv, iv + 1));
124 retsf->push_back(sideSurf(
transform, iv, 0));
135 unsigned int iv2)
const
139 double xdif = m_xyVtx[iv2].first - m_xyVtx[iv1].first;
140 double ydif = m_xyVtx[iv2].second - m_xyVtx[iv1].second;
141 double xsize = sqrt(xdif * xdif + ydif * ydif);
143 double ori =
ordering() > 0 ? 1. : -1.;
146 0.5 * (m_xyVtx[iv1].
first + m_xyVtx[iv2].
first),
149 double phi = ori * ydif < 0 ?
M_PI / 2 : -
M_PI / 2;
150 if (ori > 0 && ydif > 0)
152 if (std::abs(xdif) > 1
e-6) {
175 int ivr = (iv1 == 0 || iv2 == 0) ? 1 : 0;
176 if (ivr == 1 && (iv1 == 1 || iv2 == 1))
179 double ox = m_xyVtx[ivr].first -
pos[0];
180 double oy = m_xyVtx[ivr].second -
pos[1];
184 if (
d.dot(plane->
normal()) > 0.) {
201 if (std::abs(
pos.z()) > m_halfZ + tol)
205 return (m_baseBounds->inside(locp, tol, tol));
208 std::vector<std::pair<double, double>>
211 std::vector<std::pair<double, double>> mirrored;
212 mirrored.resize(m_xyVtx.size());
214 for (
unsigned int i = 0;
i < m_xyVtx.size();
i++)
216 std::pair<double, double>(m_xyVtx[
i].
first, -m_xyVtx[
i].
second);
224 if (m_ordering.isValid()) {
225 return *(m_ordering.ptr());
228 int tmp_ordering = 1;
230 double yd2 = m_xyVtx[2].second - m_xyVtx[1].second;
231 double yd0 = m_xyVtx[0].second - m_xyVtx[1].second;
232 double xd2 = m_xyVtx[2].first - m_xyVtx[1].first;
233 double xd0 = m_xyVtx[0].first - m_xyVtx[1].first;
234 double ph2 = yd2 < 0 ? -
M_PI / 2 :
M_PI / 2;
235 if (std::abs(xd2) > 1
e-6) {
236 ph2 =
atan(yd2 / xd2);
240 double ph0 = yd0 < 0 ? -
M_PI / 2 :
M_PI / 2;
241 if (std::abs(xd0) > 1
e-6) {
242 ph0 =
atan(yd0 / xd0);
251 if ((ph0 > ph2 && ph0 - ph2 <
M_PI) || (ph2 - ph0) >
M_PI)
254 m_ordering.set(tmp_ordering);
255 return *(m_ordering.ptr());
262 std::stringstream temp_sl;
263 temp_sl << std::setiosflags(std::ios::fixed);
264 temp_sl << std::setprecision(7);
265 temp_sl <<
"Trk::PrismVolumeBounds: (halfZ, generating vtx) = ";
266 temp_sl <<
"( " << m_halfZ <<
")";
267 for (
const auto & myVtx : m_xyVtx)
268 temp_sl <<
"(" << myVtx.first <<
"," << myVtx.second <<
")";
277 std::stringstream temp_sl;
278 temp_sl << std::setiosflags(std::ios::fixed);
279 temp_sl << std::setprecision(7);
280 temp_sl <<
"Trk::PrismVolumeBounds: (halfZ, generating vtx) = ";
281 temp_sl <<
"( " << m_halfZ <<
")";
282 for (
const auto & myVtx : m_xyVtx)
283 temp_sl <<
"(" << myVtx.first <<
"," << myVtx.second <<
")";