Skip to content

Commit

Permalink
Merge branch 'main' into feat-angle-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Oct 22, 2024
2 parents 6243cfa + 6f3673d commit 5340013
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 64 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
CTEST_OUTPUT_ON_FAILURE: 1
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_MAXSIZE: 1.25G
CCACHE_KEY_SUFFIX: r1
CCACHE_KEY_SUFFIX: r2
ACTS_LOG_FAILURE_THRESHOLD: WARNING
DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.v4.tar.zst

Expand All @@ -41,10 +41,10 @@ jobs:
- name: Cache build
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-ccache-linux_ubuntu_debug_${{ env.CCACHE_KEY_SUFFIX }}_${{ github.sha }}
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-linux_ubuntu_debug_${{ env.CCACHE_KEY_SUFFIX }}_
ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-
- name: Configure
run: >
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_MAXSIZE: 500M
CCACHE_KEY_SUFFIX: r1
CCACHE_KEY_SUFFIX: r2

jobs:
linux_ubuntu:
Expand All @@ -43,10 +43,10 @@ jobs:
uses: actions/cache/restore@v4
id: ccache-restore
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-ccache-linux_ubuntu_${{ env.CCACHE_KEY_SUFFIX }}_${{ github.sha }}
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-linux_ubuntu_${{ env.CCACHE_KEY_SUFFIX }}_
ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-
- name: Configure
# setting CMAKE_CXX_STANDARD=20 is a workaround for a bug in the
Expand Down Expand Up @@ -260,10 +260,10 @@ jobs:
uses: actions/cache/restore@v4
id: ccache-restore
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-ccache-linux_${{ matrix.image }}_${{ env.CCACHE_KEY_SUFFIX }}_${{ github.sha }}
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-linux_${{ matrix.image }}_${{ env.CCACHE_KEY_SUFFIX }}_
ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-
- name: Configure
Expand Down Expand Up @@ -339,10 +339,10 @@ jobs:
uses: actions/cache/restore@v4
id: ccache-restore
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-ccache_${{ env.CCACHE_KEY_SUFFIX }}_${{ github.sha }}
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache_${{ env.CCACHE_KEY_SUFFIX }}_
ccache-${{ runner.os }}-${{ github.job }}-${{ env.CCACHE_KEY_SUFFIX }}-
- name: Configure
run: >
Expand Down
40 changes: 26 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variables:
CCACHE_DIR: ${CI_PROJECT_DIR}/ccache
CCACHE_MAXSIZE: 2G
CCACHE_KEY_SUFFIX: r1
CCACHE_KEY_SUFFIX: r2
CTEST_OUTPUT_ON_FAILURE: 1

DEPENDENCY_TAG: v4
Expand Down Expand Up @@ -70,9 +70,12 @@ build_exatrkx_cpu:
- large

cache:
key: ccache-exatrkx-cpu-$CI_COMMIT_REF_SLUG
key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX}
fallback_keys:
- ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX}
when: always
paths:
- ${CI_PROJECT_DIR}/ccache
- ${CCACHE_DIR}

script:
- export PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
Expand Down Expand Up @@ -105,9 +108,12 @@ build_exatrkx:
- large

cache:
key: ccache-exatrkx-$CI_COMMIT_REF_SLUG
key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX}
fallback_keys:
- ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX}
when: always
paths:
- ${CI_PROJECT_DIR}/ccache
- ${CCACHE_DIR}

artifacts:
paths:
Expand Down Expand Up @@ -173,10 +179,12 @@ build_linux_ubuntu:
DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.$DEPENDENCY_TAG.tar.zst

cache:
key: ccache-${CI_JOB_NAME_SLUG}-${HEAD_REF}-${CCACHE_KEY_SUFFIX}
when: 'always'
key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX}
fallback_keys:
- ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX}
when: always
paths:
- ${CI_PROJECT_DIR}/ccache
- ${CCACHE_DIR}

artifacts:
paths:
Expand Down Expand Up @@ -281,10 +289,12 @@ linux_physmon:
stage: build

cache:
key: ccache-${CI_JOB_NAME_SLUG}-${HEAD_REF}-${CCACHE_KEY_SUFFIX}
when: 'always'
key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX}
fallback_keys:
- ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX}
when: always
paths:
- ${CI_PROJECT_DIR}/ccache
- ${CCACHE_DIR}

script:
- git clone $CLONE_URL src
Expand Down Expand Up @@ -360,10 +370,12 @@ linux_ubuntu_2204_clang:
SETUP:

cache:
key: ccache-${CI_JOB_NAME_SLUG}-${HEAD_REF}-${CCACHE_KEY_SUFFIX}
when: 'always'
key: ccache-${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CCACHE_KEY_SUFFIX}
fallback_keys:
- ccache-${CI_JOB_NAME}-${CI_DEFAULT_BRANCH}-${CCACHE_KEY_SUFFIX}
when: always
paths:
- ${CI_PROJECT_DIR}/ccache
- ${CCACHE_DIR}

before_script:
- 'echo "LCG_VERSION: ${LCG_VERSION}"'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
- id: license
name: license
language: system
entry: CI/check_license.py
entry: CI/check_license.py --fix
files: \.(cpp|hpp|ipp|cu|cuh)$

