Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • holau/Gaudi
  • dmagdali/Gaudi
  • pmunozpa/Gaudi
  • ssottoco/Gaudi
  • cvarni/Gaudi
  • mafila/Gaudi
  • admorris/Gaudi
  • staider/Gaudi
  • gunther/Gaudi
  • bstanisl/Gaudi
  • jtorasso/Gaudi
  • wochung/Gaudi
  • mveghel/Gaudi
  • averbyts/Gaudi
  • dguest/Gaudi
  • alboyer/Gaudi
  • dkonst/Gaudi
  • jcarcell/Gaudi
  • elmsheus/Gaudi
  • hpxgaudi/Gaudi
  • ganis/Gaudi
  • tadej/Gaudi
  • hahansen/Gaudi
  • juesseiv/Gaudi
  • imjelde/gaudida
  • jheuel/Gaudi
  • mimazure/Gaudi
  • masato/Gaudi
  • dcasperfaser/Gaudi
  • faser/offline/Gaudi
  • axu/Gaudi
  • sailer/Gaudi
  • amete/Gaudi
  • ponyisi/Gaudi
  • vavolkl/Gaudi
  • mstahl/Gaudi
  • wlampl/Gaudi
  • kreczko/Gaudi
  • emoyse/Gaudi
  • dhynds/Gaudi
  • sstahl/Gaudi
  • rcurrie/Gaudi
  • smh/Gaudi
  • valassi/Gaudi
  • bwynne/Gaudi_gaudi
  • abarton/Gaudi
  • tsulaia/gaudigaudi
  • mnowak/Gaudi
  • roiser/Gaudi
  • merrenst/Gaudi
  • mato/Gaudi
  • christos/Gaudi
  • goetz/Gaudi
  • goetz/AtlasGaudi
  • tsulaia/atlasgaudi
  • olupton/Gaudi
  • pseyfert/Gaudi
  • graemes/Gaudi
  • akraszna/AtlasGaudi
  • cattanem/Gaudi
  • skluth/Gaudi
  • will/Gaudi
  • ssnyder/Gaudi
  • agonzale/Gaudi
  • leggett/AtlasGaudi
  • apearce/Gaudi
  • mnowak/Gaudi-ORIG
  • fwinkl/AtlasGaudi
  • bwynne/Gaudi_atlas
  • chamont/Gaudi
  • rmatev/Gaudi
  • lhcb/Gaudi
  • atlas/Gaudi
  • akraszna/GaudiGaudi
  • fwinkl/Gaudi
  • jonrob/Gaudi
  • azaborow/Gaudi
  • clemenci/Gaudi
  • hgraslan/Gaudi
  • srimanob/Gaudi
  • graven/Gaudi
  • hegner/Gaudi
  • gaudi/Gaudi
