Skip to content

Commit

Permalink
Merge branch 'main' into gx2f-root-nupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger authored Nov 16, 2023
2 parents e2e6335 + 040a896 commit d43ab18
Show file tree
Hide file tree
Showing 435 changed files with 2,093 additions and 1,858 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check
run: >
sudo apt-get install -y git
Expand All @@ -53,6 +55,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check
run: >
CI/check_include_guards.py . --fail-global --exclude "*thirdparty/*"
Expand All @@ -68,9 +72,21 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check
run: >
CI/check_end_of_file.py . --exclude "thirdparty/*" --reject-multiple-newlines --github
size_t:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check
run: >
CI/check_size_t.py . --exclude "thirdparty/*"
boost_test_macro:
runs-on: ubuntu-latest
steps:
Expand All @@ -83,6 +99,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check
run: >
CI/check_smearing_config.py .
Expand All @@ -91,6 +109,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check
run: >
docs/parse_cmake_options.py CMakeLists.txt --write docs/getting_started.md --verify
Expand All @@ -99,6 +119,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install codespell
run: >
pip install codespell==2.2.5
Expand All @@ -120,6 +142,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: >
pip install -r CI/requirements_fpe_masks.txt
Expand Down
9 changes: 0 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,18 +440,9 @@ lcg_104:

parallel:
matrix:
- OS: [centos7]
COMPILER:
- gcc11
- gcc12

- OS: [alma9]
COMPILER:
- gcc11
- gcc12
- gcc13
- clang16

- OS: [centos8]
COMPILER: [gcc11]

2 changes: 1 addition & 1 deletion .merge-sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rules:
- WIP
- milestone-set
required_pattern:
- "review-required: *"
- "policy-bot: *"

