ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlaneSurface.ipp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PlaneSurface.ipp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018 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 
10 // PlaneSurface.ipp, Acts project
12 
14  const Vector2D& /*lpos*/) const {
15  // fast access via tranform matrix (and not rotation())
16  const auto& tMatrix = transform(gctx).matrix();
17  return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2));
18 }
19 
20 inline const Vector3D PlaneSurface::binningPosition(
21  const GeometryContext& gctx, BinningValue /*bValue*/) const {
22  return center(gctx);
23 }
24 
25 inline double PlaneSurface::pathCorrection(const GeometryContext& gctx,
26  const Vector3D& position,
27  const Vector3D& direction) const {
28  // We can ignore the global position here
29  return 1. / std::abs(Surface::normal(gctx, position).dot(direction));
30 }
31 
33  const GeometryContext& gctx, const Vector3D& position,
34  const Vector3D& direction, const BoundaryCheck& bcheck) const {
35  // Get the contextual transform
36  const auto& gctxTransform = transform(gctx);
37  // Use the intersection helper for planar surfaces
38  auto intersection =
39  PlanarHelper::intersectionEstimate(gctxTransform, position, direction);
40  // Evaluate boundary check if requested (and reachable)
41  if (intersection.status != Intersection::Status::unreachable and bcheck) {
42  // Built-in local to global for speed reasons
43  const auto& tMatrix = gctxTransform.matrix();
44  // Create the reference vector in local
45  const Vector3D vecLocal(intersection.position - tMatrix.block<3, 1>(0, 3));
46  if (not insideBounds(tMatrix.block<3, 2>(0, 0).transpose() * vecLocal,
47  bcheck)) {
48  intersection.status = Intersection::Status::missed;
49  }
50  }
51  return intersection;
52 }