Skip to content

Commit

Permalink
Merge pull request #87 from asalzburger/fix-eta-lines
Browse files Browse the repository at this point in the history
fix: eta lines on both sides of the detector
  • Loading branch information
asalzburger authored Sep 24, 2024
2 parents d2a288f + b1ce34a commit f736dfa
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 2 additions & 0 deletions meta/src/display/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ svg::object eta_lines(
std::array<scalar, 2> end;
if (theta < theta_cut) {
end = {zr_, static_cast<scalar>(zr_ * std::tan(theta))};
} else if (theta > M_PI - theta_cut) {
end = {-zr_, static_cast<scalar>(-zr_ * std::tan(theta))};
} else {
end = {static_cast<scalar>(rr_ * 1 / std::tan(theta)), rr_};
}
Expand Down
39 changes: 36 additions & 3 deletions tests/meta/eta_lines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});

Expand Down Expand Up @@ -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();
}
}

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<scalar> eta_main = {-3, -2, -1, 0, 1, 2, 3};
style::stroke stroke_main;
bool label_main = true;
style::font font_main;

std::vector<scalar> 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();
}

0 comments on commit f736dfa

Please sign in to comment.