Skip to content

Commit

Permalink
remove svg code
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitra97 committed Sep 5, 2023
1 parent fba257f commit c85ff3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 71 deletions.
1 change: 0 additions & 1 deletion Tests/UnitTests/Core/Navigation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set(unittest_extra_libraries ActsPluginActSVG)
add_unittest(DetectorVolumeUpdators DetectorVolumeUpdatorsTests.cpp)
add_unittest(DetectorVolumeFinders DetectorVolumeFindersTests.cpp)
add_unittest(NavigationState NavigationStateTests.cpp)
Expand Down
72 changes: 2 additions & 70 deletions Tests/UnitTests/Core/Navigation/MultiWireNavigationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
#include "Acts/Navigation/NavigationStateFillers.hpp"
#include "Acts/Navigation/NavigationStateUpdators.hpp"
#include "Acts/Navigation/SurfaceCandidatesUpdators.hpp"
#include "Acts/Plugins/ActSVG/GridSvgConverter.hpp"
#include "Acts/Plugins/ActSVG/SurfaceSvgConverter.hpp"
#include "Acts/Surfaces/RectangleBounds.hpp"
#include "Acts/Surfaces/StrawSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/VectorHelpers.hpp"
#include "Acts/Utilities/detail/Grid.hpp"
#include "actsvg/display/grids.hpp"

#include <fstream>
#include <memory>
Expand All @@ -45,9 +42,6 @@ BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) {

std::vector<std::shared_ptr<Acts::Surface>> strawSurfaces = {};

// svg file to save visualized objects
actsvg::svg::file gFile;

// Set the number of surfaces along each dimension of the multi wire structure
// aligned along z axis
std::size_t nSurfacesY = 4;
Expand All @@ -62,22 +56,16 @@ BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) {

Vector3 pos = ipos;

Svg::SurfaceConverter::Options sOptions;

// Generate the surfaces
for (std::size_t i = 0; i < nSurfacesY; i++) {
for (std::size_t j = 0; j < nSurfacesX; j++) {
auto surface = Surface::makeShared<StrawSurface>(
Transform3(Translation3(pos)), radius, halfZ);

strawSurfaces.push_back(surface);

pos.x() = ipos.x() + 2 * j * radius;
pos.y() = ipos.y() + 2 * i * radius;

auto svStraw =
Svg::SurfaceConverter::convert(tContext, *surface, sOptions);
auto xyObject = Svg::View::xy(
svStraw, "svg_surface_" + std::to_string(i) + std::to_string(j));
gFile.add_object(xyObject);
}
}

Expand Down Expand Up @@ -107,62 +95,6 @@ BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) {

// check the surface candidates after update (12 surfaces + 6 portals)
BOOST_CHECK(nState.surfaceCandidates.size() == 18u);

// Construct the grid for visualization with the track and the highlighted
// bins
Axis<AxisType::Equidistant, AxisBoundaryType::Bound> axisX(
-vBounds[0], vBounds[0], nSurfacesX);
Axis<AxisType::Equidistant, AxisBoundaryType::Bound> axisY(
-vBounds[1], vBounds[1], nSurfacesY);
Grid<std::tuple<GlobalBin, LocalBin>, decltype(axisX), decltype(axisY)>
gridXY({axisX, axisY});

Svg::GridConverter::Options cOptions;
auto pGrid = Svg::GridConverter::convert(gridXY, {binX, binY}, cOptions);
auto oGrid = actsvg::display::grid("MultiWireGrid", pGrid);
gFile.add_object(oGrid);

actsvg::style::fill fill_style{{{200, 150, 50}}};
actsvg::style::stroke stroke_style{{{200, 150, 50}}};
actsvg::style::stroke stroke_black = actsvg::style::stroke();

Acts::Svg::Style candidates_style;
candidates_style.fillColor = {200, 100, 100};

sOptions.style = candidates_style;

for (const auto& sfc : nState.surfaceCandidates) {
if (!sfc.portal) {
auto activatedBin = actsvg::draw::rectangle(
"bin",
{static_cast<float>(sfc.surface->center(tContext).x()),
static_cast<float>(sfc.surface->center(tContext).y())},
0.5 * axisX.getBinWidth(1), 0.5 * axisY.getBinWidth(1), fill_style,
stroke_black);
auto pcSurf =
Svg::SurfaceConverter::convert(tContext, *sfc.surface, sOptions);

gFile.add_object(activatedBin);
gFile.add_object(Svg::View::xy(pcSurf, "svg_surface_candidate"));
}
}

auto dy = axisY.getMax() - nState.position.y();
auto tanphi = tan(Acts::VectorHelpers::phi(nState.direction));
auto dx = dy / tanphi;

actsvg::point2 start = {static_cast<float>(nState.position.x()),
static_cast<float>(nState.position.y())};
actsvg::point2 end = {static_cast<float>(nState.position.x() + dx),
static_cast<float>(nState.position.y() + dy)};

auto track_line = actsvg::draw::line("track_line", start, end);
gFile.add_object(track_line);

std::ofstream gFile_ofstream;
gFile_ofstream.open("grid.svg");
gFile_ofstream << gFile;
gFile_ofstream.close();
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit c85ff3e

Please sign in to comment.