diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 30a8e40ee2a..7073e2a413a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,41 +1,11 @@ -PLEASE FOLLOW THE CHECKLIST BELOW WHEN CREATING A NEW PULL REQUEST. THE -CHECKLIST IS FOR YOUR INFORMATION AND MUST BE REMOVED BEFORE SUBMITTING THE PULL -REQUEST. +PLEASE DESCRIBE YOUR CHANGES. +THIS MESSAGE ENDS UP AS THE COMMIT MESSAGE. +DO NOT USE @-MENTIONS HERE! -## Checklist +--- END COMMIT MESSAGE --- -- [ ] Does the PR title follow the `: title` scheme? +Any further description goes here, @-mentions are ok here! - The prefix must be one of: - - - `fix`: for a bugfix - - `feat`: for a new feature - - `refactor`: for an improvement of an existing feature - - `perf`, `test`: for performance- or test-related changes - - `docs`: for documentation-related changes - - `build`, `ci`, `chore`: as appropriated for infrastructure changes - -- [ ] Does this modify the public API as defined in `docs/versioning.rst`? - - - [ ] Does the PR title contain a `!` to indicate a breaking change? - - [ ] Is there section starting with `BREAKING CHANGE:` in the PR body - that explains the breaking change? - -- [ ] Is the PR ready to be merged? - - - [ ] If not: is it marked as a draft PR? - -- [ ] Does this PR close an existing issue? - - - [ ] Is the issue correctly linked so it will be automatically closed - upon successful merge (See closing keywords link in the sidebar)? - -- The CI will initially report a missing milestone. One of the maintainers will - handle assigning a milestone for book-keeping. - -- An automated workflow will assign labels based on changed files, and whether - or not reference files were changed. These do not have to be set manually. - -- If you push updates, and you know they will be superceded later on, consider adding - `[skip ci]` in the commit message. This will instruct the CI system not to run any - jobs on this commit. +- Use a *conventional commits* prefix: [quick summary](https://www.conventionalcommits.org/en/v1.0.0/#summary) + - We mostly use `feat`, `fix`, `refactor`, `docs`, `chore` and `build` types. +- A milestone will be assigned by one of the maintainers diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 2ce3bfdc278..f33bb927f40 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -20,8 +20,9 @@ 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.v5.tar.zst # NOTE this only builds core unittests to reduce the output size. if we # found a way to have Github actions not fail regularly with this job @@ -29,18 +30,21 @@ env: jobs: build_debug: runs-on: ubuntu-latest - container: ghcr.io/acts-project/ubuntu2404:58 + container: ghcr.io/acts-project/ubuntu2404:63 steps: - uses: actions/checkout@v4 + - name: Install dependencies + run: CI/dependencies.sh + - 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: > @@ -49,6 +53,7 @@ jobs: --preset=github-ci -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror --coverage -g -gz -g1" + -DPython_EXECUTABLE=$(which python3) -DACTS_BUILD_ODD=OFF - name: Build run: cmake --build build @@ -86,10 +91,14 @@ jobs: build_performance: runs-on: ubuntu-latest - container: ghcr.io/acts-project/ubuntu2404:58 + container: ghcr.io/acts-project/ubuntu2404:63 if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 + + - name: Install dependencies + run: CI/dependencies.sh + - name: Install dependencies run: pip3 install git+https://github.com/paulgessinger/cmakeperf.git@2a409b5 - name: Configure @@ -98,6 +107,7 @@ jobs: --preset=github-ci -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-Werror" + -DPython_EXECUTABLE=$(which python3) -DACTS_BUILD_ODD=OFF - name: Measure run: cmakeperf collect build/compile_commands.json -o perf.csv diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index f31c4c2e06d..87c57c27b7e 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -19,32 +19,37 @@ env: HOMEBREW_NO_INSTALL_CLEANUP: 1 CCACHE_DIR: ${{ github.workspace }}/ccache CCACHE_MAXSIZE: 500M - CCACHE_KEY_SUFFIX: r1 + CCACHE_KEY_SUFFIX: r2 + DEPENDENCY_TAG: v5 jobs: linux_ubuntu: runs-on: ubuntu-latest - container: ghcr.io/acts-project/ubuntu2404:58 + container: ghcr.io/acts-project/ubuntu2404:63 env: INSTALL_DIR: ${{ github.workspace }}/install ACTS_LOG_FAILURE_THRESHOLD: WARNING - steps: - - name: Install git lfs - run: apt-get update && apt-get install -y git-lfs + steps: - uses: actions/checkout@v4 with: submodules: true lfs: true + - name: Set dependencies URL + run: echo "DEPENDENCY_URL=https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.${DEPENDENCY_TAG}.tar.zst" >> $GITHUB_ENV + + - name: Install dependencies + run: CI/dependencies.sh + - name: Restore ccache 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 @@ -58,6 +63,7 @@ jobs: cmake -B build -S . --preset=github-ci -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" + -DPython_EXECUTABLE=$(which python3) -DACTS_BUILD_PLUGIN_ONNX=ON - name: Build @@ -107,20 +113,23 @@ jobs: linux_examples_test: runs-on: ubuntu-latest - container: ghcr.io/acts-project/ubuntu2404:58 + container: ghcr.io/acts-project/ubuntu2404:63 needs: [linux_ubuntu] env: ACTS_SEQUENCER_DISABLE_FPEMON: true steps: - - name: Install git lfs - run: apt-get update && apt-get install -y git-lfs - - uses: actions/checkout@v4 with: submodules: true lfs: true + - name: Set dependencies URL + run: echo "DEPENDENCY_URL=https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.${DEPENDENCY_TAG}.tar.zst" >> $GITHUB_ENV + + - name: Install dependencies + run: CI/dependencies.sh + - uses: actions/download-artifact@v4 with: name: acts-linux-ubuntu @@ -135,29 +144,34 @@ jobs: PYTEST_MD_REPORT_VERBOSE: 0 PYTEST_MD_REPORT_OUTPUT: pytest.md run: > - /usr/local/bin/geant4-config --install-datasets + geant4-config --install-datasets && source build/this_acts_withdeps.sh - && pip3 install -r Examples/Python/tests/requirements.txt - && pip3 install pytest-md-report + && python3 -m pip install -r Examples/Python/tests/requirements.txt + && python3 -m pip install pytest-md-report && pytest -rFsv -k "not exatrkx" -v && cat ${PYTEST_MD_REPORT_OUTPUT} >> $GITHUB_STEP_SUMMARY linux_physmon: runs-on: ubuntu-latest - container: ghcr.io/acts-project/ubuntu2404:58 + container: ghcr.io/acts-project/ubuntu2404:63 needs: [linux_ubuntu] env: ACTS_SEQUENCER_DISABLE_FPEMON: true steps: - - name: Install git lfs - run: apt-get update && apt-get install -y git-lfs time - - uses: actions/checkout@v4 with: submodules: true lfs: true + - run: apt-get update && apt-get install -y time + + - name: Set dependencies URL + run: echo "DEPENDENCY_URL=https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.${DEPENDENCY_TAG}.tar.zst" >> $GITHUB_ENV + + - name: Install dependencies + run: CI/dependencies.sh + - uses: actions/download-artifact@v4 with: name: acts-linux-ubuntu @@ -177,10 +191,15 @@ jobs: run: > echo "::group::Dependencies" && git config --global safe.directory "$GITHUB_WORKSPACE" - && pip3 install histcmp==0.6.7 matplotlib - && pip3 install -r Examples/Scripts/requirements.txt - && /usr/local/bin/geant4-config --install-datasets + && python3 -m pip install histcmp==0.6.8 matplotlib + && python3 -m pip install -r Examples/Scripts/requirements.txt + && geant4-config --install-datasets + && venv_python=$(which python3) + && echo $venv_python && source build/this_acts_withdeps.sh + && export PATH=$(dirname $venv_python):$PATH + && echo $PATH + && which python3 && echo "::endgroup::" && CI/physmon/phys_perf_mon.sh all physmon @@ -231,27 +250,31 @@ jobs: std: 20 - image: ubuntu2204_clang std: 20 - container: ghcr.io/acts-project/${{ matrix.image }}:58 + container: ghcr.io/acts-project/${{ matrix.image }}:63 env: INSTALL_DIR: ${{ github.workspace }}/install ACTS_LOG_FAILURE_THRESHOLD: WARNING - steps: - - name: Install git lfs - run: apt-get update && apt-get install -y git-lfs + steps: - uses: actions/checkout@v4 with: submodules: true lfs: true + - name: Set dependencies URL + run: echo "DEPENDENCY_URL=https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.${DEPENDENCY_TAG}.tar.zst" >> $GITHUB_ENV + + - name: Install dependencies + run: CI/dependencies.sh + - name: Restore ccache 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 @@ -264,6 +287,7 @@ jobs: --preset=github-ci -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" + -DPython_EXECUTABLE=$(which python3) - name: Build run: cmake --build build @@ -306,11 +330,8 @@ jobs: runs-on: macos-14 env: INSTALL_DIR: ${{ github.workspace }}/install_acts - DEPENDENCY_DIR: ${{ github.workspace }}/install ACTS_LOG_FAILURE_THRESHOLD: WARNING - DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/macos-14/deps.v2.tar.zst - # Works around an issue where root's RPATH is wrong for tbb, thus won't find it - DYLD_LIBRARY_PATH: "${{ github.workspace }}/install/tbb/2021.11.0/lib" + steps: - uses: actions/checkout@v4 with: @@ -320,64 +341,71 @@ jobs: - name: Print architecture run: uname -p + - name: Set dependencies URL + run: echo "DEPENDENCY_URL=https://acts.web.cern.ch/ACTS/ci/macos-14/deps.${DEPENDENCY_TAG}.tar.zst" >> $GITHUB_ENV + - name: Install dependencies run: > brew install cmake ninja ccache xerces-c - && wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.zst ${{ env.DEPENDENCY_URL }} - && mkdir ${{ env.DEPENDENCY_DIR }} - && tar -xf deps.tar.zst -C ${{ env.DEPENDENCY_DIR }} - && PATH="${{ env.DEPENDENCY_DIR }}/bin:$PATH" - && python3 -m pip install pyyaml jinja2 + && CI/dependencies.sh - name: Restore ccache 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: > ccache -z - && PATH="${{ env.DEPENDENCY_DIR }}/bin:$PATH" && cmake -B build -S . --preset=github-ci -DCMAKE_PREFIX_PATH="${{ env.DEPENDENCY_DIR }}" - -DPython_EXECUTABLE=${{ env.DEPENDENCY_DIR }}/bin/python3 -DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" + -DPython_EXECUTABLE=$(which python3) + - name: Build run: cmake --build build + - name: ccache stats run: ccache -s + - name: Save ccache uses: actions/cache/save@v4 if: always() with: path: ${{ github.workspace }}/ccache key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - name: Unit tests run: cmake --build build --target test + - name: Integration tests run: cmake --build build --target integrationtests + - name: Install run: cmake --build build --target install + - uses: actions/upload-artifact@v4 with: name: acts-macos path: ${{ env.INSTALL_DIR }} + - name: Downstream configure run: > - PATH="${{ env.DEPENDENCY_DIR }}/bin:$PATH" - && cmake -B build-downstream -S Tests/DownstreamProject + cmake -B build-downstream -S Tests/DownstreamProject -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_CXX_STANDARD=20 -DCMAKE_PREFIX_PATH="${INSTALL_DIR}" + - name: Downstream build run: cmake --build build-downstream + - name: Downstream run run: > PATH="${{ env.DEPENDENCY_DIR }}/bin:$PATH" diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 5686d842b66..edd31d051a4 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -116,6 +116,16 @@ jobs: - name: Check run: > CI/check_spelling + math_macros: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Check + run: > + CI/check_math_macros.py . --exclude "thirdparty/*" missing_includes: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index f7dfa2bdb97..1c0fc64ff27 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -23,6 +23,8 @@ jobs: - name: "Checkout repository" uses: actions/checkout@v4 + with: + fetch-depth: 0 # To prevent shallow clone - name: 'Download artifact' uses: actions/github-script@v7 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 843980dd82a..b0a213e607d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1,14 @@ 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: v5 + clang_tidy: stage: build - image: ghcr.io/acts-project/ubuntu2404:58 + image: ghcr.io/acts-project/ubuntu2404:63 tags: - large artifacts: @@ -14,6 +16,8 @@ clang_tidy: - src/clang-tidy/ when: always expire_in: 1 week + variables: + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.$DEPENDENCY_TAG.tar.zst script: - git clone $CLONE_URL src - cd src @@ -24,19 +28,21 @@ clang_tidy: && ln -sf /usr/bin/clang++-18 /usr/bin/clang++ && ln -sf /usr/bin/clang-18 /usr/bin/clang && ln -sf /usr/bin/clang-tidy-18 /usr/bin/clang-tidy + + - source CI/dependencies.sh + - > cmake -B build -S . --preset=gitlab-ci-clangtidy -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang - -DACTS_RUN_CLANG_TIDY=ON - -DACTS_BUILD_ODD=OFF + -DPython_EXECUTABLE=$(which python3) # Main clang-tidy run during cmake compilation - CI/clang_tidy/run_clang_tidy.sh clang-tidy build # Install dependencies for processing scripts - - pip install -r CI/clang_tidy/requirements.txt + - python3 -m pip install -r CI/clang_tidy/requirements.txt # Parse the main clang-tidy run - > @@ -55,14 +61,19 @@ clang_tidy: build_exatrkx_cpu: stage: build - image: ghcr.io/acts-project/ubuntu2204_exatrkx:58 + image: ghcr.io/acts-project/ubuntu2204_exatrkx:63 + variables: + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.$DEPENDENCY_TAG.tar.zst tags: - 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 @@ -72,28 +83,35 @@ build_exatrkx_cpu: - git clone $CLONE_URL src - cd src - git checkout $HEAD_SHA + - source CI/dependencies.sh - cd .. - mkdir build - # Here we only do a minimal build without examples to save ressources + # Here we only do a minimal build without examples to save resources - > cmake -B build -S src --preset=gitlab-ci-exatrkx + -DPython_EXECUTABLE=$(which python3) -DACTS_EXATRKX_ENABLE_CUDA=OFF - ccache -z - - cmake --build build -- -j2 + - cmake --build build -- -j6 - ccache -s build_exatrkx: stage: build - image: ghcr.io/acts-project/ubuntu2204_exatrkx:58 + image: ghcr.io/acts-project/ubuntu2204_exatrkx:63 + variables: + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.$DEPENDENCY_TAG.tar.zst tags: - 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: @@ -111,22 +129,24 @@ build_exatrkx: - git clone $CLONE_URL src - cd src - git checkout $HEAD_SHA + - source CI/dependencies.sh - cd .. - mkdir build - > cmake -B build -S src --preset=gitlab-ci-exatrkx + -DPython_EXECUTABLE=$(which python3) -DCMAKE_CUDA_ARCHITECTURES="75;86" - ccache -z - - cmake --build build -- -j2 + - cmake --build build -- -j6 - ccache -s # test_exatrkx_unittests: # stage: test # needs: # - build_exatrkx -# image: ghcr.io/acts-project/ubuntu2204_exatrkx:58 +# image: ghcr.io/acts-project/ubuntu2204_exatrkx:63 # tags: # - docker-gpu-nvidia # script: @@ -136,7 +156,7 @@ build_exatrkx: # stage: test # needs: # - build_exatrkx -# image: ghcr.io/acts-project/ubuntu2204_exatrkx:58 +# image: ghcr.io/acts-project/ubuntu2204_exatrkx:63 # tags: # - docker-gpu-nvidia # script: @@ -146,19 +166,23 @@ build_exatrkx: # - git clone $CLONE_URL src # - cd src # - git checkout $HEAD_SHA -# - pip3 install -r Examples/Python/tests/requirements_ubuntu2004.txt +# - pip3 install -r Examples/Python/tests/requirements.txt # - nvidia-smi # - pytest -rFsv -k test_exatrkx build_linux_ubuntu: stage: build - image: ghcr.io/acts-project/ubuntu2404:58 + image: ghcr.io/acts-project/ubuntu2404:63 + variables: + 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: @@ -177,21 +201,25 @@ build_linux_ubuntu: - git checkout $HEAD_SHA - git submodule init - git submodule update + - source CI/dependencies.sh - cd .. - mkdir build - > cmake -B build -S src --preset=gitlab-ci + -DPython_EXECUTABLE=$(which python3) -DACTS_BUILD_PLUGIN_ONNX=ON - ccache -z - - cmake --build build -- -j2 + - cmake --build build -- -j6 - ccache -s linux_test_examples: stage: test - image: ghcr.io/acts-project/ubuntu2404:58 + image: ghcr.io/acts-project/ubuntu2404:63 + variables: + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.$DEPENDENCY_TAG.tar.zst needs: [build_linux_ubuntu] script: @@ -202,17 +230,20 @@ linux_test_examples: - git checkout $HEAD_SHA - git submodule init - git submodule update + - source CI/dependencies.sh - cd .. - - /usr/local/bin/geant4-config --install-datasets + - geant4-config --install-datasets - source build/this_acts_withdeps.sh - cd src - - pip3 install -r Examples/Python/tests/requirements.txt + - python3 -m pip install -r Examples/Python/tests/requirements.txt - pytest -rFsv -k "not exatrkx" -v -s linux_physmon: stage: test - image: ghcr.io/acts-project/ubuntu2404:58 + image: ghcr.io/acts-project/ubuntu2404:63 + variables: + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-24.04/deps.$DEPENDENCY_TAG.tar.zst needs: [build_linux_ubuntu] artifacts: @@ -229,13 +260,19 @@ linux_physmon: - git checkout $HEAD_SHA - git submodule init - git submodule update + - source CI/dependencies.sh - cd .. - git config --global safe.directory "$GITHUB_WORKSPACE" - - pip3 install histcmp==0.6.7 matplotlib - - pip3 install -r src/Examples/Scripts/requirements.txt - - /usr/local/bin/geant4-config --install-datasets + - python3 -m pip install histcmp==0.6.8 matplotlib + - python3 -m pip install -r src/Examples/Scripts/requirements.txt + - geant4-config --install-datasets + - venv_python=$(which python3) + - echo $venv_python - source build/this_acts_withdeps.sh + - export PATH=$(dirname $venv_python):$PATH + - echo $PATH + - which python3 - cd src - CI/physmon/phys_perf_mon.sh all physmon @@ -243,17 +280,19 @@ linux_physmon: ### UBUNTU EXTRA JOB MATRIX ### ############################### -.linux_ubuntu_extra: &linux_ubuntu_extra +.linux_ubuntu_extra: variables: INSTALL_DIR: ${CI_PROJECT_DIR}/install 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 @@ -262,16 +301,18 @@ linux_physmon: - git checkout $HEAD_SHA - git submodule init - git submodule update + - source CI/dependencies.sh - cd .. - mkdir build - > cmake -B build -S src --preset=gitlab-ci + -DPython_EXECUTABLE=$(which python3) -DCMAKE_CXX_STANDARD=${CXXSTD} - ccache -z - - cmake --build build -- -j2 + - cmake --build build -- -j6 - ccache -s - ctest --test-dir build -j$(nproc) @@ -295,25 +336,27 @@ linux_physmon: # Downstream run - ./build-downstream/bin/ShowActsVersion -linux_ubuntu_2404: - <<: *linux_ubuntu_extra +linux_ubuntu_2204: + extends: .linux_ubuntu_extra variables: CXXSTD: 20 - image: ghcr.io/acts-project/ubuntu2404:58 + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.$DEPENDENCY_TAG.tar.zst + image: ghcr.io/acts-project/ubuntu2204:63 linux_ubuntu_2204_clang: - <<: *linux_ubuntu_extra + extends: .linux_ubuntu_extra variables: CXXSTD: 20 - image: ghcr.io/acts-project/ubuntu2204_clang:58 + DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.$DEPENDENCY_TAG.tar.zst + image: ghcr.io/acts-project/ubuntu2204_clang:63 ###################### ### LCG JOB MATRIX ### ###################### -.lcg: &lcg_base_job - image: ghcr.io/acts-project/${OS}-base:58 +.lcg_base_job: + image: ghcr.io/acts-project/${OS}-base:63 stage: build tags: - cvmfs @@ -325,10 +368,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}"' @@ -364,17 +409,18 @@ linux_ubuntu_2204_clang: cmake -B build -S src --preset=gitlab-ci -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" + -DPython_EXECUTABLE=$(which python3) -DACTS_BUILD_PLUGIN_GEOMODEL=OFF # GeoModel is not in LCG at this point - ccache -z - - cmake --build build -- -j2 + - cmake --build build -- -j6 - ccache -s - ctest --test-dir build -j$(nproc) lcg_105: - <<: *lcg_base_job + extends: .lcg_base_job variables: LCG_VERSION: "105" diff --git a/.kodiak.toml b/.kodiak.toml index b5be47df1ee..651905f7ce0 100644 --- a/.kodiak.toml +++ b/.kodiak.toml @@ -2,7 +2,7 @@ version = 1 merge.message.title = "pull_request_title" merge.message.body = "pull_request_body" -merge.message.cut_body_before = "--- BEGIN COMMIT MESSAGE ---" +merge.message.cut_body_after = "--- END COMMIT MESSAGE ---" merge.message.cut_body_and_text = true merge.method = "squash" merge.message.include_coauthors = true diff --git a/.merge-sentinel.yml b/.merge-sentinel.yml index f62cdb682ce..1394407a063 100644 --- a/.merge-sentinel.yml +++ b/.merge-sentinel.yml @@ -14,6 +14,7 @@ rules: required_checks: - Docs / docs - Analysis / build_debug + - SonarCloud Code Analysis required_pattern: - "Builds / *" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9000c17f6e9..68c78341c5d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,3 +28,76 @@ repos: hooks: - id: gersemi args: ["-i", "--no-warn-about-unknown-commands"] + + - repo: https://github.com/codespell-project/codespell + rev: v2.2.4 + hooks: + - id: codespell + args: [ + "-S", "*.ipynb,*.onnx,_build,*.svg", + "-I", "./CI/codespell_ignore.txt" + ] + exclude: ^CI/.*$ + + - repo: local + hooks: + - id: license + name: license + language: system + entry: CI/check_license.py --fix + files: \.(cpp|hpp|ipp|cu|cuh)$ + + - repo: local + hooks: + - id: include_guards + name: include_guards + language: system + entry: CI/check_include_guards.py --fail-global + files: \.hpp$ + + - repo: local + hooks: + - id: pragma_once + name: pragma_once + language: system + entry: CI/check_pragma_once.sh + files: \.hpp$ + + - repo: local + hooks: + - id: type_t + name: type_t + language: system + entry: CI/check_type_t.py + files: \.(cpp|hpp|ipp|cu|cuh)$ + + - repo: local + hooks: + - id: boost_test + name: boost_test + language: system + entry: CI/check_boost_test_macro.sh + files: ^Tests\/.*\.(cpp|hpp|ipp|cu|cuh)$ + + - repo: local + hooks: + - id: cmake_options + name: cmake_options + 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 + + - repo: local + hooks: + - id: math_macros + name: math_macros + language: system + entry: CI/check_math_macros.py + files: \.(cpp|hpp|ipp|cu|cuh)$ diff --git a/Alignment/include/ActsAlignment/Kernel/Alignment.hpp b/Alignment/include/ActsAlignment/Kernel/Alignment.hpp index 0d0a524f7bb..2a14da18476 100644 --- a/Alignment/include/ActsAlignment/Kernel/Alignment.hpp +++ b/Alignment/include/ActsAlignment/Kernel/Alignment.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020-2021 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -149,7 +149,7 @@ struct Alignment { /// @tparam fit_options_t The fit options type /// /// @param gctx The current geometry context object - /// @param sourcelinks The fittable uncalibrated measurements + /// @param sourceLinks The fittable uncalibrated measurements /// @param sParameters The initial track parameters /// @param fitOptions The fit Options steering the fit /// @param idxedAlignSurfaces The idxed surfaces to be aligned @@ -161,7 +161,7 @@ struct Alignment { typename fit_options_t> Acts::Result evaluateTrackAlignmentState( const Acts::GeometryContext& gctx, - const std::vector& sourcelinks, + const std::vector& sourceLinks, const start_parameters_t& sParameters, const fit_options_t& fitOptions, const std::unordered_map& idxedAlignSurfaces, diff --git a/Alignment/include/ActsAlignment/Kernel/Alignment.ipp b/Alignment/include/ActsAlignment/Kernel/Alignment.ipp index 9e11bdbb09d..09170ee9ca9 100644 --- a/Alignment/include/ActsAlignment/Kernel/Alignment.ipp +++ b/Alignment/include/ActsAlignment/Kernel/Alignment.ipp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020-2021 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/EventData/VectorMultiTrajectory.hpp" #include "Acts/EventData/VectorTrackContainer.hpp" @@ -15,7 +15,7 @@ template ActsAlignment::Alignment::evaluateTrackAlignmentState( const Acts::GeometryContext& gctx, - const std::vector& sourcelinks, + const std::vector& sourceLinks, const start_parameters_t& sParameters, const fit_options_t& fitOptions, const std::unordered_map& idxedAlignSurfaces, @@ -24,8 +24,8 @@ ActsAlignment::Alignment::evaluateTrackAlignmentState( Acts::VectorMultiTrajectory{}}; // Convert to Acts::SourceLink during iteration - Acts::SourceLinkAdapterIterator begin{sourcelinks.begin()}; - Acts::SourceLinkAdapterIterator end{sourcelinks.end()}; + Acts::SourceLinkAdapterIterator begin{sourceLinks.begin()}; + Acts::SourceLinkAdapterIterator end{sourceLinks.end()}; // Perform the fit auto fitRes = m_fitter.fit(begin, end, sParameters, fitOptions, tracks); @@ -82,13 +82,13 @@ void ActsAlignment::Alignment::calculateAlignmentParameters( alignResult.numTracks = trajectoryCollection.size(); double sumChi2ONdf = 0; for (unsigned int iTraj = 0; iTraj < trajectoryCollection.size(); iTraj++) { - const auto& sourcelinks = trajectoryCollection.at(iTraj); + const auto& sourceLinks = trajectoryCollection.at(iTraj); const auto& sParameters = startParametersCollection.at(iTraj); // Set the target surface fitOptionsWithRefSurface.referenceSurface = &sParameters.referenceSurface(); // The result for one single track auto evaluateRes = evaluateTrackAlignmentState( - fitOptions.geoContext, sourcelinks, sParameters, + fitOptions.geoContext, sourceLinks, sParameters, fitOptionsWithRefSurface, alignResult.idxedAlignSurfaces, alignMask); if (!evaluateRes.ok()) { ACTS_DEBUG("Evaluation of alignment state for track " << iTraj diff --git a/Alignment/include/ActsAlignment/Kernel/AlignmentError.hpp b/Alignment/include/ActsAlignment/Kernel/AlignmentError.hpp index 88cae792a8f..9f77022929e 100644 --- a/Alignment/include/ActsAlignment/Kernel/AlignmentError.hpp +++ b/Alignment/include/ActsAlignment/Kernel/AlignmentError.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Alignment/include/ActsAlignment/Kernel/AlignmentMask.hpp b/Alignment/include/ActsAlignment/Kernel/AlignmentMask.hpp index 735f7de86fb..f3849589152 100644 --- a/Alignment/include/ActsAlignment/Kernel/AlignmentMask.hpp +++ b/Alignment/include/ActsAlignment/Kernel/AlignmentMask.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2019 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp index 64e7f9c0eb7..1bb21fdc8bd 100644 --- a/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp +++ b/Alignment/include/ActsAlignment/Kernel/detail/AlignmentEngine.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020-2021 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Alignment/src/Kernel/detail/AlignmentEngine.cpp b/Alignment/src/Kernel/detail/AlignmentEngine.cpp index c5c012d08d7..23ff0b14433 100644 --- a/Alignment/src/Kernel/detail/AlignmentEngine.cpp +++ b/Alignment/src/Kernel/detail/AlignmentEngine.cpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020-2021 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "ActsAlignment/Kernel/detail/AlignmentEngine.hpp" diff --git a/CI/check_boost_test_macro.sh b/CI/check_boost_test_macro.sh index d8f4e25c651..2af7b85f1ec 100755 --- a/CI/check_boost_test_macro.sh +++ b/CI/check_boost_test_macro.sh @@ -1,14 +1,21 @@ #!/bin/bash +files="$@" + +if [ -z "$files" ]; then + files=$(find Tests -name "*.hpp" -or -name "*.cpp" -or -name "*.ipp") +fi + test_string="BOOST_TEST(" -grep $test_string -n -r Tests --include "*.cpp" --include "*.hpp" --include "*.ipp" -status=$? +ec=0 +for file in $files; do + grep -n "$test_string" "$file" + status=$? + if [ $status -ne 1 ]; then + echo "Found occurrences of '$test_string' in '$file'" + ec=1 + fi +done -if [[ $status -eq 0 ]]; then - echo "Found occurrences of '$test_string'" - exit 1 -else - echo "Did not find occurrences of '$test_string'" - exit 0 -fi +exit $ec diff --git a/CI/check_include_guards.py b/CI/check_include_guards.py index 146322b3bda..0489c065b44 100755 --- a/CI/check_include_guards.py +++ b/CI/check_include_guards.py @@ -75,7 +75,7 @@ def main(): input_help = """ Input files: either file path, dir path (will glob for headers) or custom glob pattern """ - p.add_argument("input", help=input_help.strip()) + p.add_argument("input", nargs="+", help=input_help.strip()) p.add_argument( "--fail-local", "-l", action="store_true", help="Fail on local include guards" ) @@ -90,15 +90,20 @@ def main(): headers = [] - if os.path.isfile(args.input): - headers = [args.input] - elif os.path.isdir(args.input): - patterns = ["**/*.hpp", "**/*.h"] - headers = sum( - [glob(os.path.join(args.input, p), recursive=True) for p in patterns], [] - ) - else: - headers = glob(args.input, recursive=True) + if len(args.input) == 1: + if os.path.isdir(args.input[0]): + patterns = ["**/*.hpp", "**/*.h"] + headers = sum( + [ + glob(os.path.join(args.input[0], p), recursive=True) + for p in patterns + ], + [], + ) + else: + headers = glob(args.input[0], recursive=True) + elif all([os.path.isfile(i) for i in args.input]): + headers = args.input valid = True nlocal = 0 diff --git a/CI/check_license.py b/CI/check_license.py index 2a7453e56b5..68296ae6f0e 100755 --- a/CI/check_license.py +++ b/CI/check_license.py @@ -32,90 +32,29 @@ def err(string): return string -class CommitInfo: - date = None - year = None - author = None - subject = None - body = None - - -def check_git_dates(src): - output = ( - check_output(["git", "log", "--format={{{%an|%ad|%s|%b}}}", "--", src]) - .decode("utf-8") - .strip() - ) - - # find single outputs - commits = re.findall(r"{{{((?:.|\n)*?)}}}", output) - commits = [c for c in commits if "[ignore-license]" not in c] - commits = [c.split("|") for c in commits] - - # print(output) - mod = commits[0] - add = commits[-1] - - madd = re.match(r".*\d{2}:\d{2}:\d{2} (\d{4})", add[1]) - assert madd != None, "Regex did not match git log output" - mmod = re.match(r".*\d{2}:\d{2}:\d{2} (\d{4})", mod[1]) - assert mmod != None, "Regex did not match git log output" - - addcommit = CommitInfo() - addcommit.date = add[1] - addcommit.year = int(madd.group(1)) - addcommit.author = add[0] - addcommit.subject = add[2] - addcommit.body = add[3] - - modcommit = CommitInfo() - modcommit.date = mod[1] - modcommit.year = int(mmod.group(1)) - modcommit.author = mod[0] - modcommit.subject = mod[2] - modcommit.body = mod[3] - - return addcommit, modcommit - - def main(): p = argparse.ArgumentParser() - p.add_argument("input") + p.add_argument("input", nargs="+") p.add_argument( "--fix", action="store_true", help="Attempt to fix any license issues found." ) - p.add_argument( - "--check-years", - action="store_true", - help="Check the license year info using git info for each file.", - ) - p.add_argument( - "--fail-year-mismatch", - action="store_true", - help="Fail if year in license statement is not valid.", - ) p.add_argument("--exclude", "-e", action="append", default=EXCLUDE) args = p.parse_args() print(args.exclude) - if os.path.isdir(args.input): + extensions = ["cpp", "hpp", "ipp", "cuh", "cu", "C", "h"] + + if len(args.input) == 1 and os.path.isdir(args.input[0]): + find_command = ["find", args.input[0]] + for ext in extensions: + find_command.extend(["-iname", f"*.{ext}", "-or"]) + # Remove the last "-or" for a valid command + find_command = find_command[:-1] + srcs = ( str( - check_output( - [ - "find", - args.input, - "-iname", - "*.cpp", - "-or", - "-iname", - "*.hpp", - "-or", - "-iname", - "*.ipp", - ] - ), + check_output(find_command), "utf-8", ) .strip() @@ -123,32 +62,32 @@ def main(): ) srcs = filter(lambda p: not p.startswith("./build"), srcs) else: - srcs = [args.input] + srcs = args.input - year = int(datetime.now().strftime("%Y")) + founding_year = 2016 + year_str = f"{founding_year}" + year = year_str - raw = """// This file is part of the Acts project. + raw = """// This file is part of the ACTS project. // -// Copyright (C) {year} CERN for the benefit of the Acts project +// Copyright (C) {year} 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 http://mozilla.org/MPL/2.0/.""" +// file, You can obtain one at https://mozilla.org/MPL/2.0/.""" reg = ( - r"\A// This file is part of the Acts project.\n" + r"\A// This file is part of the ACTS project.\n" + r"//\n" - + r"// Copyright \(C\) (?P.*) CERN for the benefit of the Acts project\n" + + r"// Copyright \(C\) (?P.*) CERN for the benefit of the ACTS project\n" + r"//\n" + r"// This Source Code Form is subject to the terms of the Mozilla Public\n" + r"// License, v\. 2\.0\. If a copy of the MPL was not distributed with this\n" - + r"// file, You can obtain one at http://mozilla.org/MPL/2.0/.\Z" + + r"// file, You can obtain one at https://mozilla.org/MPL/2.0/.\Z" ) ref = re.compile(reg, re.M) clean_re = re.compile(r"(\(C\)) (.*) (CERN)", re.M) - year_re = re.compile(r"^(?P20\d{2}|(?P20\d{2})-(?P20\d{2}))$") - extract_re = re.compile(r"(20\d{2})-?(20\d{2})?") def clean(s): return clean_re.sub(r"\1 XXXX \3", s) @@ -156,54 +95,33 @@ def clean(s): def get_clean_lines(s): return [clean(l) + "\n" for l in s.split("\n")] - def validate_years(year1, year2): - if year1 and year2: - year1 = int(year1) - year2 = int(year2) - if year1 >= year2: - return False - if year1 > year or year2 > year: - return False - else: - theyear = int(year1 if year1 else year2) - if theyear > year: - return False - return True - error_summary = "" - info_summary = "" - def eprint(*args): + def eprint(string): nonlocal error_summary - error_summary += " ".join(map(str, args)) + "\n" - - def year_print(*pargs): - nonlocal error_summary - nonlocal info_summary - string = " ".join(map(str, pargs)) + "\n" - if args.fail_year_mismatch: - error_summary += string - else: - info_summary += string + error_summary += string + "\n" exit = 0 srcs = list(srcs) nsrcs = len(srcs) - step = int(nsrcs / 20) + step = max(int(nsrcs / 20), 1) + # Iterate over all files for i, src in enumerate(srcs): if any([fnmatch(src, e) for e in args.exclude]): continue + # Print progress if nsrcs > 1 and i % step == 0: - string = "{}/{} -> {:.2f}%".format(i, nsrcs, i / float(nsrcs) * 100.0) + string = f"{i}/{nsrcs} -> {i / float(nsrcs) * 100.0:.2f}%" if sys.stdout.isatty(): sys.stdout.write(string + "\r") else: print(string) + # Read the header with open(src, "r+") as f: license = "" - for x in range(len(raw)): + for _ in range(len(raw)): line = f.readline() if not line.startswith("//"): break @@ -211,192 +129,56 @@ def year_print(*pargs): license = ("".join(license)).strip() m = ref.search(license) - if m == None: + # License could not be found in header + if m is None: eprint("Invalid / missing license in " + src + "") - exp = [l + "\n" for l in raw.format(year="XXXX").split("\n")] + exp = [l + "\n" for l in raw.format(year=year_str).split("\n")] act = get_clean_lines(license) diff = difflib.unified_diff(exp, act) eprint("".join(diff)) - eprint() + eprint("") if args.fix: eprint("-> fixing file (prepend)") f.seek(0) file_content = f.read() f.seek(0) - stmnt = raw.format(year=year) + stmnt = raw.format(year=year_str) f.write(stmnt + "\n\n") f.write(file_content) exit = 1 - else: - # we have a match, need to verify year string is right - - if args.check_years: - git_add_commit, git_mod_commit = check_git_dates(src) - git_add_year = git_add_commit.year - git_mod_year = git_mod_commit.year - year_act = m.group("year") - ym = year_re.match(year_act) - valid = True - if not ym: - eprint("Year string does not match format in {}".format(src)) - eprint("Expected: YYYY or YYYY-YYYY (year or year range)") - eprint("Actual: {}\n".format(year_act)) - - if args.fix: - extract = extract_re.search(year_act) - year1 = extract.group(1) - year2 = extract.group(2) - - exit = 1 - valid = False - - else: - extract = extract_re.search(year_act) - year1 = extract.group(1) - year2 = extract.group(2) - - if not validate_years(year1, year2): - eprint("Year string is not valid in {}".format(src)) - eprint("Year string is: " + year_act + "\n") - exit = 1 - valid = False - - if args.check_years: - if git_add_year != git_mod_year: - # need year range in licence - if not (year1 and year2): - year_print("File: {}".format(src)) - # year_print("o File was modified in a different year ({}) than it was added ({})." - # .format(git_mod_year, git_add_year)) - year_print( - "- File was added in {}".format(git_add_year) - ) - year_print( - "- File was modified on {} by {}:\n{}".format( - git_mod_commit.date, - git_mod_commit.author, - git_mod_commit.subject + git_mod_commit.body, - ) - ) - year_print( - "=> License should say {}-{}".format( - git_add_year, git_mod_year - ) - ) - - act_year = year1 if year1 else year2 - year_print( - err( - "{} But says: {}".format(CROSS_SYMBOL, act_year) - ) - ) - - if args.fail_year_mismatch: - exit = 1 - year_print("\n") - else: - year_print("This is not treated as an error\n") - valid = False - else: - if ( - int(year1) != git_add_year - or int(year2) != git_mod_year - ): - year_print("File: {}".format(src)) - year_print( - "Year range {}-{} does not match range from git {}-{}".format( - year1, year2, git_add_year, git_mod_year - ) - ) - year_print( - "- File was added in {}".format(git_add_year) - ) - year_print( - "- File was modified on {} by {}:\n{}".format( - git_mod_commit.date, - git_mod_commit.author, - git_mod_commit.subject - + git_mod_commit.body, - ) - ) - year_print( - "=> License should say {}-{}".format( - git_add_year, git_mod_year - ) - ) - year_print( - err( - "{} But says: {}-{}".format( - CROSS_SYMBOL, year1, year2 - ) - ) - ) - if args.fail_year_mismatch: - exit = 1 - year_print("\n") - else: - year_print("This is not treated as an error\n") - valid = False - - else: - if int(year1) < git_mod_year: - year_print("File: {}".format(src)) - year_print( - "- Year {} does not match git modification year {}".format( - year1, git_mod_year - ) - ) - year_print( - "- File was modified on {} by {}:\n{}".format( - git_mod_commit.date, - git_mod_commit.author, - git_mod_commit.subject + git_mod_commit.body, - ) - ) - year_print( - "=> License should say {}".format(git_mod_year) - ) - year_print( - err("{} But says: {}".format(CROSS_SYMBOL, year1)) - ) - if args.fail_year_mismatch: - exit = 1 - year_print("\n") - else: - year_print("This is not treated as an error\n") - valid = False - - if args.fix and not valid: + continue + + # We have a match, need to verify year string is right + year_act = m.group("year") + if year_act != year_str: + exit = 1 + + eprint(f"File: {src}") + eprint(f"=> License should say {year_str}") + eprint(err(f"{CROSS_SYMBOL} But says: {year_act}")) + + if args.fix: eprint("-> fixing file (patch year)") - year_str = "2016-{}".format(year) - if args.check_years: - if git_add_year == git_mod_year: - year_str = "{}".format(git_add_year) - else: - year_str = "{}-{}".format(git_add_year, git_mod_year) + new_license = raw.format(year=year_str) # preserve rest of file as is - if args.check_years: - old_license_len = len(license) - f.seek(old_license_len) - file_body = f.read() - f.seek(0) - f.truncate() + old_license_len = len(license) + f.seek(old_license_len) + file_body = f.read() + f.seek(0) + f.truncate() f.seek(0) f.write(new_license) + f.write(file_body) - if args.check_years: - f.write(file_body) + eprint("") - print("\n--- INFO ---\n") - print(info_summary) - print("\n--- ERROR ---\n") print(error_summary) if exit != 0 and not args.fix: diff --git a/CI/check_math_macros.py b/CI/check_math_macros.py new file mode 100755 index 00000000000..29da233372e --- /dev/null +++ b/CI/check_math_macros.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 + +from pathlib import Path +import os +import argparse +from fnmatch import fnmatch +import re +import sys + + +math_constants = [ + ("M_PI", "std::numbers::pi"), + ("M_PI_2", "std::numbers::pi / 2."), + ("M_PI_4", "std::numbers::pi / 4."), + ("M_1_PI", "std::numbers::inv_pi"), + ("M_2_PI", "2. * std::numbers::inv_pi"), + ("M_2_SQRTPI", "2. * std::numbers::inv_sqrtpi"), + ("M_E", "std::numbers::e"), + ("M_LOG2E", "std::numbers::log2e"), + ("M_LOG10E", "std::numbers::log10e"), + ("M_LN2", "std::numbers::ln2"), + ("M_LN10", "std::numbers::ln10"), + ("M_SQRT2", "std::numbers::sqrt2"), + ("M_SQRT1_2", "1. / std::numbers::sqrt2"), + ("M_SQRT3", "std::numbers::sqrt3"), + ("M_INV_SQRT3", "std::numbers::inv_sqrt3"), + ("M_EGAMMA", "std::numbers::egamma"), + ("M_PHI", "std::numbers::phi"), +] + + +github = "GITHUB_ACTIONS" in os.environ + + +def handle_file( + file: Path, fix: bool, math_const: tuple[str, str] +) -> list[tuple[int, str]]: + ex = re.compile(rf"(? 0: + changed_lines.append((i, oline)) + + if fix and len(changed_lines) > 0: + file.write_text("\n".join(lines) + "\n") + + return changed_lines + + +def main(): + p = argparse.ArgumentParser() + p.add_argument("input", nargs="+") + p.add_argument("--fix", action="store_true", help="Attempt to fix M_* macros.") + p.add_argument("--exclude", "-e", action="append", default=[]) + + args = p.parse_args() + + exit_code = 0 + + inputs = [] + + if len(args.input) == 1 and os.path.isdir(args.input[0]): + # walk over all files + for root, _, files in os.walk(args.input[0]): + 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 + + inputs.append(filepath) + else: + for file in args.input: + inputs.append(Path(file)) + + for filepath in inputs: + for math_const in math_constants: + changed_lines = handle_file( + file=filepath, fix=args.fix, math_const=math_const + ) + if len(changed_lines) > 0: + exit_code = 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 macro {math_const[0]}::Replace {math_const[0]} with std::{math_const[1]}" + ) + + if exit_code == 1 and github: + print(f"::info You will need in each flagged file #include ") + + return exit_code + + +if "__main__" == __name__: + sys.exit(main()) diff --git a/CI/check_pragma_once.sh b/CI/check_pragma_once.sh index baafd9cfc28..9333367dcda 100755 --- a/CI/check_pragma_once.sh +++ b/CI/check_pragma_once.sh @@ -2,7 +2,13 @@ ec=0 -for file in $(find Core Examples Tests Plugins -name "*.hpp"); do +files="$@" + +if [ -z "$files" ]; then + files=$(find Core Examples Tests Plugins -name "*.hpp") +fi + +for file in $files; do res=$(grep -e "^[[:space:]]*#pragma once" $file) if [[ "$res" != "#pragma once" ]]; then ec=1 diff --git a/CI/check_smearing_config.py b/CI/check_smearing_config.py index b3b9ad0d4c8..629095976ea 100755 --- a/CI/check_smearing_config.py +++ b/CI/check_smearing_config.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 -# This file is part of the Acts project. +# This file is part of the ACTS project. # -# Copyright (C) 2021 CERN for the benefit 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 http:#mozilla.org/MPL/2.0/. +# file, You can obtain one at https://mozilla.org/MPL/2.0/. # Configuration taken from: https://arxiv.org/pdf/1904.06778.pdf # See also https://github.com/acts-project/acts/issues/946 diff --git a/CI/check_type_t.py b/CI/check_type_t.py index b7fa05fd274..793b91274ea 100755 --- a/CI/check_type_t.py +++ b/CI/check_type_t.py @@ -48,7 +48,7 @@ def handle_file(file: Path, fix: bool, c_type: str) -> list[tuple[int, str]]: def main(): p = argparse.ArgumentParser() - p.add_argument("input") + p.add_argument("input", nargs="+") p.add_argument("--fix", action="store_true", help="Attempt to fix C-style types.") p.add_argument("--exclude", "-e", action="append", default=[]) @@ -56,40 +56,49 @@ def main(): exit_code = 0 - # walk over all files - 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 - - for c_type in type_list: - changed_lines = handle_file(file=filepath, fix=args.fix, c_type=c_type) - if len(changed_lines) > 0: - exit_code = 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 {c_type}::Replace {c_type} with std::{c_type}" - ) + inputs = [] + + if len(args.input) == 1 and os.path.isdir(args.input[0]): + # walk over all files + for root, _, files in os.walk(args.input[0]): + 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 + + inputs.append(filepath) + else: + for file in args.input: + inputs.append(Path(file)) + + for filepath in inputs: + for c_type in type_list: + changed_lines = handle_file(file=filepath, fix=args.fix, c_type=c_type) + if len(changed_lines) > 0: + exit_code = 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 {c_type}::Replace {c_type} with std::{c_type}" + ) return exit_code diff --git a/CI/check_unused_files.py b/CI/check_unused_files.py index 420ba932d14..c1f099d672a 100755 --- a/CI/check_unused_files.py +++ b/CI/check_unused_files.py @@ -41,8 +41,6 @@ def main(): ".gitignore", "README.md", "CMakeLists.txt", - "DetUtils.h", - "CommandLineArguments.h", # Filename not completed in source "vertexing_event_mu20_beamspot.csv", "vertexing_event_mu20_tracks.csv", diff --git a/CI/codespell_ignore.txt b/CI/codespell_ignore.txt index e95603fc5b5..13a3328440f 100644 --- a/CI/codespell_ignore.txt +++ b/CI/codespell_ignore.txt @@ -22,3 +22,5 @@ dthe dthe vart pixelx +millepede +dependees diff --git a/CI/dependencies.sh b/CI/dependencies.sh new file mode 100755 index 00000000000..7c8879b499e --- /dev/null +++ b/CI/dependencies.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +function run() { + set -x + "$@" + { set +x; } 2> /dev/null +} + +function set_env { + key="$1" + value="$2" + + echo "=> ${key}=${value}" + + if [ -n "${GITHUB_ACTIONS:-}" ]; then + echo "${key}=${value}" >> $GITHUB_ENV + else + export ${key}=${value} + fi +} + +url=${1:-${DEPENDENCY_URL:-}} + +if [ -n "${GITHUB_ACTIONS:-}" ]; then + destination="${GITHUB_WORKSPACE}/dependencies" +elif [ -n "${GITLAB_CI:-}" ];then + destination="${CI_PROJECT_DIR}/dependencies" +else + destination=${2} +fi + +set_env DEPENDENCY_DIR "${destination}" + +if [ -z "${url}" ]; then + echo "url is not set" + exit 1 +fi + +echo "URL: $url" +echo "DESTINATION: $destination" + +# check curl location +CURL=$(command -v curl) +if [ -z "$CURL" ]; then + echo "curl is not available" + exit 1 +fi + +UNZSTD=$(command -v unzstd) +if [ -z "$UNZSTD" ]; then + echo "unzstd is not available" + exit 1 +fi + +TAR=$(command -v tar) +if [ -z "$TAR" ]; then + echo "tar is not available" + exit 1 +fi + +run mkdir -p "${destination}" + +run $CURL \ + --retry 5 \ + --connect-timeout 2 \ + --location $url \ + | unzstd \ + | tar \ + -x \ + --strip-components=1 \ + --directory "${destination}" + +# Patch up geant4-config data install script +out=$(${destination}/bin/geant4-config --datasets) +line=$(echo "$out" | head -n1) +orig_share=$(echo "$line" | perl -pe 's|.*?(\/.*)\/share.*|\1|') +orig_share_escaped=$(echo $orig_share|perl -pe 's|/|\\/|g') +destination_escaped=$(echo "$destination"|perl -pe 's|/|\\/|g') +perl -pi.bak -e "s/$orig_share_escaped/$destination_escaped/g" ${destination}/bin/geant4-config + +if [ -n "${GITHUB_ACTIONS:-}" ]; then + echo "Running in GitHub Actions" + venv="${GITHUB_WORKSPACE}/venv" +fi + +if [ -n "${GITLAB_CI:-}" ];then + echo "Running in GitLab CI" + venv="${CI_PROJECT_DIR}/venv" +fi + +if [ -n "${CI:-}" ];then + run "${destination}/bin/python3" -m venv "${venv}" + run "${venv}/bin/python3" -m pip install pyyaml jinja2 + set_env PATH "${venv}/bin:${destination}/bin/:${PATH}" +fi + +set_env CMAKE_PREFIX_PATH "${destination}" +set_env LD_LIBRARY_PATH "${destination}/lib" +set_env ROOT_INCLUDE_PATH "${destination}/include" +# Geant4 puts CLHEP in a subdirectory +set_env ROOT_INCLUDE_PATH "${destination}/include/Geant4" +# Pythia8 looks for settings in this directory +set_env PYTHIA8DATA "${destination}/share/Pythia8/xmldoc" diff --git a/CI/physmon/config/pythia8_ttbar.yml b/CI/physmon/config/pythia8_ttbar.yml index 301aba1c7e5..6a71fe03988 100644 --- a/CI/physmon/config/pythia8_ttbar.yml +++ b/CI/physmon/config/pythia8_ttbar.yml @@ -65,3 +65,8 @@ exclude: - particle - generation - sub_particle + - e_loss + - total_x0 + - total_l0 + - number_of_hits + - outcome diff --git a/CI/physmon/phys_perf_mon.sh b/CI/physmon/phys_perf_mon.sh index 8d5e9867dae..c2944f0dd06 100755 --- a/CI/physmon/phys_perf_mon.sh +++ b/CI/physmon/phys_perf_mon.sh @@ -15,13 +15,13 @@ function run() { export run - +run which python3 shopt -s extglob mode=${1:-all} -if ! [[ $mode = @(all|kf|gsf|gx2f|fullchains|simulation) ]]; then - echo "Usage: $0 (outdir)" +if ! [[ $mode = @(all|kf|gsf|gx2f|refit_kf|refit_gsf|fullchains|simulation) ]]; then + echo "Usage: $0 (outdir)" exit 1 fi @@ -83,11 +83,12 @@ elif [ "$(uname)" == "Linux" ]; then rec=$? # in kbytes max_rss=$(grep "Maximum resident set size (kbytes):" "$tmp" | awk '{printf $(NF)}') - max_rss=$(( 1000*max_rss )) + max_rss=$(( 1024 * max_rss )) + echo "Maximum resident set size: $(printf "%'d" $max_rss) bytes" + wall_time=$(grep "Elapsed (wall clock)" "$tmp" | awk '{printf $(NF)}') - echo $max_rss wall_time=$(python3 -c "i='${wall_time}';p=i.split(':');p = p if len(p) == 3 else ['0', *p];t=float(p[0])*60*60 + float(p[1])*60 + float(p[2]);print(t)") - echo $wall_time + echo "Elapsed (wall clock) time: ${wall_time} seconds" of="${memory_dir}/mem_${slug}.csv" { @@ -151,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" @@ -216,13 +223,22 @@ function trackfinding() { fi run_histcmp \ - $outdir/data/$path/performance_ckf.root \ - $refdir/$path/performance_ckf.root \ - "CKF | ${name}" \ - $path/performance_ckf.html \ - $path/performance_ckf_plots \ + $outdir/data/$path/performance_finding_ckf.root \ + $refdir/$path/performance_finding_ckf.root \ + "CKF finding performance | ${name}" \ + $path/performance_finding_ckf.html \ + $path/performance_finding_ckf_plots \ --config $default_config + run_histcmp \ + $outdir/data/$path/performance_fitting_ckf.root \ + $refdir/$path/performance_fitting_ckf.root \ + "CKF fitting performance | ${name}" \ + $path/performance_fitting_ckf.html \ + $path/performance_fitting_ckf_plots \ + --config $default_config + + run Examples/Scripts/generic_plotter.py \ $outdir/data/$path/tracksummary_ckf.root \ tracksummary \ @@ -237,17 +253,17 @@ function trackfinding() { run_histcmp \ $outdir/data/$path/tracksummary_ckf_hist.root \ $refdir/$path/tracksummary_ckf_hist.root \ - "Track Summary CKF | ${name}" \ + "CKF track summary | ${name}" \ $path/tracksummary_ckf.html \ $path/tracksummary_ckf_plots - if [ -f $refdir/$path/performance_ckf_ambi.root ]; then + if [ -f $refdir/$path/performance_finding_ckf_ambi.root ]; then run_histcmp \ - $outdir/data/$path/performance_ckf_ambi.root \ - $refdir/$path/performance_ckf_ambi.root \ - "Ambisolver | ${name}" \ - $path/performance_ckf_ambi.html \ - $path/performance_ckf_ambi + $outdir/data/$path/performance_finding_ckf_ambi.root \ + $refdir/$path/performance_finding_ckf_ambi.root \ + "Ambisolver finding performance | ${name}" \ + $path/performance_finding_ckf_ambi.html \ + $path/performance_finding_ckf_ambi fi } @@ -410,6 +426,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 diff --git a/CI/physmon/reference/simulation/particles_ttbar_hist.root b/CI/physmon/reference/simulation/particles_ttbar_hist.root index 9100c71418a..4b8b8c552e0 100644 Binary files a/CI/physmon/reference/simulation/particles_ttbar_hist.root and b/CI/physmon/reference/simulation/particles_ttbar_hist.root differ diff --git a/CI/physmon/reference/simulation/vertices_ttbar_hist.root b/CI/physmon/reference/simulation/vertices_ttbar_hist.root index 9e54eaed90e..7dc8182b96a 100644 Binary files a/CI/physmon/reference/simulation/vertices_ttbar_hist.root and b/CI/physmon/reference/simulation/vertices_ttbar_hist.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_ckf.root b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_ckf.root deleted file mode 100644 index d11ff3546ab..00000000000 Binary files a/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_ckf.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_finding_ckf.root new file mode 100644 index 00000000000..b2e59570e85 Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_finding_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_fitting_ckf.root b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_fitting_ckf.root new file mode 100644 index 00000000000..36c779d4846 Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_fitting_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_seeding.root b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_seeding.root index d55d3833570..1049ad5b18b 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_seeding.root and b/CI/physmon/reference/trackfinding_1muon/orthogonal/performance_seeding.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/orthogonal/tracksummary_ckf_hist.root b/CI/physmon/reference/trackfinding_1muon/orthogonal/tracksummary_ckf_hist.root index ed8076f3217..6288387ee09 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/orthogonal/tracksummary_ckf_hist.root and b/CI/physmon/reference/trackfinding_1muon/orthogonal/tracksummary_ckf_hist.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/seeded/performance_ckf.root b/CI/physmon/reference/trackfinding_1muon/seeded/performance_ckf.root deleted file mode 100644 index 515090462a0..00000000000 Binary files a/CI/physmon/reference/trackfinding_1muon/seeded/performance_ckf.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_1muon/seeded/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_1muon/seeded/performance_finding_ckf.root new file mode 100644 index 00000000000..7f59b99cf7e Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/seeded/performance_finding_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/seeded/performance_fitting_ckf.root b/CI/physmon/reference/trackfinding_1muon/seeded/performance_fitting_ckf.root new file mode 100644 index 00000000000..5ba97ecd168 Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/seeded/performance_fitting_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/seeded/performance_seeding.root b/CI/physmon/reference/trackfinding_1muon/seeded/performance_seeding.root index 0c64e9fe631..d91320f3d9a 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/seeded/performance_seeding.root and b/CI/physmon/reference/trackfinding_1muon/seeded/performance_seeding.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/seeded/tracksummary_ckf_hist.root b/CI/physmon/reference/trackfinding_1muon/seeded/tracksummary_ckf_hist.root index c5addb4d78b..71ece3a740b 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/seeded/tracksummary_ckf_hist.root and b/CI/physmon/reference/trackfinding_1muon/seeded/tracksummary_ckf_hist.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_ckf.root b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_ckf.root deleted file mode 100644 index 3feb0e1e4c0..00000000000 Binary files a/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_ckf.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_finding_ckf.root new file mode 100644 index 00000000000..b4def41bfb5 Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_finding_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_fitting_ckf.root b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_fitting_ckf.root new file mode 100644 index 00000000000..3fcdb6021d1 Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_fitting_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_seeding.root b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_seeding.root index 06abee42be7..4d134bc87d3 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_seeding.root and b/CI/physmon/reference/trackfinding_1muon/truth_estimated/performance_seeding.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_estimated/tracksummary_ckf_hist.root b/CI/physmon/reference/trackfinding_1muon/truth_estimated/tracksummary_ckf_hist.root index 9ce90f1355b..d6061a509fb 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/truth_estimated/tracksummary_ckf_hist.root and b/CI/physmon/reference/trackfinding_1muon/truth_estimated/tracksummary_ckf_hist.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_ckf.root b/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_ckf.root deleted file mode 100644 index be2ac6376d8..00000000000 Binary files a/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_ckf.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_finding_ckf.root new file mode 100644 index 00000000000..10f10907b8d Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_finding_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_fitting_ckf.root b/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_fitting_ckf.root new file mode 100644 index 00000000000..1ca5e629d35 Binary files /dev/null and b/CI/physmon/reference/trackfinding_1muon/truth_smeared/performance_fitting_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_1muon/truth_smeared/tracksummary_ckf_hist.root b/CI/physmon/reference/trackfinding_1muon/truth_smeared/tracksummary_ckf_hist.root index 632d9583785..4e51b3eb49c 100644 Binary files a/CI/physmon/reference/trackfinding_1muon/truth_smeared/tracksummary_ckf_hist.root and b/CI/physmon/reference/trackfinding_1muon/truth_smeared/tracksummary_ckf_hist.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_ckf.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_ckf.root deleted file mode 100644 index 6a6ecc7d054..00000000000 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_ckf.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_ckf_ambi.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_ckf_ambi.root deleted file mode 100644 index 49e0fcda2c1..00000000000 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_ckf_ambi.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf.root new file mode 100644 index 00000000000..71bfd26dfb8 Binary files /dev/null and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf_ambi.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf_ambi.root new file mode 100644 index 00000000000..39d7dc1a31f Binary files /dev/null and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf_ambi.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf.root new file mode 100644 index 00000000000..b90f40313eb Binary files /dev/null and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf_ambi.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf_ambi.root new file mode 100644 index 00000000000..ff59dc310eb Binary files /dev/null and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf_ambi.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_seeding.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_seeding.root index 0a59b0fba85..e79e159caa2 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_seeding.root and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_seeding.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_gauss_notime_hist.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_gauss_notime_hist.root index b72a71cbb42..ef6e14d59a0 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_gauss_notime_hist.root and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_gauss_notime_hist.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_grid_time_hist.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_grid_time_hist.root index fed2ae9c28e..d99436fa0f5 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_grid_time_hist.root and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_amvf_grid_time_hist.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_ivf_notime_hist.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_ivf_notime_hist.root index 377bf998d6c..c4c2af31ec4 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_ivf_notime_hist.root and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_vertexing_ivf_notime_hist.root differ diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/tracksummary_ckf_hist.root b/CI/physmon/reference/trackfinding_4muon_50vertices/tracksummary_ckf_hist.root index 07ad96265d6..4ea283d03da 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/tracksummary_ckf_hist.root and b/CI/physmon/reference/trackfinding_4muon_50vertices/tracksummary_ckf_hist.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root deleted file mode 100644 index 2a692f3d751..00000000000 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root deleted file mode 100644 index 8448a28ef8d..00000000000 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_ckf_ambi.root and /dev/null differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf.root new file mode 100644 index 00000000000..d4b5a8b9dde Binary files /dev/null and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ambi.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ambi.root new file mode 100644 index 00000000000..a083efffaff Binary files /dev/null and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ambi.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf.root new file mode 100644 index 00000000000..09d2dc033af Binary files /dev/null and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf_ambi.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf_ambi.root new file mode 100644 index 00000000000..949d8cebfc3 Binary files /dev/null and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf_ambi.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_seeding.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_seeding.root index 7447c9e6b58..500783b48a4 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_seeding.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_seeding.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root index cb06eab079b..8d1bf337631 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_gauss_notime_hist.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root index 3c6a4b94200..25110c369be 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_vertexing_amvf_grid_time_hist.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/tracksummary_ckf_hist.root b/CI/physmon/reference/trackfinding_ttbar_pu200/tracksummary_ckf_hist.root index a5f58e1e065..f803f21ee8f 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/tracksummary_ckf_hist.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/tracksummary_ckf_hist.root differ diff --git a/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root b/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root index 02975d42572..b3543963d9f 100644 Binary files a/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root and b/CI/physmon/reference/trackfitting_gsf/performance_trackfitting.root differ diff --git a/CI/physmon/reference/trackfitting_gx2f/performance_trackfitting.root b/CI/physmon/reference/trackfitting_gx2f/performance_trackfitting.root index 0b1e216915e..b2e2b47c2f5 100644 Binary files a/CI/physmon/reference/trackfitting_gx2f/performance_trackfitting.root and b/CI/physmon/reference/trackfitting_gx2f/performance_trackfitting.root differ diff --git a/CI/physmon/reference/trackfitting_kf/performance_trackfitting.root b/CI/physmon/reference/trackfitting_kf/performance_trackfitting.root index aade25ba5a2..4e3f44e2b34 100644 Binary files a/CI/physmon/reference/trackfitting_kf/performance_trackfitting.root and b/CI/physmon/reference/trackfitting_kf/performance_trackfitting.root differ diff --git a/CI/physmon/reference/trackrefitting_gsf/performance_trackrefitting.root b/CI/physmon/reference/trackrefitting_gsf/performance_trackrefitting.root new file mode 100644 index 00000000000..b6b8d6fd126 Binary files /dev/null and b/CI/physmon/reference/trackrefitting_gsf/performance_trackrefitting.root differ diff --git a/CI/physmon/reference/trackrefitting_kf/performance_trackrefitting.root b/CI/physmon/reference/trackrefitting_kf/performance_trackrefitting.root new file mode 100644 index 00000000000..99385589d48 Binary files /dev/null and b/CI/physmon/reference/trackrefitting_kf/performance_trackrefitting.root differ diff --git a/CI/physmon/workflows/physmon_simulation.py b/CI/physmon/workflows/physmon_simulation.py index c88d4a081e8..206890540b8 100755 --- a/CI/physmon/workflows/physmon_simulation.py +++ b/CI/physmon/workflows/physmon_simulation.py @@ -64,6 +64,14 @@ ) ) + s.addWriter( + acts.examples.RootParticleWriter( + level=acts.logging.INFO, + inputParticles="particles_input", + filePath=tp / "particles.root", + ) + ) + addFatras( s, setup.trackingGeometry, @@ -73,8 +81,7 @@ preSelectParticles=None, postSelectParticles=ParticleSelectorConfig(removeSecondaries=True), inputParticles="particles_input", - outputParticlesInitial="particles_initial_fatras", - outputParticlesFinal="particles_final_fatras", + outputParticles="particles_fatras", outputSimHits="simhits_fatras", outputDirRoot=tp / "fatras", ) @@ -87,12 +94,11 @@ rnd, preSelectParticles=None, postSelectParticles=ParticleSelectorConfig(removeSecondaries=True), - killVolume=setup.trackingGeometry.worldVolume, + killVolume=setup.trackingGeometry.highestTrackingVolume, killAfterTime=25 * u.ns, killSecondaries=True, inputParticles="particles_input", - outputParticlesInitial="particles_initial_geant4", - outputParticlesFinal="particles_final_geant4", + outputParticles="particles_geant4", outputSimHits="simhits_geant4", outputDirRoot=tp / "geant4", ) @@ -100,6 +106,7 @@ s.run() for file, name in [ + (tp / "particles.root", "particles_gun.root"), (tp / "fatras" / "particles_simulation.root", "particles_fatras.root"), (tp / "geant4" / "particles_simulation.root", "particles_geant4.root"), ]: @@ -135,8 +142,8 @@ s.run() for file, name in [ - (tp / "pythia8_particles.root", "particles_ttbar.root"), - (tp / "pythia8_vertices.root", "vertices_ttbar.root"), + (tp / "particles.root", "particles_ttbar.root"), + (tp / "vertices.root", "vertices_ttbar.root"), ]: assert file.exists(), "file not found" shutil.copy(file, setup.outdir / name) diff --git a/CI/physmon/workflows/physmon_trackfinding_1muon.py b/CI/physmon/workflows/physmon_trackfinding_1muon.py index 8dee557c794..aaa4bc9f71d 100755 --- a/CI/physmon/workflows/physmon_trackfinding_1muon.py +++ b/CI/physmon/workflows/physmon_trackfinding_1muon.py @@ -11,13 +11,13 @@ EtaConfig, PhiConfig, ParticleConfig, + ParticleSelectorConfig, addFatras, addDigitization, ) from acts.examples.reconstruction import ( addSeeding, - TruthSeedRanges, ParticleSmearingSigmas, SeedFinderConfigArg, SeedFinderOptionsArg, @@ -72,6 +72,11 @@ def run_ckf_tracking(label, seeding): setup.field, enableInteractions=True, rnd=rnd, + postSelectParticles=ParticleSelectorConfig( + pt=(0.9 * u.GeV, None), + measurements=(9, None), + removeNeutral=True, + ), ) addDigitization( @@ -86,7 +91,6 @@ def run_ckf_tracking(label, seeding): s, setup.trackingGeometry, setup.field, - TruthSeedRanges(pt=(500 * u.MeV, None), nHits=(9, None)), ParticleSmearingSigmas( # only used by SeedingAlgorithm.TruthSmeared # zero eveything so the CKF has a chance to find the measurements d0=0, @@ -108,7 +112,7 @@ def run_ckf_tracking(label, seeding): maxSeedsPerSpM=1, sigmaScattering=5, radLengthPerSeed=0.1, - minPt=500 * u.MeV, + minPt=0.5 * u.GeV, impactMax=3 * u.mm, ), SeedFinderOptionsArg(bFieldInZ=2 * u.T), @@ -134,13 +138,16 @@ def run_ckf_tracking(label, seeding): setup.trackingGeometry, setup.field, TrackSelectorConfig( - pt=(500 * u.MeV, None), + pt=(0.9 * u.GeV, None), loc0=(-4.0 * u.mm, 4.0 * u.mm), nMeasurementsMin=6, maxHoles=2, maxOutliers=2, ), CkfConfig( + chi2CutOffMeasurement=15.0, + chi2CutOffOutlier=25.0, + numMeasurementsCutOff=10, seedDeduplication=( True if seeding != SeedingAlgorithm.TruthSmeared else False ), @@ -156,8 +163,9 @@ def run_ckf_tracking(label, seeding): if seeding != SeedingAlgorithm.TruthSmeared else [] ) + [ - "performance_ckf.root", "tracksummary_ckf.root", + "performance_finding_ckf.root", + "performance_fitting_ckf.root", ]: perf_file = tp / file assert perf_file.exists(), f"Performance file not found {perf_file}" diff --git a/CI/physmon/workflows/physmon_trackfinding_4muon_50vertices.py b/CI/physmon/workflows/physmon_trackfinding_4muon_50vertices.py index 0efeec3acf2..1a119c8ed6c 100755 --- a/CI/physmon/workflows/physmon_trackfinding_4muon_50vertices.py +++ b/CI/physmon/workflows/physmon_trackfinding_4muon_50vertices.py @@ -11,12 +11,12 @@ EtaConfig, PhiConfig, ParticleConfig, + ParticleSelectorConfig, addFatras, addDigitization, ) from acts.examples.reconstruction import ( addSeeding, - TruthSeedRanges, SeedFinderConfigArg, SeedFinderOptionsArg, SeedingAlgorithm, @@ -69,6 +69,11 @@ setup.trackingGeometry, setup.field, rnd=rnd, + postSelectParticles=ParticleSelectorConfig( + pt=(0.9 * u.GeV, None), + measurements=(9, None), + removeNeutral=True, + ), ) addDigitization( @@ -83,7 +88,6 @@ s, setup.trackingGeometry, setup.field, - TruthSeedRanges(pt=(500.0 * u.MeV, None), nHits=(9, None)), SeedFinderConfigArg( r=(33 * u.mm, 200 * u.mm), deltaR=(1 * u.mm, 60 * u.mm), @@ -92,7 +96,7 @@ maxSeedsPerSpM=1, sigmaScattering=5, radLengthPerSeed=0.1, - minPt=500 * u.MeV, + minPt=0.5 * u.GeV, impactMax=3 * u.mm, ), SeedFinderOptionsArg(bFieldInZ=2 * u.T, beamPos=(0.0, 0.0)), @@ -116,13 +120,16 @@ setup.trackingGeometry, setup.field, TrackSelectorConfig( - pt=(500 * u.MeV, None), + pt=(0.9 * u.GeV, None), loc0=(-4.0 * u.mm, 4.0 * u.mm), nMeasurementsMin=6, maxHoles=2, maxOutliers=2, ), CkfConfig( + chi2CutOffMeasurement=15.0, + chi2CutOffOutlier=25.0, + numMeasurementsCutOff=10, seedDeduplication=True, stayOnSeed=True, ), @@ -189,8 +196,12 @@ s.run() shutil.move( - tp / "performance_ambi.root", - tp / "performance_ckf_ambi.root", + tp / "performance_finding_ambi.root", + tp / "performance_finding_ckf_ambi.root", + ) + shutil.move( + tp / "performance_fitting_ambi.root", + tp / "performance_fitting_ckf_ambi.root", ) for vertexing in ["ivf_notime", "amvf_gauss_notime", "amvf_grid_time"]: shutil.move( @@ -201,8 +212,10 @@ for file in [ "performance_seeding.root", "tracksummary_ckf.root", - "performance_ckf.root", - "performance_ckf_ambi.root", + "performance_finding_ckf.root", + "performance_fitting_ckf.root", + "performance_finding_ckf_ambi.root", + "performance_fitting_ckf_ambi.root", "performance_vertexing_ivf_notime.root", "performance_vertexing_amvf_gauss_notime.root", "performance_vertexing_amvf_grid_time.root", diff --git a/CI/physmon/workflows/physmon_trackfinding_ttbar_pu200.py b/CI/physmon/workflows/physmon_trackfinding_ttbar_pu200.py index a9414a89351..99f12d0170d 100755 --- a/CI/physmon/workflows/physmon_trackfinding_ttbar_pu200.py +++ b/CI/physmon/workflows/physmon_trackfinding_ttbar_pu200.py @@ -9,10 +9,10 @@ addPythia8, addFatras, addDigitization, + ParticleSelectorConfig, ) from acts.examples.reconstruction import ( addSeeding, - TruthSeedRanges, SeedFinderConfigArg, SeedFinderOptionsArg, SeedingAlgorithm, @@ -63,6 +63,15 @@ setup.trackingGeometry, setup.field, rnd=rnd, + preSelectParticles=ParticleSelectorConfig( + rho=(0.0, 24 * u.mm), + absZ=(0.0, 1.0 * u.m), + ), + postSelectParticles=ParticleSelectorConfig( + pt=(0.5 * u.GeV, None), + measurements=(9, None), + removeNeutral=True, + ), ) addDigitization( @@ -77,7 +86,6 @@ s, setup.trackingGeometry, setup.field, - TruthSeedRanges(pt=(500.0 * u.MeV, None), nHits=(9, None)), SeedFinderConfigArg( r=(33 * u.mm, 200 * u.mm), deltaR=(1 * u.mm, 60 * u.mm), @@ -86,7 +94,7 @@ maxSeedsPerSpM=1, sigmaScattering=5, radLengthPerSeed=0.1, - minPt=500 * u.MeV, + minPt=0.5 * u.GeV, impactMax=3 * u.mm, ), SeedFinderOptionsArg(bFieldInZ=2 * u.T, beamPos=(0.0, 0.0)), @@ -110,13 +118,16 @@ setup.trackingGeometry, setup.field, TrackSelectorConfig( - pt=(500 * u.MeV, None), + pt=(0.5 * u.GeV, None), loc0=(-4.0 * u.mm, 4.0 * u.mm), nMeasurementsMin=6, maxHoles=2, maxOutliers=2, ), CkfConfig( + chi2CutOffMeasurement=15.0, + chi2CutOffOutlier=25.0, + numMeasurementsCutOff=10, seedDeduplication=True, stayOnSeed=True, ), @@ -169,8 +180,12 @@ s.run() shutil.move( - tp / "performance_ambi.root", - tp / "performance_ckf_ambi.root", + tp / "performance_finding_ambi.root", + tp / "performance_finding_ckf_ambi.root", + ) + shutil.move( + tp / "performance_fitting_ambi.root", + tp / "performance_fitting_ckf_ambi.root", ) for vertexing in ["amvf_gauss_notime", "amvf_grid_time"]: shutil.move( @@ -181,8 +196,10 @@ for file in [ "performance_seeding.root", "tracksummary_ckf.root", - "performance_ckf.root", - "performance_ckf_ambi.root", + "performance_finding_ckf.root", + "performance_fitting_ckf.root", + "performance_finding_ckf_ambi.root", + "performance_fitting_ckf_ambi.root", "performance_vertexing_amvf_gauss_notime.root", "performance_vertexing_amvf_grid_time.root", ]: diff --git a/CI/physmon/workflows/physmon_trackrefitting_gsf.py b/CI/physmon/workflows/physmon_trackrefitting_gsf.py new file mode 100755 index 00000000000..5477121942a --- /dev/null +++ b/CI/physmon/workflows/physmon_trackrefitting_gsf.py @@ -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") diff --git a/CI/physmon/workflows/physmon_trackrefitting_kf.py b/CI/physmon/workflows/physmon_trackrefitting_kf.py new file mode 100755 index 00000000000..ea82d26c701 --- /dev/null +++ b/CI/physmon/workflows/physmon_trackrefitting_kf.py @@ -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") diff --git a/CI/test_coverage.py b/CI/test_coverage.py index 06b13a06abb..0488a71d85d 100755 --- a/CI/test_coverage.py +++ b/CI/test_coverage.py @@ -41,7 +41,7 @@ def call(cmd): ret, gcovr_version_text = check_output(["gcovr", "--version"]) gcovr_version = tuple( - map(int, re.match("gcovr (\d+\.\d+)", gcovr_version_text).group(1).split(".")) + map(int, re.match(r"gcovr (\d+\.\d+)", gcovr_version_text).group(1).split(".")) ) extra_flags = [] @@ -63,7 +63,7 @@ def call(cmd): if not os.path.exists(coverage_dir): os.makedirs(coverage_dir) -excludes = ["-e", "../Tests/", "-e", ".*json\.hpp"] +excludes = ["-e", "../Tests/", "-e", r".*json\.hpp"] # create the html report call( diff --git a/CITATION.cff b/CITATION.cff index ff80a2e9eb9..910eade5312 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -23,7 +23,6 @@ authors: affiliation: Universite Paris-Saclay / CNRS/IN2P3 - given-names: Robert family-names: Langenberg - affiliation: University of Massachussets - given-names: Corentin family-names: Allaire affiliation: CERN diff --git a/CMakeLists.txt b/CMakeLists.txt index a132cce73d3..601264badc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) @@ -58,6 +57,8 @@ option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF) option(ACTS_BUILD_PLUGIN_LEGACY "Build legacy plugin" OFF) option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF) option(ACTS_BUILD_PLUGIN_TGEO "Build TGeo plugin" OFF) +option(ACTS_SETUP_ANNOY "Explicitly set up Annoy for the project" OFF) +option(ACTS_BUILD_PLUGIN_HASHING "Build Hashing plugin" OFF) # fatras related options option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF) option(ACTS_BUILD_FATRAS_GEANT4 "Build Geant4 Fatras package" OFF) @@ -69,9 +70,9 @@ option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OF option(ACTS_BUILD_EXAMPLES_EXATRKX "Build the Exa.TrkX example code" OFF) option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF) option(ACTS_BUILD_EXAMPLES_HEPMC3 "Build HepMC3-based code in the examples" OFF) +option(ACTS_BUILD_EXAMPLES_HASHING "Build Hashing-based code in the examples" OFF) option(ACTS_BUILD_EXAMPLES_PYTHIA8 "Build Pythia8-based code in the examples" OFF) option(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS "Build python bindings for the examples" OFF) -option(ACTS_USE_EXAMPLES_TBB "Use Threading Building Blocks library in the examples" ON) option(ACTS_BUILD_ANALYSIS_APPS "Build Analysis applications in the examples" OFF) # test related options option(ACTS_BUILD_BENCHMARKS "Build benchmarks" OFF) @@ -90,7 +91,7 @@ option(ACTS_BUILD_DOCS "Build documentation" OFF) option(ACTS_SETUP_BOOST "Explicitly set up Boost for the project" ON) option(ACTS_SETUP_EIGEN3 "Explicitly set up Eigen3 for the project" ON) option(ACTS_BUILD_ODD "Build the OpenDataDetector" OFF) -# profiling related optios +# profiling related options option(ACTS_ENABLE_CPU_PROFILING "Enable CPU profiling using gperftools" OFF) option(ACTS_ENABLE_MEMORY_PROFILING "Enable memory profiling using gperftools" OFF) set(ACTS_GPERF_INSTALL_DIR "" CACHE STRING "Hint to help find gperf if profiling is enabled") @@ -110,6 +111,7 @@ set_option_if( OR ACTS_BUILD_EXAMPLES_EDM4HEP OR ACTS_BUILD_EXAMPLES_GEANT4 OR ACTS_BUILD_EXAMPLES_HEPMC3 + OR ACTS_BUILD_EXAMPLES_HASHING OR ACTS_BUILD_EXAMPLES_PYTHIA8 OR ACTS_BUILD_EXAMPLES_EXATRKX OR ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS @@ -164,6 +166,14 @@ set_option_if( ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_PLUGIN_TRACCC ) +set_option_if( + ACTS_BUILD_PLUGIN_ACTSVG + ACTS_BUILD_PLUGIN_TRACCC +) +set_option_if( + ACTS_BUILD_PLUGIN_HASHING + ACTS_BUILD_EXAMPLES_HASHING +) # feature tests include(CheckCXXSourceCompiles) @@ -213,27 +223,28 @@ 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(...)`. -set(_acts_actsvg_version 0.4.40) -set(_acts_autodiff_version 0.6) +set(_acts_actsvg_version 0.4.50) set(_acts_boost_version 1.71.0) set(_acts_dd4hep_version 1.21) +set(_acts_geant4_version 11.1.3) 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 set(_acts_doxygen_version 1.9.4) set(_acts_hepmc3_version 3.2.1) -set(_acts_nlohmanjson_version 3.2.0) +set(_acts_nlohmanjson_version 3.10.5) set(_acts_onnxruntime_version 1.12.0) set(_acts_root_version 6.20) set(_acts_tbb_version 2020.1) set(_acts_pythia8_version 8.309) -set(_acts_detray_version 0.72.0) -set(_acts_traccc_version 0.13.0) +set(_acts_pybind11_version 2.13.1) +set(_acts_detray_version 0.75.3) +set(_acts_traccc_version 0.16.0) set(_acts_covfie_version 0.10.0) set(_acts_vecmem_version 1.4.0) set(_acts_algebraplugins_version 0.22.0) +set(_acts_annoy_version 1.17.3) # recommended dependency version. if there is an opportunity to reach # this version we will try so. @@ -279,8 +290,12 @@ if(ACTS_SETUP_BOOST) endif() if(Boost_VERSION VERSION_EQUAL "1.85.0") + set(_boost_version_severity WARNING) + if(ACTS_BUILD_EXAMPLES) + set(_boost_version_severity FATAL_ERROR) + endif() message( - WARNING + ${_boost_version_severity} "Boost 1.85.0 is known to be broken (https://github.com/boostorg/container/issues/273). Please use a different version." ) endif() @@ -298,7 +313,7 @@ find_package(Filesystem REQUIRED) # the `_VERSION` variables set by `setup(... VERSION ...)` have # only local scope, i.e. they are not accessible her for dependencies added -# via `add_subdirectory`. this overrides the `project(...)` funcion for +# via `add_subdirectory`. this overrides the `project(...)` function for # sub-projects such that the resulting `_VERSION` has # global scope and is accessible within the main project later on. cmake_policy(SET CMP0048 NEW) @@ -361,8 +376,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( @@ -426,7 +457,7 @@ if(ACTS_BUILD_PLUGIN_EDM4HEP) find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG) endif() if(ACTS_BUILD_PLUGIN_GEANT4) - find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml) + find_package(Geant4 ${_acts_geant4_version} REQUIRED CONFIG COMPONENTS gdml) endif() if(ACTS_BUILD_PLUGIN_TRACCC) @@ -464,6 +495,9 @@ if(ACTS_BUILD_PLUGIN_TRACCC) add_subdirectory(thirdparty/traccc) endif() endif() +if(ACTS_SETUP_ANNOY OR ACTS_BUILD_PLUGIN_HASHING) + add_subdirectory(thirdparty/Annoy) +endif() # examples dependencies if(ACTS_BUILD_EXAMPLES) diff --git a/CMakePresets.json b/CMakePresets.json index b9181d2d0a1..2aef0f3fe94 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -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", @@ -70,7 +70,8 @@ "ACTS_BUILD_EXAMPLES_EXATRKX": "OFF", "ACTS_BUILD_EXAMPLES_GEANT4": "ON", "ACTS_BUILD_EXAMPLES_HEPMC3": "ON", - "ACTS_BUILD_EXAMPLES_PYTHIA8": "ON" + "ACTS_BUILD_EXAMPLES_PYTHIA8": "ON", + "ACTS_BUILD_EXAMPLES_HASHING": "ON" } }, { @@ -95,7 +96,6 @@ "displayName": "GitLab-CI", "inherits": "ci-common", "cacheVariables": { - "ACTS_BUILD_PLUGIN_ACTSVG": "OFF", "ACTS_BUILD_ODD": "OFF", "ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS": "OFF", "ACTS_RUN_CLANG_TIDY": "ON" diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index e680cab96ba..93fe1f04dec 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -220,7 +220,7 @@ bugfix should happen in a different branch. The recommended procedure for handling this situation is the following: #. Get into a clean state of your working directory on your feature - branch (either by commiting open changes or by stashing them). + branch (either by committing open changes or by stashing them). #. Checkout the branch the bugfix should be merged into (either *main* or *release/X.Y.Z*) and get the most recent version. #. Create a new branch for the bugfix. @@ -238,7 +238,7 @@ Example: Backporting a feature or bugfix Suppose you have a bugfix or feature branch that is eventually going to be merged in ``main``. You might want to have the feature/bugfix -avilable in a patch (say ``0.25.1``) tag. To to that, find the +available in a patch (say ``0.25.1``) tag. To to that, find the corresponding release branch, for this example that would be ``release/v0.25.X``. You must create a dedicated branch that **only** contains the commits that relate to your feature/bugfix, otherwise the diff --git a/Core/ActsVersion.hpp.in b/Core/ActsVersion.hpp.in index 4dc1ba7acb7..982c9d4fb5c 100644 --- a/Core/ActsVersion.hpp.in +++ b/Core/ActsVersion.hpp.in @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -43,7 +43,6 @@ struct VersionInfo { static VersionInfo fromLibrary(); bool operator==(const VersionInfo& other) const; - bool operator!=(const VersionInfo& other) const { return !(*this == other); } friend std::ostream& operator<<(std::ostream& os, const VersionInfo& vi); diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index b760ba576ed..554656f514c 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -108,7 +108,9 @@ add_subdirectory(src/Detector) add_subdirectory(src/Geometry) 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) diff --git a/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.hpp b/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.hpp index cffdb128220..13bd9822c86 100644 --- a/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.hpp +++ b/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.hpp @@ -1,16 +1,17 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023-2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once #include "Acts/EventData/MultiTrajectoryHelpers.hpp" #include "Acts/EventData/SourceLink.hpp" #include "Acts/EventData/TrackContainer.hpp" +#include "Acts/EventData/TrackContainerFrontendConcept.hpp" #include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/Logger.hpp" @@ -77,13 +78,11 @@ class GreedyAmbiguityResolution { /// @param state An empty state object which is expected to be default constructed. /// @param sourceLinkHash A functor to acquire a hash from a given source link. /// @param sourceLinkEquality A functor to check equality of two source links. - template class holder_t, typename source_link_hash_t, - typename source_link_equality_t> - void computeInitialState( - const TrackContainer& tracks, - State& state, source_link_hash_t&& sourceLinkHash, - source_link_equality_t&& sourceLinkEquality) const; + template + void computeInitialState(const track_container_t& tracks, State& state, + source_link_hash_t&& sourceLinkHash, + source_link_equality_t&& sourceLinkEquality) const; /// Updates the state iteratively by evicting one track after the other until /// the final state conditions are met. diff --git a/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.ipp b/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.ipp index 2f231ff216b..32cbdbbd1e3 100644 --- a/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.ipp +++ b/Core/include/Acts/AmbiguityResolution/GreedyAmbiguityResolution.ipp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023-2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -15,12 +15,11 @@ namespace Acts { -template class holder_t, typename source_link_hash_t, +template void GreedyAmbiguityResolution::computeInitialState( - const TrackContainer& tracks, - State& state, source_link_hash_t&& sourceLinkHash, + const track_container_t& tracks, State& state, + source_link_hash_t&& sourceLinkHash, source_link_equality_t&& sourceLinkEquality) const { auto measurementIndexMap = std::unordered_map #include #include +#include #include #include #include @@ -101,8 +104,8 @@ class ScoreBasedAmbiguityResolution { double pTMin = 0 * UnitConstants::GeV; double pTMax = 1e5 * UnitConstants::GeV; - double phiMin = -M_PI * UnitConstants::rad; - double phiMax = M_PI * UnitConstants::rad; + double phiMin = -std::numbers::pi * UnitConstants::rad; + double phiMax = std::numbers::pi * UnitConstants::rad; double etaMin = -5; double etaMax = 5; @@ -116,16 +119,12 @@ class ScoreBasedAmbiguityResolution { /// The optional cuts,weights and score are used to remove tracks that are not /// good enough, based on some criteria. Users are free to add their own cuts /// with the help of this struct. - template class holder_t, bool ReadOnly = true> + template struct OptionalCuts { - using OptionalFilter = - std::function&)>; + using OptionalFilter = std::function; - using OptionalScoreModifier = std::function&, - double&)>; + using OptionalScoreModifier = + std::function; std::vector cuts = {}; std::vector weights = {}; @@ -146,12 +145,10 @@ class ScoreBasedAmbiguityResolution { /// @param sourceLinkEquality is the equality function for the source links /// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures /// @return a vector of the initial state of the tracks - template class holder_t, typename source_link_hash_t, - typename source_link_equality_t> + template std::vector> computeInitialState( - const TrackContainer& tracks, - source_link_hash_t sourceLinkHash, + const track_container_t& tracks, source_link_hash_t sourceLinkHash, source_link_equality_t sourceLinkEquality, std::vector>& trackFeaturesVectors) const; @@ -161,12 +158,11 @@ class ScoreBasedAmbiguityResolution { /// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures /// @param optionalCuts is the user defined optional cuts to be applied. /// @return a vector of scores for each track - template class holder_t, bool ReadOnly = true> + template std::vector simpleScore( - const TrackContainer& tracks, + const track_container_t& tracks, const std::vector>& trackFeaturesVectors, - const OptionalCuts& + const OptionalCuts& optionalCuts = {}) const; /// Compute the score of each track based on the ambiguity function. @@ -175,12 +171,11 @@ class ScoreBasedAmbiguityResolution { /// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures /// @param optionalCuts is the user defined optional cuts to be applied. /// @return a vector of scores for each track - template class holder_t, bool ReadOnly = true> + template std::vector ambiguityScore( - const TrackContainer& tracks, + const track_container_t& tracks, const std::vector>& trackFeaturesVectors, - const OptionalCuts& + const OptionalCuts& optionalCuts = {}) const; /// Remove hits that are not good enough for each track and removes tracks @@ -205,13 +200,12 @@ class ScoreBasedAmbiguityResolution { /// @param trackFeaturesVectors is the map of detector id to trackFeatures for each track /// @param optionalCuts is the optional cuts to be applied /// @return a vector of IDs of the tracks we want to keep - template class holder_t, bool ReadOnly = true> + template std::vector solveAmbiguity( - const TrackContainer& tracks, + const track_container_t& tracks, const std::vector>& measurementsPerTrack, const std::vector>& trackFeaturesVectors, - const OptionalCuts& + const OptionalCuts& optionalCuts = {}) const; private: diff --git a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp index 5175248a05c..58742d7d11a 100644 --- a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp +++ b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp @@ -1,15 +1,16 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once #include "Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp" #include "Acts/Definitions/Units.hpp" +#include "Acts/EventData/TrackContainerFrontendConcept.hpp" #include "Acts/Utilities/VectorHelpers.hpp" #include @@ -20,13 +21,11 @@ inline const Logger& ScoreBasedAmbiguityResolution::logger() const { return *m_logger; } -template class holder_t, typename source_link_hash_t, +template std::vector> ScoreBasedAmbiguityResolution::computeInitialState( - const TrackContainer& tracks, - source_link_hash_t sourceLinkHash, + const track_container_t& tracks, source_link_hash_t sourceLinkHash, source_link_equality_t sourceLinkEquality, std::vector>& trackFeaturesVectors) const { auto MeasurementIndexMap = @@ -47,7 +46,7 @@ ScoreBasedAmbiguityResolution::computeInitialState( for (const auto& ts : track.trackStatesReversed()) { if (!ts.hasReferenceSurface()) { - ACTS_ERROR("Track state has no reference surface"); + ACTS_DEBUG("Track state has no reference surface"); continue; } auto iVolume = ts.referenceSurface().geometryId().volume(); @@ -98,12 +97,11 @@ ScoreBasedAmbiguityResolution::computeInitialState( return measurementsPerTrack; } -template class holder_t, bool ReadOnly> +template std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( - const TrackContainer& tracks, + const track_container_t& tracks, const std::vector>& trackFeaturesVectors, - const OptionalCuts& + const OptionalCuts& optionalCuts) const { std::vector trackScore; trackScore.reserve(tracks.size()); @@ -184,7 +182,6 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( ACTS_DEBUG("---> Number of outliers: " << trackFeatures.nOutliers); if ((trackFeatures.nHits < detector.minHits) || - (trackFeatures.nHits > detector.maxHits) || (trackFeatures.nHoles > detector.maxHoles) || (trackFeatures.nOutliers > detector.maxOutliers)) { score = 0; @@ -248,12 +245,11 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( return trackScore; } -template class holder_t, bool ReadOnly> +template std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( - const TrackContainer& tracks, + const track_container_t& tracks, const std::vector>& trackFeaturesVectors, - const OptionalCuts& + const OptionalCuts& optionalCuts) const { std::vector trackScore; trackScore.reserve(tracks.size()); @@ -336,7 +332,6 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( ACTS_DEBUG("---> Number of outliers: " << trackFeatures.nOutliers); if ((trackFeatures.nHits < detector.minHits) || - (trackFeatures.nHits > detector.maxHits) || (trackFeatures.nHoles > detector.maxHoles) || (trackFeatures.nOutliers > detector.maxOutliers)) { score = 0; @@ -425,13 +420,13 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( return trackScore; } -template class holder_t, bool ReadOnly> + +template std::vector Acts::ScoreBasedAmbiguityResolution::solveAmbiguity( - const TrackContainer& tracks, + const track_container_t& tracks, const std::vector>& measurementsPerTrack, const std::vector>& trackFeaturesVectors, - const OptionalCuts& + const OptionalCuts& optionalCuts) const { ACTS_INFO("Number of tracks before Ambiguty Resolution: " << tracks.size()); // vector of trackFeaturesVectors. where each trackFeaturesVector contains the diff --git a/Core/include/Acts/Clusterization/Clusterization.hpp b/Core/include/Acts/Clusterization/Clusterization.hpp index 39a1dc9b656..a7b4d853b20 100644 --- a/Core/include/Acts/Clusterization/Clusterization.hpp +++ b/Core/include/Acts/Clusterization/Clusterization.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -13,6 +13,26 @@ namespace Acts::Ccl { +template +concept HasRetrievableColumnInfo = requires(Cell cell) { + { getCellColumn(cell) } -> std::same_as; +}; + +template +concept HasRetrievableRowInfo = requires(Cell cell) { + { getCellRow(cell) } -> std::same_as; +}; + +template +concept HasRetrievableLabelInfo = requires(Cell cell) { + { getCellLabel(cell) } -> std::same_as; +}; + +template +concept CanAcceptCell = requires(Cell cell, Cluster cluster) { + { clusterAddCell(cluster, cell) } -> std::same_as; +}; + using Label = int; constexpr Label NO_LABEL = 0; @@ -28,17 +48,21 @@ enum class ConnectResult { // Default connection type for 2-D grids: 4- or 8-cell connectivity template + requires(Acts::Ccl::HasRetrievableColumnInfo && + Acts::Ccl::HasRetrievableRowInfo) struct Connect2D { - bool conn8; - Connect2D() : conn8{true} {} + bool conn8{true}; + Connect2D() = default; explicit Connect2D(bool commonCorner) : conn8{commonCorner} {} - ConnectResult operator()(const Cell& ref, const Cell& iter) const; + virtual ConnectResult operator()(const Cell& ref, const Cell& iter) const; + virtual ~Connect2D() = default; }; // Default connection type for 1-D grids: 2-cell connectivity -template +template struct Connect1D { - ConnectResult operator()(const Cell& ref, const Cell& iter) const; + virtual ConnectResult operator()(const Cell& ref, const Cell& iter) const; + virtual ~Connect1D() = default; }; // Default connection type based on GridDim @@ -49,13 +73,16 @@ struct DefaultConnect { }; template -struct DefaultConnect : public Connect2D { - explicit DefaultConnect(bool commonCorner) : Connect2D(commonCorner) {} - DefaultConnect() : DefaultConnect(true) {} +struct DefaultConnect : public Connect1D { + ~DefaultConnect() override = default; }; template -struct DefaultConnect : public Connect1D {}; +struct DefaultConnect : public Connect2D { + explicit DefaultConnect(bool commonCorner) : Connect2D(commonCorner) {} + DefaultConnect() = default; + ~DefaultConnect() override = default; +}; /// @brief labelClusters /// @@ -70,6 +97,8 @@ struct DefaultConnect : public Connect1D {}; template > + requires( + Acts::Ccl::HasRetrievableLabelInfo) void labelClusters(CellCollection& cells, Connect connect = Connect()); /// @brief mergeClusters @@ -82,6 +111,9 @@ void labelClusters(CellCollection& cells, Connect connect = Connect()); /// @return nothing template + requires(GridDim == 1 || GridDim == 2) && + Acts::Ccl::HasRetrievableLabelInfo< + typename CellCollection::value_type> ClusterCollection mergeClusters(CellCollection& /*cells*/); /// @brief createClusters diff --git a/Core/include/Acts/Clusterization/Clusterization.ipp b/Core/include/Acts/Clusterization/Clusterization.ipp index 44f8abd1267..90a69930ce1 100644 --- a/Core/include/Acts/Clusterization/Clusterization.ipp +++ b/Core/include/Acts/Clusterization/Clusterization.ipp @@ -1,11 +1,12 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +#include #include #include @@ -13,60 +14,6 @@ namespace Acts::Ccl::internal { -// Machinery for validating generic Cell/Cluster types at compile-time - -template -struct cellTypeHasRequiredFunctions : std::false_type {}; - -template -struct cellTypeHasRequiredFunctions< - T, 2, - std::void_t())), - decltype(getCellColumn(std::declval())), - decltype(getCellLabel(std::declval()))>> : std::true_type { -}; - -template -struct cellTypeHasRequiredFunctions< - T, 1, - std::void_t())), - decltype(getCellLabel(std::declval()))>> : std::true_type { -}; - -template -struct clusterTypeHasRequiredFunctions : std::false_type {}; - -template -struct clusterTypeHasRequiredFunctions< - T, U, - std::void_t(), std::declval()))>> - : std::true_type {}; - -template -constexpr void staticCheckGridDim() { - static_assert( - GridDim == 1 || GridDim == 2, - "mergeClusters is only defined for grid dimensions of 1 or 2. "); -} - -template -constexpr void staticCheckCellType() { - constexpr bool hasFns = cellTypeHasRequiredFunctions(); - static_assert(hasFns, - "Cell type should have the following functions: " - "'int getCellRow(const Cell&)', " - "'int getCellColumn(const Cell&)', " - "'Label& getCellLabel(Cell&)'"); -} - -template -constexpr void staticCheckClusterType() { - constexpr bool hasFns = clusterTypeHasRequiredFunctions(); - static_assert(hasFns, - "Cluster type should have the following function: " - "'void clusterAddCell(Cluster&, const Cell&)'"); -} - template struct Compare { static_assert(GridDim != 1 && GridDim != 2, @@ -74,25 +21,27 @@ struct Compare { }; // Comparator function object for cells, column-wise ordering -// Specialization for 2-D grid -template -struct Compare { +// Specialization for 1-D grids +template +struct Compare { bool operator()(const Cell& c0, const Cell& c1) const { - int row0 = getCellRow(c0); - int row1 = getCellRow(c1); int col0 = getCellColumn(c0); int col1 = getCellColumn(c1); - return (col0 == col1) ? row0 < row1 : col0 < col1; + return col0 < col1; } }; -// Specialization for 1-D grids +// Specialization for 2-D grid template -struct Compare { + requires(Acts::Ccl::HasRetrievableColumnInfo && + Acts::Ccl::HasRetrievableRowInfo) +struct Compare { bool operator()(const Cell& c0, const Cell& c1) const { + int row0 = getCellRow(c0); + int row1 = getCellRow(c1); int col0 = getCellColumn(c0); int col1 = getCellColumn(c1); - return col0 < col1; + return (col0 == col1) ? row0 < row1 : col0 < col1; } }; @@ -183,6 +132,10 @@ Connections getConnections(typename std::vector::iterator it, } template + requires( + Acts::Ccl::HasRetrievableLabelInfo && + Acts::Ccl::CanAcceptCell) ClusterCollection mergeClustersImpl(CellCollection& cells) { using Cluster = typename ClusterCollection::value_type; @@ -214,6 +167,8 @@ ClusterCollection mergeClustersImpl(CellCollection& cells) { namespace Acts::Ccl { template + requires(Acts::Ccl::HasRetrievableColumnInfo && + Acts::Ccl::HasRetrievableRowInfo) ConnectResult Connect2D::operator()(const Cell& ref, const Cell& iter) const { int deltaRow = std::abs(getCellRow(ref) - getCellRow(iter)); @@ -236,7 +191,7 @@ ConnectResult Connect2D::operator()(const Cell& ref, return ConnectResult::eNoConn; } -template +template ConnectResult Connect1D::operator()(const Cell& ref, const Cell& iter) const { int deltaCol = std::abs(getCellColumn(ref) - getCellColumn(iter)); @@ -266,17 +221,19 @@ void recordEquivalences(const internal::Connections seen, } template + requires( + Acts::Ccl::HasRetrievableLabelInfo) void labelClusters(CellCollection& cells, Connect connect) { using Cell = typename CellCollection::value_type; - internal::staticCheckCellType(); internal::DisjointSets ds{}; // Sort cells by position to enable in-order scan - std::sort(cells.begin(), cells.end(), internal::Compare()); + std::ranges::sort(cells, internal::Compare()); // First pass: Allocate labels and record equivalences - for (auto it = cells.begin(); it != cells.end(); ++it) { + for (auto it = std::ranges::begin(cells); it != std::ranges::end(cells); + ++it) { const internal::Connections seen = internal::getConnections(it, cells, connect); if (seen.nconn == 0) { @@ -298,19 +255,15 @@ void labelClusters(CellCollection& cells, Connect connect) { template + requires(GridDim == 1 || GridDim == 2) && + Acts::Ccl::HasRetrievableLabelInfo< + typename CellCollection::value_type> ClusterCollection mergeClusters(CellCollection& cells) { using Cell = typename CellCollection::value_type; - using Cluster = typename ClusterCollection::value_type; - internal::staticCheckGridDim(); - internal::staticCheckCellType(); - internal::staticCheckClusterType(); - if constexpr (GridDim > 1) { // Sort the cells by their cluster label, only needed if more than // one spatial dimension - std::sort(cells.begin(), cells.end(), [](Cell& lhs, Cell& rhs) { - return getCellLabel(lhs) < getCellLabel(rhs); - }); + std::ranges::sort(cells, {}, [](Cell& c) { return getCellLabel(c); }); } return internal::mergeClustersImpl(cells); @@ -319,10 +272,6 @@ ClusterCollection mergeClusters(CellCollection& cells) { template ClusterCollection createClusters(CellCollection& cells, Connect connect) { - using Cell = typename CellCollection::value_type; - using Cluster = typename ClusterCollection::value_type; - internal::staticCheckCellType(); - internal::staticCheckClusterType(); labelClusters(cells, connect); return mergeClusters(cells); } diff --git a/Core/include/Acts/Clusterization/TimedClusterization.hpp b/Core/include/Acts/Clusterization/TimedClusterization.hpp new file mode 100644 index 00000000000..e92ebce44e2 --- /dev/null +++ b/Core/include/Acts/Clusterization/TimedClusterization.hpp @@ -0,0 +1,38 @@ +// 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/. + +#pragma once + +#include "Acts/Clusterization/Clusterization.hpp" +#include "Acts/Definitions/Algebra.hpp" + +#include + +namespace Acts::Ccl { + +template +concept HasRetrievableTimeInfo = requires(Cell cell) { + { getCellTime(cell) } -> std::same_as; +}; + +template +struct TimedConnect : public Acts::Ccl::DefaultConnect { + Acts::ActsScalar timeTolerance{std::numeric_limits::max()}; + + TimedConnect() = default; + TimedConnect(Acts::ActsScalar time); + TimedConnect(Acts::ActsScalar time, bool commonCorner) + requires(N == 2); + ~TimedConnect() override = default; + + ConnectResult operator()(const Cell& ref, const Cell& iter) const override; +}; + +} // namespace Acts::Ccl + +#include "Acts/Clusterization/TimedClusterization.ipp" diff --git a/Core/include/Acts/Clusterization/TimedClusterization.ipp b/Core/include/Acts/Clusterization/TimedClusterization.ipp new file mode 100644 index 00000000000..0e7b3e5bda8 --- /dev/null +++ b/Core/include/Acts/Clusterization/TimedClusterization.ipp @@ -0,0 +1,36 @@ +// 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/. + +namespace Acts::Ccl { + +template +TimedConnect::TimedConnect(Acts::ActsScalar time) + : timeTolerance(time) {} + +template +TimedConnect::TimedConnect(Acts::ActsScalar time, bool commonCorner) + requires(N == 2) + : Acts::Ccl::DefaultConnect(commonCorner), timeTolerance(time) {} + +template +Acts::Ccl::ConnectResult TimedConnect::operator()( + const Cell& ref, const Cell& iter) const { + Acts::Ccl::ConnectResult spaceCompatibility = + Acts::Ccl::DefaultConnect::operator()(ref, iter); + if (spaceCompatibility != Acts::Ccl::ConnectResult::eConn) { + return spaceCompatibility; + } + + if (std::abs(getCellTime(ref) - getCellTime(iter)) < timeTolerance) { + return Acts::Ccl::ConnectResult::eConn; + } + + return Acts::Ccl::ConnectResult::eNoConn; +} + +} // namespace Acts::Ccl diff --git a/Core/include/Acts/Definitions/Algebra.hpp b/Core/include/Acts/Definitions/Algebra.hpp index fa5edcc2252..843958a3282 100644 --- a/Core/include/Acts/Definitions/Algebra.hpp +++ b/Core/include/Acts/Definitions/Algebra.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -100,4 +100,6 @@ using AngleAxis3 = Eigen::AngleAxis; using Transform2 = Eigen::Transform; using Transform3 = Eigen::Transform; +constexpr ActsScalar s_transformEquivalentTolerance = 1e-9; + } // namespace Acts diff --git a/Core/include/Acts/Definitions/Alignment.hpp b/Core/include/Acts/Definitions/Alignment.hpp index 68e9cfa358d..77d8cd8c1e7 100644 --- a/Core/include/Acts/Definitions/Alignment.hpp +++ b/Core/include/Acts/Definitions/Alignment.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Definitions/Common.hpp b/Core/include/Acts/Definitions/Common.hpp index 538de54a945..854c54e2bde 100644 --- a/Core/include/Acts/Definitions/Common.hpp +++ b/Core/include/Acts/Definitions/Common.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2018 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Definitions/Direction.hpp b/Core/include/Acts/Definitions/Direction.hpp index 9254b35a40c..d07646bab26 100644 --- a/Core/include/Acts/Definitions/Direction.hpp +++ b/Core/include/Acts/Definitions/Direction.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2018 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -41,7 +41,7 @@ class Direction final { /// @param scalar is the signed value /// /// @return a direction enum - static inline constexpr Direction fromScalar(ActsScalar scalar) { + static constexpr Direction fromScalar(ActsScalar scalar) { assert(scalar != 0); return scalar >= 0 ? Value::Positive : Value::Negative; } @@ -53,8 +53,7 @@ class Direction final { /// @param scalar is the signed value /// /// @return a direction enum - static inline constexpr Direction fromScalarZeroAsPositive( - ActsScalar scalar) { + static constexpr Direction fromScalarZeroAsPositive(ActsScalar scalar) { return scalar >= 0 ? Value::Positive : Value::Negative; } @@ -62,7 +61,7 @@ class Direction final { /// std::array /// /// @param index is the direction at input - static inline constexpr Direction fromIndex(std::size_t index) { + static constexpr Direction fromIndex(std::size_t index) { if (index == 0u) { return Value::Negative; } @@ -73,7 +72,7 @@ class Direction final { /// objects in std::array /// /// @return either 0 or 1 - inline constexpr std::size_t index() const { + constexpr std::size_t index() const { if (m_value == Value::Negative) { return 0u; } @@ -83,28 +82,24 @@ class Direction final { /// Turns the direction into a signed value /// /// @return a signed value - inline constexpr int sign() const { return static_cast(m_value); } + constexpr int sign() const { return static_cast(m_value); } /// Reverse the direction /// /// @return an opposite direction - inline constexpr Direction invert() const { + constexpr Direction invert() const { return (m_value == Value::Positive) ? Value::Negative : Value::Positive; } std::string toString() const; - inline constexpr Direction() = default; - inline constexpr Direction(Value value) : m_value(value) {} + constexpr Direction() = default; + constexpr Direction(Value value) : m_value(value) {} - inline constexpr bool operator==(Direction other) const { + constexpr bool operator==(Direction other) const { return m_value == other.m_value; } - inline constexpr bool operator!=(Direction other) const { - return m_value != other.m_value; - } - private: Value m_value = Value::Positive; }; @@ -113,15 +108,15 @@ std::ostream& operator<<(std::ostream& os, Direction dir); // Direction * T -inline constexpr int operator*(Direction dir, int value) { +constexpr int operator*(Direction dir, int value) { return dir.sign() * value; } -inline constexpr float operator*(Direction dir, float value) { +constexpr float operator*(Direction dir, float value) { return dir.sign() * value; } -inline constexpr double operator*(Direction dir, double value) { +constexpr double operator*(Direction dir, double value) { return dir.sign() * value; } @@ -131,15 +126,15 @@ inline Acts::Vector3 operator*(Direction dir, const Acts::Vector3& value) { // T * Direction -inline constexpr int operator*(int value, Direction dir) { +constexpr int operator*(int value, Direction dir) { return value * dir.sign(); } -inline constexpr float operator*(float value, Direction dir) { +constexpr float operator*(float value, Direction dir) { return value * dir.sign(); } -inline constexpr double operator*(double value, Direction dir) { +constexpr double operator*(double value, Direction dir) { return value * dir.sign(); } @@ -149,17 +144,17 @@ inline Acts::Vector3 operator*(const Acts::Vector3& value, Direction dir) { // T *= Direction -inline constexpr int operator*=(int& value, Direction dir) { +constexpr int operator*=(int& value, Direction dir) { value *= dir.sign(); return value; } -inline constexpr float operator*=(float& value, Direction dir) { +constexpr float operator*=(float& value, Direction dir) { value *= dir.sign(); return value; } -inline constexpr double operator*=(double& value, Direction dir) { +constexpr double operator*=(double& value, Direction dir) { value *= dir.sign(); return value; } diff --git a/Core/include/Acts/Definitions/ParticleData.hpp b/Core/include/Acts/Definitions/ParticleData.hpp index 420121f4bcf..8cb97a9df9d 100644 --- a/Core/include/Acts/Definitions/ParticleData.hpp +++ b/Core/include/Acts/Definitions/ParticleData.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Definitions/PdgParticle.hpp b/Core/include/Acts/Definitions/PdgParticle.hpp index 28f7d248493..f6967671136 100644 --- a/Core/include/Acts/Definitions/PdgParticle.hpp +++ b/Core/include/Acts/Definitions/PdgParticle.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2019-2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -36,7 +36,7 @@ enum PdgParticle : std::int32_t { }; /// Convert an anti-particle to its particle and leave particles as-is. -static constexpr inline PdgParticle makeAbsolutePdgParticle(PdgParticle pdg) { +static constexpr PdgParticle makeAbsolutePdgParticle(PdgParticle pdg) { const auto value = static_cast(pdg); return static_cast((0 <= value) ? value : -value); } diff --git a/Core/include/Acts/Definitions/Tolerance.hpp b/Core/include/Acts/Definitions/Tolerance.hpp index 0380c732408..0b8ef36e55f 100644 --- a/Core/include/Acts/Definitions/Tolerance.hpp +++ b/Core/include/Acts/Definitions/Tolerance.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Definitions/TrackParametrization.hpp b/Core/include/Acts/Definitions/TrackParametrization.hpp index 952fe24c512..ac5f0e09b1b 100644 --- a/Core/include/Acts/Definitions/TrackParametrization.hpp +++ b/Core/include/Acts/Definitions/TrackParametrization.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Definitions/Units.hpp b/Core/include/Acts/Definitions/Units.hpp index b61515234a9..65d7cee775d 100644 --- a/Core/include/Acts/Definitions/Units.hpp +++ b/Core/include/Acts/Definitions/Units.hpp @@ -1,13 +1,15 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2019 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once +#include + namespace Acts { /// @verbatim embed:rst:leading-slashes @@ -170,7 +172,7 @@ constexpr double h = 3600.0 * s; // Angles, native unit radian constexpr double mrad = 1e-3; constexpr double rad = 1.0; -constexpr double degree = 0.017453292519943295; // = M_PI / 180.0 * rad; +constexpr double degree = std::numbers::pi / 180. / rad; // Energy/mass/momentum, native unit GeV constexpr double GeV = 1.0; constexpr double eV = 1e-9 * GeV; diff --git a/Core/include/Acts/Detector/Blueprint.hpp b/Core/include/Acts/Detector/Blueprint.hpp index 63f442dae0b..3be0d6353db 100644 --- a/Core/include/Acts/Detector/Blueprint.hpp +++ b/Core/include/Acts/Detector/Blueprint.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp b/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp index 9ec69348116..ea5b98675cf 100644 --- a/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp +++ b/Core/include/Acts/Detector/CuboidalContainerBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp b/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp index c3023cea84e..4520eea5e07 100644 --- a/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp +++ b/Core/include/Acts/Detector/CylindricalContainerBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/Detector.hpp b/Core/include/Acts/Detector/Detector.hpp index 6ce3d4bc488..fa61327089a 100644 --- a/Core/include/Acts/Detector/Detector.hpp +++ b/Core/include/Acts/Detector/Detector.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/DetectorBuilder.hpp b/Core/include/Acts/Detector/DetectorBuilder.hpp index 11fc60d67a7..d5e0ab7e16b 100644 --- a/Core/include/Acts/Detector/DetectorBuilder.hpp +++ b/Core/include/Acts/Detector/DetectorBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/DetectorComponents.hpp b/Core/include/Acts/Detector/DetectorComponents.hpp index 5f6cf73d6e8..ed5a0c342de 100644 --- a/Core/include/Acts/Detector/DetectorComponents.hpp +++ b/Core/include/Acts/Detector/DetectorComponents.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/DetectorVolume.hpp b/Core/include/Acts/Detector/DetectorVolume.hpp index ac1164342d3..1617721d62f 100644 --- a/Core/include/Acts/Detector/DetectorVolume.hpp +++ b/Core/include/Acts/Detector/DetectorVolume.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/DetectorVolumeBuilder.hpp b/Core/include/Acts/Detector/DetectorVolumeBuilder.hpp index c7b4ae8c6f6..6cb5e6647db 100644 --- a/Core/include/Acts/Detector/DetectorVolumeBuilder.hpp +++ b/Core/include/Acts/Detector/DetectorVolumeBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/DetectorVolumeVisitorConcept.hpp b/Core/include/Acts/Detector/DetectorVolumeVisitorConcept.hpp index 95998fdb716..b43ec35277d 100644 --- a/Core/include/Acts/Detector/DetectorVolumeVisitorConcept.hpp +++ b/Core/include/Acts/Detector/DetectorVolumeVisitorConcept.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/GeometryCompatibilityConcept.hpp b/Core/include/Acts/Detector/GeometryCompatibilityConcept.hpp index 4879fb9533d..643efa1b138 100644 --- a/Core/include/Acts/Detector/GeometryCompatibilityConcept.hpp +++ b/Core/include/Acts/Detector/GeometryCompatibilityConcept.hpp @@ -1,49 +1,32 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once #include "Acts/Detector/DetectorVolume.hpp" #include "Acts/Geometry/TrackingVolume.hpp" -#include "Acts/Utilities/TypeTraits.hpp" +#include "Acts/Utilities/Concepts.hpp" -namespace Acts::Concepts { - -// Types to check compatibility of -template -using ReturnTypeCurrentVolume = - decltype(std::declval().currentVolume( - std::declval().navigation)); +namespace Acts { /// @brief Concept ensuring compatibility TrackingGeometry /// and Detector navigation interfaces with the client code /// @tparam propagator_state_t Type of the object for navigation state /// @tparam navigator_t Type of the navigator object template -struct NavigationCompatibilityConceptImpl { - /// @brief Ensure that the currentVolume method - /// returns one of the known volume types - constexpr static bool isCurrentVolumePtr = - (Acts::Concepts::identical_to || - Acts::Concepts::identical_to); - - static_assert(isCurrentVolumePtr, - "Return type is not a known volume pointer type"); - - constexpr static bool value = Acts::Concepts::require; +concept NavigationCompatibleConcept = requires(propagator_state_t &p, + navigator_t &n) { + requires requires { + { + n.currentVolume(p.navigation) + } -> Concepts::same_as_any_of; + }; }; -template -constexpr bool NavigationCompatibilityConcept = - NavigationCompatibilityConceptImpl::value; - -} // namespace Acts::Concepts +} // namespace Acts diff --git a/Core/include/Acts/Detector/GeometryIdGenerator.hpp b/Core/include/Acts/Detector/GeometryIdGenerator.hpp index 83e2ed90b9b..ff8e36cc451 100644 --- a/Core/include/Acts/Detector/GeometryIdGenerator.hpp +++ b/Core/include/Acts/Detector/GeometryIdGenerator.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/GeometryIdMapper.hpp b/Core/include/Acts/Detector/GeometryIdMapper.hpp index f4d6a4163b2..0b9215011e2 100644 --- a/Core/include/Acts/Detector/GeometryIdMapper.hpp +++ b/Core/include/Acts/Detector/GeometryIdMapper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp b/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp index f985ea3975e..64483115c61 100644 --- a/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp +++ b/Core/include/Acts/Detector/IndexedRootVolumeFinderBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/KdtSurfacesProvider.hpp b/Core/include/Acts/Detector/KdtSurfacesProvider.hpp index dda69aeefc7..fd7086e01df 100644 --- a/Core/include/Acts/Detector/KdtSurfacesProvider.hpp +++ b/Core/include/Acts/Detector/KdtSurfacesProvider.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/LayerStructureBuilder.hpp b/Core/include/Acts/Detector/LayerStructureBuilder.hpp index afc04463cc5..02fd726824e 100644 --- a/Core/include/Acts/Detector/LayerStructureBuilder.hpp +++ b/Core/include/Acts/Detector/LayerStructureBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -91,8 +91,9 @@ class LayerStructureBuilder : public IInternalStructureBuilder { /// Minimum number of surfaces to build an internal structure /// - otherwise the tryAll options is used unsigned int nMinimalSurfaces = 4u; - /// Polyhedron approximations - unsigned int nSegments = 1u; + /// Polyhedron approximations: number of segments to be used + /// to approximate a quarter of a circle + unsigned int quarterSegments = 1u; /// Extra information, mainly for screen output std::string auxiliary = ""; }; diff --git a/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp b/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp index 86cce7fce56..939388c223a 100644 --- a/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp +++ b/Core/include/Acts/Detector/MultiWireStructureBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/Portal.hpp b/Core/include/Acts/Detector/Portal.hpp index 4c4bc7fe8a4..3cdfce02dc4 100644 --- a/Core/include/Acts/Detector/Portal.hpp +++ b/Core/include/Acts/Detector/Portal.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/PortalGenerators.hpp b/Core/include/Acts/Detector/PortalGenerators.hpp index d8f8bf50614..9468e63d2cc 100644 --- a/Core/include/Acts/Detector/PortalGenerators.hpp +++ b/Core/include/Acts/Detector/PortalGenerators.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/ProtoBinning.hpp b/Core/include/Acts/Detector/ProtoBinning.hpp index 8d5d4db8374..371bfe60bd2 100644 --- a/Core/include/Acts/Detector/ProtoBinning.hpp +++ b/Core/include/Acts/Detector/ProtoBinning.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/ProtoDetector.hpp b/Core/include/Acts/Detector/ProtoDetector.hpp index b1d7877d65d..5e4e4d426c2 100644 --- a/Core/include/Acts/Detector/ProtoDetector.hpp +++ b/Core/include/Acts/Detector/ProtoDetector.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/ProtoSupport.hpp b/Core/include/Acts/Detector/ProtoSupport.hpp index 55f8110a3a2..8f1e2581e77 100644 --- a/Core/include/Acts/Detector/ProtoSupport.hpp +++ b/Core/include/Acts/Detector/ProtoSupport.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/VolumeStructureBuilder.hpp b/Core/include/Acts/Detector/VolumeStructureBuilder.hpp index 812f2e761ec..aede963c78c 100644 --- a/Core/include/Acts/Detector/VolumeStructureBuilder.hpp +++ b/Core/include/Acts/Detector/VolumeStructureBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/BlueprintDrawer.hpp b/Core/include/Acts/Detector/detail/BlueprintDrawer.hpp index cc589bf8e06..775eb83f45b 100644 --- a/Core/include/Acts/Detector/detail/BlueprintDrawer.hpp +++ b/Core/include/Acts/Detector/detail/BlueprintDrawer.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/BlueprintHelper.hpp b/Core/include/Acts/Detector/detail/BlueprintHelper.hpp index 06cc3e2046f..a1c0368a0ad 100644 --- a/Core/include/Acts/Detector/detail/BlueprintHelper.hpp +++ b/Core/include/Acts/Detector/detail/BlueprintHelper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp b/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp index 34be7576be2..c9ad46744d3 100644 --- a/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp +++ b/Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp b/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp index 91b7935482c..05815b1325f 100644 --- a/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp +++ b/Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp b/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp index ffc9ae97985..ebea6a7a4d6 100644 --- a/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp +++ b/Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/IndexedGridFiller.hpp b/Core/include/Acts/Detector/detail/IndexedGridFiller.hpp index b79cafa93ad..3bbbee0569c 100644 --- a/Core/include/Acts/Detector/detail/IndexedGridFiller.hpp +++ b/Core/include/Acts/Detector/detail/IndexedGridFiller.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023-2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -17,6 +17,7 @@ #include "Acts/Utilities/Delegate.hpp" #include "Acts/Utilities/Enumerate.hpp" #include "Acts/Utilities/GridAccessHelpers.hpp" +#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/IAxis.hpp" #include "Acts/Utilities/Logger.hpp" @@ -193,7 +194,7 @@ struct IndexedGridFiller { // Loop over the surfaces to be filled for (auto [io, o] : enumerate(iObjects)) { // Exclude indices that should be handled differently - if (std::find(aToAll.begin(), aToAll.end(), io) != aToAll.end()) { + if (rangeContainsValue(aToAll, io)) { continue; } // Get the reference positions @@ -216,7 +217,7 @@ struct IndexedGridFiller { // Now fill the surface indices for (const auto& li : lIndices) { auto& bContent = iGrid.grid.atLocalBins(li); - if (std::find(bContent.begin(), bContent.end(), io) == bContent.end()) { + if (!rangeContainsValue(bContent, io)) { bContent.push_back(io); } } @@ -238,7 +239,7 @@ struct IndexedGridFiller { for (std::size_t gi = 0; gi < iGrid.grid.size(true); ++gi) { auto& bContent = iGrid.grid.at(gi); for (const auto& io : idcs) { - if (std::find(bContent.begin(), bContent.end(), io) == bContent.end()) { + if (!rangeContainsValue(bContent, io)) { bContent.push_back(io); } } diff --git a/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp b/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp index 6d87d9f3a50..83dc9170208 100644 --- a/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp +++ b/Core/include/Acts/Detector/detail/IndexedSurfacesGenerator.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/PortalHelper.hpp b/Core/include/Acts/Detector/detail/PortalHelper.hpp index 52245ee4a66..ec17c487098 100644 --- a/Core/include/Acts/Detector/detail/PortalHelper.hpp +++ b/Core/include/Acts/Detector/detail/PortalHelper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2022-2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/ProtoMaterialHelper.hpp b/Core/include/Acts/Detector/detail/ProtoMaterialHelper.hpp index eb483a2f680..a43e96ac521 100644 --- a/Core/include/Acts/Detector/detail/ProtoMaterialHelper.hpp +++ b/Core/include/Acts/Detector/detail/ProtoMaterialHelper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp b/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp index 8d03d515bb3..db77685a2bc 100644 --- a/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp +++ b/Core/include/Acts/Detector/detail/ReferenceGenerators.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp b/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp index 1cfef5fdb5b..e956e215e4f 100644 --- a/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp +++ b/Core/include/Acts/Detector/detail/SupportSurfacesHelper.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/IDetectorBuilder.hpp b/Core/include/Acts/Detector/interface/IDetectorBuilder.hpp index 73a167e08ba..b9950cbd283 100644 --- a/Core/include/Acts/Detector/interface/IDetectorBuilder.hpp +++ b/Core/include/Acts/Detector/interface/IDetectorBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/IDetectorComponentBuilder.hpp b/Core/include/Acts/Detector/interface/IDetectorComponentBuilder.hpp index e2b8f5fdd6d..cc9d207aef0 100644 --- a/Core/include/Acts/Detector/interface/IDetectorComponentBuilder.hpp +++ b/Core/include/Acts/Detector/interface/IDetectorComponentBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/IExternalStructureBuilder.hpp b/Core/include/Acts/Detector/interface/IExternalStructureBuilder.hpp index 483ddf6299a..7f5177b8e92 100644 --- a/Core/include/Acts/Detector/interface/IExternalStructureBuilder.hpp +++ b/Core/include/Acts/Detector/interface/IExternalStructureBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/IGeometryIdGenerator.hpp b/Core/include/Acts/Detector/interface/IGeometryIdGenerator.hpp index bb161cb9d58..61a1461bd6b 100644 --- a/Core/include/Acts/Detector/interface/IGeometryIdGenerator.hpp +++ b/Core/include/Acts/Detector/interface/IGeometryIdGenerator.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/IInternalStructureBuilder.hpp b/Core/include/Acts/Detector/interface/IInternalStructureBuilder.hpp index 4ae2e242bf0..0d453248834 100644 --- a/Core/include/Acts/Detector/interface/IInternalStructureBuilder.hpp +++ b/Core/include/Acts/Detector/interface/IInternalStructureBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/IRootVolumeFinderBuilder.hpp b/Core/include/Acts/Detector/interface/IRootVolumeFinderBuilder.hpp index aacb5c5dfc3..ea96a05de8e 100644 --- a/Core/include/Acts/Detector/interface/IRootVolumeFinderBuilder.hpp +++ b/Core/include/Acts/Detector/interface/IRootVolumeFinderBuilder.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/Detector/interface/ISurfacesProvider.hpp b/Core/include/Acts/Detector/interface/ISurfacesProvider.hpp index 7cedfbf6a82..65d810a24dc 100644 --- a/Core/include/Acts/Detector/interface/ISurfacesProvider.hpp +++ b/Core/include/Acts/Detector/interface/ISurfacesProvider.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/EventData/Charge.hpp b/Core/include/Acts/EventData/Charge.hpp index 020aa87ce83..6ae62b3d963 100644 --- a/Core/include/Acts/EventData/Charge.hpp +++ b/Core/include/Acts/EventData/Charge.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/EventData/ChargeConcept.hpp b/Core/include/Acts/EventData/ChargeConcept.hpp index 4b0540ac407..448722bd4b3 100644 --- a/Core/include/Acts/EventData/ChargeConcept.hpp +++ b/Core/include/Acts/EventData/ChargeConcept.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp index 3d256630f76..38f297764b1 100644 --- a/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericBoundTrackParameters.hpp @@ -1,14 +1,15 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once #include "Acts/Definitions/Tolerance.hpp" +#include "Acts/EventData/TrackParameterHelpers.hpp" #include "Acts/EventData/TransformationHelpers.hpp" #include "Acts/EventData/detail/PrintParameters.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -18,7 +19,6 @@ #include #include #include -#include namespace Acts { @@ -61,7 +61,10 @@ class GenericBoundTrackParameters { m_cov(std::move(cov)), m_surface(std::move(surface)), m_particleHypothesis(std::move(particleHypothesis)) { - assert(m_surface); + // TODO set `validateAngleRange` to `true` after fixing caller code + assert(isBoundVectorValid(m_params, false) && + "Invalid bound parameters vector"); + assert(m_surface != nullptr && "Reference surface must not be null"); normalizePhiTheta(); } @@ -250,6 +253,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 reflect() const { + GenericBoundTrackParameters reflected = *this; + reflected.reflectInPlace(); + return reflected; + } + private: BoundVector m_params; std::optional m_cov; @@ -282,11 +296,7 @@ class GenericBoundTrackParameters { (lhs.m_surface == rhs.m_surface) && (lhs.m_particleHypothesis == rhs.m_particleHypothesis); } - /// Compare two bound track parameters for bitwise in-equality. - friend bool operator!=(const GenericBoundTrackParameters& lhs, - const GenericBoundTrackParameters& rhs) { - return !(lhs == rhs); - } + /// Print information to the output stream. friend std::ostream& operator<<(std::ostream& os, const GenericBoundTrackParameters& tp) { diff --git a/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp b/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp index ec4b49be9bb..6e4ed9bae7a 100644 --- a/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericCurvilinearTrackParameters.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2016-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -82,8 +82,7 @@ class GenericCurvilinearTrackParameters template static GenericCurvilinearTrackParameters create( const other_track_parameter_t& other) { - static_assert( - Concepts::BoundTrackParametersConcept); + static_assert(BoundTrackParametersConcept); return GenericCurvilinearTrackParameters( other.fourPosition(), other.particleHypothesis(), other.covariance()); @@ -112,6 +111,14 @@ class GenericCurvilinearTrackParameters Vector3 position() const { return GenericBoundTrackParameters::position({}); } + + /// Reflect the parameters. + /// @return Reflected parameters. + GenericCurvilinearTrackParameters reflect() const { + GenericCurvilinearTrackParameters reflected = *this; + reflected.reflectInPlace(); + return reflected; + } }; } // namespace Acts diff --git a/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp b/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp index c54ce44697c..7a2b4b46522 100644 --- a/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp +++ b/Core/include/Acts/EventData/GenericFreeTrackParameters.hpp @@ -1,24 +1,26 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2019-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/TrackParametrization.hpp" +#include "Acts/EventData/TrackParameterHelpers.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 #include #include -#include namespace Acts { @@ -52,7 +54,34 @@ class GenericFreeTrackParameters { ParticleHypothesis particleHypothesis) : m_params(params), m_cov(std::move(cov)), - m_particleHypothesis(std::move(particleHypothesis)) {} + m_particleHypothesis(std::move(particleHypothesis)) { + assert(isFreeVectorValid(m_params) && "Invalid free parameters vector"); + } + + /// 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 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; + + assert(isFreeVectorValid(m_params) && "Invalid free parameters vector"); + } /// Construct from four-position, angles, absolute momentum, and charge. /// @@ -77,6 +106,8 @@ class GenericFreeTrackParameters { m_params[eFreeDir1] = dir[eMom1]; m_params[eFreeDir2] = dir[eMom2]; m_params[eFreeQOverP] = qOverP; + + assert(isFreeVectorValid(m_params) && "Invalid free parameters vector"); } /// Converts a free track parameter with a different hypothesis. @@ -91,8 +122,7 @@ class GenericFreeTrackParameters { template static GenericFreeTrackParameters create( const other_track_parameter_t& other) { - static_assert( - Concepts::FreeTrackParametersConcept); + static_assert(FreeTrackParametersConcept); return GenericFreeTrackParameters( other.parameters(), other.particleHypothesis(), other.covariance()); @@ -135,9 +165,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]; } @@ -155,12 +185,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(); } @@ -175,6 +205,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 reflect() const { + GenericFreeTrackParameters reflected = *this; + reflected.reflectInPlace(); + return reflected; + } + private: FreeVector m_params; std::optional m_cov; diff --git a/Core/include/Acts/EventData/GenericParticleHypothesis.hpp b/Core/include/Acts/EventData/GenericParticleHypothesis.hpp index 38c70409dc6..46ebe4ff298 100644 --- a/Core/include/Acts/EventData/GenericParticleHypothesis.hpp +++ b/Core/include/Acts/EventData/GenericParticleHypothesis.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -133,11 +133,6 @@ class GenericParticleHypothesis { return (lhs.m_absPdg == rhs.m_absPdg) && (lhs.m_mass == rhs.m_mass) && (lhs.m_chargeType == rhs.m_chargeType); } - friend bool operator!=(const GenericParticleHypothesis& lhs, - const GenericParticleHypothesis& rhs) { - return (lhs.m_absPdg != rhs.m_absPdg) || (lhs.m_mass != rhs.m_mass) || - (lhs.m_chargeType != rhs.m_chargeType); - } }; } // namespace Acts diff --git a/Core/include/Acts/EventData/MeasurementHelpers.hpp b/Core/include/Acts/EventData/MeasurementHelpers.hpp index 9d927e40447..d4aae9b7565 100644 --- a/Core/include/Acts/EventData/MeasurementHelpers.hpp +++ b/Core/include/Acts/EventData/MeasurementHelpers.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2019-2020 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp b/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp index dd3496910f7..70ad87f8d77 100644 --- a/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp +++ b/Core/include/Acts/EventData/MultiComponentTrackParameters.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2021 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -262,7 +262,7 @@ class MultiComponentCurvilinearTrackParameters avgDir += w * dir; } - auto s = Surface::makeShared(avgPos, avgDir); + auto s = CurvilinearSurface(avgPos, avgDir).planeSurface(); std::vector> bound; bound.reserve(curvi.size()); diff --git a/Core/include/Acts/EventData/MultiTrajectory.hpp b/Core/include/Acts/EventData/MultiTrajectory.hpp index d5766844403..1c065fd7e12 100644 --- a/Core/include/Acts/EventData/MultiTrajectory.hpp +++ b/Core/include/Acts/EventData/MultiTrajectory.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2019-2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -21,7 +21,6 @@ #include "Acts/Utilities/HashedString.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/ThrowAssert.hpp" -#include "Acts/Utilities/TypeTraits.hpp" #include #include @@ -88,6 +87,12 @@ class TrackStateRange { } } + Iterator operator++(int) { + Iterator tmp(*this); + operator++(); + return tmp; + } + bool operator==(const Iterator& other) const { if (!proxy && !other.proxy) { return true; @@ -98,8 +103,6 @@ class TrackStateRange { return false; } - bool operator!=(const Iterator& other) const { return !(*this == other); } - ProxyType operator*() const { return *proxy; } ProxyType operator*() { return *proxy; } }; @@ -110,18 +113,18 @@ class TrackStateRange { Iterator begin() { return m_begin; } Iterator end() { return Iterator{std::nullopt}; } + Iterator cbegin() const { return m_begin; } + Iterator cend() const { return Iterator{std::nullopt}; } + private: Iterator m_begin; }; // implement track state visitor concept template -using call_operator_t = decltype(std::declval()(std::declval())); - -template -constexpr bool VisitorConcept = Concepts ::require< - Concepts ::either, - Concepts ::identical_to>>; +concept VisitorConcept = requires(T& t, TS& ts) { + { t(ts) } -> Concepts::same_as_any_of; +}; } // namespace detail_lt @@ -269,7 +272,8 @@ class MultiTrajectory { /// @param iendpoint index of the last state /// @param callable non-modifying functor to be called with each point template - void visitBackwards(IndexType iendpoint, F&& callable) const; + void visitBackwards(IndexType iendpoint, F&& callable) const + requires detail_lt::VisitorConcept; /// Apply a function to all previous states starting at a given endpoint. /// @@ -281,11 +285,8 @@ class MultiTrajectory { /// @note Only available if the MultiTrajectory is not read-only template void applyBackwards(IndexType iendpoint, F&& callable) - requires(!ReadOnly) + requires(!ReadOnly) && detail_lt::VisitorConcept { - static_assert(detail_lt::VisitorConcept, - "Callable needs to satisfy VisitorConcept"); - if (iendpoint == MultiTrajectoryTraits::kInvalid) { throw std::runtime_error( "Cannot apply backwards with kInvalid as endpoint"); @@ -695,13 +696,10 @@ class MultiTrajectory { self().allocateCalibrated_impl(istate, measdim); } - // This function will move to an rvalue reference in the next major version - template - void setUncalibratedSourceLink(IndexType istate, source_link_t&& sourceLink) + void setUncalibratedSourceLink(IndexType istate, SourceLink&& sourceLink) requires(!ReadOnly) { - self().setUncalibratedSourceLink_impl( - istate, std::forward(sourceLink)); + self().setUncalibratedSourceLink_impl(istate, std::move(sourceLink)); } SourceLink getUncalibratedSourceLink(IndexType istate) const { diff --git a/Core/include/Acts/EventData/MultiTrajectory.ipp b/Core/include/Acts/EventData/MultiTrajectory.ipp index 3b1e3d8a184..c8f12967cd2 100644 --- a/Core/include/Acts/EventData/MultiTrajectory.ipp +++ b/Core/include/Acts/EventData/MultiTrajectory.ipp @@ -1,13 +1,12 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2019 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/Utilities/AlgebraHelpers.hpp" -#include "Acts/Utilities/TypeTraits.hpp" #include #include @@ -20,11 +19,9 @@ namespace Acts { template template -void MultiTrajectory::visitBackwards(IndexType iendpoint, - F&& callable) const { - static_assert(detail_lt::VisitorConcept, - "Callable needs to satisfy VisitorConcept"); - +void MultiTrajectory::visitBackwards(IndexType iendpoint, F&& callable) const + requires detail_lt::VisitorConcept +{ if (iendpoint == MultiTrajectoryTraits::kInvalid) { throw std::runtime_error( "Cannot visit backwards with kInvalid as endpoint"); diff --git a/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp b/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp index 7898a336754..92ae47270bc 100644 --- a/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp +++ b/Core/include/Acts/EventData/MultiTrajectoryBackendConcept.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/EventData/MultiTrajectoryHelpers.hpp b/Core/include/Acts/EventData/MultiTrajectoryHelpers.hpp index 84d4c763a7b..2cc417bc133 100644 --- a/Core/include/Acts/EventData/MultiTrajectoryHelpers.hpp +++ b/Core/include/Acts/EventData/MultiTrajectoryHelpers.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2020-2024 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -14,6 +14,7 @@ #include "Acts/Geometry/Layer.hpp" #include "Acts/Geometry/TrackingVolume.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Utilities/Helpers.hpp" #include #include @@ -102,8 +103,7 @@ VolumeTrajectoryStateContainer trajectoryState( const auto& volume = geoID.volume(); const auto& layer = geoID.layer(); // Check if the track info for this sub-detector is requested - auto it = std::find(volumeIds.begin(), volumeIds.end(), volume); - if (it == volumeIds.end()) { + if (!rangeContainsValue(volumeIds, volume)) { return true; } // The trajectory state for this volume diff --git a/Core/include/Acts/EventData/ParticleHypothesis.hpp b/Core/include/Acts/EventData/ParticleHypothesis.hpp index 8fb7fe9ec03..f236441ede6 100644 --- a/Core/include/Acts/EventData/ParticleHypothesis.hpp +++ b/Core/include/Acts/EventData/ParticleHypothesis.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once diff --git a/Core/include/Acts/EventData/ProxyAccessor.hpp b/Core/include/Acts/EventData/ProxyAccessor.hpp index 6e6ffec53ae..429c0ef670b 100644 --- a/Core/include/Acts/EventData/ProxyAccessor.hpp +++ b/Core/include/Acts/EventData/ProxyAccessor.hpp @@ -1,10 +1,10 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2023 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once @@ -74,15 +74,17 @@ struct ProxyAccessorBase { /// Create the accessor from a string key /// @param _key the key - ProxyAccessorBase(const std::string& _key) : key{hashString(_key)} {} + constexpr ProxyAccessorBase(const std::string& _key) + : key{hashString(_key)} {} /// Access the stored key on the proxy given as an argument. Mutable version /// @tparam proxy_t the type of the proxy /// @param proxy the proxy object to access /// @return mutable reference to the column behind the key - template > - T& operator()(proxy_t proxy) const { + template + T& operator()(proxy_t proxy) const + requires(!ReadOnly) + { static_assert(!proxy_t::ReadOnly, "Cannot get mutable ref for const track proxy"); return proxy.template component(key); @@ -92,9 +94,10 @@ struct ProxyAccessorBase { /// @tparam proxy_t the type of the track proxy /// @param proxy the proxy to access /// @return const reference to the column behind the key - template > - const T& operator()(proxy_t proxy) const { + template + const T& operator()(proxy_t proxy) const + requires(ReadOnly) + { if constexpr (proxy_t::ReadOnly) { return proxy.template component(key); diff --git a/Core/include/Acts/EventData/Seed.hpp b/Core/include/Acts/EventData/Seed.hpp new file mode 100644 index 00000000000..f3c6707b2e1 --- /dev/null +++ b/Core/include/Acts/EventData/Seed.hpp @@ -0,0 +1,44 @@ +// 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/. + +#pragma once + +#include +#include + +namespace Acts { + +template +class Seed { + static_assert(N >= 3ul); + + public: + using value_type = external_spacepoint_t; + static constexpr std::size_t DIM = N; + + template + requires(sizeof...(args_t) == N) && + (std::same_as && ...) + explicit Seed(const args_t&... points); + + void setVertexZ(float vertex); + void setQuality(float seedQuality); + + const std::array& sp() const; + float z() const; + float seedQuality() const; + + private: + std::array m_spacepoints{}; + float m_vertexZ{0.f}; + float m_seedQuality{-std::numeric_limits::infinity()}; +}; + +} // namespace Acts + +#include "Acts/EventData/Seed.ipp" diff --git a/Core/include/Acts/EventData/Seed.ipp b/Core/include/Acts/EventData/Seed.ipp new file mode 100644 index 00000000000..e977a3d67d7 --- /dev/null +++ b/Core/include/Acts/EventData/Seed.ipp @@ -0,0 +1,44 @@ +// 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/. + +namespace Acts { + +template +template + requires(sizeof...(args_t) == N) && + (std::same_as && ...) +Seed::Seed(const args_t&... points) + : m_spacepoints({&points...}) {} + +template +void Seed::setVertexZ(float vertex) { + m_vertexZ = vertex; +} + +template +void Seed::setQuality(float seedQuality) { + m_seedQuality = seedQuality; +} + +template +const std::array& +Seed::sp() const { + return m_spacepoints; +} + +template +float Seed::z() const { + return m_vertexZ; +} + +template +float Seed::seedQuality() const { + return m_seedQuality; +} + +} // namespace Acts diff --git a/Core/include/Acts/EventData/SourceLink.hpp b/Core/include/Acts/EventData/SourceLink.hpp index 4d26b7589c9..ba1515738e6 100644 --- a/Core/include/Acts/EventData/SourceLink.hpp +++ b/Core/include/Acts/EventData/SourceLink.hpp @@ -1,20 +1,19 @@ -// This file is part of the Acts project. +// This file is part of the ACTS project. // -// Copyright (C) 2021 CERN for the benefit 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 http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. #pragma once #include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/Utilities/Any.hpp" #include "Acts/Utilities/Delegate.hpp" -#include "Acts/Utilities/TypeTraits.hpp" #include -#include +#include #include #include @@ -34,12 +33,13 @@ class SourceLink final { SourceLink& operator=(const SourceLink& other) = default; SourceLink& operator=(SourceLink&& other) = default; - /// Constructor from concrete sourcelink + /// Constructor from concrete source link /// @tparam T The source link type /// @param upstream The upstream source link to store - template , SourceLink>>> - explicit SourceLink(T&& upstream) : m_upstream(std::forward(upstream)) { + template + explicit SourceLink(T&& upstream) + requires(!std::same_as, SourceLink>) + : m_upstream(std::forward(upstream)) { static_assert(!std::is_same_v, SourceLink>, "Cannot wrap SourceLink in SourceLink"); } @@ -85,10 +85,6 @@ struct SourceLinkAdapterIterator { return m_iterator == other.m_iterator; } - bool operator!=(const SourceLinkAdapterIterator& other) const { - return !(*this == other); - } - Acts::SourceLink operator*() const { return Acts::SourceLink{*m_iterator}; } auto operator-(const SourceLinkAdapterIterator& other) const { diff --git a/Core/include/Acts/EventData/SpacePointContainer.hpp b/Core/include/Acts/EventData/SpacePointContainer.hpp new file mode 100644 index 00000000000..619a1393ecc --- /dev/null +++ b/Core/include/Acts/EventData/SpacePointContainer.hpp @@ -0,0 +1,163 @@ +// 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/. + +#pragma once + +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Definitions/Units.hpp" +#include "Acts/EventData/SpacePointData.hpp" +#include "Acts/EventData/SpacePointProxy.hpp" +#include "Acts/EventData/Utils.hpp" +#include "Acts/Utilities/HashedString.hpp" +#include "Acts/Utilities/Iterator.hpp" + +#include +#include + +namespace Acts { + +struct SpacePointContainerConfig { + bool useDetailedDoubleMeasurementInfo = false; + bool isInInternalUnits = false; + + SpacePointContainerConfig toInternalUnits() const { + if (isInInternalUnits) { + throw std::runtime_error( + "Repeated conversion to internal units for " + "SpacePointContainerConfig"); + } + using namespace Acts::UnitLiterals; + SpacePointContainerConfig config = *this; + config.isInInternalUnits = true; + return config; + }; +}; + +struct SpacePointContainerOptions { + // location of beam in x,y plane. + // used as offset for Space Points + Acts::Vector2 beamPos{0 * Acts::UnitConstants::mm, + 0 * Acts::UnitConstants::mm}; + bool isInInternalUnits = false; + + SpacePointContainerOptions toInternalUnits() const { + if (isInInternalUnits) { + throw std::runtime_error( + "Repeated conversion to internal units for " + "SpacePointContainerOptions"); + } + using namespace Acts::UnitLiterals; + SpacePointContainerOptions options = *this; + options.isInInternalUnits = true; + options.beamPos[0] /= 1_mm; + options.beamPos[1] /= 1_mm; + return options; + } +}; + +template class holder_t> +class SpacePointContainer { + public: + friend class Acts::SpacePointProxy< + Acts::SpacePointContainer>; + + public: + using SpacePointProxyType = + Acts::SpacePointProxy>; + + using iterator = + ContainerIndexIterator, + SpacePointProxyType&, false>; + using const_iterator = + ContainerIndexIterator, + const SpacePointProxyType&, true>; + + using ValueType = typename container_t::ValueType; + using ProxyType = SpacePointProxyType; + using value_type = ProxyType; + using size_type = std::size_t; + + public: + // Constructors + // It makes sense to support both options of + // taking or not the ownership + + // Do not take ownership + // Activate only if holder_t is RefHolder + template