Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into releases
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Oct 17, 2024
2 parents 117feaa + 057d33d commit 3eaeed7
Show file tree
Hide file tree
Showing 216 changed files with 4,660 additions and 2,110 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,10 @@ repos:
language: system
entry: docs/parse_cmake_options.py --write docs/getting_started.md
files: ^CMakeLists.txt$

- repo: local
hooks:
- id: leftover_conflict_markers
name: Leftover conflict markers
language: system
entry: git diff --staged --check
30 changes: 28 additions & 2 deletions CI/physmon/phys_perf_mon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ shopt -s extglob


mode=${1:-all}
if ! [[ $mode = @(all|kf|gsf|gx2f|fullchains|simulation) ]]; then
echo "Usage: $0 <all|kf|gsf|gx2f|fullchains|simulation> (outdir)"
if ! [[ $mode = @(all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation) ]]; then
echo "Usage: $0 <all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation> (outdir)"
exit 1
fi

Expand Down Expand Up @@ -152,6 +152,12 @@ fi
if [[ "$mode" == "all" || "$mode" == "gx2f" ]]; then
run_physmon_gen "Truth Tracking GX2F" "trackfitting_gx2f"
fi
if [[ "$mode" == "all" || "$mode" == "refit_kf" ]]; then
run_physmon_gen "Truth Tracking KF refit" "trackrefitting_kf"
fi
if [[ "$mode" == "all" || "$mode" == "refit_gsf" ]]; then
run_physmon_gen "Truth Tracking GSF refit" "trackrefitting_gsf"
fi
if [[ "$mode" == "all" || "$mode" == "fullchains" ]]; then
run_physmon_gen "CKF single muon" "trackfinding_1muon"
run_physmon_gen "CKF muon 50" "trackfinding_4muon_50vertices"
Expand Down Expand Up @@ -411,6 +417,26 @@ if [[ "$mode" == "all" || "$mode" == "gx2f" ]]; then
--config CI/physmon/config/trackfitting_gx2f.yml
fi

if [[ "$mode" == "all" || "$mode" == "kf_refit" ]]; then
run_histcmp \
$outdir/data/trackrefitting_kf/performance_trackrefitting.root \
$refdir/trackrefitting_kf/performance_trackrefitting.root \
"Truth tracking (KF refit)" \
trackrefitting_kf/performance_trackrefitting.html \
trackrefitting_kf/performance_trackrefitting_plots \
--config CI/physmon/config/trackfitting_kf.yml
fi

if [[ "$mode" == "all" || "$mode" == "gsf_refit" ]]; then
run_histcmp \
$outdir/data/trackrefitting_gsf/performance_trackrefitting.root \
$refdir/trackrefitting_gsf/performance_trackrefitting.root \
"Truth tracking (GSF refit)" \
trackrefitting_gsf/performance_trackrefitting.html \
trackrefitting_gsf/performance_trackrefitting_plots \
--config CI/physmon/config/trackfitting_gsf.yml
fi

if [[ "$mode" == "all" || "$mode" == "fullchains" ]]; then
trackfinding "trackfinding | single muon | truth smeared seeding" trackfinding_1muon/truth_smeared
trackfinding "trackfinding | single muon | truth estimated seeding" trackfinding_1muon/truth_estimated
Expand Down
Binary file modified CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions CI/physmon/workflows/physmon_trackrefitting_gsf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

import tempfile
from pathlib import Path
import shutil

import acts
from truth_tracking_gsf_refitting import runRefittingGsf

from physmon_common import makeSetup

setup = makeSetup()

with tempfile.TemporaryDirectory() as temp:
s = acts.examples.Sequencer(
events=10000,
numThreads=-1,
logLevel=acts.logging.INFO,
)

tp = Path(temp)
runRefittingGsf(
trackingGeometry=setup.trackingGeometry,
field=setup.field,
digiConfigFile=setup.digiConfig,
outputDir=tp,
s=s,
)

s.run()

perf_file = tp / "performance_gsf_refit.root"
assert perf_file.exists(), "Performance file not found"
shutil.copy(perf_file, setup.outdir / "performance_trackrefitting.root")
34 changes: 34 additions & 0 deletions CI/physmon/workflows/physmon_trackrefitting_kf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

import tempfile
from pathlib import Path
import shutil

import acts
from truth_tracking_kalman_refitting import runRefittingKf

from physmon_common import makeSetup

setup = makeSetup()

with tempfile.TemporaryDirectory() as temp:
s = acts.examples.Sequencer(
events=10000,
numThreads=-1,
logLevel=acts.logging.INFO,
)

tp = Path(temp)
runRefittingKf(
trackingGeometry=setup.trackingGeometry,
field=setup.field,
digiConfigFile=setup.digiConfig,
outputDir=tp,
s=s,
)

s.run()

