From 2ac6ef3fd46134729886d4de4e810e158339687f Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Tue, 24 Sep 2024 09:52:50 +0200 Subject: [PATCH 1/4] fix eta lines on both sides of the detector --- meta/src/display/geometry.cpp | 2 ++ tests/meta/eta_lines.cpp | 39 ++++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) 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..daed9e8 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(); +} From 33950444afa8eca430477a1a7d758abf89795927 Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Tue, 24 Sep 2024 09:56:18 +0200 Subject: [PATCH 2/4] increase to v2 artifact --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0927e36..4ec707f 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -19,9 +19,9 @@ jobs: - uses: actions/checkout@v2 - name: Check run: .github/check_format.sh . - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v2 if: failure() with: name: changed path: changed - + From 0b89cb538ace1a88072b12c2ea36d155613d9785 Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Tue, 24 Sep 2024 09:57:19 +0200 Subject: [PATCH 3/4] increase to v3 artifact --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4ec707f..6fadde8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,10 +16,10 @@ 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@v2 + - uses: actions/upload-artifact@v3 if: failure() with: name: changed From b1ce34ae7007a065cc3845ee48e60755c8bf2d6e Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Tue, 24 Sep 2024 09:59:45 +0200 Subject: [PATCH 4/4] format check --- tests/meta/eta_lines.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meta/eta_lines.cpp b/tests/meta/eta_lines.cpp index daed9e8..d5851f0 100644 --- a/tests/meta/eta_lines.cpp +++ b/tests/meta/eta_lines.cpp @@ -60,7 +60,7 @@ TEST(meta, eta_lines_full_detector) { scalar r = 120; scalar z = 300; - std::vector eta_main = { -3, -2, -1, 0, 1, 2, 3}; + std::vector eta_main = {-3, -2, -1, 0, 1, 2, 3}; style::stroke stroke_main; bool label_main = true; style::font font_main;