File indexing completed on 2025-01-18 09:28:02
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "ActsFatras/Digitization/PlanarSurfaceDrift.hpp"
0012 #include "ActsFatras/Digitization/PlanarSurfaceMask.hpp"
0013 #include "ActsFatras/Digitization/Segmentizer.hpp"
0014 #include "ActsFatras/EventData/Hit.hpp"
0015
0016 #include <numeric>
0017
0018 namespace ActsFatras {
0019
0020
0021 class Channelizer {
0022 PlanarSurfaceDrift m_surfaceDrift;
0023 PlanarSurfaceMask m_surfaceMask;
0024 Segmentizer m_segmentizer;
0025
0026 public:
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 Acts::Result<std::vector<Segmentizer::ChannelSegment>> channelize(
0038 const Hit& hit, const Acts::Surface& surface,
0039 const Acts::GeometryContext& gctx, const Acts::Vector3& driftDir,
0040 const Acts::BinUtility& segmentation, double thickness) const {
0041 auto driftedSegment = m_surfaceDrift.toReadout(
0042 gctx, surface, thickness, hit.position(), hit.direction(), driftDir);
0043
0044 auto maskedSegmentRes = m_surfaceMask.apply(surface, driftedSegment);
0045
0046 if (!maskedSegmentRes.ok()) {
0047 return maskedSegmentRes.error();
0048 }
0049
0050
0051 auto segments =
0052 m_segmentizer.segments(gctx, surface, segmentation, *maskedSegmentRes);
0053
0054
0055 const auto path2D = std::accumulate(
0056 segments.begin(), segments.end(), 0.0,
0057 [](double sum, const auto& seg) { return sum + seg.activation; });
0058
0059 for (auto& seg : segments) {
0060 auto r = path2D != 0.0 ? (seg.activation / path2D) : 1.0;
0061 auto segThickness = r * thickness;
0062
0063 seg.activation = std::hypot(segThickness, seg.activation);
0064 }
0065
0066 return segments;
0067 }
0068 };
0069
0070 }