Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: eta lines on both sides of the detector #87

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
Loading