perf_file = tp / "performance_kf_refit.root"
assert perf_file.exists(), "Performance file not found"
shutil.copy(perf_file, setup.outdir / "performance_trackrefitting.root")
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ option(ACTS_FORCE_ASSERTIONS "Force assertions regardless of build type" OFF)
option(ACTS_USE_SYSTEM_LIBS "Use system libraries by default" OFF)
# plugins related options
option(ACTS_USE_SYSTEM_ACTSVG "Use the ActSVG system library" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
Expand Down Expand Up @@ -229,7 +228,6 @@ set(_acts_actsvg_version 0.4.50)
set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version 0.7)
set(_acts_geomodel_version 6.3.0)
set(_acts_eigen3_version 3.4.0)
set(_acts_podio_version 1.0.1) # will try this first
set(_acts_podio_fallback_version 0.16) # if not found, will try this one
Expand Down Expand Up @@ -374,8 +372,24 @@ if(ACTS_BUILD_PLUGIN_JSON)
endif()
endif()
if(ACTS_BUILD_PLUGIN_GEOMODEL)
find_package(GeoModelCore ${_acts_geomodel_version} REQUIRED CONFIG)
find_package(GeoModelIO ${_acts_geomodel_version} REQUIRED CONFIG)
find_package(GeoModelCore CONFIG)
if(NOT GeoModelCore_FOUND)
message(
FATAL_ERROR
"GeoModel not found. Please install GeoModel or set ACTS_BUILD_PLUGIN_GEOMODEL to OFF."
)
endif()

set(_gm_ver_min 6.3.0)

if(GeoModelCore_VERSION VERSION_LESS _gm_ver_min)
message(
FATAL_ERROR
"GeoModel version ${GeoModelCore_VERSION} is insufficient. Please install GeoModel version ${_gm_ver_min} or newer."
)
endif()
# find other GeoModel components of EXACT same version
find_package(GeoModelIO ${GeoModelCore_VERSION} REQUIRED EXACT CONFIG)
endif()
if(ACTS_BUILD_PLUGIN_TGEO)
find_package(
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"inherits": "common",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "-Werror",
"CMAKE_COMPILE_WARNING_AS_ERROR": "ON",
"ACTS_FORCE_ASSERTIONS": "ON",
"ACTS_ENABLE_LOG_FAILURE_THRESHOLD": "ON",
"ACTS_BUILD_BENCHMARKS": "ON",
Expand Down
1 change: 1 addition & 0 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ add_subdirectory(src/MagneticField)
add_subdirectory(src/Material)
add_subdirectory(src/Navigation)
add_subdirectory(src/Propagator)
add_subdirectory(src/Seeding)
add_subdirectory(src/Surfaces)
add_subdirectory(src/TrackFinding)
add_subdirectory(src/TrackFitting)
Expand Down
11 changes: 11 additions & 0 deletions Core/include/Acts/EventData/GenericBoundTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ class GenericBoundTrackParameters {
return m_surface->referenceFrame(geoCtx, position(geoCtx), momentum());
}

/// Reflect the parameters in place.
void reflectInPlace() { m_params = reflectBoundParameters(m_params); }

/// Reflect the parameters.
/// @return Reflected parameters.
GenericBoundTrackParameters<ParticleHypothesis> reflect() const {
GenericBoundTrackParameters<ParticleHypothesis> reflected = *this;
reflected.reflectInPlace();
return reflected;
}

private:
BoundVector m_params;
std::optional<BoundSquareMatrix> m_cov;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ class GenericCurvilinearTrackParameters
Vector3 position() const {
return GenericBoundTrackParameters<ParticleHypothesis>::position({});
}

/// Reflect the parameters.
/// @return Reflected parameters.
GenericCurvilinearTrackParameters<ParticleHypothesis> reflect() const {
GenericCurvilinearTrackParameters<ParticleHypothesis> reflected = *this;
reflected.reflectInPlace();
return reflected;
}
};

} // namespace Acts
21 changes: 17 additions & 4 deletions Core/include/Acts/EventData/GenericFreeTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include "Acts/Definitions/Common.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/TrackParametersConcept.hpp"
#include "Acts/EventData/TransformationHelpers.hpp"
#include "Acts/EventData/detail/PrintParameters.hpp"
#include "Acts/Utilities/MathHelpers.hpp"
#include "Acts/Utilities/UnitVectors.hpp"

