Skip to content

Commit

Permalink
change the path for the gdml file
Browse files Browse the repository at this point in the history
changes on the mockupbuilder header file and on the unit test

Update Core/include/Acts/Navigation/MultiWireLayerUpdators.hpp

Co-authored-by: Andreas Stefl <[email protected]>

Change on test mockup builder script

Multi Wire structure with the interface

Changes on the multiwire structure builder

Place the files that create the mockup geometry in another folder

Change the location of the gdml file

An indexed surfaces multilayer navigation

Remove unused variable

fix type conversions for the number of bins

Remove some actsvg includes not needed now

change the path for the gdml file

Multi Wire structure with the interface

Delete MultiWireLayerUpdators.hpp

Delete IndexedSurfacesNavigationTests.cpp

Update CMakeLists.txt

revert some files

trying for Indexed Surfaces Generator

Indexed Surfaces generator update

fix

LayerStructure builder fix

fix

Delete MuonChamber.gdml

revert layer strucutre builder from upstream

cmake file

Update MultiWireStructureBuilder.hpp

Update MultiWireStructureBuilder.hpp

Update MultiWireStructureBuilder.cpp

Place the files that create the mockup geometry in another folder

Change the location of the gdml file

An indexed surfaces multilayer navigation

Remove unused variable

Remove unused variable

fix type conversions for the number of bins

Remove some actsvg includes not needed now

change the path for the gdml file

changes on the mockupbuilder header file and on the unit test

Update Core/include/Acts/Navigation/MultiWireLayerUpdators.hpp

Co-authored-by: Andreas Stefl <[email protected]>

Change on test mockup builder script

Multi Wire structure with the interface

Changes on the multiwire structure builder

Place the files that create the mockup geometry in another folder

Change the location of the gdml file

An indexed surfaces multilayer navigation

Remove unused variable

fix type conversions for the number of bins

Remove some actsvg includes not needed now

change the path for the gdml file

Multi Wire structure with the interface

Delete MultiWireLayerUpdators.hpp

Delete IndexedSurfacesNavigationTests.cpp

Update CMakeLists.txt

revert some files

trying for Indexed Surfaces Generator

Indexed Surfaces generator update

LayerStructure builder fix

fix

Delete MuonChamber.gdml

revert gdml from upstream

revert layer strucutre builder from upstream

fix conflicts and some optimizations

conflicts and format

revert some files

revert some files

new updator

fix

license issue

 fix
  • Loading branch information
dimitra97 authored and Dimitra Amperiadou committed Jul 26, 2023
1 parent f5d9778 commit df37950
Show file tree
Hide file tree
Showing 15 changed files with 8,555 additions and 587 deletions.
142 changes: 142 additions & 0 deletions Core/include/Acts/Navigation/MultiLayerSurfacesUpdator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Detector/DetectorVolume.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationStateFillers.hpp"
#include "Acts/Navigation/NavigationStateUpdators.hpp"
#include "Acts/Utilities/VectorHelpers.hpp"

#include <array>
#include <memory>

