From ee912a1c18b49c807d349458e05818a29e6720bb Mon Sep 17 00:00:00 2001 From: Moritz Kiehn <msmk@cern.ch> Date: Mon, 16 Mar 2020 13:49:33 +0100 Subject: [PATCH] Utilities: remove explicit default parameter file --- CMakeLists.txt | 3 +- Core/CMakeLists.txt | 9 +- .../Acts/Utilities/ParameterDefinitions.hpp | 122 ++++++++++++++++- .../detail/DefaultParameterDefinitions.hpp | 125 ------------------ 4 files changed, 126 insertions(+), 133 deletions(-) delete mode 100644 Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index db0ed3980..166041948 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,10 +30,9 @@ option(ACTS_BUILD_EXAMPLES "Build examples" OFF) option(ACTS_BUILD_UNITTESTS "Build unit tests" OFF) option(ACTS_BUILD_INTEGRATIONTESTS "Build integration tests" OFF) option(ACTS_BUILD_DOC "Build documentation" OFF) - # all other compile-time parameters must be defined here for clear visibility # and to avoid forgotten options somewhere deep in the hierarchy -set(ACTS_PARAMETER_DEFINITIONS_PLUGIN "Acts/Utilities/detail/DefaultParameterDefinitions.hpp" CACHE FILEPATH "Default track parameter definition") +set(ACTS_PARAMETER_DEFINITIONS_HEADER "" CACHE FILEPATH "Use a different (track) parameter definitions header") # handle inter-plugin dependencies # DD4hepPlugin depends on TGeoPlugin diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index d022d9373..63acfd031 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -8,9 +8,6 @@ add_library( target_compile_features( ActsCore PUBLIC cxx_std_17) -target_compile_definitions( - ActsCore - PUBLIC -DACTS_PARAMETER_DEFINITIONS_PLUGIN="${ACTS_PARAMETER_DEFINITIONS_PLUGIN}") target_include_directories( ActsCore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} @@ -23,6 +20,12 @@ target_link_libraries( ActsCore PUBLIC Boost::boost) +if(ACTS_PARAMETER_DEFINITIONS_HEADER) + target_compile_definitions( + ActsCore + PUBLIC -DACTS_PARAMETER_DEFINITIONS_HEADER="${ACTS_PARAMETER_DEFINITIONS_HEADER}") +endif() + install( TARGETS ActsCore EXPORT ActsCoreTargets diff --git a/Core/include/Acts/Utilities/ParameterDefinitions.hpp b/Core/include/Acts/Utilities/ParameterDefinitions.hpp index 3a0ac2f2b..66feee557 100644 --- a/Core/include/Acts/Utilities/ParameterDefinitions.hpp +++ b/Core/include/Acts/Utilities/ParameterDefinitions.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2018 CERN for the benefit of the Acts project +// Copyright (C) 2016-2020 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -8,12 +8,128 @@ #pragma once +#include <cmath> #include <type_traits> #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/ParameterTypes.hpp" -#ifdef ACTS_PARAMETER_DEFINITIONS_PLUGIN -#include ACTS_PARAMETER_DEFINITIONS_PLUGIN +// The user can override the (track) parameter ordering and underlying scalar +// type. If the variable is defined, it must point to a header file that +// contains the same enum and type definitions for bound and free track +// parameters as well as space points as given below. +#ifdef ACTS_PARAMETER_DEFINITIONS_HEADER +#include ACTS_PARAMETER_DEFINITIONS_HEADER +#else +namespace Acts { + +/// Components of a bound track parameters vector. +/// +/// To be used to access components by named indices instead of just numbers. +/// This must be a regular `enum` and not a scoped `enum class` to allow +/// implicit conversion to an integer. The enum value are thus visible directly +/// in `namespace Acts` and are prefixed to avoid naming collisions. +enum BoundParametersIndices : unsigned int { + // Local position on the reference surface. + // This is intentionally named different from the position components in + // the other data vectors, to clarify that this is defined on a surface + // while the others are defined in free space. + eBoundLoc0 = 0, + eBoundLoc1 = 1, + // Direction angles + eBoundPhi = 2, + eBoundTheta = 3, + // Global inverse-momentum-like parameter, i.e. q/p or 1/p + // The naming is inconsistent for the case of neutral track parameters where + // the value is interpreted as 1/p not as q/p. This is intentional to avoid + // having multiple aliases for the same element and for lack of an acceptable + // common name. + eBoundQOverP = 4, + eBoundTime = 5, + // Last uninitialized value contains the total number of components + eBoundParametersSize, + // The following aliases without prefix exist for historical reasons + // Generic spatial coordinates on the local surface + eLOC_0 = eBoundLoc0, + eLOC_1 = eBoundLoc1, + // Spatial coordinates on a disk in polar coordinates + eLOC_R = eLOC_0, + eLOC_PHI = eLOC_1, + // Spatial coordinates on a disk in Cartesian coordinates + eLOC_X = eLOC_0, + eLOC_Y = eLOC_1, + // Spatial coordinates on a cylinder + eLOC_RPHI = eLOC_0, + eLOC_Z = eLOC_1, + // Closest approach coordinates on a virtual perigee surface + eLOC_D0 = eLOC_0, + eLOC_Z0 = eLOC_1, + // Direction angles + ePHI = eBoundPhi, + eTHETA = eBoundTheta, + eQOP = eBoundQOverP, + eT = eBoundTime, +}; + +/// Components of a free track parameters vector. +/// +/// To be used to access components by named indices instead of just numbers. +/// This must be a regular `enum` and not a scoped `enum class` to allow +/// implicit conversion to an integer. The enum value are thus visible directly +/// in `namespace Acts` and are prefixed to avoid naming collisions. +enum FreeParametersIndices : unsigned int { + // Spatial position + // The spatial position components must be stored as one continous block. + eFreePos0 = 0u, + eFreePos1 = eFreePos0 + 1u, + eFreePos2 = eFreePos0 + 2u, + // Time + eFreeTime = 3u, + // (Unit) direction + // The direction components must be stored as one continous block. + eFreeDir0 = 4u, + eFreeDir1 = eFreeDir0 + 1u, + eFreeDir2 = eFreeDir0 + 2u, + // Global inverse-momentum-like parameter, i.e. q/p or 1/p + // See BoundParametersIndices for further information + eFreeQOverP = 7u, + // Last uninitialized value contains the total number of components + eFreeParametersSize, +}; + +/// Components of a space point vector. +/// +/// To be used to access components by named indices instead of just numbers. +/// This must be a regular `enum` and not a scoped `enum class` to allow +/// implicit conversion to an integer. The enum value are thus visible directly +/// in `namespace Acts` and are prefixed to avoid naming collisions. +/// +/// Within the same context either the position-like or the momentum-like +/// indices must be used exclusively. +enum SpacePointIndices : unsigned int { + // For position four-vectors + // The spatial position components must be stored as one continous block. + eSpacePos0 = 0u, + eSpacePos1 = eSpacePos0 + 1u, + eSpacePos2 = eSpacePos0 + 2u, + eSpaceTime = 3u, + // Last uninitialized value contains the total number of components + eSpacePointSize, + // Aliases for momentum four-vectors to allow clearer code + eSpaceMom0 = eSpacePos0, + eSpaceMom1 = eSpacePos1, + eSpaceMom2 = eSpacePos2, + eSpaceEnergy = eSpaceTime, +}; + +/// Underlying fundamental scalar type for bound track parameters. +using BoundParametersScalar = double; +/// Underlying fundamental scalar type for free track parameters. +using FreeParametersScalar = double; +/// Underlying fundamental scalar type for space points. +using SpacePointScalar = double; + +} // namespace Acts #endif namespace Acts { diff --git a/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp b/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp deleted file mode 100644 index 6882d1e6c..000000000 --- a/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp +++ /dev/null @@ -1,125 +0,0 @@ -// This file is part of the Acts project. -// -// Copyright (C) 2016-2019 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#pragma once - -#include <cmath> - -#include "Acts/Utilities/ParameterTypes.hpp" - -namespace Acts { - -/// Components of a bound track parameters vector. -/// -/// To be used to access components by named indices instead of just numbers. -/// This must be a regular `enum` and not a scoped `enum class` to allow -/// implicit conversion to an integer. The enum value are thus visible directly -/// in `namespace Acts` and are prefixed to avoid naming collisions. -enum BoundParametersIndices : unsigned int { - // Local position on the reference surface. - // This is intentionally named different from the position components in - // the other data vectors, to clarify that this is defined on a surface - // while the others are defined in free space. - eBoundLoc0 = 0, - eBoundLoc1 = 1, - // Direction angles - eBoundPhi = 2, - eBoundTheta = 3, - // Global inverse-momentum-like parameter, i.e. q/p or 1/p - // The naming is inconsistent for the case of neutral track parameters where - // the value is interpreted as 1/p not as q/p. This is intentional to avoid - // having multiple aliases for the same element and for lack of an acceptable - // common name. - eBoundQOverP = 4, - eBoundTime = 5, - // Last uninitialized value contains the total number of components - eBoundParametersSize, - // The following aliases without prefix exist for historical reasons - // Generic spatial coordinates on the local surface - eLOC_0 = eBoundLoc0, - eLOC_1 = eBoundLoc1, - // Spatial coordinates on a disk in polar coordinates - eLOC_R = eLOC_0, - eLOC_PHI = eLOC_1, - // Spatial coordinates on a disk in Cartesian coordinates - eLOC_X = eLOC_0, - eLOC_Y = eLOC_1, - // Spatial coordinates on a cylinder - eLOC_RPHI = eLOC_0, - eLOC_Z = eLOC_1, - // Closest approach coordinates on a virtual perigee surface - eLOC_D0 = eLOC_0, - eLOC_Z0 = eLOC_1, - // Direction angles - ePHI = eBoundPhi, - eTHETA = eBoundTheta, - eQOP = eBoundQOverP, - eT = eBoundTime, -}; - -/// Underlying fundamental scalar type for bound track parameters. -using BoundParametersScalar = double; - -/// Components of a free track parameters vector. -/// -/// To be used to access components by named indices instead of just numbers. -/// This must be a regular `enum` and not a scoped `enum class` to allow -/// implicit conversion to an integer. The enum value are thus visible directly -/// in `namespace Acts` and are prefixed to avoid naming collisions. -enum FreeParametersIndices : unsigned int { - // Spatial position - // The spatial position components must be stored as one continous block. - eFreePos0 = 0u, - eFreePos1 = eFreePos0 + 1u, - eFreePos2 = eFreePos0 + 2u, - // Time - eFreeTime = 3u, - // (Unit) direction - // The direction components must be stored as one continous block. - eFreeDir0 = 4u, - eFreeDir1 = eFreeDir0 + 1u, - eFreeDir2 = eFreeDir0 + 2u, - // Global inverse-momentum-like parameter, i.e. q/p or 1/p - // See BoundParametersIndices for further information - eFreeQOverP = 7u, - // Last uninitialized value contains the total number of components - eFreeParametersSize, -}; - -/// Underlying fundamental scalar type for free track parameters. -using FreeParametersScalar = double; - -/// Components of a space point vector. -/// -/// To be used to access components by named indices instead of just numbers. -/// This must be a regular `enum` and not a scoped `enum class` to allow -/// implicit conversion to an integer. The enum value are thus visible directly -/// in `namespace Acts` and are prefixed to avoid naming collisions. -/// -/// Within the same context either the position-like or the momentum-like -/// indices must be used exclusively. -enum SpacePointIndices : unsigned int { - // For position four-vectors - // The spatial position components must be stored as one continous block. - eSpacePos0 = 0u, - eSpacePos1 = eSpacePos0 + 1u, - eSpacePos2 = eSpacePos0 + 2u, - eSpaceTime = 3u, - // Last uninitialized value contains the total number of components - eSpacePointSize, - // Aliases for momentum four-vectors to allow clearer code - eSpaceMom0 = eSpacePos0, - eSpaceMom1 = eSpacePos1, - eSpaceMom2 = eSpacePos2, - eSpaceEnergy = eSpaceTime, -}; - -/// Underlying fundamental scalar type for space points. -using SpacePointScalar = double; - -} // namespace Acts -- GitLab