Skip to content

Commit

Permalink
Merge branch 'main' into refactor/dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzburger authored Mar 21, 2022
2 parents 5604805 + 4c9374c commit 7804fa9
Show file tree
Hide file tree
Showing 44 changed files with 678 additions and 169 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
-DACTS_BUILD_EVERYTHING=ON
-DACTS_BUILD_EXAMPLES_PYTHON_BINDINGS=ON
-DACTS_LOG_FAILURE_THRESHOLD=WARNING
-DACTS_FORCE_ASSERTIONS=ON
- name: Build
run: ${SETUP} && cmake --build build --
- name: Unit tests
Expand Down Expand Up @@ -129,6 +130,7 @@ jobs:
-DACTS_BUILD_UNITTESTS=ON
-DACTS_BUILD_INTEGRATIONTESTS=ON
-DACTS_LOG_FAILURE_THRESHOLD=WARNING
-DACTS_FORCE_ASSERTIONS=ON
-DACTS_USE_SYSTEM_BOOST=OFF
-DACTS_USE_SYSTEM_EIGEN3=OFF
-DACTS_BUILD_PLUGIN_JSON=ON
Expand All @@ -152,6 +154,7 @@ jobs:
-DCMAKE_CXX_FLAGS=-Werror
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
-DACTS_LOG_FAILURE_THRESHOLD=WARNING
-DACTS_FORCE_ASSERTIONS=ON
-DACTS_USE_SYSTEM_BOOST=OFF
-DACTS_USE_SYSTEM_EIGEN3=OFF
-DACTS_BUILD_EXAMPLES=ON
Expand All @@ -178,7 +181,7 @@ jobs:
&& CI/check_boost_eigen_versions.sh ./build-downstream-nodeps/bin/ShowActsVersion

macos:
runs-on: macos-10.15
runs-on: macos-11
env:
INSTALL_DIR: ${{ github.workspace }}/install
steps:
Expand All @@ -188,7 +191,7 @@ jobs:
brew install cmake eigen ninja
&& sudo mkdir /usr/local/acts
&& sudo chown $USER /usr/local/acts
&& wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.gz https://acts.web.cern.ch/ci/macOS/deps.43e0201.tar.gz
&& wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.gz https://acts.web.cern.ch/ci/macOS/deps.494c52d.tar.gz
&& tar -xf deps.tar.gz -C /usr/local/acts
- name: Configure
# setting CMAKE_CXX_STANDARD=17 is a workaround for a bug in the
Expand All @@ -204,6 +207,7 @@ jobs:
-DCMAKE_PREFIX_PATH=/usr/local/acts
-DACTS_BUILD_EVERYTHING=ON
-DACTS_LOG_FAILURE_THRESHOLD=WARNING
-DACTS_FORCE_ASSERTIONS=ON
- name: Build
run: cmake --build build --
- name: Unit tests
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ option(ACTS_BUILD_EVERYTHING "Build with most options enabled (except HepMC3 and
# core related options
set(ACTS_PARAMETER_DEFINITIONS_HEADER "" CACHE FILEPATH "Use a different (track) parameter definitions header")
set(ACTS_LOG_FAILURE_THRESHOLD "" CACHE STRING "Log level above which an exception should be automatically thrown")
option(ACTS_FORCE_ASSERTIONS "Force assertions regardless of build type" OFF)
# plugins related options
option(ACTS_BUILD_PLUGIN_AUTODIFF "Build the autodiff plugin" OFF)
option(ACTS_USE_SYSTEM_AUTODIFF "Use autodiff provided by the system instead of the bundled version" OFF)
Expand Down Expand Up @@ -127,6 +128,12 @@ include(ActsComponentsHelpers) # handle components via add_..._if commands
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

# This needs to happen before we set up any targets
if(ACTS_FORCE_ASSERTIONS)
message(STATUS "Injecting headers to force assertions. This can have side-effects, USE WITH CAUTION!")
include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/cmake/assert_include)
endif()

# minimal dependency versions. they are defined here in a single place so
# they can be easily upgraded, although they might not be used if the
# dependency is included via `add_subdirectory(...)`.
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Definitions/Units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ constexpr double g = 1.0 / 1.782662e-24;
constexpr double kg = 1.0 / 1.782662e-27;
// Charge, native unit e (elementary charge)
constexpr double e = 1.0;
constexpr double C = 1.602176634e19;
constexpr double C = 6.2415091e18;
// Magnetic field, native unit GeV/(e*mm)
constexpr double T = 0.000299792458; // equivalent to c in appropriate SI units
constexpr double Gauss = 1e-4 * T;
Expand Down
15 changes: 9 additions & 6 deletions Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <functional>
#include <iosfwd>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
Expand All @@ -28,7 +29,7 @@ class RectangleBounds;
class ISurfaceMaterial;
class IVolumeMaterial;
class DetectorElementBase;
class PlaneSurface;
class Surface;
class Layer;