#include <cassert>
Expand Down Expand Up @@ -154,12 +156,12 @@ class GenericFreeTrackParameters {
// [f*sin(theta)*cos(phi), f*sin(theta)*sin(phi), f*cos(theta)]
// w/ f,sin(theta) positive, the transverse magnitude is then
// sqrt(f^2*sin^2(theta)) = f*sin(theta)
Scalar transverseMagnitude =
std::hypot(m_params[eFreeDir0], m_params[eFreeDir1]);
Scalar transverseMagnitude2 =
square(m_params[eFreeDir0]) + square(m_params[eFreeDir1]);
// absolute magnitude is f by construction
Scalar magnitude = std::hypot(transverseMagnitude, m_params[eFreeDir2]);
Scalar magnitude2 = transverseMagnitude2 + square(m_params[eFreeDir2]);
// such that we can extract sin(theta) = f*sin(theta) / f
return (transverseMagnitude / magnitude) * absoluteMomentum();
return std::sqrt(transverseMagnitude2 / magnitude2) * absoluteMomentum();
}
/// Momentum three-vector.
Vector3 momentum() const { return absoluteMomentum() * direction(); }
Expand All @@ -174,6 +176,17 @@ class GenericFreeTrackParameters {
return m_particleHypothesis;
}

/// Reflect the parameters in place.
void reflectInPlace() { m_params = reflectFreeParameters(m_params); }

/// Reflect the parameters.
/// @return Reflected parameters.
GenericFreeTrackParameters<ParticleHypothesis> reflect() const {
GenericFreeTrackParameters<ParticleHypothesis> reflected = *this;
reflected.reflectInPlace();
return reflected;
}

private:
FreeVector m_params;
std::optional<FreeSquareMatrix> m_cov;
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/EventData/Seed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Acts {

template <typename external_spacepoint_t, std::size_t N = 3ul>
requires(N >= 3)
requires(N >= 3ul)
class Seed {
public:
using value_type = external_spacepoint_t;
Expand Down
12 changes: 6 additions & 6 deletions Core/include/Acts/EventData/Seed.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@
namespace Acts {

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
template <typename... args_t>
requires(sizeof...(args_t) == N) &&
(std::same_as<external_spacepoint_t, args_t> && ...)
Seed<external_spacepoint_t, N>::Seed(const args_t&... points)
: m_spacepoints({&points...}) {}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
void Seed<external_spacepoint_t, N>::setVertexZ(float vertex) {
m_vertexZ = vertex;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
void Seed<external_spacepoint_t, N>::setQuality(float seedQuality) {
m_seedQuality = seedQuality;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
const std::array<const external_spacepoint_t*, N>&
Seed<external_spacepoint_t, N>::sp() const {
return m_spacepoints;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
float Seed<external_spacepoint_t, N>::z() const {
return m_vertexZ;
}

template <typename external_spacepoint_t, std::size_t N>
requires(N >= 3)
requires(N >= 3ul)
float Seed<external_spacepoint_t, N>::seedQuality() const {
return m_seedQuality;
}
Expand Down
1 change: 0 additions & 1 deletion Core/include/Acts/EventData/SourceLink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <cassert>
#include <concepts>
#include <iostream>
#include <type_traits>
#include <utility>

Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/EventData/TrackStateProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,9 @@ class TrackStateProxy {
jacobian() = other.jacobian();
}

// NOTE: we should not check hasCalibrated on this, since it
// may be not yet allocated
if (ACTS_CHECK_BIT(mask, PM::Calibrated) &&
has<hashString("calibrated")>() &&
other.template has<hashString("calibrated")>()) {
allocateCalibrated(other.calibratedSize());

Expand Down
28 changes: 28 additions & 0 deletions Core/include/Acts/EventData/TransformationHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,39 @@
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/Result.hpp"
#include "Acts/Utilities/detail/periodic.hpp"

namespace Acts {

class Surface;

/// Reflect bound track parameters.
///
/// @param boundParams Bound track parameters vector
/// @return Reflected bound track parameters vector
inline BoundVector reflectBoundParameters(const BoundVector& boundParams) {
BoundVector reflected = boundParams;
auto [phi, theta] = detail::normalizePhiTheta(
boundParams[eBoundPhi] - M_PI, M_PI - boundParams[eBoundTheta]);
reflected[eBoundPhi] = phi;
reflected[eBoundTheta] = theta;
reflected[eBoundQOverP] = -boundParams[eBoundQOverP];
return reflected;
}

/// Reflect free track parameters.
///
/// @param freeParams Free track parameters vector
/// @return Reflected free track parameters vector
inline FreeVector reflectFreeParameters(const FreeVector& freeParams) {
FreeVector reflected = freeParams;
reflected[eFreeDir0] = -freeParams[eFreeDir0];
reflected[eFreeDir1] = -freeParams[eFreeDir1];
reflected[eFreeDir2] = -freeParams[eFreeDir2];
reflected[eFreeQOverP] = -freeParams[eFreeQOverP];
return reflected;
}

/// Transform bound track parameters into equivalent free track parameters.
///
/// @param surface Surface onto which the input parameters are bound
Expand Down
Loading

0 comments on commit 3eaeed7

Please sign in to comment.