26 class DetectorElementBase;
41 double radius,
double halfz,
42 double halfphi,
double avphi,
43 double bevelMinZ,
double bevelMaxZ)
46 radius, halfz, halfphi, avphi, bevelMinZ, bevelMaxZ)) {}
49 std::shared_ptr<const CylinderBounds> cbounds,
51 :
Surface(detelement), m_bounds(std::
move(cbounds)) {
58 :
Surface(transform), m_bounds(std::
move(cbounds)) {
92 Vector3 measY = rotSymmetryAxis(gctx);
94 Vector3 measDepth = normal(gctx, position);
96 Vector3 measX(measY.cross(measDepth).normalized());
98 mFrame.col(0) = measX;
99 mFrame.col(1) = measY;
100 mFrame.col(2) = measDepth;
132 Transform3 inverseTrans(sfTransform.inverse());
133 Vector3 loc3Dframe(inverseTrans * position);
142 return "Acts::CylinderSurface";
148 Vector3 localNormal(cos(phi), sin(phi), 0.);
160 return sfTransform.linear() * pos3D.normalized();
166 Vector3 normalT = normal(gctx, position);
167 double cosAlpha = normalT.dot(direction);
168 return std::fabs(1. / cosAlpha);
172 return (*m_bounds.get());
180 std::vector<Vector3>
vertices =
bounds().createCircles(ctrans, lseg);
181 std::vector<Polyhedron::FaceType> faces;
182 std::vector<Polyhedron::FaceType> triangularMesh;
184 bool fullCylinder =
bounds().coversFullAzimuth();
188 return Polyhedron(vertices, facesMesh.first, facesMesh.second,
false);
194 return transform(gctx).matrix().block<3, 1>(0, 2);
199 const Vector3& direction)
const {
204 const auto& tMatrix = transform.matrix();
205 Vector3 caxis = tMatrix.block<3, 1>(0, 2).transpose();
206 Vector3 ccenter = tMatrix.block<3, 1>(0, 3).transpose();
209 Vector3 pc = position - ccenter;
210 Vector3 pcXcd = pc.cross(caxis);
211 Vector3 ldXcd = direction.cross(caxis);
212 double a = ldXcd.dot(ldXcd);
213 double b = 2. * (ldXcd.dot(pcXcd));
214 double c = pcXcd.dot(pcXcd) - (R *
R);
223 const auto& gctxTransform =
transform(gctx);
226 auto qe = intersectionSolver(gctxTransform, position, direction);
229 if (qe.solutions == 0) {
234 Vector3 solution1 = position + qe.first * direction;
236 ? Intersection3D::Status::onSurface
237 : Intersection3D::Status::reachable;
247 const auto& cBounds =
bounds();
248 if (cBounds.coversFullAzimuth() and
249 bcheck.
type() == BoundaryCheck::Type::eAbsolute) {
252 const auto& tMatrix = gctxTransform.matrix();
254 const Vector3 vecLocal(solution - tMatrix.block<3, 1>(0, 3));
255 double cZ = vecLocal.dot(tMatrix.block<3, 1>(0, 2));
258 return std::abs(cZ) < std::abs(hZ) ?
status
259 : Intersection3D::Status::missed;
261 return (isOnSurface(gctx, solution, direction, bcheck)
263 : Intersection3D::Status::missed);
269 if (qe.solutions == 1) {
270 return {{first, first},
this};
273 Vector3 solution2 = position + qe.second * direction;
275 ? Intersection3D::Status::onSurface
276 : Intersection3D::Status::reachable;
282 return {{first, second},
this};
284 return {{second, first},
this};
292 const auto direction = parameters.segment<3>(
eFreeDir0);
294 const auto pcRowVec = (
position - center(gctx)).transpose().eval();
296 const auto& rotation =
transform(gctx).rotation();
298 const auto& localXAxis = rotation.col(0);
299 const auto& localYAxis = rotation.col(1);
300 const auto& localZAxis = rotation.col(2);
302 const auto localPos = (rotation.transpose() *
position).eval();
303 const auto dx = direction.dot(localXAxis);
304 const auto dy = direction.dot(localYAxis);
305 const auto dz = direction.dot(localZAxis);
307 const auto norm = 1 / (1 -
dz *
dz);
309 const auto& dirRowVec = direction.transpose();
313 const auto localXAxisToPath =
314 (-2 *
norm * (dx * pcRowVec + localPos.x() * dirRowVec)).eval();
315 const auto localYAxisToPath =
316 (-2 *
norm * (
dy * pcRowVec + localPos.y() * dirRowVec)).eval();
317 const auto localZAxisToPath =
318 (-4 *
norm *
norm * (dx * localPos.x() +
dy * localPos.y()) *
dz *
322 const auto [rotToLocalXAxis, rotToLocalYAxis, rotToLocalZAxis] =
328 2 *
norm * (dx * localXAxis.transpose() +
dy * localYAxis.transpose());
330 localXAxisToPath * rotToLocalXAxis + localYAxisToPath * rotToLocalYAxis +
331 localZAxisToPath * rotToLocalZAxis;
345 const double lr =
perp(localPos);
346 const double lphi =
phi(localPos);
347 const double lcphi = std::cos(lphi);
348 const double lsphi = std::sin(lphi);
352 loc3DToLocBound << -R * lsphi / lr, R * lcphi / lr, 0, 0, 0, 1;
354 return loc3DToLocBound;