diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index f8a45866cfa..ae6020bbc9d 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -82,7 +82,7 @@ jobs: - name: Save PR number to file if: github.event_name == 'pull_request' - run: echo ${{ github.event.number }} > PR_NUMBER.txt + run: echo -n ${{ github.event.number }} > PR_NUMBER.txt - name: Persist PR number if: github.event_name == 'pull_request' diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index faa74ba10cd..d70ffc5b3ee 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -158,7 +158,7 @@ jobs: source build/this_acts_withdeps.sh python3 -m pip install -r Examples/Python/tests/requirements.txt python3 -m pip install pytest-md-report - pytest -rfExw -k "not exatrkx" -v + pytest -rfExw -k "not gnn" -v cat ${PYTEST_MD_REPORT_OUTPUT} >> $GITHUB_STEP_SUMMARY linux_physmon: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 89f2fd7e305..e76a54c9ee9 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -113,30 +113,30 @@ jobs: ls -al build/coverage - name: Run sonar-scanner (PR mode) - uses: SonarSource/sonarqube-scan-action@v5.3.0 + uses: SonarSource/sonarqube-scan-action@v5.3.1 if: github.event.workflow_run.event == 'pull_request' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here with: args: > - --define sonar.cfamily.compile-commands="build/compile_commands.json" + --define sonar.cfamily.compile-commands=build/compile_commands.json --define sonar.coverageReportPaths=build/coverage/cov.xml - --define sonar.projectVersion="${{ steps.next_version.outputs.content }}" - --define sonar.scm.revision="${{ github.event.workflow_run.head_sha }}" - --define sonar.pullrequest.key="${{ steps.pr_number.outputs.content }}" - --define sonar.pullrequest.branch="${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}" - --define sonar.pullrequest.base="${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}" + --define sonar.projectVersion=${{ steps.next_version.outputs.content }} + --define sonar.scm.revision=${{ github.event.workflow_run.head_sha }} + --define sonar.pullrequest.key=${{ steps.pr_number.outputs.content }} + --define sonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} + --define sonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} - name: Run sonar-scanner (push mode) - uses: SonarSource/sonarqube-scan-action@v5.3.0 + uses: SonarSource/sonarqube-scan-action@v5.3.1 if: github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here with: args: > - --define sonar.cfamily.compile-commands="build/compile_commands.json" + --define sonar.cfamily.compile-commands=build/compile_commands.json --define sonar.coverageReportPaths=build/coverage/cov.xml - --define sonar.projectVersion="${{ steps.next_version.outputs.content }}" + --define sonar.projectVersion=${{ steps.next_version.outputs.content }} --define sonar.branch.name=main diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2dc663a536d..81b6e496979 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -100,7 +100,7 @@ clang_tidy: after_script: - !reference [.spack_cleanup, after_script] -build_exatrkx_cpu: +build_gnn_cpu: stage: build image: registry.cern.ch/ghcr.io/acts-project/ubuntu2404_exatrkx:80 tags: @@ -126,9 +126,9 @@ build_exatrkx_cpu: # Here we only do a minimal build without examples to save resources - > cmake -B build -S src - --preset=gitlab-ci-exatrkx - -DACTS_EXATRKX_ENABLE_CUDA=OFF - -DACTS_EXATRKX_ENABLE_MODULEMAP=OFF + --preset=gitlab-ci-gnn + -DACTS_GNN_ENABLE_CUDA=OFF + -DACTS_GNN_ENABLE_MODULEMAP=OFF - ccache -z - cmake --build build -- -j6 @@ -137,7 +137,7 @@ build_exatrkx_cpu: after_script: - !reference [.spack_cleanup, after_script] -build_exatrkx: +build_gnn: stage: build image: registry.cern.ch/ghcr.io/acts-project/ubuntu2404_exatrkx:80 tags: @@ -170,7 +170,7 @@ build_exatrkx: - mkdir build - > cmake -B build -S src - --preset=gitlab-ci-exatrkx + --preset=gitlab-ci-gnn - ccache -z - cmake --build build -- -j6 @@ -179,10 +179,10 @@ build_exatrkx: after_script: - !reference [.spack_cleanup, after_script] -test_exatrkx_unittests: +test_gnn_unittests: stage: test needs: - - build_exatrkx + - build_gnn image: registry.cern.ch/ghcr.io/acts-project/ubuntu2404_exatrkx:80 tags: - docker-gpu-nvidia @@ -199,15 +199,15 @@ test_exatrkx_unittests: CI/dependencies/setup.sh -c g++ -e .env source .env - cd .. - - ctest --test-dir build -R "(ExaTrkX|ConnectedComponentsCuda|JunctionRemoval|Tensor)" + - ctest --test-dir build -R "(Gnn|ConnectedComponentsCuda|JunctionRemoval|Tensor)" after_script: - !reference [.spack_cleanup, after_script] -test_exatrkx_python: +test_gnn_python: stage: test needs: - - build_exatrkx + - build_gnn image: registry.cern.ch/ghcr.io/acts-project/ubuntu2404_exatrkx:80 tags: - docker-gpu-nvidia @@ -356,7 +356,7 @@ linux_test_examples: - source build/this_acts_withdeps.sh - cd src - python3 -m pip install -r Examples/Python/tests/requirements.txt - - pytest -rfExw -k "not exatrkx" -v + - pytest -rfExw -k "not gnn" -v after_script: - !reference [.spack_cleanup, after_script] diff --git a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf.root b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf.root index 830c1379c74..7ea944afc08 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf.root 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 index fdc79a8f122..1d22037549b 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_finding_ckf_ambi.root 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 index a44305770d3..264fb593b9c 100644 Binary files a/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf.root and b/CI/physmon/reference/trackfinding_4muon_50vertices/performance_fitting_ckf.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 e1fcf7f7ad5..1199bfe9827 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 bdcb1310909..91936289c0b 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 f00b5115a8f..977e94cd815 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 d98e15b0746..2a527a2ffaa 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 41f0fd007e4..d51b2f526b3 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_finding_ckf.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf.root index b5306747a04..aea11edb4dd 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf.root 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 index 1aff01a192f..304a4e0eae0 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ambi.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ambi.root differ diff --git a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ml_solver.root b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ml_solver.root index 0a2e14affed..23c728a86bb 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ml_solver.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_finding_ckf_ml_solver.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 index c6ebbf0ba91..e06dcca0f0a 100644 Binary files a/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf.root and b/CI/physmon/reference/trackfinding_ttbar_pu200/performance_fitting_ckf.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 52e66eef555..7e5b3e3b2ab 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 5b64f11e70c..6a63a4ba16b 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 549935c53d9..e28a42cf3af 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 4b612d4ae7a..e428077d0b5 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 0477ccfd4f4..65f2fb986cc 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_kf/performance_trackfitting.root b/CI/physmon/reference/trackfitting_kf/performance_trackfitting.root index 16faff9bdfa..adc398698a4 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 index 9e46b1e8a9c..b9cd9681deb 100644 Binary files a/CI/physmon/reference/trackrefitting_gsf/performance_trackrefitting.root 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 index 8c319ef4fac..e199718329a 100644 Binary files a/CI/physmon/reference/trackrefitting_kf/performance_trackrefitting.root and b/CI/physmon/reference/trackrefitting_kf/performance_trackrefitting.root differ diff --git a/CI/physmon/workflows/physmon_trackfitting_kf.py b/CI/physmon/workflows/physmon_trackfitting_kf.py index 767c2ff5d69..b7aadfb6da1 100755 --- a/CI/physmon/workflows/physmon_trackfitting_kf.py +++ b/CI/physmon/workflows/physmon_trackfitting_kf.py @@ -24,6 +24,8 @@ field=setup.field, digiConfigFile=setup.digiConfig, outputDir=tp, + reverseFilteringMomThreshold=float("inf"), + reverseFilteringCovarianceScaling=100.0, s=s, ) diff --git a/CI/physmon/workflows/physmon_trackrefitting_kf.py b/CI/physmon/workflows/physmon_trackrefitting_kf.py index ea82d26c701..d31879ae66a 100755 --- a/CI/physmon/workflows/physmon_trackrefitting_kf.py +++ b/CI/physmon/workflows/physmon_trackrefitting_kf.py @@ -24,6 +24,8 @@ field=setup.field, digiConfigFile=setup.digiConfig, outputDir=tp, + reverseFilteringMomThreshold=float("inf"), + reverseFilteringCovarianceScaling=100.0, s=s, ) diff --git a/CMakeLists.txt b/CMakeLists.txt index e84baa359d1..57e7be5f9cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,12 +85,12 @@ option(ACTS_BUILD_PLUGIN_FASTJET "Build FastJet plugin" OFF) option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF) option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF) option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF) -option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF) -option(ACTS_EXATRKX_ENABLE_ONNX "Build the Onnx backend for the exatrkx plugin" OFF) -option(ACTS_EXATRKX_ENABLE_TORCH "Build the torchscript backend for the exatrkx plugin" ON) -option(ACTS_EXATRKX_ENABLE_CUDA "Enable CUDA for the exatrkx plugin" OFF) -option(ACTS_EXATRKX_ENABLE_MODULEMAP "Enable Module-Map-based graph construction" OFF) -option(ACTS_EXATRKX_ENABLE_TENSORRT "Enable the native TensorRT inference modules" OFF) +option(ACTS_BUILD_PLUGIN_GNN "Build the GNN plugin" OFF) +option(ACTS_GNN_ENABLE_ONNX "Build the Onnx backend for the gnn plugin" OFF) +option(ACTS_GNN_ENABLE_TORCH "Build the torchscript backend for the gnn plugin" ON) +option(ACTS_GNN_ENABLE_CUDA "Enable CUDA for the gnn plugin" OFF) +option(ACTS_GNN_ENABLE_MODULEMAP "Enable Module-Map-based graph construction" OFF) +option(ACTS_GNN_ENABLE_TENSORRT "Enable the native TensorRT inference modules" OFF) option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF) option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF) option(ACTS_BUILD_PLUGIN_ROOT "Build ROOT plugin" OFF) @@ -105,7 +105,7 @@ option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF) option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF) option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF) option(ACTS_BUILD_EXAMPLES_PODIO "Build Podio-based code in the examples" OFF) -option(ACTS_BUILD_EXAMPLES_EXATRKX "Build the Exa.TrkX example code" OFF) +option(ACTS_BUILD_EXAMPLES_GNN "Build the GNN example code" OFF) option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-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) @@ -155,7 +155,7 @@ set_option_if( OR ACTS_BUILD_EXAMPLES_PYTHIA8 OR - ACTS_BUILD_EXAMPLES_EXATRKX + ACTS_BUILD_EXAMPLES_GNN OR ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS ) @@ -187,12 +187,12 @@ set_option_if( ) set_option_if(ACTS_BUILD_PLUGIN_JSON ACTS_BUILD_EXAMPLES) set_option_if(ACTS_BUILD_FATRAS ACTS_BUILD_EXAMPLES) -set_option_if(ACTS_BUILD_PLUGIN_EXATRKX ACTS_BUILD_EXAMPLES_EXATRKX) +set_option_if(ACTS_BUILD_PLUGIN_GNN ACTS_BUILD_EXAMPLES_GNN) set_option_if(ACTS_BUILD_PLUGIN_FPEMON ACTS_BUILD_EXAMPLES) 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) -set_option_if(ACTS_EXATRKX_ENABLE_CUDA ACTS_EXATRKX_ENABLE_MODULEMAP) +set_option_if(ACTS_GNN_ENABLE_CUDA ACTS_GNN_ENABLE_MODULEMAP) # feature tests include(CheckCXXSourceCompiles) @@ -417,19 +417,19 @@ if(ACTS_BUILD_ANALYSIS_APPS) ) check_root_compatibility() endif() -if(ACTS_BUILD_PLUGIN_EXATRKX) - if(ACTS_EXATRKX_ENABLE_CUDA) +if(ACTS_BUILD_PLUGIN_GNN) + if(ACTS_GNN_ENABLE_CUDA) find_package(CUDAToolkit REQUIRED) enable_cuda() - message(STATUS "Build Exa.TrkX plugin with CUDA") + message(STATUS "Build GNN plugin with CUDA") else() - message(STATUS "Build Exa.TrkX plugin for CPU only") + message(STATUS "Build GNN plugin for CPU only") endif() - if(ACTS_EXATRKX_ENABLE_TORCH) + if(ACTS_GNN_ENABLE_TORCH) find_package(Torch REQUIRED) add_subdirectory(thirdparty/FRNN) endif() - if(ACTS_EXATRKX_ENABLE_MODULEMAP) + if(ACTS_GNN_ENABLE_MODULEMAP) if(ACTS_USE_SYSTEM_MODULEMAPGRAPH) find_package(ModuleMapGraph REQUIRED COMPONENTS CPU GPU) else() @@ -437,7 +437,7 @@ if(ACTS_BUILD_PLUGIN_EXATRKX) endif() endif() endif() -if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_EXATRKX_ENABLE_ONNX) +if(ACTS_BUILD_PLUGIN_ONNX OR ACTS_GNN_ENABLE_ONNX) find_package(onnxruntime ${_acts_onnxruntime_version} MODULE REQUIRED) endif() if(ACTS_BUILD_PLUGIN_EDM4HEP OR ACTS_BUILD_PLUGIN_PODIO) diff --git a/CMakePresets.json b/CMakePresets.json index a1ab54afec9..4cc531a16a7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -62,14 +62,14 @@ "ACTS_BUILD_PLUGIN_GEOMODEL": "ON", "ACTS_BUILD_PLUGIN_TRACCC": "ON", "ACTS_BUILD_PLUGIN_GEANT4": "ON", - "ACTS_BUILD_PLUGIN_EXATRKX": "OFF", + "ACTS_BUILD_PLUGIN_GNN": "OFF", "ACTS_BUILD_PLUGIN_JSON": "ON", "ACTS_BUILD_PLUGIN_ONNX": "OFF", "ACTS_BUILD_PLUGIN_TGEO": "ON", "ACTS_BUILD_PLUGIN_FASTJET": "ON", "ACTS_BUILD_EXAMPLES_EDM4HEP": "ON", "ACTS_BUILD_EXAMPLES_PODIO": "ON", - "ACTS_BUILD_EXAMPLES_EXATRKX": "OFF", + "ACTS_BUILD_EXAMPLES_GNN": "OFF", "ACTS_BUILD_EXAMPLES_GEANT4": "ON", "ACTS_BUILD_EXAMPLES_PYTHIA8": "ON", "ACTS_BUILD_EXAMPLES_HASHING": "ON", @@ -120,8 +120,8 @@ } }, { - "name": "gitlab-ci-exatrkx", - "displayName": "GitLab-CI ExaTrkX", + "name": "gitlab-ci-gnn", + "displayName": "GitLab-CI Gnn", "generator": "Ninja", "cacheVariables": { "CMAKE_CXX_STANDARD": "20", @@ -133,14 +133,14 @@ "CMAKE_CUDA_ARCHITECTURES": "86", "TORCH_CUDA_ARCH_LIST": "8.6", "ACTS_FORCE_ASSERTIONS": "ON", - "ACTS_BUILD_PLUGIN_EXATRKX": "ON", + "ACTS_BUILD_PLUGIN_GNN": "ON", "ACTS_BUILD_EXAMPLES_ROOT": "ON", - "ACTS_BUILD_EXAMPLES_EXATRKX": "ON", + "ACTS_BUILD_EXAMPLES_GNN": "ON", "ACTS_BUILD_UNITTESTS": "ON", - "ACTS_EXATRKX_ENABLE_TORCH": "ON", - "ACTS_EXATRKX_ENABLE_ONNX": "ON", - "ACTS_EXATRKX_ENABLE_CUDA": "ON", - "ACTS_EXATRKX_ENABLE_MODULEMAP": "ON", + "ACTS_GNN_ENABLE_TORCH": "ON", + "ACTS_GNN_ENABLE_ONNX": "ON", + "ACTS_GNN_ENABLE_CUDA": "ON", + "ACTS_GNN_ENABLE_MODULEMAP": "ON", "ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS": "ON", "ACTS_ENABLE_LOG_FAILURE_THRESHOLD": "ON" } @@ -154,11 +154,11 @@ "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", "CMAKE_CUDA_ARCHITECTURES": "86", "TORCH_CUDA_ARCH_LIST": "8.6", - "ACTS_BUILD_PLUGIN_EXATRKX": "ON", - "ACTS_EXATRKX_ENABLE_TORCH": "OFF", - "ACTS_EXATRKX_ENABLE_CUDA": "ON", - "ACTS_EXATRKX_ENABLE_TENSORRT": "ON", - "ACTS_EXATRKX_ENABLE_MODULEMAP": "OFF" + "ACTS_BUILD_PLUGIN_GNN": "ON", + "ACTS_GNN_ENABLE_TORCH": "OFF", + "ACTS_GNN_ENABLE_CUDA": "ON", + "ACTS_GNN_ENABLE_TENSORRT": "ON", + "ACTS_GNN_ENABLE_MODULEMAP": "OFF" } } ] diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c66b362258e..52682c46916 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,6 +1,6 @@ # Code Of Conduct -The Acts project observes [CERN's Code of Conduct](https://cern.ch/codeofconduct). +The ACTS project observes [CERN's Code of Conduct](https://cern.ch/codeofconduct). Below is a plain text summary of the [official PDF](https://cds.cern.ch/record/2240689/files/BrochureCodeofConductEN.pdf?) as of 1. April 2020. Please consult the [PDF](https://cds.cern.ch/record/2240689/files/BrochureCodeofConductEN.pdf?) for up-to-date information. diff --git a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp index fff9d7314b0..37b0935097c 100644 --- a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp +++ b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.hpp @@ -151,6 +151,34 @@ class ScoreBasedAmbiguityResolution { std::vector hitSelections = {}; }; + struct ScoreMonitor { + double pT = 0.0; + double eta = 0.0; + double phi = 0.0; + + double ptScore = 0; + std::vector detectorHitScore; + std::vector detectorHoleScore; + std::vector detectorOutlierScore; + std::vector detectorOtherScore; + double chi2Score = 0; + + std::vector optionalScore; + + double totalScore = 0; + + void setZero() { + ptScore = 0; + detectorHitScore.clear(); + detectorHoleScore.clear(); + detectorOutlierScore.clear(); + detectorOtherScore.clear(); + chi2Score = 0; + optionalScore.clear(); + totalScore = 0; + } + }; + explicit ScoreBasedAmbiguityResolution( const Config& cfg, std::unique_ptr logger = @@ -170,26 +198,30 @@ class ScoreBasedAmbiguityResolution { /// @param tracks is the input track container /// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures /// @param optionals is the user defined optional cuts to be applied. + /// @param scoreMonitor is an optional vector to monitor the track score /// @return a vector of scores for each track template std::vector simpleScore( const track_container_t& tracks, const std::vector>& trackFeaturesVectors, const Optionals& optionals = - {}) const; + {}, + std::vector* scoreMonitor = nullptr) const; /// Compute the score of each track based on the ambiguity function. /// /// @param tracks is the input track container /// @param trackFeaturesVectors is the trackFeatures map from detector ID to trackFeatures /// @param optionals is the user defined optional cuts to be applied. + /// @param scoreMonitor is an optional vector to monitor the track score /// @return a vector of scores for each track template std::vector ambiguityScore( const track_container_t& tracks, const std::vector>& trackFeaturesVectors, const Optionals& optionals = - {}) const; + {}, + std::vector* scoreMonitor = nullptr) const; /// Rejects Tracks based on eta dependent cuts. /// @@ -228,6 +260,7 @@ class ScoreBasedAmbiguityResolution { /// @param sourceLinkHash is the source links /// @param sourceLinkEquality is the equality function for the source links /// @param optionals are the optional cuts and score modifiers to be applied + /// @param scoreMonitor is an optional vector to monitor the track score /// @return a vector of IDs of the tracks we want to keep template @@ -235,7 +268,8 @@ class ScoreBasedAmbiguityResolution { const track_container_t& tracks, source_link_hash_t sourceLinkHash, source_link_equality_t sourceLinkEquality, const Optionals& optionals = - {}) const; + {}, + std::vector* scoreMonitor = nullptr) const; private: Config m_cfg; diff --git a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp index 151398fa14a..d371bb84ea8 100644 --- a/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp +++ b/Core/include/Acts/AmbiguityResolution/ScoreBasedAmbiguityResolution.ipp @@ -74,11 +74,15 @@ template std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( const track_container_t& tracks, const std::vector>& trackFeaturesVectors, - const Optionals& optionals) - const { + const Optionals& optionals, + std::vector* scoreMonitor) const { std::vector trackScore; - trackScore.reserve(tracks.size()); + trackScore.reserve(tracks.size()); + if (scoreMonitor) { + scoreMonitor->clear(); + scoreMonitor->reserve(tracks.size()); + } int iTrack = 0; ACTS_VERBOSE("Number of detectors: " << m_cfg.detectorConfigs.size()); @@ -90,7 +94,10 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( // get the trackFeatures map for the track const auto& trackFeaturesVector = trackFeaturesVectors[iTrack]; double score = 1; + ScoreMonitor monitor; auto eta = Acts::VectorHelpers::eta(track.momentum()); + monitor.phi = Acts::VectorHelpers::phi(track.momentum()); + monitor.pT = Acts::VectorHelpers::perp(track.momentum()); // cuts on optional cuts for (const auto& cutFunction : optionals.cuts) { @@ -105,6 +112,10 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( if (score == 0) { iTrack++; trackScore.push_back(score); + monitor.setZero(); + if (scoreMonitor) { + scoreMonitor->push_back(monitor); + } ACTS_DEBUG("Track: " << iTrack << " score : " << score); continue; } @@ -134,6 +145,10 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( if (score == 0) { iTrack++; trackScore.push_back(score); + monitor.setZero(); + if (scoreMonitor) { + scoreMonitor->push_back(monitor); + } ACTS_DEBUG("Track: " << iTrack << " score : " << score); continue; } @@ -152,14 +167,23 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( const auto& trackFeatures = trackFeaturesVector[detectorId]; score += trackFeatures.nHits * detector.hitsScoreWeight; + monitor.detectorHitScore.push_back(trackFeatures.nHits * + detector.hitsScoreWeight); score += trackFeatures.nHoles * detector.holesScoreWeight; + monitor.detectorHoleScore.push_back(trackFeatures.nHoles * + detector.holesScoreWeight); score += trackFeatures.nOutliers * detector.outliersScoreWeight; + monitor.detectorOutlierScore.push_back(trackFeatures.nOutliers * + detector.outliersScoreWeight); score += trackFeatures.nSharedHits * detector.otherScoreWeight; + monitor.detectorOtherScore.push_back(trackFeatures.nSharedHits * + detector.otherScoreWeight); } // Adding scores based on optional weights for (const auto& weightFunction : optionals.weights) { weightFunction(track, score); + monitor.optionalScore.push_back(score); } // Adding the score based on the chi2/ndf @@ -167,11 +191,15 @@ std::vector Acts::ScoreBasedAmbiguityResolution::simpleScore( double p = 1. / std::log10(10. + 10. * track.chi2() / track.nDoF()); if (p > 0) { score += p; + monitor.chi2Score = p; } else { score -= 50; + monitor.chi2Score = -50; } } + monitor.totalScore = score; + iTrack++; // Add the score to the vector @@ -187,11 +215,16 @@ template std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( const track_container_t& tracks, const std::vector>& trackFeaturesVectors, - const Optionals& optionals) - const { + const Optionals& optionals, + std::vector* scoreMonitor) const { std::vector trackScore; trackScore.reserve(tracks.size()); + if (scoreMonitor) { + scoreMonitor->clear(); + scoreMonitor->reserve(tracks.size()); + } + ACTS_VERBOSE("Using Ambiguity Scoring function"); int iTrack = 0; @@ -205,8 +238,14 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( // get the trackFeatures map for the track const auto& trackFeaturesVector = trackFeaturesVectors[iTrack]; double score = 1; + ScoreMonitor monitor; auto pT = Acts::VectorHelpers::perp(track.momentum()); auto eta = Acts::VectorHelpers::eta(track.momentum()); + auto phi = Acts::VectorHelpers::phi(track.momentum()); + + monitor.pT = pT; + monitor.eta = eta; + monitor.phi = phi; // cuts on optional cuts for (const auto& cutFunction : optionals.cuts) { @@ -221,6 +260,10 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( if (score == 0) { iTrack++; trackScore.push_back(score); + monitor.setZero(); + if (scoreMonitor) { + scoreMonitor->push_back(monitor); + } ACTS_DEBUG("Track: " << iTrack << " score : " << score); continue; } @@ -250,6 +293,10 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( if (score == 0) { iTrack++; trackScore.push_back(score); + monitor.setZero(); + if (scoreMonitor) { + scoreMonitor->push_back(monitor); + } ACTS_DEBUG("Track: " << iTrack << " score : " << score); continue; } @@ -262,6 +309,8 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( ACTS_DEBUG("Modifier for pT = " << pT << " GeV is : " << score << " New score now: " << score); + monitor.ptScore = score; + for (std::size_t detectorId = 0; detectorId < m_cfg.detectorConfigs.size(); detectorId++) { const auto& detector = m_cfg.detectorConfigs.at(detectorId); @@ -280,6 +329,7 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( << " hits: " << detector.factorHits[nHits] << " New score now: " << score); + monitor.detectorHitScore.push_back(detector.factorHits[nHits]); // choosing a scaling factor based on the number of holes in a track per // detector. std::size_t iHoles = trackFeatures.nHoles; @@ -288,6 +338,9 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( iHoles = detector.maxHoles; } score = score * detector.factorHoles[iHoles]; + + monitor.detectorHoleScore.push_back(detector.factorHoles[iHoles]); + ACTS_DEBUG("Modifier for " << iHoles << " holes: " << detector.factorHoles[iHoles] << " New score now: " << score); @@ -295,6 +348,7 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( for (const auto& scoreFunction : optionals.scores) { scoreFunction(track, score); + monitor.optionalScore.push_back(score); } if (track.chi2() > 0 && track.nDoF() > 0) { @@ -302,15 +356,23 @@ std::vector Acts::ScoreBasedAmbiguityResolution::ambiguityScore( int indf = track.nDoF(); double fac = 1. / std::log10(10. + 10. * chi2 / indf); score = score * fac; + + monitor.chi2Score = fac; + ACTS_DEBUG("Modifier for chi2 = " << chi2 << " and NDF = " << indf << " is : " << fac << " New score now: " << score); } + monitor.totalScore = score; + iTrack++; // Add the score to the vector trackScore.push_back(score); + if (scoreMonitor) { + scoreMonitor->push_back(monitor); + } ACTS_VERBOSE("Track: " << iTrack << " score: " << score); } // end of loop over tracks @@ -323,8 +385,8 @@ template Acts::ScoreBasedAmbiguityResolution::solveAmbiguity( const track_container_t& tracks, source_link_hash_t sourceLinkHash, source_link_equality_t sourceLinkEquality, - const Optionals& optionals) - const { + const Optionals& optionals, + std::vector* scoreMonitor) const { ACTS_INFO("Number of tracks before Ambiguty Resolution: " << tracks.size()); // vector of trackFeaturesVectors. where each trackFeaturesVector contains the // number of hits/hole/outliers for each detector in a track. @@ -335,9 +397,11 @@ std::vector Acts::ScoreBasedAmbiguityResolution::solveAmbiguity( std::vector trackScore; trackScore.reserve(tracks.size()); if (m_cfg.useAmbiguityScoring) { - trackScore = ambiguityScore(tracks, trackFeaturesVectors, optionals); + trackScore = + ambiguityScore(tracks, trackFeaturesVectors, optionals, scoreMonitor); } else { - trackScore = simpleScore(tracks, trackFeaturesVectors, optionals); + trackScore = + simpleScore(tracks, trackFeaturesVectors, optionals, scoreMonitor); } auto MeasurementIndexMap = diff --git a/Core/include/Acts/Clusterization/Clusterization.hpp b/Core/include/Acts/Clusterization/Clusterization.hpp index ddd518796b1..ba33caf5df3 100644 --- a/Core/include/Acts/Clusterization/Clusterization.hpp +++ b/Core/include/Acts/Clusterization/Clusterization.hpp @@ -11,7 +11,76 @@ #include #include +#include + namespace Acts::Ccl { +using Label = int; +constexpr Label NO_LABEL = 0; +} // namespace Acts::Ccl + +namespace Acts::Ccl { +// Simple wrapper around boost::disjoint_sets. In theory, could use +// boost::vector_property_map and use boost::disjoint_sets without +// wrapping, but it's way slower +class DisjointSets { + public: + explicit DisjointSets(std::size_t initial_size = 128) + : m_defaultSize(initial_size), + m_size(initial_size), + m_rank(m_size), + m_parent(m_size), + m_ds(&m_rank[0], &m_parent[0]) {} + + Acts::Ccl::Label makeSet() { + // Empirically, m_size = 128 seems to be good default. If we + // exceed this, take a performance hit and do the right thing. + while (m_globalId >= m_size) { + m_size *= 2; + m_rank.resize(m_size); + m_parent.resize(m_size); + m_ds = boost::disjoint_sets(&m_rank[0], + &m_parent[0]); + } + m_ds.make_set(m_globalId); + return static_cast(m_globalId++); + } + + void unionSet(std::size_t x, std::size_t y) { m_ds.union_set(x, y); } + Acts::Ccl::Label findSet(std::size_t x) { + return static_cast(m_ds.find_set(x)); + } + + void clear() { + m_size = m_defaultSize; + m_rank.clear(); + m_parent.clear(); + m_rank.resize(m_size); + m_parent.resize(m_size); + m_globalId = 1; + m_ds = boost::disjoint_sets(&m_rank[0], + &m_parent[0]); + } + + private: + std::size_t m_defaultSize{128}; + std::size_t m_globalId = 1; + std::size_t m_size{m_defaultSize}; + std::vector m_rank; + std::vector m_parent; + boost::disjoint_sets m_ds; +}; + +struct ClusteringData { + void clear() { + labels.clear(); + nClusters.clear(); + ds.clear(); + } + + std::vector labels{}; + std::vector nClusters{}; + Acts::Ccl::DisjointSets ds{}; +}; template concept HasRetrievableColumnInfo = requires(Cell cell) { @@ -33,9 +102,6 @@ concept CanReserve = requires(Cluster cluster, std::size_t n) { { clusterReserve(cluster, n) } -> std::same_as; }; -using Label = int; -constexpr Label NO_LABEL = 0; - // When looking for a cell connected to a reference cluster, the code // always loops backward, starting from the reference cell. Since // the cells are globally sorted column-wise, the connection function @@ -90,15 +156,15 @@ struct DefaultConnect : public Connect2D { /// The `Cell` type must have the following functions defined: /// int getCellRow(const Cell&), /// int getCellColumn(const Cell&) -/// int& getCellLabel(Cell&) /// +/// @param [in] data collection of quantities for clusterization /// @param [in] cells the cell collection to be labeled /// @param [in] connect the connection type (see DefaultConnect) template > -std::vector labelClusters(CellCollection& cells, - Connect&& connect = Connect()); +void labelClusters(Acts::Ccl::ClusteringData& data, CellCollection& cells, + Connect&& connect = Connect()); /// @brief mergeClusters /// @@ -108,10 +174,11 @@ std::vector labelClusters(CellCollection& cells, /// void clusterAddCell(Cluster&, const Cell&) /// /// @return nothing -template - requires(GridDim == 1 || GridDim == 2) -ClusterCollection mergeClusters(CellCollection& /*cells*/); +template + requires(Acts::Ccl::CanAcceptCell) +void mergeClusters(Acts::Ccl::ClusteringData& data, const CellCollection& cells, + ClusterCollection& outv); /// @brief createClusters /// Convenience function which runs both labelClusters and createClusters. @@ -119,9 +186,21 @@ template > +[[deprecated]] ClusterCollection createClusters(CellCollection& cells, Connect&& connect = Connect()); +/// @brief createClusters +/// Alternative convenience function which runs both labelClusters and +/// createClusters. +template > + requires(GridDim == 1 || GridDim == 2) +void createClusters(Acts::Ccl::ClusteringData& data, CellCollection& cells, + ClusterCollection& clusters, Connect&& connect = Connect()); + } // namespace Acts::Ccl #include "Acts/Clusterization/Clusterization.ipp" diff --git a/Core/include/Acts/Clusterization/Clusterization.ipp b/Core/include/Acts/Clusterization/Clusterization.ipp index 7bda4b702ad..1dffd97611c 100644 --- a/Core/include/Acts/Clusterization/Clusterization.ipp +++ b/Core/include/Acts/Clusterization/Clusterization.ipp @@ -15,9 +15,7 @@ #include #include -#include - -namespace Acts::Ccl::internal { +namespace Acts::Ccl { template void reserve(Cluster& /*cl*/, std::size_t /*n*/) {} @@ -58,42 +56,6 @@ struct Compare { } }; -// Simple wrapper around boost::disjoint_sets. In theory, could use -// boost::vector_property_map and use boost::disjoint_sets without -// wrapping, but it's way slower -class DisjointSets { - public: - explicit DisjointSets(std::size_t initial_size = 128) - : m_size(initial_size), - m_rank(m_size), - m_parent(m_size), - m_ds(&m_rank[0], &m_parent[0]) {} - - Label makeSet() { - // Empirically, m_size = 128 seems to be good default. If we - // exceed this, take a performance hit and do the right thing. - while (m_globalId >= m_size) { - m_size *= 2; - m_rank.resize(m_size); - m_parent.resize(m_size); - m_ds = boost::disjoint_sets(&m_rank[0], - &m_parent[0]); - } - m_ds.make_set(m_globalId); - return static_cast