35 Acts::DiscSurface::DiscSurface(
const DiscSurface& other)
36 : GeometryObject(),
Surface(other), m_bounds(other.m_bounds) {}
39 const DiscSurface& other,
41 : GeometryObject(),
Surface(gctx, other, shift), m_bounds(other.m_bounds) {}
44 double rmax,
double hphisec)
47 m_bounds(std::make_shared<const RadialBounds>(rmin, rmax, hphisec)) {}
50 double maxhalfx,
double minR,
double maxR,
51 double avephi,
double stereo)
54 m_bounds(std::make_shared<const DiscTrapezoidBounds>(
55 minhalfx, maxhalfx, minR, maxR, avephi, stereo)) {}
58 std::shared_ptr<const DiscBounds> dbounds)
59 : GeometryObject(),
Surface(transform), m_bounds(std::
move(dbounds)) {}
61 Acts::DiscSurface::DiscSurface(std::shared_ptr<const DiscBounds> dbounds,
62 const DetectorElementBase& detelement)
63 : GeometryObject(),
Surface(detelement), m_bounds(std::
move(dbounds)) {
70 m_bounds = other.m_bounds;
95 if (std::abs(loc3Dframe.z()) > std::abs(tolerance)) {
96 return Result<Vector2>::failure(SurfaceError::GlobalPositionNotOnSurface);
98 return Result<Acts::Vector2>::success({
perp(loc3Dframe),
phi(loc3Dframe)});
103 const DiscTrapezoidBounds* dtbo =
105 if (dtbo !=
nullptr) {
106 double rMedium = dtbo->
rCenter();
109 Vector2 polarCenter(rMedium, phi);
110 Vector2 cartCenter = localPolarToCartesian(polarCenter);
111 Vector2 cartPos = localPolarToCartesian(locpol);
112 Vector2 Pos = cartPos - cartCenter;
134 return Vector2(loc3Dframe.x(), loc3Dframe.y());
138 return "Acts::DiscSurface";
143 return (*(m_bounds.get()));
152 std::vector<Polyhedron::FaceType> faces;
153 std::vector<Polyhedron::FaceType> triangularMesh;
156 bool fullDisc = m_bounds->coversFullAzimuth();
162 auto vertices2D = m_bounds->vertices(lseg);
163 vertices.reserve(vertices2D.size() + 1);
165 for (
const auto& v2D : vertices2D) {
167 wCenter += (*vertices.rbegin());
171 if (exactPolyhedron or toCenter or not fullDisc) {
173 wCenter *= 1. / vertices.size();
174 if (addCentreFromConvexFace) {
175 vertices.push_back(wCenter);
178 faces = facesMesh.first;
179 triangularMesh = facesMesh.second;
185 faces = facesMesh.first;
186 triangularMesh = facesMesh.second;
189 throw std::domain_error(
190 "Polyhedron repr of boundless surface not possible.");
192 return Polyhedron(vertices, faces, triangularMesh, exactPolyhedron);
198 lpolar[
eBoundLoc0] * sin(lpolar[eBoundLoc1]));
204 std::atan2(lcart[eBoundLoc1], lcart[eBoundLoc0]));
218 const double sin_theta = std::sin(boundParams[
eBoundTheta]);
219 const double cos_phi = std::cos(boundParams[
eBoundPhi]);
220 const double sin_phi = std::sin(boundParams[
eBoundPhi]);
224 double lcos_phi = cos(lphi);
225 double lsin_phi = sin(lphi);
227 const auto rframe = referenceFrame(gctx, position, direction);
232 lcos_phi * rframe.block<3, 1>(0, 0) + lsin_phi * rframe.block<3, 1>(0, 1);
234 lrad * (lcos_phi * rframe.block<3, 1>(0, 1) -
235 lsin_phi * rframe.block<3, 1>(0, 0));
253 const auto position = parameters.segment<3>(
eFreePos0);
255 const auto direction = parameters.segment<3>(
eFreeDir0);
257 const double x = direction(0);
258 const double y = direction(1);
259 const double z = direction(2);
261 const double cosTheta =
z;
262 const double sinTheta = std::hypot(x, y);
263 const double invSinTheta = 1. / sinTheta;
264 const double cosPhi = x * invSinTheta;
265 const double sinPhi = y * invSinTheta;
268 referenceFrame(gctx, position, direction).transpose();
271 const double lr =
perp(pos_loc);
272 const double lphi =
phi(pos_loc);
273 const double lcphi = cos(lphi);
274 const double lsphi = sin(lphi);
276 auto lx = rframeT.block<1, 3>(0, 0);
277 auto ly = rframeT.block<1, 3>(1, 0);
283 (lcphi * ly - lsphi * lx) / lr;
298 const Vector3& direction,
const BoundaryCheck& bcheck,
305 auto status = intersection.status();
307 if (intersection.status() != Intersection3D::Status::unreachable and
308 bcheck and m_bounds !=
nullptr) {
310 const auto& tMatrix = gctxTransform.matrix();
311 const Vector3 vecLocal(intersection.position() - tMatrix.block<3, 1>(0, 3));
312 const Vector2 lcartesian = tMatrix.block<3, 2>(0, 0).transpose() * vecLocal;
313 if (bcheck.type() == BoundaryCheck::Type::eAbsolute and
314 m_bounds->coversFullAzimuth()) {
315 double modifiedTolerance = tolerance + bcheck.tolerance()[
eBoundLoc0];
317 modifiedTolerance)) {
318 status = Intersection3D::Status::missed;
320 }
else if (not insideBounds(localCartesianToPolar(lcartesian), bcheck)) {
321 status = Intersection3D::Status::missed;
324 return {{
Intersection3D(intersection.position(), intersection.pathLength(),
338 const double lr =
perp(localPos);
339 const double lphi =
phi(localPos);
340 const double lcphi = std::cos(lphi);
341 const double lsphi = std::sin(lphi);
342 ActsMatrix<2, 3> loc3DToLocBound = ActsMatrix<2, 3>::Zero();
343 loc3DToLocBound << lcphi, lsphi, 0, -lsphi / lr, lcphi / lr, 0;
345 return loc3DToLocBound;
351 const auto& tMatrix =
transform(gctx).matrix();
352 return Vector3(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2));
358 double r = m_bounds->binningValueR();
359 double phi = m_bounds->binningValuePhi();
365 double Acts::DiscSurface::binningPositionValue(
const GeometryContext& gctx,
367 if (bValue ==
binR) {
379 const Vector3& direction)
const {