diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0927e36..6fadde8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,12 +16,12 @@ jobs: runs-on: ubuntu-latest container: ghcr.io/acts-project/format10:v11 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check run: .github/check_format.sh . - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v3 if: failure() with: name: changed path: changed - + diff --git a/meta/src/display/geometry.cpp b/meta/src/display/geometry.cpp index 214e571..d70adb4 100644 --- a/meta/src/display/geometry.cpp +++ b/meta/src/display/geometry.cpp @@ -48,6 +48,8 @@ svg::object eta_lines( std::array end; if (theta < theta_cut) { end = {zr_, static_cast(zr_ * std::tan(theta))}; + } else if (theta > M_PI - theta_cut) { + end = {-zr_, static_cast(-zr_ * std::tan(theta))}; } else { end = {static_cast(rr_ * 1 / std::tan(theta)), rr_}; } diff --git a/tests/meta/eta_lines.cpp b/tests/meta/eta_lines.cpp index f7f42e1..d5851f0 100644 --- a/tests/meta/eta_lines.cpp +++ b/tests/meta/eta_lines.cpp @@ -17,7 +17,7 @@ using namespace actsvg; -TEST(meta, eta_lines) { +TEST(meta, eta_lines_positive_side) { auto pg = test::playground({-300, -10}, {300, 120}); @@ -45,7 +45,40 @@ TEST(meta, eta_lines) { etafile.add_object(eta_lines); std::ofstream tstream; - tstream.open("test_display_eta_lines.svg"); + tstream.open("test_display_eta_lines_ps.svg"); tstream << etafile; tstream.close(); -} \ No newline at end of file +} + +TEST(meta, eta_lines_full_detector) { + + auto pg = test::playground({-300, -10}, {300, 120}); + + svg::file etafile; + etafile.add_object(pg); + + scalar r = 120; + scalar z = 300; + + std::vector eta_main = {-3, -2, -1, 0, 1, 2, 3}; + style::stroke stroke_main; + bool label_main = true; + style::font font_main; + + std::vector eta_half = {0.5, 1.5, 2.5}; + style::stroke stroke_half; + stroke_half._dasharray = {2, 2}; + bool label_half = false; + style::font font_half; + + auto eta_lines = display::eta_lines( + "eta_lines_", z, r, + {std::tie(eta_main, stroke_main, label_main, font_main), + std::tie(eta_half, stroke_half, label_half, font_half)}); + + etafile.add_object(eta_lines); + std::ofstream tstream; + tstream.open("test_display_eta_lines_fd.svg"); + tstream << etafile; + tstream.close(); +}