diff --git a/Core/include/Acts/EventData/TrackState.hpp b/Core/include/Acts/EventData/TrackState.hpp index d9bd0b9e0bb306a5dd7bf4bfe0b71ddf3a1d538c..ea587505506c6709e7f36568129e0ba29d09a90b 100644 --- a/Core/include/Acts/EventData/TrackState.hpp +++ b/Core/include/Acts/EventData/TrackState.hpp @@ -8,13 +8,13 @@ #pragma once -#include <boost/none.hpp> -#include <boost/optional.hpp> #include "Acts/EventData/Measurement.hpp" #include "Acts/EventData/MeasurementHelpers.hpp" #include "Acts/EventData/SourceLinkConcept.hpp" #include "Acts/Utilities/ParameterDefinitions.hpp" +#include <optional> + namespace Acts { /// @enum TrackStateFlag @@ -133,14 +133,14 @@ class TrackState { /// @brief number of Measured parameters, forwarded /// @note This only returns a value if there is a calibrated measurement - /// set. If not, this returns boost::none + /// set. If not, this returns std::nullopt /// - /// @return number of measured parameters, or boost::none - boost::optional<size_t> size() { + /// @return number of measured parameters, or std::nullopt + std::optional<size_t> size() { if (this->measurement.calibrated) { return MeasurementHelpers::getSize(*this->measurement.calibrated); } - return boost::none; + return std::nullopt; } /// The parameter part @@ -149,13 +149,13 @@ class TrackState { /// It is enough to to run the track smoothing struct { /// The predicted state - boost::optional<Parameters> predicted{boost::none}; + std::optional<Parameters> predicted{std::nullopt}; /// The filtered state - boost::optional<Parameters> filtered{boost::none}; + std::optional<Parameters> filtered{std::nullopt}; /// The smoothed state - boost::optional<Parameters> smoothed{boost::none}; + std::optional<Parameters> smoothed{std::nullopt}; /// The transport jacobian matrix - boost::optional<Jacobian> jacobian{boost::none}; + std::optional<Jacobian> jacobian{std::nullopt}; /// The path length along the track - will help sorting double pathLength = 0.; /// chisquare @@ -167,9 +167,9 @@ class TrackState { /// (in case the latter is different) struct { /// The optional (uncalibrated) measurement - boost::optional<SourceLink> uncalibrated{boost::none}; + std::optional<SourceLink> uncalibrated{std::nullopt}; /// The optional calibrabed measurement - boost::optional<FittableMeasurement<SourceLink>> calibrated{boost::none}; + std::optional<FittableMeasurement<SourceLink>> calibrated{std::nullopt}; } measurement; private: diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index b7f5c0e6110ce0a2dae5480011402e2a6c54609e..832bbe63bc3b51e400e18e16bcaded12605f468b 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -93,7 +93,7 @@ struct KalmanFitterResult { size_t trackTip = SIZE_MAX; // The optional Parameters at the provided surface - boost::optional<BoundParameters> fittedParameters; + std::optional<BoundParameters> fittedParameters; // Counter for states with measurements size_t measurementStates = 0; diff --git a/Core/include/Acts/Geometry/LayerCreator.hpp b/Core/include/Acts/Geometry/LayerCreator.hpp index 25a882a483301a220c482680b6b3027b769cc79f..0cb420c088fc0c77423cc3c54fe34e598f4f8b2d 100644 --- a/Core/include/Acts/Geometry/LayerCreator.hpp +++ b/Core/include/Acts/Geometry/LayerCreator.hpp @@ -12,7 +12,6 @@ #pragma once -#include <boost/optional.hpp> #include "Acts/Geometry/ApproachDescriptor.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/SurfaceArrayCreator.hpp" @@ -20,6 +19,8 @@ #include "Acts/Utilities/Definitions.hpp" #include "Acts/Utilities/Logger.hpp" +#include <optional> + #ifndef ACTS_LAYERCREATOR_TAKESMALLERBIGGER #define ACTS_LAYERCREATOR_TAKESMALLERBIGGER #define takeSmaller(current, test) current = current < test ? current : test @@ -91,7 +92,7 @@ class LayerCreator { MutableLayerPtr cylinderLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, - size_t binsZ, boost::optional<ProtoLayer> _protoLayer = boost::none, + size_t binsZ, std::optional<ProtoLayer> _protoLayer = std::nullopt, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -116,7 +117,7 @@ class LayerCreator { const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi, BinningType bTypeZ, - boost::optional<ProtoLayer> _protoLayer = boost::none, + std::optional<ProtoLayer> _protoLayer = std::nullopt, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -140,7 +141,7 @@ class LayerCreator { MutableLayerPtr discLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, - size_t binsPhi, boost::optional<ProtoLayer> _protoLayer = boost::none, + size_t binsPhi, std::optional<ProtoLayer> _protoLayer = std::nullopt, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -165,7 +166,7 @@ class LayerCreator { const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, - boost::optional<ProtoLayer> _protoLayer = boost::none, + std::optional<ProtoLayer> _protoLayer = std::nullopt, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -194,7 +195,7 @@ class LayerCreator { const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, BinningValue bValue, - boost::optional<ProtoLayer> _protoLayer = boost::none, + std::optional<ProtoLayer> _protoLayer = std::nullopt, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; diff --git a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp index 57e22c9e919f0e3ff38a3af64be662eddecf1afc..1fc4193fbd7b88ccfbdfd97252c0ac396d2d1d8c 100644 --- a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp @@ -12,9 +12,6 @@ #pragma once -#include <boost/none.hpp> -#include <boost/optional.hpp> - #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/ProtoLayer.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" @@ -24,6 +21,8 @@ #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Units.hpp" +#include <optional> + namespace Acts { namespace Test { struct SurfaceArrayCreatorFixture; @@ -119,7 +118,7 @@ class SurfaceArrayCreator { std::unique_ptr<SurfaceArray> surfaceArrayOnCylinder( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, - size_t binsZ, boost::optional<ProtoLayer> protoLayerOpt = boost::none, + size_t binsZ, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// SurfaceArrayCreator interface method @@ -143,7 +142,7 @@ class SurfaceArrayCreator { const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi = equidistant, BinningType bTypeZ = equidistant, - boost::optional<ProtoLayer> protoLayerOpt = boost::none, + std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// SurfaceArrayCreator interface method @@ -165,7 +164,7 @@ class SurfaceArrayCreator { std::unique_ptr<SurfaceArray> surfaceArrayOnDisc( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, - size_t binsPhi, boost::optional<ProtoLayer> protoLayerOpt = boost::none, + size_t binsPhi, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// SurfaceArrayCreator interface method @@ -192,7 +191,7 @@ class SurfaceArrayCreator { const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, - boost::optional<ProtoLayer> protoLayerOpt = boost::none, + std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// SurfaceArrayCreator interface method @@ -219,7 +218,7 @@ class SurfaceArrayCreator { const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, BinningValue bValue, - boost::optional<ProtoLayer> protoLayerOpt = boost::none, + std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// Static check funtion for surface equivalent @@ -378,7 +377,7 @@ class SurfaceArrayCreator { using SGL = SurfaceArray::SurfaceGridLookup<decltype(axisA), decltype(axisB)>; ptr = std::unique_ptr<ISGL>(static_cast<ISGL*>( new SGL(globalToLocal, localToGlobal, std::make_tuple(axisA, axisB)))); - + } else if (pAxisA.bType == arbitrary && pAxisB.bType == equidistant) { detail::Axis<detail::AxisType::Variable, bdtA> axisA(pAxisA.binEdges); diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index b0fcfe2aba3df58cc47ad878b581163435376c65..20e96c88b17457db837214c4e7b27ef7489db1be 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -65,7 +65,7 @@ std::shared_ptr<const Acts::Layer> Acts::CuboidVolumeBuilder::buildLayer( LayerCreator layerCreator(lCfg); return layerCreator.planeLayer(gctx, {cfg.surface}, cfg.binsY, cfg.binsZ, - BinningValue::binX, boost::none, + BinningValue::binX, std::nullopt, std::make_shared<const Transform3D>(trafo)); } diff --git a/Core/src/Geometry/LayerCreator.cpp b/Core/src/Geometry/LayerCreator.cpp index b19e4d70507fde04b79047f5f1e615f4f4521ebf..19ce42c95812c9bb7f7e488c62d464d6423b7370 100644 --- a/Core/src/Geometry/LayerCreator.cpp +++ b/Core/src/Geometry/LayerCreator.cpp @@ -45,7 +45,7 @@ void Acts::LayerCreator::setLogger(std::unique_ptr<const Logger> newLogger) { Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, - size_t binsZ, boost::optional<ProtoLayer> _protoLayer, + size_t binsZ, std::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -120,7 +120,7 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi, - BinningType bTypeZ, boost::optional<ProtoLayer> _protoLayer, + BinningType bTypeZ, std::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -195,7 +195,7 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( Acts::MutableLayerPtr Acts::LayerCreator::discLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, - size_t binsPhi, boost::optional<ProtoLayer> _protoLayer, + size_t binsPhi, std::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -258,7 +258,7 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( Acts::MutableLayerPtr Acts::LayerCreator::discLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, - BinningType bTypePhi, boost::optional<ProtoLayer> _protoLayer, + BinningType bTypePhi, std::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -318,7 +318,7 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, - size_t bins2, BinningValue bValue, boost::optional<ProtoLayer> _protoLayer, + size_t bins2, BinningValue bValue, std::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = diff --git a/Core/src/Geometry/SurfaceArrayCreator.cpp b/Core/src/Geometry/SurfaceArrayCreator.cpp index 7480106cd99bda47d30e5d2db083475ae18ec5b0..e376277a4d2a9f3961d89fbd5cd97b7824647fa5 100644 --- a/Core/src/Geometry/SurfaceArrayCreator.cpp +++ b/Core/src/Geometry/SurfaceArrayCreator.cpp @@ -31,7 +31,7 @@ std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, - size_t binsZ, boost::optional<ProtoLayer> protoLayerOpt, + size_t binsZ, std::optional<ProtoLayer> protoLayerOpt, const std::shared_ptr<const Transform3D>& transformOpt) const { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it @@ -81,7 +81,7 @@ std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi, - BinningType bTypeZ, boost::optional<ProtoLayer> protoLayerOpt, + BinningType bTypeZ, std::optional<ProtoLayer> protoLayerOpt, const std::shared_ptr<const Transform3D>& transformOpt) const { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it @@ -147,7 +147,7 @@ std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnDisc( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, - size_t binsPhi, boost::optional<ProtoLayer> protoLayerOpt, + size_t binsPhi, std::optional<ProtoLayer> protoLayerOpt, const std::shared_ptr<const Transform3D>& transformOpt) const { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it @@ -203,7 +203,7 @@ std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnDisc( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, - BinningType bTypePhi, boost::optional<ProtoLayer> protoLayerOpt, + BinningType bTypePhi, std::optional<ProtoLayer> protoLayerOpt, const std::shared_ptr<const Transform3D>& transformOpt) const { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it @@ -312,8 +312,7 @@ std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnPlane( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, - size_t bins2, BinningValue bValue, - boost::optional<ProtoLayer> protoLayerOpt, + size_t bins2, BinningValue bValue, std::optional<ProtoLayer> protoLayerOpt, const std::shared_ptr<const Transform3D>& transformOpt) const { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it diff --git a/Tests/Core/Fitter/KalmanFitterTests.cpp b/Tests/Core/Fitter/KalmanFitterTests.cpp index 3ed685798153b597f902abafc7640d0ccbd312df..de3dd40eb68b21f6e9464e12d4d55fbb35adfaa8 100644 --- a/Tests/Core/Fitter/KalmanFitterTests.cpp +++ b/Tests/Core/Fitter/KalmanFitterTests.cpp @@ -325,13 +325,13 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { auto fitRes = kFitter.fit(sourcelinks, rStart, kfOptions); BOOST_CHECK(fitRes.ok()); auto& fittedTrack = *fitRes; - auto fittedParameters = fittedTrack.fittedParameters.get(); + auto fittedParameters = fittedTrack.fittedParameters.value(); // Make sure it is deterministic fitRes = kFitter.fit(sourcelinks, rStart, kfOptions); BOOST_CHECK(fitRes.ok()); auto& fittedAgainTrack = *fitRes; - auto fittedAgainParameters = fittedAgainTrack.fittedParameters.get(); + auto fittedAgainParameters = fittedAgainTrack.fittedParameters.value(); CHECK_CLOSE_REL(fittedParameters.parameters().template head<5>(), fittedAgainParameters.parameters().template head<5>(), 1e-5); @@ -347,7 +347,7 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { fitRes = kFitter.fit(shuffledMeasurements, rStart, kfOptions); BOOST_CHECK(fitRes.ok()); auto& fittedShuffledTrack = *fitRes; - auto fittedShuffledParameters = fittedShuffledTrack.fittedParameters.get(); + auto fittedShuffledParameters = fittedShuffledTrack.fittedParameters.value(); CHECK_CLOSE_REL(fittedParameters.parameters().template head<5>(), fittedShuffledParameters.parameters().template head<5>(), @@ -365,7 +365,7 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { fitRes = kFitter.fit(measurementsWithHole, rStart, kfOptions); BOOST_CHECK(fitRes.ok()); auto& fittedWithHoleTrack = *fitRes; - auto fittedWithHoleParameters = fittedWithHoleTrack.fittedParameters.get(); + auto fittedWithHoleParameters = fittedWithHoleTrack.fittedParameters.value(); // Count one hole BOOST_CHECK_EQUAL(fittedWithHoleTrack.missedActiveSurfaces.size(), 1u);