83 results
Show changes
Commits on Source (56)
Showing
with 354 additions and 1968 deletions
#####################################################################################
# (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations #
# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations #
# #
# This software is distributed under the terms of the Apache version 2 licence, #
# copied verbatim in the file "LICENSE". #
......@@ -9,30 +9,26 @@
# or submit itself to any jurisdiction. #
#####################################################################################
variables:
LCG_VERSION: "101"
CMAKE_GENERATOR: 'Ninja' # default build system
NO_LBLOGIN: "1" # prevent lbdocker containers to start LbLogin/LbEnv
TARGET_BRANCH: master
# All the configuration
default:
image: gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build
before_script:
# Add Ninja and CMake to the PATH
- export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.18.3/Linux-x86_64/bin:/cvmfs/sft.cern.ch/lcg/contrib/ninja/1.10.0/Linux-x86_64:$PATH"
- export CCACHE_DIR=$PWD/.ccache
- export PRESET=full
# Job templates
.build: &template_build
tags:
- cvmfs
image: gitlab-registry.cern.ch/lhcb-docker/os-base/centos7-devel:latest
before_script:
# Add Ninja and CMake to the PATH
- export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.20.0/Linux-$(uname -m)/bin:/cvmfs/sft.cern.ch/lcg/contrib/ninja/1.11.1/Linux-$(uname -m)/bin:$PATH"
- export CCACHE_DIR=$PWD/.ccache
- "export LCG_VERSION=$(cut -d: -f2 <<< $CI_JOB_NAME)"
- "export platform=$(cut -d: -f3 <<< $CI_JOB_NAME)"
- "export PRESET=$(cut -d: -f4 <<< $CI_JOB_NAME)"
- if [ -z "$PRESET" ] ; then PRESET=full ; fi
script:
- platform=${CI_JOB_NAME%/*}
- if [[ "${CI_JOB_NAME}" = */* ]] ; then PRESET=${CI_JOB_NAME#*/} ; fi
- git clone https://gitlab.cern.ch/lhcb-core/lcg-toolchains.git
- cmake --version
- cmake -S . -B build -Wno-dev -DCMAKE_TOOLCHAIN_FILE=lcg-toolchains/LCG_${LCG_VERSION}/${platform}.cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -C ci-utils/preset-${PRESET}.cmake
- cmake -S . -B build -Wno-dev -DCMAKE_TOOLCHAIN_FILE=lcg-toolchains/LCG_${LCG_VERSION}/${platform}.cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DGAUDI_TEST_PUBLIC_HEADERS_BUILD=yes -C ci-utils/preset-${PRESET}.cmake
- ccache -z
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
......@@ -42,104 +38,78 @@ default:
- done
# build from scratch
- cmake --build build --target clean
- cmake --build build 2>&1 | tee build/build.log
- cmake --build build 2>&1 | tee build.log
- ccache -s
artifacts:
paths:
- build
- lcg-toolchains
expire_in: 1 week
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- .ccache
.build-check: &template_build_check
variables:
LOG: build/build.log
script:
- ci-utils/build-check ${LOG}
allow_failure: true
.test: &template_test
tags:
- cvmfs
script:
- find build -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake
- cp build/compile_commands.json .
# run the tests
- cd build
- if ctest -T test -j $(nproc) --repeat until-pass:3 --no-compress-output ; then result=success ; else result=failure ; fi
- cp Testing/$(head -1 Testing/TAG)/Test.xml ..
- cd ..
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
# FIXME: Many tests require AIDA, so we ignore them in that case
- test "$PRESET" = "no-AIDA" -o "$result" = "success"
artifacts:
paths:
- build.log
- compile_commands.json
- Test.xml
reports:
junit:
- results.xml
when: always
expire_in: 1 week
.test_headers: &template_test_headers
tags:
- cvmfs
script:
- export CCACHE_DIR=$PWD/.ccache_headers
- find build -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake
- ccache -z
- cmake --build build --target test_public_headers_build 2>&1 | tee build/test_public_headers_build.log
- ccache -s
artifacts:
paths:
- build/test_public_headers_build.log
when: always
expire_in: 1 week
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- .ccache_headers
- .ccache
- build/Testing
.warnings-check: &template_warnings_check
image: gitlab-registry.cern.ch/linuxsupport/alma9-base:latest
variables:
LOG: build.log
script:
- ci-utils/build-check ${LOG}
allow_failure: true
### Build
x86_64-centos7-gcc11-opt:
lcg:103:x86_64-centos7-gcc12-opt:
<<: *template_build
x86_64-centos7-gcc11-dbg:
lcg:103:x86_64-centos7-gcc12-dbg:
<<: *template_build
x86_64-centos7-gcc11-opt/minimal:
lcg:103:x86_64-centos9-gcc12-opt:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
view-gcc8:
lcg:103:x86_64-centos9-gcc12-dbg:
<<: *template_build
script:
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/setup.sh
- cmake --version
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- ccache -z
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
- while [[ $jobs -ge 1 ]] ; do
- cmake --build build -j $jobs --target GaudiKernel && break || true
- jobs=$(( $jobs / 2 ))
- done
# build from scratch
- cmake --build build --target clean
- cmake --build build 2>&1 | tee build/build.log
- ccache -s
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
lhcb-gcc11:
lcg:103:x86_64-centos7-gcc11-opt:minimal:
<<: *template_build
variables:
BINARY_TAG: x86_64_v2-centos7-gcc11-opt
lcg:103:x86_64-centos7-gcc11-opt:no-AIDA:
<<: *template_build
lcg:103:x86_64-centos7-gcc12-opt:no-GaudiAlg:
<<: *template_build
lhcb:103:x86_64_v2-el9-gcc12-opt:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
script:
- shopt -s expand_aliases
- . /cvmfs/lhcb.cern.ch/lib/LbEnv
- cmake --version
- lb-set-platform $platform
- lb-project-init --overwrite
- ccache -z
- mkdir build.${BINARY_TAG}
- if [ -e build/Testing ] ; then mv build/Testing build.${BINARY_TAG} ; fi
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
- while [[ $jobs -ge 1 ]] ; do
......@@ -148,129 +118,118 @@ lhcb-gcc11:
- done
# build from scratch
- make clean
- make 2>&1 | tee build.${BINARY_TAG}/build.log
- make 2>&1 | tee build.log
- ccache -s
artifacts:
paths:
- build.${BINARY_TAG}
expire_in: 1 week
### Tests
x86_64-centos7-gcc11-opt:test:
<<: *template_test
needs:
- job: "x86_64-centos7-gcc11-opt"
artifacts: true
x86_64-centos7-gcc11-opt:test_headers:
<<: *template_test_headers
needs:
- job: "x86_64-centos7-gcc11-opt"
artifacts: true
x86_64-centos7-gcc11-dbg:test:
<<: *template_test
needs:
- job: "x86_64-centos7-gcc11-dbg"
artifacts: true
x86_64-centos7-gcc11-dbg:test_headers:
<<: *template_test_headers
needs:
- job: "x86_64-centos7-gcc11-dbg"
artifacts: true
view-gcc8:test:
<<: *template_test
needs:
- job: "view-gcc8"
artifacts: true
before_script:
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/setup.sh
lhcb-gcc11:test:
<<: *template_test
needs:
- job: "lhcb-gcc11"
artifacts: true
variables:
BINARY_TAG: x86_64_v2-centos7-gcc11-opt
script:
- . /cvmfs/lhcb.cern.ch/lib/LbEnv
- lb-project-init --overwrite
- find build.${BINARY_TAG} -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake
# run the tests
- if make test ARGS="-j $(nproc) --repeat until-pass:3 --no-compress-output" ; then result=success ; else result=failure ; fi
- cp build.${BINARY_TAG}/Testing/$(head -1 build.${BINARY_TAG}/Testing/TAG)/Test.xml .
- mkdir -p build && mv build.${BINARY_TAG}/Testing build
- cp build.${BINARY_TAG}/compile_commands.json .
- mv build.${BINARY_TAG}/html .
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
artifacts:
paths:
- build.log
- compile_commands.json
- Test.xml
- html
reports:
junit:
- results.xml
when: always
expire_in: 1 day
expire_in: 1 week
lcg-view:102b:x86_64-centos7-gcc11-opt:
<<: *template_build
script:
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/${platform}/setup.sh
- export CONFIGURABLE_DB_IGNORE=/cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/${platform}/lib/Gaudi.confdb
- cmake --version
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- ccache -z
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
- while [[ $jobs -ge 1 ]] ; do
- cmake --build build -j $jobs --target GaudiKernel && break || true
- jobs=$(( $jobs / 2 ))
- done
# build from scratch
- cmake --build build --target clean
- cmake --build build 2>&1 | tee build.log
- ccache -s
- cp build/compile_commands.json .
# run the tests
- cd build
- if ctest -T test -j $(nproc) --repeat until-pass:3 --no-compress-output ; then result=success ; else result=failure ; fi
- cp Testing/$(head -1 Testing/TAG)/Test.xml ..
- cd ..
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
### Check build outputs
x86_64-centos7-gcc11-opt:build-check:
<<: *template_build_check
warnings-check:lcg:103:x86_64-centos7-gcc12-opt:
<<: *template_warnings_check
needs:
- job: "x86_64-centos7-gcc11-opt"
- job: "lcg:103:x86_64-centos7-gcc12-opt"
artifacts: true
x86_64-centos7-gcc11-dbg:build-check:
<<: *template_build_check
warnings-check:lcg:103:x86_64-centos7-gcc12-dbg:
<<: *template_warnings_check
needs:
- job: "x86_64-centos7-gcc11-dbg"
- job: "lcg:103:x86_64-centos7-gcc12-dbg"
artifacts: true
x86_64-centos7-gcc11-opt:build-headers-check:
<<: *template_build_check
variables:
LOG: build/test_public_headers_build.log
warnings-check:lcg:103:x86_64-centos9-gcc12-opt:
<<: *template_warnings_check
needs:
- job: "x86_64-centos7-gcc11-opt:test_headers"
- job: "lcg:103:x86_64-centos9-gcc12-opt"
artifacts: true
x86_64-centos7-gcc11-dbg:build-headers-check:
<<: *template_build_check
variables:
LOG: build/test_public_headers_build.log
warnings-check:lcg:103:x86_64-centos9-gcc12-dbg:
<<: *template_warnings_check
needs:
- job: "x86_64-centos7-gcc11-dbg:test_headers"
- job: "lcg:103:x86_64-centos9-gcc12-dbg"
artifacts: true
view-gcc8:build-check:
<<: *template_build_check
warnings-check:lcg:103:x86_64-centos7-gcc11-opt:minimal:
<<: *template_warnings_check
needs:
- job: "view-gcc8"
- job: "lcg:103:x86_64-centos7-gcc11-opt:minimal"
artifacts: true
lhcb-gcc11:build-check:
<<: *template_build_check
warnings-check:lcg:103:x86_64-centos7-gcc12-opt:no-GaudiAlg:
<<: *template_warnings_check
needs:
- job: "lhcb-gcc11"
- job: "lcg:103:x86_64-centos7-gcc12-opt:no-GaudiAlg"
artifacts: true
warnings-check:lhcb:103:x86_64_v2-el9-gcc12-opt:
<<: *template_warnings_check
needs:
- job: "lhcb:103:x86_64_v2-el9-gcc12-opt"
artifacts: true
warnings-check:lcg-view:102b:x86_64-centos7-gcc11-opt:
<<: *template_warnings_check
needs:
- job: "lcg-view:102b:x86_64-centos7-gcc11-opt"
artifacts: true
variables:
BINARY_TAG: x86_64_v2-centos7-gcc11-opt
script:
- ci-utils/build-check build.${BINARY_TAG}/build.log
### Misc checks
x86_64-centos7-gcc11-opt:check-unused:
lcg:103:x86_64-centos7-gcc12-opt:check-unused:
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
needs:
- job: "x86_64-centos7-gcc11-opt"
- job: "lcg:103:x86_64-centos7-gcc12-opt"
artifacts: true
script:
- ci-utils/check-sources build/build.ninja
- ci-utils/check-sources compile_commands.json
allow_failure: true
pre-commit-checks:
image: registry.cern.ch/docker.io/library/python:3.8
image: registry.cern.ch/docker.io/library/python:3.9
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
......@@ -310,13 +269,23 @@ pre-commit-checks:
expire_in: 1 week
check-copyright:
image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7
image: registry.cern.ch/docker.io/library/python:3.9
script:
- curl -o lb-check-copyright "https://gitlab.cern.ch/lhcb-core/LbDevTools/-/raw/master/LbDevTools/SourceTools.py?inline=false"
- python lb-check-copyright --exclude lhcbproject.yml --exclude ci-utils/preset-default.cmake --exclude ci-utils/preset-full.cmake --exclude ci-utils/preset-minimal.cmake --exclude ci-utils/preset-no-test.cmake origin/${TARGET_BRANCH}
- |
curl -o lb-check-copyright "https://gitlab.cern.ch/lhcb-core/LbDevTools/-/raw/master/LbDevTools/SourceTools.py?inline=false"
python lb-check-copyright \
--exclude lhcbproject.yml \
--exclude ci-utils/preset-default.cmake \
--exclude ci-utils/preset-full.cmake \
--exclude ci-utils/preset-minimal.cmake \
--exclude ci-utils/preset-no-AIDA.cmake \
--exclude ci-utils/preset-no-GaudiAlg.cmake \
--exclude ci-utils/preset-no-test.cmake \
origin/${TARGET_BRANCH}
website:
image: python
image: registry.cern.ch/docker.io/library/python:3.9
script:
- rm -rf public
- mkdir -p public
......@@ -329,35 +298,29 @@ website:
- public
expire_in: 1 day
doxygen:
tags:
- cvmfs
needs:
- job: "view-gcc8"
artifacts: true
doxygen:103:x86_64-centos7-gcc12-opt:
<<: *template_build
script:
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/x86_64-centos7-gcc8-opt/setup.sh
- find build -type f -exec touch -d $(date +@%s) \{} \; # not to re-run cmake
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/${platform}/setup.sh
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- cmake --build build --target doc
- rm -rf public
- mkdir -p public/doxygen
- cp -r GaudiRelease/web_helpers/. public/doxygen/.
- mv build/doxygen/html ${CI_COMMIT_REF_SLUG}
- zip -r -q public/doxygen/${CI_COMMIT_REF_SLUG}.zip ${CI_COMMIT_REF_SLUG}
artifacts:
paths:
- public
expire_in: 1 day
# see https://gitlab.cern.ch/gitlabci-examples/deploy_eos for the details
# of the configuration
deploy-website:
needs:
- job: "website"
artifacts: true
- job: "doxygen"
- job: "doxygen:103:x86_64-centos7-gcc12-opt"
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == "master"
......
......@@ -6,6 +6,25 @@ Project Coordinators: Marco Clemencic @clemenci, Charles Leggett @leggett
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [v36r14](https://gitlab.cern.ch/gaudi/Gaudi/-/releases/v36r14) - 2023-06-19
This release features a number of minor fixes to help downstream projects
work with C++20, plus a few minor fixes.
### Changed
- Make sure `OutputStream` instances are configured with and explicit `Output`
option (gaudi/Gaudi#262 gaudi/Gaudi!1467)
### Added
- Allow disabling of `FIXTURES_REQUIRED` for qmtests (gaudi/Gaudi!1465)
- Made more methods public in Histograms (gaudi/Gaudi!1460)
- Add support for Gaudi::Property to fmtlib (gaudi/Gaudi!1462)
### Fixed
- Fix delegation of `T == Property&lt;T&gt;` for C++20 (gaudi/Gaudi!1466)
- Fixed improper ordering of stops methods in Sinks (gaudi/Gaudi!1464)
- Fixed usage of histograms with integer Arithmetic (gaudi/Gaudi!1461)
## [v36r13](https://gitlab.cern.ch/gaudi/Gaudi/-/releases/v36r13) - 2023-06-05
This is a minor bugfix release needed by LHCb to pick up some additions.
......
......@@ -55,6 +55,7 @@ after the configuration or use ccmake or cmake-gui.
* For sanitized build
* GAUDI_GENCONF_NO_FAIL
* Compile options
* GAUDI_ENABLE_GAUDIALG
* GAUDI_REFLEX_COMPONENT_ALIASES
* Doxygen
* DOXYGEN_WITH_LOCAL_MATHJAX
......@@ -80,7 +81,7 @@ Maintainer's guide: `<https://twiki.cern.ch/twiki/bin/view/LHCb/MaintainGaudiCMa
cmake_minimum_required(VERSION 3.15)
project(Gaudi VERSION 36.13
project(Gaudi VERSION 36.14
LANGUAGES CXX
DESCRIPTION "Gaudi Software Framework"
HOMEPAGE_URL "https://cern.ch/gaudi")
......@@ -103,12 +104,14 @@ include(cmake/GaudiToolbox.cmake)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable/Disable output of compile_commands.json" FORCE)
set(GAUDI_USE_PYTHON_MAJOR 3 CACHE STRING "Major version of Python to use")
set(GAUDI_OPTIONAL_DEPENDENCIES "${GAUDI_OPTIONAL_DEPENDENCIES}set(GAUDI_USE_PYTHON_MAJOR ${GAUDI_USE_PYTHON_MAJOR})\n")
string(APPEND GAUDI_OPTIONAL_DEPENDENCIES "set(GAUDI_USE_PYTHON_MAJOR ${GAUDI_USE_PYTHON_MAJOR})\n")
# Find all the dependencies of the project
list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") # (Find*.cmake)
include(cmake/GaudiDependencies.cmake)
string(APPEND GAUDI_OPTIONAL_DEPENDENCIES "set(GAUDI_ENABLE_GAUDIALG ${GAUDI_ENABLE_GAUDIALG})\n")
# The C++ standard used must be the same as ROOT's
if(NOT GAUDI_CXX_STANDARD)
# FIXME: the day ROOT_CXX_STANDARD is provided by ROOTConfig.cmake, remove this lookup
......@@ -145,6 +148,7 @@ add_subdirectory(GaudiCoreSvc)
add_subdirectory(GaudiUtils)
add_subdirectory(Gaudi)
add_subdirectory(GaudiAlg)
add_subdirectory(GaudiFunctional)
add_subdirectory(GaudiAud)
add_subdirectory(GaudiCommonSvc)
add_subdirectory(GaudiHive)
......
......@@ -63,7 +63,6 @@ def _fillConfDict():
)
pass
del dups
log.warning("Fix your cmt/requirements file !!")
pass
else:
log.debug("No duplicates have been found: that's good !")
......
......@@ -14,16 +14,16 @@ def test():
allConfigurables = GaudiKernel.Configurable.Configurable.allConfigurables
allConfigurables.clear()
from Configurables import MyGaudiAlgorithm
from Configurables import MyAlgorithm
assert not allConfigurables
alg = MyGaudiAlgorithm()
alg = MyAlgorithm()
assert len(allConfigurables) == 1
assert "MyGaudiAlgorithm.PrivToolHandle" not in allConfigurables
assert "MyAlgorithm.PrivToolHandle" not in allConfigurables
_ = alg.PrivToolHandle
assert "MyGaudiAlgorithm.PrivToolHandle" in allConfigurables
assert "MyAlgorithm.PrivToolHandle" in allConfigurables
assert "ToolSvc.PrivToolHandle" not in allConfigurables
print(list(allConfigurables))
......
......@@ -12,4 +12,4 @@ from Gaudi.Configuration import AuditorSvc, importOptions
importOptions("test_purge2.opts")
AuditorSvc().Auditors += ["TimingAuditor/TIMER"]
AuditorSvc().Auditors += ["AlgTimingAuditor/TIMER"]
......@@ -19,7 +19,7 @@
from pprint import PrettyPrinter
pp = PrettyPrinter()
expected = {'AuditorSvc': {'Auditors': ['ChronoAuditor', 'TimingAuditor/TIMER']}}
expected = {'AuditorSvc': {'Auditors': ['ChronoAuditor', 'AlgTimingAuditor/TIMER']}}
exec("\n".join(stdout.splitlines())) # stdout needs to be sanitized for windows
result["GaudiTest.expected_config"] = result.Quote(pp.pformat(expected))
......
#####################################################################################
# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations #
# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations #
# #
# This software is distributed under the terms of the Apache version 2 licence, #
# copied verbatim in the file "LICENSE". #
......@@ -10,6 +10,10 @@
#####################################################################################
# Gaudi subdirectory
if(NOT GAUDI_ENABLE_GAUDIALG)
return()
endif()
# Build the library
gaudi_add_library(GaudiAlgLib
SOURCES src/lib/EventCounter.cpp
......@@ -21,12 +25,14 @@ gaudi_add_library(GaudiAlgLib
src/lib/GaudiTool.cpp
src/lib/GetAlg.cpp
src/lib/Prescaler.cpp
src/lib/Sequencer.cpp
src/lib/Tuple.cpp
src/lib/TupleObj.cpp
src/lib/AlgDecorators.cpp
LINK
PUBLIC
GaudiUtilsLib
Gaudi::GaudiUtilsLib
Gaudi::GaudiPythonLib
Gaudi::Functional
Boost::headers
Boost::regex
Rangev3::rangev3)
......@@ -37,8 +43,13 @@ if(GAUDI_USE_AIDA)
src/lib/GaudiHistoTool.cpp
src/lib/GetAlgs.cpp
src/lib/GaudiTupleAlg.cpp
src/lib/GaudiTupleTool.cpp)
src/lib/GaudiTupleTool.cpp
src/lib/HistoDecorator.cpp)
target_link_libraries(GaudiAlgLib PUBLIC AIDA::aida)
if(GAUDI_USE_CLHEP)
target_sources(GaudiAlgLib PRIVATE src/lib/TupleDecorator.cpp)
target_link_libraries(GaudiAlgLib PUBLIC CLHEP::CLHEP)
endif()
endif()
# Build the plugin
......@@ -60,3 +71,55 @@ if(GAUDI_USE_AIDA)
src/components/SequencerTimerTool.cpp)
target_link_libraries(GaudiAlg PRIVATE AIDA::aida)
endif()
gaudi_add_dictionary(GaudiAlgDict
HEADERFILES dict/dictionary.h
SELECTION dict/selection.xml
LINK GaudiAlgLib)
if(GAUDI_USE_AIDA)
target_compile_definitions(GaudiAlgDict PRIVATE AIDA_FOUND)
endif()
if(GAUDI_USE_CLHEP)
target_compile_definitions(GaudiAlgDict PRIVATE CLHEP_FOUND)
endif()
gaudi_install(PYTHON)
if(BUILD_TESTING)
# Ignore examples if not building tests
# see https://gitlab.cern.ch/atlas/atlasexternals/-/merge_requests/664#note_3395313
gaudi_add_module(GaudiAlgExamples
SOURCES
src/examples/GaudiCommonTests.cpp
src/examples/MyGaudiAlgorithm.cpp
src/examples/MyGaudiTool.cpp
src/examples/SelCreate.cpp
src/examples/SelFilter.cpp
LINK
GaudiAlgLib
Gaudi::GaudiExamplesLib
)
if(GAUDI_USE_AIDA)
target_sources(GaudiAlgExamples PRIVATE
src/examples/Aida2Root.cpp
src/examples/GaudiHistoAlgorithm.cpp
src/examples/HistoTimingAlg.cpp
src/examples/EvtColAlg.cpp
src/examples/ExtendedEvtCol.cpp
)
target_link_libraries(GaudiAlgExamples PRIVATE AIDA::aida)
if(GAUDI_USE_CLHEP)
target_sources(GaudiAlgExamples PRIVATE
src/examples/TupleAlg2.cpp
src/examples/TupleAlg3.cpp
src/examples/TupleAlg.cpp
src/examples/TupleDef.cpp
)
target_link_libraries(GaudiAlgExamples PRIVATE CLHEP::CLHEP)
endif()
endif()
endif()
gaudi_add_tests(QMTest)
/***********************************************************************************\
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
// redefined anyway in features.h by _GNU_SOURCE
#undef _XOPEN_SOURCE
#undef _POSIX_C_SOURCE
// ============================================================================
// Python must always be the first.
#ifndef __APPLE__
# include <Python.h>
#endif // not __APPLE__
#include <GaudiPython/AlgDecorators.h>
#include <GaudiPython/PyAlg.h>
#ifdef AIDA_FOUND
# include <GaudiPython/HistoDecorator.h>
# ifdef CLHEP_FOUND
# include <GaudiPython/TupleDecorator.h>
# endif // CLHEP_FOUND
#endif // AIDA_FOUND
#ifdef AIDA_FOUND
# include <GaudiAlg/GaudiHistoAlg.h>
# include <GaudiAlg/GaudiTupleAlg.h>
# include <GaudiAlg/Print.h>
// Added to avoid warnings about inlined functions never implemented.
# include <GaudiAlg/GaudiHistos.icpp>
#endif // AIDA_FOUND
#include <GaudiAlg/GaudiAlgorithm.h>
#include <GaudiAlg/GaudiCommon.h>
#include <GaudiAlg/GaudiHistoID.h>
#include <GaudiAlg/IErrorTool.h>
#include <GaudiAlg/IGenericTool.h>
#include <GaudiAlg/IHistoTool.h>
#include <GaudiAlg/ISequencerTimerTool.h>
#include <GaudiAlg/ITupleTool.h>
#include <GaudiAlg/Tuple.h>
<!--
(c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations
This software is distributed under the terms of the Apache version 2 licence,
copied verbatim in the file "LICENSE".
In applying this licence, CERN does not waive the privileges and immunities
granted to it by virtue of its status as an Intergovernmental Organization
or submit itself to any jurisdiction.
-->
<lcgdict>
<class name = "GaudiAlgorithm"/>
<class name = "GaudiPython::PyAlg<GaudiAlgorithm>"/>
<class name = "GaudiPython::PyAlg<GaudiHistoAlg>"/>
<class name = "GaudiPython::PyAlg<GaudiTupleAlg>"/>
<class name = "IErrorTool"/>
<class name = "IGenericTool"/>
<class name = "IHistoTool"/>
<class name = "ISequencerTimerTool"/>
<class name = "ITupleTool"/>
<class name = "std::vector<GaudiAlg::ID>"/>
<class name = "Tuples::Tuple"/>
<class pattern = "GaudiAlg::*"/>
<class pattern = "GaudiAlg::Print*"/>
<class pattern = "GaudiCommon<*>"/>
<class pattern = "GaudiHistos<*>"/>
<class pattern = "GaudiPython::*Decorator*"/>
<class pattern = "GaudiTuples<*>"/>
</lcgdict>
/***********************************************************************************\
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
......@@ -8,64 +8,6 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#pragma once
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/FunctionalFilterDecision.h"
#include <utility>
namespace Gaudi::Functional {
namespace details {
template <typename Signature, typename Traits_, bool isLegacy>
struct Consumer;
template <typename... In, typename Traits_>
struct Consumer<void( const In&... ), Traits_, true>
: DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
// derived classes are NOT allowed to implement execute ...
StatusCode execute() override final {
try {
filter_evtcontext_t<In...>::apply( *this, this->m_inputs );
return FilterDecision::PASSED;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.tag() << " : " << e.message() << endmsg;
return e.code();
}
}
// ... instead, they must implement the following operator
virtual void operator()( const In&... ) const = 0;
};
template <typename... In, typename Traits_>
struct Consumer<void( const In&... ), Traits_, false>
: DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
// derived classes are NOT allowed to implement execute ...
StatusCode execute( const EventContext& ctx ) const override final {
try {
filter_evtcontext_t<In...>::apply( *this, ctx, this->m_inputs );
return FilterDecision::PASSED;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.tag() << " : " << e.message() << endmsg;
return e.code();
}
}
// ... instead, they must implement the following operator
virtual void operator()( const In&... ) const = 0;
};
} // namespace details
template <typename Signature, typename Traits_ = Traits::useDefaults>
using Consumer = details::Consumer<Signature, Traits_, details::isLegacy<Traits_>>;
} // namespace Gaudi::Functional
#include <Gaudi/Functional/Consumer.h>
/***********************************************************************************\
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
......@@ -8,65 +8,6 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#pragma once
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/FunctionalFilterDecision.h"
#include <type_traits>
#include <utility>
namespace Gaudi::Functional {
namespace details {
template <typename T, typename Traits_, bool isLegacy>
struct FilterPredicate;
template <typename... In, typename Traits_>
struct FilterPredicate<bool( const In&... ), Traits_, true>
: DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
// derived classes are NOT allowed to implement execute ...
StatusCode execute() override final {
try {
return filter_evtcontext_t<In...>::apply( *this, this->m_inputs ) ? FilterDecision::PASSED
: FilterDecision::FAILED;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.tag() << " : " << e.message() << endmsg;
return e.code();
}
}
// ... instead, they must implement the following operator
virtual bool operator()( const In&... ) const = 0;
};
template <typename... In, typename Traits_>
struct FilterPredicate<bool( const In&... ), Traits_, false>
: DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_> {
using DataHandleMixin<std::tuple<>, filter_evtcontext<In...>, Traits_>::DataHandleMixin;
// derived classes are NOT allowed to implement execute ...
StatusCode execute( const EventContext& ctx ) const override final {
try {
return filter_evtcontext_t<In...>::apply( *this, ctx, this->m_inputs ) ? FilterDecision::PASSED
: FilterDecision::FAILED;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.tag() << " : " << e.message() << endmsg;
return e.code();
}
}
// ... instead, they must implement the following operator
virtual bool operator()( const In&... ) const = 0;
};
} // namespace details
template <typename Signature, typename Traits_ = Traits::useDefaults>
using FilterPredicate = details::FilterPredicate<Signature, Traits_, details::isLegacy<Traits_>>;
} // namespace Gaudi::Functional
#include <Gaudi/Functional/FilterPredicate.h>
/*****************************************************************************\
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
* (c) Copyright 2021-2023 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
......@@ -8,81 +8,6 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/IBinder.h"
#pragma once
#define GAUDI_FUNCTIONAL_TOOL_BINDER_USES_CREATE
namespace Gaudi::Functional {
namespace details {
// add a baseclass in case it isn't defined yet...
template <typename Tr, typename Base = FixTESPath<AlgTool>>
using add_base_t = std::conditional_t<Gaudi::cpp17::is_detected_v<detail2::BaseClass_t, Tr>, Tr,
Traits::use_<Tr, BaseClass_t<Base>>>;
template <typename Signature, typename Traits>
class ToolBinder;
template <typename IFace, typename... Args, typename Traits>
class ToolBinder<Gaudi::Interface::Bind::Box<IFace>( Args const&... ), Traits>
: public extends<details::BaseClass_t<Traits, AlgTool>, Gaudi::Interface::Bind::IBinder<IFace>> {
constexpr static std::size_t N = sizeof...( Args );
template <typename IArgs, std::size_t... I>
ToolBinder( std::string type, std::string name, const IInterface* parent, IArgs&& args,
Gaudi::Interface::Bind::Box<IFace> ( *creator )( void const*, Args const&... ),
std::index_sequence<I...> )
: extends<details::BaseClass_t<Traits>, Gaudi::Interface::Bind::IBinder<IFace>>{ std::move( type ),
std::move( name ), parent }
, m_handles{ std::tuple_cat( std::forward_as_tuple( this ), std::get<I>( args ) )... }
, m_creator{ creator } {}
std::tuple<details::InputHandle_t<Traits, Args>...> m_handles;
Gaudi::Interface::Bind::Box<IFace> ( *m_creator )( void const*, Args const&... );
public:
using KeyValue = std::pair<std::string, std::string>;
ToolBinder( std::string type, std::string name, const IInterface* parent,
Gaudi::Functional::details::RepeatValues_<KeyValue, N> const& inputs,
Gaudi::Interface::Bind::Box<IFace> ( *creator )( void const*, Args const&... ) )
: ToolBinder{ std::move( type ), std::move( name ), parent, inputs, creator, std::make_index_sequence<N>{} } {
}
Gaudi::Interface::Bind::Box<IFace> bind( EventContext const& ctx ) const final {
return std::apply(
[&]( auto const&... arg ) {
using namespace details;
return std::invoke( m_creator, this, get( arg, *this, ctx )... );
},
m_handles );
}
template <std::size_t N = 0>
decltype( auto ) inputLocation() const {
using namespace details;
return getKey( std::get<N>( m_handles ) );
}
template <typename T>
decltype( auto ) inputLocation() const {
using namespace details;
return getKey( std::get<InputHandle_t<Traits, std::decay_t<T>>>( m_handles ) );
}
// TODO: make this a callable instance?
template <typename BoundInstance, typename Self>
static auto construct( Self* ) {
static_assert( std::is_base_of_v<ToolBinder, Self> );
return +[]( void const* ptr, const Args&... args ) {
return Gaudi::Interface::Bind::Box<IFace>{ std::in_place_type<BoundInstance>,
static_cast<std::add_const_t<Self>*>( ptr ), args... };
};
}
};
} // namespace details
template <typename Signature, typename Traits_ = Traits::use_<Traits::BaseClass_t<AlgTool>>>
using ToolBinder = details::ToolBinder<Signature, Traits_>;
} // namespace Gaudi::Functional
#include <Gaudi/Functional/ToolBinder.h>
/***********************************************************************************\
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
......@@ -8,117 +8,21 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#ifndef FUNCTIONAL_UTILITIES_H
#define FUNCTIONAL_UTILITIES_H
#pragma once
#include "boost/algorithm/string/join.hpp"
#include <initializer_list>
#include <string>
#include <Gaudi/Accumulators.h>
#include <Gaudi/Functional/utilities.h>
#include <GaudiAlg/GaudiAlgorithm.h>
#include <GaudiAlg/GaudiHistoAlg.h>
// TODO: fwd declare instead?
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiAlg/GaudiHistoAlg.h"
#include "GaudiKernel/DataObjectHandle.h"
#include "GaudiKernel/SerializeSTL.h"
namespace Gaudi::Functional::Traits {
// this example uses GaudiHistoAlg as base class, and the default handle types for
// input and output
using useGaudiHistoAlg = use_<BaseClass_t<GaudiHistoAlg>>;
namespace Gaudi::Functional {
// this is the default, but is kept for backward compatibility
using useAlgorithm = use_<BaseClass_t<Gaudi::Algorithm>>;
// This utility is needed when the inputs of a functional algorithm may be stored in several locations
inline std::string concat_alternatives( std::initializer_list<std::string> c ) {
return boost::algorithm::join( c, ":" );
}
template <typename... Strings>
std::string concat_alternatives( const Strings&... s ) {
return concat_alternatives( std::initializer_list<std::string>{ s... } );
}
[[deprecated( "please use `updateHandleLocation` instead of `Gaudi::Functional::updateHandleLocation`" )]] inline void
updateHandleLocation( IProperty& parent, const std::string& prop, const std::string& newLoc ) {
auto sc = parent.setProperty( prop, newLoc );
if ( sc.isFailure() ) throw GaudiException( "Could not set Property", prop + " -> " + newLoc, sc );
}
[[deprecated(
"please use `updateHandleLocations` instead of `Gaudi::Functional::updateHandleLocations`" )]] inline void
updateHandleLocations( IProperty& parent, const std::string& prop, const std::vector<std::string>& newLocs ) {
std::ostringstream ss;
GaudiUtils::details::ostream_joiner(
ss << '[', newLocs, ", ", []( std::ostream & os, const auto& i ) -> auto& { return os << "'" << i << "'"; } )
<< ']';
auto sc = parent.setProperty( prop, ss.str() );
if ( sc.isFailure() ) throw GaudiException( "Could not set Property", prop + " -> " + ss.str(), sc );
}
namespace Traits {
// traits classes used to customize Transformer and FilterPredicate
// Define the types to to be used as baseclass, and as in- resp. output hanldes.
// In case a type is not specified in the traits struct, a default is used.
//
// The defaults are:
//
// using BaseClass = GaudiAlgorithm
// template <typename T> using InputHandle = DataObjectHandle<T>;
// template <typename T> using OutputHandle = DataObjectHandle<T>;
//
// the best way to 'compose' traits is by inheriting them one-by-one...
template <typename... Base>
struct use_ : Base... {};
// helper classes one can inherit from to specify a specific trait
template <typename Base>
struct BaseClass_t {
using BaseClass = Base;
};
template <template <typename> class Handle>
struct InputHandle_t {
template <typename T>
using InputHandle = Handle<T>;
};
template <template <typename> class Handle>
struct OutputHandle_t {
template <typename T>
using OutputHandle = Handle<T>;
};
template <typename Data, typename View>
struct writeViewFor {
template <typename T>
using OutputHandle = std::enable_if_t<std::is_same_v<T, Data>, DataObjectWriteHandle<View, Data>>;
};
// add support for objects that should reside in the TES for lifetime management, but should not
// be used explicitly and/or directly by downstream code.
template <typename Data>
struct WriteOpaqueFor {
struct OpaqueView {
OpaqueView() = default;
template <typename T>
OpaqueView( T const& ) {}
};
template <typename T>
using OutputHandle = std::enable_if_t<std::is_same_v<T, Data>, DataObjectWriteHandle<OpaqueView, Data>>;
};
// this uses the defaults -- and it itself is the default ;-)
using useDefaults = use_<>;
// this example uses GaudiHistoAlg as baseclass, and the default handle types for
// input and output
using useGaudiHistoAlg = use_<BaseClass_t<GaudiHistoAlg>>;
// use Gaudi::Algorithm as base class -- this should be the base class!
using useAlgorithm = use_<BaseClass_t<Gaudi::Algorithm>>;
// use the legacy GaudiAlgorithm as base class -- this is (annoyingly) the current default
using useLegacyGaudiAlgorithm = use_<BaseClass_t<GaudiAlgorithm>>;
} // namespace Traits
} // namespace Gaudi::Functional
#endif
// use legacy GaudiAlgorithm as base class
using useLegacyGaudiAlgorithm = use_<BaseClass_t<GaudiAlgorithm>>;
} // namespace Gaudi::Functional::Traits
/***********************************************************************************\
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
......@@ -8,24 +8,20 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#ifndef GAUDIALG_GETALGS_H
#define GAUDIALG_GETALGS_H 1
// ============================================================================
// Include files
// ============================================================================
#include "GaudiKernel/IAlgorithm.h"
#include "GaudiKernel/Kernel.h"
// ============================================================================
// forward declarations
// ============================================================================
#pragma once
#include <GaudiKernel/IAlgorithm.h>
#include <GaudiKernel/Kernel.h>
class IAlgContextSvc;
class GaudiAlgorithm;
struct GaudiHistoAlg;
struct GaudiTupleAlg;
class GaudiSequencer;
class Sequencer;
// ============================================================================
namespace Gaudi {
class Sequencer;
namespace Utils {
// ========================================================================
/** simple function to extract the last active
......@@ -133,7 +129,3 @@ namespace Gaudi {
// ========================================================================
} // namespace Utils
} // end of namespace Gaudi
// ============================================================================
// The END
// ============================================================================
#endif // GAUDIALG_GETALGS_H
/***********************************************************************************\
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
......@@ -8,34 +8,6 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#ifndef GAUDI_FUNCTIONAL_PRODUCER_H
#define GAUDI_FUNCTIONAL_PRODUCER_H
#pragma once
#include "GaudiAlg/Transformer.h"
#include <utility>
namespace Gaudi::Functional {
namespace details {
template <typename Signature, typename Traits_, bool isLegacy>
struct Producer;
template <typename... Out, typename Traits_, bool legacy>
struct Producer<std::tuple<Out...>(), Traits_, legacy> : MultiTransformer<std::tuple<Out...>(), Traits_, legacy> {
using MultiTransformer<std::tuple<Out...>(), Traits_, legacy>::MultiTransformer;
};
template <typename Out, typename Traits_, bool legacy>
struct Producer<Out(), Traits_, legacy> : Transformer<Out(), Traits_, legacy> {
using Transformer<Out(), Traits_, legacy>::Transformer;
};
} // namespace details
template <typename Signature, typename Traits_ = Traits::useDefaults>
using Producer = details::Producer<Signature, Traits_, details::isLegacy<Traits_>>;
} // namespace Gaudi::Functional
#endif
#include <Gaudi/Functional/Producer.h>
......@@ -8,86 +8,6 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#ifndef SCALAR_TRANSFORMER_H
#define SCALAR_TRANSFORMER_H
#pragma once
#include "GaudiAlg/Transformer.h"
namespace Gaudi::Functional {
// Scalar->Vector adapted N->1 algorithm
template <typename ScalarOp, typename TransformerSignature, typename Traits_ = Traits::useDefaults>
class ScalarTransformer;
template <typename ScalarOp, typename Out, typename... In, typename Traits_>
class ScalarTransformer<ScalarOp, Out( const In&... ), Traits_> : public Transformer<Out( const In&... ), Traits_> {
/// Access the scalar operator
const ScalarOp& scalarOp() const { return static_cast<const ScalarOp&>( *this ); }
public:
using Transformer<Out( const In&... ), Traits_>::Transformer;
/// The main operator
Out operator()( const In&... in ) const override final {
const auto inrange = details::zip::range( in... );
Out out;
out.reserve( inrange.size() );
auto& scalar = scalarOp();
for ( const auto&& tuple : inrange ) {
/// Call the scalar operator with the objects obtained from the given tuple as arguments
details::invoke_optionally(
[&out]( auto&& arg ) { details::insert( out, std::forward<decltype( arg )>( arg ) ); },
std::apply( [&]( const auto&... i ) { return scalar( details::deref( i )... ); }, tuple ) );
}
details::applyPostProcessing( scalar, out );
return out;
}
};
// Scalar->Vector adapted N->M algorithm
template <typename ScalarOp, typename TransformerSignature, typename Traits_ = Traits::useDefaults>
class MultiScalarTransformer;
template <typename ScalarOp, typename... Out, typename... In, typename Traits_>
class MultiScalarTransformer<ScalarOp, std::tuple<Out...>( const In&... ), Traits_>
: public MultiTransformer<std::tuple<Out...>( const In&... ), Traits_> {
/// Access the scalar operator
const ScalarOp& scalarOp() const { return static_cast<const ScalarOp&>( *this ); }
public:
using MultiTransformer<std::tuple<Out...>( const In&... ), Traits_>::MultiTransformer;
/// The main operator
std::tuple<Out...> operator()( const In&... in ) const override final {
const auto inrange = details::zip::range( in... );
std::tuple<Out...> out;
std::apply( [sz = inrange.size()]( auto&&... o ) { ( o.reserve( sz ), ... ); }, out );
auto& scalar = scalarOp();
for ( const auto&& indata : inrange ) {
std::apply(
[&scalar, &indata]( auto&... out ) {
/// Call the scalar operator with the objects obtained from the given indata,
/// and invoke insert with it (unless the resulting type is an optional,
/// and the optional is not engaged)
details::invoke_optionally(
[&out...]( auto&& outdata ) {
GF_SUPPRESS_SPURIOUS_CLANG_WARNING_BEGIN
std::apply(
[&out...]( auto&&... outdata1 ) {
( details::insert( out, std::forward<decltype( outdata1 )>( outdata1 ) ), ... );
},
std::forward<decltype( outdata )>( outdata ) );
GF_SUPPRESS_SPURIOUS_CLANG_WARNING_END
},
std::apply( [&scalar]( const auto&... args ) { return scalar( details::deref( args )... ); },
indata ) );
},
out );
}
details::applyPostProcessing( scalar, out );
return out;
}
};
} // namespace Gaudi::Functional
#endif
#include <Gaudi/Functional/ScalarTransformer.h>
/***********************************************************************************\
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
......@@ -8,235 +8,8 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#ifndef ALGORITHM_SEQUENCER_H
#define ALGORITHM_SEQUENCER_H
#pragma once
// Include files
#include <Gaudi/Property.h>
#include <Gaudi/Sequence.h>
#include <Gaudi/Sequencer.h>
#include <mutex>
class MsgStream;
/**
** ClassName: Sequencer
**
** Description: A Sequencer is essentially a list of Algorithms and is responsible
** for their management. Note that Sequences may themselves contain other
** Sequences. The default execute() implementation loops over the
** members of the sequence, calling their execute() methods. However, this
** can be modified if a member is disabled, has already been executed, or a
** member indicates that it's filter fails. The the former two cases the
** execution of the member is bypassed. In the latter case, the loop is
** terminated and the Sequencer assumes the same filtered state as the
** last member.
**/
class GAUDI_API Sequencer : public Gaudi::Sequence {
public:
/**
** Constructor(s)
**/
using Gaudi::Sequence::Sequence;
/*****************************
** Public Function Members **
*****************************/
/**
** Initialization of a sequencer. Typically things like histogram creation,
** setting up of data structures etc, should be done here. If a sequence
** has properties specified in the job options file, they will be set to
** the requested values BEFORE the initialize() method is invoked.
**/
StatusCode initialize() override;
/**
** Sequencer Reinitialization.
**/
StatusCode reinitialize() override;
/**
** Sequencer finalization.
**/
StatusCode start() override;
/**
** The actions to be performed by the sequencer on an event. This method
** is invoked once per event.
**/
StatusCode execute( const EventContext& ctx ) const override;
/**
** Sequencer finalization.
**/
StatusCode stop() override;
/**
** Sequencer finalization.
**/
StatusCode finalize() override;
/**
** additional interface methods
**/
/**
** Was the branch filter passed for the last event?
**/
bool branchFilterPassed( const EventContext& ctx ) const;
/**
** Set the branch filter passed flag for the last event
**/
void setBranchFilterPassed( const EventContext& ctx, bool state ) const;
/**
** Has the StopOverride mode been set?
**/
virtual bool isStopOverride() const;
/**
** Append an algorithm to the sequencer.
**/
StatusCode append( Gaudi::Algorithm* pAlgorithm );
/**
** Append an algorithm to the sequencer branch
**/
StatusCode appendToBranch( Gaudi::Algorithm* pAlgorithm );
/**
** Create a algorithm and append it to the sequencer. A call to this method
** creates a child algorithm object. Note that the returned pointer is
** to Algorithm (as opposed to IAlgorithm), and thus the methods of
** IProperty are also available for the direct setting of the algorithm's
** properties. Using this mechanism instead of creating algorithms
** directly via the new operator is preferred since then the framework
** may take care of all of the necessary book-keeping.
**/
StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
const std::string& name, // The name to be given to the algorithm
Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
);
/**
** Create a algorithm and append it to the sequencer branch. A call to this method
** creates a child algorithm object. Note that the returned pointer is
** to Algorithm (as opposed to IAlgorithm), and thus the methods of
** IProperty are also available for the direct setting of the algorithm's
** properties. Using this mechanism instead of creating algorithms
** directly via the new operator is preferred since then the framework
** may take care of all of the necessary book-keeping.
**/
StatusCode createAndAppendToBranch( const std::string& type, // The concrete algorithm class of the algorithm
const std::string& name, // The name to be given to the algorithm
Gaudi::Algorithm*& pAlgorithm // Set to point to the newly created algorithm
// object
);
/**
** Remove the specified algorithm from the sequencer
**/
StatusCode remove( Gaudi::Algorithm* pAlgorithm );
StatusCode remove( const std::string& name );
StatusCode removeFromBranch( Gaudi::Algorithm* pAlgorithm );
StatusCode removeFromBranch( const std::string& name );
/**
** List of branch algorithms. These are the algorithms
** that would get executed if a filter algorithm indicated
** a failure. The branch is located within the main sequence
** by the first element, which is the filter algorithm.
**/
const std::vector<Gaudi::Algorithm*>& branchAlgorithms() const;
std::vector<Gaudi::Algorithm*>& branchAlgorithms();
/// Decode Member Name list
StatusCode decodeMemberNames();
/// Decode branch member name list
StatusCode decodeBranchMemberNames();
protected:
/**
** Append an algorithm to the sequencer.
**/
StatusCode append( Gaudi::Algorithm* pAlgorithm, std::vector<Gaudi::Algorithm*>& theAlgs );
/**
** Create a algorithm and append it to the sequencer. A call to this method
** creates a child algorithm object. Note that the returned pointer is
** to Algorithm (as opposed to IAlgorithm), and thus the methods of
** IProperty are also available for the direct setting of the algorithm's
** properties. Using this mechanism instead of creating algorithms
** directly via the new operator is preferred since then the framework
** may take care of all of the necessary book-keeping.
**/
StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
const std::string& name, // The name to be given to the algorithm
Gaudi::Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
std::vector<Gaudi::Algorithm*>& theAlgs );
/**
** Decode algorithm names, creating or appending algorithms as appropriate
**/
StatusCode decodeNames( Gaudi::Property<std::vector<std::string>>& theNames, std::vector<Gaudi::Algorithm*>& theAlgs,
std::vector<bool>& theLogic );
/**
** Execute the members in the specified list
**/
StatusCode execute( const EventContext& ctx, const std::vector<Gaudi::Algorithm*>& theAlgs,
const std::vector<bool>& theLogic, Gaudi::Algorithm*& lastAlgorithm,
std::size_t first = 0 ) const;
/**
** Execute member algorithm
**/
StatusCode executeMember( Gaudi::Algorithm* theAlgorithm, const EventContext& context ) const;
/**
** Remove the specified algorithm from the sequencer
**/
StatusCode remove( const std::string& algname, std::vector<Gaudi::Algorithm*>& theAlgs );
// NO COPY / ASSIGNMENT ALLOWED
Sequencer( const Sequencer& a ) = delete;
Sequencer& operator=( const Sequencer& rhs ) = delete;
public:
/// Produce string represention of the control flow expression.
std::ostream& toControlFlowExpression( std::ostream& os ) const override;
private:
/**************************
** Private Data Members **
**************************/
Gaudi::Property<std::vector<std::string>> m_names{ this,
"Members",
{},
[this]( auto& ) {
if ( this->isInitialized() ) this->decodeMemberNames().ignore();
},
"member names" };
Gaudi::Property<std::vector<std::string>> m_branchNames{ this,
"BranchMembers",
{},
[this]( auto& ) {
if ( this->isInitialized() )
this->decodeBranchMemberNames().ignore();
},
"branch member names" };
Gaudi::Property<bool> m_stopOverride{ this, "StopOverride", false, "stop on filter failure override" };
std::vector<bool> m_isInverted; // Member logic inverted list
std::vector<Gaudi::Algorithm*> m_branchAlgs; // Branch algorithms
std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
mutable std::mutex m_branchFilterMutex;
mutable std::map<EventContext::ContextID_t, bool> m_branchFilterPassed; // Branch filter passed flag
};
#endif // ALGORITHM_SEQUENCER_H
using Sequencer = Gaudi::Sequencer;