namespace Acts {
namespace Experimental {

template <typename grid_t, typename path_generator>
class MultiLayerSurfacesUpdatorImpl : public INavigationDelegate {
public:
/// Broadcast the grid type
using grid_type = grid_t;

/// The grid where the indices are stored
grid_type grid;

/// These are the cast parameters - copied from constructor
std::array<BinningValue, grid_type::DIM> casts{};

/// A transform to be applied to the position
Transform3 transform = Transform3::Identity();

/// The path generator
path_generator pgenerator;

/// @brief Constructor for a grid based surface attacher
///@param igrid the grid that is moved into this attacher
/// @param icasts is the cast values array
/// @param itr a transform applied to the global position
MultiLayerSurfacesUpdatorImpl(
grid_type&& igrid, const std::array<BinningValue, grid_type::DIM>& icasts,
const Transform3& itr = Transform3::Identity())
: grid(std::move(igrid)), casts(icasts), transform(itr) {}

MultiLayerSurfacesUpdatorImpl() = delete;

void update(const GeometryContext& gctx, NavigationState& nState) const {
auto path = pgenerator(nState.position,
nState.direction.y() * grid.binWidth()[1] /
tan(Acts::VectorHelpers::phi(nState.direction)),
nState.direction.y() * grid.binWidth()[1],
grid.numLocalBins()[1]);

std::vector<const Acts::Surface*> surfCandidates = {};

for (const auto& p : path) {
const auto& entry = grid.atPosition(castPosition(p));
const auto extracted =
IndexedSurfacesExtractor::extract(gctx, nState, entry);
surfCandidates.insert(surfCandidates.end(), extracted.begin(),
extracted.end());
}

resolveDuplicates(gctx, surfCandidates);
SurfacesFiller::fill(nState, surfCandidates);
}

/// Cast into a lookup position
///
/// @param position is the position of the update call
std::array<ActsScalar, grid_type::DIM> castPosition(
const Vector3& position) const {
// Transform into local 3D frame
Vector3 tposition = transform * position;

std::array<ActsScalar, grid_type::DIM> casted{};
fillCasts(tposition, casted,
std::make_integer_sequence<std::size_t, grid_type::DIM>{});
return casted;
}

/// Resolve duplicate on surface candidates
///
/// @param gctx The geometry context of the current geometry
/// @param surfaces is the surface candidates to check and resolve for duplicates
void resolveDuplicates(const GeometryContext& gctx,
std::vector<const Acts::Surface*>& surfaces) const {
// sorting the surfaces according to their radial distance
std::sort(surfaces.begin(), surfaces.end(),
[&gctx](const auto& surf1, const auto& surf2) {
if (surf1->center(gctx).x() != surf2->center(gctx).x()) {
return surf1->center(gctx).x() < surf2->center(gctx).x();
}
if (surf1->center(gctx).y() != surf2->center(gctx).y()) {
return surf1->center(gctx).y() < surf2->center(gctx).y();
}
return surf1->center(gctx).z() < surf2->center(gctx).z();
});

// Remove the duplicates
surfaces.erase(std::unique(surfaces.begin(), surfaces.end()),
surfaces.end());
}

private:
/// Unroll the cast loop
/// @param position is the position of the update call
/// @param a is the array to be filled
template <typename Array, std::size_t... idx>
void fillCasts(const Vector3& position, Array& a,
std::index_sequence<idx...> /*indices*/) const {
((a[idx] = VectorHelpers::cast(position, casts[idx])), ...);
}
};

struct PathGridSurfacesGenerator {
std::vector<Vector3> operator()(Vector3 startPosition, ActsScalar stepSizeX,
ActsScalar stepSizeY,
std::size_t numberOfSteps) const {
std::vector<Vector3> pathCoordinates = {};
pathCoordinates.reserve(numberOfSteps);

auto tposition = startPosition;

for (std::size_t i = 0; i < numberOfSteps; i++) {
pathCoordinates.push_back(tposition);
tposition.y() = tposition.y() + stepSizeY;
tposition.x() = tposition.x() + stepSizeX;
}

return pathCoordinates;
}
};

} // namespace Experimental

} // namespace Acts
82 changes: 82 additions & 0 deletions Core/include/Acts/Navigation/MultiLayerUpdator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationStateFillers.hpp"
#include "Acts/Navigation/NavigationStateUpdators.hpp"

#include <array>
#include <memory>

namespace Acts {
namespace Experimental {

template <typename grid_type, typename path_generator>
class MultiLayerSurfacesUpdatorImpl : public INavigationDelegate {
public:
/// The grid where the indices are stored
grid_type grid;

/// These are the cast parameters - copied from constructor
std::array<BinningValue, grid_type::DIM> casts{};

/// The updator, it can be indexed surfaces updator or indexed volumes updator
updator_type updator;

/// @brief Constructor for a grid based surface attacher
///@param igrid the grid that is moved into this attacher
/// @param icasts is the cast values array
/// @param itr a transform applied to the global position
MultiLayerSurfacesUpdatorImpl(
grid_type&& igrid, const std::array<BinningValue, grid_type::DIM>& icasts,
const Transform3& itr = Transform3::Identity())
: grid(std::move(igrid)), casts(icasts), transform(itr) {}

MultiLayerSurfacesUpdatorImpl() = delete;

void update(const GeometryContext& gctx, NavigationState& nState) {
auto path = path_generator(grid, nState);

for (const auto& p : path) {
const auto& entry = grid.atPosition(castPosition(p));
auto extracted = IndexedSurfacesExtractor::extract(gctx, nState, entry);
SurfacesFiller:
fill(nState, extracted);
}
}

/// Cast into a lookup position
///
/// @param position is the position of the update call
std::array<ActsScalar, grid_type::DIM> castPosition(
const Vector3& position) const {
// Transform into local 3D frame
Vector3 tposition = transform * position;

std::array<ActsScalar, grid_type::DIM> casted{};
fillCasts(tposition, casted,
std::make_integer_sequence<std::size_t, grid_type::DIM>{});
return casted;
}

private:
/// Unroll the cast loop
/// @param position is the position of the update call
/// @param a is the array to be filled
template <typename Array, std::size_t... idx>
void fillCasts(const Vector3& position, Array& a,
std::index_sequence<idx...> /*indices*/) const {
((a[idx] = VectorHelpers::cast(position, casts[idx])), ...);
}
};

} // namespace Experimental

} // namespace Acts
Loading

0 comments on commit df37950

Please sign in to comment.