40 if (candidate and candidate.
pathLength() > 0 and
42 intersections.push_back(candidate);
58 std::vector<Acts::Intersection2D>& intersections,
60 std::sort(intersections.begin(), intersections.end(),
62 if (intersections.size() >= 2) {
64 intersections[0].position(), intersections[1].position()};
65 }
else if (intersections.size() == 1) {
66 return (not firstInside
71 segment[0], intersections[0].position()});
73 return ActsFatras::DigitizationError::MaskingError;
81 auto surfaceType = surface.
type();
99 bool startInside = surface.
bounds().
inside(localStart,
true);
100 bool endInside = surface.
bounds().
inside(localEnd,
true);
103 if (startInside and endInside) {
114 return DigitizationError::UndefinedSurface;
132 bool startInside = surface.
bounds().
inside(sPolar,
true);
136 if (startInside and endInside) {
149 return annulusMask(*aBounds, segment, startInside);
152 return DigitizationError::UndefinedSurface;
158 bool firstInside)
const {
159 std::vector<Acts::Intersection2D> intersections;
162 double sLength = sVector.norm();
164 for (
size_t iv = 0; iv < vertices.size(); ++iv) {
167 (iv + 1) < vertices.size() ? vertices[iv + 1] : vertices[0];
170 intersector.intersectSegment(s0, s1, segment[0], sDir,
true), sLength);
172 return maskAndReturn(intersections, segment, firstInside);
179 bool firstInside)
const {
185 std::array<double, 2> radii = {rMin, rMax};
186 std::array<double, 2> phii = {aPhi - hPhi, aPhi + hPhi};
188 std::vector<Acts::Intersection2D> intersections;
191 double sLength = sVector.norm();
199 auto intersectPhiLine = [&](
double phi) ->
void {
204 intersector.intersectSegment(s0, s1, segment[0], sDir,
true), sLength);
208 auto intersectCircle = [&](
double r) ->
void {
209 auto cIntersections = intersector.intersectCircle(
r, segment[0], sDir);
210 for (
const auto& intersection : cIntersections) {
217 if (sPhi < phii[0] or ePhi < phii[0]) {
218 intersectPhiLine(phii[0]);
220 if (sPhi > phii[1] or ePhi > phii[1]) {
221 intersectPhiLine(phii[1]);
224 if (sR < radii[0] or eR < radii[0]) {
226 intersector.intersectCircleSegment(
227 radii[0], phii[0], phii[1], segment[0], sDir),
230 if (sR > radii[1] or eR > radii[1]) {
232 intersector.intersectCircleSegment(
233 radii[1], phii[0], phii[1], segment[0], sDir),
239 if (sR < radii[0] or eR < radii[0]) {
240 intersectCircle(radii[0]);
242 if (sR > radii[1] or eR > radii[1]) {
243 intersectCircle(radii[1]);
246 return maskAndReturn(intersections, segment, firstInside);
252 bool firstInside)
const {
256 std::array<std::array<unsigned int, 2>, 2> edgeCombos = {
257 std::array<unsigned int, 2>{0, 3}, std::array<unsigned int, 2>{1, 2}};
259 std::vector<Acts::Intersection2D> intersections;
262 double sLength = sVector.norm();
264 for (
const auto& ec : edgeCombos) {
268 segment[0], sDir,
true),
273 std::array<unsigned int, 4> phii = {1, 0, 2, 3};
274 for (
unsigned int iarc = 0; iarc < 2; ++iarc) {
276 aBounds.
get(static_cast<Acts::AnnulusBounds::BoundValues>(iarc)),
279 segment[0] - moduleOrigin, sDir);
283 intersection.
position() + moduleOrigin,
288 return maskAndReturn(intersections, segment, firstInside);