- repo: local
Expand Down
1 change: 1 addition & 0 deletions Examples/Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_library(
src/Framework/WhiteBoard.cpp
src/Framework/RandomNumbers.cpp
src/Framework/Sequencer.cpp
src/Framework/DataHandle.cpp
src/Utilities/EventDataTransforms.cpp
src/Utilities/Paths.cpp
src/Utilities/Options.cpp
Expand Down
57 changes: 25 additions & 32 deletions Examples/Framework/include/ActsExamples/Framework/DataHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

#pragma once

#include "Acts/Utilities/ThrowAssert.hpp"
#include "ActsExamples/Framework/SequenceElement.hpp"
#include "ActsExamples/Framework/WhiteBoard.hpp"

#include <iostream>
#include <stdexcept>
#include <typeinfo>

Expand Down Expand Up @@ -54,14 +52,33 @@ class DataHandleBase {
std::optional<std::string> m_key{};
};

template <typename T>
class ReadDataHandle;
class WriteDataHandleBase : public DataHandleBase {
protected:
WriteDataHandleBase(SequenceElement* parent, const std::string& name)
: DataHandleBase{parent, name} {}

public:
void initialize(const std::string& key);

bool isCompatible(const DataHandleBase& other) const final;
};

class ReadDataHandleBase : public DataHandleBase {
protected:
ReadDataHandleBase(SequenceElement* parent, const std::string& name)
: DataHandleBase{parent, name} {}

public:
void initialize(const std::string& key);

bool isCompatible(const DataHandleBase& other) const final;
};

template <typename T>
class WriteDataHandle final : public DataHandleBase {
class WriteDataHandle final : public WriteDataHandleBase {
public:
WriteDataHandle(SequenceElement* parent, const std::string& name)
: DataHandleBase{parent, name} {
: WriteDataHandleBase{parent, name} {
m_parent->registerWriteHandle(*this);
}

Expand All @@ -77,37 +94,17 @@ class WriteDataHandle final : public DataHandleBase {
wb.add(m_key.value(), std::move(value));
}

void initialize(const std::string& key) {
if (key.empty()) {
throw std::invalid_argument{"Write handle '" + fullName() +
"' cannot receive empty key"};
}
m_key = key;
}

bool isCompatible(const DataHandleBase& other) const override {
return dynamic_cast<const ReadDataHandle<T>*>(&other) != nullptr;
}

const std::type_info& typeInfo() const override { return typeid(T); };
};

template <typename T>
class ReadDataHandle final : public DataHandleBase {
class ReadDataHandle final : public ReadDataHandleBase {
public:
ReadDataHandle(SequenceElement* parent, const std::string& name)
: DataHandleBase{parent, name} {
: ReadDataHandleBase{parent, name} {
m_parent->registerReadHandle(*this);
}

void initialize(const std::string& key) {
if (key.empty()) {
throw std::invalid_argument{"Read handle '" + fullName() +
"' cannot receive empty key"};
}
m_key = key;
}

const T& operator()(const AlgorithmContext& ctx) const {
return (*this)(ctx.eventStore);
}
Expand All @@ -120,10 +117,6 @@ class ReadDataHandle final : public DataHandleBase {
return wb.get<T>(m_key.value());
}

bool isCompatible(const DataHandleBase& other) const override {
return dynamic_cast<const WriteDataHandle<T>*>(&other) != nullptr;
}

const std::type_info& typeInfo() const override { return typeid(T); };
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <optional>
#include <stdexcept>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
Expand Down
39 changes: 39 additions & 0 deletions Examples/Framework/src/Framework/DataHandle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// This file is part of the ACTS project.
//
// Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.

#include "ActsExamples/Framework/DataHandle.hpp"

namespace ActsExamples {

void WriteDataHandleBase::initialize(const std::string& key) {
if (key.empty()) {
throw std::invalid_argument{"Write handle '" + fullName() +
"' cannot receive empty key"};
}
m_key = key;
}

bool WriteDataHandleBase::isCompatible(const DataHandleBase& other) const {
return dynamic_cast<const ReadDataHandleBase*>(&other) != nullptr &&
typeInfo() == other.typeInfo();
}

void ReadDataHandleBase::initialize(const std::string& key) {
if (key.empty()) {
throw std::invalid_argument{"Read handle '" + fullName() +
"' cannot receive empty key"};
}
m_key = key;
}

bool ReadDataHandleBase::isCompatible(const DataHandleBase& other) const {
return dynamic_cast<const WriteDataHandleBase*>(&other) != nullptr &&
typeInfo() == other.typeInfo();
}

} // namespace ActsExamples
4 changes: 4 additions & 0 deletions Examples/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ target_link_libraries(
ActsExamplesDetectorTelescope
ActsExamplesUtilities
ActsExamplesAmbiguityResolution
ActsExamplesTruthTracking
ActsExamplesDigitization
ActsExamplesPropagation
ActsExamplesMaterialMapping
)

set(py_files
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Core/TrackFitting/FitterTestsCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ auto makeStraightPropagator(std::shared_ptr<const Acts::TrackingGeometry> geo) {
cfg.resolveMaterial = true;
cfg.resolveSensitive = true;
Acts::Navigator navigator(
cfg, Acts::getDefaultLogger("Navigator", Acts::Logging::VERBOSE));
cfg, Acts::getDefaultLogger("Navigator", Acts::Logging::INFO));
Acts::StraightLineStepper stepper;
return Acts::Propagator<Acts::StraightLineStepper, Acts::Navigator>(
stepper, std::move(navigator));
Expand All @@ -105,7 +105,7 @@ auto makeConstantFieldPropagator(
cfg.resolveMaterial = true;
cfg.resolveSensitive = true;
Acts::Navigator navigator(
cfg, Acts::getDefaultLogger("Navigator", Acts::Logging::VERBOSE));
cfg, Acts::getDefaultLogger("Navigator", Acts::Logging::INFO));
auto field =
std::make_shared<Acts::ConstantBField>(Acts::Vector3(0.0, 0.0, bz));
stepper_t stepper(std::move(field));
Expand Down

0 comments on commit 5340013

Please sign in to comment.