File indexing completed on 2025-01-18 09:12:13
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsFatras/Digitization/PlanarSurfaceDrift.hpp"
0010
0011 #include "Acts/Utilities/Helpers.hpp"
0012
0013 #include <cmath>
0014
0015 ActsFatras::PlanarSurfaceDrift::Segment2D
0016 ActsFatras::PlanarSurfaceDrift::toReadout(const Acts::GeometryContext& gctx,
0017 const Acts::Surface& surface,
0018 double thickness,
0019 const Acts::Vector3& pos,
0020 const Acts::Vector3& dir,
0021 const Acts::Vector3& driftDir) const {
0022
0023 const auto& invTransform = surface.transform(gctx).inverse();
0024 Acts::Vector2 pos2Local = (invTransform * pos).segment<2>(0);
0025 Acts::Vector3 seg3Local = invTransform.linear() * dir;
0026
0027 seg3Local *= thickness / std::cos(Acts::VectorHelpers::theta(seg3Local));
0028
0029 Acts::Vector2 entry = pos2Local - 0.5 * seg3Local.segment<2>(0);
0030 Acts::Vector2 exit = pos2Local + 0.5 * seg3Local.segment<2>(0);
0031
0032
0033 if (!driftDir.segment<2>(0).isApprox(Acts::Vector2(0., 0.))) {
0034
0035 auto applyDrift = [&](Acts::Vector2& local) {
0036 auto scaledDriftDir =
0037 driftDir * thickness / std::cos(Acts::VectorHelpers::theta(driftDir));
0038 local += scaledDriftDir.segment<2>(0);
0039 };
0040
0041 if (driftDir.z() > 0.) {
0042 applyDrift(entry);
0043 }
0044 if (driftDir.z() < 0.) {
0045 applyDrift(exit);
0046 }
0047 }
0048
0049 return {entry, exit};
0050 }