/// @brief This class builds a box detector with a configurable amount of
Expand Down Expand Up @@ -59,18 +60,20 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder {
};

/// @brief This struct stores the data for the construction of a PlaneLayer
/// that has a single PlaneSurface encapsulated
struct LayerConfig {
// Configuration of the surface
SurfaceConfig surfaceCfg;
std::vector<SurfaceConfig> surfaceCfg;
// Encapsulated surface
std::shared_ptr<const PlaneSurface> surface = nullptr;
std::vector<std::shared_ptr<const Surface>> surfaces;
// Boolean flag if layer is active
bool active = false;
// Bins in Y direction
size_t binsY = 1;
// Bins in Z direction
size_t binsZ = 1;
// Envelope in X (along layer normal)
std::pair<double, double> envelopeX{0, 0};
std::optional<RotationMatrix3> rotation{std::nullopt};
};

/// @brief This struct stores the data for the construction of a cuboid
Expand Down Expand Up @@ -124,8 +127,8 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder {
/// @param [in] cfg Configuration of the surface
///
/// @return Pointer to the created surface
std::shared_ptr<const PlaneSurface> buildSurface(
const GeometryContext& gctx, const SurfaceConfig& cfg) const;
std::shared_ptr<const Surface> buildSurface(const GeometryContext& gctx,
const SurfaceConfig& cfg) const;

/// @brief This function creates a layer with a surface encaspulated with a
/// given configuration. The surface gets a detector element attached if the
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Seeding/BinnedSPGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ template <typename external_spacepoint_t>
class NeighborhoodIterator {
public:
using sp_it_t = typename std::vector<std::unique_ptr<
const InternalSpacePoint<external_spacepoint_t>>>::const_iterator;
InternalSpacePoint<external_spacepoint_t>>>::const_iterator;

NeighborhoodIterator() = delete;

Expand Down Expand Up @@ -94,7 +94,7 @@ class NeighborhoodIterator {
}
}

const InternalSpacePoint<external_spacepoint_t>* operator*() {
InternalSpacePoint<external_spacepoint_t>* operator*() {
return (*m_curIt).get();
}

Expand Down
12 changes: 5 additions & 7 deletions Core/include/Acts/Seeding/BinnedSPGroup.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Acts::BinnedSPGroup<external_spacepoint_t>::BinnedSPGroup(
// create number of bins equal to number of millimeters rMax
// (worst case minR: configured minR + 1mm)
size_t numRBins = (config.rMax + config.beamPos.norm());
std::vector<std::vector<
std::unique_ptr<const InternalSpacePoint<external_spacepoint_t>>>>
std::vector<
std::vector<std::unique_ptr<InternalSpacePoint<external_spacepoint_t>>>>
rBins(numRBins);
for (spacepoint_iterator_t it = spBegin; it != spEnd; it++) {
if (*it == nullptr) {
Expand All @@ -58,9 +58,8 @@ Acts::BinnedSPGroup<external_spacepoint_t>::BinnedSPGroup(
continue;
}

auto isp =
std::make_unique<const InternalSpacePoint<external_spacepoint_t>>(
sp, spPosition, config.beamPos, variance);
auto isp = std::make_unique<InternalSpacePoint<external_spacepoint_t>>(
sp, spPosition, config.beamPos, variance);
// calculate r-Bin index and protect against overflow (underflow not
// possible)
size_t rIndex = isp->radius();
Expand All @@ -75,8 +74,7 @@ Acts::BinnedSPGroup<external_spacepoint_t>::BinnedSPGroup(
for (auto& rbin : rBins) {
for (auto& isp : rbin) {
Acts::Vector2 spLocation(isp->phi(), isp->z());
std::vector<
std::unique_ptr<const InternalSpacePoint<external_spacepoint_t>>>&
std::vector<std::unique_ptr<InternalSpacePoint<external_spacepoint_t>>>&
bin = grid->atPosition(spLocation);
bin.push_back(std::move(isp));
}
Expand Down
13 changes: 6 additions & 7 deletions Core/include/Acts/Seeding/InternalSeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class InternalSeed {
/////////////////////////////////////////////////////////////////////////////////

public:
InternalSeed(const InternalSpacePoint<SpacePoint>& s0,
const InternalSpacePoint<SpacePoint>& s1,
const InternalSpacePoint<SpacePoint>& s2, float z);
InternalSeed(InternalSpacePoint<SpacePoint>& s0,
InternalSpacePoint<SpacePoint>& s1,
InternalSpacePoint<SpacePoint>& s2, float z);
InternalSeed& operator=(const InternalSeed& seed);

const std::array<const InternalSpacePoint<SpacePoint>*, 3> sp;
const std::array<InternalSpacePoint<SpacePoint>*, 3> sp;
float z() const { return m_z; }

protected:
Expand All @@ -49,9 +49,8 @@ inline InternalSeed<SpacePoint>& InternalSeed<SpacePoint>::operator=(

template <typename SpacePoint>
inline InternalSeed<SpacePoint>::InternalSeed(
const InternalSpacePoint<SpacePoint>& s0,
const InternalSpacePoint<SpacePoint>& s1,
const InternalSpacePoint<SpacePoint>& s2, float z)
InternalSpacePoint<SpacePoint>& s0, InternalSpacePoint<SpacePoint>& s1,
InternalSpacePoint<SpacePoint>& s2, float z)
: sp({&s0, &s1, &s2}) {
m_z = z;
}
Expand Down
40 changes: 24 additions & 16 deletions Core/include/Acts/Seeding/InternalSpacePoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,32 @@ class InternalSpacePoint {
float phi() const { return atan2f(m_y, m_x); }
const float& varianceR() const { return m_varianceR; }
const float& varianceZ() const { return m_varianceZ; }
const float& quality() const { return m_quality; }
const float& cotTheta() const { return m_cotTheta; }
void setCotTheta(float cotTheta) { m_cotTheta = cotTheta; }
void setQuality(float quality) {
if (quality >= m_quality) {
m_quality = quality;
}
}
const SpacePoint& sp() const { return m_sp; }

protected:
float m_x; // x-coordinate in beam system coordinates
float m_y; // y-coordinate in beam system coordinates
float m_z; // z-coordinate in beam system coordinetes
float m_r; // radius in beam system coordinates
float m_varianceR; //
float m_varianceZ; //
const SpacePoint& m_sp; // external space point
float m_x; // x-coordinate in beam system coordinates
float m_y; // y-coordinate in beam system coordinates
float m_z; // z-coordinate in beam system coordinetes
float m_r; // radius in beam system coordinates
float m_varianceR; //
float m_varianceZ; //
float m_cotTheta = std::numeric_limits<
double>::quiet_NaN(); // 1/tanTheta estimated from central+this space
// point. Its evaluation requires that the space
// point is a candidate for triplet search.
float m_quality = -std::numeric_limits<
double>::infinity(); // Quality score of the seed the space point is used
// for. Quality can be changed if the space point is
// used for a better quality seed.
const SpacePoint& m_sp; // external space point
};

/////////////////////////////////////////////////////////////////////////////////
Expand All @@ -75,14 +91,6 @@ inline InternalSpacePoint<SpacePoint>::InternalSpacePoint(

template <typename SpacePoint>
inline InternalSpacePoint<SpacePoint>::InternalSpacePoint(
const InternalSpacePoint<SpacePoint>& sp)
: m_sp(sp.sp()) {
m_x = sp.m_x;
m_y = sp.m_y;
m_z = sp.m_z;
m_r = sp.m_r;
m_varianceR = sp.m_varianceR;
m_varianceZ = sp.m_varianceZ;
}
const InternalSpacePoint<SpacePoint>& sp) = default;

} // end of namespace Acts
6 changes: 3 additions & 3 deletions Core/include/Acts/Seeding/SeedFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class SeedFilter {
/// @param zOrigin on the z axis as defined by bottom and middle space point
/// @param outIt Output iterator for the seeds
virtual void filterSeeds_2SpFixed(
const InternalSpacePoint<external_spacepoint_t>& bottomSP,
const InternalSpacePoint<external_spacepoint_t>& middleSP,
std::vector<const InternalSpacePoint<external_spacepoint_t>*>& topSpVec,
InternalSpacePoint<external_spacepoint_t>& bottomSP,
InternalSpacePoint<external_spacepoint_t>& middleSP,
std::vector<InternalSpacePoint<external_spacepoint_t>*>& topSpVec,
std::vector<float>& invHelixDiameterVec,
std::vector<float>& impactParametersVec, float zOrigin,
std::back_insert_iterator<std::vector<std::pair<
Expand Down
12 changes: 9 additions & 3 deletions Core/include/Acts/Seeding/SeedFilter.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ SeedFilter<external_spacepoint_t>::SeedFilter(
// return vector must contain weight of each seed
template <typename external_spacepoint_t>
void SeedFilter<external_spacepoint_t>::filterSeeds_2SpFixed(
const InternalSpacePoint<external_spacepoint_t>& bottomSP,
const InternalSpacePoint<external_spacepoint_t>& middleSP,
std::vector<const InternalSpacePoint<external_spacepoint_t>*>& topSpVec,
InternalSpacePoint<external_spacepoint_t>& bottomSP,
InternalSpacePoint<external_spacepoint_t>& middleSP,
std::vector<InternalSpacePoint<external_spacepoint_t>*>& topSpVec,
std::vector<float>& invHelixDiameterVec,
std::vector<float>& impactParametersVec, float zOrigin,
std::back_insert_iterator<std::vector<std::pair<
Expand Down Expand Up @@ -141,6 +141,12 @@ void SeedFilter<external_spacepoint_t>::filterSeeds_1SpFixed(
// ordering by weight by filterSeeds_2SpFixed means these are the lowest
// weight seeds
for (; it < itBegin + maxSeeds; ++it) {
float bestSeedQuality = (*it).first;

(*it).second->sp[0]->setQuality(bestSeedQuality);
(*it).second->sp[1]->setQuality(bestSeedQuality);
(*it).second->sp[2]->setQuality(bestSeedQuality);

outIt = Seed<external_spacepoint_t>{
(*it).second->sp[0]->sp(), (*it).second->sp[1]->sp(),
(*it).second->sp[2]->sp(), (*it).second->z()};
Expand Down
10 changes: 5 additions & 5 deletions Core/include/Acts/Seeding/SeedFinderUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ struct LinCircle {
/// @param[in] spM The middle spacepoint to use.
/// @param[in] bottom Should be true if sp is a bottom SP.
template <typename external_spacepoint_t>
LinCircle transformCoordinates(
const InternalSpacePoint<external_spacepoint_t>& sp,
const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom);
LinCircle transformCoordinates(InternalSpacePoint<external_spacepoint_t>& sp,
InternalSpacePoint<external_spacepoint_t>& spM,
bool bottom);

/// @brief Transform a vector of spacepoints to u-v space circles with respect
/// to a given middle spacepoint.
Expand All @@ -48,8 +48,8 @@ LinCircle transformCoordinates(
/// @param[out] linCircleVec The output vector to write to.
template <typename external_spacepoint_t>
void transformCoordinates(
const std::vector<const InternalSpacePoint<external_spacepoint_t>*>& vec,
const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom,
const std::vector<InternalSpacePoint<external_spacepoint_t>*>& vec,
InternalSpacePoint<external_spacepoint_t>& spM, bool bottom,
bool enableCutsForSortedSP, std::vector<LinCircle>& linCircleVec);
} // namespace Acts

Expand Down
11 changes: 6 additions & 5 deletions Core/include/Acts/Seeding/SeedFinderUtils.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

namespace Acts {
template <typename external_spacepoint_t>
LinCircle transformCoordinates(
const InternalSpacePoint<external_spacepoint_t>& sp,
const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom) {
LinCircle transformCoordinates(InternalSpacePoint<external_spacepoint_t>& sp,
InternalSpacePoint<external_spacepoint_t>& spM,
bool bottom) {
// The computation inside this function is exactly identical to that in the
// vectorized version of this function, except that it operates on a single
// spacepoint. Please see the other version of this function for more
Expand Down Expand Up @@ -46,8 +46,8 @@ LinCircle transformCoordinates(

template <typename external_spacepoint_t>
void transformCoordinates(
const std::vector<const InternalSpacePoint<external_spacepoint_t>*>& vec,
const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom,
const std::vector<InternalSpacePoint<external_spacepoint_t>*>& vec,
InternalSpacePoint<external_spacepoint_t>& spM, bool bottom,
bool enableCutsForSortedSP, std::vector<LinCircle>& linCircleVec) {
float xM = spM.x();
float yM = spM.y();
Expand Down Expand Up @@ -93,6 +93,7 @@ void transformCoordinates(
(cot_theta * cot_theta) * (varianceRM + sp->varianceR())) *
iDeltaR2;
linCircleVec.push_back(l);
sp->setCotTheta(cot_theta);
}
// sort the SP in order of cotTheta
if (enableCutsForSortedSP) {
Expand Down
7 changes: 3 additions & 4 deletions Core/include/Acts/Seeding/Seedfinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ class Seedfinder {
public:
struct State {
// bottom space point
std::vector<const InternalSpacePoint<external_spacepoint_t>*>
compatBottomSP;
std::vector<const InternalSpacePoint<external_spacepoint_t>*> compatTopSP;
std::vector<InternalSpacePoint<external_spacepoint_t>*> compatBottomSP;
std::vector<InternalSpacePoint<external_spacepoint_t>*> compatTopSP;
// contains parameters required to calculate circle with linear equation
// ...for bottom-middle
std::vector<LinCircle> linCircleBottom;
// ...for middle-top
std::vector<LinCircle> linCircleTop;

// create vectors here to avoid reallocation in each loop
std::vector<const InternalSpacePoint<external_spacepoint_t>*> topSpVec;
std::vector<InternalSpacePoint<external_spacepoint_t>*> topSpVec;
std::vector<float> curvatures;
std::vector<float> impactParameters;
std::vector<float> etaVec;
Expand Down
Loading

0 comments on commit 7804fa9

Please sign in to comment.