Skip to content

Commit

Permalink
Merge branch 'main' into explicit-material
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Oct 18, 2024
2 parents 3271411 + 1d1ccbd commit cced811
Show file tree
Hide file tree
Showing 114 changed files with 1,790 additions and 943 deletions.
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 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
40 changes: 38 additions & 2 deletions Core/include/Acts/EventData/GenericFreeTrackParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
#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 "Acts/Utilities/VectorHelpers.hpp"

#include <cassert>
#include <cmath>
Expand Down Expand Up @@ -55,6 +57,29 @@ class GenericFreeTrackParameters {
m_cov(std::move(cov)),
m_particleHypothesis(std::move(particleHypothesis)) {}

/// Construct from four-position, direction, absolute momentum, and charge.
///
/// @param pos4 Track position/time four-vector
/// @param dir Track direction three-vector; normalization is ignored.
/// @param qOverP Charge over momentum
/// @param cov Free parameters covariance matrix
/// @param particleHypothesis Particle hypothesis
GenericFreeTrackParameters(const Vector4& pos4, const Vector3& dir,
Scalar qOverP, std::optional<CovarianceMatrix> cov,
ParticleHypothesis particleHypothesis)
: m_params(FreeVector::Zero()),
m_cov(std::move(cov)),
m_particleHypothesis(std::move(particleHypothesis)) {
m_params[eFreePos0] = pos4[ePos0];
m_params[eFreePos1] = pos4[ePos1];
m_params[eFreePos2] = pos4[ePos2];
m_params[eFreeTime] = pos4[eTime];
m_params[eFreeDir0] = dir[eMom0];
m_params[eFreeDir1] = dir[eMom1];
m_params[eFreeDir2] = dir[eMom2];
m_params[eFreeQOverP] = qOverP;
}

/// Construct from four-position, angles, absolute momentum, and charge.
///
/// @param pos4 Track position/time four-vector
Expand Down Expand Up @@ -135,9 +160,9 @@ class GenericFreeTrackParameters {
Scalar time() const { return m_params[eFreeTime]; }

/// Phi direction.
Scalar phi() const { return phi(direction()); }
Scalar phi() const { return VectorHelpers::phi(direction()); }
/// Theta direction.
Scalar theta() const { return theta(direction()); }
Scalar theta() const { return VectorHelpers::theta(direction()); }
/// Charge over momentum.
Scalar qOverP() const { return m_params[eFreeQOverP]; }

Expand Down Expand Up @@ -175,6 +200,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
6 changes: 3 additions & 3 deletions Core/include/Acts/EventData/TrackProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ class TrackProxy {
return std::distance(tsRange.begin(), tsRange.end());
}

/// Return the number of measurements for the track. Const version
/// Return a mutable reference to the number of measurements for the track.
/// Mutable version
/// @note Only available if the track proxy is not read-only
/// @return The number of measurements
unsigned int& nMeasurements()
Expand All @@ -333,8 +334,7 @@ class TrackProxy {
return component<unsigned int, hashString("nMeasurements")>();
}

/// Return a mutable reference to the number of measurements for the track.
/// Mutable version
/// Return the number of measurements for the track. Const version
/// @return The number of measurements
unsigned int nMeasurements() const {
return component<unsigned int, hashString("nMeasurements")>();
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
15 changes: 14 additions & 1 deletion Core/include/Acts/Geometry/CylinderVolumeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/BoundarySurfaceFace.hpp"
#include "Acts/Geometry/Volume.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Utilities/BinningType.hpp"
Expand Down Expand Up @@ -80,6 +81,18 @@ class CylinderVolumeBounds : public VolumeBounds {
eSize
};

/// Enum describing the possible faces of a cylinder volume
/// @note These values are synchronized with the BoundarySurfaceFace enum.
/// Once Gen1 is removed, this can be changed.
enum class Face : unsigned int {
PositiveDisc = BoundarySurfaceFace::positiveFaceXY,
NegativeDisc = BoundarySurfaceFace::negativeFaceXY,
OuterCylinder = BoundarySurfaceFace::tubeOuterCover,
InnerCylinder = BoundarySurfaceFace::tubeInnerCover,
NegativePhiPlane = BoundarySurfaceFace::tubeSectorNegativePhi,
PositivePhiPlane = BoundarySurfaceFace::tubeSectorPositivePhi
};

CylinderVolumeBounds() = delete;

/// Constructor
Expand Down Expand Up @@ -115,7 +128,7 @@ class CylinderVolumeBounds : public VolumeBounds {
/// Copy Constructor
///
/// @param cylbo is the source cylinder volume bounds for the copy
CylinderVolumeBounds(const CylinderVolumeBounds& cylbo) = default;
CylinderVolumeBounds(const CylinderVolumeBounds& cylbo);

~CylinderVolumeBounds() override = default;
CylinderVolumeBounds& operator=(const CylinderVolumeBounds& cylbo) = default;
Expand Down
Loading

0 comments on commit cced811

Please sign in to comment.