- branch_filter:
- "main"
Expand Down
18 changes: 9 additions & 9 deletions Alignment/include/ActsAlignment/Kernel/Alignment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ struct AlignmentOptions {
const AlignedTransformUpdater& aTransformUpdater,
const std::vector<Acts::DetectorElementBase*>& aDetElements = {},
double chi2CutOff = 0.5,
const std::pair<size_t, double>& deltaChi2CutOff = {5, 0.01},
size_t maxIters = 5,
const std::pair<std::size_t, double>& deltaChi2CutOff = {5, 0.01},
std::size_t maxIters = 5,
const std::map<unsigned int, AlignmentMask>& iterState = {})
: fitOptions(fOptions),
alignedTransformUpdater(aTransformUpdater),
Expand All @@ -79,10 +79,10 @@ struct AlignmentOptions {

// The delta of average chi2/ndf within a couple of iterations to determine if
// alignment is converged
std::pair<size_t, double> deltaAverageChi2ONdfCutOff = {5, 0.01};
std::pair<std::size_t, double> deltaAverageChi2ONdfCutOff = {5, 0.01};

// The maximum number of iterations to run alignment
size_t maxIterations = 5;
std::size_t maxIterations = 5;

// The alignment mask for different iterations
std::map<unsigned int, AlignmentMask> iterationState;
Expand Down Expand Up @@ -111,16 +111,16 @@ struct AlignmentResult {
double chi2 = 0;

// The measurement dimension from all tracks
size_t measurementDim = 0;
std::size_t measurementDim = 0;

// The alignment degree of freedom
size_t alignmentDof = 0;
std::size_t alignmentDof = 0;

// The number of tracks used for alignment
size_t numTracks = 0;
std::size_t numTracks = 0;

// The indexed alignable surfaces
std::unordered_map<const Acts::Surface*, size_t> idxedAlignSurfaces;
std::unordered_map<const Acts::Surface*, std::size_t> idxedAlignSurfaces;

Acts::Result<void> result{Acts::Result<void>::success()};
};
Expand Down Expand Up @@ -163,7 +163,7 @@ struct Alignment {
const Acts::GeometryContext& gctx,
const std::vector<source_link_t>& sourcelinks,
const start_parameters_t& sParameters, const fit_options_t& fitOptions,
const std::unordered_map<const Acts::Surface*, size_t>&
const std::unordered_map<const Acts::Surface*, std::size_t>&
idxedAlignSurfaces,
const AlignmentMask& alignMask) const;

Expand Down
5 changes: 3 additions & 2 deletions Alignment/include/ActsAlignment/Kernel/Alignment.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ ActsAlignment::Alignment<fitter_t>::evaluateTrackAlignmentState(
const Acts::GeometryContext& gctx,
const std::vector<source_link_t>& sourcelinks,
const start_parameters_t& sParameters, const fit_options_t& fitOptions,
const std::unordered_map<const Acts::Surface*, size_t>& idxedAlignSurfaces,
const std::unordered_map<const Acts::Surface*, std::size_t>&
idxedAlignSurfaces,
const ActsAlignment::AlignmentMask& alignMask) const {
Acts::TrackContainer tracks{Acts::VectorTrackContainer{},
Acts::VectorMultiTrajectory{}};
Expand Down Expand Up @@ -122,7 +123,7 @@ void ActsAlignment::Alignment<fitter_t>::calculateAlignmentParameters(
// Get the inverse of chi2 second derivative matrix (we need this to
// calculate the covariance of the alignment parameters)
// @Todo: use more stable method for solving the inverse
size_t alignDof = alignResult.alignmentDof;
std::size_t alignDof = alignResult.alignmentDof;
Acts::ActsDynamicMatrix sumChi2SecondDerivativeInverse =
Acts::ActsDynamicMatrix::Zero(alignDof, alignDof);
sumChi2SecondDerivativeInverse = sumChi2SecondDerivative.inverse();
Expand Down
37 changes: 19 additions & 18 deletions Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ using namespace Acts;
///
struct TrackAlignmentState {
// The dimension of measurements
size_t measurementDim = 0;
std::size_t measurementDim = 0;

// The dimension of track parameters
size_t trackParametersDim = 0;
std::size_t trackParametersDim = 0;

// The contributed alignment degree of freedom
size_t alignmentDof = 0;
std::size_t alignmentDof = 0;

// The measurements covariance
ActsDynamicMatrix measurementCovariance;
Expand Down Expand Up @@ -65,7 +65,8 @@ struct TrackAlignmentState {

// The alignable surfaces on the track and their indices in both the global
// alignable surfaces pool and those relevant with this track
std::unordered_map<const Surface*, std::pair<size_t, size_t>> alignedSurfaces;
std::unordered_map<const Surface*, std::pair<std::size_t, std::size_t>>
alignedSurfaces;
};

/// Reset some columns of the alignment to bound derivative to zero if the
Expand Down Expand Up @@ -104,24 +105,24 @@ void resetAlignmentDerivative(Acts::AlignmentToBoundMatrix& alignToBound,
template <typename traj_t, typename parameters_t = BoundTrackParameters>
TrackAlignmentState trackAlignmentState(
const GeometryContext& gctx, const traj_t& multiTraj,
const size_t& entryIndex,
const std::pair<ActsDynamicMatrix, std::unordered_map<size_t, size_t>>&
const std::size_t& entryIndex,
const std::pair<ActsDynamicMatrix,
std::unordered_map<std::size_t, std::size_t>>&
globalTrackParamsCov,
const std::unordered_map<const Surface*, size_t>& idxedAlignSurfaces,
const std::unordered_map<const Surface*, std::size_t>& idxedAlignSurfaces,
const AlignmentMask& alignMask) {
using CovMatrix = typename parameters_t::CovarianceMatrix;

// Construct an alignment state
TrackAlignmentState alignState;

// Remember the index within the trajectory and whether it's alignable
std::vector<std::pair<size_t, bool>> measurementStates;
std::vector<std::pair<std::size_t, bool>> measurementStates;
measurementStates.reserve(15);
// Number of smoothed states on the track
// size_t nSmoothedStates = 0; // commented because clang-tidy complains about
// unused
// Number of alignable surfaces on the track
size_t nAlignSurfaces = 0;
// std::size_t nSmoothedStates = 0; // commented because clang-tidy complains
// about unused Number of alignable surfaces on the track
std::size_t nAlignSurfaces = 0;

// Visit the track states on the track
multiTraj.visitBackwards(entryIndex, [&](const auto& ts) {
Expand Down Expand Up @@ -192,12 +193,12 @@ TrackAlignmentState trackAlignmentState(

// Loop over the measurement states to fill those alignment matrices
// This is done in reverse order
size_t iMeasurement = alignState.measurementDim;
size_t iParams = alignState.trackParametersDim;
size_t iSurface = nAlignSurfaces;
std::size_t iMeasurement = alignState.measurementDim;
std::size_t iParams = alignState.trackParametersDim;
std::size_t iSurface = nAlignSurfaces;
for (const auto& [rowStateIndex, isAlignable] : measurementStates) {
const auto& state = multiTraj.getTrackState(rowStateIndex);
const size_t measdim = state.calibratedSize();
const std::size_t measdim = state.calibratedSize();
// Update index of current measurement and parameter
iMeasurement -= measdim;
iParams -= eBoundSize;
Expand Down Expand Up @@ -251,14 +252,14 @@ TrackAlignmentState trackAlignmentState(
// @Todo: add helper function to select rows/columns of a matrix
for (unsigned int iColState = 0; iColState < measurementStates.size();
iColState++) {
size_t colStateIndex = measurementStates.at(iColState).first;
std::size_t colStateIndex = measurementStates.at(iColState).first;
// Retrieve the block from the source covariance matrix
CovMatrix correlation =
sourceTrackParamsCov.block<eBoundSize, eBoundSize>(
stateRowIndices.at(rowStateIndex),
stateRowIndices.at(colStateIndex));
// Fill the block of the target covariance matrix
size_t iCol =
std::size_t iCol =
alignState.trackParametersDim - (iColState + 1) * eBoundSize;
alignState.trackParametersCovariance.block<eBoundSize, eBoundSize>(
iParams, iCol) = correlation;
Expand Down
82 changes: 82 additions & 0 deletions CI/check_size_t.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env python3

from pathlib import Path
import os
import argparse
from fnmatch import fnmatch
import re
import sys

ex = re.compile(r"(\b(?<!std::)size_t)\b")

github = "GITHUB_ACTIONS" in os.environ


def main():
p = argparse.ArgumentParser()
p.add_argument("input")
p.add_argument(
"--fix", action="store_true", help="Attempt to fix any license issues found."
)
p.add_argument("--exclude", "-e", action="append", default=[])

args = p.parse_args()

# walk over all files
exit = 0
for root, _, files in os.walk("."):
root = Path(root)
for filename in files:
# get the full path of the file
filepath = root / filename
if filepath.suffix not in (
".hpp",
".cpp",
".ipp",
".h",
".C",
".c",
".cu",
".cuh",
):
continue

if any([fnmatch(str(filepath), e) for e in args.exclude]):
continue

changed_lines = handle_file(filepath, fix=args.fix)
if len(changed_lines) > 0:
exit = 1
print()
print(filepath)
for i, oline in changed_lines:
print(f"{i}: {oline}")

if github:
print(
f"::error file={filepath},line={i+1},title=Do not use C-style size_t::Replace size_t with std::size_t"
)

return exit


def handle_file(file: Path, fix: bool) -> list[tuple[int, str]]:
content = file.read_text()
lines = content.splitlines()

changed_lines = []

for i, oline in enumerate(lines):
line, n_subs = ex.subn(r"std::size_t", oline)
lines[i] = line
if n_subs > 0:
changed_lines.append((i, oline))

if fix and len(changed_lines) > 0:
file.write_text("\n".join(lines) + "\n")

return changed_lines


if "__main__" == __name__:
sys.exit(main())
6 changes: 3 additions & 3 deletions Core/include/Acts/EventData/MultiTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,15 +908,15 @@ class TrackStateProxy {
/// @note this overload is only enabled in case the proxy is not read-only
/// @return Mutable reference to the chi2 value
template <bool RO = ReadOnly, typename = std::enable_if_t<!RO>>
double& chi2() {
return component<double, hashString("chi2")>();
float& chi2() {
return component<float, hashString("chi2")>();
}

/// Getter for the chi2 value associated with the track state.
/// This overload returns a copy of the chi2 value, and thus does not allow
/// modification of the value in the backing storage.
/// @return the chi2 value of the track state
double chi2() const { return component<double, hashString("chi2")>(); }
float chi2() const { return component<float, hashString("chi2")>(); }

/// Getter for the path length associated with the track state.
/// This overloaded is only enabled if not read-only, and returns a mutable
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/EventData/TrackStateProxyConcept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ concept TrackStateProxyConcept =
{ cv.calibratedSize() } -> std::same_as<TrackIndexType>;
{ v.calibratedSize() } -> std::same_as<TrackIndexType>;

{ cv.chi2() } -> std::same_as<double>;
{ cv.chi2() } -> std::same_as<float>;

{ cv.pathLength() } -> std::same_as<double>;

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/EventData/VectorMultiTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class VectorMultiTrajectoryBase {
IndexType ijacobian = kInvalid;
IndexType iprojector = kInvalid;

double chi2 = 0;
float chi2 = 0;
double pathLength = 0;
TrackStateType::raw_type typeFlags{};

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Seeding/SeedFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ inline void SeedFinder<external_spacepoint_t, platform_t>::filterCandidates(

// sqrt(S2)/B = 2 * helixradius
// calculated radius must not be smaller than minimum radius
if (S2 < B2 * options.minHelixDiameter2 * m_config.helixCut) {
if (S2 < B2 * options.minHelixDiameter2) {
continue;
}

Expand Down
Loading

0 comments on commit d43ab18

Please sign in to comment.