From 74ac15c9ecf6d2ca1fafb722a16ea6c767c45ddb Mon Sep 17 00:00:00 2001 From: Robert Langenberg <robert.langenberg@cern.ch> Date: Mon, 8 Jul 2019 17:05:59 +0200 Subject: [PATCH] introduce and apply new clang-format flags for parameter and (template) argument breaking --- .clang-format | 5 + Core/include/Acts/EventData/ChargePolicy.hpp | 38 +- Core/include/Acts/EventData/Measurement.hpp | 93 ++-- .../Acts/EventData/MeasurementHelpers.hpp | 32 +- Core/include/Acts/EventData/ParameterSet.hpp | 95 +++- .../EventData/SingleBoundTrackParameters.hpp | 116 ++-- .../SingleCurvilinearTrackParameters.hpp | 86 +-- .../Acts/EventData/SingleTrackParameters.hpp | 96 ++-- .../Acts/EventData/SourceLinkConcept.hpp | 5 +- .../Acts/EventData/TrackParametersBase.hpp | 31 +- Core/include/Acts/EventData/TrackState.hpp | 19 +- .../Acts/EventData/TrackStateSorters.hpp | 6 +- .../detail/coordinate_transformations.hpp | 46 +- .../detail/fittable_type_generator.hpp | 9 +- .../EventData/detail/full_parameter_set.hpp | 3 +- .../detail/initialize_parameter_set.hpp | 32 +- .../detail/make_projection_matrix.hpp | 6 +- .../EventData/detail/residual_calculator.hpp | 19 +- .../Acts/EventData/detail/value_corrector.hpp | 9 +- .../Acts/Fitter/GainMatrixSmoother.hpp | 11 +- .../include/Acts/Fitter/GainMatrixUpdator.hpp | 25 +- Core/include/Acts/Fitter/KalmanFitter.hpp | 120 +++-- .../Fitter/detail/VoidKalmanComponents.hpp | 30 +- Core/include/Acts/Geometry/AbstractVolume.hpp | 5 +- .../Acts/Geometry/ApproachDescriptor.hpp | 34 +- .../Acts/Geometry/BoundarySurfaceFace.hpp | 3 +- .../Acts/Geometry/BoundarySurfaceT.hpp | 55 +- Core/include/Acts/Geometry/ConeLayer.hpp | 26 +- .../Acts/Geometry/CuboidVolumeBounds.hpp | 32 +- .../Acts/Geometry/CuboidVolumeBuilder.hpp | 30 +- .../Geometry/CutoutCylinderVolumeBounds.hpp | 45 +- Core/include/Acts/Geometry/CylinderLayer.hpp | 29 +- .../Acts/Geometry/CylinderVolumeBounds.hpp | 47 +- .../Acts/Geometry/CylinderVolumeBuilder.hpp | 79 ++- .../Acts/Geometry/CylinderVolumeHelper.hpp | 116 ++-- Core/include/Acts/Geometry/DiscLayer.hpp | 29 +- .../Geometry/DoubleTrapezoidVolumeBounds.hpp | 46 +- .../Geometry/GenericApproachDescriptor.hpp | 7 +- .../Geometry/GenericCuboidVolumeBounds.hpp | 12 +- Core/include/Acts/Geometry/GeometryID.hpp | 26 +- Core/include/Acts/Geometry/GeometryObject.hpp | 24 +- .../Acts/Geometry/GeometryObjectSorter.hpp | 20 +- .../Acts/Geometry/GlueVolumesDescriptor.hpp | 11 +- .../Acts/Geometry/ILayerArrayCreator.hpp | 7 +- .../Geometry/ITrackingVolumeArrayCreator.hpp | 3 +- .../Acts/Geometry/ITrackingVolumeBuilder.hpp | 3 +- .../Acts/Geometry/ITrackingVolumeHelper.hpp | 33 +- Core/include/Acts/Geometry/Layer.hpp | 86 +-- .../Acts/Geometry/LayerArrayCreator.hpp | 31 +- Core/include/Acts/Geometry/LayerCreator.hpp | 43 +- .../include/Acts/Geometry/NavigationLayer.hpp | 54 +- .../Acts/Geometry/PassiveLayerBuilder.hpp | 19 +- Core/include/Acts/Geometry/PlaneLayer.hpp | 29 +- Core/include/Acts/Geometry/ProtoLayer.hpp | 15 +- .../Acts/Geometry/SurfaceArrayCreator.hpp | 131 +++-- .../Acts/Geometry/TrackingGeometry.hpp | 14 +- .../Acts/Geometry/TrackingGeometryBuilder.hpp | 16 +- Core/include/Acts/Geometry/TrackingVolume.hpp | 198 ++++--- .../Geometry/TrackingVolumeArrayCreator.hpp | 19 +- .../Acts/Geometry/TrapezoidVolumeBounds.hpp | 46 +- Core/include/Acts/Geometry/Volume.hpp | 22 +- Core/include/Acts/Geometry/VolumeBounds.hpp | 6 +- .../detail/BoundaryIntersectionSorter.hpp | 60 ++- .../detail/DefaultDetectorElementBase.hpp | 6 +- Core/include/Acts/Geometry/detail/Layer.ipp | 106 ++-- .../Acts/Geometry/detail/TrackingVolume.ipp | 86 ++- .../Acts/MagneticField/BFieldMapUtils.hpp | 64 ++- .../Acts/MagneticField/ConstantBField.hpp | 37 +- .../MagneticField/InterpolatedBFieldMap.hpp | 95 ++-- .../Acts/MagneticField/SharedBField.hpp | 18 +- .../Acts/MagneticField/SolenoidBField.hpp | 12 +- .../AccumulatedMaterialProperties.hpp | 13 +- .../Material/AccumulatedSurfaceMaterial.hpp | 25 +- .../Acts/Material/BinnedSurfaceMaterial.hpp | 29 +- .../include/Acts/Material/ElementFraction.hpp | 19 +- .../Material/HomogeneousSurfaceMaterial.hpp | 25 +- .../Material/HomogeneousVolumeMaterial.hpp | 3 +- .../Acts/Material/ISurfaceMaterial.hpp | 39 +- .../Acts/Material/InterpolatedMaterialMap.hpp | 72 ++- Core/include/Acts/Material/Material.hpp | 60 ++- .../Acts/Material/MaterialCollector.hpp | 21 +- .../Acts/Material/MaterialComposition.hpp | 18 +- .../Acts/Material/MaterialMapUtils.hpp | 41 +- .../Acts/Material/MaterialProperties.hpp | 57 +- .../Acts/Material/ProtoSurfaceMaterial.hpp | 11 +- .../Acts/Material/SurfaceMaterialMapper.hpp | 37 +- .../Acts/Material/VolumeMaterialMapper.hpp | 50 +- Core/include/Acts/Propagator/AbortList.hpp | 19 +- Core/include/Acts/Propagator/ActionList.hpp | 12 +- .../Acts/Propagator/DefaultExtension.hpp | 43 +- .../Propagator/DenseEnvironmentExtension.hpp | 157 ++++-- Core/include/Acts/Propagator/EigenStepper.hpp | 84 ++- Core/include/Acts/Propagator/EigenStepper.ipp | 110 ++-- .../Acts/Propagator/EigenStepperError.hpp | 11 +- .../Acts/Propagator/MaterialInteractor.hpp | 26 +- Core/include/Acts/Propagator/Navigator.hpp | 345 ++++++++---- Core/include/Acts/Propagator/Propagator.hpp | 73 ++- Core/include/Acts/Propagator/Propagator.ipp | 58 +- .../Acts/Propagator/PropagatorError.hpp | 14 +- .../Acts/Propagator/StepperExtensionList.hpp | 80 ++- .../Acts/Propagator/StraightLineStepper.hpp | 120 +++-- .../Acts/Propagator/SurfaceCollector.hpp | 12 +- .../Acts/Propagator/detail/Auctioneer.hpp | 9 +- .../Propagator/detail/ConstrainedStep.hpp | 41 +- .../Propagator/detail/DebugOutputActor.hpp | 12 +- .../Propagator/detail/InteractionFormulas.hpp | 48 +- .../Acts/Propagator/detail/LoopProtection.hpp | 3 +- .../detail/RelativePathCorrector.hpp | 13 +- .../Propagator/detail/StandardAborters.hpp | 52 +- .../Acts/Propagator/detail/SteppingLogger.hpp | 12 +- .../detail/VoidPropagatorComponents.hpp | 11 +- .../abort_condition_signature_check.hpp | 49 +- .../detail/abort_list_implementation.hpp | 84 ++- .../detail/action_list_implementation.hpp | 75 ++- .../detail/action_signature_check.hpp | 46 +- .../stepper_extension_list_implementation.hpp | 119 +++-- Core/include/Acts/Seeding/BinFinder.hpp | 3 +- Core/include/Acts/Seeding/BinFinder.ipp | 6 +- Core/include/Acts/Seeding/IBinFinder.hpp | 3 +- Core/include/Acts/Seeding/IExperimentCuts.hpp | 10 +- Core/include/Acts/Seeding/InternalSeed.hpp | 20 +- .../Acts/Seeding/InternalSpacePoint.hpp | 53 +- Core/include/Acts/Seeding/Seed.hpp | 24 +- Core/include/Acts/Seeding/SeedFilter.hpp | 8 +- Core/include/Acts/Seeding/SeedFilter.ipp | 45 +- Core/include/Acts/Seeding/Seedfinder.hpp | 10 +- Core/include/Acts/Seeding/Seedfinder.ipp | 39 +- Core/include/Acts/Seeding/SeedfinderState.hpp | 34 +- Core/include/Acts/Seeding/SpacePointGrid.hpp | 8 +- Core/include/Acts/Seeding/SpacePointGrid.ipp | 6 +- Core/include/Acts/Surfaces/BoundaryCheck.hpp | 113 ++-- Core/include/Acts/Surfaces/ConeBounds.hpp | 39 +- Core/include/Acts/Surfaces/ConeSurface.hpp | 86 +-- .../Acts/Surfaces/ConvexPolygonBounds.ipp | 58 +- Core/include/Acts/Surfaces/CylinderBounds.hpp | 19 +- .../include/Acts/Surfaces/CylinderSurface.hpp | 95 ++-- Core/include/Acts/Surfaces/DiamondBounds.hpp | 15 +- Core/include/Acts/Surfaces/DiscSurface.hpp | 119 +++-- .../Acts/Surfaces/DiscTrapezoidalBounds.hpp | 41 +- Core/include/Acts/Surfaces/EllipseBounds.hpp | 28 +- Core/include/Acts/Surfaces/InfiniteBounds.hpp | 26 +- Core/include/Acts/Surfaces/LineBounds.hpp | 6 +- Core/include/Acts/Surfaces/LineSurface.hpp | 94 ++-- Core/include/Acts/Surfaces/PerigeeSurface.hpp | 20 +- Core/include/Acts/Surfaces/PlaneSurface.hpp | 67 ++- .../Surfaces/PolyhedronRepresentation.hpp | 8 +- Core/include/Acts/Surfaces/RadialBounds.hpp | 12 +- .../include/Acts/Surfaces/RectangleBounds.hpp | 15 +- Core/include/Acts/Surfaces/StrawSurface.hpp | 42 +- Core/include/Acts/Surfaces/Surface.hpp | 144 +++-- Core/include/Acts/Surfaces/SurfaceArray.hpp | 184 +++++-- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 13 +- .../include/Acts/Surfaces/TrapezoidBounds.hpp | 9 +- .../Acts/Surfaces/detail/ConeSurface.ipp | 10 +- .../Acts/Surfaces/detail/CylinderSurface.ipp | 18 +- .../Acts/Surfaces/detail/DiscSurface.ipp | 63 ++- .../Acts/Surfaces/detail/LineSurface.ipp | 88 +-- .../Acts/Surfaces/detail/PlaneSurface.ipp | 29 +- Core/include/Acts/Surfaces/detail/Surface.ipp | 74 ++- Core/include/Acts/Utilities/BinAdjustment.hpp | 10 +- Core/include/Acts/Utilities/BinUtility.hpp | 105 ++-- Core/include/Acts/Utilities/BinnedArray.hpp | 14 +- Core/include/Acts/Utilities/BinnedArrayXD.hpp | 55 +- Core/include/Acts/Utilities/BinningData.hpp | 102 ++-- Core/include/Acts/Utilities/BinningType.hpp | 12 +- Core/include/Acts/Utilities/BoundingBox.hpp | 51 +- Core/include/Acts/Utilities/BoundingBox.ipp | 192 ++++--- Core/include/Acts/Utilities/Frustum.hpp | 33 +- Core/include/Acts/Utilities/Frustum.ipp | 49 +- Core/include/Acts/Utilities/Helpers.hpp | 106 ++-- .../include/Acts/Utilities/IVisualization.hpp | 39 +- Core/include/Acts/Utilities/Interpolation.hpp | 32 +- Core/include/Acts/Utilities/Intersection.hpp | 55 +- Core/include/Acts/Utilities/Logger.hpp | 72 ++- Core/include/Acts/Utilities/ObjHelper.hpp | 29 +- .../Acts/Utilities/ParameterDefinitions.hpp | 71 ++- .../include/Acts/Utilities/ParameterTypes.hpp | 24 +- Core/include/Acts/Utilities/PlyHelper.hpp | 30 +- Core/include/Acts/Utilities/Ray.hpp | 18 +- Core/include/Acts/Utilities/Ray.ipp | 15 +- Core/include/Acts/Utilities/Result.hpp | 88 ++- Core/include/Acts/Utilities/ThrowAssert.hpp | 20 +- Core/include/Acts/Utilities/TypeTraits.hpp | 24 +- Core/include/Acts/Utilities/detail/Axis.hpp | 261 ++++++--- .../detail/DefaultParameterDefinitions.hpp | 20 +- .../Acts/Utilities/detail/Extendable.hpp | 20 +- Core/include/Acts/Utilities/detail/Grid.hpp | 109 ++-- .../Utilities/detail/MPL/type_collector.hpp | 7 +- .../Acts/Utilities/detail/grid_helper.hpp | 278 ++++++---- .../Utilities/detail/interpolation_impl.hpp | 56 +- .../Acts/Utilities/detail/periodic.hpp | 9 +- .../Vertexing/FullBilloirVertexFitter.hpp | 30 +- .../Vertexing/FullBilloirVertexFitter.ipp | 42 +- Core/include/Acts/Vertexing/IVertexFitter.hpp | 9 +- .../Acts/Vertexing/ImpactPoint3dEstimator.hpp | 5 +- .../Acts/Vertexing/IterativeVertexFinder.hpp | 48 +- .../Acts/Vertexing/IterativeVertexFinder.ipp | 115 ++-- .../Acts/Vertexing/LinearizedTrack.hpp | 16 +- .../Acts/Vertexing/LinearizedTrackFactory.hpp | 19 +- .../Acts/Vertexing/LinearizedTrackFactory.ipp | 40 +- Core/include/Acts/Vertexing/TrackAtVertex.hpp | 6 +- .../Vertexing/TrackToVertexIPEstimator.hpp | 25 +- .../Vertexing/TrackToVertexIPEstimator.ipp | 27 +- Core/include/Acts/Vertexing/Vertex.hpp | 13 +- Core/include/Acts/Vertexing/Vertex.ipp | 53 +- .../Acts/Vertexing/VertexFinderOptions.hpp | 9 +- .../include/Acts/Vertexing/VertexingError.hpp | 14 +- .../Acts/Vertexing/ZScanVertexFinder.hpp | 26 +- .../Acts/Vertexing/ZScanVertexFinder.ipp | 21 +- Core/src/EventData/TrackParametersBase.cpp | 3 +- Core/src/Geometry/AbstractVolume.cpp | 7 +- Core/src/Geometry/BinUtility.cpp | 3 +- Core/src/Geometry/ConeLayer.cpp | 19 +- Core/src/Geometry/CuboidVolumeBounds.cpp | 77 +-- Core/src/Geometry/CuboidVolumeBuilder.cpp | 70 ++- .../Geometry/CutoutCylinderVolumeBounds.cpp | 24 +- Core/src/Geometry/CylinderLayer.cpp | 16 +- Core/src/Geometry/CylinderVolumeBounds.cpp | 65 ++- Core/src/Geometry/CylinderVolumeBuilder.cpp | 128 +++-- Core/src/Geometry/CylinderVolumeHelper.cpp | 504 +++++++++++------- Core/src/Geometry/DiscLayer.cpp | 22 +- .../Geometry/DoubleTrapezoidVolumeBounds.cpp | 119 +++-- .../Geometry/GenericApproachDescriptor.cpp | 16 +- .../Geometry/GenericCuboidVolumeBounds.cpp | 73 +-- Core/src/Geometry/GeometryID.cpp | 17 +- Core/src/Geometry/GlueVolumesDescriptor.cpp | 15 +- Core/src/Geometry/Layer.cpp | 19 +- Core/src/Geometry/LayerArrayCreator.cpp | 68 ++- Core/src/Geometry/LayerCreator.cpp | 254 +++++---- Core/src/Geometry/NavigationLayer.cpp | 3 +- Core/src/Geometry/PassiveLayerBuilder.cpp | 59 +- Core/src/Geometry/PlaneLayer.cpp | 22 +- Core/src/Geometry/ProtoLayer.cpp | 28 +- Core/src/Geometry/SurfaceArrayCreator.cpp | 251 +++++---- Core/src/Geometry/TrackingGeometry.cpp | 33 +- Core/src/Geometry/TrackingGeometryBuilder.cpp | 6 +- Core/src/Geometry/TrackingVolume.cpp | 63 ++- .../Geometry/TrackingVolumeArrayCreator.cpp | 3 +- Core/src/Geometry/TrapezoidVolumeBounds.cpp | 115 ++-- Core/src/Geometry/Volume.cpp | 46 +- Core/src/Geometry/VolumeBounds.cpp | 3 +- Core/src/MagneticField/BFieldMapUtils.cpp | 118 ++-- Core/src/MagneticField/SolenoidBField.cpp | 40 +- .../Material/AccumulatedSurfaceMaterial.cpp | 20 +- .../Material/AccumulatedVolumeMaterial.cpp | 15 +- Core/src/Material/BinnedSurfaceMaterial.cpp | 20 +- .../Material/HomogeneousSurfaceMaterial.cpp | 11 +- Core/src/Material/MaterialMapUtils.cpp | 68 ++- Core/src/Material/MaterialProperties.cpp | 38 +- Core/src/Material/ProtoSurfaceMaterial.cpp | 7 +- Core/src/Material/SurfaceMaterialMapper.cpp | 57 +- Core/src/Material/VolumeMaterialMapper.cpp | 43 +- Core/src/Surfaces/ConeBounds.cpp | 51 +- Core/src/Surfaces/ConeSurface.cpp | 122 +++-- Core/src/Surfaces/CylinderBounds.cpp | 66 ++- Core/src/Surfaces/CylinderSurface.cpp | 103 ++-- Core/src/Surfaces/DiamondBounds.cpp | 44 +- Core/src/Surfaces/DiscSurface.cpp | 121 +++-- Core/src/Surfaces/DiscTrapezoidalBounds.cpp | 39 +- Core/src/Surfaces/EllipseBounds.cpp | 50 +- Core/src/Surfaces/LineBounds.cpp | 25 +- Core/src/Surfaces/LineSurface.cpp | 26 +- Core/src/Surfaces/PerigeeSurface.cpp | 34 +- Core/src/Surfaces/PlaneSurface.cpp | 64 ++- .../src/Surfaces/PolyhedronRepresentation.cpp | 3 +- Core/src/Surfaces/RadialBounds.cpp | 45 +- Core/src/Surfaces/RectangleBounds.cpp | 30 +- Core/src/Surfaces/StrawSurface.cpp | 39 +- Core/src/Surfaces/Surface.cpp | 34 +- Core/src/Surfaces/SurfaceArray.cpp | 5 +- Core/src/Surfaces/TrapezoidBounds.cpp | 34 +- Core/src/Surfaces/TriangleBounds.cpp | 28 +- Core/src/Utilities/Logger.cpp | 8 +- Core/src/Vertexing/FsmwMode1dFinder.cpp | 13 +- Core/src/Vertexing/ImpactPoint3dEstimator.cpp | 6 +- .../include/Acts/Propagator/AtlasStepper.hpp | 98 ++-- .../include/Acts/Seeding/AtlasSeedfinder.hpp | 42 +- .../include/Acts/Seeding/AtlasSeedfinder.ipp | 78 +-- .../Acts/Seeding/LegacyInternalSeed.hpp | 67 ++- Legacy/include/Acts/Seeding/LegacySeed.hpp | 26 +- Legacy/include/Acts/Seeding/SPForSeed.hpp | 78 ++- .../Acts/Plugins/DD4hep/ActsExtension.hpp | 37 +- .../Plugins/DD4hep/ConvertDD4hepDetector.hpp | 40 +- .../Plugins/DD4hep/DD4hepDetectorElement.hpp | 6 +- .../Plugins/DD4hep/DD4hepLayerBuilder.hpp | 19 +- Plugins/DD4hep/src/ActsExtension.cpp | 11 +- Plugins/DD4hep/src/ConvertDD4hepDetector.cpp | 147 +++-- Plugins/DD4hep/src/DD4hepDetectorElement.cpp | 21 +- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 154 ++++-- .../Digitization/CartesianSegmentation.hpp | 59 +- .../Plugins/Digitization/Clusterization.hpp | 17 +- .../Plugins/Digitization/DigitizationCell.hpp | 20 +- .../Digitization/DigitizationModule.hpp | 59 +- .../DoubleHitSpacePointBuilder.hpp | 44 +- .../Digitization/PlanarModuleCluster.hpp | 24 +- .../Digitization/PlanarModuleStepper.hpp | 31 +- .../Plugins/Digitization/Segmentation.hpp | 17 +- .../SingleHitSpacePointBuilder.hpp | 20 +- .../Digitization/detail/Clusterization.ipp | 37 +- .../src/CartesianSegmentation.cpp | 71 ++- .../Digitization/src/DigitizationModule.cpp | 24 +- .../src/DoubleHitSpacePointBuilder.cpp | 53 +- .../Digitization/src/PlanarModuleStepper.cpp | 41 +- .../src/SingleHitSpacePointBuilder.cpp | 12 +- .../Acts/Plugins/TGeo/TGeoDetectorElement.hpp | 31 +- .../Acts/Plugins/TGeo/TGeoLayerBuilder.hpp | 34 +- .../Plugins/TGeo/TGeoPrimitivesHelpers.hpp | 10 +- Plugins/TGeo/src/TGeoDetectorElement.cpp | 68 ++- Plugins/TGeo/src/TGeoLayerBuilder.cpp | 102 ++-- .../CommonHelpers/CubicTrackingGeometry.hpp | 62 ++- .../CylindricalTrackingGeometry.hpp | 64 ++- .../CommonHelpers/DetectorElementStub.hpp | 16 +- .../Tests/CommonHelpers/FloatComparisons.hpp | 87 +-- .../Tests/CommonHelpers/LineSurfaceStub.hpp | 41 +- Tests/Core/EventData/BoundParametersTests.cpp | 260 +++++---- .../EventData/CurvilinearParametersTests.cpp | 77 +-- Tests/Core/EventData/FittableTypeTests.cpp | 130 +++-- .../EventData/MeasurementHelpersTests.cpp | 22 +- Tests/Core/EventData/MeasurementTests.cpp | 8 +- Tests/Core/EventData/ParameterSetTests.cpp | 93 ++-- Tests/Core/EventData/ParametersTestHelper.hpp | 11 +- Tests/Core/EventData/TrackStateTests.cpp | 8 +- Tests/Core/Fitter/GainMatrixSmootherTests.cpp | 45 +- Tests/Core/Fitter/GainMatrixUpdatorTests.cpp | 7 +- Tests/Core/Fitter/KalmanFilterTestUtils.hpp | 22 +- Tests/Core/Fitter/KalmanFitterTests.cpp | 116 ++-- Tests/Core/Geometry/AlignmentContextTests.cpp | 49 +- Tests/Core/Geometry/BVHDataTestCase.hpp | 69 ++- Tests/Core/Geometry/ConeLayerTests.cpp | 9 +- .../Geometry/CuboidVolumeBuilderTests.cpp | 17 +- Tests/Core/Geometry/CylinderLayerTests.cpp | 27 +- .../Geometry/CylinderVolumeBoundsTests.cpp | 37 +- .../Geometry/CylinderVolumeBuilderTests.cpp | 58 +- Tests/Core/Geometry/DiscLayerTests.cpp | 9 +- .../GenericApproachDescriptorTests.cpp | 17 +- Tests/Core/Geometry/LayerCreatorTests.cpp | 40 +- Tests/Core/Geometry/LayerStub.hpp | 23 +- Tests/Core/Geometry/NavigationLayerTests.cpp | 4 +- Tests/Core/Geometry/PlaneLayerTests.cpp | 28 +- .../Geometry/SurfaceArrayCreatorTests.cpp | 199 ++++--- .../Geometry/TrackingGeometryClosureTests.cpp | 54 +- .../Geometry/TrackingGeometryGeoIDTests.cpp | 31 +- .../Core/Geometry/TrackingVolumeCreation.hpp | 42 +- .../MagneticField/ConstantBFieldTests.cpp | 38 +- .../InterpolatedBFieldMapTests.cpp | 19 +- ...MagneticFieldInterfaceConsistencyTests.cpp | 31 +- .../MagneticField/SolenoidBFieldTests.cpp | 4 +- .../MagneticField/SolenoidFieldBenchmark.cpp | 7 +- .../AccumulatedMaterialPropertiesTests.cpp | 30 +- .../Material/InterpolatedMaterialMapTests.cpp | 21 +- .../Material/MaterialCompositionTests.cpp | 41 +- .../Core/Material/MaterialPropertiesTests.cpp | 30 +- Tests/Core/Material/MaterialTests.cpp | 4 +- .../Material/SurfaceMaterialMapperTests.cpp | 3 +- .../Material/VolumeMaterialMapperTests.cpp | 29 +- Tests/Core/Propagator/ActionListTests.cpp | 24 +- .../Core/Propagator/AtlasStepperBenchmark.cpp | 17 +- Tests/Core/Propagator/AuctioneerTests.cpp | 12 +- .../Core/Propagator/EigenStepperBenchmark.cpp | 17 +- Tests/Core/Propagator/ExtrapolatorTests.cpp | 123 +++-- .../Propagator/IntersectionCorrectorTests.cpp | 8 +- Tests/Core/Propagator/JacobianTests.cpp | 44 +- .../Propagator/KalmanExtrapolatorTests.cpp | 16 +- Tests/Core/Propagator/LoopProtectionTests.cpp | 57 +- .../Propagator/MaterialCollectionTests.cpp | 49 +- Tests/Core/Propagator/NavigatorTests.cpp | 119 +++-- Tests/Core/Propagator/PropagatorTests.cpp | 134 +++-- Tests/Core/Propagator/StepperTests.cpp | 163 +++--- Tests/Core/Seeding/ATLASBottomBinFinder.hpp | 6 +- Tests/Core/Seeding/ATLASBottomBinFinder.ipp | 6 +- Tests/Core/Seeding/ATLASCuts.hpp | 24 +- Tests/Core/Seeding/ATLASTopBinFinder.hpp | 6 +- Tests/Core/Seeding/ATLASTopBinFinder.ipp | 6 +- Tests/Core/Seeding/SeedfinderTest.cpp | 9 +- Tests/Core/Seeding/SpacePoint.hpp | 20 +- Tests/Core/Seeding/TestCovarianceTool.hpp | 16 +- .../Core/Surfaces/BoundaryCheckBenchmark.cpp | 18 +- Tests/Core/Surfaces/ConeBoundsTests.cpp | 4 +- Tests/Core/Surfaces/ConeSurfaceTests.cpp | 46 +- Tests/Core/Surfaces/CylinderBoundsTests.cpp | 51 +- Tests/Core/Surfaces/CylinderSurfaceTests.cpp | 87 +-- Tests/Core/Surfaces/DiamondBoundsTests.cpp | 45 +- Tests/Core/Surfaces/DiscSurfaceTests.cpp | 55 +- .../Surfaces/DiscTrapezoidalBoundsTests.cpp | 28 +- Tests/Core/Surfaces/EllipseBoundsTests.cpp | 40 +- Tests/Core/Surfaces/LineBoundsTests.cpp | 10 +- Tests/Core/Surfaces/LineSurfaceTests.cpp | 33 +- Tests/Core/Surfaces/PerigeeSurfaceTests.cpp | 18 +- Tests/Core/Surfaces/PlaneSurfaceTests.cpp | 28 +- Tests/Core/Surfaces/RadialBoundsTests.cpp | 21 +- Tests/Core/Surfaces/RectangleBoundsTests.cpp | 39 +- Tests/Core/Surfaces/StrawSurfaceTests.cpp | 4 +- Tests/Core/Surfaces/SurfaceArrayTests.cpp | 44 +- Tests/Core/Surfaces/SurfaceBoundsTests.cpp | 39 +- Tests/Core/Surfaces/SurfaceStub.hpp | 88 +-- Tests/Core/Surfaces/SurfaceTests.cpp | 33 +- Tests/Core/Surfaces/TrapezoidBoundsTests.cpp | 30 +- Tests/Core/Surfaces/TriangleBoundsTests.cpp | 36 +- Tests/Core/Utilities/AxesTests.cpp | 52 +- Tests/Core/Utilities/BFieldMapUtilsTests.cpp | 84 ++- Tests/Core/Utilities/BinUtilityTests.cpp | 28 +- Tests/Core/Utilities/BinningDataTests.cpp | 34 +- Tests/Core/Utilities/BoundingBoxTest.cpp | 35 +- Tests/Core/Utilities/GeometryIDTests.cpp | 12 +- Tests/Core/Utilities/GridTests.cpp | 173 +++--- Tests/Core/Utilities/HelpersTests.cpp | 30 +- Tests/Core/Utilities/InterpolationTests.cpp | 8 +- Tests/Core/Utilities/IntersectionTests.cpp | 146 ++--- Tests/Core/Utilities/LoggerTests.cpp | 11 +- Tests/Core/Utilities/MPLTests.cpp | 124 +++-- .../Core/Utilities/MaterialMapUtilsTests.cpp | 35 +- Tests/Core/Utilities/ResultTests.cpp | 9 +- Tests/Core/Utilities/TypeTraitsTest.cpp | 77 ++- .../FullBilloirVertexFitterTests.cpp | 64 ++- .../Vertexing/IterativeVertexFinderTests.cpp | 16 +- .../Vertexing/LinearizedTrackFactoryTests.cpp | 52 +- .../TrackToVertexIPEstimatorTests.cpp | 5 +- .../Core/Vertexing/ZScanVertexFinderTests.cpp | 39 +- Tests/Examples/src/CustomDefaultLogger.cpp | 16 +- .../Integration/ATLSeedingIntegrationTest.cpp | 28 +- .../InterpolatedSolenoidBFieldTest.cpp | 39 +- Tests/Integration/PropagationTestBase.hpp | 428 ++++++++++++--- Tests/Integration/PropagationTestHelper.hpp | 167 ++++-- Tests/Integration/PropagationTests.cpp | 46 +- .../PropagationTestsAtlasField.cpp | 38 +- .../covariance_validation_fixture.hpp | 44 +- .../CartesianSegmentationTests.cpp | 8 +- .../Digitization/ClusterizationTests.cpp | 33 +- .../DoubleHitSpacePointBuilderTests.cpp | 11 +- .../Digitization/PlanarModuleStepperTests.cpp | 36 +- .../SingleHitSpacePointBuilderTests.cpp | 6 +- 431 files changed, 13021 insertions(+), 7254 deletions(-) diff --git a/.clang-format b/.clang-format index d59ace01c..6f2f05440 100644 --- a/.clang-format +++ b/.clang-format @@ -6,6 +6,11 @@ AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false +AllowAllParametersOfDeclarationOnNextLine: false +BinPackArguments: false +BinPackParameters: false +AlignAfterOpenBracket: AlwaysBreak +AlwaysBreakAfterDefinitionReturnType: All PointerAlignment: Left ColumnLimit: 80 IncludeCategories: diff --git a/Core/include/Acts/EventData/ChargePolicy.hpp b/Core/include/Acts/EventData/ChargePolicy.hpp index 110285eec..72e2a89d9 100644 --- a/Core/include/Acts/EventData/ChargePolicy.hpp +++ b/Core/include/Acts/EventData/ChargePolicy.hpp @@ -31,27 +31,40 @@ class ChargedPolicy { /// @brief equality operator /// /// @return @c true if rhs has the same charge, otherwise @c false - bool operator==(const ChargedPolicy& rhs) const { + bool + operator==(const ChargedPolicy& rhs) const { return m_dCharge == rhs.m_dCharge; } /// @brief inequality operator /// /// @return @c true if rhs has a different charge, otherwise @c false - bool operator!=(const ChargedPolicy& rhs) const { return !(*this == rhs); } + bool + operator!=(const ChargedPolicy& rhs) const { + return !(*this == rhs); + } /// @brief retrieve stored value of the electric charge /// /// @return value for charge - double getCharge() const { return m_dCharge; } + double + getCharge() const { + return m_dCharge; + } /// @brief sets charge /// /// @param charge new value for the electric charge - void setCharge(double charge) { m_dCharge = charge; } + void + setCharge(double charge) { + m_dCharge = charge; + } /// @brief flip sign of electric charge - void flipSign() { m_dCharge *= -1.; } + void + flipSign() { + m_dCharge *= -1.; + } private: double m_dCharge; ///< value of electric charge @@ -74,16 +87,25 @@ class NeutralPolicy { /// @brief equality operator /// /// @return always @c true - bool operator==(const NeutralPolicy& /*other*/) const { return true; } + bool + operator==(const NeutralPolicy& /*other*/) const { + return true; + } /// @brief inequality operator /// /// @return always @c false - bool operator!=(const NeutralPolicy& rhs) const { return !(*this == rhs); } + bool + operator!=(const NeutralPolicy& rhs) const { + return !(*this == rhs); + } /// @brief get electric charge /// /// @return always 0 - double getCharge() const { return 0.; } + double + getCharge() const { + return 0.; + } }; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/EventData/Measurement.hpp b/Core/include/Acts/EventData/Measurement.hpp index 3fe4401fe..f976495e4 100644 --- a/Core/include/Acts/EventData/Measurement.hpp +++ b/Core/include/Acts/EventData/Measurement.hpp @@ -50,8 +50,9 @@ class Surface; template <typename source_link_t, ParID_t... params> class Measurement { // check type conditions - static_assert(SourceLinkConcept<source_link_t>, - "Source link does not fulfill SourceLinkConcept"); + static_assert( + SourceLinkConcept<source_link_t>, + "Source link does not fulfill SourceLinkConcept"); private: // private typedefs @@ -90,13 +91,18 @@ class Measurement { /// @param head,values consistent number of parameter values of the /// measurement template <typename... Tail> - Measurement(std::shared_ptr<const Surface> surface, - const source_link_t& source, CovMatrix_t cov, - typename std::enable_if<sizeof...(Tail) + 1 == sizeof...(params), - ParValue_t>::type head, - Tail... values) - : m_oParameters(std::make_unique<const CovMatrix_t>(std::move(cov)), head, - values...), + Measurement( + std::shared_ptr<const Surface> surface, + const source_link_t& source, + CovMatrix_t cov, + typename std::enable_if< + sizeof...(Tail) + 1 == sizeof...(params), + ParValue_t>::type head, + Tail... values) + : m_oParameters( + std::make_unique<const CovMatrix_t>(std::move(cov)), + head, + values...), m_pSurface(std::move(surface)), m_sourceLink(source) { assert(m_pSurface); @@ -133,8 +139,8 @@ class Measurement { /// @tparam params...The local parameter pack /// /// @param rhs is the source for the assignment - Measurement<source_link_t, params...>& operator=( - const Measurement<source_link_t, params...>& rhs) { + Measurement<source_link_t, params...>& + operator=(const Measurement<source_link_t, params...>& rhs) { // check for self-assignment if (&rhs != this) { m_oParameters = rhs.m_oParameters; @@ -150,8 +156,8 @@ class Measurement { /// @tparam params...The local parameter pack /// /// @param rhs is the source for the move assignment - Measurement<source_link_t, params...>& operator=( - Measurement<source_link_t, params...>&& rhs) { + Measurement<source_link_t, params...>& + operator=(Measurement<source_link_t, params...>&& rhs) { m_oParameters = std::move(rhs.m_oParameters); m_pSurface = std::move(rhs.m_pSurface); m_sourceLink = std::move(rhs.m_sourceLink); @@ -168,7 +174,8 @@ class Measurement { /// /// @return value of the stored parameter template <ParID_t parameter> - ParValue_t get() const { + ParValue_t + get() const { return m_oParameters.template getParameter<parameter>(); } @@ -179,12 +186,18 @@ class Measurement { /// given for the measured parameters in the order defined by the /// class /// template argument @c params. - ParVector_t parameters() const { return m_oParameters.getParameters(); } + ParVector_t + parameters() const { + return m_oParameters.getParameters(); + } /// @brief access covariance matrix of the measured parameter values /// /// @return covariance matrix of the measurement - CovMatrix_t covariance() const { return *m_oParameters.getCovariance(); } + CovMatrix_t + covariance() const { + return *m_oParameters.getCovariance(); + } /// @brief retrieve stored uncertainty for given parameter /// @@ -196,14 +209,18 @@ class Measurement { /// /// @return uncertainty \f$\sigma \ge 0\f$ for given parameter template <ParID_t parameter> - ParValue_t uncertainty() const { + ParValue_t + uncertainty() const { return m_oParameters.template getUncertainty<parameter>(); } /// @brief number of measured parameters /// /// @return number of measured parameters - static constexpr unsigned int size() { return ParSet_t::size(); } + static constexpr unsigned int + size() { + return ParSet_t::size(); + } /// @brief access associated surface /// @@ -211,7 +228,10 @@ class Measurement { /// must still be valid at the same memory location. /// /// @return reference to surface at which the measurement took place - const Acts::Surface& referenceSurface() const { return *m_pSurface; } + const Acts::Surface& + referenceSurface() const { + return *m_pSurface; + } /// @brief link access to the source of the measurement. /// @@ -219,7 +239,10 @@ class Measurement { /// object, see description above. /// /// @return source_link_t object - const source_link_t& sourceLink() const { return m_sourceLink; } + const source_link_t& + sourceLink() const { + return m_sourceLink; + } /// @brief calculate residual with respect to given track parameters /// @@ -237,7 +260,8 @@ class Measurement { /// @return vector with the residual parameter values (in valid range) /// /// @sa ParameterSet::residual - ParVector_t residual(const TrackParameters& trackPars) const { + ParVector_t + residual(const TrackParameters& trackPars) const { return m_oParameters.residual(trackPars.getParameterSet()); } @@ -245,11 +269,11 @@ class Measurement { /// /// @return @c true if parameter sets and associated surfaces compare equal, /// otherwise @c false - virtual bool operator==( - const Measurement<source_link_t, params...>& rhs) const { - return ((m_oParameters == rhs.m_oParameters) && - (*m_pSurface == *rhs.m_pSurface) && - (m_sourceLink == rhs.m_sourceLink)); + virtual bool + operator==(const Measurement<source_link_t, params...>& rhs) const { + return ( + (m_oParameters == rhs.m_oParameters) && + (*m_pSurface == *rhs.m_pSurface) && (m_sourceLink == rhs.m_sourceLink)); } /// @brief inequality operator @@ -257,21 +281,28 @@ class Measurement { /// @return @c true if both objects are not equal, otherwise @c false /// /// @sa Measurement::operator== - bool operator!=(const Measurement<source_link_t, params...>& rhs) const { + bool + operator!=(const Measurement<source_link_t, params...>& rhs) const { return !(*this == rhs); } /// @projection operator - static Projection_t projector() { return ParSet_t::projector(); } + static Projection_t + projector() { + return ParSet_t::projector(); + } - friend std::ostream& operator<<( - std::ostream& out, const Measurement<source_link_t, params...>& m) { + friend std::ostream& + operator<<( + std::ostream& out, + const Measurement<source_link_t, params...>& m) { m.print(out); return out; } protected: - virtual std::ostream& print(std::ostream& out) const { + virtual std::ostream& + print(std::ostream& out) const { out << sizeof...(params) << "D measurement: "; int dummy[sizeof...(params)] = {(out << params << ", ", 0)...}; dummy[0] = dummy[0]; diff --git a/Core/include/Acts/EventData/MeasurementHelpers.hpp b/Core/include/Acts/EventData/MeasurementHelpers.hpp index 15e8ab46d..3be141ba4 100644 --- a/Core/include/Acts/EventData/MeasurementHelpers.hpp +++ b/Core/include/Acts/EventData/MeasurementHelpers.hpp @@ -22,26 +22,31 @@ namespace MeasurementHelpers { /// @tparam T The FittableMeasurement type /// @return const pointer to the extracted surface template <typename T> -const Surface* getSurface(const T& fittable_measurement) { - return std::visit([](const auto& meas) { return &meas.referenceSurface(); }, - fittable_measurement); +const Surface* +getSurface(const T& fittable_measurement) { + return std::visit( + [](const auto& meas) { return &meas.referenceSurface(); }, + fittable_measurement); } template <typename T> -size_t getSize(const T& fittable_measurement) { - return std::visit([](const auto& meas) { return meas.size(); }, - fittable_measurement); +size_t +getSize(const T& fittable_measurement) { + return std::visit( + [](const auto& meas) { return meas.size(); }, fittable_measurement); } } // namespace MeasurementHelpers struct MinimalSourceLink { const FittableMeasurement<MinimalSourceLink>* meas{nullptr}; - bool operator==(const MinimalSourceLink& rhs) const { + bool + operator==(const MinimalSourceLink& rhs) const { return meas == rhs.meas; } - const Surface& referenceSurface() const { + const Surface& + referenceSurface() const { return *MeasurementHelpers::getSurface(*meas); } @@ -50,13 +55,15 @@ struct MinimalSourceLink { } }; -inline std::ostream& operator<<(std::ostream& os, const MinimalSourceLink& sl) { +inline std::ostream& +operator<<(std::ostream& os, const MinimalSourceLink& sl) { os << "SourceLink(" << sl.meas << ")"; return os; } -static_assert(SourceLinkConcept<MinimalSourceLink>, - "MinimalSourceLink does not fulfill SourceLinkConcept"); +static_assert( + SourceLinkConcept<MinimalSourceLink>, + "MinimalSourceLink does not fulfill SourceLinkConcept"); namespace detail { @@ -96,7 +103,8 @@ struct visit_measurement_callable { /// @param dim The actual dimension as a runtime value /// @param lambda The lambda to call with the statically sized subsets template <typename L, typename A, typename B> -auto visit_measurement(A&& param, B&& cov, size_t dim, L&& lambda) { +auto +visit_measurement(A&& param, B&& cov, size_t dim, L&& lambda) { return template_switch<detail::visit_measurement_callable, 1, BoundParsDim>( dim, param, cov, lambda); } diff --git a/Core/include/Acts/EventData/ParameterSet.hpp b/Core/include/Acts/EventData/ParameterSet.hpp index 45b25d8ac..b2aa19c69 100644 --- a/Core/include/Acts/EventData/ParameterSet.hpp +++ b/Core/include/Acts/EventData/ParameterSet.hpp @@ -85,11 +85,15 @@ class ParameterSet { sizeof...(params); ///< number of parameters stored in this class // static assert to check that the template parameters are consistent - static_assert(detail::are_sorted<true, true, ParID_t, params...>::value, - "parameter identifiers are not sorted"); static_assert( - detail::are_within<unsigned int, 0, BoundParsDim, - static_cast<unsigned int>(params)...>::value, + detail::are_sorted<true, true, ParID_t, params...>::value, + "parameter identifiers are not sorted"); + static_assert( + detail::are_within< + unsigned int, + 0, + BoundParsDim, + static_cast<unsigned int>(params)...>::value, "parameter identifiers must be greater or " "equal to zero and smaller than the total number of parameters"); static_assert(NPars > 0, "number of stored parameters can not be zero"); @@ -120,9 +124,10 @@ class ParameterSet { * @param values values for the remaining stored parameters */ template <typename... Tail> - ParameterSet(CovPtr_t cov, - std::enable_if_t<sizeof...(Tail) + 1 == NPars, ParValue_t> head, - Tail... values) + ParameterSet( + CovPtr_t cov, + std::enable_if_t<sizeof...(Tail) + 1 == NPars, ParValue_t> head, + Tail... values) : m_vValues(NPars), m_pCovariance(std::move(cov)) { detail::initialize_parset<ParID_t, params...>::init(*this, head, values...); } @@ -177,7 +182,8 @@ class ParameterSet { * * @param rhs object whose content is assigned to this @c ParameterSet object */ - ParSet_t& operator=(const ParSet_t& rhs) { + ParSet_t& + operator=(const ParSet_t& rhs) { m_vValues = rhs.m_vValues; m_pCovariance = (rhs.m_pCovariance @@ -191,7 +197,8 @@ class ParameterSet { * * @param rhs object whose content is moved into this @c ParameterSet object */ - ParSet_t& operator=(ParSet_t&& rhs) { + ParSet_t& + operator=(ParSet_t&& rhs) { m_vValues = std::move(rhs.m_vValues); m_pCovariance = std::move(rhs.m_pCovariance); return *this; @@ -200,7 +207,8 @@ class ParameterSet { /** * @brief swap two objects */ - friend void swap(ParSet_t& first, ParSet_t& second) noexcept { + friend void + swap(ParSet_t& first, ParSet_t& second) noexcept { using std::swap; swap(first.m_vValues, second.m_vValues); swap(first.m_pCovariance, second.m_pCovariance); @@ -216,7 +224,8 @@ class ParameterSet { * @return position of parameter in variadic template parameter set @c params */ template <ParID_t parameter> - static constexpr size_t getIndex() { + static constexpr size_t + getIndex() { return detail::get_position<ParID_t, parameter, params...>::value; } @@ -232,7 +241,8 @@ class ParameterSet { * parameter set @c params */ template <size_t index> - static constexpr ParID_t getParID() { + static constexpr ParID_t + getParID() { return detail::at_index<ParID_t, index, params...>::value; } @@ -246,7 +256,8 @@ class ParameterSet { * @return value of the stored parameter */ template <ParID_t parameter> - ParValue_t getParameter() const { + ParValue_t + getParameter() const { return m_vValues(getIndex<parameter>()); } @@ -255,7 +266,10 @@ class ParameterSet { * * @return column vector with @c #NPars rows */ - ParVector_t getParameters() const { return m_vValues; } + ParVector_t + getParameters() const { + return m_vValues; + } /** * @brief sets value for given parameter @@ -268,7 +282,8 @@ class ParameterSet { * @return previously stored value of this parameter */ template <ParID_t parameter> - void setParameter(ParValue_t value) { + void + setParameter(ParValue_t value) { using parameter_type = typename par_type<parameter>::type; m_vValues(getIndex<parameter>()) = parameter_type::getValue(value); } @@ -282,7 +297,8 @@ class ParameterSet { * * @param values vector of length #NPars */ - void setParameters(const ParVector_t& values) { + void + setParameters(const ParVector_t& values) { detail::initialize_parset<ParID_t, params...>::init(*this, values); } @@ -298,7 +314,8 @@ class ParameterSet { * @return @c true if the parameter is stored in this set, otherwise @c false */ template <ParID_t parameter> - bool contains() const { + bool + contains() const { return detail::is_contained<ParID_t, parameter, params...>::value; } @@ -310,7 +327,10 @@ class ParameterSet { * * @return raw pointer to covariance matrix (can be a nullptr) */ - const CovMatrix_t* getCovariance() const { return m_pCovariance.get(); } + const CovMatrix_t* + getCovariance() const { + return m_pCovariance.get(); + } /** * @brief access uncertainty for individual parameter @@ -325,7 +345,8 @@ class ParameterSet { * covariance matrix is set */ template <ParID_t parameter> - ParValue_t getUncertainty() const { + ParValue_t + getUncertainty() const { if (m_pCovariance) { size_t index = getIndex<parameter>(); return sqrt((*m_pCovariance)(index, index)); @@ -341,7 +362,10 @@ class ParameterSet { * * @param cov unique pointer to new covariance matrix (nullptr is accepted) */ - void setCovariance(CovPtr_t cov) { m_pCovariance = std::move(cov); } + void + setCovariance(CovPtr_t cov) { + m_pCovariance = std::move(cov); + } /** * @brief equality operator @@ -350,7 +374,8 @@ class ParameterSet { * matrices are * either identical or not set, otherwise @c false */ - bool operator==(const ParSet_t& rhs) const { + bool + operator==(const ParSet_t& rhs) const { // shortcut comparison with myself if (&rhs == this) { return true; @@ -381,7 +406,10 @@ class ParameterSet { * * @sa ParameterSet::operator== */ - bool operator!=(const ParSet_t& rhs) const { return !(*this == rhs); } + bool + operator!=(const ParSet_t& rhs) const { + return !(*this == rhs); + } /** * @brief project vector of full parameter set onto parameter sub-space @@ -408,7 +436,8 @@ class ParameterSet { * vector * which are also defined for this ParameterSet object */ - ParVector_t project(const FullParameterSet& fullParSet) const { + ParVector_t + project(const FullParameterSet& fullParSet) const { return projector() * fullParSet.getParameters(); } @@ -451,7 +480,8 @@ class ParameterSet { typename T = ParSet_t, std::enable_if_t<not std::is_same<T, FullParameterSet>::value, int> = 0> /// @endcond - ParVector_t residual(const FullParameterSet& fullParSet) const { + ParVector_t + residual(const FullParameterSet& fullParSet) const { return detail::residual_calculator<params...>::result( m_vValues, projector() * fullParSet.getParameters()); } @@ -488,7 +518,8 @@ class ParameterSet { * ParameterSet object * with respect to the given other parameter set */ - ParVector_t residual(const ParSet_t& otherParSet) const { + ParVector_t + residual(const ParSet_t& otherParSet) const { return detail::residual_calculator<params...>::result( m_vValues, otherParSet.m_vValues); } @@ -503,7 +534,8 @@ class ParameterSet { * @return constant matrix with @c #NPars rows and @c #Acts::BoundParsDim * columns */ - static const ActsMatrix<ParValue_t, NPars, BoundParsDim> projector() { + static const ActsMatrix<ParValue_t, NPars, BoundParsDim> + projector() { return sProjector; } @@ -512,7 +544,10 @@ class ParameterSet { * * @return number of stored parameters */ - static constexpr unsigned int size() { return NPars; } + static constexpr unsigned int + size() { + return NPars; + } /** * @brief correct given parameter values @@ -526,7 +561,8 @@ class ParameterSet { * @param values vector with parameter values to be checked and corrected if * necessary */ - static void correctValues(ParVector_t& values) { + static void + correctValues(ParVector_t& values) { detail::value_corrector<params...>::result(values); } @@ -546,5 +582,6 @@ constexpr unsigned int ParameterSet<params...>::NPars; template <ParID_t... params> const typename ParameterSet<params...>::Projection_t ParameterSet<params...>::sProjector = detail::make_projection_matrix< - BoundParsDim, static_cast<unsigned int>(params)...>::init(); + BoundParsDim, + static_cast<unsigned int>(params)...>::init(); } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp b/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp index e8ed1a861..4b28e360d 100644 --- a/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp @@ -41,15 +41,21 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// it is given in the measurement frame /// @param[in] parValues The parameter vector /// @param[in] surface The reference surface the parameters are bound to - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> - SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, - const ParVector_t& parValues, - std::shared_ptr<const Surface> surface) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> + SingleBoundTrackParameters( + const GeometryContext& gctx, + CovPtr_t cov, + const ParVector_t& parValues, + std::shared_ptr<const Surface> surface) : SingleTrackParameters<ChargePolicy>( - std::move(cov), parValues, + std::move(cov), + parValues, detail::coordinate_transformation::parameters2globalPosition( - gctx, parValues, *surface), + gctx, + parValues, + *surface), detail::coordinate_transformation::parameters2globalMomentum( parValues)), m_pSurface(std::move(surface)) { @@ -71,18 +77,28 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// @param[in] momentum The global momentum of the track parameterisation /// @param[in] dCharge The charge of the particle track parameterisation /// @param[in] surface The reference surface the parameters are bound to - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> - SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, - const ActsVectorD<3>& position, - const ActsVectorD<3>& momentum, double dCharge, - double dTime, - std::shared_ptr<const Surface> surface) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> + SingleBoundTrackParameters( + const GeometryContext& gctx, + CovPtr_t cov, + const ActsVectorD<3>& position, + const ActsVectorD<3>& momentum, + double dCharge, + double dTime, + std::shared_ptr<const Surface> surface) : SingleTrackParameters<ChargePolicy>( std::move(cov), detail::coordinate_transformation::global2parameters( - gctx, position, momentum, dCharge, dTime, *surface), - position, momentum), + gctx, + position, + momentum, + dCharge, + dTime, + *surface), + position, + momentum), m_pSurface(std::move(surface)) { assert(m_pSurface); } @@ -100,15 +116,21 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// it is given in the measurement frame /// @param[in] parValues The parameter vector /// @param[in] surface The reference surface the parameters are bound to - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> - SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, - const ParVector_t& parValues, - std::shared_ptr<const Surface> surface) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> + SingleBoundTrackParameters( + const GeometryContext& gctx, + CovPtr_t cov, + const ParVector_t& parValues, + std::shared_ptr<const Surface> surface) : SingleTrackParameters<ChargePolicy>( - std::move(cov), parValues, + std::move(cov), + parValues, detail::coordinate_transformation::parameters2globalPosition( - gctx, parValues, *surface), + gctx, + parValues, + *surface), detail::coordinate_transformation::parameters2globalMomentum( parValues)), m_pSurface(std::move(surface)) { @@ -131,17 +153,27 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// @param[in] momentum The global momentum of the track parameterisation /// @param[in] dCharge The charge of the particle track parameterisation /// @param[in] surface The reference surface the parameters are bound to - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> - SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, - const ActsVectorD<3>& position, - const ActsVectorD<3>& momentum, double dTime, - std::shared_ptr<const Surface> surface) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> + SingleBoundTrackParameters( + const GeometryContext& gctx, + CovPtr_t cov, + const ActsVectorD<3>& position, + const ActsVectorD<3>& momentum, + double dTime, + std::shared_ptr<const Surface> surface) : SingleTrackParameters<ChargePolicy>( std::move(cov), detail::coordinate_transformation::global2parameters( - gctx, position, momentum, 0, dTime, *surface), - position, momentum), + gctx, + position, + momentum, + 0, + dTime, + *surface), + position, + momentum), m_pSurface(std::move(surface)) {} /// @brief copy constructor - charged/neutral @@ -163,8 +195,8 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { ~SingleBoundTrackParameters() override = default; /// @brief copy assignment operator - charged/neutral - SingleBoundTrackParameters<ChargePolicy>& operator=( - const SingleBoundTrackParameters<ChargePolicy>& rhs) { + SingleBoundTrackParameters<ChargePolicy>& + operator=(const SingleBoundTrackParameters<ChargePolicy>& rhs) { // check for self-assignment if (this != &rhs) { SingleTrackParameters<ChargePolicy>::operator=(rhs); @@ -175,8 +207,8 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// @brief move assignment operator - charged/neutral /// checks if the surface is free and in such a case delete-clones it - SingleBoundTrackParameters<ChargePolicy>& operator=( - SingleBoundTrackParameters<ChargePolicy>&& rhs) { + SingleBoundTrackParameters<ChargePolicy>& + operator=(SingleBoundTrackParameters<ChargePolicy>&& rhs) { // check for self-assignment if (this != &rhs) { SingleTrackParameters<ChargePolicy>::operator=(std::move(rhs)); @@ -188,7 +220,8 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// @brief clone - charged/netural /// virtual constructor for type creation without casting - SingleBoundTrackParameters<ChargePolicy>* clone() const override { + SingleBoundTrackParameters<ChargePolicy>* + clone() const override { return new SingleBoundTrackParameters<ChargePolicy>(*this); } @@ -198,13 +231,17 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation template <ParID_t par> - void set(const GeometryContext& gctx, ParValue_t newValue) { + void + set(const GeometryContext& gctx, ParValue_t newValue) { this->getParameterSet().template setParameter<par>(newValue); this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); } /// @brief access method to the reference surface - const Surface& referenceSurface() const final { return *m_pSurface; } + const Surface& + referenceSurface() const final { + return *m_pSurface; + } /// @brief access to the measurement frame, i.e. the rotation matrix with /// respect to the global coordinate system, in which the local error @@ -217,7 +254,8 @@ class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> { /// surface frame, for measurements with respect to a line this has to be /// constructed by the point of clostest approach to the line, for /// cylindrical surfaces this is (by convention) the tangential plane. - RotationMatrix3D referenceFrame(const GeometryContext& gctx) const final { + RotationMatrix3D + referenceFrame(const GeometryContext& gctx) const final { return std::move( m_pSurface->referenceFrame(gctx, this->position(), this->momentum())); } diff --git a/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp b/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp index bcb2d2595..d25038340 100644 --- a/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp @@ -37,16 +37,24 @@ class SingleCurvilinearTrackParameters /// @param[in] position The global position of this track parameterisation /// @param[in] momentum The global momentum of this track parameterisation /// @param[in] dCharge The charge of this track parameterisation - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> - SingleCurvilinearTrackParameters(CovPtr_t cov, const ActsVectorD<3>& position, - const ActsVectorD<3>& momentum, - double dCharge, double dTime) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> + SingleCurvilinearTrackParameters( + CovPtr_t cov, + const ActsVectorD<3>& position, + const ActsVectorD<3>& momentum, + double dCharge, + double dTime) : SingleTrackParameters<ChargePolicy>( std::move(cov), detail::coordinate_transformation::global2curvilinear( - position, momentum, dCharge, dTime), - position, momentum), + position, + momentum, + dCharge, + dTime), + position, + momentum), m_upSurface(Surface::makeShared<PlaneSurface>(position, momentum)) {} /// @brief constructor for curvilienear representation @@ -56,15 +64,23 @@ class SingleCurvilinearTrackParameters /// @param[in] cov The covariance matrix w.r.t. curvilinear frame /// @param[in] position The global position of this track parameterisation /// @param[in] momentum The global momentum of this track parameterisation - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> - SingleCurvilinearTrackParameters(CovPtr_t cov, const ActsVectorD<3>& position, - const ActsVectorD<3>& momentum, double dTime) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> + SingleCurvilinearTrackParameters( + CovPtr_t cov, + const ActsVectorD<3>& position, + const ActsVectorD<3>& momentum, + double dTime) : SingleTrackParameters<ChargePolicy>( std::move(cov), detail::coordinate_transformation::global2curvilinear( - position, momentum, 0, dTime), - position, momentum), + position, + momentum, + 0, + dTime), + position, + momentum), m_upSurface(Surface::makeShared<PlaneSurface>(position, momentum)) {} /// @brief copy constructor - charged/neutral @@ -87,8 +103,8 @@ class SingleCurvilinearTrackParameters /// @brief copy assignment operator - charged/netural /// virtual constructor for type creation without casting - SingleCurvilinearTrackParameters<ChargePolicy>& operator=( - const SingleCurvilinearTrackParameters<ChargePolicy>& rhs) { + SingleCurvilinearTrackParameters<ChargePolicy>& + operator=(const SingleCurvilinearTrackParameters<ChargePolicy>& rhs) { // check for self-assignment if (this != &rhs) { SingleTrackParameters<ChargePolicy>::operator=(rhs); @@ -100,8 +116,8 @@ class SingleCurvilinearTrackParameters /// @brief move assignment operator - charged/netural /// virtual constructor for type creation without casting - SingleCurvilinearTrackParameters<ChargePolicy>& operator=( - SingleCurvilinearTrackParameters<ChargePolicy>&& rhs) { + SingleCurvilinearTrackParameters<ChargePolicy>& + operator=(SingleCurvilinearTrackParameters<ChargePolicy>&& rhs) { // check for self-assignment if (this != &rhs) { SingleTrackParameters<ChargePolicy>::operator=(std::move(rhs)); @@ -112,7 +128,8 @@ class SingleCurvilinearTrackParameters /// @brief clone - charged/netural /// virtual constructor for type creation without casting - SingleTrackParameters<ChargePolicy>* clone() const override { + SingleTrackParameters<ChargePolicy>* + clone() const override { return new SingleCurvilinearTrackParameters<ChargePolicy>(*this); } @@ -126,11 +143,13 @@ class SingleCurvilinearTrackParameters /// /// For curvilinear parameters the local parameters are forced to be /// (0,0), hence an update is an effective shift of the reference - template <ParID_t par, - std::enable_if_t<std::is_same<typename par_type<par>::type, - local_parameter>::value, - int> = 0> - void set(const GeometryContext& gctx, ParValue_t newValue) { + template < + ParID_t par, + std::enable_if_t< + std::is_same<typename par_type<par>::type, local_parameter>::value, + int> = 0> + void + set(const GeometryContext& gctx, ParValue_t newValue) { // set the parameter & update the new global position this->getParameterSet().template setParameter<par>(newValue); this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); @@ -151,11 +170,14 @@ class SingleCurvilinearTrackParameters /// /// For curvilinear parameters the directional change of parameters /// causes a recalculation of the surface - template <ParID_t par, - std::enable_if_t<not std::is_same<typename par_type<par>::type, - local_parameter>::value, - int> = 0> - void set(const GeometryContext& gctx, ParValue_t newValue) { + template < + ParID_t par, + std::enable_if_t< + not std::is_same<typename par_type<par>::type, local_parameter>:: + value, + int> = 0> + void + set(const GeometryContext& gctx, ParValue_t newValue) { this->getParameterSet().template setParameter<par>(newValue); this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); // recreate the surface @@ -164,7 +186,10 @@ class SingleCurvilinearTrackParameters } /// @brief access to the reference surface - const Surface& referenceSurface() const final { return *m_upSurface; } + const Surface& + referenceSurface() const final { + return *m_upSurface; + } /// @brief access to the measurement frame, i.e. the rotation matrix with /// respect to the global coordinate system, in which the local error @@ -175,7 +200,8 @@ class SingleCurvilinearTrackParameters /// /// @note For a curvilinear track parameterisation this is identical to /// the rotation matrix of the intrinsic planar surface. - RotationMatrix3D referenceFrame(const GeometryContext& gctx) const final { + RotationMatrix3D + referenceFrame(const GeometryContext& gctx) const final { return m_upSurface->transform(gctx).linear(); } diff --git a/Core/include/Acts/EventData/SingleTrackParameters.hpp b/Core/include/Acts/EventData/SingleTrackParameters.hpp index 00d3c6a4d..c1777ac45 100644 --- a/Core/include/Acts/EventData/SingleTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleTrackParameters.hpp @@ -32,10 +32,11 @@ namespace Acts { /// (must be either ChargedPolicy or NeutralPolicy) template <class ChargePolicy> class SingleTrackParameters : public TrackParametersBase { - static_assert(std::is_same<ChargePolicy, ChargedPolicy>::value or - std::is_same<ChargePolicy, NeutralPolicy>::value, - "ChargePolicy must either be 'Acts::ChargedPolicy' or " - "'Acts::NeutralPolicy"); + static_assert( + std::is_same<ChargePolicy, ChargedPolicy>::value or + std::is_same<ChargePolicy, NeutralPolicy>::value, + "ChargePolicy must either be 'Acts::ChargedPolicy' or " + "'Acts::NeutralPolicy"); public: // public typedef's @@ -56,36 +57,50 @@ class SingleTrackParameters : public TrackParametersBase { SingleTrackParameters<ChargePolicy>* clone() const override = 0; /// @copydoc TrackParametersBase::position - ActsVectorD<3> position() const final { return m_vPosition; } + ActsVectorD<3> + position() const final { + return m_vPosition; + } /// @copydoc TrackParametersBase::momentum - ActsVectorD<3> momentum() const final { return m_vMomentum; } + ActsVectorD<3> + momentum() const final { + return m_vMomentum; + } /// @brief equality operator /// /// @return @c true of both objects have the same charge policy, parameter /// values, position and momentum, otherwise @c false - bool operator==(const TrackParametersBase& rhs) const override { + bool + operator==(const TrackParametersBase& rhs) const override { auto casted = dynamic_cast<decltype(this)>(&rhs); if (!casted) { return false; } - return (m_oChargePolicy == casted->m_oChargePolicy && - m_oTime == casted->m_oTime && - m_oParameters == casted->m_oParameters && - m_vPosition == casted->m_vPosition && - m_vMomentum == casted->m_vMomentum); + return ( + m_oChargePolicy == casted->m_oChargePolicy && + m_oTime == casted->m_oTime && m_oParameters == casted->m_oParameters && + m_vPosition == casted->m_vPosition && + m_vMomentum == casted->m_vMomentum); } /// @copydoc TrackParametersBase::charge - double charge() const final { return m_oChargePolicy.getCharge(); } + double + charge() const final { + return m_oChargePolicy.getCharge(); + } /// @copydoc TrackParametersBase::time - double time() const final { return m_oTime; } + double + time() const final { + return m_oTime; + } /// @copydoc TrackParametersBase::getParameterSet - const FullParameterSet& getParameterSet() const final { + const FullParameterSet& + getParameterSet() const final { return m_oParameters; } @@ -96,11 +111,14 @@ class SingleTrackParameters : public TrackParametersBase { /// @param parValues vector with parameter values /// @param position 3D vector with global position /// @param momentum 3D vector with global momentum - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> - SingleTrackParameters(CovPtr_t cov, const ParVector_t& parValues, - const ActsVectorD<3>& position, - const ActsVectorD<3>& momentum) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> + SingleTrackParameters( + CovPtr_t cov, + const ParVector_t& parValues, + const ActsVectorD<3>& position, + const ActsVectorD<3>& momentum) : TrackParametersBase(), m_oChargePolicy( detail::coordinate_transformation::parameters2charge(parValues)), @@ -115,11 +133,14 @@ class SingleTrackParameters : public TrackParametersBase { /// @param parValues vector with parameter values /// @param position 3D vector with global position /// @param momentum 3D vector with global momentum - template <typename T = ChargePolicy, - std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> - SingleTrackParameters(CovPtr_t cov, const ParVector_t& parValues, - const ActsVectorD<3>& position, - const ActsVectorD<3>& momentum) + template < + typename T = ChargePolicy, + std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> + SingleTrackParameters( + CovPtr_t cov, + const ParVector_t& parValues, + const ActsVectorD<3>& position, + const ActsVectorD<3>& momentum) : TrackParametersBase(), m_oChargePolicy(), m_oTime(detail::coordinate_transformation::parameters2time(parValues)), @@ -137,8 +158,8 @@ class SingleTrackParameters : public TrackParametersBase { /// @brief copy assignment operator /// /// @param rhs object to be copied - SingleTrackParameters<ChargePolicy>& operator=( - const SingleTrackParameters<ChargePolicy>& rhs) { + SingleTrackParameters<ChargePolicy>& + operator=(const SingleTrackParameters<ChargePolicy>& rhs) { // check for self-assignment if (this != &rhs) { m_oChargePolicy = rhs.m_oChargePolicy; @@ -154,8 +175,8 @@ class SingleTrackParameters : public TrackParametersBase { /// @brief move assignment operator /// /// @param rhs object to be movied into `*this` - SingleTrackParameters<ChargePolicy>& operator=( - SingleTrackParameters<ChargePolicy>&& rhs) { + SingleTrackParameters<ChargePolicy>& + operator=(SingleTrackParameters<ChargePolicy>&& rhs) { // check for self-assignment if (this != &rhs) { m_oChargePolicy = std::move(rhs.m_oChargePolicy); @@ -169,7 +190,10 @@ class SingleTrackParameters : public TrackParametersBase { } /// @copydoc TrackParametersBase::getParameterSet - virtual FullParameterSet& getParameterSet() final { return m_oParameters; } + virtual FullParameterSet& + getParameterSet() final { + return m_oParameters; + } /// @brief update global momentum from current parameter values /// @@ -180,8 +204,10 @@ class SingleTrackParameters : public TrackParametersBase { /// @note This function is triggered when called with an argument of a type /// different from Acts::local_parameter template <typename T> - void updateGlobalCoordinates(const GeometryContext& /*gctx*/, - const T& /*unused*/) { + void + updateGlobalCoordinates( + const GeometryContext& /*gctx*/, + const T& /*unused*/) { m_vMomentum = detail::coordinate_transformation::parameters2globalMomentum( getParameterSet().getParameters()); m_oTime = detail::coordinate_transformation::parameters2time( @@ -192,8 +218,10 @@ class SingleTrackParameters : public TrackParametersBase { /// /// @note This function is triggered when called with an argument of a type /// Acts::local_parameter - void updateGlobalCoordinates(const GeometryContext& gctx, - const local_parameter& /*unused*/) { + void + updateGlobalCoordinates( + const GeometryContext& gctx, + const local_parameter& /*unused*/) { m_vPosition = detail::coordinate_transformation::parameters2globalPosition( gctx, getParameterSet().getParameters(), this->referenceSurface()); } diff --git a/Core/include/Acts/EventData/SourceLinkConcept.hpp b/Core/include/Acts/EventData/SourceLinkConcept.hpp index 4400478d3..aaed004bf 100644 --- a/Core/include/Acts/EventData/SourceLinkConcept.hpp +++ b/Core/include/Acts/EventData/SourceLinkConcept.hpp @@ -31,8 +31,9 @@ namespace concept { struct SourceLinkConcept { constexpr static bool comparison_works = identical_to<bool, comparable_t, T>; - static_assert(comparison_works, - "Source link does not implement equality operator"); + static_assert( + comparison_works, + "Source link does not implement equality operator"); constexpr static bool surface_method_exists = converts_to<const Surface&, surface_method_t, T>; diff --git a/Core/include/Acts/EventData/TrackParametersBase.hpp b/Core/include/Acts/EventData/TrackParametersBase.hpp index 4624245e3..2d0e8833b 100644 --- a/Core/include/Acts/EventData/TrackParametersBase.hpp +++ b/Core/include/Acts/EventData/TrackParametersBase.hpp @@ -53,7 +53,8 @@ class TrackParametersBase { /// @brief inequality operator /// /// @return `not (*this == rhs)` - bool operator!=(const TrackParametersBase& rhs) const { + bool + operator!=(const TrackParametersBase& rhs) const { return !(*this == rhs); } @@ -72,7 +73,10 @@ class TrackParametersBase { /// @return Eigen vector of dimension Acts::BoundParsDim with values of the /// track parameters /// (in the order as defined by the ParID_t enumeration) - ParVector_t parameters() const { return getParameterSet().getParameters(); } + ParVector_t + parameters() const { + return getParameterSet().getParameters(); + } /// @brief access track parameter /// @@ -82,7 +86,8 @@ class TrackParametersBase { /// /// @sa ParameterSet::get template <ParID_t par> - ParValue_t get() const { + ParValue_t + get() const { return getParameterSet().template getParameter<par>(); } @@ -92,7 +97,8 @@ class TrackParametersBase { /// /// @return value of the requested track parameter uncertainty template <ParID_t par> - ParValue_t uncertainty() const { + ParValue_t + uncertainty() const { return getParameterSet().template getUncertainty<par>(); } @@ -104,15 +110,22 @@ class TrackParametersBase { /// @return raw pointer to covariance matrix (can be a nullptr) /// /// @sa ParameterSet::getCovariance - const CovMatrix_t* covariance() const { + const CovMatrix_t* + covariance() const { return getParameterSet().getCovariance(); } /// @brief convenience method to retrieve transverse momentum - double pT() const { return VectorHelpers::perp(momentum()); } + double + pT() const { + return VectorHelpers::perp(momentum()); + } /// @brief convenience method to retrieve pseudorapidity - double eta() const { return VectorHelpers::eta(momentum()); } + double + eta() const { + return VectorHelpers::eta(momentum()); + } /// @brief retrieve electric charge /// @@ -152,8 +165,8 @@ class TrackParametersBase { /// TrackParameters::print method. /// /// @return modified output stream object - friend std::ostream& operator<<(std::ostream& out, - const TrackParametersBase& tp) { + friend std::ostream& + operator<<(std::ostream& out, const TrackParametersBase& tp) { tp.print(out); return out; } diff --git a/Core/include/Acts/EventData/TrackState.hpp b/Core/include/Acts/EventData/TrackState.hpp index 3df709795..6dd01c43b 100644 --- a/Core/include/Acts/EventData/TrackState.hpp +++ b/Core/include/Acts/EventData/TrackState.hpp @@ -31,8 +31,9 @@ class Surface; /// assumed the surface lives longer than the TrackState template <typename source_link_t, typename parameters_t> class TrackState { - static_assert(SourceLinkConcept<source_link_t>, - "Source link does not fulfill SourceLinkConcept"); + static_assert( + SourceLinkConcept<source_link_t>, + "Source link does not fulfill SourceLinkConcept"); public: using SourceLink = source_link_t; @@ -77,7 +78,8 @@ class TrackState { /// Assignment operator /// /// @param rhs is the source TrackState - TrackState& operator=(const TrackState& rhs) { + TrackState& + operator=(const TrackState& rhs) { parameter = rhs.parameter; measurement = rhs.measurement; m_surface = rhs.m_surface; @@ -87,7 +89,8 @@ class TrackState { /// Assignment move operator /// /// @param rhs is the source TrackState - TrackState& operator=(TrackState&& rhs) { + TrackState& + operator=(TrackState&& rhs) { parameter = std::move(rhs.parameter); measurement = std::move(rhs.measurement); m_surface = std::move(rhs.m_surface); @@ -95,14 +98,18 @@ class TrackState { } /// @brief return method for the surface - const Surface& referenceSurface() const { return (*m_surface); } + const Surface& + referenceSurface() const { + return (*m_surface); + } /// @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 /// /// @return number of measured parameters, or boost::none - boost::optional<size_t> size() { + boost::optional<size_t> + size() { if (this->measurement.calibrated) { return MeasurementHelpers::getSize(*this->measurement.calibrated); } diff --git a/Core/include/Acts/EventData/TrackStateSorters.hpp b/Core/include/Acts/EventData/TrackStateSorters.hpp index db3956b40..4adf6b708 100644 --- a/Core/include/Acts/EventData/TrackStateSorters.hpp +++ b/Core/include/Acts/EventData/TrackStateSorters.hpp @@ -24,8 +24,10 @@ struct TrackStatePathLengthSorter { * @return bool */ template <typename identifier_t, typename parameters_t> - bool operator()(const TrackState<identifier_t, parameters_t>& lhs, - const TrackState<identifier_t, parameters_t>& rhs) { + bool + operator()( + const TrackState<identifier_t, parameters_t>& lhs, + const TrackState<identifier_t, parameters_t>& rhs) { return lhs.parameter.pathLength < rhs.parameter.pathLength; } }; diff --git a/Core/include/Acts/EventData/detail/coordinate_transformations.hpp b/Core/include/Acts/EventData/detail/coordinate_transformations.hpp index 9f8b68890..2ce5d8958 100644 --- a/Core/include/Acts/EventData/detail/coordinate_transformations.hpp +++ b/Core/include/Acts/EventData/detail/coordinate_transformations.hpp @@ -40,13 +40,17 @@ struct coordinate_transformation { /// @param s the surface for the local to global transform /// /// @return position in the global frame - static ActsVectorD<3> parameters2globalPosition(const GeometryContext& gctx, - const ParVector_t& pars, - const Surface& s) { + static ActsVectorD<3> + parameters2globalPosition( + const GeometryContext& gctx, + const ParVector_t& pars, + const Surface& s) { ActsVectorD<3> globalPosition; - s.localToGlobal(gctx, - ActsVectorD<2>(pars(Acts::eLOC_0), pars(Acts::eLOC_1)), - parameters2globalMomentum(pars), globalPosition); + s.localToGlobal( + gctx, + ActsVectorD<2>(pars(Acts::eLOC_0), pars(Acts::eLOC_1)), + parameters2globalMomentum(pars), + globalPosition); return globalPosition; } @@ -59,7 +63,8 @@ struct coordinate_transformation { /// @param pars the parameter vector /// /// @return momentum in the global frame - static ActsVectorD<3> parameters2globalMomentum(const ParVector_t& pars) { + static ActsVectorD<3> + parameters2globalMomentum(const ParVector_t& pars) { ActsVectorD<3> momentum; double p = std::abs(1. / pars(Acts::eQOP)); double phi = pars(Acts::ePHI); @@ -81,9 +86,12 @@ struct coordinate_transformation { /// @param charge of the particle/track /// /// @return curvilinear parameter representation - static ParVector_t global2curvilinear(const ActsVectorD<3>& /*pos*/, - const ActsVectorD<3>& mom, - double charge, double time) { + static ParVector_t + global2curvilinear( + const ActsVectorD<3>& /*pos*/, + const ActsVectorD<3>& mom, + double charge, + double time) { using VectorHelpers::phi; using VectorHelpers::theta; ParVector_t parameters; @@ -107,10 +115,14 @@ struct coordinate_transformation { /// @param s the surface for the global to local transform /// /// @return the track parameterisation - static ParVector_t global2parameters(const GeometryContext& gctx, - const ActsVectorD<3>& pos, - const ActsVectorD<3>& mom, double charge, - double time, const Surface& s) { + static ParVector_t + global2parameters( + const GeometryContext& gctx, + const ActsVectorD<3>& pos, + const ActsVectorD<3>& mom, + double charge, + double time, + const Surface& s) { using VectorHelpers::phi; using VectorHelpers::theta; ActsVectorD<2> localPosition; @@ -124,14 +136,16 @@ struct coordinate_transformation { /// @brief static calculate the charge from the track parameterisation /// /// @return the charge as a double - static double parameters2charge(const ParVector_t& pars) { + static double + parameters2charge(const ParVector_t& pars) { return (pars(Acts::eQOP) > 0) ? 1. : -1.; } /// @brief static calculate the time from the track parametrisation /// /// @return the time as a double - static double parameters2time(const ParVector_t& pars) { + static double + parameters2time(const ParVector_t& pars) { return pars(Acts::eT); } }; diff --git a/Core/include/Acts/EventData/detail/fittable_type_generator.hpp b/Core/include/Acts/EventData/detail/fittable_type_generator.hpp index 024420e6b..af002a456 100644 --- a/Core/include/Acts/EventData/detail/fittable_type_generator.hpp +++ b/Core/include/Acts/EventData/detail/fittable_type_generator.hpp @@ -62,7 +62,8 @@ namespace hana = boost::hana; * @tparam W End of the range (exclusive) */ template <size_t W> -constexpr auto unique_ordered_sublists() { +constexpr auto +unique_ordered_sublists() { using namespace hana::literals; // generate an empty tuple to start off constexpr auto combinations = hana::make_tuple(hana::make_tuple()); @@ -89,7 +90,8 @@ constexpr auto unique_ordered_sublists() { * @tparam W The size of the parameter pack to generate the sublists over. */ template <template <ParID_t...> class meas_meta, size_t W> -constexpr auto type_generator() { +constexpr auto +type_generator() { // generate sublists constexpr auto sublists = unique_ordered_sublists<W>(); // map each sublist (tuple of paramater indices) into a measurement using @@ -112,7 +114,8 @@ constexpr auto type_generator() { */ template <template <ParID_t...> class meas_meta, size_t W> using type_generator_t = typename decltype(hana::unpack( - type_generator<meas_meta, W>(), hana::template_<std::variant>))::type; + type_generator<meas_meta, W>(), + hana::template_<std::variant>))::type; /// @endcond } // namespace detail diff --git a/Core/include/Acts/EventData/detail/full_parameter_set.hpp b/Core/include/Acts/EventData/detail/full_parameter_set.hpp index 5e6574f4f..499db4d40 100644 --- a/Core/include/Acts/EventData/detail/full_parameter_set.hpp +++ b/Core/include/Acts/EventData/detail/full_parameter_set.hpp @@ -40,7 +40,8 @@ struct full_parset { template <typename T, unsigned int N> struct tparam_generator { using type = typename add_to_value_container< - static_cast<T>(N), typename tparam_generator<T, N - 1>::type>::type; + static_cast<T>(N), + typename tparam_generator<T, N - 1>::type>::type; }; template <typename T> diff --git a/Core/include/Acts/EventData/detail/initialize_parameter_set.hpp b/Core/include/Acts/EventData/detail/initialize_parameter_set.hpp index c4d3413df..def7bf926 100644 --- a/Core/include/Acts/EventData/detail/initialize_parameter_set.hpp +++ b/Core/include/Acts/EventData/detail/initialize_parameter_set.hpp @@ -32,18 +32,25 @@ struct initialize_parset; /// @cond template <typename T, T first, T... others> struct initialize_parset<T, first, others...> { - template <typename ParSetType, typename first_value_type, - typename... other_value_types> - static void init(ParSetType& parSet, const first_value_type& v1, - const other_value_types&... values) { + template < + typename ParSetType, + typename first_value_type, + typename... other_value_types> + static void + init( + ParSetType& parSet, + const first_value_type& v1, + const other_value_types&... values) { parSet.template setParameter<first>(v1); initialize_parset<T, others...>::init(parSet, values...); } template <typename ParSetType> - static void init(ParSetType& parSet, - const typename ParSetType::ParVector_t& values, - const unsigned int& pos = 0) { + static void + init( + ParSetType& parSet, + const typename ParSetType::ParVector_t& values, + const unsigned int& pos = 0) { parSet.template setParameter<first>(values(pos)); initialize_parset<T, others...>::init(parSet, values, pos + 1); } @@ -52,14 +59,17 @@ struct initialize_parset<T, first, others...> { template <typename T, T last> struct initialize_parset<T, last> { template <typename ParSet_tType, typename last_value_type> - static void init(ParSet_tType& ParSet_t, const last_value_type& v1) { + static void + init(ParSet_tType& ParSet_t, const last_value_type& v1) { ParSet_t.template setParameter<last>(v1); } template <typename ParSetType> - static void init(ParSetType& parSet, - const typename ParSetType::ParVector_t& values, - const unsigned int& pos = 0) { + static void + init( + ParSetType& parSet, + const typename ParSetType::ParVector_t& values, + const unsigned int& pos = 0) { parSet.template setParameter<last>(values(pos)); } }; diff --git a/Core/include/Acts/EventData/detail/make_projection_matrix.hpp b/Core/include/Acts/EventData/detail/make_projection_matrix.hpp index 368b17992..e2cfd2836 100644 --- a/Core/include/Acts/EventData/detail/make_projection_matrix.hpp +++ b/Core/include/Acts/EventData/detail/make_projection_matrix.hpp @@ -33,7 +33,8 @@ struct make_projection_matrix; // build projection matrix by iteratively stacking row vectors template <unsigned int columns, unsigned int i, unsigned int... N> struct make_projection_matrix<columns, i, N...> { - static ActsMatrixD<sizeof...(N) + 1, columns> init() { + static ActsMatrixD<sizeof...(N) + 1, columns> + init() { ActsRowVectorD<columns> v; v.setZero(); v(i) = 1; @@ -50,7 +51,8 @@ struct make_projection_matrix<columns, i, N...> { // projection matrix for a single local parameter is a simple row vector template <unsigned int columns, unsigned int i> struct make_projection_matrix<columns, i> { - static ActsRowVectorD<columns> init() { + static ActsRowVectorD<columns> + init() { ActsRowVectorD<columns> v; v.setZero(); v(i) = 1; diff --git a/Core/include/Acts/EventData/detail/residual_calculator.hpp b/Core/include/Acts/EventData/detail/residual_calculator.hpp index 3cdd686b2..a1fc5b01c 100644 --- a/Core/include/Acts/EventData/detail/residual_calculator.hpp +++ b/Core/include/Acts/EventData/detail/residual_calculator.hpp @@ -35,29 +35,30 @@ template <ParID_t... params> struct residual_calculator { using ParVector_t = ActsVector<ParValue_t, sizeof...(params)>; - static ParVector_t result(const ParVector_t& test, const ParVector_t& ref) { + static ParVector_t + result(const ParVector_t& test, const ParVector_t& ref) { ParVector_t result; - residual_calculator_impl<ParVector_t, params...>::calculate(result, test, - ref, 0); + residual_calculator_impl<ParVector_t, params...>::calculate( + result, test, ref, 0); return result; } }; template <typename R, ParID_t first, ParID_t... others> struct residual_calculator_impl<R, first, others...> { - static void calculate(R& result, const R& test, const R& ref, - unsigned int pos) { + static void + calculate(R& result, const R& test, const R& ref, unsigned int pos) { using parameter_type = typename par_type<first>::type; result(pos) = parameter_type::getDifference(test(pos), ref(pos)); - residual_calculator_impl<R, others...>::calculate(result, test, ref, - pos + 1); + residual_calculator_impl<R, others...>::calculate( + result, test, ref, pos + 1); } }; template <typename R, ParID_t last> struct residual_calculator_impl<R, last> { - static void calculate(R& result, const R& test, const R& ref, - unsigned int pos) { + static void + calculate(R& result, const R& test, const R& ref, unsigned int pos) { using parameter_type = typename par_type<last>::type; result(pos) = parameter_type::getDifference(test(pos), ref(pos)); } diff --git a/Core/include/Acts/EventData/detail/value_corrector.hpp b/Core/include/Acts/EventData/detail/value_corrector.hpp index ddd50d7d8..ba54dc99a 100644 --- a/Core/include/Acts/EventData/detail/value_corrector.hpp +++ b/Core/include/Acts/EventData/detail/value_corrector.hpp @@ -40,14 +40,16 @@ template <ParID_t... params> struct value_corrector { using ParVector_t = ActsVector<ParValue_t, sizeof...(params)>; - static void result(ParVector_t& values) { + static void + result(ParVector_t& values) { value_corrector_impl<ParVector_t, params...>::calculate(values, 0); } }; template <typename R, ParID_t first, ParID_t... others> struct value_corrector_impl<R, first, others...> { - static void calculate(R& values, unsigned int pos) { + static void + calculate(R& values, unsigned int pos) { using parameter_type = typename par_type<first>::type; if (parameter_type::may_modify_value) { values(pos) = parameter_type::getValue(values(pos)); @@ -58,7 +60,8 @@ struct value_corrector_impl<R, first, others...> { template <typename R, ParID_t last> struct value_corrector_impl<R, last> { - static void calculate(R& values, unsigned int pos) { + static void + calculate(R& values, unsigned int pos) { using parameter_type = typename par_type<last>::type; if (parameter_type::may_modify_value) { values(pos) = parameter_type::getValue(values(pos)); diff --git a/Core/include/Acts/Fitter/GainMatrixSmoother.hpp b/Core/include/Acts/Fitter/GainMatrixSmoother.hpp index e3205500a..0626a1a48 100644 --- a/Core/include/Acts/Fitter/GainMatrixSmoother.hpp +++ b/Core/include/Acts/Fitter/GainMatrixSmoother.hpp @@ -27,8 +27,9 @@ class GainMatrixSmoother { /// template <typename track_states_t> - boost::optional<parameters_t> operator()( - const GeometryContext& gctx, track_states_t& filteredStates) const { + boost::optional<parameters_t> + operator()(const GeometryContext& gctx, track_states_t& filteredStates) + const { using namespace boost::adaptors; using track_state_t = typename track_states_t::value_type; @@ -82,8 +83,10 @@ class GainMatrixSmoother { // Create smoothed track parameters ts.parameter.smoothed = parameters_t( - gctx, std::make_unique<CovMatrix_t>(std::move(smoothedCov)), - smoothedPars, ts.referenceSurface().getSharedPtr()); + gctx, + std::make_unique<CovMatrix_t>(std::move(smoothedCov)), + smoothedPars, + ts.referenceSurface().getSharedPtr()); // Point prev state to current state prev_ts = &ts; diff --git a/Core/include/Acts/Fitter/GainMatrixUpdator.hpp b/Core/include/Acts/Fitter/GainMatrixUpdator.hpp index be52714a3..4aa815c00 100644 --- a/Core/include/Acts/Fitter/GainMatrixUpdator.hpp +++ b/Core/include/Acts/Fitter/GainMatrixUpdator.hpp @@ -25,8 +25,9 @@ namespace Acts { /// /// This is implemented as a boost vistor pattern for use of the /// boost variant container -template <typename parameters_t, - typename calibrator_t = VoidMeasurementCalibrator> +template < + typename parameters_t, + typename calibrator_t = VoidMeasurementCalibrator> class GainMatrixUpdator { using jacobian_t = typename parameters_t::CovMatrix_t; @@ -49,8 +50,8 @@ class GainMatrixUpdator { /// @note Non-'successful' updates could be holes or outliers, /// which need to be treated differently in calling code. template <typename track_state_t> - bool operator()(const GeometryContext& gctx, - track_state_t& trackState) const { + bool + operator()(const GeometryContext& gctx, track_state_t& trackState) const { using CovMatrix_t = typename parameters_t::CovMatrix_t; using ParVector_t = typename parameters_t::ParVector_t; @@ -90,8 +91,9 @@ class GainMatrixUpdator { // type of projection using projection_t = typename meas_t::Projection_t; // type of gain matrix (transposed projection) - using gain_matrix_t = ActsMatrixD<projection_t::ColsAtCompileTime, - projection_t::RowsAtCompileTime>; + using gain_matrix_t = ActsMatrixD< + projection_t::ColsAtCompileTime, + projection_t::RowsAtCompileTime>; // Take the projector (measurement mapping function) const projection_t& H = calibrated.projector(); @@ -111,11 +113,12 @@ class GainMatrixUpdator { (CovMatrix_t::Identity() - K * H) * predicted_covariance; // Create new filtered parameters and covariance - parameters_t filtered(gctx, - std::make_unique<const CovMatrix_t>( - std::move(filtered_covariance)), - filtered_parameters, - predicted.referenceSurface().getSharedPtr()); + parameters_t filtered( + gctx, + std::make_unique<const CovMatrix_t>( + std::move(filtered_covariance)), + filtered_parameters, + predicted.referenceSurface().getSharedPtr()); // calculate the chi2 // chi2 = r^T * R^-1 * r diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index c5d24bcd7..850aced13 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -45,10 +45,11 @@ struct KalmanFitterOptions { /// @param mctx The magnetic context for this fit /// @param cctx The calibration context for this fit /// @param rSurface The reference surface for the fit to be expressed at - KalmanFitterOptions(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx, - std::reference_wrapper<const CalibrationContext> cctx, - const Surface* rSurface = nullptr) + KalmanFitterOptions( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx, + std::reference_wrapper<const CalibrationContext> cctx, + const Surface* rSurface = nullptr) : geoContext(gctx), magFieldContext(mctx), calibrationContext(cctx), @@ -100,11 +101,13 @@ struct KalmanFitterOptions { /// set of track states into a given track/track particle class /// /// The void components are provided mainly for unit testing. -template <typename propagator_t, typename updator_t = VoidKalmanUpdator, - typename smoother_t = VoidKalmanSmoother, - typename calibrator_t = VoidMeasurementCalibrator, - typename input_converter_t = VoidKalmanComponents, - typename output_converter_t = VoidKalmanComponents> +template < + typename propagator_t, + typename updator_t = VoidKalmanUpdator, + typename smoother_t = VoidKalmanSmoother, + typename calibrator_t = VoidMeasurementCalibrator, + typename input_converter_t = VoidKalmanComponents, + typename output_converter_t = VoidKalmanComponents> class KalmanFitter { public: /// Shorthand definition @@ -114,11 +117,12 @@ class KalmanFitter { KalmanFitter() = delete; /// Constructor from arguments - KalmanFitter(propagator_t pPropagator, - std::unique_ptr<const Logger> logger = - getDefaultLogger("KalmanFilter", Logging::INFO), - input_converter_t pInputCnv = input_converter_t(), - output_converter_t pOutputCnv = output_converter_t()) + KalmanFitter( + propagator_t pPropagator, + std::unique_ptr<const Logger> logger = + getDefaultLogger("KalmanFilter", Logging::INFO), + input_converter_t pInputCnv = input_converter_t(), + output_converter_t pOutputCnv = output_converter_t()) : m_propagator(std::move(pPropagator)), m_inputConverter(std::move(pInputCnv)), m_outputConverter(std::move(pOutputCnv)), @@ -140,13 +144,17 @@ class KalmanFitter { /// the fit. /// /// @return the output as an output track - template <typename source_link_t, typename start_parameters_t, - typename parameters_t = BoundParameters> - auto fit(const std::vector<source_link_t>& sourcelinks, - const start_parameters_t& sParameters, - const KalmanFitterOptions& kfOptions) const { - static_assert(SourceLinkConcept<source_link_t>, - "Source link does not fulfill SourceLinkConcept"); + template < + typename source_link_t, + typename start_parameters_t, + typename parameters_t = BoundParameters> + auto + fit(const std::vector<source_link_t>& sourcelinks, + const start_parameters_t& sParameters, + const KalmanFitterOptions& kfOptions) const { + static_assert( + SourceLinkConcept<source_link_t>, + "Source link does not fulfill SourceLinkConcept"); // To be able to find measurements later, we put them into a map // We need to copy input SourceLinks anyways, so the map can own them. @@ -195,7 +203,10 @@ class KalmanFitter { output_converter_t m_outputConverter; /// Logger getter to support macros - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// Owned logging instance std::unique_ptr<const Logger> m_logger; @@ -213,8 +224,10 @@ class KalmanFitter { using TrackStateType = TrackState<source_link_t, parameters_t>; /// Explicit constructor with updator and calibrator - Actor(updator_t pUpdator = updator_t(), smoother_t pSmoother = smoother_t(), - calibrator_t pCalibrator = calibrator_t()) + Actor( + updator_t pUpdator = updator_t(), + smoother_t pSmoother = smoother_t(), + calibrator_t pCalibrator = calibrator_t()) : m_updator(std::move(pUpdator)), m_smoother(std::move(pSmoother)), m_calibrator(std::move(pCalibrator)) {} @@ -260,8 +273,11 @@ class KalmanFitter { /// @param stepper The stepper in use /// @param result is the mutable result state object template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // Initialization: // - Only when track states are not set if (!result.initialized) { @@ -316,8 +332,11 @@ class KalmanFitter { /// @param stepper The stepper in use /// @param result is the mutable result state object template <typename propagator_state_t, typename stepper_t> - void initialize(propagator_state_t& /*state*/, const stepper_t& /*stepper*/, - result_type& /*result*/) const {} + void + initialize( + propagator_state_t& /*state*/, + const stepper_t& /*stepper*/, + result_type& /*result*/) const {} /// @brief Kalman actor operation : update /// @@ -329,22 +348,29 @@ class KalmanFitter { /// @param stepper The stepper in use /// @param result The mutable result state object template <typename propagator_state_t, typename stepper_t> - void filter(const Surface* surface, propagator_state_t& state, - const stepper_t& stepper, result_type& result) const { + void + filter( + const Surface* surface, + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // Try to find the surface in the measurement surfaces auto sourcelink_it = inputMeasurements.find(surface); if (sourcelink_it != inputMeasurements.end()) { // Screen output message - ACTS_VERBOSE("Measurement surface " << surface->geoID().toString() - << " detected."); + ACTS_VERBOSE( + "Measurement surface " << surface->geoID().toString() + << " detected."); // create track state on the vector from sourcelink result.fittedStates.emplace_back(sourcelink_it->second); TrackStateType& trackState = result.fittedStates.back(); // Transport & bind the state to the current surface - std::tuple<BoundParameters, - typename TrackStateType::Parameters::CovMatrix_t, double> + std::tuple< + BoundParameters, + typename TrackStateType::Parameters::CovMatrix_t, + double> boundState = stepper.boundState(state.stepping, *surface, true); // Fill the track state trackState.parameter.predicted = std::get<0>(boundState); @@ -354,8 +380,9 @@ class KalmanFitter { // If the update is successful, set covariance and if (m_updator(state.geoContext, trackState)) { // Update the stepping state - ACTS_VERBOSE("Filtering step successful, updated parameters are : \n" - << *trackState.parameter.filtered); + ACTS_VERBOSE( + "Filtering step successful, updated parameters are : \n" + << *trackState.parameter.filtered); // update stepping state using filtered parameters // after kalman update stepper.update(state.stepping, *trackState.parameter.filtered); @@ -378,18 +405,22 @@ class KalmanFitter { /// @param stepper The stepper in use /// @param result is the mutable result state object template <typename propagator_state_t, typename stepper_t> - void finalize(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + finalize( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // Remember you smoothed the track states result.smoothed = true; // Sort the TrackStates according to the path length TrackStatePathLengthSorter plSorter; - std::sort(result.fittedStates.begin(), result.fittedStates.end(), - plSorter); + std::sort( + result.fittedStates.begin(), result.fittedStates.end(), plSorter); // Screen output for debugging - ACTS_VERBOSE("Apply smoothing on " << result.fittedStates.size() - << " filtered track states."); + ACTS_VERBOSE( + "Apply smoothing on " << result.fittedStates.size() + << " filtered track states."); // Smooth the track states and obtain the last smoothed track parameters const auto& smoothedPars = m_smoother(state.geoContext, result.fittedStates); @@ -411,7 +442,10 @@ class KalmanFitter { const Logger* m_logger; /// Getter for the logger, to support logging macros - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// The Kalman updator updator_t m_updator; diff --git a/Core/include/Acts/Fitter/detail/VoidKalmanComponents.hpp b/Core/include/Acts/Fitter/detail/VoidKalmanComponents.hpp index 31f3f3678..2ff7cf3c3 100644 --- a/Core/include/Acts/Fitter/detail/VoidKalmanComponents.hpp +++ b/Core/include/Acts/Fitter/detail/VoidKalmanComponents.hpp @@ -25,8 +25,8 @@ struct VoidKalmanComponents { /// /// @return void-calibrated measurement template <typename measurement_t, typename parameters_t> - measurement_t operator()(measurement_t m, - const parameters_t& /*pars*/) const { + measurement_t + operator()(measurement_t m, const parameters_t& /*pars*/) const { return m; } @@ -39,7 +39,8 @@ struct VoidKalmanComponents { /// /// @return moved measurements template <typename measurements_t> - measurements_t operator()(measurements_t ms) const { + measurements_t + operator()(measurements_t ms) const { return std::move(ms); } }; @@ -61,14 +62,16 @@ struct VoidMeasurementCalibrator { /// @note This will not make the "calibrated" measurement point to the /// uncalibrated measurement via sourcelink, it's just a copy. template <typename source_link_t, typename parameters_t> - FittableMeasurement<source_link_t> operator()( - const source_link_t& sl, const parameters_t& /*pars*/) const { - static_assert(SourceLinkConcept<source_link_t>, - "Source link does fulfill SourceLinkConcept."); + FittableMeasurement<source_link_t> + operator()(const source_link_t& sl, const parameters_t& /*pars*/) const { static_assert( - concept ::converts_to<FittableMeasurement<source_link_t>, - concept ::detail_slc::dereferenceable_t, - source_link_t>, + SourceLinkConcept<source_link_t>, + "Source link does fulfill SourceLinkConcept."); + static_assert( + concept ::converts_to< + FittableMeasurement<source_link_t>, + concept ::detail_slc::dereferenceable_t, + source_link_t>, "For DefaultMeasurementCalibrator, source link needs to implement " "dereference operator"); @@ -88,8 +91,8 @@ struct VoidKalmanUpdator { /// /// @return The copied predicted parameters template <typename track_state_t, typename predicted_state_t> - auto operator()(track_state_t& /*m*/, - const predicted_state_t& predicted) const { + auto + operator()(track_state_t& /*m*/, const predicted_state_t& predicted) const { return &(predicted.parameters); } }; @@ -104,7 +107,8 @@ struct VoidKalmanSmoother { /// /// @return The resulting template <typename parameters_t, typename track_states_t> - const parameters_t* operator()(track_states_t& /*states*/) const { + const parameters_t* + operator()(track_states_t& /*states*/) const { return nullptr; } }; diff --git a/Core/include/Acts/Geometry/AbstractVolume.hpp b/Core/include/Acts/Geometry/AbstractVolume.hpp index 980be5016..ae6a90621 100644 --- a/Core/include/Acts/Geometry/AbstractVolume.hpp +++ b/Core/include/Acts/Geometry/AbstractVolume.hpp @@ -55,8 +55,9 @@ class AbstractVolume : public Volume { /// /// @param htrans is the transform 3D the positions the volume in global frame /// @param volbounds is the boundary definition - AbstractVolume(std::shared_ptr<const Transform3D> htrans, - VolumeBoundsPtr volbounds); + AbstractVolume( + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volbounds); /// Copy constructor - deleted AbstractVolume(const AbstractVolume& vol) = delete; diff --git a/Core/include/Acts/Geometry/ApproachDescriptor.hpp b/Core/include/Acts/Geometry/ApproachDescriptor.hpp index 91d9a102a..edc687bbc 100644 --- a/Core/include/Acts/Geometry/ApproachDescriptor.hpp +++ b/Core/include/Acts/Geometry/ApproachDescriptor.hpp @@ -56,10 +56,13 @@ class ApproachDescriptor { /// @param parameters The actual parameters object /// @param options are the steering options for the search /// @param corrfnc The actual Corrector object - template <typename parameters_t, typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename parameters_t, + typename options_t, + typename corrector_t = VoidIntersectionCorrector> ObjectIntersection<Surface> approachSurface( - const GeometryContext& gctx, const parameters_t& parameters, + const GeometryContext& gctx, + const parameters_t& parameters, const options_t& options, const corrector_t& corrfnc = corrector_t()) const; @@ -73,8 +76,11 @@ class ApproachDescriptor { /// /// @return is a surface intersection virtual ObjectIntersection<Surface> approachSurface( - const GeometryContext& gctx, const Vector3D& pos, const Vector3D& gdir, - NavigationDirection navDir, const BoundaryCheck& bcheck, + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc correct = nullptr) const = 0; /// Tet to all the contained surfaces @@ -86,12 +92,20 @@ class ApproachDescriptor { }; template <typename parameters_t, typename options_t, typename corrector_t> -ObjectIntersection<Surface> ApproachDescriptor::approachSurface( - const GeometryContext& gctx, const parameters_t& parameters, - const options_t& options, const corrector_t& corrfnc) const { +ObjectIntersection<Surface> +ApproachDescriptor::approachSurface( + const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { // calculate the actual intersection - return approachSurface(gctx, parameters.position(), parameters.direction(), - options.navDir, options.boundaryCheck, corrfnc); + return approachSurface( + gctx, + parameters.position(), + parameters.direction(), + options.navDir, + options.boundaryCheck, + corrfnc); } } // namespace Acts diff --git a/Core/include/Acts/Geometry/BoundarySurfaceFace.hpp b/Core/include/Acts/Geometry/BoundarySurfaceFace.hpp index 087362441..2e44457a0 100644 --- a/Core/include/Acts/Geometry/BoundarySurfaceFace.hpp +++ b/Core/include/Acts/Geometry/BoundarySurfaceFace.hpp @@ -63,7 +63,8 @@ enum BoundarySurfaceFace { /// @brief specify the inside/outside with respect to the normal vector enum BoundaryOrientation { insideVolume = -1, outsideVolume = 1 }; -inline std::ostream& operator<<(std::ostream& os, BoundarySurfaceFace& face) { +inline std::ostream& +operator<<(std::ostream& os, BoundarySurfaceFace& face) { os << "BoundarySurfaceFace::"; switch (face) { diff --git a/Core/include/Acts/Geometry/BoundarySurfaceT.hpp b/Core/include/Acts/Geometry/BoundarySurfaceT.hpp index 6dd3dbe8b..535b632a3 100644 --- a/Core/include/Acts/Geometry/BoundarySurfaceT.hpp +++ b/Core/include/Acts/Geometry/BoundarySurfaceT.hpp @@ -59,8 +59,10 @@ class BoundarySurfaceT { /// @param surface The unqiue surface the boundary represents /// @param inside The inside volume the bounday surface points to /// @param outside The outside volume the boundary surface points to - BoundarySurfaceT(std::shared_ptr<const Surface> surface, const T* inside, - const T* outside) + BoundarySurfaceT( + std::shared_ptr<const Surface> surface, + const T* inside, + const T* outside) : m_surface(std::move(surface)), m_insideVolume(inside), m_outsideVolume(outside), @@ -73,8 +75,10 @@ class BoundarySurfaceT { /// @param surface The unqiue surface the boundary represents /// @param inside The inside volume the bounday surface points to /// @param outside The outside volume the boundary surface points to - BoundarySurfaceT(std::shared_ptr<const Surface> surface, VolumePtr inside, - VolumePtr outside) + BoundarySurfaceT( + std::shared_ptr<const Surface> surface, + VolumePtr inside, + VolumePtr outside) : m_surface(std::move(surface)), m_insideVolume(inside.get()), m_outsideVolume(outside.get()), @@ -88,9 +92,10 @@ class BoundarySurfaceT { /// @param insideArray The inside volume array the bounday surface points to /// @param outsideArray The outside volume array the boundary surface /// points to - BoundarySurfaceT(std::shared_ptr<const Surface> surface, - std::shared_ptr<const VolumeArray> insideArray, - std::shared_ptr<const VolumeArray> outsideArray) + BoundarySurfaceT( + std::shared_ptr<const Surface> surface, + std::shared_ptr<const VolumeArray> insideArray, + std::shared_ptr<const VolumeArray> outsideArray) : m_surface(std::move(surface)), m_insideVolume(nullptr), m_outsideVolume(nullptr), @@ -106,9 +111,11 @@ class BoundarySurfaceT { /// @param dir is an aditional direction corrective /// /// @return The attached volume at that position - virtual const T* attachedVolume(const GeometryContext& gctx, - const Vector3D& pos, const Vector3D& mom, - NavigationDirection pdir) const; + virtual const T* attachedVolume( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom, + NavigationDirection pdir) const; /// templated onBoundary method /// @@ -117,7 +124,8 @@ class BoundarySurfaceT { /// @param gctx The current geometry context object, e.g. alignment /// @param pars The parameters used for this call template <class P> - bool onBoundary(const GeometryContext& gctx, const P& pars) const { + bool + onBoundary(const GeometryContext& gctx, const P& pars) const { return surfaceRepresentation().isOnSurface(gctx, pars); } @@ -142,8 +150,9 @@ class BoundarySurfaceT { /// /// @param volumes The volume array to be attached /// @param inout The boundary orientation @todo update to along/opposite - void attachVolumeArray(std::shared_ptr<const VolumeArray> volumes, - BoundaryOrientation inout); + void attachVolumeArray( + std::shared_ptr<const VolumeArray> volumes, + BoundaryOrientation inout); protected: /// the represented surface by this @@ -159,13 +168,14 @@ class BoundarySurfaceT { }; template <class T> -inline const Surface& BoundarySurfaceT<T>::surfaceRepresentation() const { +inline const Surface& +BoundarySurfaceT<T>::surfaceRepresentation() const { return (*(m_surface.get())); } template <class T> -void BoundarySurfaceT<T>::attachVolume(VolumePtr volume, - BoundaryOrientation inout) { +void +BoundarySurfaceT<T>::attachVolume(VolumePtr volume, BoundaryOrientation inout) { if (inout == insideVolume) { m_insideVolume = volume.get(); } else { @@ -174,7 +184,8 @@ void BoundarySurfaceT<T>::attachVolume(VolumePtr volume, } template <class T> -void BoundarySurfaceT<T>::attachVolumeArray( +void +BoundarySurfaceT<T>::attachVolumeArray( const std::shared_ptr<const VolumeArray> volumes, BoundaryOrientation inout) { if (inout == insideVolume) { @@ -185,10 +196,12 @@ void BoundarySurfaceT<T>::attachVolumeArray( } template <class T> -const T* BoundarySurfaceT<T>::attachedVolume(const GeometryContext& gctx, - const Vector3D& pos, - const Vector3D& mom, - NavigationDirection pdir) const { +const T* +BoundarySurfaceT<T>::attachedVolume( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom, + NavigationDirection pdir) const { const T* attVolume = nullptr; // dot product with normal vector to distinguish inside/outside if ((surfaceRepresentation().normal(gctx, pos)).dot(pdir * mom) > 0.) { diff --git a/Core/include/Acts/Geometry/ConeLayer.hpp b/Core/include/Acts/Geometry/ConeLayer.hpp index 215362699..e2177eeb5 100644 --- a/Core/include/Acts/Geometry/ConeLayer.hpp +++ b/Core/include/Acts/Geometry/ConeLayer.hpp @@ -40,15 +40,21 @@ class ConeLayer : virtual public ConeSurface, public Layer { /// @todo chage od and ad to unique_ptr /// /// @return is a shared pointer to a layer - static MutableLayerPtr create( + static MutableLayerPtr + create( std::shared_ptr<const Transform3D> transform, std::shared_ptr<const ConeBounds> cbounds, - std::unique_ptr<SurfaceArray> surfaceArray, double thickness = 0., + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness = 0., std::unique_ptr<ApproachDescriptor> ad = nullptr, LayerType laytyp = Acts::active) { return MutableLayerPtr(new ConeLayer( - std::move(transform), std::move(cbounds), std::move(surfaceArray), - thickness, std::move(ad), laytyp)); + std::move(transform), + std::move(cbounds), + std::move(surfaceArray), + thickness, + std::move(ad), + laytyp)); } /// Default Constructor - delete @@ -80,11 +86,13 @@ class ConeLayer : virtual public ConeSurface, public Layer { /// @param laytyp is the layer type /// /// @todo chage od and ad to unique_ptr - ConeLayer(std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const ConeBounds> cbounds, - std::unique_ptr<SurfaceArray> surfaceArray, double thickness = 0., - std::unique_ptr<ApproachDescriptor> ade = nullptr, - LayerType laytyp = Acts::active); + ConeLayer( + std::shared_ptr<const Transform3D> transform, + std::shared_ptr<const ConeBounds> cbounds, + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ade = nullptr, + LayerType laytyp = Acts::active); /// Private copy constructor with shift, called by create(args*) /// diff --git a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp index 6b4da26db..8d7e5d1a8 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBounds.hpp @@ -96,9 +96,10 @@ class CuboidVolumeBounds : public VolumeBounds { /// @param envelope Optional envelope to add / subtract from min/max /// @param entity Entity to associate this bounding box with /// @return Constructed bounding box - Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr, - const Vector3D& envelope = {0, 0, 0}, - const Volume* entity = nullptr) const final; + Volume::BoundingBox boundingBox( + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, + const Volume* entity = nullptr) const final; /// This method returns the halflength in local x double halflengthX() const; @@ -138,30 +139,37 @@ class CuboidVolumeBounds : public VolumeBounds { std::shared_ptr<const RectangleBounds> m_zxBounds; }; -inline CuboidVolumeBounds* CuboidVolumeBounds::clone() const { +inline CuboidVolumeBounds* +CuboidVolumeBounds::clone() const { return new CuboidVolumeBounds(*this); } -inline bool CuboidVolumeBounds::inside(const Vector3D& pos, double tol) const { - return (std::abs(pos.x()) <= m_valueStore.at(bv_halfX) + tol && - std::abs(pos.y()) <= m_valueStore.at(bv_halfY) + tol && - std::abs(pos.z()) <= m_valueStore.at(bv_halfZ) + tol); +inline bool +CuboidVolumeBounds::inside(const Vector3D& pos, double tol) const { + return ( + std::abs(pos.x()) <= m_valueStore.at(bv_halfX) + tol && + std::abs(pos.y()) <= m_valueStore.at(bv_halfY) + tol && + std::abs(pos.z()) <= m_valueStore.at(bv_halfZ) + tol); } -inline double CuboidVolumeBounds::halflengthX() const { +inline double +CuboidVolumeBounds::halflengthX() const { return m_valueStore.at(bv_halfX); } -inline double CuboidVolumeBounds::halflengthY() const { +inline double +CuboidVolumeBounds::halflengthY() const { return m_valueStore.at(bv_halfY); } -inline double CuboidVolumeBounds::halflengthZ() const { +inline double +CuboidVolumeBounds::halflengthZ() const { return m_valueStore.at(bv_halfZ); } template <class T> -T& CuboidVolumeBounds::dumpT(T& dt) const { +T& +CuboidVolumeBounds::dumpT(T& dt) const { dt << std::setiosflags(std::ios::fixed); dt << std::setprecision(5); dt << "Acts::CuboidVolumeBounds: (halfX, halfY, halfZ) = "; diff --git a/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp b/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp index 64f0fa9fb..f14ed0239 100644 --- a/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp +++ b/Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp @@ -47,9 +47,10 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { double thickness = 0.; // Constructor function for optional detector elements // Arguments are transform, rectangle bounds and thickness. - std::function<DetectorElementBase*(std::shared_ptr<const Transform3D>, - std::shared_ptr<const RectangleBounds>, - double)> + std::function<DetectorElementBase*( + std::shared_ptr<const Transform3D>, + std::shared_ptr<const RectangleBounds>, + double)> detElementConstructor; }; @@ -106,7 +107,10 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { /// @brief Setter of the config /// /// @param [in] cfg Configuration that is set - void setConfig(Config& cfg) { m_cfg = cfg; } + void + setConfig(Config& cfg) { + m_cfg = cfg; + } /// @brief This function creates a surface with a given configuration. A /// detector element is attached if the template parameter is non-void. @@ -116,7 +120,8 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { /// /// @return Pointer to the created surface std::shared_ptr<const PlaneSurface> buildSurface( - const GeometryContext& gctx, const SurfaceConfig& cfg) const; + const GeometryContext& gctx, + const SurfaceConfig& cfg) const; /// @brief This function creates a layer with a surface encaspulated with a /// given configuration. The surface gets a detector element attached if the @@ -126,8 +131,9 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { /// @param [in, out] cfg Configuration of the layer and the surface /// /// @return Pointer to the created layer - std::shared_ptr<const Layer> buildLayer(const GeometryContext& gctx, - LayerConfig& cfg) const; + std::shared_ptr<const Layer> buildLayer( + const GeometryContext& gctx, + LayerConfig& cfg) const; /// @brief This function creates a TrackingVolume with a configurable number /// of layers and surfaces. Each surface gets a detector element attached if @@ -137,8 +143,9 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { /// @param [in, out] cfg Configuration of the TrackingVolume /// /// @return Pointer to the created TrackingVolume - std::shared_ptr<TrackingVolume> buildVolume(const GeometryContext& gctx, - VolumeConfig& cfg) const; + std::shared_ptr<TrackingVolume> buildVolume( + const GeometryContext& gctx, + VolumeConfig& cfg) const; /// @brief This function evaluates the minimum and maximum of the binning as /// given by the configurations of the surfaces and layers. The ordering @@ -149,8 +156,9 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder { /// /// @return Pair containing the minimum and maximum along the binning /// direction - std::pair<double, double> binningRange(const GeometryContext& gctx, - const VolumeConfig& cfg) const; + std::pair<double, double> binningRange( + const GeometryContext& gctx, + const VolumeConfig& cfg) const; /// @brief This function builds a world TrackingVolume based on a given /// configuration diff --git a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp index b4738c311..06622ad24 100644 --- a/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CutoutCylinderVolumeBounds.hpp @@ -41,8 +41,12 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { * @param dz1 The longer halflength of the shape * @param dz2 The shorter halflength of the shape */ - CutoutCylinderVolumeBounds(double rmin, double rmed, double rmax, double dz1, - double dz2) + CutoutCylinderVolumeBounds( + double rmin, + double rmed, + double rmax, + double dz1, + double dz2) : m_rmin(rmin), m_rmed(rmed), m_rmax(rmax), m_dz1(dz1), m_dz2(dz2) {} /** @@ -82,9 +86,10 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { * @param entity Entity to associate this bounding box with * @return Constructed bounding box */ - Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr, - const Vector3D& envelope = {0, 0, 0}, - const Volume* entity = nullptr) const final; + Volume::BoundingBox boundingBox( + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, + const Volume* entity = nullptr) const final; /** * Write information about this instance to an outstream @@ -98,38 +103,54 @@ class CutoutCylinderVolumeBounds : public VolumeBounds { * @param helper The visualizatin helper * @param transform Optional transformation matrix */ - void draw(IVisualization& helper, - const Transform3D& transform = Transform3D::Identity()) const; + void draw( + IVisualization& helper, + const Transform3D& transform = Transform3D::Identity()) const; /** * Return the minimum radius * @return The minimum radius */ - double rMin() const { return m_rmin; } + double + rMin() const { + return m_rmin; + } /** * Return the medium radius * @return The medium radius */ - double rMed() const { return m_rmed; } + double + rMed() const { + return m_rmed; + } /** * Return the maximum radius * @return The maximum radius */ - double rMax() const { return m_rmax; } + double + rMax() const { + return m_rmax; + } /** * Return the longer halflength in z. * @return The halflength */ - double dZ1() const { return m_dz1; } + double + dZ1() const { + return m_dz1; + } /** * Return the shorter halflength in z. * @return The halflength */ - double dZ2() const { return m_dz2; } + double + dZ2() const { + return m_dz2; + } private: double m_rmin; diff --git a/Core/include/Acts/Geometry/CylinderLayer.hpp b/Core/include/Acts/Geometry/CylinderLayer.hpp index 136014343..a0e0902ca 100644 --- a/Core/include/Acts/Geometry/CylinderLayer.hpp +++ b/Core/include/Acts/Geometry/CylinderLayer.hpp @@ -46,15 +46,21 @@ class CylinderLayer : public CylinderSurface, public Layer { /// @todo ApproachDescriptor to unique_ptr /// /// @return The return object is a shared poiter to the layer. - static MutableLayerPtr create( + static MutableLayerPtr + create( const std::shared_ptr<const Transform3D>& transform, const std::shared_ptr<const CylinderBounds>& cbounds, std::unique_ptr<SurfaceArray> surfaceArray = nullptr, - double thickness = 0., std::unique_ptr<ApproachDescriptor> ad = nullptr, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ad = nullptr, LayerType laytyp = passive) { - return MutableLayerPtr(new CylinderLayer(transform, cbounds, - std::move(surfaceArray), thickness, - std::move(ad), laytyp)); + return MutableLayerPtr(new CylinderLayer( + transform, + cbounds, + std::move(surfaceArray), + thickness, + std::move(ad), + laytyp)); } /// Copy constructor - deleted @@ -92,12 +98,13 @@ class CylinderLayer : public CylinderSurface, public Layer { /// @todo change ApproachDescriptor to unique_ptr /// /// @return The return object is a shared poiter to the layer. - CylinderLayer(const std::shared_ptr<const Transform3D>& transform, - const std::shared_ptr<const CylinderBounds>& cBounds, - std::unique_ptr<SurfaceArray> surfaceArray = nullptr, - double thickness = 0., - std::unique_ptr<ApproachDescriptor> ades = nullptr, - LayerType laytyp = passive); + CylinderLayer( + const std::shared_ptr<const Transform3D>& transform, + const std::shared_ptr<const CylinderBounds>& cBounds, + std::unique_ptr<SurfaceArray> surfaceArray = nullptr, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ades = nullptr, + LayerType laytyp = passive); /// Private copy constructor with shift, called by create(args*) /// diff --git a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp index 291f394cd..5f19d0747 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeBounds.hpp @@ -104,8 +104,11 @@ class CylinderVolumeBounds : public VolumeBounds { /// @param router is the outer radius of the cylinder /// @param haphi is the half opening angle /// @param halez is the half length in z - CylinderVolumeBounds(double rinner, double router, double haphi, - double halez); + CylinderVolumeBounds( + double rinner, + double router, + double haphi, + double halez); /// Constructor - from cylinder bounds and thickness /// @@ -152,9 +155,10 @@ class CylinderVolumeBounds : public VolumeBounds { /// @param envelope Optional envelope to add / subtract from min/max /// @param entity Entity to associate this bounding box with /// @return Constructed bounding box - Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr, - const Vector3D& envelope = {0, 0, 0}, - const Volume* entity = nullptr) const final; + Volume::BoundingBox boundingBox( + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, + const Volume* entity = nullptr) const final; /// Binning offset - overloaded for some R-binning types /// @@ -190,8 +194,9 @@ class CylinderVolumeBounds : public VolumeBounds { /// Draw this cylinder to a given helper /// @param helper The helper instance /// @param transform An additional transform, default is identity - void draw(IVisualization& helper, - const Transform3D& transform = Transform3D::Identity()) const; + void draw( + IVisualization& helper, + const Transform3D& transform = Transform3D::Identity()) const; private: /// templated dumpT method @@ -222,12 +227,13 @@ class CylinderVolumeBounds : public VolumeBounds { static const double s_numericalStable; }; -inline CylinderVolumeBounds* CylinderVolumeBounds::clone() const { +inline CylinderVolumeBounds* +CylinderVolumeBounds::clone() const { return new CylinderVolumeBounds(*this); } -inline bool CylinderVolumeBounds::inside(const Vector3D& pos, - double tol) const { +inline bool +CylinderVolumeBounds::inside(const Vector3D& pos, double tol) const { using VectorHelpers::perp; using VectorHelpers::phi; double ros = perp(pos); @@ -259,33 +265,40 @@ inline double CylinderVolumeBounds::binningBorder(BinningValue bValue) return VolumeBounds::binningBorder(bValue); } -inline double CylinderVolumeBounds::innerRadius() const { +inline double +CylinderVolumeBounds::innerRadius() const { return m_valueStore.at(bv_innerRadius); } -inline double CylinderVolumeBounds::outerRadius() const { +inline double +CylinderVolumeBounds::outerRadius() const { return m_valueStore.at(bv_outerRadius); } -inline double CylinderVolumeBounds::mediumRadius() const { +inline double +CylinderVolumeBounds::mediumRadius() const { return 0.5 * (m_valueStore.at(bv_innerRadius) + m_valueStore.at(bv_outerRadius)); } -inline double CylinderVolumeBounds::deltaRadius() const { +inline double +CylinderVolumeBounds::deltaRadius() const { return (m_valueStore.at(bv_outerRadius) - m_valueStore.at(bv_innerRadius)); } -inline double CylinderVolumeBounds::halfPhiSector() const { +inline double +CylinderVolumeBounds::halfPhiSector() const { return m_valueStore.at(bv_halfPhiSector); } -inline double CylinderVolumeBounds::halflengthZ() const { +inline double +CylinderVolumeBounds::halflengthZ() const { return m_valueStore.at(bv_halfZ); } template <class T> -T& CylinderVolumeBounds::dumpT(T& tstream) const { +T& +CylinderVolumeBounds::dumpT(T& tstream) const { tstream << std::setiosflags(std::ios::fixed); tstream << std::setprecision(5); tstream << "Acts::CylinderVolumeBounds: (rMin, rMax, halfPhi, halfZ) = "; diff --git a/Core/include/Acts/Geometry/CylinderVolumeBuilder.hpp b/Core/include/Acts/Geometry/CylinderVolumeBuilder.hpp index 7d9ad1c30..210f09c26 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeBuilder.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeBuilder.hpp @@ -71,7 +71,8 @@ struct VolumeConfig { /// it will take the maximum/minimum values and just overwrite them /// /// @param [in] lConfig is the config to which it should be adapded - void adaptZ(const VolumeConfig& lConfig) { + void + adaptZ(const VolumeConfig& lConfig) { if (lConfig) { takeSmaller(zMin, lConfig.zMin); takeBigger(zMax, lConfig.zMax); @@ -82,7 +83,8 @@ struct VolumeConfig { /// it will take the maximum/minimum values and just overwrite them /// /// @param [in] lConfig is the config to which it should be adapded - void adaptR(const VolumeConfig& lConfig) { + void + adaptR(const VolumeConfig& lConfig) { if (lConfig) { takeSmaller(rMin, lConfig.rMin); takeBigger(rMax, lConfig.rMax); @@ -93,7 +95,8 @@ struct VolumeConfig { /// it will take the maximum/minimum values and just overwrite them /// /// @param [in] lConfig is the config to which it should be adapded - void adapt(const VolumeConfig& lConfig) { + void + adapt(const VolumeConfig& lConfig) { adaptZ(lConfig); adaptR(lConfig); } @@ -104,7 +107,8 @@ struct VolumeConfig { /// /// @param [in] lConfig is the config to which it should be attached /// @note lConfig will be changed - void midPointAttachZ(VolumeConfig& lConfig) { + void + midPointAttachZ(VolumeConfig& lConfig) { if (lConfig.zMin >= zMax) { double zMid = 0.5 * (lConfig.zMin + zMax); lConfig.zMin = zMid; @@ -120,7 +124,8 @@ struct VolumeConfig { /// it attaches the one volume config to the other one /// /// @param [in] lConfig is the confit to which it should be attached - void attachZ(const VolumeConfig& lConfig) { + void + attachZ(const VolumeConfig& lConfig) { if (lConfig.zMin >= zMax) { zMax = lConfig.zMin; } else { @@ -132,7 +137,8 @@ struct VolumeConfig { /// /// @param [in] vConfig is the config against which is checked /// @return boolean if the overlap in r exists - bool overlapsInR(const VolumeConfig& vConfig) const { + bool + overlapsInR(const VolumeConfig& vConfig) const { if (!present) { return false; } @@ -143,7 +149,8 @@ struct VolumeConfig { /// /// @param [in] vConfig is the config against which is checked /// @return boolean if the overlap in z exists - bool overlapsInZ(const VolumeConfig& vConfig) const { + bool + overlapsInZ(const VolumeConfig& vConfig) const { if (!present) { return false; } @@ -154,7 +161,8 @@ struct VolumeConfig { /// /// @param [in] vConfig is the config against which is checked /// @return boolean if the current volume wraps the vConfig fully - bool wraps(const VolumeConfig& vConfig) const { + bool + wraps(const VolumeConfig& vConfig) const { if ((zMax <= vConfig.zMin) || (zMin >= vConfig.zMax)) { return true; } @@ -164,26 +172,30 @@ struct VolumeConfig { /// Check if contained full set /// /// @param [in] vConfig is the config against which is checked - bool contains(const VolumeConfig& vConfig) const { + bool + contains(const VolumeConfig& vConfig) const { return (containsInR(vConfig) && containsInZ(vConfig)); } /// Check if contained radially /// /// @param [in] vConfig is the config against which is checked - bool containsInR(const VolumeConfig& vConfig) const { + bool + containsInR(const VolumeConfig& vConfig) const { return (rMin >= vConfig.rMax); } /// Check if contained longitudinally /// /// @param [in] vConfig is the config against which is checked - bool containsInZ(const VolumeConfig& vConfig) const { + bool + containsInZ(const VolumeConfig& vConfig) const { return (vConfig.zMin > zMin && vConfig.zMax < zMax); } /// Method for output formatting - std::string toString() const { + std::string + toString() const { /// for screen output std::stringstream sl; sl << rMin << ", " << rMax << " / " << zMin << ", " << zMax; @@ -222,7 +234,8 @@ struct WrappingConfig { WrappingConfig() = default; /// configure the new Volume - void configureContainerVolume() { + void + configureContainerVolume() { // set the container to be present containerVolumeConfig.present = true; std::string wConditionAddon = ""; @@ -267,7 +280,8 @@ struct WrappingConfig { } /// wrap, insert, attach - void wrapInsertAttach() { + void + wrapInsertAttach() { // action is only needed if an existing volume // is present if (existingVolumeConfig) { @@ -407,7 +421,8 @@ struct WrappingConfig { } /// Method for output formatting - std::string toString() const { + std::string + toString() const { // for screen output std::stringstream sl; if (containerVolumeConfig) { @@ -493,9 +508,10 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder { /// /// @param [in] cvbConfig is the configuraiton struct to steer the builder /// @param [in] logger logging instance - CylinderVolumeBuilder(const Config& cvbConfig, - std::unique_ptr<const Logger> logger = getDefaultLogger( - "CylinderVolumeBuilder", Logging::INFO)); + CylinderVolumeBuilder( + const Config& cvbConfig, + std::unique_ptr<const Logger> logger = + getDefaultLogger("CylinderVolumeBuilder", Logging::INFO)); /// Destructor ~CylinderVolumeBuilder() override; @@ -510,7 +526,8 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder { /// optionally provided exisitingVolume consistently for further /// processing MutableTrackingVolumePtr trackingVolume( - const GeometryContext& gctx, TrackingVolumePtr existingVolume = nullptr, + const GeometryContext& gctx, + TrackingVolumePtr existingVolume = nullptr, VolumeBoundsPtr externalBounds = nullptr) const override; /// Set configuration method @@ -534,8 +551,9 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder { /// @param [in] lVector is the vector of layers that are parsed /// /// @return a VolumeConfig representing this layer - VolumeConfig analyzeLayers(const GeometryContext& gctx, - const LayerVector& lVector) const; + VolumeConfig analyzeLayers( + const GeometryContext& gctx, + const LayerVector& lVector) const; private: /// Configuration struct @@ -544,7 +562,10 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder { /// Private access to the logger /// /// @return a const reference to the logger - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// the logging instance std::unique_ptr<const Logger> m_logger; @@ -561,15 +582,17 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder { /// @param [in] sign distinguishes inside/outside testing /// /// @return boolean that indicates the test result - bool checkLayerContainment(const GeometryContext& gctx, - VolumeConfig& layerConfig, - const VolumeConfig& insideConfig, - const VolumeConfig& volumeConfig, int sign) const; + bool checkLayerContainment( + const GeometryContext& gctx, + VolumeConfig& layerConfig, + const VolumeConfig& insideConfig, + const VolumeConfig& volumeConfig, + int sign) const; }; /// Return the configuration object -inline CylinderVolumeBuilder::Config CylinderVolumeBuilder::getConfiguration() - const { +inline CylinderVolumeBuilder::Config +CylinderVolumeBuilder::getConfiguration() const { return m_cfg; } diff --git a/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp b/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp index d5de14615..2a86b23f0 100644 --- a/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp +++ b/Core/include/Acts/Geometry/CylinderVolumeHelper.hpp @@ -65,9 +65,10 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// Constructor /// @param cvhConfig is the configuration struct for this builder /// @param logger logging instance - CylinderVolumeHelper(const Config& cvhConfig, - std::unique_ptr<const Logger> logger = getDefaultLogger( - "CylinderVolumeHelper", Logging::INFO)); + CylinderVolumeHelper( + const Config& cvhConfig, + std::unique_ptr<const Logger> logger = + getDefaultLogger("CylinderVolumeHelper", Logging::INFO)); /// Destructor ~CylinderVolumeHelper() override = default; @@ -86,7 +87,8 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr createTrackingVolume( - const GeometryContext& gctx, const LayerVector& layers, + const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const IVolumeMaterial> volumeMaterial, VolumeBoundsPtr volumeBounds, std::shared_ptr<const Transform3D> transform = nullptr, @@ -109,9 +111,13 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr createTrackingVolume( - const GeometryContext& gctx, const LayerVector& layers, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin, - double rMax, double zMin, double zMax, + const GeometryContext& gctx, + const LayerVector& layers, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double rMin, + double rMax, + double zMin, + double zMax, const std::string& volumeName = "UndefinedVolume", BinningType bType = arbitrary) const override; @@ -131,8 +137,12 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr createGapTrackingVolume( const GeometryContext& gctx, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin, - double rMax, double zMin, double zMax, unsigned int materialLayers, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double rMin, + double rMax, + double zMin, + double zMax, + unsigned int materialLayers, bool cylinder = true, const std::string& volumeName = "UndefinedVolume") const override; @@ -152,9 +162,13 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr createGapTrackingVolume( const GeometryContext& gctx, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin, - double rMax, double zMin, double zMax, - const std::vector<double>& layerPositions, bool cylinder = true, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double rMin, + double rMax, + double zMin, + double zMax, + const std::vector<double>& layerPositions, + bool cylinder = true, const std::string& volumeName = "UndefinedVolume", BinningType bType = arbitrary) const override; @@ -189,7 +203,10 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { private: /// Private access method to the logging instance - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// the looging instance std::unique_ptr<const Logger> m_logger; @@ -208,11 +225,16 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @param bValue the binning value in which the binning works /// @param bType is the type of binning: equidistant, arbitrary bool estimateAndCheckDimension( - const GeometryContext& gctx, const LayerVector& layers, + const GeometryContext& gctx, + const LayerVector& layers, const CylinderVolumeBounds*& cylinderVolumeBounds, - std::shared_ptr<const Transform3D>& transform, double& rMinClean, - double& rMaxClean, double& zMinClean, double& zMaxClean, - BinningValue& bValue, BinningType bType = arbitrary) const; + std::shared_ptr<const Transform3D>& transform, + double& rMinClean, + double& rMaxClean, + double& zMinClean, + double& zMaxClean, + BinningValue& bValue, + BinningType bType = arbitrary) const; /// Private method - interglue all volumes contained by a TrackingVolume /// and set the outside glue volumes in the descriptor @@ -225,10 +247,15 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @param rMax the maximim radius of the volume /// @param zMin the minimum z extend of the volume /// @param zMax the maximum z extend of the volume - bool interGlueTrackingVolume(const GeometryContext& gctx, - const MutableTrackingVolumePtr& tVolume, - bool rBinned, double rMin, double rGlueMin, - double rMax, double zMin, double zMax) const; + bool interGlueTrackingVolume( + const GeometryContext& gctx, + const MutableTrackingVolumePtr& tVolume, + bool rBinned, + double rMin, + double rGlueMin, + double rMax, + double zMin, + double zMax) const; /// Private method - glue volume to the other /// @@ -242,22 +269,27 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @param rMax the maximim radius of the volume /// @param zMin the minimum z extend of the volume /// @param zMax the maximum z extend of the volume - void glueTrackingVolumes(const GeometryContext& gctx, - const MutableTrackingVolumePtr& tvolOne, - BoundarySurfaceFace faceOne, - const MutableTrackingVolumePtr& tvolTwo, - BoundarySurfaceFace faceTwo, double rMin, - double rGlueMin, double rMax, double zMin, - double zMax) const; + void glueTrackingVolumes( + const GeometryContext& gctx, + const MutableTrackingVolumePtr& tvolOne, + BoundarySurfaceFace faceOne, + const MutableTrackingVolumePtr& tvolTwo, + BoundarySurfaceFace faceTwo, + double rMin, + double rGlueMin, + double rMax, + double zMin, + double zMax) const; /// Private method - helper method not to duplicate code /// /// @param tVolume is the volume to which faces are added /// @param bsf is the boundary surface to which faces are added /// @param vols are the voluems which are added - void addFaceVolumes(const MutableTrackingVolumePtr& tvol, - BoundarySurfaceFace glueFace, - TrackingVolumeVector& vols) const; + void addFaceVolumes( + const MutableTrackingVolumePtr& tvol, + BoundarySurfaceFace glueFace, + TrackingVolumeVector& vols) const; /// Private method - helper method to save some code /// @@ -269,8 +301,13 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @param binsZ are the bins for the material in z /// /// @return shared pointer to newly created cylinder layer - LayerPtr createCylinderLayer(double z, double r, double halflengthZ, - double thickness, int binsPhi, int binsZ) const; + LayerPtr createCylinderLayer( + double z, + double r, + double halflengthZ, + double thickness, + int binsPhi, + int binsZ) const; /// Private method - helper method to save some code /// @@ -282,12 +319,17 @@ class CylinderVolumeHelper : public ITrackingVolumeHelper { /// @param binsR are the bins for the material in R /// /// @return shared pointer to newly created cylinder layer - LayerPtr createDiscLayer(double z, double rMin, double rMax, double thickness, - int binsPhi, int binsR) const; + LayerPtr createDiscLayer( + double z, + double rMin, + double rMax, + double thickness, + int binsPhi, + int binsR) const; }; -inline CylinderVolumeHelper::Config CylinderVolumeHelper::getConfiguration() - const { +inline CylinderVolumeHelper::Config +CylinderVolumeHelper::getConfiguration() const { return m_cfg; } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Geometry/DiscLayer.hpp b/Core/include/Acts/Geometry/DiscLayer.hpp index 664013eab..a5d22614c 100644 --- a/Core/include/Acts/Geometry/DiscLayer.hpp +++ b/Core/include/Acts/Geometry/DiscLayer.hpp @@ -43,15 +43,21 @@ class DiscLayer : virtual public DiscSurface, public Layer { /// @todo move ApproachDescriptor to unqique_ptr /// /// @return a sharted pointer to the new layer - static MutableLayerPtr create( + static MutableLayerPtr + create( const std::shared_ptr<const Transform3D>& transform, const std::shared_ptr<const DiscBounds>& dbounds, std::unique_ptr<SurfaceArray> surfaceArray = nullptr, - double thickness = 0., std::unique_ptr<ApproachDescriptor> ad = nullptr, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ad = nullptr, LayerType laytyp = Acts::passive) { - return MutableLayerPtr(new DiscLayer(transform, dbounds, - std::move(surfaceArray), thickness, - std::move(ad), laytyp)); + return MutableLayerPtr(new DiscLayer( + transform, + dbounds, + std::move(surfaceArray), + thickness, + std::move(ad), + laytyp)); } /// Default Constructor @@ -86,12 +92,13 @@ class DiscLayer : virtual public DiscSurface, public Layer { /// @param thickness is the layer thickness (along the normal vector) /// @param ad is the approach descriptor that provides the approach surface /// @param laytyp is the layer taype - DiscLayer(const std::shared_ptr<const Transform3D>& transform, - const std::shared_ptr<const DiscBounds>& dbounds, - std::unique_ptr<SurfaceArray> surfaceArray = nullptr, - double thickness = 0., - std::unique_ptr<ApproachDescriptor> ades = nullptr, - LayerType laytyp = Acts::active); + DiscLayer( + const std::shared_ptr<const Transform3D>& transform, + const std::shared_ptr<const DiscBounds>& dbounds, + std::unique_ptr<SurfaceArray> surfaceArray = nullptr, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ades = nullptr, + LayerType laytyp = Acts::active); /// Copy constructor with shift DiscLayer(const DiscLayer& cla, const Transform3D& tr); diff --git a/Core/include/Acts/Geometry/DoubleTrapezoidVolumeBounds.hpp b/Core/include/Acts/Geometry/DoubleTrapezoidVolumeBounds.hpp index 4d23ab4b3..87a07d244 100644 --- a/Core/include/Acts/Geometry/DoubleTrapezoidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/DoubleTrapezoidVolumeBounds.hpp @@ -82,8 +82,13 @@ class DoubleTrapezoidVolumeBounds : public VolumeBounds { /// @param haley1 first half length in y (to negative) /// @param haley2 second half length in y (to positive) /// @param halez half length in z - DoubleTrapezoidVolumeBounds(double minhalex, double medhalex, double maxhalex, - double haley1, double haley2, double halez); + DoubleTrapezoidVolumeBounds( + double minhalex, + double medhalex, + double maxhalex, + double haley1, + double haley2, + double halez); /// Copy Constructor /// @@ -122,9 +127,10 @@ class DoubleTrapezoidVolumeBounds : public VolumeBounds { /// @param envelope Optional envelope to add / subtract from min/max /// @param entity Entity to associate this bounding box with /// @return Constructed bounding box - Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr, - const Vector3D& envelope = {0, 0, 0}, - const Volume* entity = nullptr) const final; + Volume::BoundingBox boundingBox( + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, + const Volume* entity = nullptr) const final; /// This method returns the X halflength at minimal Y double minHalflengthX() const; @@ -191,44 +197,54 @@ class DoubleTrapezoidVolumeBounds : public VolumeBounds { std::vector<TDD_real_t> m_valueStore; ///< the internal store }; -inline DoubleTrapezoidVolumeBounds* DoubleTrapezoidVolumeBounds::clone() const { +inline DoubleTrapezoidVolumeBounds* +DoubleTrapezoidVolumeBounds::clone() const { return new DoubleTrapezoidVolumeBounds(*this); } -inline double DoubleTrapezoidVolumeBounds::minHalflengthX() const { +inline double +DoubleTrapezoidVolumeBounds::minHalflengthX() const { return m_valueStore.at(bv_minHalfX); } -inline double DoubleTrapezoidVolumeBounds::medHalflengthX() const { +inline double +DoubleTrapezoidVolumeBounds::medHalflengthX() const { return m_valueStore.at(bv_medHalfX); } -inline double DoubleTrapezoidVolumeBounds::maxHalflengthX() const { +inline double +DoubleTrapezoidVolumeBounds::maxHalflengthX() const { return m_valueStore.at(bv_maxHalfX); } -inline double DoubleTrapezoidVolumeBounds::halflengthY1() const { +inline double +DoubleTrapezoidVolumeBounds::halflengthY1() const { return m_valueStore.at(bv_halfY1); } -inline double DoubleTrapezoidVolumeBounds::halflengthY2() const { +inline double +DoubleTrapezoidVolumeBounds::halflengthY2() const { return m_valueStore.at(bv_halfY2); } -inline double DoubleTrapezoidVolumeBounds::halflengthZ() const { +inline double +DoubleTrapezoidVolumeBounds::halflengthZ() const { return m_valueStore.at(bv_halfZ); } -inline double DoubleTrapezoidVolumeBounds::alpha1() const { +inline double +DoubleTrapezoidVolumeBounds::alpha1() const { return m_valueStore.at(bv_alpha1); } -inline double DoubleTrapezoidVolumeBounds::alpha2() const { +inline double +DoubleTrapezoidVolumeBounds::alpha2() const { return m_valueStore.at(bv_alpha2); } template <class T> -T& DoubleTrapezoidVolumeBounds::dumpT(T& dT) const { +T& +DoubleTrapezoidVolumeBounds::dumpT(T& dT) const { dT << std::setiosflags(std::ios::fixed); dT << std::setprecision(5); dT << "Acts::DoubleTrapezoidVolumeBounds: (minhalfX, medhalfX, maxhalfX, " diff --git a/Core/include/Acts/Geometry/GenericApproachDescriptor.hpp b/Core/include/Acts/Geometry/GenericApproachDescriptor.hpp index b7506d1f4..78b20bdaa 100644 --- a/Core/include/Acts/Geometry/GenericApproachDescriptor.hpp +++ b/Core/include/Acts/Geometry/GenericApproachDescriptor.hpp @@ -61,8 +61,11 @@ class GenericApproachDescriptor : public ApproachDescriptor { /// /// @return : a boolean indicating if an actual intersection had been tried ObjectIntersection<Surface> approachSurface( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir, const BoundaryCheck& bcheck, + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc corrfnc = nullptr) const override; /// return all contained surfaces of this approach descriptor diff --git a/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp b/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp index 9d0df1e93..1a5c816d2 100644 --- a/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/GenericCuboidVolumeBounds.hpp @@ -63,9 +63,10 @@ class GenericCuboidVolumeBounds : public VolumeBounds { * @param entity Entity to associate this bounding box with * @return Constructed bounding box */ - Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr, - const Vector3D& envelope = {0, 0, 0}, - const Volume* entity = nullptr) const final; + Volume::BoundingBox boundingBox( + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, + const Volume* entity = nullptr) const final; /// /// @param sl is the output stream to be written into @@ -76,8 +77,9 @@ class GenericCuboidVolumeBounds : public VolumeBounds { * @param helper The visualizatin helper * @param transform Optional transformation matrix */ - void draw(IVisualization& helper, - const Transform3D& transform = Transform3D::Identity()) const; + void draw( + IVisualization& helper, + const Transform3D& transform = Transform3D::Identity()) const; private: std::array<Vector3D, 8> m_vertices; diff --git a/Core/include/Acts/Geometry/GeometryID.hpp b/Core/include/Acts/Geometry/GeometryID.hpp index 951596a89..a4f74db51 100644 --- a/Core/include/Acts/Geometry/GeometryID.hpp +++ b/Core/include/Acts/Geometry/GeometryID.hpp @@ -62,7 +62,8 @@ class GeometryID { /// Assignement operator /// /// @param tddID is the geometry ID that will be assigned - GeometryID& operator=(const GeometryID& tddID) { + GeometryID& + operator=(const GeometryID& tddID) { if (&tddID != this) { m_value = tddID.m_value; } @@ -72,7 +73,8 @@ class GeometryID { /// Add some stuff - a new GeometryID /// /// @param tddID is the geometry ID that will be added - GeometryID& operator+=(const GeometryID& tddID) { + GeometryID& + operator+=(const GeometryID& tddID) { m_value += tddID.value(); return (*this); } @@ -80,7 +82,8 @@ class GeometryID { /// Add some stuff - a decoded value /// /// @param add_value is the fully decoded value to be added - GeometryID& operator+=(geo_id_value add_value) { + GeometryID& + operator+=(geo_id_value add_value) { m_value += add_value; return (*this); } @@ -88,20 +91,25 @@ class GeometryID { /// Equality operator /// /// @param tddID is the geometry ID that will be compared on equality - bool operator==(const GeometryID& tddID) const { + bool + operator==(const GeometryID& tddID) const { return (m_value == tddID.value()); } /// Non-equality operator /// /// @param tddID is the geometry ID that will be compared on equality - bool operator!=(const GeometryID& tddID) const { return !operator==(tddID); } + bool + operator!=(const GeometryID& tddID) const { + return !operator==(tddID); + } /// Add some stuff /// /// @param type_id which identifier do you wanna add /// @param type_mask the mask that is supposed to be applied - void add(geo_id_value type_id, geo_id_value type_mask) { + void + add(geo_id_value type_id, geo_id_value type_mask) { m_value += ACTS_BIT_ENCODE(type_id, type_mask); } @@ -117,14 +125,16 @@ class GeometryID { geo_id_value m_value = 0; }; -inline geo_id_value GeometryID::value(geo_id_value mask) const { +inline geo_id_value +GeometryID::value(geo_id_value mask) const { if (mask != 0u) { return ACTS_BIT_DECODE(m_value, mask); } return m_value; } -inline std::string GeometryID::toString() const { +inline std::string +GeometryID::toString() const { geo_id_value volume_id = value(volume_mask); geo_id_value boundary_id = value(boundary_mask); geo_id_value layer_id = value(layer_mask); diff --git a/Core/include/Acts/Geometry/GeometryObject.hpp b/Core/include/Acts/Geometry/GeometryObject.hpp index 90ee1ad05..6ce1c6a57 100644 --- a/Core/include/Acts/Geometry/GeometryObject.hpp +++ b/Core/include/Acts/Geometry/GeometryObject.hpp @@ -44,7 +44,8 @@ class GeometryObject { /// assignment operator /// /// @param geoID the source geoID - GeometryObject& operator=(const GeometryObject& geoID) { + GeometryObject& + operator=(const GeometryObject& geoID) { if (&geoID != this) { m_geoID = geoID.m_geoID; } @@ -61,8 +62,9 @@ class GeometryObject { /// @param bValue is the value in which you want to bin /// /// @return vector 3D used for the binning schema - virtual const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const = 0; + virtual const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const = 0; /// Implement the binningValue /// @@ -70,8 +72,8 @@ class GeometryObject { /// @param bValue is the dobule in which you want to bin /// /// @return float to be used for the binning schema - double binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const; + double binningPositionValue(const GeometryContext& gctx, BinningValue bValue) + const; /// Set the value /// @@ -82,16 +84,20 @@ class GeometryObject { GeometryID m_geoID; }; -inline const GeometryID& GeometryObject::geoID() const { +inline const GeometryID& +GeometryObject::geoID() const { return m_geoID; } -inline void GeometryObject::assignGeoID(const GeometryID& geoID) { +inline void +GeometryObject::assignGeoID(const GeometryID& geoID) { m_geoID = geoID; } -inline double GeometryObject::binningPositionValue(const GeometryContext& gctx, - BinningValue bValue) const { +inline double +GeometryObject::binningPositionValue( + const GeometryContext& gctx, + BinningValue bValue) const { using VectorHelpers::perp; // now switch switch (bValue) { diff --git a/Core/include/Acts/Geometry/GeometryObjectSorter.hpp b/Core/include/Acts/Geometry/GeometryObjectSorter.hpp index 21456a27a..310f2c6f8 100644 --- a/Core/include/Acts/Geometry/GeometryObjectSorter.hpp +++ b/Core/include/Acts/Geometry/GeometryObjectSorter.hpp @@ -35,7 +35,8 @@ class ObjectSorterT : public std::binary_function<T, T, bool> { /// @tparam two second object /// /// @return boolen indicator - bool operator()(T one, T two) const { + bool + operator()(T one, T two) const { using Acts::VectorHelpers::eta; using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; @@ -73,7 +74,10 @@ class ObjectSorterT : public std::binary_function<T, T, bool> { } } - BinningValue binningValue() const { return m_binningValue; } + BinningValue + binningValue() const { + return m_binningValue; + } private: BinningValue m_binningValue; ///< the binning value @@ -102,7 +106,8 @@ class DistanceSorterT : public std::binary_function<T, T, bool> { /// @tparam two second object /// /// @return boolen indicator - bool operator()(T one, T two) const { + bool + operator()(T one, T two) const { using Acts::VectorHelpers::eta; using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; @@ -171,8 +176,10 @@ class GeometryObjectSorterT : public std::binary_function<T, T, bool> { /// /// @param bValue is the value in which the binning is done /// @param transform is an optional transform to be performed - GeometryObjectSorterT(const GeometryContext& gctx, BinningValue bValue, - std::shared_ptr<const Transform3D> transform = nullptr) + GeometryObjectSorterT( + const GeometryContext& gctx, + BinningValue bValue, + std::shared_ptr<const Transform3D> transform = nullptr) : m_context(gctx), m_objectSorter(bValue), m_transform(std::move(transform)) {} @@ -183,7 +190,8 @@ class GeometryObjectSorterT : public std::binary_function<T, T, bool> { /// @tparam two second object /// /// @return boolen indicator - bool operator()(T one, T two) const { + bool + operator()(T one, T two) const { // get the pos one / pos two Vector3D posOne = m_transform diff --git a/Core/include/Acts/Geometry/GlueVolumesDescriptor.hpp b/Core/include/Acts/Geometry/GlueVolumesDescriptor.hpp index 694a3047e..ffa528d19 100644 --- a/Core/include/Acts/Geometry/GlueVolumesDescriptor.hpp +++ b/Core/include/Acts/Geometry/GlueVolumesDescriptor.hpp @@ -37,9 +37,9 @@ class GlueVolumesDescriptor { /// Constructor - with arguments /// /// @param gvs are the glue volume arrays mapped to the volume faces - GlueVolumesDescriptor( - const std::map<BoundarySurfaceFace, - std::shared_ptr<const TrackingVolumeArray>>& gvs); + GlueVolumesDescriptor(const std::map< + BoundarySurfaceFace, + std::shared_ptr<const TrackingVolumeArray>>& gvs); /// Desctructor ~GlueVolumesDescriptor() = default; @@ -47,8 +47,9 @@ class GlueVolumesDescriptor { /// /// @param bsf is the boundary surface face where the volume array is attached /// @param gvs is the array of volumes to be attached - void registerGlueVolumes(Acts::BoundarySurfaceFace bsf, - std::shared_ptr<const TrackingVolumeArray> gvs); + void registerGlueVolumes( + Acts::BoundarySurfaceFace bsf, + std::shared_ptr<const TrackingVolumeArray> gvs); /// Retrieve the glue volumes /// diff --git a/Core/include/Acts/Geometry/ILayerArrayCreator.hpp b/Core/include/Acts/Geometry/ILayerArrayCreator.hpp index 74f014e24..4044b15fb 100644 --- a/Core/include/Acts/Geometry/ILayerArrayCreator.hpp +++ b/Core/include/Acts/Geometry/ILayerArrayCreator.hpp @@ -50,8 +50,11 @@ class ILayerArrayCreator { /// /// @return unqiue pointer to a new LayerArray virtual std::unique_ptr<const LayerArray> layerArray( - const GeometryContext& gctx, const LayerVector& layers, double min, - double max, BinningType btype = arbitrary, + const GeometryContext& gctx, + const LayerVector& layers, + double min, + double max, + BinningType btype = arbitrary, BinningValue bvalue = binX) const = 0; }; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp b/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp index 191ad4180..347f9a918 100644 --- a/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Geometry/ITrackingVolumeArrayCreator.hpp @@ -56,7 +56,8 @@ class ITrackingVolumeArrayCreator { /// /// @return sahred pointer to a new TrackingVolumeArray virtual std::shared_ptr<const TrackingVolumeArray> trackingVolumeArray( - const GeometryContext& gctx, const TrackingVolumeVector& vols, + const GeometryContext& gctx, + const TrackingVolumeVector& vols, BinningValue bVal) const = 0; }; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Geometry/ITrackingVolumeBuilder.hpp b/Core/include/Acts/Geometry/ITrackingVolumeBuilder.hpp index df4bd5117..a493c6f3e 100644 --- a/Core/include/Acts/Geometry/ITrackingVolumeBuilder.hpp +++ b/Core/include/Acts/Geometry/ITrackingVolumeBuilder.hpp @@ -52,7 +52,8 @@ class ITrackingVolumeBuilder { /// /// @return shared pointer to a newly created TrackingVolume virtual MutableTrackingVolumePtr trackingVolume( - const GeometryContext& gctx, TrackingVolumePtr insideVolume = nullptr, + const GeometryContext& gctx, + TrackingVolumePtr insideVolume = nullptr, VolumeBoundsPtr outsideBounds = nullptr) const = 0; }; diff --git a/Core/include/Acts/Geometry/ITrackingVolumeHelper.hpp b/Core/include/Acts/Geometry/ITrackingVolumeHelper.hpp index 1d94d366c..1b10565ba 100644 --- a/Core/include/Acts/Geometry/ITrackingVolumeHelper.hpp +++ b/Core/include/Acts/Geometry/ITrackingVolumeHelper.hpp @@ -62,7 +62,8 @@ class ITrackingVolumeHelper { /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr createTrackingVolume( - const GeometryContext& gctx, const LayerVector& layers, + const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const IVolumeMaterial> volumeMaterial, VolumeBoundsPtr volumeBounds, std::shared_ptr<const Transform3D> transform = nullptr, @@ -83,9 +84,13 @@ class ITrackingVolumeHelper { /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr createTrackingVolume( - const GeometryContext& gctx, const LayerVector& layers, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double loc0Min, - double loc0Max, double loc1Min, double loc1Max, + const GeometryContext& gctx, + const LayerVector& layers, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double loc0Min, + double loc0Max, + double loc1Min, + double loc1Max, const std::string& volumeName = "UndefinedVolume", BinningType btype = arbitrary) const = 0; @@ -102,9 +107,13 @@ class ITrackingVolumeHelper { /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr createGapTrackingVolume( const GeometryContext& gctx, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double loc0Min, - double loc0Max, double loc1Min, double loc1Max, - unsigned int materialLayers, bool cylinder = true, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double loc0Min, + double loc0Max, + double loc1Min, + double loc1Max, + unsigned int materialLayers, + bool cylinder = true, const std::string& volumeName = "UndefinedVolume") const = 0; /// Create a gap volume from dimensions and @@ -120,9 +129,13 @@ class ITrackingVolumeHelper { /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr createGapTrackingVolume( const GeometryContext& gctx, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double loc0Min, - double loc0Max, double loc1Min, double loc1Max, - const std::vector<double>& layerPositions, bool cylinder = true, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double loc0Min, + double loc0Max, + double loc1Min, + double loc1Max, + const std::vector<double>& layerPositions, + bool cylinder = true, const std::string& volumeName = "UndefinedVolume", BinningType btype = arbitrary) const = 0; diff --git a/Core/include/Acts/Geometry/Layer.hpp b/Core/include/Acts/Geometry/Layer.hpp index 3fbda8269..33131e2df 100644 --- a/Core/include/Acts/Geometry/Layer.hpp +++ b/Core/include/Acts/Geometry/Layer.hpp @@ -128,8 +128,10 @@ class Layer : public virtual GeometryObject { /// /// @return boolean that indicates success of the operation template <typename parameters_t> - bool onLayer(const GeometryContext& gctx, const parameters_t& pars, - const BoundaryCheck& bcheck = true) const; + bool onLayer( + const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck = true) const; /// geometrical isOnLayer() method /// @@ -140,8 +142,10 @@ class Layer : public virtual GeometryObject { /// @param bcheck is the boundary check directive /// /// @return boolean that indicates success of the operation - virtual bool isOnLayer(const GeometryContext& gctx, const Vector3D& gp, - const BoundaryCheck& bcheck = true) const; + virtual bool isOnLayer( + const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck = true) const; /// Return method for the approach descriptor, can be nullptr const ApproachDescriptor* approachDescriptor() const; @@ -155,9 +159,12 @@ class Layer : public virtual GeometryObject { /// /// @return a boolean whether the layer is accepted for processing template <typename options_t> - bool resolve(const options_t& options) const { - return resolve(options.resolveSensitive, options.resolveMaterial, - options.resolvePassive); + bool + resolve(const options_t& options) const { + return resolve( + options.resolveSensitive, + options.resolveMaterial, + options.resolvePassive); } /// Accept layer according to the following collection directives @@ -167,8 +174,10 @@ class Layer : public virtual GeometryObject { /// @param resolvePassive is the prescription to find all passive surfaces /// /// @return a boolean whether the layer is accepted for processing - virtual bool resolve(bool resolveSensitive, bool resolveMaterial, - bool resolvePassive) const; + virtual bool resolve( + bool resolveSensitive, + bool resolveMaterial, + bool resolvePassive) const; /// @brief Decompose Layer into (compatible) surfaces /// @@ -182,11 +191,14 @@ class Layer : public virtual GeometryObject { /// @tparam corrector_t is an (optional) intersection corrector /// /// @return list of intersection of surfaces on the layer - template <typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename options_t, + typename corrector_t = VoidIntersectionCorrector> std::vector<SurfaceIntersection> compatibleSurfaces( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& momentum, const options_t& options, + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& momentum, + const options_t& options, const corrector_t& corrfnc = corrector_t()) const; /// @brief Decompose Layer into (compatible) surfaces @@ -201,10 +213,13 @@ class Layer : public virtual GeometryObject { /// @tparam corrector_t is an (optional) intersection corrector /// /// @return list of intersection of surfaces on the layer - template <typename parameters_t, typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename parameters_t, + typename options_t, + typename corrector_t = VoidIntersectionCorrector> std::vector<SurfaceIntersection> compatibleSurfaces( - const GeometryContext& gctx, const parameters_t& parameters, + const GeometryContext& gctx, + const parameters_t& parameters, const options_t& options, const corrector_t& corrfnc = corrector_t()) const; @@ -223,10 +238,13 @@ class Layer : public virtual GeometryObject { /// @tparam corrector_t is an (optional) intersection corrector /// /// @return the Surface intersection of the approach surface - template <typename parameters_t, typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename parameters_t, + typename options_t, + typename corrector_t = VoidIntersectionCorrector> const SurfaceIntersection surfaceOnApproach( - const GeometryContext& gctx, const parameters_t& parameters, + const GeometryContext& gctx, + const parameters_t& parameters, const options_t& options, const corrector_t& corrfnc = corrector_t()) const; @@ -245,11 +263,14 @@ class Layer : public virtual GeometryObject { /// @tparam corrector_t is an (optional) intersection corrector /// /// @return the Surface intersection of the approach surface - template <typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename options_t, + typename corrector_t = VoidIntersectionCorrector> const SurfaceIntersection surfaceOnApproach( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& corrfnc = corrector_t()) const; /// Fast navigation to next layer @@ -259,8 +280,10 @@ class Layer : public virtual GeometryObject { /// @param mom is the direction for the search /// /// @return the pointer to the next layer - const Layer* nextLayer(const GeometryContext& gctx, const Vector3D& gp, - const Vector3D& mom) const; + const Layer* nextLayer( + const GeometryContext& gctx, + const Vector3D& gp, + const Vector3D& mom) const; /// get the confining TrackingVolume /// @@ -282,9 +305,11 @@ class Layer : public virtual GeometryObject { /// @param thickness is the normal thickness of the Layer /// @param ades oapproach descriptor /// @param laytyp is the layer type if active or passive - Layer(std::unique_ptr<SurfaceArray> surfaceArray, double thickness = 0., - std::unique_ptr<ApproachDescriptor> ades = nullptr, - LayerType laytyp = passive); + Layer( + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ades = nullptr, + LayerType laytyp = passive); /// private method to set enclosing TrackingVolume, called by friend class /// only @@ -346,8 +371,9 @@ class Layer : public virtual GeometryObject { /// optionally the surface material to where they belong /// @param layerID is the geometry id of the volume /// as calculated by the TrackingGeometry - void closeGeometry(const IMaterialDecorator* materialDecorator, - const GeometryID& layerID); + void closeGeometry( + const IMaterialDecorator* materialDecorator, + const GeometryID& layerID); }; /// Layers are constructedd with shared_ptr factories, hence the layer array is diff --git a/Core/include/Acts/Geometry/LayerArrayCreator.hpp b/Core/include/Acts/Geometry/LayerArrayCreator.hpp index 6835c7c18..862c6627e 100644 --- a/Core/include/Acts/Geometry/LayerArrayCreator.hpp +++ b/Core/include/Acts/Geometry/LayerArrayCreator.hpp @@ -49,9 +49,10 @@ class LayerArrayCreator : public ILayerArrayCreator { /// Constructor /// /// @param logger logging instance - LayerArrayCreator(const Config& /*cfg*/, - std::unique_ptr<const Logger> logger = - getDefaultLogger("LayerArrayCreator", Logging::INFO)) + LayerArrayCreator( + const Config& /*cfg*/, + std::unique_ptr<const Logger> logger = + getDefaultLogger("LayerArrayCreator", Logging::INFO)) : m_logger(std::move(logger)) {} /// Destructor @@ -68,18 +69,25 @@ class LayerArrayCreator : public ILayerArrayCreator { /// /// @return unique pointer to a newly created LayerArray std::unique_ptr<const LayerArray> layerArray( - const GeometryContext& gctx, const LayerVector& layersInput, double min, - double max, BinningType bType = arbitrary, + const GeometryContext& gctx, + const LayerVector& layersInput, + double min, + double max, + BinningType bType = arbitrary, BinningValue bValue = binX) const override; /// set logging instance - void setLogger(std::unique_ptr<const Logger> logger) { + void + setLogger(std::unique_ptr<const Logger> logger) { m_logger = std::move(logger); } private: /// Private access method to the logging instance - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// logging instance std::unique_ptr<const Logger> m_logger = nullptr; @@ -91,10 +99,11 @@ class LayerArrayCreator : public ILayerArrayCreator { /// /// @param bValue is the Binning value for the layer array /// @param offset is the sift for the navigation layer - std::shared_ptr<Surface> createNavigationSurface(const GeometryContext& gctx, - const Layer& layer, - BinningValue bValue, - double offset) const; + std::shared_ptr<Surface> createNavigationSurface( + const GeometryContext& gctx, + const Layer& layer, + BinningValue bValue, + double offset) const; }; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Geometry/LayerCreator.hpp b/Core/include/Acts/Geometry/LayerCreator.hpp index 7d79f507f..74b77ac35 100644 --- a/Core/include/Acts/Geometry/LayerCreator.hpp +++ b/Core/include/Acts/Geometry/LayerCreator.hpp @@ -64,9 +64,10 @@ class LayerCreator { /// /// @param lcConfig is the configuration object /// @param logger logging instance - LayerCreator(const Config& lcConfig, - std::unique_ptr<const Logger> logger = - getDefaultLogger("LayerCreator", Logging::INFO)); + LayerCreator( + const Config& lcConfig, + std::unique_ptr<const Logger> logger = + getDefaultLogger("LayerCreator", Logging::INFO)); /// Destructor ~LayerCreator() = default; @@ -90,8 +91,10 @@ class LayerCreator { /// @return shared pointer to a newly created layer 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsPhi, + size_t binsZ, + boost::optional<ProtoLayer> _protoLayer = boost::none, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -115,7 +118,8 @@ class LayerCreator { MutableLayerPtr cylinderLayer( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, - BinningType bTypePhi, BinningType bTypeZ, + BinningType bTypePhi, + BinningType bTypeZ, boost::optional<ProtoLayer> _protoLayer = boost::none, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -139,8 +143,10 @@ class LayerCreator { /// @return shared pointer to a newly created layer 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsR, + size_t binsPhi, + boost::optional<ProtoLayer> _protoLayer = boost::none, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -163,7 +169,8 @@ class LayerCreator { /// @return shared pointer to a newly created layer MutableLayerPtr discLayer( const GeometryContext& gctx, - std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, + std::vector<std::shared_ptr<const Surface>> surfaces, + BinningType bTypeR, BinningType bTypePhi, boost::optional<ProtoLayer> _protoLayer = boost::none, std::shared_ptr<const Transform3D> transform = nullptr, @@ -192,8 +199,10 @@ class LayerCreator { /// @return shared pointer to a newly created layer MutableLayerPtr planeLayer( const GeometryContext& gctx, - std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, - size_t bins2, BinningValue bValue = BinningValue::binX, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t bins1, + size_t bins2, + BinningValue bValue = BinningValue::binX, boost::optional<ProtoLayer> _protoLayer = boost::none, std::shared_ptr<const Transform3D> transform = nullptr, std::unique_ptr<ApproachDescriptor> ad = nullptr) const; @@ -218,20 +227,24 @@ class LayerCreator { /// /// @param surfGrid is the object grid from the surface array /// @para surfaces is the vector of sensitive surfaces - bool checkBinning(const GeometryContext& gctx, - const SurfaceArray& sArray) const; + bool checkBinning(const GeometryContext& gctx, const SurfaceArray& sArray) + const; /// configuration object Config m_cfg; /// Private acces method to the logger - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// logging instance std::unique_ptr<const Logger> m_logger; }; -inline LayerCreator::Config LayerCreator::getConfiguration() const { +inline LayerCreator::Config +LayerCreator::getConfiguration() const { return m_cfg; } diff --git a/Core/include/Acts/Geometry/NavigationLayer.hpp b/Core/include/Acts/Geometry/NavigationLayer.hpp index d64a872f5..c3a9dcb8f 100644 --- a/Core/include/Acts/Geometry/NavigationLayer.hpp +++ b/Core/include/Acts/Geometry/NavigationLayer.hpp @@ -36,8 +36,10 @@ class NavigationLayer : public Layer { /// /// @param sRepresentation is the representation for extrapolation /// @param thickness is the thickness for the binning - static LayerPtr create(std::shared_ptr<const Surface> sRepresentation, - double thickness = 0.) { + static LayerPtr + create( + std::shared_ptr<const Surface> sRepresentation, + double thickness = 0.) { return LayerPtr(new NavigationLayer(std::move(sRepresentation), thickness)); } @@ -51,8 +53,9 @@ class NavigationLayer : public Layer { /// - as default the center is given, but may be overloaded /// /// @return The return vector can be used for binning in a TrackingVolume - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const final; /// Default Constructor - deleted NavigationLayer() = delete; @@ -78,8 +81,10 @@ class NavigationLayer : public Layer { /// @param bcheck is the boundary check directive /// /// @return boolean that indicates if the position is on surface - bool isOnLayer(const GeometryContext& gctx, const Vector3D& gp, - const BoundaryCheck& bcheck = true) const final; + bool isOnLayer( + const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck = true) const final; /// Accept layer according to the following colelction directives /// @@ -90,8 +95,8 @@ class NavigationLayer : public Layer { /// @note navigation layers are never accepted /// /// @return a boolean whether the layer is accepted for processing - bool resolve(bool resolveSensitive, bool resolveMaterial, - bool resolvePassive) const final; + bool resolve(bool resolveSensitive, bool resolveMaterial, bool resolvePassive) + const final; protected: /// Private Constructor @@ -100,8 +105,9 @@ class NavigationLayer : public Layer { /// /// @param surfaceRepresentation is the surface of the layer /// @param thickness ithe layer thickness - NavigationLayer(std::shared_ptr<const Surface> surfaceRepresentation, - double thickness); + NavigationLayer( + std::shared_ptr<const Surface> surfaceRepresentation, + double thickness); /// for the navigation Volume the surface /// @@ -111,28 +117,36 @@ class NavigationLayer : public Layer { std::shared_ptr<const Surface> m_surfaceRepresentation; }; -inline const Surface& NavigationLayer::surfaceRepresentation() const { +inline const Surface& +NavigationLayer::surfaceRepresentation() const { return (*m_surfaceRepresentation); } -inline Surface& NavigationLayer::surfaceRepresentation() { +inline Surface& +NavigationLayer::surfaceRepresentation() { return *(const_cast<Surface*>(m_surfaceRepresentation.get())); } -inline const Vector3D NavigationLayer::binningPosition( - const GeometryContext& gctx, BinningValue bValue) const { +inline const Vector3D +NavigationLayer::binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const { return m_surfaceRepresentation->binningPosition(gctx, bValue); } -inline bool NavigationLayer::isOnLayer(const GeometryContext& gctx, - const Vector3D& gp, - const BoundaryCheck& bcheck) const { +inline bool +NavigationLayer::isOnLayer( + const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck) const { return m_surfaceRepresentation->isOnSurface(gctx, gp, s_origin, bcheck); } -inline bool NavigationLayer::resolve(bool /*resolveSensitive*/, - bool /*resolveMaterial*/, - bool /*reolvePassive*/) const { +inline bool +NavigationLayer::resolve( + bool /*resolveSensitive*/, + bool /*resolveMaterial*/, + bool /*reolvePassive*/) const { return false; } diff --git a/Core/include/Acts/Geometry/PassiveLayerBuilder.hpp b/Core/include/Acts/Geometry/PassiveLayerBuilder.hpp index db6686fb6..0bbcc469c 100644 --- a/Core/include/Acts/Geometry/PassiveLayerBuilder.hpp +++ b/Core/include/Acts/Geometry/PassiveLayerBuilder.hpp @@ -54,9 +54,10 @@ class PassiveLayerBuilder : public ILayerBuilder { /// /// @param plConfig is the ocnfiguration struct that steers behavior /// @param logger logging instance - PassiveLayerBuilder(const Config& plConfig, - std::unique_ptr<const Logger> logger = getDefaultLogger( - "PassiveLayerBuilder", Logging::INFO)); + PassiveLayerBuilder( + const Config& plConfig, + std::unique_ptr<const Logger> logger = + getDefaultLogger("PassiveLayerBuilder", Logging::INFO)); /// Destructor ~PassiveLayerBuilder() override = default; @@ -87,7 +88,8 @@ class PassiveLayerBuilder : public ILayerBuilder { /// Name identification /// @return the string based identification - const std::string& identification() const override { + const std::string& + identification() const override { return m_cfg.layerIdentification; } @@ -118,14 +120,17 @@ class PassiveLayerBuilder : public ILayerBuilder { /// @return the layers at positive side const LayerVector endcapLayers(const GeometryContext& gctx, int side) const; - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// logging instance std::unique_ptr<const Logger> m_logger; }; -inline PassiveLayerBuilder::Config PassiveLayerBuilder::getConfiguration() - const { +inline PassiveLayerBuilder::Config +PassiveLayerBuilder::getConfiguration() const { return m_cfg; } diff --git a/Core/include/Acts/Geometry/PlaneLayer.hpp b/Core/include/Acts/Geometry/PlaneLayer.hpp index 985bbf4e3..fe77df711 100644 --- a/Core/include/Acts/Geometry/PlaneLayer.hpp +++ b/Core/include/Acts/Geometry/PlaneLayer.hpp @@ -37,15 +37,21 @@ class PlaneLayer : virtual public PlaneSurface, public Layer { /// @param laytyp is the layer type /// /// @return shared pointer to a PlaneLayer - static MutableLayerPtr create( + static MutableLayerPtr + create( std::shared_ptr<const Transform3D> transform, std::shared_ptr<const PlanarBounds> pbounds, std::unique_ptr<SurfaceArray> surfaceArray = nullptr, - double thickness = 0., std::unique_ptr<ApproachDescriptor> ad = nullptr, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ad = nullptr, LayerType laytyp = Acts::active) { - return MutableLayerPtr(new PlaneLayer(std::move(transform), pbounds, - std::move(surfaceArray), thickness, - std::move(ad), laytyp)); + return MutableLayerPtr(new PlaneLayer( + std::move(transform), + pbounds, + std::move(surfaceArray), + thickness, + std::move(ad), + laytyp)); } /// Default Constructor - deleted @@ -82,12 +88,13 @@ class PlaneLayer : virtual public PlaneSurface, public Layer { /// @param laytyp is the layer type /// /// @return shared pointer to a PlaneLayer - PlaneLayer(std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const PlanarBounds>& pbounds, - std::unique_ptr<SurfaceArray> surfaceArray = nullptr, - double thickness = 0., - std::unique_ptr<ApproachDescriptor> ades = nullptr, - LayerType laytyp = Acts::active); + PlaneLayer( + std::shared_ptr<const Transform3D> transform, + std::shared_ptr<const PlanarBounds>& pbounds, + std::unique_ptr<SurfaceArray> surfaceArray = nullptr, + double thickness = 0., + std::unique_ptr<ApproachDescriptor> ades = nullptr, + LayerType laytyp = Acts::active); /// Private constructor for a PlaneLayer, is called by create(arge* /// diff --git a/Core/include/Acts/Geometry/ProtoLayer.hpp b/Core/include/Acts/Geometry/ProtoLayer.hpp index 2274646e5..8a354e1c8 100644 --- a/Core/include/Acts/Geometry/ProtoLayer.hpp +++ b/Core/include/Acts/Geometry/ProtoLayer.hpp @@ -52,8 +52,9 @@ struct ProtoLayer { /// /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The vector of surfaces to consider - ProtoLayer(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces); + ProtoLayer( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces); /// Constructor /// @@ -63,8 +64,9 @@ struct ProtoLayer { /// /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The vector of surfaces to consider - ProtoLayer(const GeometryContext& gctx, - const std::vector<std::shared_ptr<const Surface>>& surfaces); + ProtoLayer( + const GeometryContext& gctx, + const std::vector<std::shared_ptr<const Surface>>& surfaces); // normal empty constructor ProtoLayer() = default; @@ -84,7 +86,8 @@ struct ProtoLayer { /// /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The surfaces to build this protolayer out of - void measure(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces); + void measure( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces); }; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp index 0f41caa01..779a91bfc 100644 --- a/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Geometry/SurfaceArrayCreator.hpp @@ -30,7 +30,10 @@ struct SurfaceArrayCreatorFixture; } using SurfaceMatcher = std::function<bool( - const GeometryContext& gctx, BinningValue, const Surface*, const Surface*)>; + const GeometryContext& gctx, + BinningValue, + const Surface*, + const Surface*)>; using SurfaceVector = std::vector<const Surface*>; using SurfaceMatrix = std::vector<SurfaceVector>; @@ -56,7 +59,8 @@ class SurfaceArrayCreator { double max; std::vector<double> binEdges; - size_t getBin(double x) const { + size_t + getBin(double x) const { if (binEdges.empty()) { // equidistant double w = (max - min) / nBins; @@ -85,16 +89,18 @@ class SurfaceArrayCreator { /// Constructor with default config /// /// @param logger logging instance - SurfaceArrayCreator(std::unique_ptr<const Logger> logger = getDefaultLogger( - "SurfaceArrayCreator", Logging::INFO)) + SurfaceArrayCreator( + std::unique_ptr<const Logger> logger = + getDefaultLogger("SurfaceArrayCreator", Logging::INFO)) : m_cfg(Config()), m_logger(std::move(logger)) {} /// Constructor with explicit config /// /// @param cfg Explicit config struct /// @param logger logging instance - SurfaceArrayCreator(const Config& cfg, - std::unique_ptr<const Logger> logger = getDefaultLogger( - "SurfaceArrayCreator", Logging::INFO)) + SurfaceArrayCreator( + const Config& cfg, + std::unique_ptr<const Logger> logger = + getDefaultLogger("SurfaceArrayCreator", Logging::INFO)) : m_cfg(cfg), m_logger(std::move(logger)) {} /// Destructor @@ -118,8 +124,10 @@ class SurfaceArrayCreator { /// @return a unique pointer to a new SurfaceArray 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsPhi, + size_t binsZ, + boost::optional<ProtoLayer> protoLayerOpt = boost::none, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// SurfaceArrayCreator interface method @@ -142,7 +150,8 @@ class SurfaceArrayCreator { std::unique_ptr<Acts::SurfaceArray> surfaceArrayOnCylinder( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, - BinningType bTypePhi = equidistant, BinningType bTypeZ = equidistant, + BinningType bTypePhi = equidistant, + BinningType bTypeZ = equidistant, boost::optional<ProtoLayer> protoLayerOpt = boost::none, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; @@ -164,8 +173,10 @@ class SurfaceArrayCreator { /// @return a unique pointer a new SurfaceArray 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsR, + size_t binsPhi, + boost::optional<ProtoLayer> protoLayerOpt = boost::none, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; /// SurfaceArrayCreator interface method @@ -190,7 +201,8 @@ class SurfaceArrayCreator { /// This ignores bTypePhi and produces equidistant binning in phi std::unique_ptr<Acts::SurfaceArray> surfaceArrayOnDisc( const GeometryContext& gctx, - std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, + std::vector<std::shared_ptr<const Surface>> surfaces, + BinningType bTypeR, BinningType bTypePhi, boost::optional<ProtoLayer> protoLayerOpt = boost::none, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; @@ -217,8 +229,10 @@ class SurfaceArrayCreator { /// @return a unique pointer a new SurfaceArray std::unique_ptr<SurfaceArray> surfaceArrayOnPlane( const GeometryContext& gctx, - std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, - size_t bins2, BinningValue bValue = BinningValue::binX, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t bins1, + size_t bins2, + BinningValue bValue = BinningValue::binX, boost::optional<ProtoLayer> protoLayerOpt = boost::none, const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; @@ -228,9 +242,12 @@ class SurfaceArrayCreator { /// @param bValue the binning value for the binning /// @param a first surface for checking /// @param b second surface for checking - static bool isSurfaceEquivalent(const GeometryContext& gctx, - BinningValue bValue, const Surface* a, - const Surface* b) { + static bool + isSurfaceEquivalent( + const GeometryContext& gctx, + BinningValue bValue, + const Surface* a, + const Surface* b) { using namespace UnitLiterals; using VectorHelpers::perp; @@ -253,13 +270,17 @@ class SurfaceArrayCreator { } if (bValue == Acts::binZ) { - return (std::abs(a->binningPosition(gctx, binR).z() - - b->binningPosition(gctx, binR).z()) < 1_um); + return ( + std::abs( + a->binningPosition(gctx, binR).z() - + b->binningPosition(gctx, binR).z()) < 1_um); } if (bValue == Acts::binR) { - return (std::abs(perp(a->binningPosition(gctx, binR)) - - perp(b->binningPosition(gctx, binR))) < 1_um); + return ( + std::abs( + perp(a->binningPosition(gctx, binR)) - + perp(b->binningPosition(gctx, binR))) < 1_um); } return false; @@ -267,7 +288,8 @@ class SurfaceArrayCreator { /// Set logging instance /// @param logger is the logging instance to be set - void setLogger(std::unique_ptr<const Logger> logger) { + void + setLogger(std::unique_ptr<const Logger> logger) { m_logger = std::move(logger); } @@ -276,15 +298,19 @@ class SurfaceArrayCreator { Config m_cfg; /// Private access to logger - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } std::vector<const Surface*> findKeySurfaces( const std::vector<const Surface*>& surfaces, const std::function<bool(const Surface*, const Surface*)>& equal) const; - size_t determineBinCount(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces, - BinningValue bValue) const; + size_t determineBinCount( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, + BinningValue bValue) const; /// SurfaceArrayCreator internal method /// Creates a variable @c ProtoAxis from a vector of (unsorted) surfaces with @@ -307,10 +333,12 @@ class SurfaceArrayCreator { /// @return Instance of @c ProtoAxis containing determined properties /// @note This only creates the @c ProtoAxis, this needs to be turned /// into an actual @c Axis object to be used - ProtoAxis createVariableAxis(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces, - BinningValue bValue, ProtoLayer protoLayer, - Transform3D& transform) const; + ProtoAxis createVariableAxis( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, + BinningValue bValue, + ProtoLayer protoLayer, + Transform3D& transform) const; /// SurfaceArrayCreator internal method /// Creates a equidistant @c ProtoAxis when the extremas and the bin number @@ -333,11 +361,13 @@ class SurfaceArrayCreator { /// @return Instance of @c ProtoAxis containing determined properties /// @note This only creates the @c ProtoAxis, this needs to be turned /// into an actual @c Axis object to be used - ProtoAxis createEquidistantAxis(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces, - BinningValue bValue, ProtoLayer protoLayer, - Transform3D& transform, - size_t nBins = 0) const; + ProtoAxis createEquidistantAxis( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, + BinningValue bValue, + ProtoLayer protoLayer, + Transform3D& transform, + size_t nBins = 0) const; /// SurfaceArrayCreator internal method /// @brief Creates a SurfaceGridLookup instance within an any @@ -351,11 +381,17 @@ class SurfaceArrayCreator { /// @param localToGlobal transform callable /// @param pAxisA ProtoAxis object for axis A /// @param pAxisB ProtoAxis object for axis B - template <detail::AxisBoundaryType bdtA, detail::AxisBoundaryType bdtB, - typename F1, typename F2> + template < + detail::AxisBoundaryType bdtA, + detail::AxisBoundaryType bdtB, + typename F1, + typename F2> static std::unique_ptr<SurfaceArray::ISurfaceGridLookup> - makeSurfaceGridLookup2D(F1 globalToLocal, F2 localToGlobal, ProtoAxis pAxisA, - ProtoAxis pAxisB) { + makeSurfaceGridLookup2D( + F1 globalToLocal, + F2 localToGlobal, + ProtoAxis pAxisA, + ProtoAxis pAxisB) { using ISGL = SurfaceArray::ISurfaceGridLookup; std::unique_ptr<ISGL> ptr; @@ -422,17 +458,19 @@ class SurfaceArrayCreator { /// @param [in] gctx the geometry context for this call /// @param sl The @c SurfaceGridLookup /// @param surfaces the surfaces - void completeBinning(const GeometryContext& gctx, - SurfaceArray::ISurfaceGridLookup& sl, - const std::vector<const Surface*>& surfaces) const { + void + completeBinning( + const GeometryContext& gctx, + SurfaceArray::ISurfaceGridLookup& sl, + const std::vector<const Surface*>& surfaces) const { ACTS_VERBOSE( "Complete binning by filling closest neighbour surfaces into " "empty bins."); size_t binCompleted = sl.completeBinning(gctx, surfaces); - ACTS_VERBOSE(" filled : " << binCompleted - << " (includes under/overflow)"); + ACTS_VERBOSE( + " filled : " << binCompleted << " (includes under/overflow)"); } /// Private helper method to transform the vertices of surface bounds into @@ -442,7 +480,8 @@ class SurfaceArrayCreator { /// @param locVertices a vector of the vertices in local coordinates /// @return a vector of the vertices in global coordinates std::vector<Acts::Vector3D> makeGlobalVertices( - const GeometryContext& gctx, const Acts::Surface& surface, + const GeometryContext& gctx, + const Acts::Surface& surface, const std::vector<Acts::Vector2D>& locVertices) const; }; diff --git a/Core/include/Acts/Geometry/TrackingGeometry.hpp b/Core/include/Acts/Geometry/TrackingGeometry.hpp index e7a94ca6f..8cd7cd446 100644 --- a/Core/include/Acts/Geometry/TrackingGeometry.hpp +++ b/Core/include/Acts/Geometry/TrackingGeometry.hpp @@ -50,8 +50,9 @@ class TrackingGeometry { /// @param highestVolume is the world volume /// @param materialDecorator is a dediated decorator that can assign /// surface or volume based material to the TrackingVolume - TrackingGeometry(const MutableTrackingVolumePtr& highestVolume, - const IMaterialDecorator* materialDecorator = nullptr); + TrackingGeometry( + const MutableTrackingVolumePtr& highestVolume, + const IMaterialDecorator* materialDecorator = nullptr); /// Destructor ~TrackingGeometry(); @@ -66,8 +67,9 @@ class TrackingGeometry { /// @param gp is the global position of the call /// /// @return plain pointer to the lowest TrackingVolume - const TrackingVolume* lowestTrackingVolume(const GeometryContext& gctx, - const Vector3D& gp) const; + const TrackingVolume* lowestTrackingVolume( + const GeometryContext& gctx, + const Vector3D& gp) const; /// return the lowest tracking Volume /// @@ -82,8 +84,8 @@ class TrackingGeometry { /// @param gp is the global position of the call /// /// @return plain pointer to assocaiated layer - const Layer* associatedLayer(const GeometryContext& gctx, - const Vector3D& gp) const; + const Layer* associatedLayer(const GeometryContext& gctx, const Vector3D& gp) + const; /// Register the beam tube /// diff --git a/Core/include/Acts/Geometry/TrackingGeometryBuilder.hpp b/Core/include/Acts/Geometry/TrackingGeometryBuilder.hpp index 98a8714cc..ba80df5e6 100644 --- a/Core/include/Acts/Geometry/TrackingGeometryBuilder.hpp +++ b/Core/include/Acts/Geometry/TrackingGeometryBuilder.hpp @@ -45,7 +45,8 @@ class TrackingGeometryBuilder : public ITrackingGeometryBuilder { struct Config { /// The list of tracking volume builders std::vector<std::function<std::shared_ptr<TrackingVolume>( - const GeometryContext& gctx, const TrackingVolumePtr&, + const GeometryContext& gctx, + const TrackingVolumePtr&, const VolumeBoundsPtr&)>> trackingVolumeBuilders; @@ -60,10 +61,10 @@ class TrackingGeometryBuilder : public ITrackingGeometryBuilder { /// /// @param [in] cgbConfig is the configuration struct for this builder /// @param [in] logger logging instance - TrackingGeometryBuilder(const Config& cgbConfig, - std::unique_ptr<const Logger> logger = - getDefaultLogger("TrackingGeometryBuilder", - Logging::INFO)); + TrackingGeometryBuilder( + const Config& cgbConfig, + std::unique_ptr<const Logger> logger = + getDefaultLogger("TrackingGeometryBuilder", Logging::INFO)); /// Destructor ~TrackingGeometryBuilder() override = default; @@ -94,7 +95,10 @@ class TrackingGeometryBuilder : public ITrackingGeometryBuilder { Config m_cfg; /// Private access method to the logger - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// the logging instance std::unique_ptr<const Logger> m_logger; diff --git a/Core/include/Acts/Geometry/TrackingVolume.hpp b/Core/include/Acts/Geometry/TrackingVolume.hpp index 71e19aa73..bdd9fbf3f 100644 --- a/Core/include/Acts/Geometry/TrackingVolume.hpp +++ b/Core/include/Acts/Geometry/TrackingVolume.hpp @@ -92,14 +92,18 @@ class TrackingVolume : public Volume { /// @param volumeName is a string identifier /// /// @return shared pointer to a new TrackingVolume - static MutableTrackingVolumePtr create( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volumeBounds, + static MutableTrackingVolumePtr + create( + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volumeBounds, const std::shared_ptr<const TrackingVolumeArray>& containedVolumes = nullptr, const std::string& volumeName = "undefined") { - return MutableTrackingVolumePtr( - new TrackingVolume(std::move(htrans), std::move(volumeBounds), - containedVolumes, volumeName)); + return MutableTrackingVolumePtr(new TrackingVolume( + std::move(htrans), + std::move(volumeBounds), + containedVolumes, + volumeName)); } /// Factory constructor for Tracking Volume with a bounding volume hierarchy @@ -113,16 +117,23 @@ class TrackingVolume : public Volume { /// @param volumeName is a string identifier /// /// @return shared pointer to a new TrackingVolume - static MutableTrackingVolumePtr create( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volbounds, + static MutableTrackingVolumePtr + create( + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volbounds, std::vector<std::unique_ptr<Volume::BoundingBox>> boxStore, std::vector<std::unique_ptr<const Volume>> descendants, const Volume::BoundingBox* top, std::shared_ptr<const IVolumeMaterial> volumeMaterial, const std::string& volumeName = "undefined") { return MutableTrackingVolumePtr(new TrackingVolume( - std::move(htrans), std::move(volbounds), std::move(boxStore), - std::move(descendants), top, std::move(volumeMaterial), volumeName)); + std::move(htrans), + std::move(volbounds), + std::move(boxStore), + std::move(descendants), + top, + std::move(volumeMaterial), + volumeName)); } /// Factory constructor for Tracking Volumes with content @@ -136,15 +147,21 @@ class TrackingVolume : public Volume { /// @param volumeName is a string identifier /// /// @return shared pointer to a new TrackingVolume - static MutableTrackingVolumePtr create( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volumeBounds, + static MutableTrackingVolumePtr + create( + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volumeBounds, std::shared_ptr<const IVolumeMaterial> volumeMaterial, std::unique_ptr<const LayerArray> containedLayers = nullptr, std::shared_ptr<const TrackingVolumeArray> containedVolumes = nullptr, const std::string& volumeName = "undefined") { return MutableTrackingVolumePtr(new TrackingVolume( - std::move(htrans), std::move(volumeBounds), std::move(volumeMaterial), - std::move(containedLayers), std::move(containedVolumes), volumeName)); + std::move(htrans), + std::move(volumeBounds), + std::move(volumeMaterial), + std::move(containedLayers), + std::move(containedVolumes), + volumeName)); } /// Return the associated Layer to the global position @@ -153,8 +170,8 @@ class TrackingVolume : public Volume { /// @param gp is the associated global position /// /// @return plain pointer to layer object - const Layer* associatedLayer(const GeometryContext& gctx, - const Vector3D& gp) const; + const Layer* associatedLayer(const GeometryContext& gctx, const Vector3D& gp) + const; /// @brief Resolves the volume into (compatible) Layers /// @@ -169,11 +186,14 @@ class TrackingVolume : public Volume { /// @param corrfnc is the corrector struct / function /// /// @return vector of compatible intersections with layers - template <typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename options_t, + typename corrector_t = VoidIntersectionCorrector> std::vector<LayerIntersection> compatibleLayers( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& corrfnc = corrector_t()) const; /// @brief Resolves the volume into (compatible) Layers @@ -189,10 +209,13 @@ class TrackingVolume : public Volume { /// @param corrfnc is the corrector struct / function /// /// @return vector of compatible intersections with layers - template <typename parameters_t, typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename parameters_t, + typename options_t, + typename corrector_t = VoidIntersectionCorrector> std::vector<LayerIntersection> compatibleLayers( - const GeometryContext& gctx, const parameters_t& parameters, + const GeometryContext& gctx, + const parameters_t& parameters, const options_t& options, const corrector_t& corrfnc = corrector_t()) const; @@ -210,12 +233,15 @@ class TrackingVolume : public Volume { /// @param sorter Sorter of the boundary surfaces /// /// @return is the templated boundary intersection - template <typename options_t, - typename corrector_t = VoidIntersectionCorrector, - typename sorter_t = DefaultBoundaryIntersectionSorter> + template < + typename options_t, + typename corrector_t = VoidIntersectionCorrector, + typename sorter_t = DefaultBoundaryIntersectionSorter> std::vector<BoundaryIntersection> compatibleBoundaries( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& corrfnc = corrector_t(), const sorter_t& sorter = sorter_t()) const; @@ -233,12 +259,16 @@ class TrackingVolume : public Volume { /// @param sorter Sorter of the boundary surfaces /// /// @return is the templated boundary intersection - template <typename parameters_t, typename options_t, - typename corrector_t = VoidIntersectionCorrector, - typename sorter_t = DefaultBoundaryIntersectionSorter> + template < + typename parameters_t, + typename options_t, + typename corrector_t = VoidIntersectionCorrector, + typename sorter_t = DefaultBoundaryIntersectionSorter> std::vector<BoundaryIntersection> compatibleBoundaries( - const GeometryContext& gctx, const parameters_t& parameters, - const options_t& options, const corrector_t& corrfnc = corrector_t(), + const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc = corrector_t(), const sorter_t& sorter = sorter_t()) const; /// @brief Return surfaces in given direction from bounding volume hierarchy @@ -253,11 +283,15 @@ class TrackingVolume : public Volume { /// @param corrfnc is the corrector struct / function /// /// @return Vector of surface candidates - template <typename options_t, - typename corrector_t = VoidIntersectionCorrector> + template < + typename options_t, + typename corrector_t = VoidIntersectionCorrector> std::vector<SurfaceIntersection> compatibleSurfacesFromHierarchy( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, double angle, const options_t& options, + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + double angle, + const options_t& options, const corrector_t& corrfnc = corrector_t()) const; /// Return the associated sub Volume, returns THIS if no subVolume exists @@ -266,8 +300,9 @@ class TrackingVolume : public Volume { /// @param gp is the global position associated with that search /// /// @return plain pointer to associated with the position - const TrackingVolume* lowestTrackingVolume(const GeometryContext& gctx, - const Vector3D& gp) const; + const TrackingVolume* lowestTrackingVolume( + const GeometryContext& gctx, + const Vector3D& gp) const; /// Return the confined static layer array - if it exists /// @return the BinnedArray of static layers if exists @@ -312,10 +347,11 @@ class TrackingVolume : public Volume { /// @param bsfMine is the boundary face indicater where to glue /// @param neighbor is the TrackingVolume to be glued /// @param bsfNeighbor is the boudnary surface of the neighbor - void glueTrackingVolume(const GeometryContext& gctx, - BoundarySurfaceFace bsfMine, - const MutableTrackingVolumePtr& neighbor, - BoundarySurfaceFace bsfNeighbor); + void glueTrackingVolume( + const GeometryContext& gctx, + BoundarySurfaceFace bsfMine, + const MutableTrackingVolumePtr& neighbor, + BoundarySurfaceFace bsfNeighbor); /// Glue another tracking volume to this one /// - if common face is set the glued volumes are sharing the boundary, down @@ -326,7 +362,8 @@ class TrackingVolume : public Volume { /// @param neighbors are the TrackingVolumes to be glued /// @param bsfNeighbor are the boudnary surface of the neighbors void glueTrackingVolumes( - const GeometryContext& gctx, BoundarySurfaceFace bsfMine, + const GeometryContext& gctx, + BoundarySurfaceFace bsfMine, const std::shared_ptr<TrackingVolumeArray>& neighbors, BoundarySurfaceFace bsfNeighbor); @@ -400,19 +437,21 @@ class TrackingVolume : public Volume { /// @param volbounds is the description of the volume boundaries /// @param containedVolumeArray are the static volumes that fill this volume /// @param volumeName is a string identifier - TrackingVolume(std::shared_ptr<const Transform3D> htrans, - VolumeBoundsPtr volbounds, - const std::shared_ptr<const TrackingVolumeArray>& - containedVolumeArray = nullptr, - const std::string& volumeName = "undefined"); - - TrackingVolume(std::shared_ptr<const Transform3D> htrans, - VolumeBoundsPtr volbounds, - std::vector<std::unique_ptr<Volume::BoundingBox>> boxStore, - std::vector<std::unique_ptr<const Volume>> descendants, - const Volume::BoundingBox* top, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, - const std::string& volumeName = "undefined"); + TrackingVolume( + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volbounds, + const std::shared_ptr<const TrackingVolumeArray>& containedVolumeArray = + nullptr, + const std::string& volumeName = "undefined"); + + TrackingVolume( + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volbounds, + std::vector<std::unique_ptr<Volume::BoundingBox>> boxStore, + std::vector<std::unique_ptr<const Volume>> descendants, + const Volume::BoundingBox* top, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + const std::string& volumeName = "undefined"); /// Constructor for a full equipped Tracking Volume /// @@ -423,7 +462,8 @@ class TrackingVolume : public Volume { /// @param containedVolumeArray is the confined volume array /// @param volumeName is a string identifier TrackingVolume( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volumeBounds, + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volumeBounds, std::shared_ptr<const IVolumeMaterial> volumeMaterial, std::unique_ptr<const LayerArray> staticLayerArray = nullptr, std::shared_ptr<const TrackingVolumeArray> containedVolumeArray = nullptr, @@ -448,16 +488,18 @@ class TrackingVolume : public Volume { /// @param vol is the geometry id of the volume /// as calculated by the TrackingGeometry /// - void closeGeometry(const IMaterialDecorator* materialDecorator, - std::map<std::string, const TrackingVolume*>& volumeMap, - size_t& vol); + void closeGeometry( + const IMaterialDecorator* materialDecorator, + std::map<std::string, const TrackingVolume*>& volumeMap, + size_t& vol); /// interlink the layers in this TrackingVolume void interlinkLayers(); template <typename T> static std::vector<const Volume*> intersectSearchHierarchy( - const T obj, const Volume::BoundingBox* lnode); + const T obj, + const Volume::BoundingBox* lnode); /// Forbidden copy constructor - deleted TrackingVolume(const TrackingVolume&) = delete; @@ -502,21 +544,24 @@ class TrackingVolume : public Volume { const Volume::BoundingBox* m_bvhTop{nullptr}; }; -inline const std::string& TrackingVolume::volumeName() const { +inline const std::string& +TrackingVolume::volumeName() const { return m_name; } -inline std::shared_ptr<const IVolumeMaterial> TrackingVolume::volumeMaterial() - const { +inline std::shared_ptr<const IVolumeMaterial> +TrackingVolume::volumeMaterial() const { return m_volumeMaterial; } -inline void TrackingVolume::assignVolumeMaterial( +inline void +TrackingVolume::assignVolumeMaterial( std::shared_ptr<const IVolumeMaterial> material) { m_volumeMaterial = std::move(material); } -inline const LayerArray* TrackingVolume::confinedLayers() const { +inline const LayerArray* +TrackingVolume::confinedLayers() const { return m_confinedLayers.get(); } @@ -525,31 +570,38 @@ TrackingVolume::confinedVolumes() const { return m_confinedVolumes; } -inline GeometrySignature TrackingVolume::geometrySignature() const { +inline GeometrySignature +TrackingVolume::geometrySignature() const { return m_geometrySignature; } -inline GeometryType TrackingVolume::geometryType() const { +inline GeometryType +TrackingVolume::geometryType() const { return m_geometryType; } -inline void TrackingVolume::registerColorCode(unsigned int icolor) { +inline void +TrackingVolume::registerColorCode(unsigned int icolor) { m_colorCode = icolor; } -inline unsigned int TrackingVolume::colorCode() const { +inline unsigned int +TrackingVolume::colorCode() const { return m_colorCode; } -inline const TrackingVolume* TrackingVolume::motherVolume() const { +inline const TrackingVolume* +TrackingVolume::motherVolume() const { return m_motherVolume; } -inline void TrackingVolume::setMotherVolume(const TrackingVolume* mvol) { +inline void +TrackingVolume::setMotherVolume(const TrackingVolume* mvol) { m_motherVolume = mvol; } -inline bool TrackingVolume::hasBoundingVolumeHierarchy() const { +inline bool +TrackingVolume::hasBoundingVolumeHierarchy() const { return m_bvhTop != nullptr; } diff --git a/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp b/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp index b2a84a334..5d744b05e 100644 --- a/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Geometry/TrackingVolumeArrayCreator.hpp @@ -39,10 +39,10 @@ class TrackingVolumeArrayCreator : public ITrackingVolumeArrayCreator { /// Constructor /// /// @param logger logging instance - TrackingVolumeArrayCreator(const Config& /*cfg*/, - std::unique_ptr<const Logger> logger = - getDefaultLogger("LayerArrayCreator", - Logging::INFO)) + TrackingVolumeArrayCreator( + const Config& /*cfg*/, + std::unique_ptr<const Logger> logger = + getDefaultLogger("LayerArrayCreator", Logging::INFO)) : m_logger(std::move(logger)) {} /// Destructor @@ -56,19 +56,24 @@ class TrackingVolumeArrayCreator : public ITrackingVolumeArrayCreator { /// /// @return new created volume array std::shared_ptr<const TrackingVolumeArray> trackingVolumeArray( - const GeometryContext& gctx, const TrackingVolumeVector& tVolumes, + const GeometryContext& gctx, + const TrackingVolumeVector& tVolumes, BinningValue bValue) const override; /// Set logging instance /// /// @param logger is the logging instance to be set - void setLogger(std::unique_ptr<const Logger> logger) { + void + setLogger(std::unique_ptr<const Logger> logger) { m_logger = std::move(logger); } private: // Private access to the logger method - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// logging instance std::unique_ptr<const Logger> m_logger; diff --git a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp index 3540e263d..b8170cf31 100644 --- a/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp +++ b/Core/include/Acts/Geometry/TrapezoidVolumeBounds.hpp @@ -69,8 +69,11 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// @param maxhalex is the half length in x at maximal y /// @param haley is the half length in y /// @param halez is the half length in z - TrapezoidVolumeBounds(double minhalex, double maxhalex, double haley, - double halez); + TrapezoidVolumeBounds( + double minhalex, + double maxhalex, + double haley, + double halez); /// Constructor - the trapezoid boundaries (arbitrary trapezoid) /// @@ -79,8 +82,12 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// @param halez is the half length in z /// @param alpha is the openeing angle at -x,-y /// @param beta is the openeing angle at +x,-y - TrapezoidVolumeBounds(double minhalex, double haley, double halez, - double alpha, double beta); + TrapezoidVolumeBounds( + double minhalex, + double haley, + double halez, + double alpha, + double beta); /// Copy Constructor /// @param trabo The object to be copied @@ -119,9 +126,10 @@ class TrapezoidVolumeBounds : public VolumeBounds { /// @param envelope Optional envelope to add / subtract from min/max /// @param entity Entity to associate this bounding box with /// @return Constructed bounding box - Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr, - const Vector3D& envelope = {0, 0, 0}, - const Volume* entity = nullptr) const final; + Volume::BoundingBox boundingBox( + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, + const Volume* entity = nullptr) const final; /// This method returns the minimal halflength in local x double minHalflengthX() const; @@ -173,31 +181,39 @@ class TrapezoidVolumeBounds : public VolumeBounds { std::vector<TDD_real_t> m_valueStore; }; -inline TrapezoidVolumeBounds* TrapezoidVolumeBounds::clone() const { +inline TrapezoidVolumeBounds* +TrapezoidVolumeBounds::clone() const { return new TrapezoidVolumeBounds(*this); } -inline double TrapezoidVolumeBounds::minHalflengthX() const { +inline double +TrapezoidVolumeBounds::minHalflengthX() const { return m_valueStore.at(bv_minHalfX); } -inline double TrapezoidVolumeBounds::maxHalflengthX() const { +inline double +TrapezoidVolumeBounds::maxHalflengthX() const { return m_valueStore.at(bv_maxHalfX); } -inline double TrapezoidVolumeBounds::halflengthY() const { +inline double +TrapezoidVolumeBounds::halflengthY() const { return m_valueStore.at(bv_halfY); } -inline double TrapezoidVolumeBounds::halflengthZ() const { +inline double +TrapezoidVolumeBounds::halflengthZ() const { return m_valueStore.at(bv_halfZ); } -inline double TrapezoidVolumeBounds::alpha() const { +inline double +TrapezoidVolumeBounds::alpha() const { return m_valueStore.at(bv_alpha); } -inline double TrapezoidVolumeBounds::beta() const { +inline double +TrapezoidVolumeBounds::beta() const { return m_valueStore.at(bv_beta); } template <class T> -T& TrapezoidVolumeBounds::dumpT(T& dt) const { +T& +TrapezoidVolumeBounds::dumpT(T& dt) const { dt << std::setiosflags(std::ios::fixed); dt << std::setprecision(5); dt << "Acts::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) " diff --git a/Core/include/Acts/Geometry/Volume.hpp b/Core/include/Acts/Geometry/Volume.hpp index ea2b86f35..972ee7723 100644 --- a/Core/include/Acts/Geometry/Volume.hpp +++ b/Core/include/Acts/Geometry/Volume.hpp @@ -44,8 +44,9 @@ class Volume : public virtual GeometryObject { /// @param volbounds is the volume boundary definitions /// @note This will automatically build an oriented bounding box with an /// envelope value of (0.05, 0.05, 0.05)mm - Volume(const std::shared_ptr<const Transform3D>& htrans, - VolumeBoundsPtr volbounds); + Volume( + const std::shared_ptr<const Transform3D>& htrans, + VolumeBoundsPtr volbounds); /// Copy Constructor - with optional shift /// @@ -102,8 +103,9 @@ class Volume : public virtual GeometryObject { /// @param bValue is the binning value schema /// /// @return vector 3D that can be used for the binning - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const override; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const override; protected: std::shared_ptr<const Transform3D> m_transform; @@ -113,22 +115,26 @@ class Volume : public virtual GeometryObject { BoundingBox m_orientedBoundingBox; }; -inline const Transform3D& Volume::transform() const { +inline const Transform3D& +Volume::transform() const { if (m_transform) { return (*(m_transform.get())); } return Acts::s_idTransform; } -inline const Transform3D& Volume::itransform() const { +inline const Transform3D& +Volume::itransform() const { return m_itransform; } -inline const Vector3D& Volume::center() const { +inline const Vector3D& +Volume::center() const { return m_center; } -inline const VolumeBounds& Volume::volumeBounds() const { +inline const VolumeBounds& +Volume::volumeBounds() const { return (*(m_volumeBounds.get())); } diff --git a/Core/include/Acts/Geometry/VolumeBounds.hpp b/Core/include/Acts/Geometry/VolumeBounds.hpp index b141b5b70..c5c484a37 100644 --- a/Core/include/Acts/Geometry/VolumeBounds.hpp +++ b/Core/include/Acts/Geometry/VolumeBounds.hpp @@ -76,7 +76,8 @@ class VolumeBounds { /// @param entity Entity to associate this bounding box with /// @return Constructed bounding box virtual Volume::BoundingBox boundingBox( - const Transform3D* trf = nullptr, const Vector3D& envelope = {0, 0, 0}, + const Transform3D* trf = nullptr, + const Vector3D& envelope = {0, 0, 0}, const Volume* entity = nullptr) const = 0; /// Binning offset - overloaded for some R-binning types @@ -105,7 +106,8 @@ inline Vector3D VolumeBounds::binningOffset( return Vector3D(0., 0., 0.); } -inline double VolumeBounds::binningBorder(BinningValue /*bValue*/) const { +inline double +VolumeBounds::binningBorder(BinningValue /*bValue*/) const { return 0.; } diff --git a/Core/include/Acts/Geometry/detail/BoundaryIntersectionSorter.hpp b/Core/include/Acts/Geometry/detail/BoundaryIntersectionSorter.hpp index 4b3d4f7a9..0a7e4ad12 100644 --- a/Core/include/Acts/Geometry/detail/BoundaryIntersectionSorter.hpp +++ b/Core/include/Acts/Geometry/detail/BoundaryIntersectionSorter.hpp @@ -51,24 +51,29 @@ struct DefaultBoundaryIntersectionSorter { /// @return Vector of intersections with the boundaries ordered by the /// intersection probability template <typename options_t, typename corrector_t> - std::vector<BoundaryIntersection> operator()( + std::vector<BoundaryIntersection> + operator()( const GeometryContext& gctx, std::vector<const BoundarySurfaceT<TrackingVolume>*>& boundaries, - const Vector3D& position, const Vector3D& direction, - const options_t& options, const corrector_t& corrfnc) const { + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc) const { std::vector<BoundaryIntersection> bIntersections; for (auto& bSurface : boundaries) { const auto& bSurfaceRep = bSurface->surfaceRepresentation(); // intersect the surface SurfaceIntersection bsIntersection = - bSurfaceRep.surfaceIntersectionEstimate(gctx, position, direction, - options, corrfnc); + bSurfaceRep.surfaceIntersectionEstimate( + gctx, position, direction, options, corrfnc); // check if the intersection is valid, but exlude the on-surface case // when requested -- move to intersectionestimate if (bsIntersection) { - bIntersections.push_back( - BoundaryIntersection(bsIntersection.intersection, bSurface, - &bSurfaceRep, options.navDir)); + bIntersections.push_back(BoundaryIntersection( + bsIntersection.intersection, + bSurface, + &bSurfaceRep, + options.navDir)); } } // and now sort to get the closest - need custom sort here to respect sign @@ -118,11 +123,14 @@ struct BoundaryIntersectionSorter { /// @return Vector of intersections with the boundaries ordered by the /// intersection probability template <typename options_t, typename corrector_t> - std::vector<BoundaryIntersection> operator()( + std::vector<BoundaryIntersection> + operator()( const GeometryContext& gctx, std::vector<const BoundarySurfaceT<TrackingVolume>*>& boundaries, - const Vector3D& position, const Vector3D& direction, - const options_t& options, const corrector_t& corrfnc) const { + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc) const { // Resulting vector std::vector<BoundaryIntersection> bIntersections, bIntersectionsOtherNavDir; bIntersections.reserve(boundaries.size()); @@ -168,21 +176,24 @@ struct BoundaryIntersectionSorter { // Sort both lists if (options.navDir == forward) { std::sort(bIntersections.begin(), bIntersections.end()); - std::sort(bIntersectionsOtherNavDir.begin(), - bIntersectionsOtherNavDir.end(), std::greater<>()); + std::sort( + bIntersectionsOtherNavDir.begin(), + bIntersectionsOtherNavDir.end(), + std::greater<>()); } else { std::sort(bIntersections.begin(), bIntersections.end(), std::greater<>()); - std::sort(bIntersectionsOtherNavDir.begin(), - bIntersectionsOtherNavDir.end()); + std::sort( + bIntersectionsOtherNavDir.begin(), bIntersectionsOtherNavDir.end()); } // @p bIntersectionsOtherNavDir is sorted such that the backwards elements // are in front and then the non-interacting elements. So, they get inserted // in inverted order to preserve the probability ordering in the original // direction. - bIntersections.insert(bIntersections.end(), - bIntersectionsOtherNavDir.rbegin(), - bIntersectionsOtherNavDir.rend()); + bIntersections.insert( + bIntersections.end(), + bIntersectionsOtherNavDir.rbegin(), + bIntersectionsOtherNavDir.rend()); return bIntersections; } @@ -203,17 +214,20 @@ struct BoundaryIntersectionSorter { /// /// @return Intersection object of the boundary surface template <typename options_t, typename corrector_t> - BoundaryIntersection intersect( + BoundaryIntersection + intersect( const GeometryContext& gctx, const BoundarySurfaceT<TrackingVolume>* boundary, - const Vector3D& position, const Vector3D& direction, - const options_t& options, const corrector_t& corrfnc) const { + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc) const { const Surface* surface = &(boundary->surfaceRepresentation()); // intersect the surface SurfaceIntersection bsIntersection = surface->surfaceIntersectionEstimate( gctx, position, direction, options, corrfnc); - return BoundaryIntersection(bsIntersection.intersection, boundary, surface, - options.navDir); + return BoundaryIntersection( + bsIntersection.intersection, boundary, surface, options.navDir); } }; } // namespace Acts diff --git a/Core/include/Acts/Geometry/detail/DefaultDetectorElementBase.hpp b/Core/include/Acts/Geometry/detail/DefaultDetectorElementBase.hpp index eb8b1dc5e..43208a5fa 100644 --- a/Core/include/Acts/Geometry/detail/DefaultDetectorElementBase.hpp +++ b/Core/include/Acts/Geometry/detail/DefaultDetectorElementBase.hpp @@ -91,7 +91,8 @@ DetectorElementBase::neighbours() const { return m_neighbours; } -inline void DetectorElementBase::registerBinmembers( +inline void +DetectorElementBase::registerBinmembers( std::vector<const DetectorElementBase*>& binmembers) { for (auto& bmember : binmembers) { // only fill if it's not yet registered @@ -102,7 +103,8 @@ inline void DetectorElementBase::registerBinmembers( } } -inline void DetectorElementBase::registerNeighbours( +inline void +DetectorElementBase::registerNeighbours( std::vector<const DetectorElementBase*>& neighbours) { for (auto& neighbour : neighbours) { // only fill if it's not yet registered diff --git a/Core/include/Acts/Geometry/detail/Layer.ipp b/Core/include/Acts/Geometry/detail/Layer.ipp index 23c50d00e..23745bcc4 100644 --- a/Core/include/Acts/Geometry/detail/Layer.ipp +++ b/Core/include/Acts/Geometry/detail/Layer.ipp @@ -10,37 +10,46 @@ namespace Acts { -inline const SurfaceArray* Layer::surfaceArray() const { +inline const SurfaceArray* +Layer::surfaceArray() const { return m_surfaceArray.get(); } -inline SurfaceArray* Layer::surfaceArray() { +inline SurfaceArray* +Layer::surfaceArray() { return const_cast<SurfaceArray*>(m_surfaceArray.get()); } -inline double Layer::thickness() const { +inline double +Layer::thickness() const { return m_layerThickness; } -inline LayerType Layer::layerType() const { +inline LayerType +Layer::layerType() const { return m_layerType; } -inline const TrackingVolume* Layer::trackingVolume() const { +inline const TrackingVolume* +Layer::trackingVolume() const { return m_trackingVolume; } -inline void Layer::encloseTrackingVolume(const TrackingVolume& tvol) { +inline void +Layer::encloseTrackingVolume(const TrackingVolume& tvol) { m_trackingVolume = &(tvol); } -inline const AbstractVolume* Layer::representingVolume() const { +inline const AbstractVolume* +Layer::representingVolume() const { return m_representingVolume.get(); } -inline const Layer* Layer::nextLayer(const GeometryContext& /*gctx*/, - const Vector3D& gp, - const Vector3D& mom) const { +inline const Layer* +Layer::nextLayer( + const GeometryContext& /*gctx*/, + const Vector3D& gp, + const Vector3D& mom) const { // no binutility -> no chance to find out the direction if (m_nextLayerUtility == nullptr) { return nullptr; @@ -49,8 +58,9 @@ inline const Layer* Layer::nextLayer(const GeometryContext& /*gctx*/, : m_nextLayers.second; } -inline bool Layer::resolve(bool resolveSensitive, bool resolveMaterial, - bool resolvePassive) const { +inline bool +Layer::resolve(bool resolveSensitive, bool resolveMaterial, bool resolvePassive) + const { if (resolvePassive) { return true; } @@ -66,15 +76,21 @@ inline bool Layer::resolve(bool resolveSensitive, bool resolveMaterial, } template <typename parameters_t> -bool Layer::onLayer(const GeometryContext& gctx, const parameters_t& pars, - const BoundaryCheck& bcheck) const { +bool +Layer::onLayer( + const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck) const { return isOnLayer(gctx, pars.position(), bcheck); } template <typename options_t, typename corrector_t> -std::vector<SurfaceIntersection> Layer::compatibleSurfaces( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& momentum, const options_t& options, +std::vector<SurfaceIntersection> +Layer::compatibleSurfaces( + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& momentum, + const options_t& options, const corrector_t& corrfnc) const { // the list of valid intersection std::vector<SurfaceIntersection> sIntersections; @@ -120,8 +136,8 @@ std::vector<SurfaceIntersection> Layer::compatibleSurfaces( } // lemma 0 : accept the surface - auto acceptSurface = [&options, &accepted](const Surface& sf, - bool sensitive = false) -> bool { + auto acceptSurface = [&options, &accepted]( + const Surface& sf, bool sensitive = false) -> bool { // check for duplicates if (accepted.find(&sf) != accepted.end()) { return false; @@ -213,17 +229,23 @@ std::vector<SurfaceIntersection> Layer::compatibleSurfaces( } template <typename parameters_t, typename options_t, typename corrector_t> -std::vector<SurfaceIntersection> Layer::compatibleSurfaces( - const GeometryContext& gctx, const parameters_t& parameters, - const options_t& options, const corrector_t& corrfnc) const { - return compatibleSurfaces(gctx, parameters.position(), parameters.momentum(), - options, corrfnc); +std::vector<SurfaceIntersection> +Layer::compatibleSurfaces( + const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { + return compatibleSurfaces( + gctx, parameters.position(), parameters.momentum(), options, corrfnc); } template <typename options_t, typename corrector_t> -const SurfaceIntersection Layer::surfaceOnApproach( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, +const SurfaceIntersection +Layer::surfaceOnApproach( + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& corrfnc) const { // resolve directive based by options // - options.resolvePassive is on -> always @@ -249,7 +271,11 @@ const SurfaceIntersection Layer::surfaceOnApproach( // that's the collect trigger for always collecting // let's find the most suitable approach surface SurfaceIntersection aSurface = m_approachDescriptor->approachSurface( - gctx, position, direction, options.navDir, options.boundaryCheck, + gctx, + position, + direction, + options.navDir, + options.boundaryCheck, corrfnc); if (aSurface.intersection.valid) { return (aSurface); @@ -265,20 +291,26 @@ const SurfaceIntersection Layer::surfaceOnApproach( } // create the intersection with the surface representation - return rSurface.surfaceIntersectionEstimate(gctx, position, direction, - options, corrfnc); + return rSurface.surfaceIntersectionEstimate( + gctx, position, direction, options, corrfnc); } template <typename parameters_t, typename options_t, typename corrector_t> -const SurfaceIntersection Layer::surfaceOnApproach( - const GeometryContext& gctx, const parameters_t& parameters, - const options_t& options, const corrector_t& corrfnc) const { - return surfaceOnApproach(gctx, parameters.position(), parameters.direction(), - options, corrfnc); +const SurfaceIntersection +Layer::surfaceOnApproach( + const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { + return surfaceOnApproach( + gctx, parameters.position(), parameters.direction(), options, corrfnc); } -inline bool Layer::isOnLayer(const GeometryContext& gctx, const Vector3D& gp, - const BoundaryCheck& bcheck) const { +inline bool +Layer::isOnLayer( + const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck) const { if (m_representingVolume != nullptr) { return m_representingVolume->inside(gp); } diff --git a/Core/include/Acts/Geometry/detail/TrackingVolume.ipp b/Core/include/Acts/Geometry/detail/TrackingVolume.ipp index 6fd478351..172156ac2 100644 --- a/Core/include/Acts/Geometry/detail/TrackingVolume.ipp +++ b/Core/include/Acts/Geometry/detail/TrackingVolume.ipp @@ -10,8 +10,10 @@ // TrackingVolume.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline const Acts::Layer* TrackingVolume::associatedLayer( - const GeometryContext& /*gctx*/, const Vector3D& gp) const { +inline const Acts::Layer* +TrackingVolume::associatedLayer( + const GeometryContext& /*gctx*/, + const Vector3D& gp) const { // confined static layers - highest hierarchy if (m_confinedLayers) { return (m_confinedLayers->object(gp).get()); @@ -22,9 +24,12 @@ inline const Acts::Layer* TrackingVolume::associatedLayer( } template <typename options_t, typename corrector_t> -std::vector<LayerIntersection> TrackingVolume::compatibleLayers( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, +std::vector<LayerIntersection> +TrackingVolume::compatibleLayers( + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& corrfnc) const { // the layer intersections which are valid std::vector<LayerIntersection> lIntersections; @@ -74,19 +79,26 @@ std::vector<LayerIntersection> TrackingVolume::compatibleLayers( } template <typename parameters_t, typename options_t, typename corrector_t> -std::vector<LayerIntersection> TrackingVolume::compatibleLayers( - const GeometryContext& gctx, const parameters_t& parameters, - const options_t& options, const corrector_t& corrfnc) const { - return compatibleLayers(gctx, parameters.position(), parameters.direction(), - options, corrfnc); +std::vector<LayerIntersection> +TrackingVolume::compatibleLayers( + const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { + return compatibleLayers( + gctx, parameters.position(), parameters.direction(), options, corrfnc); } // Returns the boundary surfaces ordered in probability to hit them based on template <typename options_t, typename corrector_t, typename sorter_t> -std::vector<BoundaryIntersection> TrackingVolume::compatibleBoundaries( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, - const corrector_t& corrfnc, const sorter_t& sorter) const { +std::vector<BoundaryIntersection> +TrackingVolume::compatibleBoundaries( + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc, + const sorter_t& sorter) const { // Loop over boundarySurfaces and calculate the intersection auto excludeObject = options.startObject; auto& bSurfaces = boundarySurfaces(); @@ -102,27 +114,41 @@ std::vector<BoundaryIntersection> TrackingVolume::compatibleBoundaries( } nonExcludedBoundaries.push_back(bSurface); } - return sorter(gctx, nonExcludedBoundaries, position, direction, options, - corrfnc); + return sorter( + gctx, nonExcludedBoundaries, position, direction, options, corrfnc); } // Returns the boundary surfaces ordered in probability to hit them based on // straight line intersection @todo change hard-coded default -template <typename parameters_t, typename options_t, typename corrector_t, - typename sorter_t> -std::vector<BoundaryIntersection> TrackingVolume::compatibleBoundaries( - const GeometryContext& gctx, const parameters_t& parameters, - const options_t& options, const corrector_t& corrfnc, +template < + typename parameters_t, + typename options_t, + typename corrector_t, + typename sorter_t> +std::vector<BoundaryIntersection> +TrackingVolume::compatibleBoundaries( + const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc, const sorter_t& sorter) const { - return compatibleBoundaries(gctx, parameters.position(), - parameters.direction(), options, corrfnc, sorter); + return compatibleBoundaries( + gctx, + parameters.position(), + parameters.direction(), + options, + corrfnc, + sorter); } template <typename options_t, typename corrector_t> std::vector<SurfaceIntersection> TrackingVolume::compatibleSurfacesFromHierarchy( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, double angle, const options_t& options, + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + double angle, + const options_t& options, const corrector_t& corrfnc) const { std::vector<SurfaceIntersection> sIntersections; sIntersections.reserve(20); // arbitrary @@ -154,8 +180,8 @@ TrackingVolume::compatibleSurfacesFromHierarchy( for (const auto& bs : boundarySurfaces) { const Surface& srf = bs->surfaceRepresentation(); SurfaceIntersection sfi( - srf.intersectionEstimate(gctx, position, direction, options.navDir, - false, corrfnc), + srf.intersectionEstimate( + gctx, position, direction, options.navDir, false, corrfnc), &srf); if (sfi) { @@ -175,8 +201,10 @@ TrackingVolume::compatibleSurfacesFromHierarchy( } template <typename T> -std::vector<const Volume*> TrackingVolume::intersectSearchHierarchy( - const T obj, const Volume::BoundingBox* lnode) { +std::vector<const Volume*> +TrackingVolume::intersectSearchHierarchy( + const T obj, + const Volume::BoundingBox* lnode) { std::vector<const Volume*> hits; hits.reserve(20); // arbitrary do { diff --git a/Core/include/Acts/MagneticField/BFieldMapUtils.hpp b/Core/include/Acts/MagneticField/BFieldMapUtils.hpp index 6c2cf0749..728eed429 100644 --- a/Core/include/Acts/MagneticField/BFieldMapUtils.hpp +++ b/Core/include/Acts/MagneticField/BFieldMapUtils.hpp @@ -62,16 +62,20 @@ class SolenoidBField; /// e.g. we have the grid values r={0,1} with BFieldValues={2,3} on the r axis. /// If the flag is set to true the r-axis grid values will be set to {-1,0,1} /// and the BFieldValues will be set to {3,2,3}. -Acts::InterpolatedBFieldMapper< - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>> -fieldMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, - std::array<size_t, 2> nBinsRZ)>& - localToGlobalBin, - std::vector<double> rPos, std::vector<double> zPos, - std::vector<Acts::Vector2D> bField, - double lengthUnit = UnitConstants::mm, - double BFieldUnit = UnitConstants::T, bool firstQuadrant = false); +Acts::InterpolatedBFieldMapper<Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>> +fieldMapperRZ( + const std::function< + size_t(std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ)>& + localToGlobalBin, + std::vector<double> rPos, + std::vector<double> zPos, + std::vector<Acts::Vector2D> bField, + double lengthUnit = UnitConstants::mm, + double BFieldUnit = UnitConstants::T, + bool firstQuadrant = false); /// Method to setup the FieldMapper /// @param localToGlobalBin Function mapping the local bins of x,y,z to the @@ -124,15 +128,21 @@ fieldMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, /// If the flag is set to true the z-axis grid values will be set to {-1,0,1} /// and the BFieldValues will be set to {3,2,3}. Acts::InterpolatedBFieldMapper<Acts::detail::Grid< - Acts::Vector3D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis, Acts::detail::EquidistantAxis>> -fieldMapperXYZ(const std::function<size_t(std::array<size_t, 3> binsXYZ, - std::array<size_t, 3> nBinsXYZ)>& - localToGlobalBin, - std::vector<double> xPos, std::vector<double> yPos, - std::vector<double> zPos, std::vector<Acts::Vector3D> bField, - double lengthUnit = UnitConstants::mm, - double BFieldUnit = UnitConstants::T, bool firstOctant = false); + Acts::Vector3D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>> +fieldMapperXYZ( + const std::function< + size_t(std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ)>& + localToGlobalBin, + std::vector<double> xPos, + std::vector<double> yPos, + std::vector<double> zPos, + std::vector<Acts::Vector3D> bField, + double lengthUnit = UnitConstants::mm, + double BFieldUnit = UnitConstants::T, + bool firstOctant = false); /// Function which takes an existing SolenoidBField instance and /// creates a field mapper by sampling grid points from the analytical @@ -144,12 +154,14 @@ fieldMapperXYZ(const std::function<size_t(std::array<size_t, 3> binsXYZ, /// @param field the solenoid field instance /// /// @return A field mapper instance for use in interpolation. -Acts::InterpolatedBFieldMapper< - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>> -solenoidFieldMapper(std::pair<double, double> rlim, - std::pair<double, double> zlim, - std::pair<size_t, size_t> nbins, - const SolenoidBField& field); +Acts::InterpolatedBFieldMapper<Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>> +solenoidFieldMapper( + std::pair<double, double> rlim, + std::pair<double, double> zlim, + std::pair<size_t, size_t> nbins, + const SolenoidBField& field); } // namespace Acts diff --git a/Core/include/Acts/MagneticField/ConstantBField.hpp b/Core/include/Acts/MagneticField/ConstantBField.hpp index 7190a43f3..5fd9aa292 100644 --- a/Core/include/Acts/MagneticField/ConstantBField.hpp +++ b/Core/include/Acts/MagneticField/ConstantBField.hpp @@ -45,7 +45,10 @@ class ConstantBField final { /// /// @note The @p position is ignored and only kept as argument to provide /// a consistent interface with other magnetic field services. - Vector3D getField(const Vector3D& /*position*/) const { return m_BField; } + Vector3D + getField(const Vector3D& /*position*/) const { + return m_BField; + } /// @brief retrieve magnetic field value /// @@ -55,7 +58,8 @@ class ConstantBField final { /// /// @note The @p position is ignored and only kept as argument to provide /// a consistent interface with other magnetic field services. - Vector3D getField(const Vector3D& /*position*/, Cache& /*cache*/) const { + Vector3D + getField(const Vector3D& /*position*/, Cache& /*cache*/) const { return m_BField; } @@ -69,8 +73,10 @@ class ConstantBField final { /// a consistent interface with other magnetic field services. /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& /*position*/, - ActsMatrixD<3, 3>& /*derivative*/) const { + Vector3D + getFieldGradient( + const Vector3D& /*position*/, + ActsMatrixD<3, 3>& /*derivative*/) const { return m_BField; } @@ -85,9 +91,11 @@ class ConstantBField final { /// a consistent interface with other magnetic field services. /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& /*position*/, - ActsMatrixD<3, 3>& /*derivative*/, - Cache& /*cache*/) const { + Vector3D + getFieldGradient( + const Vector3D& /*position*/, + ActsMatrixD<3, 3>& /*derivative*/, + Cache& /*cache*/) const { return m_BField; } @@ -97,19 +105,28 @@ class ConstantBField final { /// @return @c true if position is inside the defined look-up grid, /// otherwise @c false /// @note The method will always return true for the constant B-Field - bool isInside(const Vector3D& /*position*/) const { return true; } + bool + isInside(const Vector3D& /*position*/) const { + return true; + } /// @brief update magnetic field vector from components /// /// @param [in] Bx magnetic field component in global x-direction /// @param [in] By magnetic field component in global y-direction /// @param [in] Bz magnetic field component in global z-direction - void setField(double Bx, double By, double Bz) { m_BField << Bx, By, Bz; } + void + setField(double Bx, double By, double Bz) { + m_BField << Bx, By, Bz; + } /// @brief update magnetic field vector /// /// @param [in] B magnetic field vector in global coordinate system - void setField(const Vector3D& B) { m_BField = B; } + void + setField(const Vector3D& B) { + m_BField = B; + } private: /// magnetic field vector diff --git a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp index 3775eeaaf..54029fe8e 100644 --- a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp +++ b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp @@ -54,10 +54,11 @@ struct InterpolatedBFieldMapper { /// each Dimension) /// @param [in] fieldValues field values at the hyper box corners sorted in /// the canonical order defined in Acts::interpolate - FieldCell(std::function<ActsVectorD<DIM_POS>(const Vector3D&)> transformPos, - std::array<double, DIM_POS> lowerLeft, - std::array<double, DIM_POS> upperRight, - std::array<Vector3D, N> fieldValues) + FieldCell( + std::function<ActsVectorD<DIM_POS>(const Vector3D&)> transformPos, + std::array<double, DIM_POS> lowerLeft, + std::array<double, DIM_POS> upperRight, + std::array<Vector3D, N> fieldValues) : m_transformPos(std::move(transformPos)), m_lowerLeft(std::move(lowerLeft)), m_upperRight(std::move(upperRight)), @@ -69,10 +70,11 @@ struct InterpolatedBFieldMapper { /// @return magnetic field value at the given position /// /// @pre The given @c position must lie within the current field cell. - Vector3D getField(const Vector3D& position) const { + Vector3D + getField(const Vector3D& position) const { // defined in Interpolation.hpp - return interpolate(m_transformPos(position), m_lowerLeft, m_upperRight, - m_fieldValues); + return interpolate( + m_transformPos(position), m_lowerLeft, m_upperRight, m_fieldValues); } /// @brief check whether given 3D position is inside this field cell @@ -80,7 +82,8 @@ struct InterpolatedBFieldMapper { /// @param [in] position global 3D position /// @return @c true if position is inside the current field cell, /// otherwise @c false - bool isInside(const Vector3D& position) const { + bool + isInside(const Vector3D& position) const { const auto& gridCoordinates = m_transformPos(position); for (unsigned int i = 0; i < DIM_POS; ++i) { if (gridCoordinates[i] < m_lowerLeft.at(i) || @@ -132,9 +135,10 @@ struct InterpolatedBFieldMapper { /// /// @pre The given @c position must lie within the range of the underlying /// magnetic field map. - Vector3D getField(const Vector3D& position) const { - return m_transformBField(m_grid.interpolate(m_transformPos(position)), - position); + Vector3D + getField(const Vector3D& position) const { + return m_transformBField( + m_grid.interpolate(m_transformPos(position)), position); } /// @brief retrieve field cell for given position @@ -144,7 +148,8 @@ struct InterpolatedBFieldMapper { /// /// @pre The given @c position must lie within the range of the underlying /// magnetic field map. - FieldCell getFieldCell(const Vector3D& position) const { + FieldCell + getFieldCell(const Vector3D& position) const { const auto& gridPosition = m_transformPos(position); const auto& indices = m_grid.localBinsFromPosition(gridPosition); const auto& lowerLeft = m_grid.lowerLeftBinEdge(indices); @@ -160,14 +165,15 @@ struct InterpolatedBFieldMapper { neighbors.at(i++) = m_transformBField(m_grid.at(index), position); } - return FieldCell(m_transformPos, lowerLeft, upperRight, - std::move(neighbors)); + return FieldCell( + m_transformPos, lowerLeft, upperRight, std::move(neighbors)); } /// @brief get the number of bins for all axes of the field map /// /// @return vector returning number of bins for all field map axes - std::vector<size_t> getNBins() const { + std::vector<size_t> + getNBins() const { auto nBinsArray = m_grid.numLocalBins(); return std::vector<size_t>(nBinsArray.begin(), nBinsArray.end()); } @@ -175,7 +181,8 @@ struct InterpolatedBFieldMapper { /// @brief get the minimum value of all axes of the field map /// /// @return vector returning the minima of all field map axes - std::vector<double> getMin() const { + std::vector<double> + getMin() const { auto minArray = m_grid.minPosition(); return std::vector<double>(minArray.begin(), minArray.end()); } @@ -183,7 +190,8 @@ struct InterpolatedBFieldMapper { /// @brief get the maximum value of all axes of the field map /// /// @return vector returning the maxima of all field map axes - std::vector<double> getMax() const { + std::vector<double> + getMax() const { auto maxArray = m_grid.maxPosition(); return std::vector<double>(maxArray.begin(), maxArray.end()); } @@ -193,14 +201,18 @@ struct InterpolatedBFieldMapper { /// @param [in] position global 3D position /// @return @c true if position is inside the defined look-up grid, /// otherwise @c false - bool isInside(const Vector3D& position) const { + bool + isInside(const Vector3D& position) const { return m_grid.isInside(m_transformPos(position)); } /// @brief Get a const reference on the underlying grid structure /// /// @return grid reference - const Grid_t& getGrid() const { return m_grid; } + const Grid_t& + getGrid() const { + return m_grid; + } private: /// geometric transformation applied to global 3D positions @@ -267,14 +279,18 @@ class InterpolatedBFieldMap final { /// @brief get configuration object /// /// @return copy of the internal configuration object - Config getConfiguration() const { return m_config; } + Config + getConfiguration() const { + return m_config; + } /// @brief retrieve magnetic field value /// /// @param [in] position global 3D position /// /// @return magnetic field vector at given position - Vector3D getField(const Vector3D& position) const { + Vector3D + getField(const Vector3D& position) const { return m_config.mapper.getField(position); } @@ -285,7 +301,8 @@ class InterpolatedBFieldMap final { /// interpolation /// /// @return magnetic field vector at given position - Vector3D getField(const Vector3D& position, Cache& cache) const { + Vector3D + getField(const Vector3D& position, Cache& cache) const { if (!cache.fieldCell || !(*cache.fieldCell).isInside(position)) { cache.fieldCell = getFieldCell(position); } @@ -300,8 +317,9 @@ class InterpolatedBFieldMap final { /// /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& position, - ActsMatrixD<3, 3>& /*derivative*/) const { + Vector3D + getFieldGradient(const Vector3D& position, ActsMatrixD<3, 3>& /*derivative*/) + const { return m_config.mapper.getField(position); } @@ -315,35 +333,47 @@ class InterpolatedBFieldMap final { /// @note currently the derivative is not calculated /// @note Cache is not used currently /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& position, - ActsMatrixD<3, 3>& /*derivative*/, - Cache& /*cache*/) const { + Vector3D + getFieldGradient( + const Vector3D& position, + ActsMatrixD<3, 3>& /*derivative*/, + Cache& /*cache*/) const { return m_config.mapper.getField(position); } /// @brief get global scaling factor for magnetic field /// /// @return global factor for scaling the magnetic field - double getScale() const { return m_config.scale; } + double + getScale() const { + return m_config.scale; + } /// @brief convenience method to access underlying field mapper /// /// @return the field mapper - Mapper_t getMapper() const { return m_config.mapper; } + Mapper_t + getMapper() const { + return m_config.mapper; + } /// @brief check whether given 3D position is inside look-up domain /// /// @param [in] position global 3D position /// @return @c true if position is inside the defined BField map, /// otherwise @c false - bool isInside(const Vector3D& position) const { + bool + isInside(const Vector3D& position) const { return m_config.mapper.isInside(position); } /// @brief update configuration /// /// @param [in] config new configuration object - void setConfiguration(const Config& config) { m_config = config; } + void + setConfiguration(const Config& config) { + m_config = config; + } private: /// @brief retrieve field cell for given position @@ -353,7 +383,8 @@ class InterpolatedBFieldMap final { /// /// @pre The given @c position must lie within the range of the underlying /// magnetic field map. - typename Mapper_t::FieldCell getFieldCell(const Vector3D& position) const { + typename Mapper_t::FieldCell + getFieldCell(const Vector3D& position) const { return m_config.mapper.getFieldCell(position); } diff --git a/Core/include/Acts/MagneticField/SharedBField.hpp b/Core/include/Acts/MagneticField/SharedBField.hpp index 49529c6f3..65a62fdb6 100644 --- a/Core/include/Acts/MagneticField/SharedBField.hpp +++ b/Core/include/Acts/MagneticField/SharedBField.hpp @@ -33,7 +33,8 @@ class SharedBField { /// @param [in] position global 3D position /// /// @return magnetic field vector at given position - Vector3D getField(const Vector3D& position) const { + Vector3D + getField(const Vector3D& position) const { return m_bField->getField(position); } @@ -41,7 +42,8 @@ class SharedBField { /// /// @param [in] position global 3D position /// @param [in,out] cache Cache object, passed through to wrapped BField - Vector3D getField(const Vector3D& position, Cache& cache) const { + Vector3D + getField(const Vector3D& position, Cache& cache) const { return m_bField->getField(position, cache); } @@ -53,8 +55,9 @@ class SharedBField { /// /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& position, - ActsMatrixD<3, 3>& derivative) const { + Vector3D + getFieldGradient(const Vector3D& position, ActsMatrixD<3, 3>& derivative) + const { return m_bField->getFieldGradient(position, derivative); } @@ -67,8 +70,11 @@ class SharedBField { /// /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& position, - ActsMatrixD<3, 3>& derivative, Cache& cache) const { + Vector3D + getFieldGradient( + const Vector3D& position, + ActsMatrixD<3, 3>& derivative, + Cache& cache) const { return m_bField->getFieldGradient(position, derivative, cache); } diff --git a/Core/include/Acts/MagneticField/SolenoidBField.hpp b/Core/include/Acts/MagneticField/SolenoidBField.hpp index a042521a8..a56b84b00 100644 --- a/Core/include/Acts/MagneticField/SolenoidBField.hpp +++ b/Core/include/Acts/MagneticField/SolenoidBField.hpp @@ -116,8 +116,9 @@ class SolenoidBField { /// /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& position, - ActsMatrixD<3, 3>& /*derivative*/) const; + Vector3D getFieldGradient( + const Vector3D& position, + ActsMatrixD<3, 3>& /*derivative*/) const; /// @brief retrieve magnetic field value & its gradient /// @@ -128,9 +129,10 @@ class SolenoidBField { /// /// @note currently the derivative is not calculated /// @todo return derivative - Vector3D getFieldGradient(const Vector3D& position, - ActsMatrixD<3, 3>& /*derivative*/, - Cache& /*cache*/) const; + Vector3D getFieldGradient( + const Vector3D& position, + ActsMatrixD<3, 3>& /*derivative*/, + Cache& /*cache*/) const; private: Config m_cfg; diff --git a/Core/include/Acts/Material/AccumulatedMaterialProperties.hpp b/Core/include/Acts/Material/AccumulatedMaterialProperties.hpp index c713bd2aa..f82fb794f 100644 --- a/Core/include/Acts/Material/AccumulatedMaterialProperties.hpp +++ b/Core/include/Acts/Material/AccumulatedMaterialProperties.hpp @@ -110,8 +110,10 @@ class AccumulatedMaterialProperties { unsigned int m_totalEvents{0}; //!< the number of events }; -inline void AccumulatedMaterialProperties::accumulate( - const MaterialProperties& amp, double pathCorrection) { +inline void +AccumulatedMaterialProperties::accumulate( + const MaterialProperties& amp, + double pathCorrection) { m_eventPathInX0 += amp.thicknessInX0(); m_eventPathInL0 += amp.thicknessInL0(); double t = amp.thickness(); @@ -125,7 +127,8 @@ inline void AccumulatedMaterialProperties::accumulate( m_eventPathCorrection += pathCorrection * t; } -inline void AccumulatedMaterialProperties::trackAverage() { +inline void +AccumulatedMaterialProperties::trackAverage() { // Always count a hit if a path length is registered if (m_eventPath > 0.) { ++m_totalEvents; @@ -163,8 +166,8 @@ AccumulatedMaterialProperties::totalAverage() { double L0 = 1. / m_totalPathInL0; // Create the material properties - fixed to unit path length MaterialProperties averageMat(X0, L0, m_totalA, m_totalZ, m_totalRho, 1.); - return std::pair<MaterialProperties, unsigned int>(std::move(averageMat), - m_totalEvents); + return std::pair<MaterialProperties, unsigned int>( + std::move(averageMat), m_totalEvents); } return std::pair<MaterialProperties, unsigned int>( MaterialProperties{Material(), 0.}, 0); diff --git a/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp b/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp index 56df31bde..fa315b843 100644 --- a/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/AccumulatedSurfaceMaterial.hpp @@ -47,8 +47,9 @@ class AccumulatedSurfaceMaterial { /// /// @param binUtility defines the binning structure on the surface /// @param splitFactor is the pre/post splitting directive - AccumulatedSurfaceMaterial(const BinUtility& binUtility, - double splitFactor = 0.); + AccumulatedSurfaceMaterial( + const BinUtility& binUtility, + double splitFactor = 0.); /// Copy Constructor /// @@ -84,9 +85,10 @@ class AccumulatedSurfaceMaterial { /// @param mp material properties to be assigned /// /// @return the bin triple to which the material was assigned - std::array<size_t, 3> accumulate(const Vector2D& lp, - const MaterialProperties& mp, - double pathCorrection = 1.); + std::array<size_t, 3> accumulate( + const Vector2D& lp, + const MaterialProperties& mp, + double pathCorrection = 1.); /// Assign a material properites object /// @@ -94,9 +96,10 @@ class AccumulatedSurfaceMaterial { /// @param mp material properties to be assigned /// /// @return the bin triple to which the material was assigned - std::array<size_t, 3> accumulate(const Vector3D& gp, - const MaterialProperties& mp, - double pathCorrection = 1.); + std::array<size_t, 3> accumulate( + const Vector3D& gp, + const MaterialProperties& mp, + double pathCorrection = 1.); /// Average the information accumulated from one mapped track /// @@ -124,7 +127,8 @@ class AccumulatedSurfaceMaterial { AccumulatedMatrix m_accumulatedMaterial; }; -inline const BinUtility& AccumulatedSurfaceMaterial::binUtility() const { +inline const BinUtility& +AccumulatedSurfaceMaterial::binUtility() const { return (m_binUtility); } @@ -133,7 +137,8 @@ AccumulatedSurfaceMaterial::accumulatedMaterial() const { return (m_accumulatedMaterial); } -inline double AccumulatedSurfaceMaterial::splitFactor() const { +inline double +AccumulatedSurfaceMaterial::splitFactor() const { return m_splitFactor; } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp b/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp index 111a859f7..45d8997ff 100644 --- a/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/BinnedSurfaceMaterial.hpp @@ -40,9 +40,10 @@ class BinnedSurfaceMaterial : public ISurfaceMaterial { /// @param binUtility defines the binning structure on the surface (copied) /// @param fullProperties is the vector of properties as recorded (moved) /// @param splitFactor is the pre/post splitting directive - BinnedSurfaceMaterial(const BinUtility& binUtility, - MaterialPropertiesVector fullProperties, - double splitFactor = 0.); + BinnedSurfaceMaterial( + const BinUtility& binUtility, + MaterialPropertiesVector fullProperties, + double splitFactor = 0.); /// Explicit constructor with only full MaterialProperties, /// for two-dimensional binning. @@ -55,9 +56,10 @@ class BinnedSurfaceMaterial : public ISurfaceMaterial { /// @param binUtility defines the binning structure on the surface (copied) /// @param fullProperties is the vector of properties as recorded (moved) /// @param splitFactor is the pre/post splitting directive - BinnedSurfaceMaterial(const BinUtility& binUtility, - MaterialPropertiesMatrix fullProperties, - double splitFactor = 0.); + BinnedSurfaceMaterial( + const BinUtility& binUtility, + MaterialPropertiesMatrix fullProperties, + double splitFactor = 0.); /// Copy Move Constructor /// @@ -96,8 +98,8 @@ class BinnedSurfaceMaterial : public ISurfaceMaterial { const MaterialProperties& materialProperties(const Vector3D& gp) const final; /// @copydoc SurfaceMaterial::materialProperties(size_t, size_t) - const MaterialProperties& materialProperties(size_t bin0, - size_t bin1) const final; + const MaterialProperties& materialProperties(size_t bin0, size_t bin1) + const final; /// Output Method for std::ostream, to be overloaded by child classes std::ostream& toStream(std::ostream& sl) const final; @@ -110,17 +112,18 @@ class BinnedSurfaceMaterial : public ISurfaceMaterial { MaterialPropertiesMatrix m_fullMaterial; }; -inline const BinUtility& BinnedSurfaceMaterial::binUtility() const { +inline const BinUtility& +BinnedSurfaceMaterial::binUtility() const { return (m_binUtility); } -inline const MaterialPropertiesMatrix& BinnedSurfaceMaterial::fullMaterial() - const { +inline const MaterialPropertiesMatrix& +BinnedSurfaceMaterial::fullMaterial() const { return m_fullMaterial; } -inline const MaterialProperties& BinnedSurfaceMaterial::materialProperties( - size_t bin0, size_t bin1) const { +inline const MaterialProperties& +BinnedSurfaceMaterial::materialProperties(size_t bin0, size_t bin1) const { return m_fullMaterial[bin1][bin0]; } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Material/ElementFraction.hpp b/Core/include/Acts/Material/ElementFraction.hpp index 55f13748d..933adbcc1 100644 --- a/Core/include/Acts/Material/ElementFraction.hpp +++ b/Core/include/Acts/Material/ElementFraction.hpp @@ -78,21 +78,29 @@ class ElementFraction { ElementFraction& operator=(ElementFraction&& ef) = default; /// Access to the data itself - const std::array<uint8_t, 2>& data() const { return m_data; } + const std::array<uint8_t, 2>& + data() const { + return m_data; + } /// Return in a nice format /// @return casts back to an unsigned integer - unsigned int element() const { return static_cast<unsigned int>(m_data[0]); } + unsigned int + element() const { + return static_cast<unsigned int>(m_data[0]); + } /// Return in a nice format /// @return casts char to an unsigned int and then into double - double fraction() const { + double + fraction() const { return (static_cast<unsigned int>(m_data[1]) * s_oneOverUcharMax); } /// Define the equality operator /// @param ef is the source ElementFraction for comparison - bool operator==(const ElementFraction& ef) const { + bool + operator==(const ElementFraction& ef) const { return (m_data[0] == ef.m_data[0] && m_data[1] == ef.m_data[1]); } @@ -101,7 +109,8 @@ class ElementFraction { /// most probable fraction /// /// @param ef is the source ElementFraction for comparison - bool operator<(const ElementFraction& ef) const { + bool + operator<(const ElementFraction& ef) const { return (m_data[1] < ef.m_data[1]); } diff --git a/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp b/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp index 34fea17c6..2baa6add1 100644 --- a/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/HomogeneousSurfaceMaterial.hpp @@ -31,8 +31,9 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial { /// /// @param full are the full material properties /// @param splitFactor is the split for pre/post update - HomogeneousSurfaceMaterial(const MaterialProperties& full, - double splitFactor = 1.); + HomogeneousSurfaceMaterial( + const MaterialProperties& full, + double splitFactor = 1.); /// Copy Constructor /// @@ -86,8 +87,8 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial { /// @param ib1 The bin at local 1 for retrieving the material /// /// @note the input parameter is ignored - const MaterialProperties& materialProperties(size_t ib0, - size_t ib1) const final; + const MaterialProperties& materialProperties(size_t ib0, size_t ib1) + const final; /// The inherited methods - for materialProperties access using ISurfaceMaterial::materialProperties; @@ -105,22 +106,24 @@ class HomogeneousSurfaceMaterial : public ISurfaceMaterial { MaterialProperties m_fullMaterial = MaterialProperties(); }; -inline const MaterialProperties& HomogeneousSurfaceMaterial::materialProperties( - const Vector2D& /*lp*/) const { +inline const MaterialProperties& +HomogeneousSurfaceMaterial::materialProperties(const Vector2D& /*lp*/) const { return (m_fullMaterial); } -inline const MaterialProperties& HomogeneousSurfaceMaterial::materialProperties( - const Vector3D& /*gp*/) const { +inline const MaterialProperties& +HomogeneousSurfaceMaterial::materialProperties(const Vector3D& /*gp*/) const { return (m_fullMaterial); } -inline const MaterialProperties& HomogeneousSurfaceMaterial::materialProperties( - size_t /*ib0*/, size_t /*ib1*/) const { +inline const MaterialProperties& +HomogeneousSurfaceMaterial::materialProperties(size_t /*ib0*/, size_t /*ib1*/) + const { return (m_fullMaterial); } -inline bool HomogeneousSurfaceMaterial::operator==( +inline bool +HomogeneousSurfaceMaterial::operator==( const HomogeneousSurfaceMaterial& hsm) const { return (m_fullMaterial == hsm.m_fullMaterial); } diff --git a/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp b/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp index 4dde4cd8c..edcac7a83 100644 --- a/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp +++ b/Core/include/Acts/Material/HomogeneousVolumeMaterial.hpp @@ -36,7 +36,8 @@ class HomogeneousVolumeMaterial : public IVolumeMaterial { /// /// @param position is the request position for the material call /// @todo interface to change including 'cell' - const Material& material(const Vector3D& /*position*/) const final { + const Material& + material(const Vector3D& /*position*/) const final { return m_material; } diff --git a/Core/include/Acts/Material/ISurfaceMaterial.hpp b/Core/include/Acts/Material/ISurfaceMaterial.hpp index 2670034b8..f0abc611d 100644 --- a/Core/include/Acts/Material/ISurfaceMaterial.hpp +++ b/Core/include/Acts/Material/ISurfaceMaterial.hpp @@ -66,8 +66,8 @@ class ISurfaceMaterial { /// /// @param ib0 is the material bin in dimension 0 /// @param ib1 is the material bin in dimension 1 - virtual const MaterialProperties& materialProperties(size_t ib0, - size_t ib1) const = 0; + virtual const MaterialProperties& materialProperties(size_t ib0, size_t ib1) + const = 0; /// Update pre factor /// @@ -83,9 +83,10 @@ class ISurfaceMaterial { /// @param mStage is the material update directive (onapproach, full, onleave) /// /// @return MaterialProperties - MaterialProperties materialProperties(const Vector2D& lp, - NavigationDirection pDir, - MaterialUpdateStage mStage) const; + MaterialProperties materialProperties( + const Vector2D& lp, + NavigationDirection pDir, + MaterialUpdateStage mStage) const; /// Return method for full material description of the Surface /// - from the global coordinates @@ -95,9 +96,10 @@ class ISurfaceMaterial { /// @param mStage is the material update directive (onapproach, full, onleave) /// /// @return MaterialProperties - MaterialProperties materialProperties(const Vector3D& gp, - NavigationDirection pDir, - MaterialUpdateStage mStage) const; + MaterialProperties materialProperties( + const Vector3D& gp, + NavigationDirection pDir, + MaterialUpdateStage mStage) const; /// @brief output stream operator /// @@ -105,8 +107,8 @@ class ISurfaceMaterial { /// virtual ISurfaceMaterial::toStream method /// /// @return modified output stream object - friend std::ostream& operator<<(std::ostream& out, - const ISurfaceMaterial& sm) { + friend std::ostream& + operator<<(std::ostream& out, const ISurfaceMaterial& sm) { sm.toStream(out); return out; } @@ -118,16 +120,19 @@ class ISurfaceMaterial { double m_splitFactor{1.}; //!< the split factor in favour of oppositePre }; -inline double ISurfaceMaterial::factor(NavigationDirection pDir, - MaterialUpdateStage mStage) const { +inline double +ISurfaceMaterial::factor(NavigationDirection pDir, MaterialUpdateStage mStage) + const { if (mStage == Acts::fullUpdate) { return 1.; } return (pDir * mStage > 0 ? m_splitFactor : 1. - m_splitFactor); } -inline MaterialProperties ISurfaceMaterial::materialProperties( - const Vector2D& lp, NavigationDirection pDir, +inline MaterialProperties +ISurfaceMaterial::materialProperties( + const Vector2D& lp, + NavigationDirection pDir, MaterialUpdateStage mStage) const { // The plain material properties associated to this bin MaterialProperties plainMatProp = materialProperties(lp); @@ -142,8 +147,10 @@ inline MaterialProperties ISurfaceMaterial::materialProperties( return plainMatProp; } -inline MaterialProperties ISurfaceMaterial::materialProperties( - const Vector3D& gp, NavigationDirection pDir, +inline MaterialProperties +ISurfaceMaterial::materialProperties( + const Vector3D& gp, + NavigationDirection pDir, MaterialUpdateStage mStage) const { // The plain material properties associated to this bin MaterialProperties plainMatProp = materialProperties(gp); diff --git a/Core/include/Acts/Material/InterpolatedMaterialMap.hpp b/Core/include/Acts/Material/InterpolatedMaterialMap.hpp index d218bbb8a..f5c750550 100644 --- a/Core/include/Acts/Material/InterpolatedMaterialMap.hpp +++ b/Core/include/Acts/Material/InterpolatedMaterialMap.hpp @@ -63,10 +63,14 @@ struct MaterialMapper { /// @return Material at the given position /// /// @pre The given @c position must lie within the current cell. - Material getMaterial(const Vector3D& position) const { + Material + getMaterial(const Vector3D& position) const { // defined in Interpolation.hpp - return Material(interpolate(m_transformPos(position), m_lowerLeft, - m_upperRight, m_materialValues)); + return Material(interpolate( + m_transformPos(position), + m_lowerLeft, + m_upperRight, + m_materialValues)); } /// @brief Check whether given 3D position is inside this cell @@ -74,7 +78,8 @@ struct MaterialMapper { /// @param [in] position Global 3D position /// @return @c true if position is inside the current cell, /// otherwise @c false - bool isInside(const Vector3D& position) const { + bool + isInside(const Vector3D& position) const { const auto& gridCoordinates = m_transformPos(position); for (unsigned int i = 0; i < DIM_POS; ++i) { if (gridCoordinates[i] < m_lowerLeft.at(i) || @@ -119,7 +124,8 @@ struct MaterialMapper { /// /// @pre The given @c position must lie within the range of the underlying /// map. - Material getMaterial(const Vector3D& position) const { + Material + getMaterial(const Vector3D& position) const { return Material(m_grid.interpolate(m_transformPos(position))); } @@ -130,7 +136,8 @@ struct MaterialMapper { /// /// @pre The given @c position must lie within the range of the underlying /// map. - MaterialCell getMaterialCell(const Vector3D& position) const { + MaterialCell + getMaterialCell(const Vector3D& position) const { const auto& gridPosition = m_transformPos(position); size_t bin = m_grid.globalBinFromPosition(gridPosition); const auto& indices = m_grid.localBinsFromPosition(bin); @@ -147,14 +154,15 @@ struct MaterialMapper { neighbors.at(i++) = m_grid.at(index); } - return MaterialCell(m_transformPos, lowerLeft, upperRight, - std::move(neighbors)); + return MaterialCell( + m_transformPos, lowerLeft, upperRight, std::move(neighbors)); } /// @brief Get the number of bins for all axes of the map /// /// @return Vector returning number of bins for all map axes - std::vector<size_t> getNBins() const { + std::vector<size_t> + getNBins() const { auto nBinsArray = m_grid.numLocalBins(); return std::vector<size_t>(nBinsArray.begin(), nBinsArray.end()); } @@ -162,7 +170,8 @@ struct MaterialMapper { /// @brief Get the minimum value of all axes of the map /// /// @return Vector returning the minima of all map axes - std::vector<double> getMin() const { + std::vector<double> + getMin() const { auto minArray = m_grid.minPosition(); return std::vector<double>(minArray.begin(), minArray.end()); } @@ -170,7 +179,8 @@ struct MaterialMapper { /// @brief Get the maximum value of all axes of the map /// /// @return Vector returning the maxima of all map axes - std::vector<double> getMax() const { + std::vector<double> + getMax() const { auto maxArray = m_grid.maxPosition(); return std::vector<double>(maxArray.begin(), maxArray.end()); } @@ -180,14 +190,18 @@ struct MaterialMapper { /// @param [in] position Global 3D position /// @return @c true if position is inside the defined look-up grid, /// otherwise @c false - bool isInside(const Vector3D& position) const { + bool + isInside(const Vector3D& position) const { return m_grid.isInside(m_transformPos(position)); } /// @brief Get a const reference on the underlying grid structure /// /// @return Grid reference - const Grid_t& getGrid() const { return m_grid; } + const Grid_t& + getGrid() const { + return m_grid; + } private: /// Geometric transformation applied to global 3D positions @@ -239,7 +253,8 @@ class InterpolatedMaterialMap final { /// @param [in] position Global 3D position /// /// @return Material at given position - Material getMaterial(const Vector3D& position) const { + Material + getMaterial(const Vector3D& position) const { return m_mapper.getMaterial(position); } @@ -250,7 +265,8 @@ class InterpolatedMaterialMap final { /// interpolation /// /// @return material at given position - Material getMaterial(const Vector3D& position, Cache& cache) const { + Material + getMaterial(const Vector3D& position, Cache& cache) const { if (!cache.initialized || !(*cache.matCell).isInside(position)) { cache.matCell = getMaterialCell(position); cache.initialized = true; @@ -266,8 +282,10 @@ class InterpolatedMaterialMap final { /// /// @note Currently the derivative is not calculated /// @todo return derivative - Material getMaterialGradient(const Vector3D& position, - ActsMatrixD<5, 5>& /*derivative*/) const { + Material + getMaterialGradient( + const Vector3D& position, + ActsMatrixD<5, 5>& /*derivative*/) const { return m_mapper.getMaterial(position); } @@ -281,22 +299,28 @@ class InterpolatedMaterialMap final { /// @note Currently the derivative is not calculated /// @note Cache is not used currently /// @todo return derivative - Material getMaterialGradient(const Vector3D& position, - ActsMatrixD<5, 5>& /*derivative*/, - Cache& /*cache*/) const { + Material + getMaterialGradient( + const Vector3D& position, + ActsMatrixD<5, 5>& /*derivative*/, + Cache& /*cache*/) const { return m_mapper.getMaterial(position); } /// @brief Convenience method to access underlying material mapper /// /// @return The material mapper - Mapper_t getMapper() const { return m_mapper; } + Mapper_t + getMapper() const { + return m_mapper; + } /// @brief Check whether given 3D position is inside look-up domain /// /// @param [in] position Global 3D position /// @return @c true if position is inside the defined map, otherwise @c false - bool isInside(const Vector3D& position) const { + bool + isInside(const Vector3D& position) const { return m_mapper.isInside(position); } @@ -308,8 +332,8 @@ class InterpolatedMaterialMap final { /// /// @pre The given @c position must lie within the range of the underlying /// map. - typename Mapper_t::MaterialCell getMaterialCell( - const Vector3D& position) const { + typename Mapper_t::MaterialCell + getMaterialCell(const Vector3D& position) const { return m_mapper.getMaterialCell(position); } diff --git a/Core/include/Acts/Material/Material.hpp b/Core/include/Acts/Material/Material.hpp index 21f4bc1a7..8554ec919 100644 --- a/Core/include/Acts/Material/Material.hpp +++ b/Core/include/Acts/Material/Material.hpp @@ -61,8 +61,13 @@ class Material { /// @param iZ is the average atomic number /// @param iRho is the average density /// @param imc is the material composition - Material(float iX0, float iL0, float iA, float iZ, float iRho, - MaterialComposition imc = {}) + Material( + float iX0, + float iL0, + float iA, + float iZ, + float iRho, + MaterialComposition imc = {}) : m_vacuum(false), m_store({iX0, iL0, iA, iZ, iRho, 0.}), m_composition(std::move(imc)) { @@ -71,8 +76,13 @@ class Material { } Material(ActsVectorF<5> iMatData, MaterialComposition imc = {}) - : Material(iMatData[0], iMatData[1], iMatData[2], iMatData[3], - iMatData[4], std::move(imc)) {} + : Material( + iMatData[0], + iMatData[1], + iMatData[2], + iMatData[3], + iMatData[4], + std::move(imc)) {} /// @brief Copy Constructor /// @@ -112,33 +122,53 @@ class Material { /// @brief Access to X0 /// if it's vacuum, infinity - float X0() const { return m_store[matX0]; } + float + X0() const { + return m_store[matX0]; + } /// @brief Access to L0 /// if it's vacuum, infinity - float L0() const { return m_store[matL0]; } + float + L0() const { + return m_store[matL0]; + } /// @brief Access to A - float A() const { return m_store[matA]; } + float + A() const { + return m_store[matA]; + } /// @brief Access to Z - float Z() const { return m_store[matZ]; } + float + Z() const { + return m_store[matZ]; + } /// @brief Access to rho - float rho() const { return m_store[matrho]; } + float + rho() const { + return m_store[matrho]; + } /// @brief Access to z/A*tho - float zOverAtimesRho() const { return m_store[matZ_AR]; } + float + zOverAtimesRho() const { + return m_store[matZ_AR]; + } /// @brief Access to all classification numbers of the material - ActsVectorF<5> classificationNumbers() { + ActsVectorF<5> + classificationNumbers() { ActsVectorF<5> numbers; numbers << X0(), L0(), A(), Z(), rho(); return numbers; } /// spit out as a string - std::string toString() const { + std::string + toString() const { std::ostringstream sout; sout << std::setiosflags(std::ios::fixed) << std::setprecision(4); sout << " | "; @@ -168,11 +198,13 @@ class Material { MaterialComposition m_composition = MaterialComposition(); }; -inline bool Material::operator==(const Material& mat) const { +inline bool +Material::operator==(const Material& mat) const { return (m_store == mat.m_store && m_composition == mat.m_composition); } -inline bool Material::operator!=(const Material& mat) const { +inline bool +Material::operator!=(const Material& mat) const { return !operator==(mat); } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Material/MaterialCollector.hpp b/Core/include/Acts/Material/MaterialCollector.hpp index be739e497..abc6540c4 100644 --- a/Core/include/Acts/Material/MaterialCollector.hpp +++ b/Core/include/Acts/Material/MaterialCollector.hpp @@ -57,8 +57,11 @@ struct MaterialCollector { /// @param stepper The stepper in use /// @param result is the result object to be filled template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { if (state.navigation.currentSurface) { if (state.navigation.currentSurface == state.navigation.targetSurface and not state.navigation.targetReached) { @@ -88,8 +91,9 @@ struct MaterialCollector { prepofu = state.navigation.currentSurface->surfaceMaterial()->factor( state.stepping.navDir, postUpdate); - } else if (state.navigation.targetSurface == - state.navigation.currentSurface) { + } else if ( + state.navigation.targetSurface == + state.navigation.currentSurface) { debugLog(state, [&] { return std::string("Update on target surface: pre-update mode"); }); @@ -153,7 +157,8 @@ struct MaterialCollector { /// Pure observer interface /// - this does not apply to the surface collector template <typename propagator_state_t> - void operator()(propagator_state_t& /*state*/) const {} + void + operator()(propagator_state_t& /*state*/) const {} private: /// The private propagation debug logging @@ -168,8 +173,10 @@ struct MaterialCollector { /// length /// @param logAction is a callable function that returns a stremable object template <typename propagator_state_t> - void debugLog(propagator_state_t& state, - const std::function<std::string()>& logAction) const { + void + debugLog( + propagator_state_t& state, + const std::function<std::string()>& logAction) const { if (state.options.debug) { std::stringstream dstream; dstream << " " << std::setw(state.options.debugPfxWidth); diff --git a/Core/include/Acts/Material/MaterialComposition.hpp b/Core/include/Acts/Material/MaterialComposition.hpp index 1b3ecbd96..099b5562f 100644 --- a/Core/include/Acts/Material/MaterialComposition.hpp +++ b/Core/include/Acts/Material/MaterialComposition.hpp @@ -61,19 +61,29 @@ class MaterialComposition { MaterialComposition& operator=(MaterialComposition&& mc) = default; /// Access to the elements themselves - const std::vector<ElementFraction>& elements() const { return m_elements; } + const std::vector<ElementFraction>& + elements() const { + return m_elements; + } /// Boolean operator to indicate if this is empty operator bool() const { return !empty(); } /// How many elements you have - size_t size() const { return m_elements.size(); } + size_t + size() const { + return m_elements.size(); + } /// Check if empty - bool empty() const { return m_elements.empty(); } + bool + empty() const { + return m_elements.empty(); + } /// Euality operator - bool operator==(const MaterialComposition& mc) const { + bool + operator==(const MaterialComposition& mc) const { return (mc.m_elements == m_elements); } diff --git a/Core/include/Acts/Material/MaterialMapUtils.hpp b/Core/include/Acts/Material/MaterialMapUtils.hpp index 5b6096846..12a3f52b0 100644 --- a/Core/include/Acts/Material/MaterialMapUtils.hpp +++ b/Core/include/Acts/Material/MaterialMapUtils.hpp @@ -54,14 +54,17 @@ namespace Acts { /// @note The function localToGlobalBin determines how the material was /// stored in the vector in respect to the grid values /// @param [in] lengthUnit The unit of the grid points -MaterialMapper<detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis>> -materialMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, - std::array<size_t, 2> nBinsRZ)>& - materialVectorToGridMapper, - std::vector<double> rPos, std::vector<double> zPos, - std::vector<Material> material, - double lengthUnit = UnitConstants::mm); +MaterialMapper< + detail:: + Grid<ActsVectorF<5>, detail::EquidistantAxis, detail::EquidistantAxis>> +materialMapperRZ( + const std::function< + size_t(std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ)>& + materialVectorToGridMapper, + std::vector<double> rPos, + std::vector<double> zPos, + std::vector<Material> material, + double lengthUnit = UnitConstants::mm); /// Method to setup the MaterialMapper /// @param [in] materialVectorToGridMapper Function mapping the vector of @@ -104,13 +107,19 @@ materialMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, /// @note The function localToGlobalBin determines how the material was /// stored in the vector in respect to the grid values /// @param [in] lengthUnit The unit of the grid points -MaterialMapper<detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis, detail::EquidistantAxis>> -materialMapperXYZ(const std::function<size_t(std::array<size_t, 3> binsXYZ, - std::array<size_t, 3> nBinsXYZ)>& - materialVectorToGridMapper, - std::vector<double> xPos, std::vector<double> yPos, - std::vector<double> zPos, std::vector<Material> material, - double lengthUnit = UnitConstants::mm); +MaterialMapper<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis>> +materialMapperXYZ( + const std::function< + size_t(std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ)>& + materialVectorToGridMapper, + std::vector<double> xPos, + std::vector<double> yPos, + std::vector<double> zPos, + std::vector<Material> material, + double lengthUnit = UnitConstants::mm); } // namespace Acts diff --git a/Core/include/Acts/Material/MaterialProperties.hpp b/Core/include/Acts/Material/MaterialProperties.hpp index cfe3937ea..40791c130 100644 --- a/Core/include/Acts/Material/MaterialProperties.hpp +++ b/Core/include/Acts/Material/MaterialProperties.hpp @@ -48,8 +48,13 @@ class MaterialProperties { /// @param averageZ is the average atomic number /// @param averageRho is the average density in g/mm3 /// @param thickness is the thickness of the material - MaterialProperties(float Xo, float Lo, float averageA, float averageZ, - float averageRho, float thickness); + MaterialProperties( + float Xo, + float Lo, + float averageA, + float averageZ, + float averageRho, + float thickness); /// Constructor - for full Material class /// @@ -61,8 +66,9 @@ class MaterialProperties { /// /// @param matLayers The vector of pairs of material and thickness /// @param unitThickness Boolean to set compound is set to unit thickness - MaterialProperties(const std::vector<MaterialProperties>& matLayers, - bool unitThickness = true); + MaterialProperties( + const std::vector<MaterialProperties>& matLayers, + bool unitThickness = true); /// Copy Constructor /// @@ -158,54 +164,65 @@ class MaterialProperties { float m_dInL0{0.}; //!< thickness in units of nucl. interaction length }; -inline const Material& MaterialProperties::material() const { +inline const Material& +MaterialProperties::material() const { return m_material; } -inline float MaterialProperties::thicknessInX0() const { +inline float +MaterialProperties::thicknessInX0() const { return m_dInX0; } -inline float MaterialProperties::thicknessInL0() const { +inline float +MaterialProperties::thicknessInL0() const { return m_dInL0; } -inline float MaterialProperties::thickness() const { +inline float +MaterialProperties::thickness() const { return m_thickness; } -inline float MaterialProperties::zOverAtimesRho() const { +inline float +MaterialProperties::zOverAtimesRho() const { return m_material.zOverAtimesRho(); } -inline float MaterialProperties::averageX0() const { +inline float +MaterialProperties::averageX0() const { return m_material.X0(); } -inline float MaterialProperties::averageL0() const { +inline float +MaterialProperties::averageL0() const { return m_material.L0(); } -inline float MaterialProperties::averageA() const { +inline float +MaterialProperties::averageA() const { return m_material.A(); } -inline float MaterialProperties::averageZ() const { +inline float +MaterialProperties::averageZ() const { return m_material.Z(); } -inline float MaterialProperties::averageRho() const { +inline float +MaterialProperties::averageRho() const { return m_material.rho(); } -inline bool MaterialProperties::operator==( - const MaterialProperties& mprop) const { - return (m_material == mprop.m_material && m_dInX0 == mprop.m_dInX0 && - m_dInL0 == mprop.m_dInL0); +inline bool +MaterialProperties::operator==(const MaterialProperties& mprop) const { + return ( + m_material == mprop.m_material && m_dInX0 == mprop.m_dInX0 && + m_dInL0 == mprop.m_dInL0); } -inline bool MaterialProperties::operator!=( - const MaterialProperties& mprop) const { +inline bool +MaterialProperties::operator!=(const MaterialProperties& mprop) const { return (!operator==(mprop)); } diff --git a/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp b/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp index 9ef427ae9..44d8bb177 100644 --- a/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp +++ b/Core/include/Acts/Material/ProtoSurfaceMaterial.hpp @@ -92,8 +92,8 @@ class ProtoSurfaceMaterial : public ISurfaceMaterial { /// @param ib1 indicates the seconf bin /// /// @return will return dummy material - const MaterialProperties& materialProperties(size_t ib0, - size_t ib1) const final; + const MaterialProperties& materialProperties(size_t ib0, size_t ib1) + const final; /// Output Method for std::ostream, to be overloaded by child classes std::ostream& toStream(std::ostream& sl) const final; @@ -120,11 +120,12 @@ Acts::ProtoSurfaceMaterial::materialProperties(const Vector3D& /*gp*/) const { } inline const Acts::MaterialProperties& -Acts::ProtoSurfaceMaterial::materialProperties(size_t /*ib0*/, - size_t /*ib1*/) const { +Acts::ProtoSurfaceMaterial::materialProperties(size_t /*ib0*/, size_t /*ib1*/) + const { return (m_materialProperties); } -inline const Acts::BinUtility& Acts::ProtoSurfaceMaterial::binUtility() const { +inline const Acts::BinUtility& +Acts::ProtoSurfaceMaterial::binUtility() const { return m_binUtility; } \ No newline at end of file diff --git a/Core/include/Acts/Material/SurfaceMaterialMapper.hpp b/Core/include/Acts/Material/SurfaceMaterialMapper.hpp index 03a03c756..bae4207b2 100644 --- a/Core/include/Acts/Material/SurfaceMaterialMapper.hpp +++ b/Core/include/Acts/Material/SurfaceMaterialMapper.hpp @@ -31,7 +31,8 @@ class TrackingGeometry; /// @brief selector for finding struct MaterialSurface { - bool operator()(const Surface& sf) const { + bool + operator()(const Surface& sf) const { return (sf.surfaceMaterial() != nullptr); } }; @@ -80,8 +81,9 @@ class SurfaceMaterialMapper { /// Nested State struct which is used for the mapping prococess struct State { /// Constructor of the Sate with contexts - State(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx) + State( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx) : geoContext(gctx), magFieldContext(mctx) {} /// The accumulated material per geometry ID @@ -106,10 +108,11 @@ class SurfaceMaterialMapper { /// @param cfg Configuration struct /// @param propagator The straight line propagator /// @param log The logger - SurfaceMaterialMapper(const Config& cfg, StraightLinePropagator propagator, - std::unique_ptr<const Logger> slogger = - getDefaultLogger("SurfaceMaterialMapper", - Logging::INFO)); + SurfaceMaterialMapper( + const Config& cfg, + StraightLinePropagator propagator, + std::unique_ptr<const Logger> slogger = + getDefaultLogger("SurfaceMaterialMapper", Logging::INFO)); /// @brief helper method that creates the cache for the mapping /// @@ -118,9 +121,10 @@ class SurfaceMaterialMapper { /// This method takes a TrackingGeometry, /// finds all surfaces with material proxis /// and returns you a Cache object tO be used - State createState(const GeometryContext& gctx, - const MagneticFieldContext& mctx, - const TrackingGeometry& tGeometry) const; + State createState( + const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const TrackingGeometry& tGeometry) const; /// @brief Method to finalize the maps /// @@ -138,16 +142,16 @@ class SurfaceMaterialMapper { /// /// @note the RecordedMaterialProperties of the track are assumed /// to be ordered from the starting position along the starting direction - void mapMaterialTrack(State& mState, - const RecordedMaterialTrack& mTrack) const; + void mapMaterialTrack(State& mState, const RecordedMaterialTrack& mTrack) + const; private: /// @brief finds all surfaces with ProtoSurfaceMaterial of a volume /// /// @param mState The state to be filled /// @param tVolume is current TrackingVolume - void resolveMaterialSurfaces(State& mState, - const TrackingVolume& tVolume) const; + void resolveMaterialSurfaces(State& mState, const TrackingVolume& tVolume) + const; /// @brief check and insert /// @@ -156,7 +160,10 @@ class SurfaceMaterialMapper { void checkAndInsert(State& /*mState*/, const Surface& surface) const; /// Standard logger method - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// The configuration object Config m_cfg; diff --git a/Core/include/Acts/Material/VolumeMaterialMapper.hpp b/Core/include/Acts/Material/VolumeMaterialMapper.hpp index 0ed00c40f..2bd9e3b15 100644 --- a/Core/include/Acts/Material/VolumeMaterialMapper.hpp +++ b/Core/include/Acts/Material/VolumeMaterialMapper.hpp @@ -34,15 +34,20 @@ namespace Acts { /// @return The map detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, detail::EquidistantAxis> createMaterialGrid( - std::array<double, 3> gridAxis1, std::array<double, 3> gridAxis2, + std::array<double, 3> gridAxis1, + std::array<double, 3> gridAxis2, const std::vector<std::pair<Material, Vector3D>>& mPoints, - const std::function< - detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis>:: - index_t(const Vector3D&, - const detail::Grid< - AccumulatedVolumeMaterial, detail::EquidistantAxis, - detail::EquidistantAxis>&)>& matchToGridPoint); + const std::function<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis>:: + index_t( + const Vector3D&, + const detail::Grid< + AccumulatedVolumeMaterial, + detail::EquidistantAxis, + detail::EquidistantAxis>&)>& + matchToGridPoint); /// @brief This function creates a discrete material map /// @@ -56,18 +61,27 @@ createMaterialGrid( /// of @p mPoints to the grid points by its local index /// /// @return The map -detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, detail::EquidistantAxis, - detail::EquidistantAxis> +detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis> createMaterialGrid( - std::array<double, 3> gridAxis1, std::array<double, 3> gridAxis2, + std::array<double, 3> gridAxis1, + std::array<double, 3> gridAxis2, std::array<double, 3> gridAxis3, const std::vector<std::pair<Material, Vector3D>>& mPoints, - const std::function< - detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis, detail::EquidistantAxis>:: - index_t(const Vector3D&, - const detail::Grid< - AccumulatedVolumeMaterial, detail::EquidistantAxis, - detail::EquidistantAxis, detail::EquidistantAxis>&)>& + const std::function<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis>:: + index_t( + const Vector3D&, + const detail::Grid< + AccumulatedVolumeMaterial, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis>&)>& matchToGridPoint); } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Propagator/AbortList.hpp b/Core/include/Acts/Propagator/AbortList.hpp index b30e8d0fb..7618f3331 100644 --- a/Core/include/Acts/Propagator/AbortList.hpp +++ b/Core/include/Acts/Propagator/AbortList.hpp @@ -32,8 +32,9 @@ namespace Acts { template <typename... aborters_t> struct AbortList : public detail::Extendable<aborters_t...> { private: - static_assert(not detail::has_duplicates_v<aborters_t...>, - "same aborter type specified several times"); + static_assert( + not detail::has_duplicates_v<aborters_t...>, + "same aborter type specified several times"); using detail::Extendable<aborters_t...>::tuple; @@ -84,7 +85,8 @@ struct AbortList : public detail::Extendable<aborters_t...> { /// Append new entries and return a new condition template <typename... appendices_t> - AbortList<aborters_t..., appendices_t...> append(appendices_t... aps) const { + AbortList<aborters_t..., appendices_t...> + append(appendices_t... aps) const { auto catTuple = std::tuple_cat(tuple(), std::tuple<appendices_t...>(aps...)); return AbortList<aborters_t..., appendices_t...>(std::move(catTuple)); @@ -101,8 +103,11 @@ struct AbortList : public detail::Extendable<aborters_t...> { /// @param [in,out] state is the state object from the propagator /// @param [in] stepper Stepper used for the propagation template <typename result_t, typename propagator_state_t, typename stepper_t> - bool operator()(const result_t& result, propagator_state_t& state, - const stepper_t& stepper) const { + bool + operator()( + const result_t& result, + propagator_state_t& state, + const stepper_t& stepper) const { // clang-format off static_assert(detail::all_of_v<detail::abort_condition_signature_check_v< aborters_t, @@ -110,8 +115,8 @@ struct AbortList : public detail::Extendable<aborters_t...> { "not all aborters support the specified input"); // clang-format on - return detail::abort_list_impl<aborters_t...>::check(tuple(), result, state, - stepper); + return detail::abort_list_impl<aborters_t...>::check( + tuple(), result, state, stepper); } }; diff --git a/Core/include/Acts/Propagator/ActionList.hpp b/Core/include/Acts/Propagator/ActionList.hpp index d82c20855..80c600113 100644 --- a/Core/include/Acts/Propagator/ActionList.hpp +++ b/Core/include/Acts/Propagator/ActionList.hpp @@ -30,8 +30,9 @@ namespace Acts { template <typename... actors_t> struct ActionList : public detail::Extendable<actors_t...> { private: - static_assert(not detail::has_duplicates_v<actors_t...>, - "same action type specified several times"); + static_assert( + not detail::has_duplicates_v<actors_t...>, + "same action type specified several times"); using detail::Extendable<actors_t...>::tuple; @@ -82,8 +83,11 @@ struct ActionList : public detail::Extendable<actors_t...> { /// /// @return bool type indiciating if the step size can be released template <typename propagator_state_t, typename stepper_t, typename result_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_t& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_t& result) const { // clang-format off static_assert(detail::all_of_v<detail::action_signature_check_v<actors_t, propagator_state_t, stepper_t>...>, diff --git a/Core/include/Acts/Propagator/DefaultExtension.hpp b/Core/include/Acts/Propagator/DefaultExtension.hpp index 865b46519..9f6df07af 100644 --- a/Core/include/Acts/Propagator/DefaultExtension.hpp +++ b/Core/include/Acts/Propagator/DefaultExtension.hpp @@ -24,8 +24,8 @@ struct DefaultExtension { /// @tparam stepper_t Type of the stepper /// @return Boolean flag if the step would be valid template <typename propagator_state_t, typename stepper_t> - int bid(const propagator_state_t& /*unused*/, - const stepper_t& /*unused*/) const { + int + bid(const propagator_state_t& /*unused*/, const stepper_t& /*unused*/) const { return 1; } @@ -43,9 +43,14 @@ struct DefaultExtension { /// @param [in] kprev Evaluated k_{i - 1} /// @return Boolean flag if the calculation is valid template <typename propagator_state_t, typename stepper_t> - bool k(const propagator_state_t& state, const stepper_t& stepper, - Vector3D& knew, const Vector3D& bField, const int i = 0, - const double h = 0., const Vector3D& kprev = Vector3D()) { + bool + k(const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField, + const int i = 0, + const double h = 0., + const Vector3D& kprev = Vector3D()) { auto qop = stepper.charge(state.stepping) / stepper.momentum(state.stepping); // First step does not rely on previous data @@ -69,8 +74,9 @@ struct DefaultExtension { /// @param [in] h Step size /// @return Boolean flag if the calculation is valid template <typename propagator_state_t, typename stepper_t> - bool finalize(propagator_state_t& state, const stepper_t& stepper, - const double h) const { + bool + finalize(propagator_state_t& state, const stepper_t& stepper, const double h) + const { propagateTime(state, stepper, h); return true; } @@ -87,8 +93,12 @@ struct DefaultExtension { /// @param [out] D Transport matrix /// @return Boolean flag if the calculation is valid template <typename propagator_state_t, typename stepper_t> - bool finalize(propagator_state_t& state, const stepper_t& stepper, - const double h, FreeMatrix& D) const { + bool + finalize( + propagator_state_t& state, + const stepper_t& stepper, + const double h, + FreeMatrix& D) const { propagateTime(state, stepper, h); return transportMatrix(state, stepper, h, D); } @@ -102,8 +112,11 @@ struct DefaultExtension { /// @param [in] stepper Stepper of the propagation /// @param [in] h Step size template <typename propagator_state_t, typename stepper_t> - void propagateTime(propagator_state_t& state, const stepper_t& stepper, - const double h) const { + void + propagateTime( + propagator_state_t& state, + const stepper_t& stepper, + const double h) const { /// This evaluation is based on dt/ds = 1/v = 1/(beta * c) with the velocity /// v, the speed of light c and beta = v/c. This can be re-written as dt/ds /// = sqrt(m^2/p^2 + c^{-2}) with the mass m and the momentum p. @@ -125,8 +138,12 @@ struct DefaultExtension { /// @param [out] D Transport matrix /// @return Boolean flag if evaluation is valid template <typename propagator_state_t, typename stepper_t> - bool transportMatrix(propagator_state_t& state, const stepper_t& stepper, - const double h, FreeMatrix& D) const { + bool + transportMatrix( + propagator_state_t& state, + const stepper_t& stepper, + const double h, + FreeMatrix& D) const { /// The calculations are based on ATL-SOFT-PUB-2009-002. The update of the /// Jacobian matrix is requires only the calculation of eq. 17 and 18. /// Since the terms of eq. 18 are currently 0, this matrix is not needed diff --git a/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp b/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp index 0bec75f1f..6b0a3c27a 100644 --- a/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp +++ b/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp @@ -60,7 +60,8 @@ struct DenseEnvironmentExtension { /// @param [in] state State of the propagator /// @return Boolean flag if the step would be valid template <typename propagator_state_t, typename stepper_t> - int bid(const propagator_state_t& state, const stepper_t& stepper) const { + int + bid(const propagator_state_t& state, const stepper_t& stepper) const { // Check for valid particle properties if (stepper.charge(state.stepping) == 0. || state.options.mass == 0. || stepper.momentum(state.stepping) < state.options.momentumCutOff) { @@ -88,9 +89,14 @@ struct DenseEnvironmentExtension { /// @param [in] kprev Evaluated k_{i - 1} /// @return Boolean flag if the calculation is valid template <typename propagator_state_t, typename stepper_t> - bool k(const propagator_state_t& state, const stepper_t& stepper, - Vector3D& knew, const Vector3D& bField, const int i = 0, - const double h = 0., const Vector3D& kprev = Vector3D()) { + bool + k(const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField, + const int i = 0, + const double h = 0., + const Vector3D& kprev = Vector3D()) { // i = 0 is used for setup and evaluation of k if (i == 0) { // Set up container for energy loss @@ -138,8 +144,9 @@ struct DenseEnvironmentExtension { /// @param [in] h Step size /// @return Boolean flag if the calculation is valid template <typename propagator_state_t, typename stepper_t> - bool finalize(propagator_state_t& state, const stepper_t& stepper, - const double h) const { + bool + finalize(propagator_state_t& state, const stepper_t& stepper, const double h) + const { // Evaluate the new momentum double newMomentum = stepper.momentum(state.stepping) + @@ -151,10 +158,11 @@ struct DenseEnvironmentExtension { } // Add derivative dlambda/ds = Lambda'' - state.stepping.derivative(7) = - -std::sqrt(state.options.mass * state.options.mass + - newMomentum * newMomentum) * - g / (newMomentum * newMomentum * newMomentum); + state.stepping.derivative(7) = -std::sqrt( + state.options.mass * state.options.mass + + newMomentum * newMomentum) * + g / + (newMomentum * newMomentum * newMomentum); // Update momentum state.stepping.p = newMomentum; @@ -181,8 +189,12 @@ struct DenseEnvironmentExtension { /// @param [out] D Transport matrix /// @return Boolean flag if the calculation is valid template <typename propagator_state_t, typename stepper_t> - bool finalize(propagator_state_t& state, const stepper_t& stepper, - const double h, FreeMatrix& D) const { + bool + finalize( + propagator_state_t& state, + const stepper_t& stepper, + const double h, + FreeMatrix& D) const { return finalize(state, stepper, h) && transportMatrix(state, stepper, h, D); } @@ -196,8 +208,12 @@ struct DenseEnvironmentExtension { /// @param [out] D Transport matrix /// @return Boolean flag if evaluation is valid template <typename propagator_state_t, typename stepper_t> - bool transportMatrix(propagator_state_t& state, const stepper_t& stepper, - const double h, FreeMatrix& D) const { + bool + transportMatrix( + propagator_state_t& state, + const stepper_t& stepper, + const double h, + FreeMatrix& D) const { /// The calculations are based on ATL-SOFT-PUB-2009-002. The update of the /// Jacobian matrix is requires only the calculation of eq. 17 and 18. /// Since the terms of eq. 18 are currently 0, this matrix is not needed @@ -293,25 +309,31 @@ struct DenseEnvironmentExtension { double dtpp1dl = -state.options.mass * state.options.mass * qop[0] * qop[0] * - (3. * g + qop[0] * dgdqop(energy[0], state.options.mass, - state.options.absPdgCode, - state.options.meanEnergyLoss)); + (3. * g + qop[0] * dgdqop( + energy[0], + state.options.mass, + state.options.absPdgCode, + state.options.meanEnergyLoss)); double qopNew = qop[0] + half_h * Lambdappi[0]; double dtpp2dl = -state.options.mass * state.options.mass * qopNew * qopNew * (3. * g * (1. + half_h * jdL[0]) + - qopNew * dgdqop(energy[1], state.options.mass, - state.options.absPdgCode, - state.options.meanEnergyLoss)); + qopNew * dgdqop( + energy[1], + state.options.mass, + state.options.absPdgCode, + state.options.meanEnergyLoss)); qopNew = qop[0] + half_h * Lambdappi[1]; double dtpp3dl = -state.options.mass * state.options.mass * qopNew * qopNew * (3. * g * (1. + half_h * jdL[1]) + - qopNew * dgdqop(energy[2], state.options.mass, - state.options.absPdgCode, - state.options.meanEnergyLoss)); + qopNew * dgdqop( + energy[2], + state.options.mass, + state.options.absPdgCode, + state.options.meanEnergyLoss)); D(3, 7) = h * h / 6. * (dtpp1dl + dtpp2dl + dtpp3dl); return true; @@ -328,8 +350,13 @@ struct DenseEnvironmentExtension { /// @param [in] meanEnergyLoss Boolean indicator if mean or mode of the energy /// loss will be evaluated /// @return Infinitesimal energy loss - double dEds(const double energy_, const double momentum, const double mass, - const int pdg, const bool meanEnergyLoss) const { + double + dEds( + const double energy_, + const double momentum, + const double mass, + const int pdg, + const bool meanEnergyLoss) const { // Easy exit if material is invalid if (material->X0() == 0 || material->Z() == 0) { return 0.; @@ -337,11 +364,15 @@ struct DenseEnvironmentExtension { // Calculate energy loss by // a) ionisation - double ionisationEnergyLoss = - ionisationLoss - .dEds(mass, momentum / energy_, energy_ / mass, *(material), 1., - meanEnergyLoss) - .first; + double ionisationEnergyLoss = ionisationLoss + .dEds( + mass, + momentum / energy_, + energy_ / mass, + *(material), + 1., + meanEnergyLoss) + .first; // b) radiation double radiationEnergyLoss = radiationLoss.dEds(energy_, mass, *(material), pdg, 1.); @@ -365,8 +396,12 @@ struct DenseEnvironmentExtension { /// @param [in] meanEnergyLoss Return mean or mode of the energy loss /// @return Derivative evaluated at the point defined by the /// function parameters - double dgdqop(const double energy_, const double mass, const int pdg, - const bool meanEnergyLoss) const { + double + dgdqop( + const double energy_, + const double mass, + const int pdg, + const bool meanEnergyLoss) const { // Fast exit if material is invalid if (material->X0() == 0. || material->Z() == 0. || material->zOverAtimesRho() == 0.) { @@ -395,11 +430,16 @@ struct DenseEnvironmentExtension { /// @tparam propagator_state_t Type of the state of the propagator /// @param [in] state Deliverer of configurations template <typename propagator_state_t> - void initializeEnergyLoss(const propagator_state_t& state) { + void + initializeEnergyLoss(const propagator_state_t& state) { energy[0] = std::hypot(initialMomentum, state.options.mass); // Use the same energy loss throughout the step. - g = dEds(energy[0], initialMomentum, state.options.mass, - state.options.absPdgCode, state.options.meanEnergyLoss); + g = dEds( + energy[0], + initialMomentum, + state.options.mass, + state.options.absPdgCode, + state.options.meanEnergyLoss); // Change of the momentum per path length // dPds = dPdE * dEds dPds[0] = g * energy[0] / initialMomentum; @@ -407,16 +447,19 @@ struct DenseEnvironmentExtension { // Calculate the change of the energy loss per path length and // inverse momentum if (state.options.includeGgradient) { - dgdqopValue = - dgdqop(energy[0], state.options.mass, state.options.absPdgCode, - state.options - .meanEnergyLoss); // Use this value throughout the step. + dgdqopValue = dgdqop( + energy[0], + state.options.mass, + state.options.absPdgCode, + state.options + .meanEnergyLoss); // Use this value throughout the step. } // Calculate term for later error propagation - dLdl[0] = (-qop[0] * qop[0] * g * energy[0] * - (3. - (initialMomentum * initialMomentum) / - (energy[0] * energy[0])) - - qop[0] * qop[0] * qop[0] * energy[0] * dgdqopValue); + dLdl[0] = + (-qop[0] * qop[0] * g * energy[0] * + (3. - + (initialMomentum * initialMomentum) / (energy[0] * energy[0])) - + qop[0] * qop[0] * qop[0] * energy[0] * dgdqopValue); } } @@ -429,9 +472,13 @@ struct DenseEnvironmentExtension { /// @param [in] state State of the stepper /// @param [in] i Index of the sub-step (1-3) template <typename stepper_state_t, typename stepper_t> - void updateEnergyLoss(const double mass, const double h, - const stepper_state_t& state, const stepper_t& stepper, - const int i) { + void + updateEnergyLoss( + const double mass, + const double h, + const stepper_state_t& state, + const stepper_t& stepper, + const int i) { // Update parameters related to a changed momentum currentMomentum = initialMomentum + h * dPds[i - 1]; energy[i] = std::sqrt(currentMomentum * currentMomentum + mass * mass); @@ -439,16 +486,18 @@ struct DenseEnvironmentExtension { qop[i] = stepper.charge(state) / currentMomentum; // Calculate term for later error propagation if (state.covTransport) { - dLdl[i] = (-qop[i] * qop[i] * g * energy[i] * - (3. - (currentMomentum * currentMomentum) / - (energy[i] * energy[i])) - - qop[i] * qop[i] * qop[i] * energy[i] * dgdqopValue); + dLdl[i] = + (-qop[i] * qop[i] * g * energy[i] * + (3. - + (currentMomentum * currentMomentum) / (energy[i] * energy[i])) - + qop[i] * qop[i] * qop[i] * energy[i] * dgdqopValue); } } }; -template <typename action_list_t = ActionList<>, - typename aborter_list_t = AbortList<>> +template < + typename action_list_t = ActionList<>, + typename aborter_list_t = AbortList<>> struct DenseStepperPropagatorOptions : public PropagatorOptions<action_list_t, aborter_list_t> { /// Copy Constructor @@ -480,8 +529,8 @@ struct DenseStepperPropagatorOptions /// /// @param aborters The new aborter list to be used (internally) template <typename extended_aborter_list_t> - DenseStepperPropagatorOptions<action_list_t, extended_aborter_list_t> extend( - extended_aborter_list_t aborters) const { + DenseStepperPropagatorOptions<action_list_t, extended_aborter_list_t> + extend(extended_aborter_list_t aborters) const { DenseStepperPropagatorOptions<action_list_t, extended_aborter_list_t> eoptions(this->geoContext, this->magFieldContext); // Copy the options over diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index fc57b0676..7fe8fbb81 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -36,9 +36,11 @@ namespace Acts { /// with s being the arc length of the track, q the charge of the particle, /// p its momentum and B the magnetic field /// -template <typename BField, typename corrector_t = VoidIntersectionCorrector, - typename extensionlist_t = StepperExtensionList<DefaultExtension>, - typename auctioneer_t = detail::VoidAuctioneer> +template < + typename BField, + typename corrector_t = VoidIntersectionCorrector, + typename extensionlist_t = StepperExtensionList<DefaultExtension>, + typename auctioneer_t = detail::VoidAuctioneer> class EigenStepper { private: // This struct is a meta-function which normally maps to BoundParameters... @@ -81,10 +83,12 @@ class EigenStepper { /// /// @note the covariance matrix is copied when needed template <typename parameters_t> - explicit State(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx, - const parameters_t& par, NavigationDirection ndir = forward, - double ssize = std::numeric_limits<double>::max()) + explicit State( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx, + const parameters_t& par, + NavigationDirection ndir = forward, + double ssize = std::numeric_limits<double>::max()) : pos(par.position()), dir(par.momentum().normalized()), p(par.momentum().norm()), @@ -104,8 +108,8 @@ class EigenStepper { // set the covariance transport flag to true and copy covTransport = true; cov = BoundSymMatrix(*par.covariance()); - surface.initJacobianToGlobal(gctx, jacToGlobal, pos, dir, - par.parameters()); + surface.initJacobianToGlobal( + gctx, jacToGlobal, pos, dir, par.parameters()); } } @@ -197,25 +201,41 @@ class EigenStepper { /// @param [in,out] state is the propagation state associated with the track /// the magnetic field cell is used (and potentially updated) /// @param [in] pos is the field position - Vector3D getField(State& state, const Vector3D& pos) const { + Vector3D + getField(State& state, const Vector3D& pos) const { // get the field from the cell return m_bField.getField(pos, state.fieldCache); } /// Global particle position accessor - Vector3D position(const State& state) const { return state.pos; } + Vector3D + position(const State& state) const { + return state.pos; + } /// Momentum direction accessor - Vector3D direction(const State& state) const { return state.dir; } + Vector3D + direction(const State& state) const { + return state.dir; + } /// Actual momentum accessor - double momentum(const State& state) const { return state.p; } + double + momentum(const State& state) const { + return state.p; + } /// Charge access - double charge(const State& state) const { return state.q; } + double + charge(const State& state) const { + return state.q; + } /// Time access - double time(const State& state) const { return state.t0 + state.dt; } + double + time(const State& state) const { + return state.t0 + state.dt; + } /// Tests if the state reached a surface /// @@ -223,9 +243,10 @@ class EigenStepper { /// @param [in] surface Surface that is tested /// /// @return Boolean statement if surface is reached by state - bool surfaceReached(const State& state, const Surface* surface) const { - return surface->isOnSurface(state.geoContext, position(state), - direction(state), true); + bool + surfaceReached(const State& state, const Surface* surface) const { + return surface->isOnSurface( + state.geoContext, position(state), direction(state), true); } /// Create and return the bound state at the current position @@ -244,8 +265,10 @@ class EigenStepper { /// - the parameters at the surface /// - the stepwise jacobian towards it (from last bound) /// - and the path length (from start - for ordering) - BoundState boundState(State& state, const Surface& surface, - bool reinitialize = true) const; + BoundState boundState( + State& state, + const Surface& surface, + bool reinitialize = true) const; /// Create and return a curvilinear state at the current position /// @@ -260,8 +283,8 @@ class EigenStepper { /// - the curvilinear parameters at given position /// - the stepweise jacobian towards it (from last bound) /// - and the path length (from start - for ordering) - CurvilinearState curvilinearState(State& state, - bool reinitialize = true) const; + CurvilinearState curvilinearState(State& state, bool reinitialize = true) + const; /// Method to update a stepper state to the some parameters /// @@ -275,11 +298,16 @@ class EigenStepper { /// @param [in] uposition the updated position /// @param [in] udirection the updated direction /// @param [in] up the updated momentum value - void update(State& state, const Vector3D& uposition, - const Vector3D& udirection, double up, double time) const; + void update( + State& state, + const Vector3D& uposition, + const Vector3D& udirection, + double up, + double time) const; /// Return a corrector - corrector_t corrector(State& state) const { + corrector_t + corrector(State& state) const { return corrector_t(state.startPos, state.startDir, state.pathAccumulated); } @@ -305,8 +333,10 @@ class EigenStepper { /// @param [in] reinitialize is a flag to steer whether the state should be /// reinitialized at the new position /// @note no check is done if the position is actually on the surface - void covarianceTransport(State& state, const Surface& surface, - bool reinitialize = true) const; + void covarianceTransport( + State& state, + const Surface& surface, + bool reinitialize = true) const; /// Perform a Runge-Kutta track parameter propagation step /// diff --git a/Core/include/Acts/Propagator/EigenStepper.ipp b/Core/include/Acts/Propagator/EigenStepper.ipp index 947f58d08..71618d357 100644 --- a/Core/include/Acts/Propagator/EigenStepper.ipp +++ b/Core/include/Acts/Propagator/EigenStepper.ipp @@ -11,10 +11,11 @@ Acts::EigenStepper<B, C, E, A>::EigenStepper(B bField) : m_bField(std::move(bField)) {} template <typename B, typename C, typename E, typename A> -auto Acts::EigenStepper<B, C, E, A>::boundState(State& state, - const Surface& surface, - bool reinitialize) const - -> BoundState { +auto +Acts::EigenStepper<B, C, E, A>::boundState( + State& state, + const Surface& surface, + bool reinitialize) const -> BoundState { // Transport the covariance to here std::unique_ptr<const Covariance> covPtr = nullptr; if (state.covTransport) { @@ -22,12 +23,17 @@ auto Acts::EigenStepper<B, C, E, A>::boundState(State& state, covPtr = std::make_unique<const Covariance>(state.cov); } // Create the bound parameters - BoundParameters parameters(state.geoContext, std::move(covPtr), state.pos, - state.p * state.dir, state.q, state.t0 + state.dt, - surface.getSharedPtr()); + BoundParameters parameters( + state.geoContext, + std::move(covPtr), + state.pos, + state.p * state.dir, + state.q, + state.t0 + state.dt, + surface.getSharedPtr()); // Create the bound state - BoundState bState{std::move(parameters), state.jacobian, - state.pathAccumulated}; + BoundState bState{ + std::move(parameters), state.jacobian, state.pathAccumulated}; // Reset the jacobian to identity if (reinitialize) { state.jacobian = Jacobian::Identity(); @@ -37,9 +43,10 @@ auto Acts::EigenStepper<B, C, E, A>::boundState(State& state, } template <typename B, typename C, typename E, typename A> -auto Acts::EigenStepper<B, C, E, A>::curvilinearState(State& state, - bool reinitialize) const - -> CurvilinearState { +auto +Acts::EigenStepper<B, C, E, A>::curvilinearState( + State& state, + bool reinitialize) const -> CurvilinearState { // Transport the covariance to here std::unique_ptr<const Covariance> covPtr = nullptr; if (state.covTransport) { @@ -47,12 +54,15 @@ auto Acts::EigenStepper<B, C, E, A>::curvilinearState(State& state, covPtr = std::make_unique<const Covariance>(state.cov); } // Create the curvilinear parameters - CurvilinearParameters parameters(std::move(covPtr), state.pos, - state.p * state.dir, state.q, - state.t0 + state.dt); + CurvilinearParameters parameters( + std::move(covPtr), + state.pos, + state.p * state.dir, + state.q, + state.t0 + state.dt); // Create the bound state - CurvilinearState curvState{std::move(parameters), state.jacobian, - state.pathAccumulated}; + CurvilinearState curvState{ + std::move(parameters), state.jacobian, state.pathAccumulated}; // Reset the jacobian to identity if (reinitialize) { state.jacobian = Jacobian::Identity(); @@ -62,8 +72,10 @@ auto Acts::EigenStepper<B, C, E, A>::curvilinearState(State& state, } template <typename B, typename C, typename E, typename A> -void Acts::EigenStepper<B, C, E, A>::update(State& state, - const BoundParameters& pars) const { +void +Acts::EigenStepper<B, C, E, A>::update( + State& state, + const BoundParameters& pars) const { const auto& mom = pars.momentum(); state.pos = pars.position(); state.dir = mom.normalized(); @@ -75,10 +87,13 @@ void Acts::EigenStepper<B, C, E, A>::update(State& state, } template <typename B, typename C, typename E, typename A> -void Acts::EigenStepper<B, C, E, A>::update(State& state, - const Vector3D& uposition, - const Vector3D& udirection, - double up, double time) const { +void +Acts::EigenStepper<B, C, E, A>::update( + State& state, + const Vector3D& uposition, + const Vector3D& udirection, + double up, + double time) const { state.pos = uposition; state.dir = udirection; state.p = up; @@ -86,8 +101,10 @@ void Acts::EigenStepper<B, C, E, A>::update(State& state, } template <typename B, typename C, typename E, typename A> -void Acts::EigenStepper<B, C, E, A>::covarianceTransport( - State& state, bool reinitialize) const { +void +Acts::EigenStepper<B, C, E, A>::covarianceTransport( + State& state, + bool reinitialize) const { // Optimized trigonometry on the propagation direction const double x = state.dir(0); // == cos(phi) * sin(theta) const double y = state.dir(1); // == sin(phi) * sin(theta) @@ -161,15 +178,18 @@ void Acts::EigenStepper<B, C, E, A>::covarianceTransport( } template <typename B, typename C, typename E, typename A> -void Acts::EigenStepper<B, C, E, A>::covarianceTransport( - State& state, const Surface& surface, bool reinitialize) const { +void +Acts::EigenStepper<B, C, E, A>::covarianceTransport( + State& state, + const Surface& surface, + bool reinitialize) const { using VectorHelpers::phi; using VectorHelpers::theta; // Initialize the transport final frame jacobian FreeToBoundMatrix jacToLocal = FreeToBoundMatrix::Zero(); // initalize the jacobian to local, returns the transposed ref frame - auto rframeT = surface.initJacobianToLocal(state.geoContext, jacToLocal, - state.pos, state.dir); + auto rframeT = surface.initJacobianToLocal( + state.geoContext, jacToLocal, state.pos, state.dir); // Update the jacobian with the transport from the steps state.jacToGlobal = state.jacTransport * state.jacToGlobal; // calculate the form factors for the derivatives @@ -194,8 +214,8 @@ void Acts::EigenStepper<B, C, E, A>::covarianceTransport( BoundVector pars; pars << loc[eLOC_0], loc[eLOC_1], phi(state.dir), theta(state.dir), state.q / state.p, state.t0 + state.dt; - surface.initJacobianToGlobal(state.geoContext, state.jacToGlobal, state.pos, - state.dir, pars); + surface.initJacobianToGlobal( + state.geoContext, state.jacToGlobal, state.pos, state.dir, pars); } // Store The global and bound jacobian (duplication for the moment) state.jacobian = jacFull * state.jacobian; @@ -203,8 +223,8 @@ void Acts::EigenStepper<B, C, E, A>::covarianceTransport( template <typename B, typename C, typename E, typename A> template <typename propagator_state_t> -Acts::Result<double> Acts::EigenStepper<B, C, E, A>::step( - propagator_state_t& state) const { +Acts::Result<double> +Acts::EigenStepper<B, C, E, A>::step(propagator_state_t& state) const { using namespace Acts::UnitLiterals; // Runge-Kutta integrator state @@ -232,14 +252,14 @@ Acts::Result<double> Acts::EigenStepper<B, C, E, A>::step( const Vector3D pos1 = state.stepping.pos + half_h * state.stepping.dir + h2 * 0.125 * sd.k1; sd.B_middle = getField(state.stepping, pos1); - if (!state.stepping.extension.k2(state, *this, sd.k2, sd.B_middle, half_h, - sd.k1)) { + if (!state.stepping.extension.k2( + state, *this, sd.k2, sd.B_middle, half_h, sd.k1)) { return false; } // Third Runge-Kutta point - if (!state.stepping.extension.k3(state, *this, sd.k3, sd.B_middle, half_h, - sd.k2)) { + if (!state.stepping.extension.k3( + state, *this, sd.k3, sd.B_middle, half_h, sd.k2)) { return false; } @@ -247,8 +267,8 @@ Acts::Result<double> Acts::EigenStepper<B, C, E, A>::step( const Vector3D pos2 = state.stepping.pos + h * state.stepping.dir + h2 * 0.5 * sd.k3; sd.B_last = getField(state.stepping, pos2); - if (!state.stepping.extension.k4(state, *this, sd.k4, sd.B_last, h, - sd.k3)) { + if (!state.stepping.extension.k4( + state, *this, sd.k4, sd.B_last, h, sd.k3)) { return false; } @@ -264,11 +284,13 @@ Acts::Result<double> Acts::EigenStepper<B, C, E, A>::step( // Select and adjust the appropriate Runge-Kutta step size as given // ATL-SOFT-PUB-2009-001 while (!tryRungeKuttaStep(state.stepping.stepSize)) { - stepSizeScaling = - std::min(std::max(0.25, std::pow((state.options.tolerance / - std::abs(2. * error_estimate)), - 0.25)), - 4.); + stepSizeScaling = std::min( + std::max( + 0.25, + std::pow( + (state.options.tolerance / std::abs(2. * error_estimate)), + 0.25)), + 4.); if (stepSizeScaling == 1.) { break; } diff --git a/Core/include/Acts/Propagator/EigenStepperError.hpp b/Core/include/Acts/Propagator/EigenStepperError.hpp index 2d18a3b7e..1fcd6946d 100644 --- a/Core/include/Acts/Propagator/EigenStepperError.hpp +++ b/Core/include/Acts/Propagator/EigenStepperError.hpp @@ -21,9 +21,13 @@ namespace detail { class EigenStepperErrorCategory : public std::error_category { public: // Return a short descriptive name for the category - const char* name() const noexcept final { return "EigenStepperError"; } + const char* + name() const noexcept final { + return "EigenStepperError"; + } // Return what each enum means in text - std::string message(int c) const final { + std::string + message(int c) const final { switch (static_cast<EigenStepperError>(c)) { case EigenStepperError::StepSizeStalled: return "Step size fell below minimum threshold"; @@ -43,7 +47,8 @@ EigenStepperErrorCategory() { return c; } -inline std::error_code make_error_code(Acts::EigenStepperError e) { +inline std::error_code +make_error_code(Acts::EigenStepperError e) { return {static_cast<int>(e), Acts::EigenStepperErrorCategory()}; } } // namespace Acts diff --git a/Core/include/Acts/Propagator/MaterialInteractor.hpp b/Core/include/Acts/Propagator/MaterialInteractor.hpp index 0622b7cd7..f39ff1095 100644 --- a/Core/include/Acts/Propagator/MaterialInteractor.hpp +++ b/Core/include/Acts/Propagator/MaterialInteractor.hpp @@ -93,8 +93,11 @@ struct MaterialInteractor { /// @param stepper The stepper in use /// @param result is the mutable result state object template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { using namespace Acts::UnitLiterals; // If we are on target, everything should have been done @@ -120,8 +123,8 @@ struct MaterialInteractor { }); mStage = postUpdate; // Or is it the target surface ? - } else if (state.navigation.targetSurface == - state.navigation.currentSurface) { + } else if ( + state.navigation.targetSurface == state.navigation.currentSurface) { debugLog(state, [&] { return std::string("Update on target surface: pre-update mode"); }); @@ -158,7 +161,8 @@ struct MaterialInteractor { // Calculate the path correction double pCorrection = state.navigation.currentSurface->pathCorrection( - state.geoContext, stepper.position(state.stepping), + state.geoContext, + stepper.position(state.stepping), stepper.direction(state.stepping)); // Scale the material properties @@ -231,7 +235,8 @@ struct MaterialInteractor { mInteraction.deltaP = p - newP; // Update the state/momentum stepper.update( - state.stepping, stepper.position(state.stepping), + state.stepping, + stepper.position(state.stepping), stepper.direction(state.stepping), std::copysign(newP, stepper.momentum(state.stepping)), stepper.time(state.stepping)); @@ -281,7 +286,8 @@ struct MaterialInteractor { /// Pure observer interface /// This does not apply to the surface collector template <typename propagator_state_t> - void operator()(propagator_state_t& /*state*/) const {} + void + operator()(propagator_state_t& /*state*/) const {} private: /// The private propagation debug logging @@ -296,8 +302,10 @@ struct MaterialInteractor { /// length /// @param logAction is a callable function that returns a stremable object template <typename propagator_state_t> - void debugLog(propagator_state_t& state, - const std::function<std::string()>& logAction) const { + void + debugLog( + propagator_state_t& state, + const std::function<std::string()>& logAction) const { if (state.options.debug) { std::stringstream dstream; dstream << " " << std::setw(state.options.debugPfxWidth); diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index 4887845b2..1e59b2551 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -64,10 +64,14 @@ struct NavigationOptions { /// @param sobject Start object to check against /// @param eobject End object to check against /// @param maxStepLength Maximal step length to check against - NavigationOptions(NavigationDirection ndir, BoundaryCheck bcheck, - bool resolves = true, bool resolvem = true, - bool resolvep = false, const object_t* sobject = nullptr, - const object_t* eobject = nullptr) + NavigationOptions( + NavigationDirection ndir, + BoundaryCheck bcheck, + bool resolves = true, + bool resolvem = true, + bool resolvep = false, + const object_t* sobject = nullptr, + const object_t* eobject = nullptr) : navDir(ndir), boundaryCheck(std::move(bcheck)), resolveSensitive(resolves), @@ -222,7 +226,8 @@ class Navigator { /// @param [in,out] state is the mutable propagator state object /// @param [in] stepper Stepper in use template <typename propagator_state_t, typename stepper_t> - void status(propagator_state_t& state, const stepper_t& stepper) const { + void + status(propagator_state_t& state, const stepper_t& stepper) const { // Check if the navigator is inactive if (inactive(state, stepper)) { return; @@ -246,10 +251,13 @@ class Navigator { // (b) Status call within propagation loop // Try finding status of surfaces - if (status(state, stepper, state.navigation.navSurfaces, - state.navigation.navSurfaceIter)) { - debugLog(state, - [&] { return std::string("Status: in surface handling."); }); + if (status( + state, + stepper, + state.navigation.navSurfaces, + state.navigation.navSurfaceIter)) { + debugLog( + state, [&] { return std::string("Status: in surface handling."); }); if (state.navigation.currentSurface) { debugLog(state, [&] { return std::string("On surface: switch forward or release."); @@ -269,10 +277,13 @@ class Navigator { // Set the navigation stage to surface target state.navigation.navigationStage = Stage::surfaceTarget; // Try finding status of layer - } else if (status(state, stepper, state.navigation.navLayers, - state.navigation.navLayerIter)) { - debugLog(state, - [&] { return std::string("Status: in layer handling."); }); + } else if (status( + state, + stepper, + state.navigation.navLayers, + state.navigation.navLayerIter)) { + debugLog( + state, [&] { return std::string("Status: in layer handling."); }); if (state.navigation.currentSurface != nullptr) { debugLog(state, [&] { return std::string("On layer: update layer information."); @@ -289,10 +300,13 @@ class Navigator { state.navigation.navigationStage = Stage::layerTarget; } // Try finding status of boundaries - } else if (status(state, stepper, state.navigation.navBoundaries, - state.navigation.navBoundaryIter)) { - debugLog(state, - [&] { return std::string("Status: in boundary handling."); }); + } else if (status( + state, + stepper, + state.navigation.navBoundaries, + state.navigation.navBoundaryIter)) { + debugLog( + state, [&] { return std::string("Status: in boundary handling."); }); // Are we on the boundary - then overwrite the stage if (state.navigation.currentSurface != nullptr) { @@ -309,8 +323,10 @@ class Navigator { // get the attached volume information auto boundary = state.navigation.navBoundaryIter->object; state.navigation.currentVolume = boundary->attachedVolume( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), state.stepping.navDir); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + state.stepping.navDir); // No volume anymore : end of known world if (!state.navigation.currentVolume) { debugLog(state, [&] { @@ -332,8 +348,8 @@ class Navigator { // Set the navigation stage back to boundary target state.navigation.navigationStage = Stage::boundaryTarget; } - } else if (state.navigation.currentVolume == - state.navigation.targetVolume) { + } else if ( + state.navigation.currentVolume == state.navigation.targetVolume) { debugLog(state, [&] { return std::string("No further navigation action, proceed to target."); }); @@ -361,7 +377,8 @@ class Navigator { /// @param [in,out] state is the mutable propagator state object /// @param [in] stepper Stepper in use template <typename propagator_state_t, typename stepper_t> - void target(propagator_state_t& state, const stepper_t& stepper) const { + void + target(propagator_state_t& state, const stepper_t& stepper) const { // Check if the navigator is inactive if (inactive(state, stepper)) { return; @@ -382,14 +399,15 @@ class Navigator { // Try targeting the surfaces - then layers - then boundaries if (state.navigation.navigationStage <= Stage::surfaceTarget and targetSurfaces(state, stepper, navCorr)) { - debugLog(state, - [&] { return std::string("Target set to next surface."); }); - } else if (state.navigation.navigationStage <= Stage::layerTarget and - targetLayers(state, stepper, navCorr)) { + debugLog( + state, [&] { return std::string("Target set to next surface."); }); + } else if ( + state.navigation.navigationStage <= Stage::layerTarget and + targetLayers(state, stepper, navCorr)) { debugLog(state, [&] { return std::string("Target set to next layer."); }); } else if (targetBoundaries(state, stepper, navCorr)) { - debugLog(state, - [&] { return std::string("Target set to next boundary."); }); + debugLog( + state, [&] { return std::string("Target set to next boundary."); }); } else { debugLog(state, [&] { return std::string("No furter navigation action, proceed to target."); @@ -418,7 +436,8 @@ class Navigator { /// /// @return boolean return triggers exit to stepper template <typename propagator_state_t, typename stepper_t> - void initialize(propagator_state_t& state, const stepper_t& stepper) const { + void + initialize(propagator_state_t& state, const stepper_t& stepper) const { // Call the navigation helper prior to actual navigation debugLog(state, [&] { return std::string("Initialization."); }); @@ -501,11 +520,17 @@ class Navigator { /// @param [in] navIter test surface fore the status test /// /// @return boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename navigation_surfaces_t, typename navigation_iter_t> - bool status(propagator_state_t& state, const stepper_t& stepper, - navigation_surfaces_t& navSurfaces, - const navigation_iter_t& navIter) const { + template < + typename propagator_state_t, + typename stepper_t, + typename navigation_surfaces_t, + typename navigation_iter_t> + bool + status( + propagator_state_t& state, + const stepper_t& stepper, + navigation_surfaces_t& navSurfaces, + const navigation_iter_t& navIter) const { // No surfaces, status check will be done on layer if (navSurfaces.empty() or navIter == navSurfaces.end()) { return false; @@ -548,10 +573,15 @@ class Navigator { /// @param [in] navCorr is the navigation path corrector /// /// boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename corrector_t> - bool targetSurfaces(propagator_state_t& state, const stepper_t& stepper, - const corrector_t& navCorr) const { + template < + typename propagator_state_t, + typename stepper_t, + typename corrector_t> + bool + targetSurfaces( + propagator_state_t& state, + const stepper_t& stepper, + const corrector_t& navCorr) const { if (state.navigation.navigationBreak) { return false; } @@ -559,8 +589,8 @@ class Navigator { // Make sure resolve Surfaces is called on the start layer if (state.navigation.startLayer and not state.navigation.startLayerResolved) { - debugLog(state, - [&] { return std::string("Start layer to be resolved."); }); + debugLog( + state, [&] { return std::string("Start layer to be resolved."); }); // We provide the layer to the resolve surface method in this case state.navigation.startLayerResolved = true; bool startResolved = @@ -598,8 +628,9 @@ class Navigator { // Screen output how much is left to try debugLog(state, [&] { std::stringstream dstream; - dstream << std::distance(state.navigation.navSurfaceIter, - state.navigation.navSurfaces.end()); + dstream << std::distance( + state.navigation.navSurfaceIter, + state.navigation.navSurfaces.end()); dstream << " out of " << state.navigation.navSurfaces.size(); dstream << " surfaces remain to try."; return dstream.str(); @@ -615,8 +646,11 @@ class Navigator { }); // Now intersect (should exclude punch-through) auto surfaceIntersect = surface->surfaceIntersectionEstimate( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr); double surfaceDistance = surfaceIntersect.intersection.pathLength; if (!surfaceIntersect) { debugLog(state, [&] { @@ -670,10 +704,15 @@ class Navigator { /// @param [in] corrector_t navCorr is the navigation path corrector /// /// @return boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename corrector_t> - bool targetLayers(propagator_state_t& state, const stepper_t& stepper, - const corrector_t& navCorr) const { + template < + typename propagator_state_t, + typename stepper_t, + typename corrector_t> + bool + targetLayers( + propagator_state_t& state, + const stepper_t& stepper, + const corrector_t& navCorr) const { if (state.navigation.navigationBreak) { return false; } @@ -688,8 +727,13 @@ class Navigator { if (state.navigation.currentVolume->hasBoundingVolumeHierarchy()) { // has hierarchy, use that, skip layer resolution NavigationOptions<Surface> navOpts( - state.stepping.navDir, true, resolveSensitive, resolveMaterial, - resolvePassive, nullptr, state.navigation.targetSurface); + state.stepping.navDir, + true, + resolveSensitive, + resolveMaterial, + resolvePassive, + nullptr, + state.navigation.targetSurface); double opening_angle = 0; // Preliminary version of the frustum opening angle estimation. @@ -728,8 +772,11 @@ class Navigator { auto protoNavSurfaces = state.navigation.currentVolume->compatibleSurfacesFromHierarchy( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), opening_angle, navOpts, + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + opening_angle, + navOpts, navCorr); if (!protoNavSurfaces.empty()) { // did we find any surfaces? @@ -745,9 +792,11 @@ class Navigator { state.navigation.navSurfaces.begin(); state.navigation.navLayers = {}; state.navigation.navLayerIter = state.navigation.navLayers.end(); - updateStep(state, navCorr, - state.navigation.navSurfaceIter->intersection.pathLength, - true); + updateStep( + state, + navCorr, + state.navigation.navSurfaceIter->intersection.pathLength, + true); return true; } } @@ -779,8 +828,11 @@ class Navigator { // Otherwise try to step towards it NavigationOptions<Surface> navOpts(state.stepping.navDir, true); auto layerIntersect = layerSurface->surfaceIntersectionEstimate( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr); // check if the intersect is invalid if (!layerIntersect) { debugLog(state, [&] { @@ -789,8 +841,8 @@ class Navigator { ++state.navigation.navLayerIter; } else { // update the navigation step size, release the former first - updateStep(state, navCorr, layerIntersect.intersection.pathLength, - true); + updateStep( + state, navCorr, layerIntersect.intersection.pathLength, true); return true; } } @@ -844,10 +896,15 @@ class Navigator { /// @param [in] navCorr is the navigation path corrector /// /// boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename corrector_t> - bool targetBoundaries(propagator_state_t& state, const stepper_t& stepper, - const corrector_t& navCorr) const { + template < + typename propagator_state_t, + typename stepper_t, + typename corrector_t> + bool + targetBoundaries( + propagator_state_t& state, + const stepper_t& stepper, + const corrector_t& navCorr) const { if (state.navigation.navigationBreak) { return false; } @@ -860,8 +917,8 @@ class Navigator { }); state.stepping.stepSize.release(Cstep::actor); return false; - } else if (state.navigation.currentVolume == - state.navigation.targetVolume) { + } else if ( + state.navigation.currentVolume == state.navigation.targetVolume) { debugLog(state, [&] { return std::string( "In target volume: no need to resolve boundary, " @@ -894,8 +951,11 @@ class Navigator { // Evaluate the boundary surfaces state.navigation.navBoundaries = state.navigation.currentVolume->compatibleBoundaries( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr, + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr, BoundaryIntersectionSorter()); // The number of boundary candidates debugLog(state, [&] { @@ -918,8 +978,11 @@ class Navigator { auto boundarySurface = state.navigation.navBoundaryIter->representation; // Step towards the boundary surface auto boundaryIntersect = boundarySurface->surfaceIntersectionEstimate( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr); // Distance auto distance = boundaryIntersect.intersection.pathLength; // Check the boundary is properly intersected: we are in target mode @@ -942,8 +1005,8 @@ class Navigator { ++state.navigation.navBoundaryIter; } else { - debugLog(state, - [&] { return std::string("Boundary intersection valid."); }); + debugLog( + state, [&] { return std::string("Boundary intersection valid."); }); // This is a new navigation stream, release the former first updateStep(state, navCorr, distance, true); return true; @@ -975,10 +1038,15 @@ class Navigator { /// @param [in] navCorr is the navigation path corrector /// /// boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename corrector_t> - void initializeTarget(propagator_state_t& state, const stepper_t& stepper, - const corrector_t& navCorr) const { + template < + typename propagator_state_t, + typename stepper_t, + typename corrector_t> + void + initializeTarget( + propagator_state_t& state, + const stepper_t& stepper, + const corrector_t& navCorr) const { if (state.navigation.targetVolume && state.stepping.pathAccumulated == 0.) { debugLog(state, [&] { return std::string("Re-initialzing cancelled as it is the first step."); @@ -1012,14 +1080,20 @@ class Navigator { } // Slow navigation initialization for target: // target volume and layer search through global search - NavigationOptions<Surface> navOpts(state.stepping.navDir, false, - resolveSensitive, resolveMaterial, - resolvePassive); + NavigationOptions<Surface> navOpts( + state.stepping.navDir, + false, + resolveSensitive, + resolveMaterial, + resolvePassive); // take the target intersection auto targetIntersection = state.navigation.targetSurface->surfaceIntersectionEstimate( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr); debugLog(state, [&] { std::stringstream dstream; dstream << "Target estimate position ("; @@ -1034,8 +1108,8 @@ class Navigator { trackingGeometry->lowestTrackingVolume(state.geoContext, tPosition); state.navigation.targetLayer = state.navigation.targetVolume - ? state.navigation.targetVolume->associatedLayer(state.geoContext, - tPosition) + ? state.navigation.targetVolume->associatedLayer( + state.geoContext, tPosition) : nullptr; if (state.navigation.targetVolume) { debugLog(state, [&] { @@ -1060,11 +1134,16 @@ class Navigator { /// @param [in] cLayer is the already assigned current layer, e.g. start layer /// /// boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename corrector_t> - bool resolveSurfaces(propagator_state_t& state, const stepper_t& stepper, - const corrector_t& navCorr, - const Layer* cLayer = nullptr) const { + template < + typename propagator_state_t, + typename stepper_t, + typename corrector_t> + bool + resolveSurfaces( + propagator_state_t& state, + const stepper_t& stepper, + const corrector_t& navCorr, + const Layer* cLayer = nullptr) const { // get the layer and layer surface auto layerSurface = cLayer ? state.navigation.startSurface : state.navigation.navLayerIter->representation; @@ -1073,14 +1152,22 @@ class Navigator { bool onStart = (navLayer == state.navigation.startLayer); auto startSurface = onStart ? state.navigation.startSurface : layerSurface; NavigationOptions<Surface> navOpts( - state.stepping.navDir, true, resolveSensitive, resolveMaterial, - resolvePassive, startSurface, state.navigation.targetSurface); + state.stepping.navDir, + true, + resolveSensitive, + resolveMaterial, + resolvePassive, + startSurface, + state.navigation.targetSurface); // Check the limit navOpts.pathLimit = state.stepping.stepSize.value(Cstep::aborter); // get the surfaces state.navigation.navSurfaces = navLayer->compatibleSurfaces( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr); // the number of layer candidates if (!state.navigation.navSurfaces.empty()) { debugLog(state, [&] { @@ -1096,14 +1183,16 @@ class Navigator { state.navigation.navSurfaceIter = state.navigation.navSurfaces.begin(); // Update the navigation step size before you return to the stepper // This is a new navigation stream, release the former step size first - updateStep(state, navCorr, - state.navigation.navSurfaceIter->intersection.pathLength, - true); + updateStep( + state, + navCorr, + state.navigation.navSurfaceIter->intersection.pathLength, + true); return true; } state.navigation.navSurfaceIter = state.navigation.navSurfaces.end(); - debugLog(state, - [&] { return std::string("No surface candidates found."); }); + debugLog( + state, [&] { return std::string("No surface candidates found."); }); return false; } @@ -1124,12 +1213,17 @@ class Navigator { /// @param [in] navCorr is the navigation path corrector /// /// @return boolean return triggers exit to stepper - template <typename propagator_state_t, typename stepper_t, - typename corrector_t> - bool resolveLayers(propagator_state_t& state, const stepper_t& stepper, - const corrector_t& navCorr) const { - debugLog(state, - [&] { return std::string("Searching for compatible layers."); }); + template < + typename propagator_state_t, + typename stepper_t, + typename corrector_t> + bool + resolveLayers( + propagator_state_t& state, + const stepper_t& stepper, + const corrector_t& navCorr) const { + debugLog( + state, [&] { return std::string("Searching for compatible layers."); }); // Check if we are in the start volume auto startLayer = @@ -1138,17 +1232,25 @@ class Navigator { : nullptr; // Create the navigation options // - and get the compatible layers, start layer will be excluded - NavigationOptions<Layer> navOpts(state.stepping.navDir, true, - resolveSensitive, resolveMaterial, - resolvePassive, startLayer, nullptr); + NavigationOptions<Layer> navOpts( + state.stepping.navDir, + true, + resolveSensitive, + resolveMaterial, + resolvePassive, + startLayer, + nullptr); // Set also the target surface navOpts.targetSurface = state.navigation.targetSurface; navOpts.pathLimit = state.stepping.stepSize.value(Cstep::aborter); // Request the compatible layers state.navigation.navLayers = state.navigation.currentVolume->compatibleLayers( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), navOpts, navCorr); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + navOpts, + navCorr); // Layer candidates have been found if (!state.navigation.navLayers.empty()) { @@ -1170,9 +1272,11 @@ class Navigator { state.navigation.startLayer) { debugLog(state, [&] { return std::string("Target at layer."); }); // update the navigation step size before you return - updateStep(state, navCorr, - state.navigation.navLayerIter->intersection.pathLength, - true); + updateStep( + state, + navCorr, + state.navigation.navLayerIter->intersection.pathLength, + true); // Trigger the return to the propagator return true; } @@ -1200,9 +1304,11 @@ class Navigator { /// @param[in] step the step size /// @param[in] release flag steers if the step is released first template <typename propagator_state_t, typename corrector_t> - void updateStep(propagator_state_t& state, const corrector_t& navCorr, - double navigationStep, - bool release = false) const { // update the step + void updateStep( + propagator_state_t& state, + const corrector_t& navCorr, + double navigationStep, + bool release = false) const { // update the step state.stepping.stepSize.update(navigationStep, Cstep::actor, release); debugLog(state, [&] { std::stringstream dstream; @@ -1237,7 +1343,8 @@ class Navigator { /// /// boolean return triggers exit to stepper template <typename propagator_state_t, typename stepper_t> - bool inactive(propagator_state_t& state, const stepper_t& stepper) const { + bool + inactive(propagator_state_t& state, const stepper_t& stepper) const { // Void behavior in case no tracking geometry is present if (!trackingGeometry) { return true; @@ -1259,8 +1366,8 @@ class Navigator { return true; } // the only advance could have been to the target - if (stepper.surfaceReached(state.stepping, - state.navigation.targetSurface)) { + if (stepper.surfaceReached( + state.stepping, state.navigation.targetSurface)) { // set the target surface state.navigation.currentSurface = state.navigation.targetSurface; @@ -1289,8 +1396,10 @@ class Navigator { /// prefix and length /// @param logAction is a callable function that returns a stremable object template <typename propagator_state_t> - void debugLog(propagator_state_t& state, - const std::function<std::string()>& logAction) const { + void + debugLog( + propagator_state_t& state, + const std::function<std::string()>& logAction) const { if (state.options.debug) { std::string vName = "No Volume"; if (state.navigation.currentVolume) { diff --git a/Core/include/Acts/Propagator/Propagator.hpp b/Core/include/Acts/Propagator/Propagator.hpp index 5156f160a..a7abbe7f5 100644 --- a/Core/include/Acts/Propagator/Propagator.hpp +++ b/Core/include/Acts/Propagator/Propagator.hpp @@ -62,8 +62,9 @@ struct PropagatorResult : private detail::Extendable<result_list...> { /// @tparam aborter_list_t List of abort conditions tested after each /// propagation step using the current propagation and stepper state /// -template <typename action_list_t = ActionList<>, - typename aborter_list_t = AbortList<>> +template < + typename action_list_t = ActionList<>, + typename aborter_list_t = AbortList<>> struct PropagatorOptions { /// Delete default contructor PropagatorOptions() = delete; @@ -73,8 +74,9 @@ struct PropagatorOptions { const PropagatorOptions<action_list_t, aborter_list_t>& po) = default; /// PropagatorOptions with context - PropagatorOptions(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx) + PropagatorOptions( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx) : geoContext(gctx), magFieldContext(mctx) {} /// @brief Expand the Options with extended aborters @@ -83,8 +85,8 @@ struct PropagatorOptions { /// /// @param aborters The new aborter list to be used (internally) template <typename extended_aborter_list_t> - PropagatorOptions<action_list_t, extended_aborter_list_t> extend( - extended_aborter_list_t aborters) const { + PropagatorOptions<action_list_t, extended_aborter_list_t> + extend(extended_aborter_list_t aborters) const { PropagatorOptions<action_list_t, extended_aborter_list_t> eoptions( geoContext, magFieldContext); // Copy the options over @@ -197,10 +199,12 @@ class Propagator final { using BoundState = std::tuple<BoundParameters, Jacobian, double>; using CurvilinearState = std::tuple<CurvilinearParameters, Jacobian, double>; - static_assert(StepperStateConcept<typename stepper_t::State>, - "Stepper does not fulfill stepper concept."); - static_assert(StepperConcept<stepper_t>, - "Stepper does not fulfill stepper concept."); + static_assert( + StepperStateConcept<typename stepper_t::State>, + "Stepper does not fulfill stepper concept."); + static_assert( + StepperConcept<stepper_t>, + "Stepper does not fulfill stepper concept."); public: /// Type of the stepper in use for public scope @@ -238,8 +242,12 @@ class Propagator final { template <typename parameters_t> State(const parameters_t& start, const propagator_options_t& topts) : options(topts), - stepping(topts.geoContext, topts.magFieldContext, start, - topts.direction, topts.maxStepSize), + stepping( + topts.geoContext, + topts.magFieldContext, + start, + topts.direction, + topts.maxStepSize), geoContext(topts.geoContext) { // Setting the start surface navigation.startSurface = &start.referenceSurface(); @@ -331,10 +339,13 @@ class Propagator final { /// @return Propagation result containing the propagation status, final /// track parameters, and output of actions (if they produce any) /// - template <typename parameters_t, typename action_list_t, - typename aborter_list_t, - template <typename, typename> class propagator_options_t, - typename path_aborter_t = detail::PathLimitReached> + template < + typename parameters_t, + typename action_list_t, + typename aborter_list_t, + template <typename, typename> + class propagator_options_t, + typename path_aborter_t = detail::PathLimitReached> Result<action_list_t_result_t< typename stepper_t::template return_parameter_type<parameters_t>, action_list_t>> @@ -361,17 +372,22 @@ class Propagator final { /// /// @return Propagation result containing the propagation status, final /// track parameters, and output of actions (if they produce any) - template <typename parameters_t, typename surface_t, typename action_list_t, - typename aborter_list_t, - template <typename, typename> class propagator_options_t, - typename target_aborter_t = detail::SurfaceReached, - typename path_aborter_t = detail::PathLimitReached> - Result< - action_list_t_result_t<typename stepper_t::template return_parameter_type< - parameters_t, surface_t>, - action_list_t>> + template < + typename parameters_t, + typename surface_t, + typename action_list_t, + typename aborter_list_t, + template <typename, typename> + class propagator_options_t, + typename target_aborter_t = detail::SurfaceReached, + typename path_aborter_t = detail::PathLimitReached> + Result<action_list_t_result_t< + typename stepper_t:: + template return_parameter_type<parameters_t, surface_t>, + action_list_t>> propagate( - const parameters_t& start, const surface_t& target, + const parameters_t& start, + const surface_t& target, const propagator_options_t<action_list_t, aborter_list_t>& options) const; private: @@ -392,8 +408,9 @@ class Propagator final { /// @param state the propagator state for the debug flag, prefix/length /// @param logAction is a callable function that returns a stremable object template <typename propagator_state_t> - void debugLog(propagator_state_t& state, - const std::function<std::string()>& logAction) const; + void debugLog( + propagator_state_t& state, + const std::function<std::string()>& logAction) const; }; } // namespace Acts diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index aa1c9bf7e..264cac950 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -8,7 +8,8 @@ template <typename S, typename N> template <typename result_t, typename propagator_state_t> -auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state) const +auto +Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state) const -> Result<result_t> { result_t result; @@ -81,11 +82,15 @@ auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state) const } template <typename S, typename N> -template <typename parameters_t, typename action_list_t, - typename aborter_list_t, - template <typename, typename> class propagator_options_t, - typename path_aborter_t> -auto Acts::Propagator<S, N>::propagate( +template < + typename parameters_t, + typename action_list_t, + typename aborter_list_t, + template <typename, typename> + class propagator_options_t, + typename path_aborter_t> +auto +Acts::Propagator<S, N>::propagate( const parameters_t& start, const propagator_options_t<action_list_t, aborter_list_t>& options) const -> Result<action_list_t_result_t< @@ -98,8 +103,9 @@ auto Acts::Propagator<S, N>::propagate( // Type of the full propagation result, including output from actions using ResultType = action_list_t_result_t<ReturnParameterType, action_list_t>; - static_assert(std::is_copy_constructible<ReturnParameterType>::value, - "return track parameter type must be copy-constructible"); + static_assert( + std::is_copy_constructible<ReturnParameterType>::value, + "return track parameter type must be copy-constructible"); // Initialize the propagation result object @@ -115,8 +121,11 @@ auto Acts::Propagator<S, N>::propagate( StateType state(start, eOptions); static_assert( - concept ::has_method<const S, Result<double>, concept ::Stepper::step_t, - StateType&>, + concept ::has_method< + const S, + Result<double>, + concept ::Stepper::step_t, + StateType&>, "Step method of the Stepper is not compatible with the propagator " "state"); @@ -148,12 +157,19 @@ auto Acts::Propagator<S, N>::propagate( } template <typename S, typename N> -template <typename parameters_t, typename surface_t, typename action_list_t, - typename aborter_list_t, - template <typename, typename> class propagator_options_t, - typename target_aborter_t, typename path_aborter_t> -auto Acts::Propagator<S, N>::propagate( - const parameters_t& start, const surface_t& target, +template < + typename parameters_t, + typename surface_t, + typename action_list_t, + typename aborter_list_t, + template <typename, typename> + class propagator_options_t, + typename target_aborter_t, + typename path_aborter_t> +auto +Acts::Propagator<S, N>::propagate( + const parameters_t& start, + const surface_t& target, const propagator_options_t<action_list_t, aborter_list_t>& options) const -> Result<action_list_t_result_t< typename S::template return_parameter_type<parameters_t, surface_t>, @@ -181,8 +197,11 @@ auto Acts::Propagator<S, N>::propagate( state.navigation.targetSurface = ⌖ static_assert( - concept ::has_method<const S, Result<double>, concept ::Stepper::step_t, - StateType&>, + concept ::has_method< + const S, + Result<double>, + concept ::Stepper::step_t, + StateType&>, "Step method of the Stepper is not compatible with the propagator " "state"); @@ -215,7 +234,8 @@ auto Acts::Propagator<S, N>::propagate( template <typename S, typename N> template <typename propagator_state_t> -void Acts::Propagator<S, N>::debugLog( +void +Acts::Propagator<S, N>::debugLog( propagator_state_t& state, const std::function<std::string()>& logAction) const { if (state.options.debug) { diff --git a/Core/include/Acts/Propagator/PropagatorError.hpp b/Core/include/Acts/Propagator/PropagatorError.hpp index e135d08ae..f3594b0ca 100644 --- a/Core/include/Acts/Propagator/PropagatorError.hpp +++ b/Core/include/Acts/Propagator/PropagatorError.hpp @@ -21,9 +21,13 @@ namespace detail { class PropagatorErrorCategory : public std::error_category { public: // Return a short descriptive name for the category - const char* name() const noexcept final { return "PropagatorError"; } + const char* + name() const noexcept final { + return "PropagatorError"; + } // Return what each enum means in text - std::string message(int c) const final { + std::string + message(int c) const final { switch (static_cast<PropagatorError>(c)) { case PropagatorError::Failure: return "Propagation failed"; @@ -37,12 +41,14 @@ class PropagatorErrorCategory : public std::error_category { } // namespace detail // Declare a global function returning a static instance of the custom category -extern inline const detail::PropagatorErrorCategory& PropagatorErrorCategory() { +extern inline const detail::PropagatorErrorCategory& +PropagatorErrorCategory() { static detail::PropagatorErrorCategory c; return c; } -inline std::error_code make_error_code(Acts::PropagatorError e) { +inline std::error_code +make_error_code(Acts::PropagatorError e) { return {static_cast<int>(e), Acts::PropagatorErrorCategory()}; } } // namespace Acts diff --git a/Core/include/Acts/Propagator/StepperExtensionList.hpp b/Core/include/Acts/Propagator/StepperExtensionList.hpp index d6de656d4..c7f9dc74e 100644 --- a/Core/include/Acts/Propagator/StepperExtensionList.hpp +++ b/Core/include/Acts/Propagator/StepperExtensionList.hpp @@ -34,8 +34,9 @@ template <typename... extensions> struct StepperExtensionList : private detail::Extendable<extensions...> { private: // Checkout for duplicates in the extensions - static_assert(not detail::has_duplicates_v<extensions...>, - "same extension type specified several times"); + static_assert( + not detail::has_duplicates_v<extensions...>, + "same extension type specified several times"); static constexpr unsigned int nExtensions = sizeof...(extensions); @@ -61,16 +62,19 @@ struct StepperExtensionList : private detail::Extendable<extensions...> { /// @param [in] state State of the propagator /// @param [in] stepper Stepper of the propagation template <typename propagator_state_t, typename stepper_t> - bool validExtensionForStep(const propagator_state_t& state, - const stepper_t& stepper) { + bool + validExtensionForStep( + const propagator_state_t& state, + const stepper_t& stepper) { std::array<int, nExtensions> bids; // Ask all extensions for a boolean statement of their validity impl::bid(tuple(), state, stepper, bids); // Post-process the vector in an auctioneer validExtensions = state.stepping.auctioneer(std::move(bids)); - return (std::find(validExtensions.begin(), validExtensions.end(), true) != - validExtensions.end()); + return ( + std::find(validExtensions.begin(), validExtensions.end(), true) != + validExtensions.end()); } /// @brief This functions broadcasts the call for evaluating k1. It collects @@ -78,8 +82,11 @@ struct StepperExtensionList : private detail::Extendable<extensions...> { /// passes them forward for evaluation and returns a boolean as indicator if /// the evaluation is valid. template <typename propagator_state_t, typename stepper_t> - bool k1(const propagator_state_t& state, const stepper_t& stepper, - Vector3D& knew, const Vector3D& bField) { + bool + k1(const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField) { return impl::k(tuple(), state, stepper, knew, bField, validExtensions); } @@ -87,41 +94,57 @@ struct StepperExtensionList : private detail::Extendable<extensions...> { /// all arguments and extensions and passes them forward for evaluation and /// returns a boolean as indicator if the evaluation is valid. template <typename propagator_state_t, typename stepper_t> - bool k2(const propagator_state_t& state, const stepper_t& stepper, - Vector3D& knew, const Vector3D& bField, const double h, - const Vector3D& kprev) { - return impl::k(tuple(), state, stepper, knew, bField, validExtensions, 1, h, - kprev); + bool + k2(const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField, + const double h, + const Vector3D& kprev) { + return impl::k( + tuple(), state, stepper, knew, bField, validExtensions, 1, h, kprev); } /// @brief This functions broadcasts the call for evaluating k3. It collects /// all arguments and extensions and passes them forward for evaluation and /// returns a boolean as indicator if the evaluation is valid. template <typename propagator_state_t, typename stepper_t> - bool k3(const propagator_state_t& state, const stepper_t& stepper, - Vector3D& knew, const Vector3D& bField, const double h, - const Vector3D& kprev) { - return impl::k(tuple(), state, stepper, knew, bField, validExtensions, 2, h, - kprev); + bool + k3(const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField, + const double h, + const Vector3D& kprev) { + return impl::k( + tuple(), state, stepper, knew, bField, validExtensions, 2, h, kprev); } /// @brief This functions broadcasts the call for evaluating k4. It collects /// all arguments and extensions and passes them forward for evaluation and /// returns a boolean as indicator if the evaluation is valid. template <typename propagator_state_t, typename stepper_t> - bool k4(const propagator_state_t& state, const stepper_t& stepper, - Vector3D& knew, const Vector3D& bField, const double h, - const Vector3D& kprev) { - return impl::k(tuple(), state, stepper, knew, bField, validExtensions, 3, h, - kprev); + bool + k4(const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField, + const double h, + const Vector3D& kprev) { + return impl::k( + tuple(), state, stepper, knew, bField, validExtensions, 3, h, kprev); } /// @brief This functions broadcasts the call of the method finalize(). It /// collects all extensions and arguments and passes them forward for /// evaluation and returns a boolean. template <typename propagator_state_t, typename stepper_t> - bool finalize(propagator_state_t& state, const stepper_t& stepper, - const double h, FreeMatrix& D) { + bool + finalize( + propagator_state_t& state, + const stepper_t& stepper, + const double h, + FreeMatrix& D) { return impl::finalize(tuple(), state, stepper, h, D, validExtensions); } @@ -129,8 +152,11 @@ struct StepperExtensionList : private detail::Extendable<extensions...> { /// collects all extensions and arguments and passes them forward for /// evaluation and returns a boolean. template <typename propagator_state_t, typename stepper_t> - bool finalize(propagator_state_t& state, const stepper_t& stepper, - const double h) { + bool + finalize( + propagator_state_t& state, + const stepper_t& stepper, + const double h) { return impl::finalize(tuple(), state, stepper, h, validExtensions); } }; diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 21d5c6a24..61ac7e5e7 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -65,10 +65,12 @@ class StraightLineStepper { /// @param [in] ndir is the navigation direction /// @param [in] ssize is the (absolute) maximum step size template <typename parameters_t> - explicit State(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> /*mctx*/, - const parameters_t& par, NavigationDirection ndir = forward, - double ssize = std::numeric_limits<double>::max()) + explicit State( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> /*mctx*/, + const parameters_t& par, + NavigationDirection ndir = forward, + double ssize = std::numeric_limits<double>::max()) : pos(par.position()), dir(par.momentum().normalized()), p(par.momentum().norm()), @@ -83,8 +85,8 @@ class StraightLineStepper { // set the covariance transport flag to true and copy covTransport = true; cov = BoundSymMatrix(*par.covariance()); - surface.initJacobianToGlobal(gctx, jacToGlobal, pos, dir, - par.parameters()); + surface.initJacobianToGlobal( + gctx, jacToGlobal, pos, dir, par.parameters()); } } @@ -158,25 +160,41 @@ class StraightLineStepper { /// @param [in,out] state is the propagation state associated with the track /// the magnetic field cell is used (and potentially updated) /// @param [in] pos is the field position - Vector3D getField(State& /*state*/, const Vector3D& /*pos*/) const { + Vector3D + getField(State& /*state*/, const Vector3D& /*pos*/) const { // get the field from the cell return Vector3D(0., 0., 0.); } /// Global particle position accessor - Vector3D position(const State& state) const { return state.pos; } + Vector3D + position(const State& state) const { + return state.pos; + } /// Momentum direction accessor - Vector3D direction(const State& state) const { return state.dir; } + Vector3D + direction(const State& state) const { + return state.dir; + } /// Momentum accessor - double momentum(const State& state) const { return state.p; } + double + momentum(const State& state) const { + return state.p; + } /// Charge access - double charge(const State& state) const { return state.q; } + double + charge(const State& state) const { + return state.q; + } /// Time access - double time(const State& state) const { return state.t0 + state.dt; } + double + time(const State& state) const { + return state.t0 + state.dt; + } /// Tests if the state reached a surface /// @@ -184,9 +202,10 @@ class StraightLineStepper { /// @param [in] surface Surface that is tested /// /// @return Boolean statement if surface is reached by state - bool surfaceReached(const State& state, const Surface* surface) const { - return surface->isOnSurface(state.geoContext, position(state), - direction(state), true); + bool + surfaceReached(const State& state, const Surface* surface) const { + return surface->isOnSurface( + state.geoContext, position(state), direction(state), true); } /// Create and return the bound state at the current position @@ -203,8 +222,8 @@ class StraightLineStepper { /// - the parameters at the surface /// - the stepwise jacobian towards it (from last bound) /// - and the path length (from start - for ordering) - BoundState boundState(State& state, const Surface& surface, - bool reinitialize) const { + BoundState + boundState(State& state, const Surface& surface, bool reinitialize) const { // Transport the covariance to here std::unique_ptr<const Covariance> covPtr = nullptr; if (state.covTransport) { @@ -212,12 +231,17 @@ class StraightLineStepper { covPtr = std::make_unique<const Covariance>(state.cov); } // Create the bound parameters - BoundParameters parameters(state.geoContext, std::move(covPtr), state.pos, - state.p * state.dir, state.q, - state.t0 + state.dt, surface.getSharedPtr()); + BoundParameters parameters( + state.geoContext, + std::move(covPtr), + state.pos, + state.p * state.dir, + state.q, + state.t0 + state.dt, + surface.getSharedPtr()); // Create the bound state - BoundState bState{std::move(parameters), state.jacobian, - state.pathAccumulated}; + BoundState bState{ + std::move(parameters), state.jacobian, state.pathAccumulated}; // Reset the jacobian to identity if (reinitialize) { state.jacobian = Jacobian::Identity(); @@ -238,7 +262,8 @@ class StraightLineStepper { /// - the curvilinear parameters at given position /// - the stepweise jacobian towards it (from last bound) /// - and the path length (from start - for ordering) - CurvilinearState curvilinearState(State& state, bool reinitialize) const { + CurvilinearState + curvilinearState(State& state, bool reinitialize) const { // Transport the covariance to here std::unique_ptr<const Covariance> covPtr = nullptr; if (state.covTransport) { @@ -246,12 +271,15 @@ class StraightLineStepper { covPtr = std::make_unique<const Covariance>(state.cov); } // Create the curvilinear parameters - CurvilinearParameters parameters(std::move(covPtr), state.pos, - state.p * state.dir, state.q, - state.t0 + state.dt); + CurvilinearParameters parameters( + std::move(covPtr), + state.pos, + state.p * state.dir, + state.q, + state.t0 + state.dt); // Create the bound state - CurvilinearState curvState{std::move(parameters), state.jacobian, - state.pathAccumulated}; + CurvilinearState curvState{ + std::move(parameters), state.jacobian, state.pathAccumulated}; // Reset the jacobian to identity if (reinitialize) { state.jacobian = Jacobian::Identity(); @@ -264,7 +292,8 @@ class StraightLineStepper { /// /// @param [in,out] state State object that will be updated /// @param [in] pars Parameters that will be written into @p state - void update(State& state, const BoundParameters& pars) const { + void + update(State& state, const BoundParameters& pars) const { const auto& mom = pars.momentum(); state.pos = pars.position(); state.dir = mom.normalized(); @@ -283,8 +312,13 @@ class StraightLineStepper { /// @param [in] udirection the updated direction /// @param [in] up the updated momentum value /// @param [in] time the updated time value - void update(State& state, const Vector3D& uposition, - const Vector3D& udirection, double up, double time) const { + void + update( + State& state, + const Vector3D& uposition, + const Vector3D& udirection, + double up, + double time) const { state.pos = uposition; state.dir = udirection; state.p = up; @@ -292,7 +326,8 @@ class StraightLineStepper { } /// Return a corrector - VoidIntersectionCorrector corrector(State& /*state*/) const { + VoidIntersectionCorrector + corrector(State& /*state*/) const { return VoidIntersectionCorrector(); } @@ -304,7 +339,8 @@ class StraightLineStepper { /// @param [in] reinitialize is a flag to steer whether the /// state should be reinitialized at the new /// position - void covarianceTransport(State& state, bool reinitialize = false) const { + void + covarianceTransport(State& state, bool reinitialize = false) const { // Optimized trigonometry on the propagation direction const double x = state.dir(0); // == cos(phi) * sin(theta) const double y = state.dir(1); // == sin(phi) * sin(theta) @@ -391,15 +427,18 @@ class StraightLineStepper { /// position /// @note no check is done if the position is actually on the surface /// - void covarianceTransport(State& state, const Surface& surface, - bool reinitialize = false) const { + void + covarianceTransport( + State& state, + const Surface& surface, + bool reinitialize = false) const { using VectorHelpers::phi; using VectorHelpers::theta; // Initialize the transport final frame jacobian FreeToBoundMatrix jacToLocal = FreeToBoundMatrix::Zero(); // initalize the jacobian to local, returns the transposed ref frame - auto rframeT = surface.initJacobianToLocal(state.geoContext, jacToLocal, - state.pos, state.dir); + auto rframeT = surface.initJacobianToLocal( + state.geoContext, jacToLocal, state.pos, state.dir); // Update the jacobian with the transport from the steps state.jacToGlobal = state.jacTransport * state.jacToGlobal; // calculate the form factors for the derivatives @@ -424,8 +463,8 @@ class StraightLineStepper { BoundVector pars; pars << loc[eLOC_0], loc[eLOC_1], phi(state.dir), theta(state.dir), state.q / state.p, state.t0 + state.dt; - surface.initJacobianToGlobal(state.geoContext, state.jacToGlobal, - state.pos, state.dir, pars); + surface.initJacobianToGlobal( + state.geoContext, state.jacToGlobal, state.pos, state.dir, pars); } // Store The global and bound jacobian (duplication for the moment) state.jacobian = jacFull * state.jacobian; @@ -442,7 +481,8 @@ class StraightLineStepper { /// /// @return the step size taken template <typename propagator_state_t> - Result<double> step(propagator_state_t& state) const { + Result<double> + step(propagator_state_t& state) const { // use the adjusted step size const auto h = state.stepping.stepSize; // time propagates along distance as 1/b = sqrt(1 + m²/p²) diff --git a/Core/include/Acts/Propagator/SurfaceCollector.hpp b/Core/include/Acts/Propagator/SurfaceCollector.hpp index 7ea6f224d..cf8a3068c 100644 --- a/Core/include/Acts/Propagator/SurfaceCollector.hpp +++ b/Core/include/Acts/Propagator/SurfaceCollector.hpp @@ -52,8 +52,11 @@ struct SurfaceCollector { /// @param [in] stepper The stepper in use /// @param [in,out] result is the mutable result object template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // a current surface has been assigned by the navigator // if (state.navigation.currentSurface && @@ -71,8 +74,9 @@ struct SurfaceCollector { /// Pure observer interface /// - this does not apply to the surface collector template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*state*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*state*/, const stepper_t& /*unused*/) const { + } }; } // namespace Acts diff --git a/Core/include/Acts/Propagator/detail/Auctioneer.hpp b/Core/include/Acts/Propagator/detail/Auctioneer.hpp index 2671b2650..5bd219062 100644 --- a/Core/include/Acts/Propagator/detail/Auctioneer.hpp +++ b/Core/include/Acts/Propagator/detail/Auctioneer.hpp @@ -47,7 +47,8 @@ struct VoidAuctioneer { /// @param [in] vCandidates Candidates that are treated as valid extensions /// @return The to vCandidates identical list of valid extensions template <long unsigned int N> - std::array<bool, N> operator()(std::array<int, N> vCandidates) const { + std::array<bool, N> + operator()(std::array<int, N> vCandidates) const { std::array<bool, N> valids; for (unsigned int i = 0; i < vCandidates.size(); i++) { @@ -68,7 +69,8 @@ struct FirstValidAuctioneer { /// @param [in] vCandidates Candidates for a valid extension /// @return List with at most one valid extension template <long unsigned int N> - std::array<bool, N> operator()(std::array<int, N> vCandidates) const { + std::array<bool, N> + operator()(std::array<int, N> vCandidates) const { std::array<bool, N> valids = {}; for (unsigned int i = 0; i < vCandidates.size(); i++) { @@ -95,7 +97,8 @@ struct HighestValidAuctioneer { /// @param [in] vCandidates Candidates for a valid extension /// @return List with at most one valid extension template <long unsigned int N> - std::array<bool, N> operator()(std::array<int, N> vCandidates) const { + std::array<bool, N> + operator()(std::array<int, N> vCandidates) const { std::array<bool, N> valids = {}; auto highscore = std::max_element(vCandidates.begin(), vCandidates.end()); diff --git a/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp b/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp index 8968912d8..a012cb1e3 100644 --- a/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp +++ b/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp @@ -29,9 +29,10 @@ struct ConstrainedStep { enum Type : int { accuracy = 0, actor = 1, aborter = 2, user = 3 }; /// the step size tuple - std::array<double, 4> values = { - {std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), - std::numeric_limits<double>::max(), std::numeric_limits<double>::max()}}; + std::array<double, 4> values = {{std::numeric_limits<double>::max(), + std::numeric_limits<double>::max(), + std::numeric_limits<double>::max(), + std::numeric_limits<double>::max()}}; /// The Navigation direction NavigationDirection direction = forward; @@ -43,7 +44,8 @@ struct ConstrainedStep { /// /// @param value is the new value to be updated /// @param type is the constraint type - void update(const double& value, Type type, bool releaseStep = false) { + void + update(const double& value, Type type, bool releaseStep = false) { if (releaseStep) { release(type); } @@ -57,7 +59,8 @@ struct ConstrainedStep { /// it depends on the direction /// /// @param type is the constraint type to be released - void release(Type type) { + void + release(Type type) { double mvalue = (direction == forward) ? (*std::max_element(values.begin(), values.end())) : (*std::min_element(values.begin(), values.end())); @@ -75,7 +78,8 @@ struct ConstrainedStep { /// exposed to the Propagator, this adapts also the direction /// /// @param value is the new accuracy value - ConstrainedStep& operator=(const double& value) { + ConstrainedStep& + operator=(const double& value) { /// set the accuracy value values[accuracy] = value; // set/update the direction @@ -95,36 +99,43 @@ struct ConstrainedStep { /// Access to a specific value /// /// @param type is the resquested parameter type - double value(Type type) const { return values[type]; } + double + value(Type type) const { + return values[type]; + } /// Return the maximum step constraint /// @return The max step constraint - double max() const { + double + max() const { return (*std::max_element(values.begin(), values.end())); } /// Return the minimum step constraint /// @return The min step constraint - double min() const { + double + min() const { return (*std::min_element(values.begin(), values.end())); } /// Access to currently leading min type /// - Type currentType() const { + Type + currentType() const { if (direction == forward) { - return Type(std::min_element(values.begin(), values.end()) - - values.begin()); + return Type( + std::min_element(values.begin(), values.end()) - values.begin()); } - return Type(std::max_element(values.begin(), values.end()) - - values.begin()); + return Type( + std::max_element(values.begin(), values.end()) - values.begin()); } /// return the split value as string for debugging std::string toString() const; }; -inline std::string ConstrainedStep::toString() const { +inline std::string +ConstrainedStep::toString() const { std::stringstream dstream; dstream << "(" << std::setw(5) << values[accuracy]; dstream << ", " << std::setw(5) << values[actor]; diff --git a/Core/include/Acts/Propagator/detail/DebugOutputActor.hpp b/Core/include/Acts/Propagator/detail/DebugOutputActor.hpp index 32b514f3d..43e3730b8 100644 --- a/Core/include/Acts/Propagator/detail/DebugOutputActor.hpp +++ b/Core/include/Acts/Propagator/detail/DebugOutputActor.hpp @@ -38,8 +38,11 @@ struct DebugOutputActor { /// @param state is the mutable propagator state object /// @param result is the mutable result state object template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& /*unused*/, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& /*unused*/, + result_type& result) const { // move the debug output from the state to // to the output actor if it is not set to mute // only when the target is reached (or later otherwise triggered) @@ -53,8 +56,9 @@ struct DebugOutputActor { /// Pure observer interface /// - this does not apply to the output collector template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*state*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*state*/, const stepper_t& /*unused*/) const { + } }; } // namespace detail diff --git a/Core/include/Acts/Propagator/detail/InteractionFormulas.hpp b/Core/include/Acts/Propagator/detail/InteractionFormulas.hpp index ab1fee927..7f48d4af3 100644 --- a/Core/include/Acts/Propagator/detail/InteractionFormulas.hpp +++ b/Core/include/Acts/Propagator/detail/InteractionFormulas.hpp @@ -44,9 +44,14 @@ struct IonisationLoss { /// ionization along a given path length or its mode. The second entry is /// the sigma of the distribution. template <typename material_t> - std::pair<double, double> dEds(double m, double lbeta, double lgamma, - const material_t& mat, double path = 1., - bool mean = true) const { + std::pair<double, double> + dEds( + double m, + double lbeta, + double lgamma, + const material_t& mat, + double path = 1., + bool mean = true) const { // the return value double dE = 0.; @@ -119,8 +124,13 @@ struct IonisationLoss { /// @param [in] mean Toggle between mean (true) and mode (false) /// @return The evaluated derivative template <typename material_t> - double dqop(const double energy, const double qOverP, const double mass, - const material_t& material, const bool mean = true) const { + double + dqop( + const double energy, + const double qOverP, + const double mass, + const material_t& material, + const bool mean = true) const { // Fast exit if material is invalid if (material.Z() == 0 || material.zOverAtimesRho() == 0) { return 0.; @@ -150,8 +160,8 @@ struct IonisationLoss { (1. + 2. * gamma * me / mass + me2 / m2); const double lnCoreDerivative = -4. * me2 / (m4 * I2) * - std::pow(qop4 + 2. * gamma * qop4 * me / mass + qop4 * me2 / m2, - -2.) * + std::pow( + qop4 + 2. * gamma * qop4 * me / mass + qop4 * me2 / m2, -2.) * (4. * qop3 + 8. * me * qop3 * gamma / mass - 2. * me * qOverP / (m2 * mass * gamma) + 4. * qop3 * me2 / m2); @@ -176,8 +186,9 @@ struct IonisationLoss { // pre-factor if (gamma > 10.) { const double delta = - 2. * std::log(constants::eplasma * - std::sqrt(1000. * material.zOverAtimesRho()) / I) + + 2. * std::log( + constants::eplasma * + std::sqrt(1000. * material.zOverAtimesRho()) / I) + 2. * std::log(beta * gamma) - 1.; if (mean) { const double deltaDerivative = @@ -205,8 +216,9 @@ struct HighlandScattering { /// @param p is the momentum /// @param lbeta is the Lorentz beta parameter /// @param dInX0 is the passed thickness expressed in units of X0 - double operator()(double p, double lbeta, double dInX0, - bool electron = false) const { + double + operator()(double p, double lbeta, double dInX0, bool electron = false) + const { if (dInX0 == 0. || p == 0. || lbeta == 0.) { return 0.; } @@ -250,8 +262,9 @@ struct RadiationLoss { /// @param [in] path Path length of the particle through the material /// @return Radiation energy loss template <typename material_t> - double dEds(double E, double m, const material_t& mat, int pdg, - double path = 1.) const { + double + dEds(double E, double m, const material_t& mat, int pdg, double path = 1.) + const { using namespace Acts::UnitLiterals; // Easy exit @@ -288,8 +301,13 @@ struct RadiationLoss { /// @param [in] pdg PDG code of the particle /// @return The evaluated derivative template <typename material_t> - double dqop(const double mass, const material_t& material, const double qop, - const double energy, const int pdg) const { + double + dqop( + const double mass, + const material_t& material, + const double qop, + const double energy, + const int pdg) const { using namespace Acts::UnitLiterals; // Fast exit if material is invalid diff --git a/Core/include/Acts/Propagator/detail/LoopProtection.hpp b/Core/include/Acts/Propagator/detail/LoopProtection.hpp index 58d92d148..d47c23696 100644 --- a/Core/include/Acts/Propagator/detail/LoopProtection.hpp +++ b/Core/include/Acts/Propagator/detail/LoopProtection.hpp @@ -23,7 +23,8 @@ struct LoopProtection { /// @param [in,out] state State object provided for the call /// @param [in] stepper Stepper used template <typename state_t, typename stepper_t> - void operator()(state_t& state, const stepper_t& stepper) const { + void + operator()(state_t& state, const stepper_t& stepper) const { // Estimate the loop protection limit if (state.options.loopProtection) { // Get the field at the start position diff --git a/Core/include/Acts/Propagator/detail/RelativePathCorrector.hpp b/Core/include/Acts/Propagator/detail/RelativePathCorrector.hpp index 7c282f2ea..e6bb6cd94 100644 --- a/Core/include/Acts/Propagator/detail/RelativePathCorrector.hpp +++ b/Core/include/Acts/Propagator/detail/RelativePathCorrector.hpp @@ -42,9 +42,10 @@ struct RelativePathCorrector { double stepModification = 0.5; /// Constructor from arguments - RelativePathCorrector(const Vector3D& spos = Vector3D(0., 0., 0.), - const Vector3D& sdir = Vector3D(0., 0., 0.), - double spath = 0.) + RelativePathCorrector( + const Vector3D& spos = Vector3D(0., 0., 0.), + const Vector3D& sdir = Vector3D(0., 0., 0.), + double spath = 0.) : startPos(spos), startDir(sdir), pathLength(spath) {} /// Boolean() operator - returns false for void modifier @@ -55,7 +56,8 @@ struct RelativePathCorrector { /// @param pos[in,out] the position for the path intersection /// @param dir[in,out] the direction for the path intersection /// @param path[in,out] path that as a first estimate - bool operator()(Vector3D& pos, Vector3D& dir, double& path) const { + bool + operator()(Vector3D& pos, Vector3D& dir, double& path) const { // Approximation with straight line if (path * path < straightLineStep * straightLineStep) { return false; @@ -73,7 +75,8 @@ struct RelativePathCorrector { } /// Step size manipulation call - bool operator()(ConstrainedStep& step) const { + bool + operator()(ConstrainedStep& step) const { // Don't do anything if you are under accuracy or user control auto stepType = step.currentType(); if (stepType == Cstep::accuracy or stepType == Cstep::user) { diff --git a/Core/include/Acts/Propagator/detail/StandardAborters.hpp b/Core/include/Acts/Propagator/detail/StandardAborters.hpp index 25c4ad492..573c7c249 100644 --- a/Core/include/Acts/Propagator/detail/StandardAborters.hpp +++ b/Core/include/Acts/Propagator/detail/StandardAborters.hpp @@ -49,8 +49,11 @@ struct TargetOptions { /// @param state the propagator cache for the debug flag, prefix/stream /// @param logAction is a callable function that returns a stremable object template <typename propagator_state_t> -void targetDebugLog(propagator_state_t& state, const std::string& status, - const std::function<std::string()>& logAction) { +void +targetDebugLog( + propagator_state_t& state, + const std::string& status, + const std::function<std::string()>& logAction) { if (state.options.debug) { std::stringstream dstream; dstream << " " << status << " "; @@ -70,8 +73,11 @@ struct PathLimitReached { /// boolean operator for abort condition using the result template <typename propagator_state_t, typename stepper_t, typename result_t> - bool operator()(const result_t& /*r*/, propagator_state_t& state, - const stepper_t& stepper) const { + bool + operator()( + const result_t& /*r*/, + propagator_state_t& state, + const stepper_t& stepper) const { return operator()(state, stepper); } @@ -82,8 +88,8 @@ struct PathLimitReached { /// /// @param [in,out] state The propagation state object template <typename propagator_state_t, typename stepper_t> - bool operator()(propagator_state_t& state, - const stepper_t& /*unused*/) const { + bool + operator()(propagator_state_t& state, const stepper_t& /*unused*/) const { if (state.navigation.targetReached) { return true; } @@ -123,8 +129,11 @@ struct SurfaceReached { /// boolean operator for abort condition using the result (ignored) template <typename propagator_state_t, typename stepper_t, typename result_t> - bool operator()(const result_t& /*result*/, propagator_state_t& state, - const stepper_t& stepper) const { + bool + operator()( + const result_t& /*result*/, + propagator_state_t& state, + const stepper_t& stepper) const { return operator()(state, stepper); } @@ -136,7 +145,8 @@ struct SurfaceReached { /// @param [in,out] state The propagation state object /// @param [in] stepper Stepper used for propagation template <typename propagator_state_t, typename stepper_t> - bool operator()(propagator_state_t& state, const stepper_t& stepper) const { + bool + operator()(propagator_state_t& state, const stepper_t& stepper) const { return (*this)(state, stepper, *state.navigation.targetSurface); } @@ -149,8 +159,11 @@ struct SurfaceReached { /// @param [in] stepper Stepper used for the progation /// @param [in] targetSurface The target surface template <typename propagator_state_t, typename stepper_t> - bool operator()(propagator_state_t& state, const stepper_t& stepper, - const Surface& targetSurface) const { + bool + operator()( + propagator_state_t& state, + const stepper_t& stepper, + const Surface& targetSurface) const { if (state.navigation.targetReached) { return true; } @@ -171,8 +184,10 @@ struct SurfaceReached { // Calculate the distance to the surface const double tolerance = state.options.targetTolerance; const auto intersection = targetSurface.intersectionEstimate( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), anyDirection); + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + anyDirection); const double distance = intersection.pathLength; // Adjust the step size so that we cannot cross the target surface state.stepping.stepSize.update(distance, ConstrainedStep::aborter); @@ -217,8 +232,11 @@ struct EndOfWorldReached { /// boolean operator for abort condition using the result (ignored) template <typename propagator_state_t, typename stepper_t, typename result_t> - bool operator()(const result_t& /*result*/, propagator_state_t& state, - const stepper_t& stepper) const { + bool + operator()( + const result_t& /*result*/, + propagator_state_t& state, + const stepper_t& stepper) const { return operator()(state, stepper); } @@ -228,8 +246,8 @@ struct EndOfWorldReached { /// /// @param[in,out] state The propagation state object template <typename propagator_state_t, typename stepper_t> - bool operator()(propagator_state_t& state, - const stepper_t& /*unused*/) const { + bool + operator()(propagator_state_t& state, const stepper_t& /*unused*/) const { if (state.navigation.currentVolume != nullptr) { return false; } diff --git a/Core/include/Acts/Propagator/detail/SteppingLogger.hpp b/Core/include/Acts/Propagator/detail/SteppingLogger.hpp index ccaa3bd42..793eb6de3 100644 --- a/Core/include/Acts/Propagator/detail/SteppingLogger.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingLogger.hpp @@ -48,8 +48,11 @@ struct SteppingLogger { /// @param [in,out] state is the mutable stepper state object /// @param [in,out] result is the mutable result object template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // don't log if you have reached the target if (state.navigation.targetReached) return; @@ -72,8 +75,9 @@ struct SteppingLogger { /// Pure observer interface /// - this does not apply to the logger template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*unused*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/) + const {} }; } // namespace detail diff --git a/Core/include/Acts/Propagator/detail/VoidPropagatorComponents.hpp b/Core/include/Acts/Propagator/detail/VoidPropagatorComponents.hpp index cef74c142..7fb58bdf9 100644 --- a/Core/include/Acts/Propagator/detail/VoidPropagatorComponents.hpp +++ b/Core/include/Acts/Propagator/detail/VoidPropagatorComponents.hpp @@ -45,8 +45,8 @@ struct VoidNavigator { /// /// Empty call, compiler should optimise that template <typename propagator_state_t, typename stepper_t> - void status(propagator_state_t& /*state*/, - const stepper_t& /*unused*/) const {} + void + status(propagator_state_t& /*state*/, const stepper_t& /*unused*/) const {} /// Navigation call - void /// @@ -55,8 +55,8 @@ struct VoidNavigator { /// /// Empty call, compiler should optimise that template <typename propagator_state_t, typename stepper_t> - void target(propagator_state_t& /*state*/, - const stepper_t& /*unused*/) const {} + void + target(propagator_state_t& /*state*/, const stepper_t& /*unused*/) const {} /// Navigation call - void /// @@ -64,7 +64,8 @@ struct VoidNavigator { /// /// Empty call, compiler should optimise that template <typename propagator_state_t> - void operator()(propagator_state_t& /*state*/) const {} + void + operator()(propagator_state_t& /*state*/) const {} }; } // namespace detail diff --git a/Core/include/Acts/Propagator/detail/abort_condition_signature_check.hpp b/Core/include/Acts/Propagator/detail/abort_condition_signature_check.hpp index 9c64b5837..230aadb8b 100644 --- a/Core/include/Acts/Propagator/detail/abort_condition_signature_check.hpp +++ b/Core/include/Acts/Propagator/detail/abort_condition_signature_check.hpp @@ -41,28 +41,38 @@ namespace Acts { namespace detail { namespace { -template <typename T, typename propagator_state_t, typename stepper_t, - typename result_t, - typename = decltype(std::declval<const T>().operator()( - std::declval<const result_t&>(), - std::declval<const propagator_state_t&>()), - std::declval<const stepper_t&>())> +template < + typename T, + typename propagator_state_t, + typename stepper_t, + typename result_t, + typename = decltype( + std::declval<const T>().operator()( + std::declval<const result_t&>(), + std::declval<const propagator_state_t&>()), + std::declval<const stepper_t&>())> std::true_type test_condition_with_result(int); template <typename, typename, typename, typename> std::false_type test_condition_with_result(...); -template <typename T, typename propagator_state_t, typename stepper_t, - typename = decltype(std::declval<const T>().operator()( - std::declval<const propagator_state_t&>(), - std::declval<const stepper_t&>()))> +template < + typename T, + typename propagator_state_t, + typename stepper_t, + typename = decltype(std::declval<const T>().operator()( + std::declval<const propagator_state_t&>(), + std::declval<const stepper_t&>()))> std::true_type test_condition_without_result(int); template <typename, typename> std::false_type test_condition_without_result(...); -template <typename T, typename propagator_state_t, typename stepper_t, - bool has_result = false> +template < + typename T, + typename propagator_state_t, + typename stepper_t, + bool has_result = false> struct condition_signature_check_impl : decltype( test_condition_without_result<T, propagator_state_t, stepper_t>(0)) { @@ -70,14 +80,19 @@ struct condition_signature_check_impl template <typename T, typename propagator_state_t, typename stepper_t> struct condition_signature_check_impl<T, propagator_state_t, stepper_t, true> - : decltype(test_condition_with_result<T, propagator_state_t, stepper_t, - result_type_t<action_type_t<T>>>(0)) { -}; + : decltype(test_condition_with_result< + T, + propagator_state_t, + stepper_t, + result_type_t<action_type_t<T>>>(0)) {}; template <typename T, typename propagator_state_t, typename stepper_t> struct abort_condition_signature_check - : condition_signature_check_impl<T, propagator_state_t, stepper_t, - condition_uses_result_type<T>::value> {}; + : condition_signature_check_impl< + T, + propagator_state_t, + stepper_t, + condition_uses_result_type<T>::value> {}; // clang-format on } // end of anonymous namespace diff --git a/Core/include/Acts/Propagator/detail/abort_list_implementation.hpp b/Core/include/Acts/Propagator/detail/abort_list_implementation.hpp index ef1e88e46..ac0e11c8b 100644 --- a/Core/include/Acts/Propagator/detail/abort_list_implementation.hpp +++ b/Core/include/Acts/Propagator/detail/abort_list_implementation.hpp @@ -21,10 +21,17 @@ namespace { /// and that result type exists template <bool has_result = true> struct condition_caller { - template <typename condition, typename result_t, typename propagator_state_t, - typename stepper_t> - static bool check(const condition& c, const result_t& r, - propagator_state_t& state, const stepper_t& stepper) { + template < + typename condition, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static bool + check( + const condition& c, + const result_t& r, + propagator_state_t& state, + const stepper_t& stepper) { using action_type = action_type_t<condition>; using result_type = result_type_t<action_type>; @@ -36,10 +43,17 @@ struct condition_caller { /// it has no access to the result template <> struct condition_caller<false> { - template <typename condition, typename result_t, typename propagator_state_t, - typename stepper_t> - static bool check(const condition& c, const result_t& /*result*/, - propagator_state_t& state, const stepper_t& stepper) { + template < + typename condition, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static bool + check( + const condition& c, + const result_t& /*result*/, + propagator_state_t& state, + const stepper_t& stepper) { return c(state, stepper); } }; @@ -53,10 +67,17 @@ struct abort_list_impl; /// the call to the remaining ones template <typename first, typename... others> struct abort_list_impl<first, others...> { - template <typename T, typename result_t, typename propagator_state_t, - typename stepper_t> - static bool check(const T& conditions_tuple, const result_t& result, - propagator_state_t& state, const stepper_t& stepper) { + template < + typename T, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static bool + check( + const T& conditions_tuple, + const result_t& result, + propagator_state_t& state, + const stepper_t& stepper) { // get the right helper for calling the abort condition constexpr bool has_result = condition_uses_result_type<first>::value; using caller_type = condition_caller<has_result>; @@ -68,8 +89,8 @@ struct abort_list_impl<first, others...> { // - make use of short-circuit evaluation // -> skip remaining conditions if this abort condition evaluates to true bool abort = caller_type::check(this_condition, result, state, stepper) || - abort_list_impl<others...>::check(conditions_tuple, result, - state, stepper); + abort_list_impl<others...>::check( + conditions_tuple, result, state, stepper); return abort; } @@ -78,27 +99,40 @@ struct abort_list_impl<first, others...> { /// This is the check call on the a last of all conditions template <typename last> struct abort_list_impl<last> { - template <typename T, typename result_t, typename propagator_state_t, - typename stepper_t> - static bool check(const T& conditions_tuple, const result_t& result, - propagator_state_t& state, const stepper_t& stepper) { + template < + typename T, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static bool + check( + const T& conditions_tuple, + const result_t& result, + propagator_state_t& state, + const stepper_t& stepper) { // get the right helper for calling the abort condition constexpr bool has_result = condition_uses_result_type<last>::value; const auto& this_condition = std::get<last>(conditions_tuple); - return condition_caller<has_result>::check(this_condition, result, state, - stepper); + return condition_caller<has_result>::check( + this_condition, result, state, stepper); } }; /// This is the empty call list - never abort template <> struct abort_list_impl<> { - template <typename T, typename result_t, typename propagator_state_t, - typename stepper_t> - static bool check(const T& /*unused*/, const result_t& /*result*/, - propagator_state_t& /*state*/, - const stepper_t& /*unused*/) { + template < + typename T, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static bool + check( + const T& /*unused*/, + const result_t& /*result*/, + propagator_state_t& /*state*/, + const stepper_t& /*unused*/) { return false; } }; diff --git a/Core/include/Acts/Propagator/detail/action_list_implementation.hpp b/Core/include/Acts/Propagator/detail/action_list_implementation.hpp index 8f2fbc7d3..ab9d79d6f 100644 --- a/Core/include/Acts/Propagator/detail/action_list_implementation.hpp +++ b/Core/include/Acts/Propagator/detail/action_list_implementation.hpp @@ -20,10 +20,17 @@ namespace { /// from the result tuple template <bool has_result = true> struct action_caller { - template <typename actor, typename result_t, typename propagator_state_t, - typename stepper_t> - static void action(const actor& act, propagator_state_t& state, - const stepper_t& stepper, result_t& result) { + template < + typename actor, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static void + action( + const actor& act, + propagator_state_t& state, + const stepper_t& stepper, + result_t& result) { act(state, stepper, result.template get<detail::result_type_t<actor>>()); } }; @@ -31,10 +38,17 @@ struct action_caller { /// The action caller struct, without result object template <> struct action_caller<false> { - template <typename actor, typename result_t, typename propagator_state_t, - typename stepper_t> - static void action(const actor& act, propagator_state_t& state, - const stepper_t& stepper, result_t& /*unused*/) { + template < + typename actor, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static void + action( + const actor& act, + propagator_state_t& state, + const stepper_t& stepper, + result_t& /*unused*/) { act(state, stepper); } }; @@ -49,10 +63,17 @@ struct action_list_impl; /// - then broadcasts the action call to the remaining tuple template <typename first, typename... others> struct action_list_impl<first, others...> { - template <typename T, typename result_t, typename propagator_state_t, - typename stepper_t> - static void action(const T& obs_tuple, propagator_state_t& state, - const stepper_t& stepper, result_t& result) { + template < + typename T, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static void + action( + const T& obs_tuple, + propagator_state_t& state, + const stepper_t& stepper, + result_t& result) { constexpr bool has_result = has_result_type_v<first>; const auto& this_action = std::get<first>(obs_tuple); action_caller<has_result>::action(this_action, state, stepper, result); @@ -64,10 +85,17 @@ struct action_list_impl<first, others...> { /// - it calls 'action' on the last entry of the tuple template <typename last> struct action_list_impl<last> { - template <typename T, typename result_t, typename propagator_state_t, - typename stepper_t> - static void action(const T& obs_tuple, propagator_state_t& state, - const stepper_t& stepper, result_t& result) { + template < + typename T, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static void + action( + const T& obs_tuple, + propagator_state_t& state, + const stepper_t& stepper, + result_t& result) { constexpr bool has_result = has_result_type_v<last>; const auto& this_action = std::get<last>(obs_tuple); action_caller<has_result>::action(this_action, state, stepper, result); @@ -77,10 +105,17 @@ struct action_list_impl<last> { /// The empty action list call implementation template <> struct action_list_impl<> { - template <typename T, typename result_t, typename propagator_state_t, - typename stepper_t> - static void action(const T& /*unused*/, propagator_state_t& /*unused*/, - const stepper_t& /*unused*/, result_t& /*unused*/) {} + template < + typename T, + typename result_t, + typename propagator_state_t, + typename stepper_t> + static void + action( + const T& /*unused*/, + propagator_state_t& /*unused*/, + const stepper_t& /*unused*/, + result_t& /*unused*/) {} }; } // namespace detail diff --git a/Core/include/Acts/Propagator/detail/action_signature_check.hpp b/Core/include/Acts/Propagator/detail/action_signature_check.hpp index d303abbef..d610cb993 100644 --- a/Core/include/Acts/Propagator/detail/action_signature_check.hpp +++ b/Core/include/Acts/Propagator/detail/action_signature_check.hpp @@ -41,39 +41,55 @@ namespace detail { namespace { -template <typename T, typename propagator_state_t, typename stepper_t, - typename result_t, - typename = decltype(std::declval<T>().operator()( - std::declval<propagator_state_t&>(), std::declval<stepper_t&>(), - std::declval<result_t&>()))> +template < + typename T, + typename propagator_state_t, + typename stepper_t, + typename result_t, + typename = decltype(std::declval<T>().operator()( + std::declval<propagator_state_t&>(), + std::declval<stepper_t&>(), + std::declval<result_t&>()))> std::true_type test_action_with_result(int); template <typename, typename, typename, typename> std::false_type test_action_with_result(...); -template <typename T, typename propagator_state_t, typename stepper_t, - typename = decltype(std::declval<T>().operator()( - std::declval<propagator_state_t&>(), std::declval<stepper_t&>()))> +template < + typename T, + typename propagator_state_t, + typename stepper_t, + typename = decltype(std::declval<T>().operator()( + std::declval<propagator_state_t&>(), + std::declval<stepper_t&>()))> std::true_type test_action_without_result(int); template <typename> std::false_type test_action_without_result(...); -template <typename T, typename propagator_state_t, typename stepper_t, - bool has_result = false> +template < + typename T, + typename propagator_state_t, + typename stepper_t, + bool has_result = false> struct action_signature_check_impl : decltype( test_action_without_result<T, propagator_state_t, stepper_t>(0)) {}; template <typename T, typename propagator_state_t, typename stepper_t> struct action_signature_check_impl<T, propagator_state_t, stepper_t, true> - : decltype(test_action_with_result<T, propagator_state_t, stepper_t, - detail::result_type_t<T>>(0)) {}; + : decltype(test_action_with_result< + T, + propagator_state_t, + stepper_t, + detail::result_type_t<T>>(0)) {}; template <typename T, typename propagator_state_t, typename stepper_t> -struct action_signature_check - : action_signature_check_impl<T, propagator_state_t, stepper_t, - detail::has_result_type_v<T>> {}; +struct action_signature_check : action_signature_check_impl< + T, + propagator_state_t, + stepper_t, + detail::has_result_type_v<T>> {}; } // end of anonymous namespace template <typename T, typename propagator_state_t, typename stepper_t> diff --git a/Core/include/Acts/Propagator/detail/stepper_extension_list_implementation.hpp b/Core/include/Acts/Propagator/detail/stepper_extension_list_implementation.hpp index 0345eaab4..ce45b43bd 100644 --- a/Core/include/Acts/Propagator/detail/stepper_extension_list_implementation.hpp +++ b/Core/include/Acts/Propagator/detail/stepper_extension_list_implementation.hpp @@ -42,9 +42,11 @@ struct stepper_extension_list_impl; template <unsigned int N> struct stepper_extension_list_impl { template <typename propagator_state_t, typename stepper_t, typename... T> - static void bid(const std::tuple<T...>& obs_tuple, - const propagator_state_t& state, const stepper_t& stepper, - std::array<int, sizeof...(T)>& bids) { + static void + bid(const std::tuple<T...>& obs_tuple, + const propagator_state_t& state, + const stepper_t& stepper, + std::array<int, sizeof...(T)>& bids) { std::get<N - 1>(bids) = std::get<N - 1>(obs_tuple).bid(state, stepper); stepper_extension_list_impl<N - 1>::bid(obs_tuple, state, stepper, bids); } @@ -53,24 +55,42 @@ struct stepper_extension_list_impl { /// - it calls 'k()' on the current entry of the tuple /// - then broadcasts the extension call to the remaining tuple template <typename propagator_state_t, typename stepper_t, typename... T> - static bool k(std::tuple<T...>& obs_tuple, const propagator_state_t& state, - const stepper_t& stepper, Vector3D& knew, - const Vector3D& bField, - const std::array<bool, sizeof...(T)>& validExtensions, - const int i = 0, const double h = 0, - const Vector3D& kprev = Vector3D()) { + static bool + k(std::tuple<T...>& obs_tuple, + const propagator_state_t& state, + const stepper_t& stepper, + Vector3D& knew, + const Vector3D& bField, + const std::array<bool, sizeof...(T)>& validExtensions, + const int i = 0, + const double h = 0, + const Vector3D& kprev = Vector3D()) { // If element is invalid: continue if (!std::get<N - 1>(validExtensions)) { return stepper_extension_list_impl<N - 1>::k( - obs_tuple, state, stepper, knew, bField, validExtensions, i, h, + obs_tuple, + state, + stepper, + knew, + bField, + validExtensions, + i, + h, kprev); } // Continue as long as evaluations are 'true' - if (std::get<N - 1>(obs_tuple).k(state, stepper, knew, bField, i, h, - kprev)) { + if (std::get<N - 1>(obs_tuple).k( + state, stepper, knew, bField, i, h, kprev)) { return stepper_extension_list_impl<N - 1>::k( - obs_tuple, state, stepper, knew, bField, validExtensions, i, h, + obs_tuple, + state, + stepper, + knew, + bField, + validExtensions, + i, + h, kprev); } else { // Break at false @@ -82,10 +102,14 @@ struct stepper_extension_list_impl { /// - it calls 'finalize()' on the current entry of the tuple /// - then broadcasts the extension call to the remaining tuple template <typename propagator_state_t, typename stepper_t, typename... T> - static bool finalize(const std::tuple<T...>& obs_tuple, - propagator_state_t& state, const stepper_t& stepper, - const double h, FreeMatrix& D, - const std::array<bool, sizeof...(T)>& validExtensions) { + static bool + finalize( + const std::tuple<T...>& obs_tuple, + propagator_state_t& state, + const stepper_t& stepper, + const double h, + FreeMatrix& D, + const std::array<bool, sizeof...(T)>& validExtensions) { // If element is invalid: continue if (!std::get<N - 1>(validExtensions)) { return stepper_extension_list_impl<N - 1>::finalize( @@ -106,10 +130,13 @@ struct stepper_extension_list_impl { /// - it calls 'finalize()' on the current entry of the tuple /// - then broadcasts the extension call to the remaining tuple template <typename propagator_state_t, typename stepper_t, typename... T> - static bool finalize(const std::tuple<T...>& obs_tuple, - propagator_state_t& state, const stepper_t& stepper, - const double h, - const std::array<bool, sizeof...(T)>& validExtensions) { + static bool + finalize( + const std::tuple<T...>& obs_tuple, + propagator_state_t& state, + const stepper_t& stepper, + const double h, + const std::array<bool, sizeof...(T)>& validExtensions) { // If element is invalid: continue if (!std::get<N - 1>(validExtensions)) { return stepper_extension_list_impl<N - 1>::finalize( @@ -132,39 +159,49 @@ template <> struct stepper_extension_list_impl<0u> { /// The empty extension list call implementation template <typename propagator_state_t, typename stepper_t, typename... T> - static void bid(const std::tuple<T...>& /*unused*/, - const propagator_state_t& /*unused*/, - const stepper_t& /*unused*/, - std::array<int, sizeof...(T)>& /*unused*/) {} + static void + bid(const std::tuple<T...>& /*unused*/, + const propagator_state_t& /*unused*/, + const stepper_t& /*unused*/, + std::array<int, sizeof...(T)>& /*unused*/) {} /// The empty extension list call implementation template <typename propagator_state_t, typename stepper_t, typename... T> - static bool k(std::tuple<T...>& /*unused*/, - const propagator_state_t& /*unused*/, - const stepper_t& /*unused*/, Vector3D& /*unused*/, - const Vector3D& /*unused*/, - const std::array<bool, sizeof...(T)>& /*unused*/, - const int /*unused*/, const double /*unused*/, - const Vector3D& /*unused*/) { + static bool + k(std::tuple<T...>& /*unused*/, + const propagator_state_t& /*unused*/, + const stepper_t& /*unused*/, + Vector3D& /*unused*/, + const Vector3D& /*unused*/, + const std::array<bool, sizeof...(T)>& /*unused*/, + const int /*unused*/, + const double /*unused*/, + const Vector3D& /*unused*/) { return true; } /// The empty extension list call implementation template <typename propagator_state_t, typename stepper_t, typename... T> - static bool finalize(const std::tuple<T...>& /*unused*/, - propagator_state_t& /*unused*/, - const stepper_t& /*unused*/, const double /*unused*/, - FreeMatrix& /*unused*/, - const std::array<bool, sizeof...(T)>& /*unused*/) { + static bool + finalize( + const std::tuple<T...>& /*unused*/, + propagator_state_t& /*unused*/, + const stepper_t& /*unused*/, + const double /*unused*/, + FreeMatrix& /*unused*/, + const std::array<bool, sizeof...(T)>& /*unused*/) { return true; } /// The empty extension list call implementation template <typename propagator_state_t, typename stepper_t, typename... T> - static bool finalize(const std::tuple<T...>& /*unused*/, - propagator_state_t& /*unused*/, - const stepper_t& /*unused*/, const double /*unused*/, - const std::array<bool, sizeof...(T)>& /*unused*/) { + static bool + finalize( + const std::tuple<T...>& /*unused*/, + propagator_state_t& /*unused*/, + const stepper_t& /*unused*/, + const double /*unused*/, + const std::array<bool, sizeof...(T)>& /*unused*/) { return true; } }; diff --git a/Core/include/Acts/Seeding/BinFinder.hpp b/Core/include/Acts/Seeding/BinFinder.hpp index cc7408130..73f35e472 100644 --- a/Core/include/Acts/Seeding/BinFinder.hpp +++ b/Core/include/Acts/Seeding/BinFinder.hpp @@ -31,7 +31,8 @@ class BinFinder : public IBinFinder<SpacePoint> { /// @param zBin z index of bin with middle space points /// @param binnedSP phi-z grid containing all bins std::vector<size_t> findBins( - size_t phiBin, size_t zBin, + size_t phiBin, + size_t zBin, const SpacePointGrid<SpacePoint>* binnedSP) override; }; } // namespace Acts diff --git a/Core/include/Acts/Seeding/BinFinder.ipp b/Core/include/Acts/Seeding/BinFinder.ipp index cd16c9d49..91582a556 100644 --- a/Core/include/Acts/Seeding/BinFinder.ipp +++ b/Core/include/Acts/Seeding/BinFinder.ipp @@ -6,8 +6,10 @@ // 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/. template <typename SpacePoint> -std::vector<size_t> Acts::BinFinder<SpacePoint>::findBins( - size_t phiBin, size_t zBin, +std::vector<size_t> +Acts::BinFinder<SpacePoint>::findBins( + size_t phiBin, + size_t zBin, const Acts::SpacePointGrid<SpacePoint>* binnedSP) { return binnedSP->neighborHoodIndices({phiBin, zBin}).collect(); } diff --git a/Core/include/Acts/Seeding/IBinFinder.hpp b/Core/include/Acts/Seeding/IBinFinder.hpp index 48a62de5d..d04b90017 100644 --- a/Core/include/Acts/Seeding/IBinFinder.hpp +++ b/Core/include/Acts/Seeding/IBinFinder.hpp @@ -33,7 +33,8 @@ class IBinFinder { /// containing bottom resp. top space points that can be combined with the /// middle space points from the provided bin virtual std::vector<size_t> findBins( - size_t phiBin, size_t zBin, + size_t phiBin, + size_t zBin, const SpacePointGrid<SpacePoint>* binnedSP) = 0; }; } // namespace Acts diff --git a/Core/include/Acts/Seeding/IExperimentCuts.hpp b/Core/include/Acts/Seeding/IExperimentCuts.hpp index f82353109..eb9ac7696 100644 --- a/Core/include/Acts/Seeding/IExperimentCuts.hpp +++ b/Core/include/Acts/Seeding/IExperimentCuts.hpp @@ -26,9 +26,10 @@ class IExperimentCuts { /// @param middle middle space point of the current seed /// @param top top space point of the current seed /// @return seed weight to be added to the seed's weight - virtual float seedWeight(const InternalSpacePoint<SpacePoint>& bottom, - const InternalSpacePoint<SpacePoint>& middle, - const InternalSpacePoint<SpacePoint>& top) const = 0; + virtual float seedWeight( + const InternalSpacePoint<SpacePoint>& bottom, + const InternalSpacePoint<SpacePoint>& middle, + const InternalSpacePoint<SpacePoint>& top) const = 0; /// @param weight the current seed weight /// @param bottom bottom space point of the current seed /// @param middle middle space point of the current seed @@ -36,7 +37,8 @@ class IExperimentCuts { /// @return true if the seed should be kept, false if the seed should be /// discarded virtual bool singleSeedCut( - float weight, const InternalSpacePoint<SpacePoint>& bottom, + float weight, + const InternalSpacePoint<SpacePoint>& bottom, const InternalSpacePoint<SpacePoint>& middle, const InternalSpacePoint<SpacePoint>& top) const = 0; diff --git a/Core/include/Acts/Seeding/InternalSeed.hpp b/Core/include/Acts/Seeding/InternalSeed.hpp index bdb4ca6e1..5bd530023 100644 --- a/Core/include/Acts/Seeding/InternalSeed.hpp +++ b/Core/include/Acts/Seeding/InternalSeed.hpp @@ -21,13 +21,18 @@ class InternalSeed { ///////////////////////////////////////////////////////////////////////////////// public: - InternalSeed(const InternalSpacePoint<SpacePoint>& s0, - const InternalSpacePoint<SpacePoint>& s1, - const InternalSpacePoint<SpacePoint>& s2, float z); + InternalSeed( + const InternalSpacePoint<SpacePoint>& s0, + const InternalSpacePoint<SpacePoint>& s1, + const InternalSpacePoint<SpacePoint>& s2, + float z); InternalSeed& operator=(const InternalSeed& seed); const std::array<const InternalSpacePoint<SpacePoint>*, 3> sp; - float z() const { return m_z; } + float + z() const { + return m_z; + } protected: float m_z; @@ -38,8 +43,8 @@ class InternalSeed { ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline InternalSeed<SpacePoint>& InternalSeed<SpacePoint>::operator=( - const InternalSeed<SpacePoint>& seed) { +inline InternalSeed<SpacePoint>& +InternalSeed<SpacePoint>::operator=(const InternalSeed<SpacePoint>& seed) { m_z = seed.m_z; sp = seed.sp; return (*this); @@ -49,7 +54,8 @@ template <typename SpacePoint> inline InternalSeed<SpacePoint>::InternalSeed( const InternalSpacePoint<SpacePoint>& s0, const InternalSpacePoint<SpacePoint>& s1, - const InternalSpacePoint<SpacePoint>& s2, float z) + const InternalSpacePoint<SpacePoint>& s2, + float z) : sp({&s0, &s1, &s2}) { m_z = z; } diff --git a/Core/include/Acts/Seeding/InternalSpacePoint.hpp b/Core/include/Acts/Seeding/InternalSpacePoint.hpp index f079d8fc6..ec66b7cee 100644 --- a/Core/include/Acts/Seeding/InternalSpacePoint.hpp +++ b/Core/include/Acts/Seeding/InternalSpacePoint.hpp @@ -23,8 +23,11 @@ class InternalSpacePoint { public: InternalSpacePoint() = delete; - InternalSpacePoint(const SpacePoint& sp, const Acts::Vector3D& globalPos, - const Acts::Vector2D& offsetXY, const Acts::Vector2D& cov); + InternalSpacePoint( + const SpacePoint& sp, + const Acts::Vector3D& globalPos, + const Acts::Vector2D& offsetXY, + const Acts::Vector2D& cov); InternalSpacePoint(const InternalSpacePoint<SpacePoint>& sp); ~InternalSpacePoint() = default; @@ -32,14 +35,38 @@ class InternalSpacePoint { InternalSpacePoint<SpacePoint>& operator=( const InternalSpacePoint<SpacePoint>&); - const float& x() const { return m_x; } - const float& y() const { return m_y; } - const float& z() const { return m_z; } - const float& radius() const { return m_r; } - float phi() const { return atan2f(m_y, m_x); } - const float& covr() const { return m_covr; } - const float& covz() const { return m_covz; } - const SpacePoint& sp() const { return m_sp; } + const float& + x() const { + return m_x; + } + const float& + y() const { + return m_y; + } + const float& + z() const { + return m_z; + } + const float& + radius() const { + return m_r; + } + float + phi() const { + return atan2f(m_y, m_x); + } + const float& + covr() const { + return m_covr; + } + const float& + covz() const { + return m_covz; + } + const SpacePoint& + sp() const { + return m_sp; + } protected: float m_x; // x-coordinate in beam system coordinates @@ -57,8 +84,10 @@ class InternalSpacePoint { template <typename SpacePoint> inline InternalSpacePoint<SpacePoint>::InternalSpacePoint( - const SpacePoint& sp, const Acts::Vector3D& globalPos, - const Acts::Vector2D& offsetXY, const Acts::Vector2D& cov) + const SpacePoint& sp, + const Acts::Vector3D& globalPos, + const Acts::Vector2D& offsetXY, + const Acts::Vector2D& cov) : m_sp(sp) { m_x = globalPos.x() - offsetXY.x(); m_y = globalPos.y() - offsetXY.y(); diff --git a/Core/include/Acts/Seeding/Seed.hpp b/Core/include/Acts/Seeding/Seed.hpp index 27caac54b..8da17af5f 100644 --- a/Core/include/Acts/Seeding/Seed.hpp +++ b/Core/include/Acts/Seeding/Seed.hpp @@ -18,13 +18,22 @@ class Seed { ///////////////////////////////////////////////////////////////////////////////// public: - Seed(const SpacePoint& b, const SpacePoint& m, const SpacePoint& u, - float vertex); + Seed( + const SpacePoint& b, + const SpacePoint& m, + const SpacePoint& u, + float vertex); Seed(const Seed&) = default; Seed& operator=(const Seed&); - const std::vector<const SpacePoint*>& sp() const { return m_spacepoints; } - double z() const { return m_zvertex; } + const std::vector<const SpacePoint*>& + sp() const { + return m_spacepoints; + } + double + z() const { + return m_zvertex; + } private: std::vector<const SpacePoint*> m_spacepoints; @@ -36,8 +45,11 @@ class Seed { /////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -Seed<SpacePoint>::Seed(const SpacePoint& b, const SpacePoint& m, - const SpacePoint& u, float vertex) { +Seed<SpacePoint>::Seed( + const SpacePoint& b, + const SpacePoint& m, + const SpacePoint& u, + float vertex) { m_zvertex = vertex; m_spacepoints.push_back(&b); m_spacepoints.push_back(&m); diff --git a/Core/include/Acts/Seeding/SeedFilter.hpp b/Core/include/Acts/Seeding/SeedFilter.hpp index 59878cb07..cb372b93a 100644 --- a/Core/include/Acts/Seeding/SeedFilter.hpp +++ b/Core/include/Acts/Seeding/SeedFilter.hpp @@ -64,15 +64,17 @@ class SeedFilter { const InternalSpacePoint<SpacePoint>& middleSP, std::vector<const InternalSpacePoint<SpacePoint>*>& topSpVec, std::vector<float>& invHelixDiameterVec, - std::vector<float>& impactParametersVec, float zOrigin) const; + std::vector<float>& impactParametersVec, + float zOrigin) const; /// Filter seeds once all seeds for one middle space point have been created /// @param seedsPerSpM vector of pairs containing weight and seed for all /// for all seeds with the same middle space point /// @return vector of all InternalSeeds that not filtered out virtual void filterSeeds_1SpFixed( - std::vector<std::pair< - float, std::unique_ptr<const InternalSeed<SpacePoint>>>>& seedsPerSpM, + std::vector< + std::pair<float, std::unique_ptr<const InternalSeed<SpacePoint>>>>& + seedsPerSpM, std::vector<std::unique_ptr<Seed<SpacePoint>>>& outVec) const; private: diff --git a/Core/include/Acts/Seeding/SeedFilter.ipp b/Core/include/Acts/Seeding/SeedFilter.ipp index 19096ec2b..d2c7ef315 100644 --- a/Core/include/Acts/Seeding/SeedFilter.ipp +++ b/Core/include/Acts/Seeding/SeedFilter.ipp @@ -12,7 +12,8 @@ namespace Acts { // constructor template <typename SpacePoint> SeedFilter<SpacePoint>::SeedFilter( - SeedFilterConfig config, IExperimentCuts<SpacePoint>* expCuts /* = 0*/) + SeedFilterConfig config, + IExperimentCuts<SpacePoint>* expCuts /* = 0*/) : m_cfg(config), m_experimentCuts(expCuts) {} // function to filter seeds based on all seeds with same bottom- and @@ -25,7 +26,8 @@ SeedFilter<SpacePoint>::filterSeeds_2SpFixed( const InternalSpacePoint<SpacePoint>& middleSP, std::vector<const InternalSpacePoint<SpacePoint>*>& topSpVec, std::vector<float>& invHelixDiameterVec, - std::vector<float>& impactParametersVec, float zOrigin) const { + std::vector<float>& impactParametersVec, + float zOrigin) const { std::vector<std::pair<float, std::unique_ptr<const InternalSeed<SpacePoint>>>> selectedSeeds; @@ -84,33 +86,40 @@ SeedFilter<SpacePoint>::filterSeeds_2SpFixed( // add detector specific considerations on the seed weight weight += m_experimentCuts->seedWeight(bottomSP, middleSP, *topSpVec[i]); // discard seeds according to detector specific cuts (e.g.: weight) - if (!m_experimentCuts->singleSeedCut(weight, bottomSP, middleSP, - *topSpVec[i])) { + if (!m_experimentCuts->singleSeedCut( + weight, bottomSP, middleSP, *topSpVec[i])) { continue; } } - selectedSeeds.push_back( - std::make_pair(weight, std::make_unique<const InternalSeed<SpacePoint>>( - bottomSP, middleSP, *topSpVec[i], zOrigin))); + selectedSeeds.push_back(std::make_pair( + weight, + std::make_unique<const InternalSeed<SpacePoint>>( + bottomSP, middleSP, *topSpVec[i], zOrigin))); } return selectedSeeds; } // after creating all seeds with a common middle space point, filter again template <typename SpacePoint> -void SeedFilter<SpacePoint>::filterSeeds_1SpFixed( - std::vector<std::pair< - float, std::unique_ptr<const InternalSeed<SpacePoint>>>>& seedsPerSpM, +void +SeedFilter<SpacePoint>::filterSeeds_1SpFixed( + std::vector< + std::pair<float, std::unique_ptr<const InternalSeed<SpacePoint>>>>& + seedsPerSpM, std::vector<std::unique_ptr<Seed<SpacePoint>>>& outVec) const { // sort by weight and iterate only up to configured max number of seeds per // middle SP std::sort( - (seedsPerSpM.begin()), (seedsPerSpM.end()), + (seedsPerSpM.begin()), + (seedsPerSpM.end()), [](const std::pair< - float, std::unique_ptr<const Acts::InternalSeed<SpacePoint>>>& i1, - const std::pair<float, - std::unique_ptr<const Acts::InternalSeed<SpacePoint>>>& - i2) { return i1.first > i2.first; }); + float, + std::unique_ptr<const Acts::InternalSeed<SpacePoint>>>& i1, + const std::pair< + float, + std::unique_ptr<const Acts::InternalSeed<SpacePoint>>>& i2) { + return i1.first > i2.first; + }); if (m_experimentCuts != nullptr) { seedsPerSpM = m_experimentCuts->cutPerMiddleSP(std::move(seedsPerSpM)); } @@ -125,8 +134,10 @@ void SeedFilter<SpacePoint>::filterSeeds_1SpFixed( // weight seeds for (; it < itBegin + maxSeeds; ++it) { outVec.push_back(std::make_unique<Seed<SpacePoint>>( - (*it).second->sp[0]->sp(), (*it).second->sp[1]->sp(), - (*it).second->sp[2]->sp(), (*it).second->z())); + (*it).second->sp[0]->sp(), + (*it).second->sp[1]->sp(), + (*it).second->sp[2]->sp(), + (*it).second->z())); } } diff --git a/Core/include/Acts/Seeding/Seedfinder.hpp b/Core/include/Acts/Seeding/Seedfinder.hpp index 1dd6f0644..a1c9ef37b 100644 --- a/Core/include/Acts/Seeding/Seedfinder.hpp +++ b/Core/include/Acts/Seeding/Seedfinder.hpp @@ -62,9 +62,10 @@ class Seedfinder { /// found seeds template <typename spacepoint_iterator_t> Acts::SeedfinderState<external_spacepoint_t> initState( - spacepoint_iterator_t spBegin, spacepoint_iterator_t spEnd, - std::function<Acts::Vector2D(const external_spacepoint_t&, float, float, - float)> + spacepoint_iterator_t spBegin, + spacepoint_iterator_t spEnd, + std::function< + Acts::Vector2D(const external_spacepoint_t&, float, float, float)> covTool, std::shared_ptr<Acts::IBinFinder<external_spacepoint_t>> bottomBinFinder, std::shared_ptr<Acts::IBinFinder<external_spacepoint_t>> topBinFinder) @@ -83,7 +84,8 @@ class Seedfinder { private: void transformCoordinates( std::vector<const InternalSpacePoint<external_spacepoint_t>*>& vec, - const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom, + const InternalSpacePoint<external_spacepoint_t>& spM, + bool bottom, std::vector<LinCircle>& linCircleVec) const; Acts::SeedfinderConfig<external_spacepoint_t> m_config; diff --git a/Core/include/Acts/Seeding/Seedfinder.ipp b/Core/include/Acts/Seeding/Seedfinder.ipp index 9cdcbeea8..02a1bb67a 100644 --- a/Core/include/Acts/Seeding/Seedfinder.ipp +++ b/Core/include/Acts/Seeding/Seedfinder.ipp @@ -39,9 +39,10 @@ template <typename external_spacepoint_t> template <typename spacepoint_iterator_t> Acts::SeedfinderState<external_spacepoint_t> Seedfinder<external_spacepoint_t>::initState( - spacepoint_iterator_t spBegin, spacepoint_iterator_t spEnd, - std::function<Acts::Vector2D(const external_spacepoint_t&, float, float, - float)> + spacepoint_iterator_t spBegin, + spacepoint_iterator_t spEnd, + std::function< + Acts::Vector2D(const external_spacepoint_t&, float, float, float)> covTool, std::shared_ptr<Acts::IBinFinder<external_spacepoint_t>> bottomBinFinder, std::shared_ptr<Acts::IBinFinder<external_spacepoint_t>> topBinFinder) @@ -134,7 +135,8 @@ Seedfinder<external_spacepoint_t>::initState( } template <typename external_spacepoint_t> -void Seedfinder<external_spacepoint_t>::createSeedsForRegion( +void +Seedfinder<external_spacepoint_t>::createSeedsForRegion( SeedfinderStateIterator<external_spacepoint_t> it, Acts::SeedfinderState<external_spacepoint_t>& state) const { for (size_t spIndex = 0; spIndex < it.currentBin->size(); spIndex++) { @@ -228,7 +230,8 @@ void Seedfinder<external_spacepoint_t>::createSeedsForRegion( std::vector<float> impactParameters; std::vector<std::pair< - float, std::unique_ptr<const InternalSeed<external_spacepoint_t>>>> + float, + std::unique_ptr<const InternalSeed<external_spacepoint_t>>>> seedsPerSpM; size_t numBotSP = compatBottomSP.size(); size_t numTopSP = compatTopSP.size(); @@ -338,25 +341,33 @@ void Seedfinder<external_spacepoint_t>::createSeedsForRegion( } if (!topSpVec.empty()) { std::vector<std::pair< - float, std::unique_ptr<const InternalSeed<external_spacepoint_t>>>> + float, + std::unique_ptr<const InternalSeed<external_spacepoint_t>>>> sameTrackSeeds; sameTrackSeeds = std::move(m_config.seedFilter->filterSeeds_2SpFixed( - *compatBottomSP[b], *spM, topSpVec, curvatures, impactParameters, + *compatBottomSP[b], + *spM, + topSpVec, + curvatures, + impactParameters, Zob)); - seedsPerSpM.insert(seedsPerSpM.end(), - std::make_move_iterator(sameTrackSeeds.begin()), - std::make_move_iterator(sameTrackSeeds.end())); + seedsPerSpM.insert( + seedsPerSpM.end(), + std::make_move_iterator(sameTrackSeeds.begin()), + std::make_move_iterator(sameTrackSeeds.end())); } } - m_config.seedFilter->filterSeeds_1SpFixed(seedsPerSpM, - state.outputVec[it.outputIndex]); + m_config.seedFilter->filterSeeds_1SpFixed( + seedsPerSpM, state.outputVec[it.outputIndex]); } } template <typename external_spacepoint_t> -void Seedfinder<external_spacepoint_t>::transformCoordinates( +void +Seedfinder<external_spacepoint_t>::transformCoordinates( std::vector<const InternalSpacePoint<external_spacepoint_t>*>& vec, - const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom, + const InternalSpacePoint<external_spacepoint_t>& spM, + bool bottom, std::vector<LinCircle>& linCircleVec) const { float xM = spM.x(); float yM = spM.y(); diff --git a/Core/include/Acts/Seeding/SeedfinderState.hpp b/Core/include/Acts/Seeding/SeedfinderState.hpp index 71e5621d2..4e3cf2540 100644 --- a/Core/include/Acts/Seeding/SeedfinderState.hpp +++ b/Core/include/Acts/Seeding/SeedfinderState.hpp @@ -23,7 +23,8 @@ namespace Acts { template <typename SpacePoint> class SeedfinderStateIterator { public: - SeedfinderStateIterator& operator++() { + SeedfinderStateIterator& + operator++() { if (zIndex < phiZbins[1]) { zIndex++; @@ -44,13 +45,15 @@ class SeedfinderStateIterator { return *this; } - bool operator==(const SeedfinderStateIterator& otherState) { + bool + operator==(const SeedfinderStateIterator& otherState) { return (zIndex == otherState.zIndex && phiIndex == otherState.phiIndex); } - SeedfinderStateIterator(const SpacePointGrid<SpacePoint>* spgrid, - IBinFinder<SpacePoint>* botBinFinder, - IBinFinder<SpacePoint>* tBinFinder) + SeedfinderStateIterator( + const SpacePointGrid<SpacePoint>* spgrid, + IBinFinder<SpacePoint>* botBinFinder, + IBinFinder<SpacePoint>* tBinFinder) : currentBin(&(spgrid->atLocalBins({1, 1}))) { grid = spgrid; bottomBinFinder = botBinFinder; @@ -63,10 +66,12 @@ class SeedfinderStateIterator { topBinIndices = topBinFinder->findBins(phiIndex, zIndex, grid); } - SeedfinderStateIterator(const SpacePointGrid<SpacePoint>* spgrid, - IBinFinder<SpacePoint>* botBinFinder, - IBinFinder<SpacePoint>* tBinFinder, size_t phiInd, - size_t zInd) + SeedfinderStateIterator( + const SpacePointGrid<SpacePoint>* spgrid, + IBinFinder<SpacePoint>* botBinFinder, + IBinFinder<SpacePoint>* tBinFinder, + size_t phiInd, + size_t zInd) : currentBin(&(spgrid->atLocalBins({phiInd, zInd}))) { bottomBinFinder = botBinFinder; topBinFinder = tBinFinder; @@ -108,15 +113,20 @@ struct SeedfinderState { // container with seeds created so far std::vector<std::vector<std::unique_ptr<Seed<SpacePoint>>>> outputVec; - SeedfinderStateIterator<SpacePoint> begin() { + SeedfinderStateIterator<SpacePoint> + begin() { return SeedfinderStateIterator<SpacePoint>( binnedSP.get(), bottomBinFinder.get(), topBinFinder.get()); } - SeedfinderStateIterator<SpacePoint> end() { + SeedfinderStateIterator<SpacePoint> + end() { auto phiZbins = binnedSP->numLocalBins(); return SeedfinderStateIterator<SpacePoint>( - binnedSP.get(), bottomBinFinder.get(), topBinFinder.get(), phiZbins[0], + binnedSP.get(), + bottomBinFinder.get(), + topBinFinder.get(), + phiZbins[0], phiZbins[1] + 1); } }; diff --git a/Core/include/Acts/Seeding/SpacePointGrid.hpp b/Core/include/Acts/Seeding/SpacePointGrid.hpp index c824e92c6..aa08d8208 100644 --- a/Core/include/Acts/Seeding/SpacePointGrid.hpp +++ b/Core/include/Acts/Seeding/SpacePointGrid.hpp @@ -38,10 +38,10 @@ struct SpacePointGridConfig { template <typename SpacePoint> using SpacePointGrid = detail::Grid< std::vector<std::unique_ptr<const InternalSpacePoint<SpacePoint>>>, - detail::Axis<detail::AxisType::Equidistant, - detail::AxisBoundaryType::Closed>, - detail::Axis<detail::AxisType::Equidistant, - detail::AxisBoundaryType::Bound>>; + detail:: + Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Closed>, + detail:: + Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Bound>>; class SpacePointGridCreator { public: diff --git a/Core/include/Acts/Seeding/SpacePointGrid.ipp b/Core/include/Acts/Seeding/SpacePointGrid.ipp index 6f4c3637d..cadfd4c99 100644 --- a/Core/include/Acts/Seeding/SpacePointGrid.ipp +++ b/Core/include/Acts/Seeding/SpacePointGrid.ipp @@ -35,9 +35,9 @@ Acts::SpacePointGridCreator::createGrid( // divide 2pi by angle delta to get number of phi-bins // size is always 2pi even for regions of interest int phiBins = std::floor(2 * M_PI / (outerAngle - innerAngle)); - Acts::detail::Axis<detail::AxisType::Equidistant, - detail::AxisBoundaryType::Closed> - phiAxis(-M_PI, M_PI, phiBins); + Acts::detail:: + Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Closed> + phiAxis(-M_PI, M_PI, phiBins); // TODO: can probably be optimized using smaller z bins // and returning (multiple) neighbors only in one z-direction for forward diff --git a/Core/include/Acts/Surfaces/BoundaryCheck.hpp b/Core/include/Acts/Surfaces/BoundaryCheck.hpp index 3b53203bb..f1f9c6bde 100644 --- a/Core/include/Acts/Surfaces/BoundaryCheck.hpp +++ b/Core/include/Acts/Surfaces/BoundaryCheck.hpp @@ -47,8 +47,11 @@ class BoundaryCheck { /// @param checkLocal1 Boolean directive to check coordinate 1 /// @param tolerance0 Tolerance along coordinate 0 /// @param tolerance1 Tolerance along coordinate 1 - BoundaryCheck(bool checkLocal0, bool checkLocal1, double tolerance0 = 0, - double tolerance1 = 0); + BoundaryCheck( + bool checkLocal0, + bool checkLocal1, + double tolerance0 = 0, + double tolerance1 = 0); /// Construct a chi2-based check. /// @@ -82,8 +85,10 @@ class BoundaryCheck { /// /// The check takes into account whether tolerances or covariances are defined /// for the boundary check. - bool isInside(const Vector2D& point, const Vector2D& lowerLeft, - const Vector2D& upperRight) const; + bool isInside( + const Vector2D& point, + const Vector2D& lowerLeft, + const Vector2D& upperRight) const; /// Calculate the signed, weighted, closest distance to a polygonal boundary. /// @@ -97,8 +102,8 @@ class BoundaryCheck { /// If a covariance is defined, the distance is the corresponding Mahalanobis /// distance. Otherwise, it is the Eucleadian distance. template <typename Vector2DContainer> - double distance(const Vector2D& point, - const Vector2DContainer& vertices) const; + double distance(const Vector2D& point, const Vector2DContainer& vertices) + const; /// Calculate the signed, weighted, closest distance to an aligned box. /// @@ -111,8 +116,10 @@ class BoundaryCheck { /// /// If a covariance is defined, the distance is the corresponding Mahalanobis /// distance. Otherwise, it is the Eucleadian distance. - double distance(const Vector2D& point, const Vector2D& lowerLeft, - const Vector2D& upperRight) const; + double distance( + const Vector2D& point, + const Vector2D& lowerLeft, + const Vector2D& upperRight) const; private: enum class Type { @@ -129,12 +136,14 @@ class BoundaryCheck { /// Check if the point is inside the polygon w/o any tolerances. template <typename Vector2DContainer> - bool isInsidePolygon(const Vector2D& point, - const Vector2DContainer& vertices) const; + bool isInsidePolygon(const Vector2D& point, const Vector2DContainer& vertices) + const; /// Check if the point is inside the aligned box - bool isInsideRectangle(const Vector2D& point, const Vector2D& lowerLeft, - const Vector2D& upperRight) const; + bool isInsideRectangle( + const Vector2D& point, + const Vector2D& lowerLeft, + const Vector2D& upperRight) const; /// Check if the distance vector is within the absolute or relative limits. bool isTolerated(const Vector2D& delta) const; @@ -145,11 +154,13 @@ class BoundaryCheck { /// Calculate the closest point on the polygon. template <typename Vector2DContainer> Vector2D computeClosestPointOnPolygon( - const Vector2D& point, const Vector2DContainer& vertices) const; + const Vector2D& point, + const Vector2DContainer& vertices) const; /// Calculate the closest point on the box Vector2D computeEuclideanClosestPointOnRectangle( - const Vector2D& point, const Vector2D& lowerLeft, + const Vector2D& point, + const Vector2D& lowerLeft, const Vector2D& upperRight) const; /// metric weight matrix: identity for absolute mode or inverse covariance @@ -176,21 +187,26 @@ inline Acts::BoundaryCheck::BoundaryCheck(bool check) m_tolerance(0, 0), m_type(check ? Type::eAbsolute : Type::eNone) {} -inline Acts::BoundaryCheck::BoundaryCheck(bool checkLocal0, bool checkLocal1, - double tolerance0, double tolerance1) +inline Acts::BoundaryCheck::BoundaryCheck( + bool checkLocal0, + bool checkLocal1, + double tolerance0, + double tolerance1) : m_weight(ActsSymMatrixD<2>::Identity()), - m_tolerance(checkLocal0 ? tolerance0 : DBL_MAX, - checkLocal1 ? tolerance1 : DBL_MAX), + m_tolerance( + checkLocal0 ? tolerance0 : DBL_MAX, + checkLocal1 ? tolerance1 : DBL_MAX), m_type(Type::eAbsolute) {} inline Acts::BoundaryCheck::BoundaryCheck( - const ActsSymMatrixD<2>& localCovariance, double sigmaMax) + const ActsSymMatrixD<2>& localCovariance, + double sigmaMax) : m_weight(localCovariance.inverse()), m_tolerance(sigmaMax, 0), m_type(Type::eChi2) {} -inline Acts::BoundaryCheck Acts::BoundaryCheck::transformed( - const ActsMatrixD<2, 2>& jacobian) const { +inline Acts::BoundaryCheck +Acts::BoundaryCheck::transformed(const ActsMatrixD<2, 2>& jacobian) const { BoundaryCheck bc = *this; if (m_type == Type::eAbsolute) { // project tolerances to the new system. depending on the jacobian we need @@ -204,8 +220,10 @@ inline Acts::BoundaryCheck Acts::BoundaryCheck::transformed( } template <typename Vector2DContainer> -inline bool Acts::BoundaryCheck::isInside( - const Vector2D& point, const Vector2DContainer& vertices) const { +inline bool +Acts::BoundaryCheck::isInside( + const Vector2D& point, + const Vector2DContainer& vertices) const { // a compatible point must be either completely in the polygon or on the // outside but within the defined tolerance relative to the closest point if (isInsidePolygon(point, vertices)) { @@ -217,8 +235,10 @@ inline bool Acts::BoundaryCheck::isInside( } template <typename Vector2DContainer> -inline bool Acts::BoundaryCheck::isInsidePolygon( - const Vector2D& point, const Vector2DContainer& vertices) const { +inline bool +Acts::BoundaryCheck::isInsidePolygon( + const Vector2D& point, + const Vector2DContainer& vertices) const { // when we move along the edges of a convex polygon, a point on the inside of // the polygon will always appear on the same side of each edge. // a point on the outside will switch sides at least once. @@ -252,16 +272,20 @@ inline bool Acts::BoundaryCheck::isInsidePolygon( return true; } -inline bool Acts::BoundaryCheck::isInsideRectangle( - const Vector2D& point, const Vector2D& lowerLeft, +inline bool +Acts::BoundaryCheck::isInsideRectangle( + const Vector2D& point, + const Vector2D& lowerLeft, const Vector2D& upperRight) const { return (lowerLeft[0] <= point[0]) && (point[0] < upperRight[0]) && (lowerLeft[1] <= point[1]) && (point[1] < upperRight[1]); } -inline bool Acts::BoundaryCheck::isInside(const Vector2D& point, - const Vector2D& lowerLeft, - const Vector2D& upperRight) const { +inline bool +Acts::BoundaryCheck::isInside( + const Vector2D& point, + const Vector2D& lowerLeft, + const Vector2D& upperRight) const { if (isInsideRectangle(point, lowerLeft, upperRight)) { return true; } else { @@ -286,17 +310,21 @@ inline bool Acts::BoundaryCheck::isInside(const Vector2D& point, } template <typename Vector2DContainer> -inline double Acts::BoundaryCheck::distance( - const Acts::Vector2D& point, const Vector2DContainer& vertices) const { +inline double +Acts::BoundaryCheck::distance( + const Acts::Vector2D& point, + const Vector2DContainer& vertices) const { // TODO 2017-04-06 msmk: this should be calculable directly double d = squaredNorm(point - computeClosestPointOnPolygon(point, vertices)); d = std::sqrt(d); return isInsidePolygon(point, vertices) ? -d : d; } -inline double Acts::BoundaryCheck::distance(const Acts::Vector2D& point, - const Vector2D& lowerLeft, - const Vector2D& upperRight) const { +inline double +Acts::BoundaryCheck::distance( + const Acts::Vector2D& point, + const Vector2D& lowerLeft, + const Vector2D& upperRight) const { if (m_type == Type::eNone || m_type == Type::eAbsolute) { // compute closest point on box double d = (point - computeEuclideanClosestPointOnRectangle( @@ -313,7 +341,8 @@ inline double Acts::BoundaryCheck::distance(const Acts::Vector2D& point, } } -inline bool Acts::BoundaryCheck::isTolerated(const Vector2D& delta) const { +inline bool +Acts::BoundaryCheck::isTolerated(const Vector2D& delta) const { if (m_type == Type::eNone) { return true; } else if (m_type == Type::eAbsolute) { @@ -325,13 +354,16 @@ inline bool Acts::BoundaryCheck::isTolerated(const Vector2D& delta) const { } } -inline double Acts::BoundaryCheck::squaredNorm(const Vector2D& x) const { +inline double +Acts::BoundaryCheck::squaredNorm(const Vector2D& x) const { return (x.transpose() * m_weight * x).value(); } template <typename Vector2DContainer> -inline Acts::Vector2D Acts::BoundaryCheck::computeClosestPointOnPolygon( - const Acts::Vector2D& point, const Vector2DContainer& vertices) const { +inline Acts::Vector2D +Acts::BoundaryCheck::computeClosestPointOnPolygon( + const Acts::Vector2D& point, + const Vector2DContainer& vertices) const { // calculate the closest position on the segment between `ll0` and `ll1` to // the point as measured by the metric induced by the weight matrix auto closestOnSegment = [&](auto&& ll0, auto&& ll1) { @@ -368,7 +400,8 @@ inline Acts::Vector2D Acts::BoundaryCheck::computeClosestPointOnPolygon( inline Acts::Vector2D Acts::BoundaryCheck::computeEuclideanClosestPointOnRectangle( - const Vector2D& point, const Vector2D& lowerLeft, + const Vector2D& point, + const Vector2D& lowerLeft, const Vector2D& upperRight) const { /* * diff --git a/Core/include/Acts/Surfaces/ConeBounds.hpp b/Core/include/Acts/Surfaces/ConeBounds.hpp index 2754a1e4e..9ebb84616 100644 --- a/Core/include/Acts/Surfaces/ConeBounds.hpp +++ b/Core/include/Acts/Surfaces/ConeBounds.hpp @@ -62,8 +62,12 @@ class ConeBounds : public SurfaceBounds { /// @param halfphi is the half opening angle (default is pi) /// @param avphi is the phi value around which the bounds are opened /// (default=0) - ConeBounds(double alpha, double zmin, double zmax, double halfphi = M_PI, - double avphi = 0.); + ConeBounds( + double alpha, + double zmin, + double zmax, + double halfphi = M_PI, + double avphi = 0.); ~ConeBounds() override; @@ -78,8 +82,8 @@ class ConeBounds : public SurfaceBounds { /// @param lpos is the local position to be checked /// @param bcheck is the boundary check directive /// @return is a boolean indicating if the position is inside - bool inside(const Vector2D& lpos, - const BoundaryCheck& bcheck = true) const final; + bool inside(const Vector2D& lpos, const BoundaryCheck& bcheck = true) + const final; /// Minimal distance to boundary ( > 0 if outside and <=0 if inside) /// @@ -135,39 +139,48 @@ class ConeBounds : public SurfaceBounds { Vector2D shifted(const Vector2D& lpos) const; }; -inline double ConeBounds::r(double z) const { +inline double +ConeBounds::r(double z) const { return std::abs(z * m_tanAlpha); } -inline double ConeBounds::tanAlpha() const { +inline double +ConeBounds::tanAlpha() const { return m_tanAlpha; } -inline double ConeBounds::sinAlpha() const { +inline double +ConeBounds::sinAlpha() const { return std::sin(m_alpha); } -inline double ConeBounds::cosAlpha() const { +inline double +ConeBounds::cosAlpha() const { return std::cos(m_alpha); } -inline double ConeBounds::alpha() const { +inline double +ConeBounds::alpha() const { return m_alpha; } -inline double ConeBounds::minZ() const { +inline double +ConeBounds::minZ() const { return m_zMin; } -inline double ConeBounds::maxZ() const { +inline double +ConeBounds::maxZ() const { return m_zMax; } -inline double ConeBounds::averagePhi() const { +inline double +ConeBounds::averagePhi() const { return m_avgPhi; } -inline double ConeBounds::halfPhiSector() const { +inline double +ConeBounds::halfPhiSector() const { return m_halfPhi; } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index 8eff497f6..15477d2a7 100644 --- a/Core/include/Acts/Surfaces/ConeSurface.hpp +++ b/Core/include/Acts/Surfaces/ConeSurface.hpp @@ -43,8 +43,10 @@ class ConeSurface : public Surface { /// @param htrans is the transform to place to cone in a 3D frame /// @param alpha is the opening angle of the cone /// @param symmetric indicates if the cones are built to +/1 z - ConeSurface(std::shared_ptr<const Transform3D> htrans, double alpha, - bool symmetric = false); + ConeSurface( + std::shared_ptr<const Transform3D> htrans, + double alpha, + bool symmetric = false); /// Constructor form HepTransform and an opening angle /// @@ -53,15 +55,20 @@ class ConeSurface : public Surface { /// @param zmin is the z range over which the cone spans /// @param zmax is the z range over which the cone spans /// @param halfPhi is the openen angle for cone ssectors - ConeSurface(std::shared_ptr<const Transform3D> htrans, double alpha, - double zmin, double zmax, double halfPhi = M_PI); + ConeSurface( + std::shared_ptr<const Transform3D> htrans, + double alpha, + double zmin, + double zmax, + double halfPhi = M_PI); /// Constructor from HepTransform and ConeBounds /// /// @param htrans is the transform that places the cone in the global frame /// @param cbounds is the boundary class, the bounds must exit - ConeSurface(std::shared_ptr<const Transform3D> htrans, - const std::shared_ptr<const ConeBounds>& cbounds); + ConeSurface( + std::shared_ptr<const Transform3D> htrans, + const std::shared_ptr<const ConeBounds>& cbounds); /// Copy constructor /// @@ -73,8 +80,10 @@ class ConeSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - ConeSurface(const GeometryContext& gctx, const ConeSurface& other, - const Transform3D& transf); + ConeSurface( + const GeometryContext& gctx, + const ConeSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -88,8 +97,9 @@ class ConeSurface : public Surface { /// Clone method into a concrete type of ConeSurface with shift /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<ConeSurface> clone(const GeometryContext& gctx, - const Transform3D& shift) const; + std::shared_ptr<ConeSurface> clone( + const GeometryContext& gctx, + const Transform3D& shift) const; /// The binning position method - is overloaded for r-type binning /// @@ -97,8 +107,9 @@ class ConeSurface : public Surface { /// @param bValue defines the type of binning applied in the global frame /// /// @return The return type is a vector for positioning in the global frame - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const final; /// Return the surface type SurfaceType type() const override; @@ -112,9 +123,10 @@ class ConeSurface : public Surface { /// constructed /// @param mom is the momentum used for the measurement frame construction /// @return matrix that indicates the measurement frame - const RotationMatrix3D referenceFrame(const GeometryContext& gctx, - const Vector3D& pos, - const Vector3D& mom) const final; + const RotationMatrix3D referenceFrame( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const final; /// Return method for surface normal information /// @@ -122,8 +134,8 @@ class ConeSurface : public Surface { /// @param lp is the local position on the cone for which the normal vector /// is requested /// @return Vector3D normal vector in global frame - const Vector3D normal(const GeometryContext& gctx, - const Vector2D& lp) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector2D& lp) + const final; /// Return method for surface normal information /// @@ -131,8 +143,8 @@ class ConeSurface : public Surface { /// @param gpos is the global position on the cone for which the normal vector /// is requested /// @return Vector3D normal vector in global frame - const Vector3D normal(const GeometryContext& gctx, - const Vector3D& gpos) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector3D& gpos) + const final; /// Normal vector return without argument using Surface::normal; @@ -153,8 +165,11 @@ class ConeSurface : public Surface { /// @param lpos is the local position to be transformed /// @param mom is the global momentum (ignored in this operation) /// @param gpos is the global position shich is filled - void localToGlobal(const GeometryContext& gctx, const Vector2D& lpos, - const Vector3D& mom, Vector3D& gpos) const final; + void localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Global to local transfomration /// @@ -163,8 +178,11 @@ class ConeSurface : public Surface { /// @param mom is the global momentum (ignored in this operation) /// @param lpos is hte local position to be filled /// @return is a boolean indicating if the transformation succeeded - bool globalToLocal(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom, Vector2D& lpos) const final; + bool globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// @brief Straight line intersection schema - provides closest intersection /// and (signed) path length @@ -209,11 +227,13 @@ class ConeSurface : public Surface { /// to be unit length. /// /// @return is the Intersection object - Intersection intersectionEstimate(const GeometryContext& gctx, - const Vector3D& gpos, const Vector3D& gmom, - NavigationDirection navDir, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + Intersection intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + NavigationDirection navDir, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// the pathCorrection for derived classes with thickness /// @@ -221,8 +241,10 @@ class ConeSurface : public Surface { /// @param gpos is the global potion at the correction point /// @param mom is the momentum at the correction point /// @return is the path correction due to incident angle - double pathCorrection(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom) const final; + double pathCorrection( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Return properly formatted class name for screen output std::string name() const override; @@ -235,8 +257,8 @@ class ConeSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - ConeSurface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const override; + ConeSurface* clone_impl(const GeometryContext& gctx, const Transform3D& shift) + const override; }; #include "Acts/Surfaces/detail/ConeSurface.ipp" diff --git a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp index 1dd7104a2..47edfd98b 100644 --- a/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp +++ b/Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp @@ -8,7 +8,8 @@ #include "Acts/Utilities/ThrowAssert.hpp" -std::ostream& Acts::ConvexPolygonBoundsBase::toStream(std::ostream& sl) const { +std::ostream& +Acts::ConvexPolygonBoundsBase::toStream(std::ostream& sl) const { std::vector<Vector2D> vtxs = vertices(); sl << "Acts::ConvexPolygonBounds<" << vtxs.size() << ">: vertices: [x, y]\n"; for (size_t i = 0; i < vtxs.size(); i++) { @@ -23,8 +24,8 @@ std::ostream& Acts::ConvexPolygonBoundsBase::toStream(std::ostream& sl) const { } template <typename coll_t> -Acts::RectangleBounds Acts::ConvexPolygonBoundsBase::makeBoundingBox( - const coll_t& vertices) { +Acts::RectangleBounds +Acts::ConvexPolygonBoundsBase::makeBoundingBox(const coll_t& vertices) { Vector2D vmax, vmin; vmax = vertices[0]; vmin = vertices[0]; @@ -37,7 +38,8 @@ Acts::RectangleBounds Acts::ConvexPolygonBoundsBase::makeBoundingBox( return {vmin, vmax}; } -std::vector<TDD_real_t> Acts::ConvexPolygonBoundsBase::valueStore() const { +std::vector<TDD_real_t> +Acts::ConvexPolygonBoundsBase::valueStore() const { std::vector<TDD_real_t> values; for (const auto& vtx : vertices()) { values.push_back(vtx.x()); @@ -47,9 +49,11 @@ std::vector<TDD_real_t> Acts::ConvexPolygonBoundsBase::valueStore() const { } template <typename coll_t> -bool Acts::ConvexPolygonBoundsBase::convex_impl(const coll_t& vertices) { - static_assert(std::is_same<typename coll_t::value_type, Vector2D>::value, - "Must be collection of Vector2D"); +bool +Acts::ConvexPolygonBoundsBase::convex_impl(const coll_t& vertices) { + static_assert( + std::is_same<typename coll_t::value_type, Vector2D>::value, + "Must be collection of Vector2D"); const size_t N = vertices.size(); for (size_t i = 0; i < N; i++) { @@ -89,8 +93,8 @@ template <int N> Acts::ConvexPolygonBounds<N>::ConvexPolygonBounds( const std::vector<Acts::Vector2D>& vertices) : m_vertices(), m_boundingBox(makeBoundingBox(vertices)) { - throw_assert(vertices.size() == N, - "Size and number of given vertices do not match."); + throw_assert( + vertices.size() == N, "Size and number of given vertices do not match."); for (size_t i = 0; i < N; i++) { m_vertices[i] = vertices[i]; } @@ -104,39 +108,47 @@ Acts::ConvexPolygonBounds<N>::ConvexPolygonBounds(const vertex_array& vertices) } template <int N> -Acts::ConvexPolygonBounds<N>* Acts::ConvexPolygonBounds<N>::clone() const { +Acts::ConvexPolygonBounds<N>* +Acts::ConvexPolygonBounds<N>::clone() const { return new ConvexPolygonBounds<N>(*this); } template <int N> -Acts::SurfaceBounds::BoundsType Acts::ConvexPolygonBounds<N>::type() const { +Acts::SurfaceBounds::BoundsType +Acts::ConvexPolygonBounds<N>::type() const { return SurfaceBounds::ConvexPolygon; } template <int N> -bool Acts::ConvexPolygonBounds<N>::inside( - const Acts::Vector2D& lpos, const Acts::BoundaryCheck& bcheck) const { +bool +Acts::ConvexPolygonBounds<N>::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { return bcheck.isInside(lpos, m_vertices); } template <int N> -double Acts::ConvexPolygonBounds<N>::distanceToBoundary( +double +Acts::ConvexPolygonBounds<N>::distanceToBoundary( const Acts::Vector2D& lpos) const { return BoundaryCheck(true).distance(lpos, m_vertices); } template <int N> -std::vector<Acts::Vector2D> Acts::ConvexPolygonBounds<N>::vertices() const { +std::vector<Acts::Vector2D> +Acts::ConvexPolygonBounds<N>::vertices() const { return {m_vertices.begin(), m_vertices.end()}; } template <int N> -const Acts::RectangleBounds& Acts::ConvexPolygonBounds<N>::boundingBox() const { +const Acts::RectangleBounds& +Acts::ConvexPolygonBounds<N>::boundingBox() const { return m_boundingBox; } template <int N> -bool Acts::ConvexPolygonBounds<N>::convex() const { +bool +Acts::ConvexPolygonBounds<N>::convex() const { return convex_impl(m_vertices); } @@ -154,12 +166,15 @@ Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::type() const { return SurfaceBounds::ConvexPolygon; } -bool Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::inside( - const Acts::Vector2D& lpos, const Acts::BoundaryCheck& bcheck) const { +bool +Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { return bcheck.isInside(lpos, m_vertices); } -double Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::distanceToBoundary( +double +Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::distanceToBoundary( const Acts::Vector2D& lpos) const { return BoundaryCheck(true).distance(lpos, m_vertices); } @@ -174,6 +189,7 @@ Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::boundingBox() const { return m_boundingBox; } -bool Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::convex() const { +bool +Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::convex() const { return convex_impl(m_vertices); } diff --git a/Core/include/Acts/Surfaces/CylinderBounds.hpp b/Core/include/Acts/Surfaces/CylinderBounds.hpp index 240c2bab8..48a844154 100644 --- a/Core/include/Acts/Surfaces/CylinderBounds.hpp +++ b/Core/include/Acts/Surfaces/CylinderBounds.hpp @@ -69,8 +69,11 @@ class CylinderBounds : public SurfaceBounds { /// @param avphi is the middle phi position of the segment /// @param halfphi is the half opening angle /// @param halez is the half length in z - CylinderBounds(double radius, double averagePhi, double halfPhi, - double halfZ); + CylinderBounds( + double radius, + double averagePhi, + double halfPhi, + double halfZ); ~CylinderBounds() override; @@ -128,19 +131,23 @@ class CylinderBounds : public SurfaceBounds { ActsSymMatrixD<2> jacobian() const; }; -inline double CylinderBounds::r() const { +inline double +CylinderBounds::r() const { return m_radius; } -inline double CylinderBounds::averagePhi() const { +inline double +CylinderBounds::averagePhi() const { return m_avgPhi; } -inline double CylinderBounds::halfPhiSector() const { +inline double +CylinderBounds::halfPhiSector() const { return m_halfPhi; } -inline double CylinderBounds::halflengthZ() const { +inline double +CylinderBounds::halflengthZ() const { return m_halfZ; } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 3812f09d1..8908a1b20 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -48,8 +48,10 @@ class CylinderSurface : public Surface { /// @note if htrans == nullptr, the cylinder is positioned around (0.,0.,0.) /// @param radius is the radius of the cylinder /// @param hlength is the half length of the cylinder in z - CylinderSurface(std::shared_ptr<const Transform3D> htrans, double radius, - double hlength); + CylinderSurface( + std::shared_ptr<const Transform3D> htrans, + double radius, + double hlength); /// Constructor from Transform3D, radius halfphi, and halflength /// @@ -58,15 +60,19 @@ class CylinderSurface : public Surface { /// @param radius is the radius of the cylinder /// @param hphi is the half length in phi of the cylinder /// @param hlength is the half length of the cylinder in z - CylinderSurface(std::shared_ptr<const Transform3D> htrans, double radius, - double hphi, double hlength); + CylinderSurface( + std::shared_ptr<const Transform3D> htrans, + double radius, + double hphi, + double hlength); /// Constructor from DetectorElementBase: Element proxy /// /// @param cbounds are the provided cylinder bounds (shared) /// @param detelement is the linked detector element to this surface - CylinderSurface(std::shared_ptr<const CylinderBounds> cbounds, - const DetectorElementBase& detelement); + CylinderSurface( + std::shared_ptr<const CylinderBounds> cbounds, + const DetectorElementBase& detelement); /// Constructor from Transform3D and CylinderBounds /// @@ -74,8 +80,9 @@ class CylinderSurface : public Surface { /// @note if htrans == nullptr, the cylinder is positioned around (0.,0.,0.) /// @param cbounds is a shared pointer to a cylindeer bounds object, /// it must exist (assert test) - CylinderSurface(std::shared_ptr<const Transform3D> htrans, - const std::shared_ptr<const CylinderBounds>& cbounds); + CylinderSurface( + std::shared_ptr<const Transform3D> htrans, + const std::shared_ptr<const CylinderBounds>& cbounds); /// Copy constructor /// @@ -87,8 +94,10 @@ class CylinderSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - CylinderSurface(const GeometryContext& gctx, const CylinderSurface& other, - const Transform3D& transf); + CylinderSurface( + const GeometryContext& gctx, + const CylinderSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -103,8 +112,9 @@ class CylinderSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<CylinderSurface> clone(const GeometryContext& gctx, - const Transform3D& shift) const; + std::shared_ptr<CylinderSurface> clone( + const GeometryContext& gctx, + const Transform3D& shift) const; /// The binning position method - is overloaded for r-type binning /// @@ -112,8 +122,9 @@ class CylinderSurface : public Surface { /// @param bValue is the type of global binning to be done /// /// @return is the global position to be used for binning - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const final; /// Return the measurement frame - this is needed for alignment, in particular /// The measurement frame of a cylinder is the tangential plane at a given @@ -123,9 +134,10 @@ class CylinderSurface : public Surface { /// @param gpos is the position where the measurement frame is defined /// @param mom is the momentum vector (ignored) /// @return rotation matrix that defines the measurement frame - const RotationMatrix3D referenceFrame(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + const RotationMatrix3D referenceFrame( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Return the surface type SurfaceType type() const override; @@ -137,8 +149,8 @@ class CylinderSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local postion for which the normal vector is requested /// @return normal vector at the local position - const Vector3D normal(const GeometryContext& gctx, - const Vector2D& lpos) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector2D& lpos) + const final; /// Return method for surface normal information /// @note for a Cylinder a local position is always required for the normal @@ -147,8 +159,8 @@ class CylinderSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global postion for which the normal vector is requested /// @return normal vector at the global position - const Vector3D normal(const GeometryContext& gctx, - const Vector3D& gpos) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector3D& gpos) + const final; /// Normal vector return without argument using Surface::normal; @@ -169,8 +181,11 @@ class CylinderSurface : public Surface { /// @param lpos is the local position to be transformed /// @param mom is the global momentum (ignored in this operation) /// @param gpos is the global position shich is filled - void localToGlobal(const GeometryContext& gctx, const Vector2D& lpos, - const Vector3D& mom, Vector3D& gpos) const final; + void localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Global to local transfomration /// @@ -180,8 +195,11 @@ class CylinderSurface : public Surface { /// @param lpos is hte local position to be filled /// /// @return is a boolean indicating if the transformation succeeded - bool globalToLocal(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom, Vector2D& lpos) const final; + bool globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// Straight line intersection schema - provides closest intersection /// and (signed) path length @@ -226,11 +244,13 @@ class CylinderSurface : public Surface { /// reinsertion into the line equation. /// /// @return is the intersection object - Intersection intersectionEstimate(const GeometryContext& gctx, - const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + Intersection intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// Path correction due to incident of the track /// @@ -239,8 +259,10 @@ class CylinderSurface : public Surface { /// @param mom is the global momentum at the starting point /// /// @return is the correction factor due to incident - double pathCorrection(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom) const final; + double pathCorrection( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Return method for properly formatted output string std::string name() const override; @@ -251,7 +273,9 @@ class CylinderSurface : public Surface { /// @param l0div Number of divisions along l0 (phi) /// @param l1div Number of divisions along l1 (z) virtual PolyhedronRepresentation polyhedronRepresentation( - const GeometryContext& gctx, size_t l0div = 10, size_t l1div = 1) const; + const GeometryContext& gctx, + size_t l0div = 10, + size_t l1div = 1) const; protected: std::shared_ptr<const CylinderBounds> m_bounds; //!< bounds (shared) @@ -261,8 +285,9 @@ class CylinderSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - CylinderSurface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const override; + CylinderSurface* clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const override; }; #include "Acts/Surfaces/detail/CylinderSurface.ipp" diff --git a/Core/include/Acts/Surfaces/DiamondBounds.hpp b/Core/include/Acts/Surfaces/DiamondBounds.hpp index b8d1b7d21..b48076947 100644 --- a/Core/include/Acts/Surfaces/DiamondBounds.hpp +++ b/Core/include/Acts/Surfaces/DiamondBounds.hpp @@ -106,23 +106,28 @@ class DiamondBounds : public PlanarBounds { RectangleBounds m_boundingBox; ///< internal bounding box cache }; -inline double DiamondBounds::x1() const { +inline double +DiamondBounds::x1() const { return m_x1; } -inline double DiamondBounds::x2() const { +inline double +DiamondBounds::x2() const { return m_x2; } -inline double DiamondBounds::x3() const { +inline double +DiamondBounds::x3() const { return m_x3; } -inline double DiamondBounds::y1() const { +inline double +DiamondBounds::y1() const { return m_y1; } -inline double DiamondBounds::y2() const { +inline double +DiamondBounds::y2() const { return m_y2; } diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index 58249bad3..2de4c0a44 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -60,8 +60,11 @@ class DiscSurface : public Surface { /// @param rmax The outer radius of the disc surface /// @param hphisec The opening angle of the disc surface and is optional /// the default is a full disc - DiscSurface(std::shared_ptr<const Transform3D> htrans, double rmin, - double rmax, double hphisec = M_PI); + DiscSurface( + std::shared_ptr<const Transform3D> htrans, + double rmin, + double rmax, + double hphisec = M_PI); /// Constructor for Discs from Transform3D, \f$ r_{min}, r_{max}, hx_{min}, /// hx_{max} \f$ @@ -75,23 +78,30 @@ class DiscSurface : public Surface { /// @param minR The outer radius of the disc surface /// @param avephi The position in phi (default is 0.) /// @param stereo The optional stereo angle - DiscSurface(std::shared_ptr<const Transform3D> htrans, double minhalfx, - double maxhalfx, double maxR, double minR, double avephi = 0., - double stereo = 0.); + DiscSurface( + std::shared_ptr<const Transform3D> htrans, + double minhalfx, + double maxhalfx, + double maxR, + double minR, + double avephi = 0., + double stereo = 0.); /// Constructor for Discs from Transform3D and shared DiscBounds /// /// @param htrans The transform that positions the disc in global 3D /// @param dbounds The disc bounds describing the surface coverage - DiscSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const DiscBounds> dbounds = nullptr); + DiscSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const DiscBounds> dbounds = nullptr); /// Constructor from DetectorElementBase : Element proxy /// /// @param dbounds The disc bounds describing the surface coverage /// @param detelement The detector element represented by this surface - DiscSurface(const std::shared_ptr<const DiscBounds>& dbounds, - const DetectorElementBase& detelement); + DiscSurface( + const std::shared_ptr<const DiscBounds>& dbounds, + const DetectorElementBase& detelement); /// Copy Constructor /// @@ -103,8 +113,10 @@ class DiscSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - DiscSurface(const GeometryContext& gctx, const DiscSurface& other, - const Transform3D& transf); + DiscSurface( + const GeometryContext& gctx, + const DiscSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -119,8 +131,9 @@ class DiscSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<DiscSurface> clone(const GeometryContext& gctx, - const Transform3D& shift) const; + std::shared_ptr<DiscSurface> clone( + const GeometryContext& gctx, + const Transform3D& shift) const; /// Return the surface type SurfaceType type() const override; @@ -131,8 +144,8 @@ class DiscSurface : public Surface { /// @param lpos The local position is ignored /// /// @return a Vector3D by value - const Vector3D normal(const GeometryContext& gctx, - const Vector2D& lpos) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector2D& lpos) + const final; /// Normal vector return without argument using Surface::normal; @@ -144,8 +157,9 @@ class DiscSurface : public Surface { /// @param bValue The binning type to be used /// /// @return position that can beused for this binning - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const final; /// This method returns the bounds by reference const SurfaceBounds& bounds() const final; @@ -161,8 +175,11 @@ class DiscSurface : public Surface { /// symmetry) /// /// @note the momentum is ignored for Disc surfaces in this calculateion - void localToGlobal(const GeometryContext& gctx, const Vector2D& lpos, - const Vector3D& mom, Vector3D& gpos) const final; + void localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Global to local transformation /// @note the momentum is ignored for Disc surfaces in this calculateion @@ -176,8 +193,11 @@ class DiscSurface : public Surface { /// /// @return boolean indication if operation was successful (fail means global /// position was not on surface) - bool globalToLocal(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom, Vector2D& lpos) const final; + bool globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// Special method for DiscSurface : local<->local transformations polar <-> /// cartesian @@ -211,8 +231,9 @@ class DiscSurface : public Surface { /// @param lpos is local 2D position in cartesian coordinates /// /// @return value is a global cartesian 3D position - const Vector3D localCartesianToGlobal(const GeometryContext& gctx, - const Vector2D& lpos) const; + const Vector3D localCartesianToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos) const; /// Special method for DiscSurface : global<->local from cartesian coordinates /// @@ -221,9 +242,10 @@ class DiscSurface : public Surface { /// @param tol The absoltue tolerance parameter /// /// @return value is a local polar - const Vector2D globalToLocalCartesian(const GeometryContext& gctx, - const Vector3D& gpos, - double tol = 0.) const; + const Vector2D globalToLocalCartesian( + const GeometryContext& gctx, + const Vector3D& gpos, + double tol = 0.) const; /// Initialize the jacobian from local to global /// the surface knows best, hence the calculation is done here. @@ -236,10 +258,12 @@ class DiscSurface : public Surface { /// @param dir The direction at of the parameters /// /// @param pars The paranmeters vector - void initJacobianToGlobal(const GeometryContext& gctx, - BoundToFreeMatrix& jacobian, const Vector3D& gpos, - const Vector3D& dir, - const BoundVector& pars) const final; + void initJacobianToGlobal( + const GeometryContext& gctx, + BoundToFreeMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir, + const BoundVector& pars) const final; /// Initialize the jacobian from global to local /// the surface knows best, hence the calculation is done here. @@ -252,10 +276,11 @@ class DiscSurface : public Surface { /// @param dir The direction at of the parameters /// /// @return the transposed reference frame (avoids recalculation) - const RotationMatrix3D initJacobianToLocal(const GeometryContext& gctx, - FreeToBoundMatrix& jacobian, - const Vector3D& gpos, - const Vector3D& dir) const final; + const RotationMatrix3D initJacobianToLocal( + const GeometryContext& gctx, + FreeToBoundMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir) const final; /// Path correction due to incident of the track /// @@ -263,8 +288,10 @@ class DiscSurface : public Surface { /// @param pos The global position as a starting point /// @param mom The global momentum at the starting point /// @return The correction factor due to incident - double pathCorrection(const GeometryContext& gctx, const Vector3D& pos, - const Vector3D& mom) const final; + double pathCorrection( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const final; /// @brief Straight line intersection schema /// @@ -295,11 +322,13 @@ class DiscSurface : public Surface { /// - perpendicular to the normal of the plane /// /// @return is the surface intersection object - Intersection intersectionEstimate(const GeometryContext& gctx, - const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + Intersection intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// Return properly formatted class name for screen output std::string name() const override; @@ -309,7 +338,9 @@ class DiscSurface : public Surface { /// @param l0div Number of divisions along l0 (phi) /// @param l1div Number of divisions along l1 (r) virtual PolyhedronRepresentation polyhedronRepresentation( - const GeometryContext& gctx, size_t l0div = 10, size_t l1div = 1) const; + const GeometryContext& gctx, + size_t l0div = 10, + size_t l1div = 1) const; protected: std::shared_ptr<const DiscBounds> m_bounds; ///< bounds (shared) @@ -319,8 +350,8 @@ class DiscSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - DiscSurface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const override; + DiscSurface* clone_impl(const GeometryContext& gctx, const Transform3D& shift) + const override; }; #include "Acts/Surfaces/detail/DiscSurface.ipp" diff --git a/Core/include/Acts/Surfaces/DiscTrapezoidalBounds.hpp b/Core/include/Acts/Surfaces/DiscTrapezoidalBounds.hpp index 5eba7d3b5..f638c2bc7 100644 --- a/Core/include/Acts/Surfaces/DiscTrapezoidalBounds.hpp +++ b/Core/include/Acts/Surfaces/DiscTrapezoidalBounds.hpp @@ -51,9 +51,13 @@ class DiscTrapezoidalBounds : public DiscBounds { /// @param minR inner radius /// @param avephi average phi value /// @param stereo optional stero angle applied - DiscTrapezoidalBounds(double minhalfx, double maxhalfx, double maxR, - double minR, double avephi = M_PI_2, - double stereo = 0.); + DiscTrapezoidalBounds( + double minhalfx, + double maxhalfx, + double maxR, + double minR, + double avephi = M_PI_2, + double stereo = 0.); ~DiscTrapezoidalBounds() override; @@ -68,8 +72,8 @@ class DiscTrapezoidalBounds : public DiscBounds { /// if only tol0 is given and additional in the phi sector is tol1 is given /// @param lpos is the local position to be checked (in polar coordinates) /// @param bcheck is the boundary check directive - bool inside(const Vector2D& lpos, - const BoundaryCheck& bcheck = true) const final; + bool inside(const Vector2D& lpos, const BoundaryCheck& bcheck = true) + const final; /// Minimal distance to boundary /// @param lpos is the local position to be checked (in polar coordinates) @@ -114,43 +118,52 @@ class DiscTrapezoidalBounds : public DiscBounds { ActsMatrixD<2, 2> jacobianToLocalXY(const Vector2D& lpos) const; }; -inline double DiscTrapezoidalBounds::rMin() const { +inline double +DiscTrapezoidalBounds::rMin() const { return m_rMin; } -inline double DiscTrapezoidalBounds::rMax() const { +inline double +DiscTrapezoidalBounds::rMax() const { return m_rMax; } -inline double DiscTrapezoidalBounds::minHalflengthX() const { +inline double +DiscTrapezoidalBounds::minHalflengthX() const { return m_minHalfX; } -inline double DiscTrapezoidalBounds::maxHalflengthX() const { +inline double +DiscTrapezoidalBounds::maxHalflengthX() const { return m_maxHalfX; } -inline double DiscTrapezoidalBounds::averagePhi() const { +inline double +DiscTrapezoidalBounds::averagePhi() const { return m_avgPhi; } -inline double DiscTrapezoidalBounds::stereo() const { +inline double +DiscTrapezoidalBounds::stereo() const { return m_stereo; } -inline double DiscTrapezoidalBounds::halfPhiSector() const { +inline double +DiscTrapezoidalBounds::halfPhiSector() const { auto minHalfPhi = std::asin(m_minHalfX / m_rMin); auto maxHalfPhi = std::asin(m_maxHalfX / m_rMax); return std::max(minHalfPhi, maxHalfPhi); } -inline double DiscTrapezoidalBounds::rCenter() const { +inline double +DiscTrapezoidalBounds::rCenter() const { auto hmin = std::sqrt(m_rMin * m_rMin - m_minHalfX * m_minHalfX); auto hmax = std::sqrt(m_rMax * m_rMax - m_maxHalfX * m_maxHalfX); return (hmin + hmax) / 2.0; } -inline double DiscTrapezoidalBounds::halflengthY() const { +inline double +DiscTrapezoidalBounds::halflengthY() const { auto hmin = std::sqrt(m_rMin * m_rMin - m_minHalfX * m_minHalfX); auto hmax = std::sqrt(m_rMax * m_rMax - m_maxHalfX * m_maxHalfX); return (hmax - hmin) / 2.0; diff --git a/Core/include/Acts/Surfaces/EllipseBounds.hpp b/Core/include/Acts/Surfaces/EllipseBounds.hpp index a72d7ef46..0de121f99 100644 --- a/Core/include/Acts/Surfaces/EllipseBounds.hpp +++ b/Core/include/Acts/Surfaces/EllipseBounds.hpp @@ -52,9 +52,13 @@ class EllipseBounds : public PlanarBounds { /// @param maxRadius1 is the minimum radius at coorindate 1 /// @param averagePhi average phi (is set to 0. as default) /// @param halfPhi spanning phi sector (is set to pi as default) - EllipseBounds(double minRadius0, double minRadius1, double maxRadius0, - double maxRadius1, double averagePhi = 0., - double halfPhi = M_PI); + EllipseBounds( + double minRadius0, + double minRadius1, + double maxRadius0, + double maxRadius1, + double averagePhi = 0., + double halfPhi = M_PI); ~EllipseBounds() override; @@ -111,27 +115,33 @@ class EllipseBounds : public PlanarBounds { RectangleBounds m_boundingBox; }; -inline double EllipseBounds::rMinX() const { +inline double +EllipseBounds::rMinX() const { return m_rMinX; } -inline double EllipseBounds::rMinY() const { +inline double +EllipseBounds::rMinY() const { return m_rMinY; } -inline double EllipseBounds::rMaxX() const { +inline double +EllipseBounds::rMaxX() const { return m_rMaxX; } -inline double EllipseBounds::rMaxY() const { +inline double +EllipseBounds::rMaxY() const { return m_rMaxY; } -inline double EllipseBounds::averagePhi() const { +inline double +EllipseBounds::averagePhi() const { return m_avgPhi; } -inline double EllipseBounds::halfPhiSector() const { +inline double +EllipseBounds::halfPhiSector() const { return m_halfPhi; } diff --git a/Core/include/Acts/Surfaces/InfiniteBounds.hpp b/Core/include/Acts/Surfaces/InfiniteBounds.hpp index 94003792d..32f44d7aa 100644 --- a/Core/include/Acts/Surfaces/InfiniteBounds.hpp +++ b/Core/include/Acts/Surfaces/InfiniteBounds.hpp @@ -26,31 +26,43 @@ class InfiniteBounds : public SurfaceBounds { InfiniteBounds() = default; ~InfiniteBounds() override = default; - InfiniteBounds* clone() const final { return new InfiniteBounds(); } + InfiniteBounds* + clone() const final { + return new InfiniteBounds(); + } - SurfaceBounds::BoundsType type() const final { + SurfaceBounds::BoundsType + type() const final { return SurfaceBounds::Boundless; } - std::vector<TDD_real_t> valueStore() const final { return {}; } + std::vector<TDD_real_t> + valueStore() const final { + return {}; + } /// Method inside() returns true for any case /// /// ignores input parameters /// /// @return always true - bool inside(const Vector2D& /*lpos*/, - const BoundaryCheck& /*bcheck*/) const final { + bool + inside(const Vector2D& /*lpos*/, const BoundaryCheck& /*bcheck*/) + const final { return true; } /// Minimal distance calculation /// ignores input parameter /// @return always 0. (should be -NaN) - double distanceToBoundary(const Vector2D& /*pos*/) const final { return 0; } + double + distanceToBoundary(const Vector2D& /*pos*/) const final { + return 0; + } /// Output Method for std::ostream - std::ostream& toStream(std::ostream& os) const final { + std::ostream& + toStream(std::ostream& os) const final { os << "Acts::InfiniteBounds ... boundless surface" << std::endl; return os; } diff --git a/Core/include/Acts/Surfaces/LineBounds.hpp b/Core/include/Acts/Surfaces/LineBounds.hpp index 8f18034ee..6ae06b7aa 100644 --- a/Core/include/Acts/Surfaces/LineBounds.hpp +++ b/Core/include/Acts/Surfaces/LineBounds.hpp @@ -73,11 +73,13 @@ class LineBounds : public SurfaceBounds { double m_radius, m_halfZ; }; -inline double LineBounds::r() const { +inline double +LineBounds::r() const { return m_radius; } -inline double LineBounds::halflengthZ() const { +inline double +LineBounds::halflengthZ() const { return m_halfZ; } diff --git a/Core/include/Acts/Surfaces/LineSurface.hpp b/Core/include/Acts/Surfaces/LineSurface.hpp index 188a08ee7..aa754b75b 100644 --- a/Core/include/Acts/Surfaces/LineSurface.hpp +++ b/Core/include/Acts/Surfaces/LineSurface.hpp @@ -42,23 +42,27 @@ class LineSurface : public Surface { /// @param htrans The transform that positions the surface in the global frame /// @param radius The straw radius /// @param halez The half length in z - LineSurface(std::shared_ptr<const Transform3D> htrans, double radius, - double halez); + LineSurface( + std::shared_ptr<const Transform3D> htrans, + double radius, + double halez); /// Constructor from Transform3D and a shared bounds object /// /// @param htrans The transform that positions the surface in the global frame /// @param lbounds The bounds describing the straw dimensions, can be /// optionally nullptr - LineSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const LineBounds> lbounds = nullptr); + LineSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const LineBounds> lbounds = nullptr); /// Constructor from DetectorElementBase : Element proxy /// /// @param lbounds The bounds describing the straw dimensions /// @param detelement for which this surface is (at least) one representation - LineSurface(const std::shared_ptr<const LineBounds>& lbounds, - const DetectorElementBase& detelement); + LineSurface( + const std::shared_ptr<const LineBounds>& lbounds, + const DetectorElementBase& detelement); /// Copy constructor /// @@ -70,8 +74,10 @@ class LineSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - LineSurface(const GeometryContext& gctx, const LineSurface& other, - const Transform3D& transf); + LineSurface( + const GeometryContext& gctx, + const LineSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -88,8 +94,8 @@ class LineSurface : public Surface { /// @param lpos is the local position is ignored /// /// @return a Vector3D by value - const Vector3D normal(const GeometryContext& gctx, - const Vector2D& lpos) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector2D& lpos) + const final; /// Normal vector return without argument using Surface::normal; @@ -101,8 +107,9 @@ class LineSurface : public Surface { /// @param bValue is the binning type to be used /// /// @return position that can beused for this binning - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const final; /// Return the measurement frame - this is needed for alignment, in particular /// @@ -115,9 +122,10 @@ class LineSurface : public Surface { /// @param mom is the momentum used for the measurement frame construction /// /// @return is a rotation matrix that indicates the measurement frame - const RotationMatrix3D referenceFrame(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + const RotationMatrix3D referenceFrame( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Initialize the jacobian from local to global /// the surface knows best, hence the calculation is done here. @@ -130,10 +138,12 @@ class LineSurface : public Surface { /// @param dir is the direction at of the parameters /// /// @param pars is the paranmeters vector - void initJacobianToGlobal(const GeometryContext& gctx, - BoundToFreeMatrix& jacobian, const Vector3D& gpos, - const Vector3D& dir, - const BoundVector& pars) const final; + void initJacobianToGlobal( + const GeometryContext& gctx, + BoundToFreeMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir, + const BoundVector& pars) const final; /// Calculate the form factors for the derivatives /// the calculation is identical for all surfaces where the @@ -147,8 +157,11 @@ class LineSurface : public Surface { /// /// @return a five-dim vector const BoundRowVector derivativeFactors( - const GeometryContext& gctx, const Vector3D& pos, const Vector3D& dir, - const RotationMatrix3D& rft, const BoundToFreeMatrix& jac) const final; + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& dir, + const RotationMatrix3D& rft, + const BoundToFreeMatrix& jac) const final; /// Local to global transformation /// for line surfaces the momentum is used in order to interpret the drift @@ -159,8 +172,11 @@ class LineSurface : public Surface { /// @param mom is the global momentum (used to sign the closest approach) /// /// @param gpos is the global position shich is filled - void localToGlobal(const GeometryContext& gctx, const Vector2D& lpos, - const Vector3D& mom, Vector3D& gpos) const final; + void localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Specified for LineSurface: global to local method without dynamic /// memory allocation @@ -199,8 +215,11 @@ class LineSurface : public Surface { /// /// @return boolean indication if operation was successful (fail means global /// position was not on surface) - bool globalToLocal(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom, Vector2D& lpos) const final; + bool globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// @brief Straight line intersection schema /// @@ -240,19 +259,23 @@ class LineSurface : public Surface { /// e_a)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br> /// /// @return is the intersection object - Intersection intersectionEstimate(const GeometryContext& gctx, - const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + Intersection intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// the pathCorrection for derived classes with thickness /// is by definition 1 for LineSurfaces /// /// @note input parameters are ignored /// @note there's no material associated to the line surface - double pathCorrection(const GeometryContext& gctx, const Vector3D& pos, - const Vector3D& mom) const override; + double pathCorrection( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const override; /// This method returns the bounds of the Surface by reference */ const SurfaceBounds& bounds() const final; @@ -270,8 +293,11 @@ class LineSurface : public Surface { /// @param pos is the global position /// @param mom is the momentum /// @param lpos is the local position to be filled - bool globalToLocalPlain(const GeometryContext& gctx, const Vector3D& pos, - const Vector3D& mom, Vector2D& lpos) const; + bool globalToLocalPlain( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom, + Vector2D& lpos) const; }; #include "Acts/Surfaces/detail/LineSurface.ipp" diff --git a/Core/include/Acts/Surfaces/PerigeeSurface.hpp b/Core/include/Acts/Surfaces/PerigeeSurface.hpp index 7e6688b06..6066b2d9b 100644 --- a/Core/include/Acts/Surfaces/PerigeeSurface.hpp +++ b/Core/include/Acts/Surfaces/PerigeeSurface.hpp @@ -51,8 +51,10 @@ class PerigeeSurface : public LineSurface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - PerigeeSurface(const GeometryContext& gctx, const PerigeeSurface& other, - const Transform3D& transf); + PerigeeSurface( + const GeometryContext& gctx, + const PerigeeSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -62,8 +64,9 @@ class PerigeeSurface : public LineSurface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<PerigeeSurface> clone(const GeometryContext& gctx, - const Transform3D& shift) const; + std::shared_ptr<PerigeeSurface> clone( + const GeometryContext& gctx, + const Transform3D& shift) const; /// Assignment operator /// @@ -82,16 +85,17 @@ class PerigeeSurface : public LineSurface { /// @param sl is the ostream to be dumped into /// /// @return ostreamn obect which was streamed into - std::ostream& toStream(const GeometryContext& gctx, - std::ostream& sl) const final; + std::ostream& toStream(const GeometryContext& gctx, std::ostream& sl) + const final; private: /// Clone method implementation /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - PerigeeSurface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const override; + PerigeeSurface* clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const override; }; } // namespace Acts diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index 22b9a8f15..5d2ed54b4 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -50,8 +50,10 @@ class PlaneSurface : public Surface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - PlaneSurface(const GeometryContext& gctx, const PlaneSurface& other, - const Transform3D& transf); + PlaneSurface( + const GeometryContext& gctx, + const PlaneSurface& other, + const Transform3D& transf); /// Dedicated Constructor with normal vector /// This is for curvilinear surfaces which are by definition boundless @@ -64,15 +66,17 @@ class PlaneSurface : public Surface { /// /// @param pbounds are the provided planar bounds (shared) /// @param detelement is the linked detector element to this surface - PlaneSurface(const std::shared_ptr<const PlanarBounds>& pbounds, - const DetectorElementBase& detelement); + PlaneSurface( + const std::shared_ptr<const PlanarBounds>& pbounds, + const DetectorElementBase& detelement); /// Constructor for Planes with (optional) shared bounds object /// /// @param htrans transform in 3D that positions this surface /// @param pbounds bounds object to describe the actual surface area - PlaneSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const PlanarBounds> pbounds = nullptr); + PlaneSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const PlanarBounds> pbounds = nullptr); public: /// Destructor - defaulted @@ -87,8 +91,9 @@ class PlaneSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<PlaneSurface> clone(const GeometryContext& gctx, - const Transform3D& shift) const; + std::shared_ptr<PlaneSurface> clone( + const GeometryContext& gctx, + const Transform3D& shift) const; /// Normal vector return /// @@ -96,8 +101,8 @@ class PlaneSurface : public Surface { /// @param lpos is the local position is ignored /// /// return a Vector3D by value - const Vector3D normal(const GeometryContext& gctx, - const Vector2D& lpos) const final; + const Vector3D normal(const GeometryContext& gctx, const Vector2D& lpos) + const final; /// Normal vector return without argument using Surface::normal; @@ -109,8 +114,9 @@ class PlaneSurface : public Surface { /// @param bValue is the binning type to be used /// /// @return position that can beused for this binning - const Vector3D binningPosition(const GeometryContext& gctx, - BinningValue bValue) const final; + const Vector3D binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const final; /// Return the surface type SurfaceType type() const override; @@ -127,8 +133,11 @@ class PlaneSurface : public Surface { /// @param mom global 3D momentum representation (optionally ignored) /// @param gpos global 3D position to be filled (given by reference for method /// symmetry) - void localToGlobal(const GeometryContext& gctx, const Vector2D& lpos, - const Vector3D& mom, Vector3D& gpos) const override; + void localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const override; /// Global to local transformation /// For planar surfaces the momentum is ignroed in the global to local @@ -143,8 +152,11 @@ class PlaneSurface : public Surface { /// /// @return boolean indication if operation was successful (fail means global /// position was not on surface) - bool globalToLocal(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& mom, Vector2D& lpos) const override; + bool globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const override; /// Method that calculates the correction due to incident angle /// @@ -155,8 +167,10 @@ class PlaneSurface : public Surface { /// @note this is the final implementation of the pathCorrection function /// /// @return a double representing the scaling factor - double pathCorrection(const GeometryContext& gctx, const Vector3D& pos, - const Vector3D& mom) const final; + double pathCorrection( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const final; /// @brief Straight line intersection schema /// @@ -186,11 +200,13 @@ class PlaneSurface : public Surface { /// - perpendicular to the normal of the plane /// /// @return the Intersection object - Intersection intersectionEstimate(const GeometryContext& gctx, - const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + Intersection intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// Return properly formatted class name for screen output std::string name() const override; @@ -204,8 +220,9 @@ class PlaneSurface : public Surface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - PlaneSurface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const override; + PlaneSurface* clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const override; }; #include "Acts/Surfaces/detail/PlaneSurface.ipp" diff --git a/Core/include/Acts/Surfaces/PolyhedronRepresentation.hpp b/Core/include/Acts/Surfaces/PolyhedronRepresentation.hpp index 607ad7f57..725dae606 100644 --- a/Core/include/Acts/Surfaces/PolyhedronRepresentation.hpp +++ b/Core/include/Acts/Surfaces/PolyhedronRepresentation.hpp @@ -28,8 +28,9 @@ struct PolyhedronRepresentation { /// @param verticesIn The 3D global vertices that make up the object /// @param facesIn List of lists of indices for faces. /// @note This creates copies of the input vectors - PolyhedronRepresentation(const std::vector<Vector3D>& verticesIn, - const std::vector<std::vector<size_t>>& facesIn) + PolyhedronRepresentation( + const std::vector<Vector3D>& verticesIn, + const std::vector<std::vector<size_t>>& facesIn) : vertices(verticesIn), faces(facesIn) {} /// list of 3D vertices as vectors @@ -47,7 +48,8 @@ struct PolyhedronRepresentation { std::string objString(size_t vtxOffset = 0) const; template <typename helper_t> - void draw(helper_t& helper) const { + void + draw(helper_t& helper) const { for (const auto& face : faces) { std::vector<Vector3D> face_vtx; for (size_t i : face) { diff --git a/Core/include/Acts/Surfaces/RadialBounds.hpp b/Core/include/Acts/Surfaces/RadialBounds.hpp index 83e2c7a95..5c7830599 100644 --- a/Core/include/Acts/Surfaces/RadialBounds.hpp +++ b/Core/include/Acts/Surfaces/RadialBounds.hpp @@ -105,19 +105,23 @@ class RadialBounds : public DiscBounds { Vector2D shifted(const Vector2D& lpos) const; }; -inline double RadialBounds::rMin() const { +inline double +RadialBounds::rMin() const { return m_rMin; } -inline double RadialBounds::rMax() const { +inline double +RadialBounds::rMax() const { return m_rMax; } -inline double RadialBounds::averagePhi() const { +inline double +RadialBounds::averagePhi() const { return m_avgPhi; } -inline double RadialBounds::halfPhiSector() const { +inline double +RadialBounds::halfPhiSector() const { return m_halfPhi; } diff --git a/Core/include/Acts/Surfaces/RectangleBounds.hpp b/Core/include/Acts/Surfaces/RectangleBounds.hpp index 4b4fdf31f..fa05d8390 100644 --- a/Core/include/Acts/Surfaces/RectangleBounds.hpp +++ b/Core/include/Acts/Surfaces/RectangleBounds.hpp @@ -98,23 +98,28 @@ class RectangleBounds : public PlanarBounds { Vector2D m_max; }; -inline double RectangleBounds::halflengthX() const { +inline double +RectangleBounds::halflengthX() const { return std::abs(m_max.x() - m_min.x()) * 0.5; } -inline double RectangleBounds::halflengthY() const { +inline double +RectangleBounds::halflengthY() const { return std::abs(m_max.y() - m_min.y()) * 0.5; } -inline SurfaceBounds::BoundsType RectangleBounds::type() const { +inline SurfaceBounds::BoundsType +RectangleBounds::type() const { return SurfaceBounds::Rectangle; } -inline const Vector2D& RectangleBounds::min() const { +inline const Vector2D& +RectangleBounds::min() const { return m_min; } -inline const Vector2D& RectangleBounds::max() const { +inline const Vector2D& +RectangleBounds::max() const { return m_max; } diff --git a/Core/include/Acts/Surfaces/StrawSurface.hpp b/Core/include/Acts/Surfaces/StrawSurface.hpp index 8c9272d56..8ba5d37c3 100644 --- a/Core/include/Acts/Surfaces/StrawSurface.hpp +++ b/Core/include/Acts/Surfaces/StrawSurface.hpp @@ -42,8 +42,10 @@ class StrawSurface : public LineSurface { /// frame /// @param radius is the straw radius /// @param halez is the half length in z - StrawSurface(std::shared_ptr<const Transform3D> htrans, double radius, - double halez); + StrawSurface( + std::shared_ptr<const Transform3D> htrans, + double radius, + double halez); /// Constructor from Transform3D and a shared bounds object /// @@ -51,16 +53,18 @@ class StrawSurface : public LineSurface { /// frame /// @param lbounds are the bounds describing the straw dimensions, can be /// optionally nullptr - StrawSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const LineBounds> lbounds = nullptr); + StrawSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const LineBounds> lbounds = nullptr); /// Constructor from DetectorElementBase : Element proxy /// /// @param lbounds are the bounds describing the straw dimensions, they must /// not be nullptr /// @param detelement for which this surface is (at least) one representation - StrawSurface(const std::shared_ptr<const LineBounds>& lbounds, - const DetectorElementBase& detelement); + StrawSurface( + const std::shared_ptr<const LineBounds>& lbounds, + const DetectorElementBase& detelement); /// Copy constructor /// @@ -72,8 +76,10 @@ class StrawSurface : public LineSurface { /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - StrawSurface(const GeometryContext& gctx, const StrawSurface& other, - const Transform3D& transf); + StrawSurface( + const GeometryContext& gctx, + const StrawSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -88,8 +94,9 @@ class StrawSurface : public LineSurface { /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<StrawSurface> clone(const GeometryContext& gctx, - const Transform3D& shift) const; + std::shared_ptr<StrawSurface> clone( + const GeometryContext& gctx, + const Transform3D& shift) const; /// Return the surface type SurfaceType type() const final; @@ -102,22 +109,27 @@ class StrawSurface : public LineSurface { /// @param l0div Number of divisions along l0 (phi) /// @param l1div Number of divisions along l1 (z) virtual PolyhedronRepresentation polyhedronRepresentation( - const GeometryContext& gctx, size_t l0div = 10, size_t l1div = 1) const; + const GeometryContext& gctx, + size_t l0div = 10, + size_t l1div = 1) const; private: /// Clone method implementation /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - StrawSurface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const override; + StrawSurface* clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const override; }; -inline Surface::SurfaceType StrawSurface::type() const { +inline Surface::SurfaceType +StrawSurface::type() const { return Surface::Straw; } -inline std::string Acts::StrawSurface::name() const { +inline std::string +Acts::StrawSurface::name() const { return "Acts::StrawSurface"; } diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index 1a31e671e..f2dbc60f1 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -93,8 +93,10 @@ class Surface : public virtual GeometryObject, /// @param gctx The current geometry context object, e.g. alignment /// @param other Source surface for copy /// @param shift Additional transform applied after copying from the source - Surface(const GeometryContext& gctx, const Surface& other, - const Transform3D& shift); + Surface( + const GeometryContext& gctx, + const Surface& other, + const Transform3D& shift); public: /// Destructor @@ -104,7 +106,8 @@ class Surface : public virtual GeometryObject, /// Will forward all parameters and will attempt to find a suitable /// constructor. template <class T, typename... Args> - static std::shared_ptr<T> makeShared(Args&&... args) { + static std::shared_ptr<T> + makeShared(Args&&... args) { return std::shared_ptr<T>(new T(std::forward<Args>(args)...)); } @@ -156,8 +159,8 @@ class Surface : public virtual GeometryObject, /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - std::shared_ptr<Surface> clone(const GeometryContext& gctx, - const Transform3D& shift) const { + std::shared_ptr<Surface> + clone(const GeometryContext& gctx, const Transform3D& shift) const { return std::shared_ptr<Surface>(this->clone_impl(gctx, shift)); } @@ -168,8 +171,9 @@ class Surface : public virtual GeometryObject, /// /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface - virtual Surface* clone_impl(const GeometryContext& gctx, - const Transform3D& shift) const = 0; + virtual Surface* clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const = 0; public: /// Return method for the Surface type to avoid dynamic casts @@ -201,8 +205,9 @@ class Surface : public virtual GeometryObject, /// @param lpos is the local position where the normal verctor is constructed /// /// @return normal vector by value - virtual const Vector3D normal(const GeometryContext& gctx, - const Vector2D& lpos) const = 0; + virtual const Vector3D normal( + const GeometryContext& gctx, + const Vector2D& lpos) const = 0; /// Return method for the normal vector of the surface /// The normal vector can only be generally defined at a given local position @@ -213,8 +218,9 @@ class Surface : public virtual GeometryObject, /// /// @return normal vector by value - virtual const Vector3D normal(const GeometryContext& gctx, - const Vector3D& pos) const; + virtual const Vector3D normal( + const GeometryContext& gctx, + const Vector3D& pos) const; /// Return method for the normal vector of the surface /// @@ -223,7 +229,8 @@ class Surface : public virtual GeometryObject, /// @param gctx The current geometry context object, e.g. alignment // /// @return normal vector by value - virtual const Vector3D normal(const GeometryContext& gctx) const { + virtual const Vector3D + normal(const GeometryContext& gctx) const { return normal(gctx, center(gctx)); } @@ -272,8 +279,10 @@ class Surface : public virtual GeometryObject, /// /// @return boolean indication if operation was successful template <typename parameters_t> - bool isOnSurface(const GeometryContext& gctx, const parameters_t& pars, - const BoundaryCheck& bcheck = true) const; + bool isOnSurface( + const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck = true) const; /// The geometric onSurface method /// @@ -285,17 +294,20 @@ class Surface : public virtual GeometryObject, /// @param bcheck BoundaryCheck directive for this onSurface check /// /// @return boolean indication if operation was successful - bool isOnSurface(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& gmom, - const BoundaryCheck& bcheck = true) const; + bool isOnSurface( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + const BoundaryCheck& bcheck = true) const; /// The insideBounds method for local positions /// /// @param locpos local position to check /// @param bcheck BoundaryCheck directive for this onSurface check /// @return boolean indication if operation was successful - virtual bool insideBounds(const Vector2D& locpos, - const BoundaryCheck& bcheck = true) const; + virtual bool insideBounds( + const Vector2D& locpos, + const BoundaryCheck& bcheck = true) const; /// Local to global transformation /// Generalized local to global transformation for the surface types. Since @@ -307,8 +319,11 @@ class Surface : public virtual GeometryObject, /// @param gmom global 3D momentum representation (optionally ignored) /// @param gpos global 3D position to be filled (given by reference for method /// symmetry) - virtual void localToGlobal(const GeometryContext& gctx, const Vector2D& lpos, - const Vector3D& gmom, Vector3D& gpos) const = 0; + virtual void localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& gmom, + Vector3D& gpos) const = 0; /// Global to local transformation /// Generalized global to local transformation for the surface types. Since @@ -324,8 +339,11 @@ class Surface : public virtual GeometryObject, /// /// @return boolean indication if operation was successful (fail means global /// position was not on surface) - virtual bool globalToLocal(const GeometryContext& gctx, const Vector3D& gpos, - const Vector3D& gmom, Vector2D& lpos) const = 0; + virtual bool globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + Vector2D& lpos) const = 0; /// Return mehtod for the reference frame /// This is the frame in which the covariance matrix is defined (specialized @@ -339,7 +357,8 @@ class Surface : public virtual GeometryObject, /// @return RotationMatrix3D which defines the three axes of the measurement /// frame virtual const Acts::RotationMatrix3D referenceFrame( - const GeometryContext& gctx, const Vector3D& gpos, + const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& gmom) const; /// Initialize the jacobian from local to global @@ -356,10 +375,12 @@ class Surface : public virtual GeometryObject, /// @param gpos is the global position of the parameters /// @param dir is the direction at of the parameters /// @param pars is the parameter vector - virtual void initJacobianToGlobal(const GeometryContext& gctx, - BoundToFreeMatrix& jacobian, - const Vector3D& gpos, const Vector3D& dir, - const BoundVector& pars) const; + virtual void initJacobianToGlobal( + const GeometryContext& gctx, + BoundToFreeMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir, + const BoundVector& pars) const; /// Initialize the jacobian from global to local /// the surface knows best, hence the calculation is done here. @@ -377,8 +398,10 @@ class Surface : public virtual GeometryObject, /// /// @return the transposed reference frame (avoids recalculation) virtual const RotationMatrix3D initJacobianToLocal( - const GeometryContext& gctx, FreeToBoundMatrix& jacobian, - const Vector3D& gpos, const Vector3D& dir) const; + const GeometryContext& gctx, + FreeToBoundMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir) const; /// Calculate the form factors for the derivatives /// the calculation is identical for all surfaces where the @@ -397,8 +420,11 @@ class Surface : public virtual GeometryObject, /// /// @return a five-dim vector virtual const BoundRowVector derivativeFactors( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& dir, - const RotationMatrix3D& rft, const BoundToFreeMatrix& jac) const; + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& dir, + const RotationMatrix3D& rft, + const BoundToFreeMatrix& jac) const; /// Calucation of the path correction for incident /// @@ -408,9 +434,10 @@ class Surface : public virtual GeometryObject, /// @param gmom global 3D momentum representation /// /// @return Path correction with respect to the nominal incident. - virtual double pathCorrection(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& gmom) const = 0; + virtual double pathCorrection( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom) const = 0; /// Straight line intersection schema from position/direction /// @@ -425,18 +452,26 @@ class Surface : public virtual GeometryObject, /// @param correct Corrector struct that can be used to refine the solution /// /// @return SurfaceIntersection object (contains intersection & surface) - template <typename options_t, - typename corrector_t = VoidIntersectionCorrector> - SurfaceIntersection surfaceIntersectionEstimate( - const GeometryContext& gctx, const Vector3D& position, - const Vector3D& direction, const options_t& options, + template < + typename options_t, + typename corrector_t = VoidIntersectionCorrector> + SurfaceIntersection + surfaceIntersectionEstimate( + const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& correct = corrector_t()) const { // get the intersection with the surface - auto sIntersection = - intersectionEstimate(gctx, position, direction, options.navDir, - options.boundaryCheck, correct); + auto sIntersection = intersectionEstimate( + gctx, + position, + direction, + options.navDir, + options.boundaryCheck, + correct); // return a surface intersection with result direction return SurfaceIntersection(sIntersection, this); } @@ -454,10 +489,14 @@ class Surface : public virtual GeometryObject, /// @param correct Corrector struct that can be used to refine the solution /// /// @return SurfaceIntersection object (contains intersection & surface) - template <typename parameters_t, typename options_t, - typename corrector_t = VoidIntersectionCorrector> - SurfaceIntersection surfaceIntersectionEstimate( - const GeometryContext& gctx, const parameters_t& parameters, + template < + typename parameters_t, + typename options_t, + typename corrector_t = VoidIntersectionCorrector> + SurfaceIntersection + surfaceIntersectionEstimate( + const GeometryContext& gctx, + const parameters_t& parameters, const options_t& options, const corrector_t& correct = corrector_t()) const { return surfaceIntersectionEstimate( @@ -479,8 +518,11 @@ class Surface : public virtual GeometryObject, /// /// @return Intersection object virtual Intersection intersectionEstimate( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gidr, - NavigationDirection navDir = forward, const BoundaryCheck& bcheck = false, + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gidr, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, CorrFnc corr = nullptr) const = 0; /// clang-format on @@ -488,8 +530,8 @@ class Surface : public virtual GeometryObject, /// /// @param gctx The current geometry context object, e.g. alignment /// @param sl is the ostream to be dumped into - virtual std::ostream& toStream(const GeometryContext& gctx, - std::ostream& sl) const; + virtual std::ostream& toStream(const GeometryContext& gctx, std::ostream& sl) + const; /// Return properly formatted class name virtual std::string name() const = 0; diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index 39b28242f..8176ff596 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -36,8 +36,9 @@ class SurfaceArray { /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces Input surface pointers - virtual void fill(const GeometryContext& gctx, - const SurfaceVector& surfaces) = 0; + virtual void fill( + const GeometryContext& gctx, + const SurfaceVector& surfaces) = 0; /// @brief Attempts to fix sub-optimal binning by filling closest /// Surfaces into empty bin @@ -46,8 +47,9 @@ class SurfaceArray { /// @param surfaces The surface pointers to fill /// @return number of bins that were filled - virtual size_t completeBinning(const GeometryContext& gctx, - const SurfaceVector& surfaces) = 0; + virtual size_t completeBinning( + const GeometryContext& gctx, + const SurfaceVector& surfaces) = 0; /// @brief Performs lookup at @c pos and returns bin content as reference /// @param pos Lookup position @@ -130,9 +132,10 @@ class SurfaceArray { /// @note Signature of localToGlobal and globalToLocal depends on @c DIM. /// If DIM > 1, local coords are @c ActsVectorD<DIM> else /// @c std::array<double, 1>. - SurfaceGridLookup(std::function<point_t(const Vector3D&)> globalToLocal, - std::function<Vector3D(const point_t&)> localToGlobal, - std::tuple<Axes...> axes) + SurfaceGridLookup( + std::function<point_t(const Vector3D&)> globalToLocal, + std::function<Vector3D(const point_t&)> localToGlobal, + std::tuple<Axes...> axes) : m_globalToLocal(std::move(globalToLocal)), m_localToGlobal(std::move(localToGlobal)), m_grid(std::move(axes)) { @@ -149,8 +152,8 @@ class SurfaceArray { /// /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces Input surface pointers - void fill(const GeometryContext& gctx, - const SurfaceVector& surfaces) override { + void + fill(const GeometryContext& gctx, const SurfaceVector& surfaces) override { for (const auto& srf : surfaces) { Vector3D pos = srf->binningPosition(gctx, binR); lookup(pos).push_back(srf); @@ -166,8 +169,9 @@ class SurfaceArray { /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The surface pointers to fill /// @return number of bins that were filled - size_t completeBinning(const GeometryContext& gctx, - const SurfaceVector& surfaces) override { + size_t + completeBinning(const GeometryContext& gctx, const SurfaceVector& surfaces) + override { size_t binCompleted = 0; size_t nBins = size(); double minPath, curPath; @@ -206,7 +210,8 @@ class SurfaceArray { /// @brief Performs lookup at @c pos and returns bin content as reference /// @param pos Lookup position /// @return @c SurfaceVector at given bin - SurfaceVector& lookup(const Vector3D& pos) override { + SurfaceVector& + lookup(const Vector3D& pos) override { return m_grid.atPosition(m_globalToLocal(pos)); } @@ -214,7 +219,8 @@ class SurfaceArray { /// reference /// @param pos Lookup position /// @return @c SurfaceVector at given bin - const SurfaceVector& lookup(const Vector3D& pos) const override { + const SurfaceVector& + lookup(const Vector3D& pos) const override { return m_grid.atPosition(m_globalToLocal(pos)); } @@ -222,13 +228,17 @@ class SurfaceArray { /// reference /// @param bin Global lookup bin /// @return @c SurfaceVector at given bin - SurfaceVector& lookup(size_t bin) override { return m_grid.at(bin); } + SurfaceVector& + lookup(size_t bin) override { + return m_grid.at(bin); + } /// @brief Performs lookup at global bin and returns bin content as const /// reference /// @param bin Global lookup bin /// @return @c SurfaceVector at given bin - const SurfaceVector& lookup(size_t bin) const override { + const SurfaceVector& + lookup(size_t bin) const override { return m_grid.at(bin); } @@ -236,7 +246,8 @@ class SurfaceArray { /// /// @param pos Lookup position /// @return @c SurfaceVector at given bin. Copy of all bins selected - const SurfaceVector& neighbors(const Vector3D& pos) const override { + const SurfaceVector& + neighbors(const Vector3D& pos) const override { auto loc = m_globalToLocal(pos); return m_neighborMap.at(m_grid.globalBinFromPosition(loc)); } @@ -244,33 +255,42 @@ class SurfaceArray { /// @brief Returns the total size of the grid (including under/overflow /// bins) /// @return Size of the grid data structure - size_t size() const override { return m_grid.size(); } + size_t + size() const override { + return m_grid.size(); + } /// @brief Gets the center position of bin @c bin in global coordinates /// @param bin the global bin index /// @return The bin center - Vector3D getBinCenter(size_t bin) const override { + Vector3D + getBinCenter(size_t bin) const override { return getBinCenterImpl(bin); } /// @brief Returns copies of the axes used in the grid as @c AnyAxis /// @return The axes /// @note This returns copies. Use for introspection and querying. - std::vector<const IAxis*> getAxes() const override { + std::vector<const IAxis*> + getAxes() const override { auto arr = m_grid.axes(); return std::vector<const IAxis*>(arr.begin(), arr.end()); } /// @brief Get the number of dimensions of the grid. /// @return number of dimensions - size_t dimensions() const override { return DIM; } + size_t + dimensions() const override { + return DIM; + } /// @brief Checks if global bin is valid /// @param bin the global bin index /// @return bool if the bin is valid /// @note Valid means that the index points to a bin which is not a under /// or overflow bin or out of range in any axis. - bool isValidBin(size_t bin) const override { + bool + isValidBin(size_t bin) const override { std::array<size_t, DIM> indices = m_grid.localBinsFromGlobalBin(bin); std::array<size_t, DIM> nBins = m_grid.numLocalBins(); for (size_t i = 0; i < indices.size(); ++i) { @@ -284,7 +304,8 @@ class SurfaceArray { } private: - void populateNeighborCache() { + void + populateNeighborCache() { // calculate neighbors for every bin and store in map for (size_t i = 0; i < m_grid.size(); i++) { if (!isValidBin(i)) { @@ -297,8 +318,10 @@ class SurfaceArray { for (const auto& idx : neighborIdxs) { const std::vector<const Surface*>& binContent = m_grid.at(idx); - std::copy(binContent.begin(), binContent.end(), - std::back_inserter(neighbors)); + std::copy( + binContent.begin(), + binContent.end(), + std::back_inserter(neighbors)); } } } @@ -314,7 +337,8 @@ class SurfaceArray { /// here on the callers end /// This is the version for DIM>1 template <size_t D = DIM, std::enable_if_t<D != 1, int> = 0> - Vector3D getBinCenterImpl(size_t bin) const { + Vector3D + getBinCenterImpl(size_t bin) const { return m_localToGlobal(ActsVectorD<DIM>( m_grid.binCenter(m_grid.localBinsFromGlobalBin(bin)).data())); } @@ -322,7 +346,8 @@ class SurfaceArray { /// Internal method, see above. /// This is the version for DIM==1 template <size_t D = DIM, std::enable_if_t<D == 1, int> = 0> - Vector3D getBinCenterImpl(size_t bin) const { + Vector3D + getBinCenterImpl(size_t bin) const { point_t pos = m_grid.binCenter(m_grid.localBinsFromGlobalBin(bin)); return m_localToGlobal(pos); } @@ -344,71 +369,94 @@ class SurfaceArray { /// @brief Lookup, always returns @c element /// @param pos is ignored /// @return reference to vector containing only @c element - SurfaceVector& lookup(const Vector3D& /*pos*/) override { + SurfaceVector& + lookup(const Vector3D& /*pos*/) override { return m_element; } /// @brief Lookup, always returns @c element /// @param pos is ignored /// @return reference to vector containing only @c element - const SurfaceVector& lookup(const Vector3D& /*pos*/) const override { + const SurfaceVector& + lookup(const Vector3D& /*pos*/) const override { return m_element; } /// @brief Lookup, always returns @c element /// @param bin is ignored /// @return reference to vector containing only @c element - SurfaceVector& lookup(size_t /*bin*/) override { return m_element; } + SurfaceVector& + lookup(size_t /*bin*/) override { + return m_element; + } /// @brief Lookup, always returns @c element /// @param bin is ignored /// @return reference to vector containing only @c element - const SurfaceVector& lookup(size_t /*bin*/) const override { + const SurfaceVector& + lookup(size_t /*bin*/) const override { return m_element; } /// @brief Lookup, always returns @c element /// @param pos is ignored /// @return reference to vector containing only @c element - const SurfaceVector& neighbors(const Vector3D& /*pos*/) const override { + const SurfaceVector& + neighbors(const Vector3D& /*pos*/) const override { return m_element; } /// @brief returns 1 /// @return 1 - size_t size() const override { return 1; } + size_t + size() const override { + return 1; + } /// @brief Gets the bin center, but always returns (0, 0, 0) /// @param bin is ignored /// @return (0, 0, 0) - Vector3D getBinCenter(size_t /*bin*/) const override { + Vector3D + getBinCenter(size_t /*bin*/) const override { return Vector3D(0, 0, 0); } /// @brief Returns an empty vector of @c AnyAxis /// @return empty vector - std::vector<const IAxis*> getAxes() const override { return {}; } + std::vector<const IAxis*> + getAxes() const override { + return {}; + } /// @brief Get the number of dimensions /// @return always 0 - size_t dimensions() const override { return 0; } + size_t + dimensions() const override { + return 0; + } /// @brief Comply with concept and provide fill method /// @note Does nothing - void fill(const GeometryContext& /*gctx*/, - const SurfaceVector& /*surfaces*/) override {} + void + fill(const GeometryContext& /*gctx*/, const SurfaceVector& /*surfaces*/) + override {} /// @brief Comply with concept and provide completeBinning method /// @note Does nothing - size_t completeBinning(const GeometryContext& /*gctx*/, - const SurfaceVector& /*surfaces*/) override { + size_t + completeBinning( + const GeometryContext& /*gctx*/, + const SurfaceVector& /*surfaces*/) override { return 0; } /// @brief Returns if the bin is valid (it is) /// @param bin is ignored /// @return always true - bool isValidBin(size_t /*bin*/) const override { return true; } + bool + isValidBin(size_t /*bin*/) const override { + return true; + } private: SurfaceVector m_element; @@ -421,9 +469,10 @@ class SurfaceArray { /// @param surfaces The input vector of surfaces. This is only for /// bookkeeping, so we can ask /// @param transform Optional additional transform for this SurfaceArray - SurfaceArray(std::unique_ptr<ISurfaceGridLookup> gridLookup, - std::vector<std::shared_ptr<const Surface>> surfaces, - std::shared_ptr<const Transform3D> transform = nullptr); + SurfaceArray( + std::unique_ptr<ISurfaceGridLookup> gridLookup, + std::vector<std::shared_ptr<const Surface>> surfaces, + std::shared_ptr<const Transform3D> transform = nullptr); /// @brief Constructor which takes concrete type SurfaceGridLookup /// @param gridLookup The grid storage. Is static casted to ISurfaceGridLookup @@ -440,25 +489,33 @@ class SurfaceArray { /// @brief Get all surfaces in bin given by position. /// @param pos the lookup position /// @return reference to @c SurfaceVector contained in bin at that position - SurfaceVector& at(const Vector3D& pos) { return p_gridLookup->lookup(pos); } + SurfaceVector& + at(const Vector3D& pos) { + return p_gridLookup->lookup(pos); + } /// @brief Get all surfaces in bin given by position @p pos. /// @param pos the lookup position /// @return const reference to @c SurfaceVector contained in bin at that /// position - const SurfaceVector& at(const Vector3D& pos) const { + const SurfaceVector& + at(const Vector3D& pos) const { return p_gridLookup->lookup(pos); } /// @brief Get all surfaces in bin given by global bin index @p bin. /// @param bin the global bin index /// @return reference to @c SurfaceVector contained in bin - SurfaceVector& at(size_t bin) { return p_gridLookup->lookup(bin); } + SurfaceVector& + at(size_t bin) { + return p_gridLookup->lookup(bin); + } /// @brief Get all surfaces in bin given by global bin index. /// @param bin the global bin index /// @return const reference to @c SurfaceVector contained in bin - const SurfaceVector& at(size_t bin) const { + const SurfaceVector& + at(size_t bin) const { return p_gridLookup->lookup(bin); } @@ -469,41 +526,60 @@ class SurfaceArray { /// @note The @c SurfaceVector will be combined. For technical reasons, the /// different bin content vectors have to be copied, so the resulting /// vector contains copies. - SurfaceVector neighbors(const Vector3D& pos) const { + SurfaceVector + neighbors(const Vector3D& pos) const { return p_gridLookup->neighbors(pos); } /// @brief Get the size of the underlying grid structure including /// under/overflow bins /// @return the size - size_t size() const { return p_gridLookup->size(); } + size_t + size() const { + return p_gridLookup->size(); + } /// @brief Get the center of the bin identified by global bin index @p bin /// @param bin the global bin index /// @return Center position of the bin in global coordinates - Vector3D getBinCenter(size_t bin) { return p_gridLookup->getBinCenter(bin); } + Vector3D + getBinCenter(size_t bin) { + return p_gridLookup->getBinCenter(bin); + } /// @brief Get all surfaces attached to this @c SurfaceArray /// @return Reference to @c SurfaceVector containing all surfaces /// @note This does not reflect the actual state of the grid. It only /// returns what was given in the constructor, without any checks /// if that is actually whats in the grid. - const SurfaceVector& surfaces() const { return m_surfacesRawPointers; } + const SurfaceVector& + surfaces() const { + return m_surfacesRawPointers; + } /// @brief Get vector of axes spanning the grid as @c AnyAxis /// @return vector of @c AnyAxis /// @note The axes in the vector are copies. Only use for introspection and /// querying. - std::vector<const IAxis*> getAxes() const { return p_gridLookup->getAxes(); } + std::vector<const IAxis*> + getAxes() const { + return p_gridLookup->getAxes(); + } /// @brief Checks if global bin is valid /// @param bin the global bin index /// @return bool if the bin is valid /// @note Valid means that the index points to a bin which is not a under /// or overflow bin or out of range in any axis. - bool isValidBin(size_t bin) const { return p_gridLookup->isValidBin(bin); } + bool + isValidBin(size_t bin) const { + return p_gridLookup->isValidBin(bin); + } - const Transform3D& transform() const { return *m_transform; } + const Transform3D& + transform() const { + return *m_transform; + } /// @brief String representation of this @c SurfaceArray /// @param gctx The current geometry context object, e.g. alignment diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index c7a8fba4b..cd8989310 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -76,8 +76,8 @@ class SurfaceBounds { /// @param lpos Local position (assumed to be in right surface frame) /// @param bcheck boundary check directive /// @return boolean indicator for the success of this operation - virtual bool inside(const Vector2D& lpos, - const BoundaryCheck& bcheck) const = 0; + virtual bool inside(const Vector2D& lpos, const BoundaryCheck& bcheck) + const = 0; /// Minimal distance to boundary ( > 0 if outside and <=0 if inside) /// @@ -91,18 +91,21 @@ class SurfaceBounds { virtual std::ostream& toStream(std::ostream& os) const = 0; }; -inline bool operator==(const SurfaceBounds& lhs, const SurfaceBounds& rhs) { +inline bool +operator==(const SurfaceBounds& lhs, const SurfaceBounds& rhs) { if (&lhs == &rhs) { return true; } return (lhs.type() == rhs.type()) && (lhs.valueStore() == rhs.valueStore()); } -inline bool operator!=(const SurfaceBounds& lhs, const SurfaceBounds& rhs) { +inline bool +operator!=(const SurfaceBounds& lhs, const SurfaceBounds& rhs) { return !(lhs == rhs); } -inline std::ostream& operator<<(std::ostream& os, const SurfaceBounds& sb) { +inline std::ostream& +operator<<(std::ostream& os, const SurfaceBounds& sb) { return sb.toStream(os); } diff --git a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp index bdb744921..5f8628d61 100644 --- a/Core/include/Acts/Surfaces/TrapezoidBounds.hpp +++ b/Core/include/Acts/Surfaces/TrapezoidBounds.hpp @@ -138,15 +138,18 @@ class TrapezoidBounds : public PlanarBounds { RectangleBounds m_boundingBox; }; -inline double TrapezoidBounds::minHalflengthX() const { +inline double +TrapezoidBounds::minHalflengthX() const { return m_minHalfX; } -inline double TrapezoidBounds::maxHalflengthX() const { +inline double +TrapezoidBounds::maxHalflengthX() const { return m_maxHalfX; } -inline double TrapezoidBounds::halflengthY() const { +inline double +TrapezoidBounds::halflengthY() const { return m_halfY; } diff --git a/Core/include/Acts/Surfaces/detail/ConeSurface.ipp b/Core/include/Acts/Surfaces/detail/ConeSurface.ipp index 0f71ec6e9..6b50c37b5 100644 --- a/Core/include/Acts/Surfaces/detail/ConeSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/ConeSurface.ipp @@ -10,9 +10,13 @@ // ConeSurface.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline Intersection ConeSurface::intersectionEstimate( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gmom, - NavigationDirection navDir, const BoundaryCheck& bcheck, +inline Intersection +ConeSurface::intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc correct) const { // check if you need bool needsTransform = (Surface::m_transform) ? true : false; diff --git a/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp b/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp index 41a9183af..d483523c7 100644 --- a/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp @@ -10,15 +10,19 @@ // CylinderSurface.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline const Vector3D CylinderSurface::rotSymmetryAxis( - const GeometryContext& gctx) const { +inline const Vector3D +CylinderSurface::rotSymmetryAxis(const GeometryContext& gctx) const { // fast access via tranform matrix (and not rotation()) return transform(gctx).matrix().block<3, 1>(0, 2); } -inline Intersection CylinderSurface::intersectionEstimate( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir, const BoundaryCheck& bcheck, +inline Intersection +CylinderSurface::intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc correct) const { // create line parameters Vector3D lpos = gpos; @@ -32,8 +36,8 @@ inline Intersection CylinderSurface::intersectionEstimate( double path = 0.; // lemma : the solver -> should catch current values - auto solve = [&solution, &path, &lpos, &ldir, &ccenter, &caxis, - &navDir](double R) -> bool { + auto solve = [&solution, &path, &lpos, &ldir, &ccenter, &caxis, &navDir]( + double R) -> bool { // check documentation for explanation Vector3D pc = lpos - ccenter; Vector3D pcXcd = pc.cross(caxis); diff --git a/Core/include/Acts/Surfaces/detail/DiscSurface.ipp b/Core/include/Acts/Surfaces/detail/DiscSurface.ipp index 1bbf619db..9406ecc27 100644 --- a/Core/include/Acts/Surfaces/detail/DiscSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/DiscSurface.ipp @@ -10,24 +10,27 @@ // DiscSurface.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline const Vector2D DiscSurface::localPolarToCartesian( - const Vector2D& lpolar) const { - return Vector2D(lpolar[eLOC_R] * cos(lpolar[eLOC_PHI]), - lpolar[eLOC_R] * sin(lpolar[eLOC_PHI])); +inline const Vector2D +DiscSurface::localPolarToCartesian(const Vector2D& lpolar) const { + return Vector2D( + lpolar[eLOC_R] * cos(lpolar[eLOC_PHI]), + lpolar[eLOC_R] * sin(lpolar[eLOC_PHI])); } -inline const Vector2D DiscSurface::localCartesianToPolar( - const Vector2D& lcart) const { +inline const Vector2D +DiscSurface::localCartesianToPolar(const Vector2D& lcart) const { return Vector2D( sqrt(lcart[eLOC_X] * lcart[eLOC_X] + lcart[eLOC_Y] * lcart[eLOC_Y]), atan2(lcart[eLOC_Y], lcart[eLOC_X])); } -inline void DiscSurface::initJacobianToGlobal(const GeometryContext& gctx, - BoundToFreeMatrix& jacobian, - const Vector3D& gpos, - const Vector3D& dir, - const BoundVector& pars) const { +inline void +DiscSurface::initJacobianToGlobal( + const GeometryContext& gctx, + BoundToFreeMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir, + const BoundVector& pars) const { // The trigonometry required to convert the direction to spherical // coordinates and then compute the sines and cosines again can be // surprisingly expensive from a performance point of view. @@ -69,9 +72,12 @@ inline void DiscSurface::initJacobianToGlobal(const GeometryContext& gctx, jacobian(7, eQOP) = 1; } -inline const RotationMatrix3D DiscSurface::initJacobianToLocal( - const GeometryContext& gctx, FreeToBoundMatrix& jacobian, - const Vector3D& gpos, const Vector3D& dir) const { +inline const RotationMatrix3D +DiscSurface::initJacobianToLocal( + const GeometryContext& gctx, + FreeToBoundMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir) const { using VectorHelpers::perp; using VectorHelpers::phi; // Optimized trigonometry on the propagation direction @@ -106,9 +112,13 @@ inline const RotationMatrix3D DiscSurface::initJacobianToLocal( return rframeT; } -inline Intersection DiscSurface::intersectionEstimate( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir, const BoundaryCheck& bcheck, +inline Intersection +DiscSurface::intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc correct) const { // minimize the call to transform() const auto& tMatrix = transform(gctx).matrix(); @@ -147,21 +157,26 @@ inline Intersection DiscSurface::intersectionEstimate( return Intersection(solution, path, valid); } -inline const Vector3D DiscSurface::normal(const GeometryContext& gctx, - const Vector2D& /*unused*/) const { +inline const Vector3D +DiscSurface::normal(const GeometryContext& gctx, const Vector2D& /*unused*/) + const { // fast access via tranform matrix (and not rotation()) const auto& tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } -inline const Vector3D DiscSurface::binningPosition( - const GeometryContext& gctx, BinningValue /*unused*/) const { +inline const Vector3D +DiscSurface::binningPosition( + const GeometryContext& gctx, + BinningValue /*unused*/) const { return center(gctx); } -inline double DiscSurface::pathCorrection(const GeometryContext& gctx, - const Vector3D& pos, - const Vector3D& mom) const { +inline double +DiscSurface::pathCorrection( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const { /// we can ignore the global position here return 1. / std::abs(Surface::normal(gctx, pos).dot(mom.normalized())); } diff --git a/Core/include/Acts/Surfaces/detail/LineSurface.ipp b/Core/include/Acts/Surfaces/detail/LineSurface.ipp index 881c8455e..7176a3dad 100644 --- a/Core/include/Acts/Surfaces/detail/LineSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/LineSurface.ipp @@ -10,10 +10,12 @@ // LineSurface.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline void LineSurface::localToGlobal(const GeometryContext& gctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const { +inline void +LineSurface::localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const { const auto& sTransform = transform(gctx); const auto& tMatrix = sTransform.matrix(); Vector3D lineDirection(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); @@ -25,10 +27,12 @@ inline void LineSurface::localToGlobal(const GeometryContext& gctx, gpos = Vector3D(locZinGlobal + lpos[eLOC_R] * radiusAxisGlobal.normalized()); } -inline bool LineSurface::globalToLocal(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const { +inline bool +LineSurface::globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const { using VectorHelpers::perp; const auto& sTransform = transform(gctx); @@ -46,12 +50,15 @@ inline bool LineSurface::globalToLocal(const GeometryContext& gctx, return true; } -inline std::string LineSurface::name() const { +inline std::string +LineSurface::name() const { return "Acts::LineSurface"; } -inline const RotationMatrix3D LineSurface::referenceFrame( - const GeometryContext& gctx, const Vector3D& /*unused*/, +inline const RotationMatrix3D +LineSurface::referenceFrame( + const GeometryContext& gctx, + const Vector3D& /*unused*/, const Vector3D& mom) const { RotationMatrix3D mFrame; const auto& tMatrix = transform(gctx).matrix(); @@ -66,33 +73,43 @@ inline const RotationMatrix3D LineSurface::referenceFrame( return mFrame; } -inline double LineSurface::pathCorrection(const GeometryContext& /*unused*/, - const Vector3D& /*pos*/, - const Vector3D& /*mom*/) const { +inline double +LineSurface::pathCorrection( + const GeometryContext& /*unused*/, + const Vector3D& /*pos*/, + const Vector3D& /*mom*/) const { return 1.; } -inline const Vector3D LineSurface::binningPosition( - const GeometryContext& gctx, BinningValue /*bValue*/) const { +inline const Vector3D +LineSurface::binningPosition( + const GeometryContext& gctx, + BinningValue /*bValue*/) const { return center(gctx); } -inline const Vector3D LineSurface::normal(const GeometryContext& gctx, - const Vector2D& /*lpos*/) const { +inline const Vector3D +LineSurface::normal(const GeometryContext& gctx, const Vector2D& /*lpos*/) + const { const auto& tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } -inline const SurfaceBounds& LineSurface::bounds() const { +inline const SurfaceBounds& +LineSurface::bounds() const { if (m_bounds) { return (*m_bounds.get()); } return s_noBounds; } -inline Intersection LineSurface::intersectionEstimate( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir, const BoundaryCheck& bcheck, +inline Intersection +LineSurface::intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc correct) const { // following nominclature found in header file and doxygen documentation // line one is the straight track @@ -138,11 +155,13 @@ inline Intersection LineSurface::intersectionEstimate( return Intersection(gpos, std::numeric_limits<double>::max(), false); } -inline void LineSurface::initJacobianToGlobal(const GeometryContext& gctx, - BoundToFreeMatrix& jacobian, - const Vector3D& gpos, - const Vector3D& dir, - const BoundVector& pars) const { +inline void +LineSurface::initJacobianToGlobal( + const GeometryContext& gctx, + BoundToFreeMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir, + const BoundVector& pars) const { // The trigonometry required to convert the direction to spherical // coordinates and then compute the sines and cosines again can be // surprisingly expensive from a performance point of view. @@ -189,9 +208,13 @@ inline void LineSurface::initJacobianToGlobal(const GeometryContext& gctx, jacobian.block<3, 1>(0, eTHETA) = dDThetaY * pars[eLOC_0] * ipdn; } -inline const BoundRowVector LineSurface::derivativeFactors( - const GeometryContext& gctx, const Vector3D& pos, const Vector3D& dir, - const RotationMatrix3D& rft, const BoundToFreeMatrix& jac) const { +inline const BoundRowVector +LineSurface::derivativeFactors( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& dir, + const RotationMatrix3D& rft, + const BoundToFreeMatrix& jac) const { // the vector between position and center ActsRowVectorD<3> pc = (pos - center(gctx)).transpose(); // the longitudinal component vector (alogn local z) @@ -209,6 +232,7 @@ inline const BoundRowVector LineSurface::derivativeFactors( ActsMatrixD<3, BoundParsDim> long_mat = ActsMatrixD<3, BoundParsDim>::Zero(); long_mat.colwise() += locz.transpose(); // build the combined normal & longitudinal components - return (norm * (s_vec - pc * (long_mat * d_vec.asDiagonal() - - jac.block<3, BoundParsDim>(4, 0)))); + return ( + norm * (s_vec - pc * (long_mat * d_vec.asDiagonal() - + jac.block<3, BoundParsDim>(4, 0)))); } \ No newline at end of file diff --git a/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp b/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp index 5a06a68f3..53482765c 100644 --- a/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp @@ -10,28 +10,37 @@ // PlaneSurface.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline const Vector3D PlaneSurface::normal(const GeometryContext& gctx, - const Vector2D& /*lpos*/) const { +inline const Vector3D +PlaneSurface::normal(const GeometryContext& gctx, const Vector2D& /*lpos*/) + const { // fast access via tranform matrix (and not rotation()) const auto& tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } -inline const Vector3D PlaneSurface::binningPosition( - const GeometryContext& gctx, BinningValue /*bValue*/) const { +inline const Vector3D +PlaneSurface::binningPosition( + const GeometryContext& gctx, + BinningValue /*bValue*/) const { return center(gctx); } -inline double PlaneSurface::pathCorrection(const GeometryContext& gctx, - const Vector3D& pos, - const Vector3D& mom) const { +inline double +PlaneSurface::pathCorrection( + const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const { /// we can ignore the global position here return 1. / std::abs(Surface::normal(gctx, pos).dot(mom.normalized())); } -inline Intersection PlaneSurface::intersectionEstimate( - const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& gdir, - NavigationDirection navDir, const BoundaryCheck& bcheck, +inline Intersection +PlaneSurface::intersectionEstimate( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc correct) const { // minimize the call to transform() const auto& tMatrix = transform(gctx).matrix(); diff --git a/Core/include/Acts/Surfaces/detail/Surface.ipp b/Core/include/Acts/Surfaces/detail/Surface.ipp index 34bd8ad9e..28e5d6f92 100644 --- a/Core/include/Acts/Surfaces/detail/Surface.ipp +++ b/Core/include/Acts/Surfaces/detail/Surface.ipp @@ -10,19 +10,20 @@ // Surface.ipp, Acts project /////////////////////////////////////////////////////////////////// -inline const Vector3D Surface::center(const GeometryContext& gctx) const { +inline const Vector3D +Surface::center(const GeometryContext& gctx) const { // fast access via tranform matrix (and not translation()) auto tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 3), tMatrix(1, 3), tMatrix(2, 3)); } -inline const Acts::Vector3D Surface::normal(const GeometryContext& gctx, - const Vector3D& /*unused*/) const { +inline const Acts::Vector3D +Surface::normal(const GeometryContext& gctx, const Vector3D& /*unused*/) const { return normal(gctx, s_origin2D); } -inline const Transform3D& Surface::transform( - const GeometryContext& gctx) const { +inline const Transform3D& +Surface::transform(const GeometryContext& gctx) const { if (m_transform != nullptr) { return (*(m_transform.get())); } @@ -32,22 +33,27 @@ inline const Transform3D& Surface::transform( return s_idTransform; } -inline bool Surface::insideBounds(const Vector2D& locpos, - const BoundaryCheck& bcheck) const { +inline bool +Surface::insideBounds(const Vector2D& locpos, const BoundaryCheck& bcheck) + const { return bounds().inside(locpos, bcheck); } -inline const RotationMatrix3D Surface::referenceFrame( - const GeometryContext& gctx, const Vector3D& /*unused*/, +inline const RotationMatrix3D +Surface::referenceFrame( + const GeometryContext& gctx, + const Vector3D& /*unused*/, const Vector3D& /*unused*/) const { return transform(gctx).matrix().block<3, 3>(0, 0); } -inline void Surface::initJacobianToGlobal(const GeometryContext& gctx, - BoundToFreeMatrix& jacobian, - const Vector3D& gpos, - const Vector3D& dir, - const BoundVector& /*pars*/) const { +inline void +Surface::initJacobianToGlobal( + const GeometryContext& gctx, + BoundToFreeMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir, + const BoundVector& /*pars*/) const { // The trigonometry required to convert the direction to spherical // coordinates and then compute the sines and cosines again can be // surprisingly expensive from a performance point of view. @@ -79,9 +85,12 @@ inline void Surface::initJacobianToGlobal(const GeometryContext& gctx, jacobian(7, eQOP) = 1; } -inline const RotationMatrix3D Surface::initJacobianToLocal( - const GeometryContext& gctx, FreeToBoundMatrix& jacobian, - const Vector3D& gpos, const Vector3D& dir) const { +inline const RotationMatrix3D +Surface::initJacobianToLocal( + const GeometryContext& gctx, + FreeToBoundMatrix& jacobian, + const Vector3D& gpos, + const Vector3D& dir) const { // Optimized trigonometry on the propagation direction const double x = dir(0); // == cos(phi) * sin(theta) const double y = dir(1); // == sin(phi) * sin(theta) @@ -105,9 +114,12 @@ inline const RotationMatrix3D Surface::initJacobianToLocal( return rframeT; } -inline const BoundRowVector Surface::derivativeFactors( - const GeometryContext& /*unused*/, const Vector3D& /*unused*/, - const Vector3D& dir, const RotationMatrix3D& rft, +inline const BoundRowVector +Surface::derivativeFactors( + const GeometryContext& /*unused*/, + const Vector3D& /*unused*/, + const Vector3D& dir, + const RotationMatrix3D& rft, const BoundToFreeMatrix& jac) const { // Create the normal and scale it with the projection onto the direction ActsRowVectorD<3> norm_vec = rft.template block<1, 3>(2, 0); @@ -117,8 +129,11 @@ inline const BoundRowVector Surface::derivativeFactors( } template <typename parameters_t> -bool Surface::isOnSurface(const GeometryContext& gctx, const parameters_t& pars, - const BoundaryCheck& bcheck) const { +bool +Surface::isOnSurface( + const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck) const { // surface pointer comparison as a first fast check (w/o transform) // @todo check if we can find a fast way that works for stepper state and // parameters @@ -126,23 +141,28 @@ bool Surface::isOnSurface(const GeometryContext& gctx, const parameters_t& pars, return isOnSurface(gctx, pars.position(), pars.momentum(), bcheck); } -inline const DetectorElementBase* Surface::associatedDetectorElement() const { +inline const DetectorElementBase* +Surface::associatedDetectorElement() const { return m_associatedDetElement; } -inline const Layer* Surface::associatedLayer() const { +inline const Layer* +Surface::associatedLayer() const { return (m_associatedLayer); } -inline const ISurfaceMaterial* Surface::surfaceMaterial() const { +inline const ISurfaceMaterial* +Surface::surfaceMaterial() const { return m_surfaceMaterial.get(); } -inline void Surface::assignSurfaceMaterial( +inline void +Surface::assignSurfaceMaterial( std::shared_ptr<const ISurfaceMaterial> material) { m_surfaceMaterial = std::move(material); } -inline void Surface::associateLayer(const Layer& lay) { +inline void +Surface::associateLayer(const Layer& lay) { m_associatedLayer = (&lay); } diff --git a/Core/include/Acts/Utilities/BinAdjustment.hpp b/Core/include/Acts/Utilities/BinAdjustment.hpp index 011620157..23b3b53fe 100644 --- a/Core/include/Acts/Utilities/BinAdjustment.hpp +++ b/Core/include/Acts/Utilities/BinAdjustment.hpp @@ -27,7 +27,8 @@ namespace Acts { /// @param rBounds the Radial bounds to adjust to /// /// @return new updated BinUtiltiy -BinUtility adjustBinUtility(const BinUtility& bu, const RadialBounds& rBounds) { +BinUtility +adjustBinUtility(const BinUtility& bu, const RadialBounds& rBounds) { // Default constructor BinUtility uBinUtil; // The parameters from the cylinder bounds @@ -71,8 +72,8 @@ BinUtility adjustBinUtility(const BinUtility& bu, const RadialBounds& rBounds) { /// @param cBounds the Cylinder bounds to adjust to /// /// @return new updated BinUtiltiy -BinUtility adjustBinUtility(const BinUtility& bu, - const CylinderBounds& cBounds) { +BinUtility +adjustBinUtility(const BinUtility& bu, const CylinderBounds& cBounds) { // Default constructor BinUtility uBinUtil; // The parameters from the cylinder bounds @@ -119,7 +120,8 @@ BinUtility adjustBinUtility(const BinUtility& bu, /// @param Surface to which the adjustment is being done /// /// @return new updated BinUtiltiy -BinUtility adjustBinUtility(const BinUtility& bu, const Surface& surface) { +BinUtility +adjustBinUtility(const BinUtility& bu, const Surface& surface) { // The surface type is a cylinder if (surface.type() == Surface::Cylinder) { // Cast to Cylinder bounds and return diff --git a/Core/include/Acts/Utilities/BinUtility.hpp b/Core/include/Acts/Utilities/BinUtility.hpp index e93d4b19c..9bc77a22a 100644 --- a/Core/include/Acts/Utilities/BinUtility.hpp +++ b/Core/include/Acts/Utilities/BinUtility.hpp @@ -42,8 +42,9 @@ class BinUtility { /// /// @param bData is the provided binning data /// @param tForm is the (optional) transform - BinUtility(const BinningData& bData, - const std::shared_ptr<const Transform3D>& tForm = nullptr) + BinUtility( + const BinningData& bData, + const std::shared_ptr<const Transform3D>& tForm = nullptr) : m_binningData(), m_transform(tForm), m_itransform(tForm ? new Transform3D(tForm->inverse()) : nullptr) { @@ -59,9 +60,13 @@ class BinUtility { /// @param opt is the binning option : open, closed /// @param value is the binninb value : binX, binY, binZ, etc. /// @param tForm is the (optional) transform - BinUtility(size_t bins, float min, float max, BinningOption opt = open, - BinningValue value = binX, - const std::shared_ptr<const Transform3D>& tForm = nullptr) + BinUtility( + size_t bins, + float min, + float max, + BinningOption opt = open, + BinningValue value = binX, + const std::shared_ptr<const Transform3D>& tForm = nullptr) : m_binningData(), m_transform(tForm), m_itransform(tForm ? new Transform3D(tForm->inverse()) : nullptr) { @@ -75,9 +80,11 @@ class BinUtility { /// @param opt is the binning option : open, closed /// @param value is the binninb value : binX, binY, binZ, etc. /// @param tForm is the (optional) transform - BinUtility(std::vector<float>& bValues, BinningOption opt = open, - BinningValue value = binPhi, - const std::shared_ptr<const Transform3D>& tForm = nullptr) + BinUtility( + std::vector<float>& bValues, + BinningOption opt = open, + BinningValue value = binPhi, + const std::shared_ptr<const Transform3D>& tForm = nullptr) : m_binningData(), m_transform(tForm), m_itransform(tForm ? new Transform3D(tForm->inverse()) : nullptr) { @@ -91,14 +98,15 @@ class BinUtility { BinUtility(const BinUtility& sbu) : m_binningData(sbu.m_binningData), m_transform(sbu.m_transform), - m_itransform(sbu.m_transform - ? new Transform3D(sbu.m_transform->inverse()) - : nullptr) {} + m_itransform( + sbu.m_transform ? new Transform3D(sbu.m_transform->inverse()) + : nullptr) {} /// Assignment operator /// /// @param sbu is the source bin utility - BinUtility& operator=(const BinUtility& sbu) { + BinUtility& + operator=(const BinUtility& sbu) { if (this != &sbu) { m_binningData = sbu.m_binningData; m_transform = sbu.m_transform; @@ -113,7 +121,8 @@ class BinUtility { /// Operator++ to make multidimensional BinUtility /// /// @param gbu is the additional BinUtility to be chosen - BinUtility& operator+=(const BinUtility& gbu) { + BinUtility& + operator+=(const BinUtility& gbu) { const std::vector<BinningData>& bData = gbu.binningData(); if (m_transform == nullptr && gbu.transform() != nullptr) { @@ -125,8 +134,8 @@ class BinUtility { // combine two existing transform // note that this might lead to undesired behaviour of the combined // BinUtility - m_transform = std::make_shared<const Transform3D>((*m_transform) * - (*gbu.transform())); + m_transform = std::make_shared<const Transform3D>( + (*m_transform) * (*gbu.transform())); m_itransform = std::make_unique<const Transform3D>(m_transform->inverse()); } // else { @@ -143,13 +152,22 @@ class BinUtility { /// Virtual Destructor ~BinUtility() = default; /// Implizit Constructor - BinUtility* clone() const { return new BinUtility(*this); } + BinUtility* + clone() const { + return new BinUtility(*this); + } /// return the binning data vector - const std::vector<BinningData>& binningData() const { return m_binningData; } + const std::vector<BinningData>& + binningData() const { + return m_binningData; + } /// Return the total number of bins - size_t bins() const { return bins(0) * bins(1) * bins(2); } + size_t + bins() const { + return bins(0) * bins(1) * bins(2); + } /// Bin-triple fast access /// @@ -158,7 +176,8 @@ class BinUtility { /// @param position is the 3D position to be evaluated /// /// @return is the bin value in 3D - std::array<size_t, 3> binTriple(const Vector3D& position) const { + std::array<size_t, 3> + binTriple(const Vector3D& position) const { /// transform or not const Vector3D& bPosition = m_itransform ? Vector3D((*m_itransform) * position) : position; @@ -179,7 +198,8 @@ class BinUtility { /// @param ba is the bin dimension /// /// @return is the bin value - size_t bin(const Vector3D& position, size_t ba = 0) const { + size_t + bin(const Vector3D& position, size_t ba = 0) const { if (ba >= m_binningData.size()) { return 0; } @@ -200,8 +220,8 @@ class BinUtility { /// @param ba is the binning accessor /// /// @return a vector of neighbour sizes - std::vector<size_t> neighbourRange(const Vector3D& position, - size_t ba = 0) const { + std::vector<size_t> + neighbourRange(const Vector3D& position, size_t ba = 0) const { if (ba >= m_binningData.size()) { return {0}; } @@ -228,8 +248,11 @@ class BinUtility { /// @todo the /// /// @return the next bin - int nextDirection(const Vector3D& position, const Vector3D& direction, - size_t ba = 0) const { + int + nextDirection( + const Vector3D& position, + const Vector3D& direction, + size_t ba = 0) const { if (ba >= m_binningData.size()) { return 0; } @@ -247,7 +270,8 @@ class BinUtility { /// @param ba is the bin dimension /// /// @return bin calculated from local - size_t bin(const Vector2D& lposition, size_t ba = 0) const { + size_t + bin(const Vector2D& lposition, size_t ba = 0) const { if (ba >= m_binningData.size()) { return 0; } @@ -257,7 +281,8 @@ class BinUtility { /// /// @param position is the global position to be evaluated /// @return is a boolean check - bool inside(const Vector3D& position) const { + bool + inside(const Vector3D& position) const { /// transform or not const Vector3D& bPosition = m_itransform ? Vector3D((*m_itransform) * position) : position; @@ -275,7 +300,8 @@ class BinUtility { /// /// @param lposition is the local position to be evaluated /// @return is a boolean check - bool inside(const Vector2D& lposition) const { + bool + inside(const Vector2D& lposition) const { return true; std::vector<BinningData>::const_iterator bdIter = m_binningData.begin(); for (; bdIter != m_binningData.end(); ++bdIter) { @@ -288,14 +314,18 @@ class BinUtility { /// First bin maximal value /// @return the dimenstion of the binning data - size_t dimensions() const { return m_binningData.size(); } + size_t + dimensions() const { + return m_binningData.size(); + } /// First bin maximal value /// /// @param ba is the binaccessor /// /// @return size_t is the maximal bin of the accessor entry - size_t max(size_t ba = 0) const { + size_t + max(size_t ba = 0) const { if (ba >= m_binningData.size()) { return 0; } @@ -307,7 +337,8 @@ class BinUtility { /// @param ba is the binaccessor /// /// @return size_t is the bins of the accessor entry - size_t bins(size_t ba) const { + size_t + bins(size_t ba) const { if (ba >= m_binningData.size()) { return 1; } @@ -317,14 +348,18 @@ class BinUtility { /// Transform applied to global positions before lookup /// /// @return Shared pointer to transform - std::shared_ptr<const Transform3D> transform() const { return m_transform; } + std::shared_ptr<const Transform3D> + transform() const { + return m_transform; + } /// The type/value of the binning /// /// @param ba is the binaccessor /// /// @return the binning value of the accessor entry - BinningValue binningValue(size_t ba = 0) const { + BinningValue + binningValue(size_t ba = 0) const { if (ba >= m_binningData.size()) { throw "dimension out of bounds"; } @@ -335,7 +370,8 @@ class BinUtility { /// - this creates a simple size_t from a triple object /// /// @param bin is the bin to be serialized - size_t serialize(const std::array<size_t, 3>& bin) const { + size_t + serialize(const std::array<size_t, 3>& bin) const { size_t serializedBin = bin[0]; if (m_binningData.size() == 2) { serializedBin += bin[1] * m_binningData[0].bins(); @@ -349,7 +385,8 @@ class BinUtility { /// Output Method for std::ostream, to be overloaded by child classes /// /// @param sl is the ostream to be dumped into - std::ostream& toStream(std::ostream& sl) const { + std::ostream& + toStream(std::ostream& sl) const { sl << "BinUtility for " << m_binningData.size() << "- dimensional array:" << std::endl; std::vector<BinningData>::const_iterator bdIter = m_binningData.begin(); diff --git a/Core/include/Acts/Utilities/BinnedArray.hpp b/Core/include/Acts/Utilities/BinnedArray.hpp index ed8e2906a..60f71e5f4 100644 --- a/Core/include/Acts/Utilities/BinnedArray.hpp +++ b/Core/include/Acts/Utilities/BinnedArray.hpp @@ -39,15 +39,16 @@ class BinnedArray { /// @param bins is the bin triple to filled /// /// @return the object according to the estimated bin - virtual T object(const Vector2D& lposition, - std::array<size_t, 3>& bins) const = 0; + virtual T object(const Vector2D& lposition, std::array<size_t, 3>& bins) + const = 0; /// Same method without bins for backward compatibility /// /// @param lposition is the local position for finding the obect /// /// @return the object according to the estimated bin - virtual T object(const Vector2D& lposition) const { + virtual T + object(const Vector2D& lposition) const { std::array<size_t, 3> bins; return object(lposition, bins); } @@ -58,15 +59,16 @@ class BinnedArray { /// @param bin is the bin triple filled /// /// @return the object according to the estimated bin - virtual T object(const Vector3D& position, - std::array<size_t, 3>& bin) const = 0; + virtual T object(const Vector3D& position, std::array<size_t, 3>& bin) + const = 0; /// Same method without bins for backward compatibility /// /// @param position is the global position for the object finding /// /// @return the object according to the estimated bin - virtual T object(const Vector3D& position) const { + virtual T + object(const Vector3D& position) const { std::array<size_t, 3> bins; return object(position, bins); } diff --git a/Core/include/Acts/Utilities/BinnedArrayXD.hpp b/Core/include/Acts/Utilities/BinnedArrayXD.hpp index f713914e5..1cf9aaa0b 100644 --- a/Core/include/Acts/Utilities/BinnedArrayXD.hpp +++ b/Core/include/Acts/Utilities/BinnedArrayXD.hpp @@ -41,7 +41,8 @@ class BinnedArrayXD : public BinnedArray<T> { BinnedArrayXD(T object) : BinnedArray<T>(), m_objectGrid( - 1, std::vector<std::vector<T>>(1, std::vector<T>(1, nullptr))), + 1, + std::vector<std::vector<T>>(1, std::vector<T>(1, nullptr))), m_arrayObjects({object}), m_binUtility(nullptr) { /// fill the single object into the object grid @@ -53,12 +54,15 @@ class BinnedArrayXD : public BinnedArray<T> { /// /// @param tapvector is a vector of object and binning position /// @param bu is the unique bin utility for this binned array - BinnedArrayXD(const std::vector<TAP>& tapvector, - std::unique_ptr<const BinUtility> bu) + BinnedArrayXD( + const std::vector<TAP>& tapvector, + std::unique_ptr<const BinUtility> bu) : BinnedArray<T>(), - m_objectGrid(bu->bins(2), - std::vector<std::vector<T>>( - bu->bins(1), std::vector<T>(bu->bins(0), nullptr))), + m_objectGrid( + bu->bins(2), + std::vector<std::vector<T>>( + bu->bins(1), + std::vector<T>(bu->bins(0), nullptr))), m_arrayObjects(), m_binUtility(std::move(bu)) { /// reserve the right amount of data @@ -73,8 +77,9 @@ class BinnedArrayXD : public BinnedArray<T> { /// fill the data m_objectGrid[bins[2]][bins[1]][bins[0]] = tap.first; /// fill the unique m_arrayObjects - if (std::find(m_arrayObjects.begin(), m_arrayObjects.end(), - tap.first) == m_arrayObjects.end()) { + if (std::find( + m_arrayObjects.begin(), m_arrayObjects.end(), tap.first) == + m_arrayObjects.end()) { m_arrayObjects.push_back(tap.first); } } @@ -85,8 +90,9 @@ class BinnedArrayXD : public BinnedArray<T> { /// /// @param grid is the prepared object grid /// @param bu is the unique bin utility for this binned array - BinnedArrayXD(const std::vector<std::vector<std::vector<T>>>& grid, - std::unique_ptr<const BinUtility> bu) + BinnedArrayXD( + const std::vector<std::vector<std::vector<T>>>& grid, + std::unique_ptr<const BinUtility> bu) : BinnedArray<T>(), m_objectGrid(grid), m_arrayObjects(), @@ -130,7 +136,8 @@ class BinnedArrayXD : public BinnedArray<T> { /// @param bins is the bin triple filled during this access /// /// @return is the object in that bin - T object(const Vector2D& lposition, std::array<size_t, 3>& bins) const final { + T + object(const Vector2D& lposition, std::array<size_t, 3>& bins) const final { if (m_binUtility) { size_t bdim = m_binUtility->dimensions(); bins[2] = bdim > 2 ? m_binUtility->bin(lposition, 2) : 0; @@ -142,7 +149,8 @@ class BinnedArrayXD : public BinnedArray<T> { } // satisfy overload / override - T object(const Vector2D& lposition) const override { + T + object(const Vector2D& lposition) const override { std::array<size_t, 3> bins; return object(lposition, bins); } @@ -153,7 +161,8 @@ class BinnedArrayXD : public BinnedArray<T> { /// @param bins is the bins triple filled during access /// /// @return is the object in that bin - T object(const Vector3D& position, std::array<size_t, 3>& bins) const final { + T + object(const Vector3D& position, std::array<size_t, 3>& bins) const final { if (m_binUtility) { size_t bdim = m_binUtility->dimensions(); bins[2] = bdim > 2 ? m_binUtility->bin(position, 2) : 0; @@ -165,19 +174,24 @@ class BinnedArrayXD : public BinnedArray<T> { } // satisfy overload / override - T object(const Vector3D& position) const override { + T + object(const Vector3D& position) const override { std::array<size_t, 3> bins; return object(position, bins); } /// Return all unqiue object /// @return vector of unique array objects - const std::vector<T>& arrayObjects() const final { return m_arrayObjects; } + const std::vector<T>& + arrayObjects() const final { + return m_arrayObjects; + } /// Return the object grid /// multiple entries are allowed and wanted /// @return internal object grid - const std::vector<std::vector<std::vector<T>>>& objectGrid() const final { + const std::vector<std::vector<std::vector<T>>>& + objectGrid() const final { return m_objectGrid; } @@ -187,8 +201,8 @@ class BinnedArrayXD : public BinnedArray<T> { /// @param binTriple is the binning /// /// @return a vector of unique objects - std::vector<T> objectCluster( - const std::array<size_t, 3>& binTriple) const override { + std::vector<T> + objectCluster(const std::array<size_t, 3>& binTriple) const override { // prepare the return vector std::vector<T> rvector; // reference bin object to be excluded @@ -229,7 +243,10 @@ class BinnedArrayXD : public BinnedArray<T> { /// Return the BinUtility /// @return plain pointer to the bin utility of this array - const BinUtility* binUtility() const final { return (m_binUtility.get()); } + const BinUtility* + binUtility() const final { + return (m_binUtility.get()); + } private: /// the data store - a 3D array at default diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index 64694acc4..b7ad86e88 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -84,10 +84,14 @@ class BinningData { /// @param bMax is the maxmimum value /// @param sBinData is (optional) sub structure /// @param sBinAdditive is the prescription for the sub structure - BinningData(BinningOption bOption, BinningValue bValue, size_t bBins, - float bMin, float bMax, - std::unique_ptr<const BinningData> sBinData = nullptr, - bool sBinAdditive = false) + BinningData( + BinningOption bOption, + BinningValue bValue, + size_t bBins, + float bMin, + float bMax, + std::unique_ptr<const BinningData> sBinData = nullptr, + bool sBinAdditive = false) : type(equidistant), option(bOption), binvalue(bValue), @@ -119,9 +123,11 @@ class BinningData { /// @param bValue is the binning value : binX, binY, etc. /// @param bBoundaries are the bin boundaries /// @param sBinData is (optional) sub structure - BinningData(BinningOption bOption, BinningValue bValue, - const std::vector<float>& bBoundaries, - std::unique_ptr<const BinningData> sBinData = nullptr) + BinningData( + BinningOption bOption, + BinningValue bValue, + const std::vector<float>& bBoundaries, + std::unique_ptr<const BinningData> sBinData = nullptr) : type(arbitrary), option(bOption), binvalue(bValue), @@ -183,7 +189,8 @@ class BinningData { /// Assignment operator /// /// @param bdata is the source object - BinningData& operator=(const BinningData& bdata) { + BinningData& + operator=(const BinningData& bdata) { if (this != &bdata) { type = bdata.type; option = bdata.option; @@ -216,13 +223,17 @@ class BinningData { ~BinningData() = default; /// Return the number of bins - including sub bins - size_t bins() const { return m_totalBins; } + size_t + bins() const { + return m_totalBins; + } /// Decrement the bin /// - boolean indicates if decrement actually worked /// /// @param bin is the bin to be decremented - bool decrement(size_t& bin) const { + bool + decrement(size_t& bin) const { size_t sbin = bin; bin = bin > 0 ? bin - 1 : (option == open ? bin : m_bins - 1); return (sbin != bin); @@ -232,7 +243,8 @@ class BinningData { /// - boolean indicates if decrement actually worked /// /// @param bin the bin to be incremented - bool increment(size_t& bin) const { + bool + increment(size_t& bin) const { size_t sbin = bin; bin = bin + 1 < m_bins ? bin + 1 : (option == open ? bin : 0); return (sbin != bin); @@ -240,7 +252,8 @@ class BinningData { /// Return the boundaries - including sub boundaries /// @return vector of floats indicating the boundary values - const std::vector<float>& boundaries() const { + const std::vector<float>& + boundaries() const { if (subBinningData) { return m_totalBoundaries; } @@ -252,7 +265,8 @@ class BinningData { /// @param lposition assumes the correct local position expression /// /// @return float value according to the binning setup - float value(const Vector2D& lposition) const { + float + value(const Vector2D& lposition) const { // ordered after occurence if (binvalue == binR || binvalue == binRPhi || binvalue == binX || binvalue == binH) { @@ -269,7 +283,8 @@ class BinningData { /// @param position is the global position /// /// @return float value according to the binning setup - float value(const Vector3D& position) const { + float + value(const Vector3D& position) const { using VectorHelpers::eta; using VectorHelpers::perp; using VectorHelpers::phi; @@ -295,7 +310,8 @@ class BinningData { /// @param bin is the bin for which the center value is requested /// /// @return float value according to the bin center - float center(size_t bin) const { + float + center(size_t bin) const { const std::vector<float>& bvals = boundaries(); // take the center between bin boundaries float value = bin < bvals.size() ? 0.5 * (bvals[bin] + bvals[bin + 1]) : 0.; @@ -307,7 +323,8 @@ class BinningData { /// @param position is the search position in global coordinated /// /// @return boolen if this is inside() method is true - bool inside(const Vector3D& position) const { + bool + inside(const Vector3D& position) const { // closed one is always inside if (option == closed) { return true; @@ -323,7 +340,8 @@ class BinningData { /// @param lposition is the search position in global coordinated /// /// @return boolen if this is inside() method is true - bool inside(const Vector2D& lposition) const { + bool + inside(const Vector2D& lposition) const { // closed one is always inside if (option == closed) { return true; @@ -339,7 +357,8 @@ class BinningData { /// @param lposition is the search position in local coordinated /// /// @return bin according tot this - size_t searchLocal(const Vector2D& lposition) const { + size_t + searchLocal(const Vector2D& lposition) const { if (zdim) { return 0; } @@ -351,7 +370,8 @@ class BinningData { /// @param position is the search position in global coordinated /// /// @return bin according tot this - size_t searchGlobal(const Vector3D& position) const { + size_t + searchGlobal(const Vector3D& position) const { if (zdim) { return 0; } @@ -363,7 +383,8 @@ class BinningData { /// @param value is the searchvalue as float /// /// @return bin according tot this - size_t search(float value) const { + size_t + search(float value) const { if (zdim) { return 0; } @@ -378,7 +399,8 @@ class BinningData { /// @param value is the searchvalue as float /// /// @return bin according tot this - size_t searchWithSubStructure(float value) const { + size_t + searchWithSubStructure(float value) const { // find the masterbin with the correct function pointer size_t masterbin = (*m_functionPtr)(value, *this); // additive sub binning - @@ -402,7 +424,8 @@ class BinningData { /// @todo check if this can be changed /// /// @return integer that indicates which direction to move - int nextDirection(const Vector3D& position, const Vector3D& dir) const { + int + nextDirection(const Vector3D& position, const Vector3D& dir) const { if (zdim) { return 0; } @@ -419,7 +442,8 @@ class BinningData { /// it is set to max /// /// @return the center value of the bin is given - float centerValue(size_t bin) const { + float + centerValue(size_t bin) const { if (zdim) { return 0.5 * (min + max); } @@ -433,7 +457,8 @@ class BinningData { /// takes a bin entry and returns the lower/higher bound /// respecting open/closed /// @return low/high bounds - std::vector<size_t> neighbourRange(size_t bin) const { + std::vector<size_t> + neighbourRange(size_t bin) const { size_t low = bin; size_t high = bin; // decrement and increment @@ -460,7 +485,8 @@ class BinningData { size_t (*m_functionPtr)(float, const BinningData&); /// function pointer /// helper method to set the sub structure - void checkSubStructure() { + void + checkSubStructure() { // sub structure is only checked when sBinData is defined if (subBinningData) { m_totalBoundaries.clear(); @@ -480,9 +506,10 @@ class BinningData { // should define numerically stable if (std::abs((*mbvalue) - sBinMin) < 10e-10) { // copy the sub bin boundaries into the vector - m_totalBoundaries.insert(m_totalBoundaries.begin(), - subBinBoundaries.begin(), - subBinBoundaries.end()); + m_totalBoundaries.insert( + m_totalBoundaries.begin(), + subBinBoundaries.begin(), + subBinBoundaries.end()); ++mbvalue; } else { m_totalBoundaries.push_back(*mbvalue); @@ -511,8 +538,8 @@ class BinningData { // Equidistant search // - fastest method - static size_t searchEquidistantWithBoundary(float value, - const BinningData& bData) { + static size_t + searchEquidistantWithBoundary(float value, const BinningData& bData) { // vanilla int bin = ((value - bData.min) / bData.step); @@ -527,15 +554,16 @@ class BinningData { } // if outside boundary : return boundary for open, opposite bin for closed bin = bin < 0 ? ((bData.option == open) ? 0 : (bData.m_bins - 1)) : bin; - return size_t((bin <= int(bData.m_bins - 1)) - ? bin - : ((bData.option == open) ? (bData.m_bins - 1) : 0)); + return size_t( + (bin <= int(bData.m_bins - 1)) + ? bin + : ((bData.option == open) ? (bData.m_bins - 1) : 0)); } // Linear search in arbitrary vector // - superior in O(10) searches - static size_t searchInVectorWithBoundary(float value, - const BinningData& bData) { + static size_t + searchInVectorWithBoundary(float value, const BinningData& bData) { // lower boundary if (value <= bData.m_boundaries[0]) { return (bData.option == closed) ? (bData.m_bins - 1) : 0; @@ -557,8 +585,8 @@ class BinningData { // A binary search with in an arbitrary vector // - faster than vector search for O(50) objects - static size_t binarySearchWithBoundary(float value, - const BinningData& bData) { + static size_t + binarySearchWithBoundary(float value, const BinningData& bData) { // Binary search in an array of n values to locate value if (value <= bData.m_boundaries[0]) { return (bData.option == closed) ? (bData.m_bins - 1) : 0; diff --git a/Core/include/Acts/Utilities/BinningType.hpp b/Core/include/Acts/Utilities/BinningType.hpp index 3014f05e7..85c660e43 100644 --- a/Core/include/Acts/Utilities/BinningType.hpp +++ b/Core/include/Acts/Utilities/BinningType.hpp @@ -49,7 +49,13 @@ enum BinningValue { }; /// @brief screen output option -static const std::vector<std::string> binningValueNames = { - "binX", "binY", "binZ", "binR", "binPhi", - "binRPhi", "binH", "binEta", "binMag"}; +static const std::vector<std::string> binningValueNames = {"binX", + "binY", + "binZ", + "binR", + "binPhi", + "binRPhi", + "binH", + "binEta", + "binMag"}; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Utilities/BoundingBox.hpp b/Core/include/Acts/Utilities/BoundingBox.hpp index 0fa9d421b..837093419 100644 --- a/Core/include/Acts/Utilities/BoundingBox.hpp +++ b/Core/include/Acts/Utilities/BoundingBox.hpp @@ -44,8 +44,14 @@ class AxisAlignedBoundingBox { public: explicit NamedType(const T& value) : m_value(value) {} explicit NamedType(T&& value) : m_value(std::move(value)) {} - T& get() { return m_value; } - const T& get() const { return m_value; } + T& + get() { + return m_value; + } + const T& + get() const { + return m_value; + } private: T m_value; @@ -105,8 +111,10 @@ class AxisAlignedBoundingBox { * @param vmin The minimum vertex. * @param vmax The maximum vertex. */ - AxisAlignedBoundingBox(const entity_t* entity, const vertex_type& vmin, - const vertex_type& vmax); + AxisAlignedBoundingBox( + const entity_t* entity, + const vertex_type& vmin, + const vertex_type& vmax); /** * Constructor from a center position, and a width and height. @@ -116,8 +124,10 @@ class AxisAlignedBoundingBox { * @note The special type @c size is required to disambiguate this constructor * from the other one above. It is a wrapper around a simple @c Vector3D. */ - AxisAlignedBoundingBox(const entity_t* entity, const vertex_type& center, - const Size& size); + AxisAlignedBoundingBox( + const entity_t* entity, + const vertex_type& center, + const Size& size); /** * Constructor from a list of child boxes. This box will wrap around all boxes @@ -288,8 +298,10 @@ class AxisAlignedBoundingBox { * @param trf An optional transform to apply first. */ template <size_t D = DIM, std::enable_if_t<D == 3, int> = 0> - void draw(IVisualization& helper, std::array<int, 3> color = {120, 120, 120}, - const transform_type& trf = transform_type::Identity()) const; + void draw( + IVisualization& helper, + std::array<int, 3> color = {120, 120, 120}, + const transform_type& trf = transform_type::Identity()) const; /** * Draw this bounding box as SVG. This method is only available for the 2D @@ -304,9 +316,13 @@ class AxisAlignedBoundingBox { * @return The outstream given in @p os. */ template <size_t D = DIM, std::enable_if_t<D == 2, int> = 0> - std::ostream& svg(std::ostream& os, value_type w, value_type h, - value_type unit = 10, std::string label = "", - std::string fillcolor = "grey") const; + std::ostream& svg( + std::ostream& os, + value_type w, + value_type h, + value_type unit = 10, + std::string label = "", + std::string fillcolor = "grey") const; private: template <size_t D = DIM, std::enable_if_t<D == 2, int> = 0> @@ -342,9 +358,11 @@ class AxisAlignedBoundingBox { * @return Pointer to the top most bounding box, containing the entire octree */ template <typename box_t> -box_t* make_octree(std::vector<std::unique_ptr<box_t>>& store, - const std::vector<box_t*>& prims, size_t max_depth = 1, - typename box_t::value_type envelope1 = 0); +box_t* make_octree( + std::vector<std::unique_ptr<box_t>>& store, + const std::vector<box_t*>& prims, + size_t max_depth = 1, + typename box_t::value_type envelope1 = 0); /** * Overload of the << operator for bounding boxes. @@ -356,8 +374,9 @@ box_t* make_octree(std::vector<std::unique_ptr<box_t>>& store, * @return The given output stream. */ template <typename T, typename U, size_t V> -std::ostream& operator<<(std::ostream& os, - const AxisAlignedBoundingBox<T, U, V>& box); +std::ostream& operator<<( + std::ostream& os, + const AxisAlignedBoundingBox<T, U, V>& box); } // namespace Acts diff --git a/Core/include/Acts/Utilities/BoundingBox.ipp b/Core/include/Acts/Utilities/BoundingBox.ipp index d5e7c5247..d9c5bfb5e 100644 --- a/Core/include/Acts/Utilities/BoundingBox.ipp +++ b/Core/include/Acts/Utilities/BoundingBox.ipp @@ -8,7 +8,9 @@ template <typename entity_t, typename value_t, size_t DIM> Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::AxisAlignedBoundingBox( - const entity_t* entity, const vertex_type& vmin, const vertex_type& vmax) + const entity_t* entity, + const vertex_type& vmin, + const vertex_type& vmax) : m_entity(entity), m_vmin(vmin), m_vmax(vmax), @@ -18,7 +20,9 @@ Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::AxisAlignedBoundingBox( template <typename entity_t, typename value_t, size_t DIM> Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::AxisAlignedBoundingBox( - const entity_t* entity, const vertex_type& center, const Size& size) + const entity_t* entity, + const vertex_type& center, + const Size& size) : m_entity(entity), m_vmin(center - size.get() * 0.5), m_vmax(center + size.get() * 0.5), @@ -28,7 +32,8 @@ Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::AxisAlignedBoundingBox( template <typename entity_t, typename value_t, size_t DIM> Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::AxisAlignedBoundingBox( - const std::vector<self_t*>& boxes, vertex_array_type envelope) + const std::vector<self_t*>& boxes, + vertex_array_type envelope) : m_entity(nullptr) { assert(boxes.size() > 1); @@ -59,7 +64,8 @@ std::pair< typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::vertex_type, typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::vertex_type> Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::wrap( - const std::vector<const self_t*>& boxes, vertex_array_type envelope) { + const std::vector<const self_t*>& boxes, + vertex_array_type envelope) { assert(boxes.size() > 1); // figure out extent of boxes // use array for Eigen coefficient wise min/max @@ -84,12 +90,16 @@ std::pair< typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::vertex_type, typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::vertex_type> Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::wrap( - const std::vector<self_t*>& boxes, vertex_array_type envelope) { + const std::vector<self_t*>& boxes, + vertex_array_type envelope) { assert(boxes.size() > 1); std::vector<const self_t*> box_ptrs; box_ptrs.reserve(boxes.size()); - std::transform(boxes.begin(), boxes.end(), std::back_inserter(box_ptrs), - [](const auto* box) { return box; }); + std::transform( + boxes.begin(), + boxes.end(), + std::back_inserter(box_ptrs), + [](const auto* box) { return box; }); return wrap(box_ptrs, envelope); } @@ -98,24 +108,29 @@ std::pair< typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::vertex_type, typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::vertex_type> Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::wrap( - const std::vector<self_t>& boxes, vertex_array_type envelope) { + const std::vector<self_t>& boxes, + vertex_array_type envelope) { assert(boxes.size() > 1); std::vector<const self_t*> box_ptrs; box_ptrs.reserve(boxes.size()); - std::transform(boxes.begin(), boxes.end(), std::back_inserter(box_ptrs), - [](auto& box) { return &box; }); + std::transform( + boxes.begin(), boxes.end(), std::back_inserter(box_ptrs), [](auto& box) { + return &box; + }); return wrap(box_ptrs, envelope); } template <typename entity_t, typename value_t, size_t DIM> -bool Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( +bool +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( const vertex_type& point) const { vertex_array_type t = (point - m_vmin).array() * m_iwidth; return t.minCoeff() >= 0 && t.maxCoeff() < 1; } template <typename entity_t, typename value_t, size_t DIM> -bool Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( +bool +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( const Ray<value_type, DIM>& ray) const { const vertex_type& origin = ray.origin(); const vertex_array_type& idir = ray.idir(); @@ -145,7 +160,8 @@ bool Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( template <typename entity_t, typename value_t, size_t DIM> template <size_t sides> -bool Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( +bool +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( const Frustum<value_type, DIM, sides>& fr) const { const auto& normals = fr.normals(); // Transform vmin and vmax into the coordinate system, at which the frustum is @@ -183,8 +199,8 @@ bool Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::intersect( } template <typename entity_t, typename value_t, size_t DIM> -void Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::setSkip( - self_t* skip) { +void +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::setSkip(self_t* skip) { // set next on this m_skip = skip; // find last child and set its skip @@ -206,45 +222,48 @@ Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::getSkip() const { } template <typename entity_t, typename value_t, size_t DIM> -bool Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::hasEntity() const { +bool +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::hasEntity() const { return m_entity != nullptr; } template <typename entity_t, typename value_t, size_t DIM> -const entity_t* Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::entity() - const { +const entity_t* +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::entity() const { return m_entity; } template <typename entity_t, typename value_t, size_t DIM> -void Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::setEntity( +void +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::setEntity( const entity_t* entity) { m_entity = entity; } template <typename entity_t, typename value_t, size_t DIM> -const typename Acts::AxisAlignedBoundingBox<entity_t, value_t, - DIM>::vertex_type& -Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::center() const { +const typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>:: + vertex_type& + Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::center() const { return m_center; } template <typename entity_t, typename value_t, size_t DIM> -const typename Acts::AxisAlignedBoundingBox<entity_t, value_t, - DIM>::vertex_type& -Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::min() const { +const typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>:: + vertex_type& + Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::min() const { return m_vmin; } template <typename entity_t, typename value_t, size_t DIM> -const typename Acts::AxisAlignedBoundingBox<entity_t, value_t, - DIM>::vertex_type& -Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::max() const { +const typename Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>:: + vertex_type& + Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::max() const { return m_vmax; } template <typename entity_t, typename value_t, size_t DIM> -std::ostream& Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::toStream( +std::ostream& +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::toStream( std::ostream& os) const { os << "AABB(ctr=("; @@ -338,7 +357,8 @@ Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::transformVertices( } template <typename entity_t, typename value_t, size_t DIM> -void Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::transform( +void +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::transform( const transform_type& trf) { std::tie(m_vmin, m_vmax) = transformVertices(trf); } @@ -354,44 +374,71 @@ Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::transformed( template <typename entity_t, typename value_t, size_t DIM> template <size_t D, std::enable_if_t<D == 3, int>> -void Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::draw( - IVisualization& helper, std::array<int, 3> color, +void +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::draw( + IVisualization& helper, + std::array<int, 3> color, const transform_type& trf) const { static_assert(DIM == 3, "PLY output only supported in 3D"); const vertex_type& vmin = m_vmin; const vertex_type& vmax = m_vmax; - auto write = [&](const vertex_type& a, const vertex_type& b, - const vertex_type& c, const vertex_type& d) { - helper.face(std::vector<vertex_type>({trf * a, trf * b, trf * c, trf * d}), - color); + auto write = [&](const vertex_type& a, + const vertex_type& b, + const vertex_type& c, + const vertex_type& d) { + helper.face( + std::vector<vertex_type>({trf * a, trf * b, trf * c, trf * d}), color); }; - write({vmin.x(), vmin.y(), vmin.z()}, {vmin.x(), vmax.y(), vmin.z()}, - {vmin.x(), vmax.y(), vmax.z()}, {vmin.x(), vmin.y(), vmax.z()}); - - write({vmax.x(), vmin.y(), vmin.z()}, {vmax.x(), vmax.y(), vmin.z()}, - {vmax.x(), vmax.y(), vmax.z()}, {vmax.x(), vmin.y(), vmax.z()}); - - write({vmin.x(), vmin.y(), vmin.z()}, {vmax.x(), vmin.y(), vmin.z()}, - {vmax.x(), vmin.y(), vmax.z()}, {vmin.x(), vmin.y(), vmax.z()}); - - write({vmin.x(), vmax.y(), vmin.z()}, {vmax.x(), vmax.y(), vmin.z()}, - {vmax.x(), vmax.y(), vmax.z()}, {vmin.x(), vmax.y(), vmax.z()}); - - write({vmin.x(), vmin.y(), vmin.z()}, {vmax.x(), vmin.y(), vmin.z()}, - {vmax.x(), vmax.y(), vmin.z()}, {vmin.x(), vmax.y(), vmin.z()}); - - write({vmin.x(), vmin.y(), vmax.z()}, {vmax.x(), vmin.y(), vmax.z()}, - {vmax.x(), vmax.y(), vmax.z()}, {vmin.x(), vmax.y(), vmax.z()}); + write( + {vmin.x(), vmin.y(), vmin.z()}, + {vmin.x(), vmax.y(), vmin.z()}, + {vmin.x(), vmax.y(), vmax.z()}, + {vmin.x(), vmin.y(), vmax.z()}); + + write( + {vmax.x(), vmin.y(), vmin.z()}, + {vmax.x(), vmax.y(), vmin.z()}, + {vmax.x(), vmax.y(), vmax.z()}, + {vmax.x(), vmin.y(), vmax.z()}); + + write( + {vmin.x(), vmin.y(), vmin.z()}, + {vmax.x(), vmin.y(), vmin.z()}, + {vmax.x(), vmin.y(), vmax.z()}, + {vmin.x(), vmin.y(), vmax.z()}); + + write( + {vmin.x(), vmax.y(), vmin.z()}, + {vmax.x(), vmax.y(), vmin.z()}, + {vmax.x(), vmax.y(), vmax.z()}, + {vmin.x(), vmax.y(), vmax.z()}); + + write( + {vmin.x(), vmin.y(), vmin.z()}, + {vmax.x(), vmin.y(), vmin.z()}, + {vmax.x(), vmax.y(), vmin.z()}, + {vmin.x(), vmax.y(), vmin.z()}); + + write( + {vmin.x(), vmin.y(), vmax.z()}, + {vmax.x(), vmin.y(), vmax.z()}, + {vmax.x(), vmax.y(), vmax.z()}, + {vmin.x(), vmax.y(), vmax.z()}); } template <typename entity_t, typename value_t, size_t DIM> template <size_t D, std::enable_if_t<D == 2, int>> -std::ostream& Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::svg( - std::ostream& os, value_type w, value_type h, value_type unit, - std::string label, std::string fillcolor) const { +std::ostream& +Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::svg( + std::ostream& os, + value_type w, + value_type h, + value_type unit, + std::string label, + std::string fillcolor) const { static_assert(DIM == 2, "SVG is only supported in 2D"); vertex_type mid(w / 2., h / 2.); @@ -411,7 +458,8 @@ std::ostream& Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::svg( os << "/>\n"; }; - auto draw_rect = [&](const vertex_type& center_, const vertex_type& size_, + auto draw_rect = [&](const vertex_type& center_, + const vertex_type& size_, std::string color) { vertex_type size = size_ * unit; vertex_type center = trf * center_ - size * 0.5; @@ -423,8 +471,10 @@ std::ostream& Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::svg( os << "/>\n"; }; - auto draw_text = [&](const vertex_type& center_, std::string text, - std::string color, size_t size) { + auto draw_text = [&](const vertex_type& center_, + std::string text, + std::string color, + size_t size) { vertex_type center = trf * center_; os << "<text dominant-baseline=\"middle\" text-anchor=\"middle\" "; os << "fill=\"" << color << "\" font-size=\"" << size << "\" "; @@ -441,10 +491,13 @@ std::ostream& Acts::AxisAlignedBoundingBox<entity_t, value_t, DIM>::svg( } template <typename box_t> -box_t* octree_inner(std::vector<std::unique_ptr<box_t>>& store, - size_t max_depth, - typename box_t::vertex_array_type envelope, - const std::vector<box_t*>& lprims, size_t depth) { +box_t* +octree_inner( + std::vector<std::unique_ptr<box_t>>& store, + size_t max_depth, + typename box_t::vertex_array_type envelope, + const std::vector<box_t*>& lprims, + size_t depth) { using vertex_type = typename box_t::vertex_type; assert(lprims.size() > 0); @@ -534,9 +587,12 @@ box_t* octree_inner(std::vector<std::unique_ptr<box_t>>& store, } template <typename box_t> -box_t* Acts::make_octree(std::vector<std::unique_ptr<box_t>>& store, - const std::vector<box_t*>& prims, size_t max_depth, - typename box_t::value_type envelope1) { +box_t* +Acts::make_octree( + std::vector<std::unique_ptr<box_t>>& store, + const std::vector<box_t*>& prims, + size_t max_depth, + typename box_t::value_type envelope1) { static_assert(box_t::dim == 3, "Octree can only be created in 3D"); using vertex_array_type = typename box_t::vertex_array_type; @@ -548,8 +604,8 @@ box_t* Acts::make_octree(std::vector<std::unique_ptr<box_t>>& store, } template <typename T, typename U, size_t V> -std::ostream& operator<<(std::ostream& os, - const Acts::AxisAlignedBoundingBox<T, U, V>& box) { +std::ostream& +operator<<(std::ostream& os, const Acts::AxisAlignedBoundingBox<T, U, V>& box) { box.dump(os); return os; } diff --git a/Core/include/Acts/Utilities/Frustum.hpp b/Core/include/Acts/Utilities/Frustum.hpp index 52b40b2de..775077a1b 100644 --- a/Core/include/Acts/Utilities/Frustum.hpp +++ b/Core/include/Acts/Utilities/Frustum.hpp @@ -52,8 +52,10 @@ class Frustum { /// @note The @p opening_angle is defined as the angle between opposing side /// planes. The opening angle needs to be < pi. template <size_t D = DIM, std::enable_if_t<D == 2, int> = 0> - Frustum(const vertex_type& origin, const vertex_type& dir, - value_type opening_angle); + Frustum( + const vertex_type& origin, + const vertex_type& dir, + value_type opening_angle); /// Constructor for the 3D case. /// @param origin The origin of the frustum @@ -62,8 +64,10 @@ class Frustum { /// @note The @p opening_angle is defined as the angle between opposing side /// planes. The opening angle needs to be < pi. template <size_t D = DIM, std::enable_if_t<D == 3, int> = 0> - Frustum(const vertex_type& origin, const vertex_type& dir, - value_type opening_angle); + Frustum( + const vertex_type& origin, + const vertex_type& dir, + value_type opening_angle); /// Draw a representation of this frustum using a visualization helper /// @note This is only available for the 3D case. @@ -82,22 +86,33 @@ class Frustum { /// the side lines terminate visually. /// @param unit Multiplicative factor to apply to internal distances template <size_t D = DIM, std::enable_if_t<D == 2, int> = 0> - std::ostream& svg(std::ostream& os, value_type w, value_type h, - value_type far_distance = 1, value_type unit = 20.) const; + std::ostream& svg( + std::ostream& os, + value_type w, + value_type h, + value_type far_distance = 1, + value_type unit = 20.) const; /// Getter for the oriogin of the frustum /// @return The origin of the frustum - const vertex_type& origin() const { return m_origin; } + const vertex_type& + origin() const { + return m_origin; + } /// Getter for the direction of the frustum /// @return The direction of the frustum - const vertex_type& dir() const { return m_normals[0]; } + const vertex_type& + dir() const { + return m_normals[0]; + } /// Getter for the normal vectors of the planes defining this frustum. /// @return Array containing the normal vectors for all planes. /// @note The size of the array that is returned is fixed to `number of sides /// + 1` - const std::array<vertex_type, SIDES + 1>& normals() const { + const std::array<vertex_type, SIDES + 1>& + normals() const { return m_normals; } diff --git a/Core/include/Acts/Utilities/Frustum.ipp b/Core/include/Acts/Utilities/Frustum.ipp index c60613f9a..911f9d0a4 100644 --- a/Core/include/Acts/Utilities/Frustum.ipp +++ b/Core/include/Acts/Utilities/Frustum.ipp @@ -10,9 +10,10 @@ template <typename value_t, size_t DIM, size_t SIDES> template <size_t D, std::enable_if_t<D == 2, int>> -Acts::Frustum<value_t, DIM, SIDES>::Frustum(const vertex_type& origin, - const vertex_type& dir, - value_type opening_angle) +Acts::Frustum<value_t, DIM, SIDES>::Frustum( + const vertex_type& origin, + const vertex_type& dir, + value_type opening_angle) : m_origin(origin) { using rotation_t = Eigen::Rotation2D<value_type>; @@ -32,9 +33,10 @@ Acts::Frustum<value_t, DIM, SIDES>::Frustum(const vertex_type& origin, template <typename value_t, size_t DIM, size_t SIDES> template <size_t D, std::enable_if_t<D == 3, int>> -Acts::Frustum<value_t, DIM, SIDES>::Frustum(const vertex_type& origin, - const vertex_type& dir, - value_type opening_angle) +Acts::Frustum<value_t, DIM, SIDES>::Frustum( + const vertex_type& origin, + const vertex_type& dir, + value_type opening_angle) : m_origin(origin) { static_assert(SIDES > 2, "3D frustum must have 3 or more sides"); assert(opening_angle < M_PI); @@ -75,8 +77,10 @@ Acts::Frustum<value_t, DIM, SIDES>::Frustum(const vertex_type& origin, template <typename value_t, size_t DIM, size_t SIDES> template <size_t D, std::enable_if_t<D == 3, int>> -void Acts::Frustum<value_t, DIM, SIDES>::draw(IVisualization& helper, - value_type far_distance) const { +void +Acts::Frustum<value_t, DIM, SIDES>::draw( + IVisualization& helper, + value_type far_distance) const { static_assert(DIM == 3, "Drawing is only supported in 3D"); // Iterate around normals, calculate cross with "far" plane @@ -88,7 +92,9 @@ void Acts::Frustum<value_t, DIM, SIDES>::draw(IVisualization& helper, std::array<std::pair<vertex_type, vertex_type>, SIDES> planeFarIXs; auto ixPlanePlane = - [](const auto& n1, const auto& p1, const auto& n2, + [](const auto& n1, + const auto& p1, + const auto& n2, const auto& p2) -> std::pair<vertex_type, vertex_type> { const vertex_type m = n1.cross(n2).normalized(); const double j = (n2.dot(p2 - p1)) / (n2.dot(n1.cross(m))); @@ -96,7 +102,9 @@ void Acts::Frustum<value_t, DIM, SIDES>::draw(IVisualization& helper, return {m, q}; }; - auto ixLineLine = [](const auto& p1, const auto& d1, const auto& p2, + auto ixLineLine = [](const auto& p1, + const auto& d1, + const auto& p2, const auto& d2) -> vertex_type { return p1 + (((p2 - p1).cross(d2)).norm() / (d1.cross(d2)).norm()) * d1; }; @@ -128,11 +136,13 @@ void Acts::Frustum<value_t, DIM, SIDES>::draw(IVisualization& helper, template <typename value_t, size_t DIM, size_t SIDES> template <size_t D, std::enable_if_t<D == 2, int>> -std::ostream& Acts::Frustum<value_t, DIM, SIDES>::svg(std::ostream& os, - value_type w, - value_type h, - value_type far_distance, - value_type unit) const { +std::ostream& +Acts::Frustum<value_t, DIM, SIDES>::svg( + std::ostream& os, + value_type w, + value_type h, + value_type far_distance, + value_type unit) const { static_assert(DIM == 2, "SVG is only supported in 2D"); vertex_type mid(w / 2., h / 2.); @@ -146,8 +156,10 @@ std::ostream& Acts::Frustum<value_t, DIM, SIDES>::svg(std::ostream& os, std::array<std::string, 3> colors({"orange", "blue", "red"}); - auto draw_line = [&](const vertex_type& left_, const vertex_type& right_, - std::string color, size_t width) { + auto draw_line = [&](const vertex_type& left_, + const vertex_type& right_, + std::string color, + size_t width) { vertex_type left = trf * left_; vertex_type right = trf * right_; os << "<line "; @@ -169,7 +181,8 @@ std::ostream& Acts::Frustum<value_t, DIM, SIDES>::svg(std::ostream& os, }; using vec3 = ActsVector<value_type, 3>; - auto ixLineLine = [](const vertex_type& p1_2, const vertex_type& d1_2, + auto ixLineLine = [](const vertex_type& p1_2, + const vertex_type& d1_2, const vertex_type& p2_2, const vertex_type& d2_2) -> vertex_type { const vec3 p1(p1_2.x(), p1_2.y(), 0); diff --git a/Core/include/Acts/Utilities/Helpers.hpp b/Core/include/Acts/Utilities/Helpers.hpp index d83937d07..f396e2842 100644 --- a/Core/include/Acts/Utilities/Helpers.hpp +++ b/Core/include/Acts/Utilities/Helpers.hpp @@ -74,12 +74,13 @@ using has_phi_method = concept ::is_detected<phi_method_t, T>; /// in case of dynamic size, will abort execution if that is not the case. /// @return The value of the angle in the transverse plane. template <typename Derived> -double phi(const Eigen::MatrixBase<Derived>& v) noexcept { +double +phi(const Eigen::MatrixBase<Derived>& v) noexcept { constexpr int rows = Eigen::MatrixBase<Derived>::RowsAtCompileTime; if constexpr (rows != -1) { // static size, do compile time check - static_assert(rows >= 2, - "Phi function not valid for vectors not at least 2D"); + static_assert( + rows >= 2, "Phi function not valid for vectors not at least 2D"); } else { // dynamic size if (v.rows() < 2) { @@ -97,9 +98,11 @@ double phi(const Eigen::MatrixBase<Derived>& v) noexcept { /// @tparam T anything that has a phi method /// @param v Any type that implements a phi method /// @return The phi value -template <typename T, - std::enable_if_t<detail::has_phi_method<T>::value, int> = 0> -double phi(const T& v) noexcept { +template < + typename T, + std::enable_if_t<detail::has_phi_method<T>::value, int> = 0> +double +phi(const T& v) noexcept { return v.phi(); } @@ -110,12 +113,13 @@ double phi(const T& v) noexcept { /// in case of dynamic size, will abort execution if that is not the case. /// @return The transverse radius value. template <typename Derived> -double perp(const Eigen::MatrixBase<Derived>& v) noexcept { +double +perp(const Eigen::MatrixBase<Derived>& v) noexcept { constexpr int rows = Eigen::MatrixBase<Derived>::RowsAtCompileTime; if constexpr (rows != -1) { // static size, do compile time check - static_assert(rows >= 2, - "Perp function not valid for vectors not at least 2D"); + static_assert( + rows >= 2, "Perp function not valid for vectors not at least 2D"); } else { // dynamic size if (v.rows() < 2) { @@ -134,7 +138,8 @@ double perp(const Eigen::MatrixBase<Derived>& v) noexcept { /// in case of dynamic size, will abort execution if that is not the case. /// @return The theta value template <typename Derived> -double theta(const Eigen::MatrixBase<Derived>& v) noexcept { +double +theta(const Eigen::MatrixBase<Derived>& v) noexcept { constexpr int rows = Eigen::MatrixBase<Derived>::RowsAtCompileTime; if constexpr (rows != -1) { // static size, do compile time check @@ -157,7 +162,8 @@ double theta(const Eigen::MatrixBase<Derived>& v) noexcept { /// in case of dynamic size, will abort execution if that is not the case. /// @return The pseudorapidity value template <typename Derived> -double eta(const Eigen::MatrixBase<Derived>& v) noexcept { +double +eta(const Eigen::MatrixBase<Derived>& v) noexcept { constexpr int rows = Eigen::MatrixBase<Derived>::RowsAtCompileTime; if constexpr (rows != -1) { // static size, do compile time check @@ -179,7 +185,8 @@ double eta(const Eigen::MatrixBase<Derived>& v) noexcept { /// @param [in] m Matrix that will be used for cross products /// @param [in] v Vector for cross products /// @return Constructed matrix -inline ActsMatrixD<3, 3> cross(const ActsMatrixD<3, 3>& m, const Vector3D& v) { +inline ActsMatrixD<3, 3> +cross(const ActsMatrixD<3, 3>& m, const Vector3D& v) { ActsMatrixD<3, 3> r; r.col(0) = m.col(0).cross(v); r.col(1) = m.col(1).cross(v); @@ -192,7 +199,8 @@ inline ActsMatrixD<3, 3> cross(const ActsMatrixD<3, 3>& m, const Vector3D& v) { /// /// @param spacePointVec The SpacePointVector /// @return Reference to the time component -inline ParValue_t& time(SpacePointVector& spacePointVec) { +inline ParValue_t& +time(SpacePointVector& spacePointVec) { return spacePointVec[3]; } @@ -201,7 +209,8 @@ inline ParValue_t& time(SpacePointVector& spacePointVec) { /// /// @param spacePointVec The SpacePointVector /// @return Reference to the time component -inline const ParValue_t& time(const SpacePointVector& spacePointVec) { +inline const ParValue_t& +time(const SpacePointVector& spacePointVec) { return spacePointVec[3]; } @@ -209,7 +218,8 @@ inline const ParValue_t& time(const SpacePointVector& spacePointVec) { /// /// @param boundVec The BoundVector /// @return Reference to the time component -inline ParValue_t& time(BoundVector& boundVec) { +inline ParValue_t& +time(BoundVector& boundVec) { return boundVec[eT]; } @@ -218,7 +228,8 @@ inline ParValue_t& time(BoundVector& boundVec) { /// /// @param boundVec The BoundVector /// @return Reference to the time component -inline const ParValue_t& time(const BoundVector& boundVec) { +inline const ParValue_t& +time(const BoundVector& boundVec) { return boundVec[eT]; } @@ -226,7 +237,8 @@ inline const ParValue_t& time(const BoundVector& boundVec) { /// /// @param freeVec The FreeVector /// @return Reference to the time component -inline ParValue_t& time(FreeVector& freeVec) { +inline ParValue_t& +time(FreeVector& freeVec) { return freeVec[7]; } @@ -235,7 +247,8 @@ inline ParValue_t& time(FreeVector& freeVec) { /// /// @param freeVec The FreeVector /// @return Reference to the time component -inline const ParValue_t& time(const FreeVector& freeVec) { +inline const ParValue_t& +time(const FreeVector& freeVec) { return freeVec[7]; } @@ -243,7 +256,8 @@ inline const ParValue_t& time(const FreeVector& freeVec) { /// /// @param spacePointVec The SpacePointVector /// @return Reference to the position components -inline auto position(SpacePointVector& spacePointVec) { +inline auto +position(SpacePointVector& spacePointVec) { return spacePointVec.head<3>(); } @@ -252,7 +266,8 @@ inline auto position(SpacePointVector& spacePointVec) { /// /// @param spacePointVec The SpacePointVector /// @return Reference to the position components -inline auto position(const SpacePointVector& spacePointVec) { +inline auto +position(const SpacePointVector& spacePointVec) { return spacePointVec.head<3>(); } @@ -261,7 +276,8 @@ inline auto position(const SpacePointVector& spacePointVec) { /// /// @param freeVec The SpacePointVector /// @return Reference to the position components -inline auto position(FreeVector& freeVec) { +inline auto +position(FreeVector& freeVec) { return freeVec.head<3>(); } @@ -270,7 +286,8 @@ inline auto position(FreeVector& freeVec) { /// /// @param freeVec The SpacePointVector /// @return Reference to the position components -inline auto position(const FreeVector& freeVec) { +inline auto +position(const FreeVector& freeVec) { return freeVec.head<3>(); } @@ -278,7 +295,8 @@ inline auto position(const FreeVector& freeVec) { namespace detail { -inline double roundWithPrecision(double val, int precision) { +inline double +roundWithPrecision(double val, int precision) { if (val < 0 && std::abs(val) * std::pow(10, precision) < 1.) { return -val; } @@ -291,8 +309,11 @@ inline double roundWithPrecision(double val, int precision) { /// @param precision Numeric output precision /// @param offset Offset in front of matrix lines /// @return The printed string -inline std::string toString(const ActsMatrixXd& matrix, int precision = 4, - const std::string& offset = "") { +inline std::string +toString( + const ActsMatrixXd& matrix, + int precision = 4, + const std::string& offset = "") { std::ostringstream sout; sout << std::setiosflags(std::ios::fixed) << std::setprecision(precision); @@ -334,8 +355,8 @@ inline std::string toString(const ActsMatrixXd& matrix, int precision = 4, /// @param matrix The translation to print /// @param precision Numeric output precision /// @return The printed string -inline std::string toString(const Acts::Translation3D& translation, - int precision = 4) { +inline std::string +toString(const Acts::Translation3D& translation, int precision = 4) { Acts::Vector3D trans; trans[0] = translation.x(); trans[1] = translation.y(); @@ -348,8 +369,11 @@ inline std::string toString(const Acts::Translation3D& translation, /// @param precision Numeric output precision /// @param offset Offset in front of matrix lines /// @return The printed string -inline std::string toString(const Acts::Transform3D& transform, - int precision = 4, const std::string& offset = "") { +inline std::string +toString( + const Acts::Transform3D& transform, + int precision = 4, + const std::string& offset = "") { std::ostringstream sout; sout << "Translation : " << toString(transform.translation(), precision) << std::endl; @@ -365,8 +389,8 @@ inline std::string toString(const Acts::Transform3D& transform, /// @param items The vector of @c shared_ptr /// @return The unpacked vector template <typename T> -std::vector<T*> unpack_shared_vector( - const std::vector<std::shared_ptr<T>>& items) { +std::vector<T*> +unpack_shared_vector(const std::vector<std::shared_ptr<T>>& items) { std::vector<T*> rawPtrs; rawPtrs.reserve(items.size()); for (const std::shared_ptr<T>& item : items) { @@ -381,8 +405,8 @@ std::vector<T*> unpack_shared_vector( /// @param items The vector of @c shared_ptr /// @return The unpacked vector template <typename T> -std::vector<const T*> unpack_shared_vector( - const std::vector<std::shared_ptr<const T>>& items) { +std::vector<const T*> +unpack_shared_vector(const std::vector<std::shared_ptr<const T>>& items) { std::vector<const T*> rawPtrs; rawPtrs.reserve(items.size()); for (const std::shared_ptr<const T>& item : items) { @@ -408,16 +432,20 @@ std::vector<const T*> unpack_shared_vector( /// @param args Additional arguments passed to @c Callable::invoke(). /// @note @c Callable is expected to have a static member function @c invoke /// that is callable with @c Args -template <template <size_t> class Callable, size_t N, size_t NMAX, - typename... Args> -decltype(Callable<N>::invoke(std::declval<Args>()...)) template_switch( - size_t v, Args&&... args) { +template < + template <size_t> + class Callable, + size_t N, + size_t NMAX, + typename... Args> +decltype(Callable<N>::invoke(std::declval<Args>()...)) +template_switch(size_t v, Args&&... args) { if (v == N) { return Callable<N>::invoke(std::forward<Args>(args)...); } if constexpr (N < NMAX) { - return template_switch<Callable, N + 1, NMAX>(v, - std::forward<Args>(args)...); + return template_switch<Callable, N + 1, NMAX>( + v, std::forward<Args>(args)...); } std::cerr << "template_switch<Fn, " << N << ", " << NMAX << ">(v=" << v << ") is not valid (v > NMAX)" << std::endl; diff --git a/Core/include/Acts/Utilities/IVisualization.hpp b/Core/include/Acts/Utilities/IVisualization.hpp index 68b0bc3a8..b7eb82de2 100644 --- a/Core/include/Acts/Utilities/IVisualization.hpp +++ b/Core/include/Acts/Utilities/IVisualization.hpp @@ -32,8 +32,9 @@ class IVisualization { * @param vtx The vertex position * @param color The color */ - virtual void vertex(const Vector3D& vtx, - color_type color = {120, 120, 120}) = 0; + virtual void vertex( + const Vector3D& vtx, + color_type color = {120, 120, 120}) = 0; /** * Draw a face that connects a list of vertices. @@ -42,8 +43,9 @@ class IVisualization { * @param vtxs The vertices that make up the face * @param color The color of the face */ - virtual void face(const std::vector<Vector3D>& vtxs, - color_type color = {120, 120, 120}) = 0; + virtual void face( + const std::vector<Vector3D>& vtxs, + color_type color = {120, 120, 120}) = 0; /** * Draw a line from a vertex to another @@ -51,8 +53,10 @@ class IVisualization { * @param b The end vertex * @param color The color of the line */ - virtual void line(const Vector3D& a, const Vector3D& b, - color_type color = {120, 120, 120}) = 0; + virtual void line( + const Vector3D& a, + const Vector3D& b, + color_type color = {120, 120, 120}) = 0; /** * Write the content of the helper to an outstream. @@ -74,7 +78,8 @@ class IVisualization { /** * @copydoc Acts::IVisualization::vertex(const Vector3D&, color_type) */ - void vertex(const Vector3F& vtx, color_type color = {120, 120, 120}) { + void + vertex(const Vector3F& vtx, color_type color = {120, 120, 120}) { Vector3D vtxd = vtx.template cast<double>(); vertex(vtxd, color); } @@ -82,11 +87,13 @@ class IVisualization { /** * @copydoc Acts::IVisualization::face(std::vector<Vector3F>&, color_type) */ - void face(const std::vector<Vector3F>& vtxs, - color_type color = {120, 120, 120}) { + void + face(const std::vector<Vector3F>& vtxs, color_type color = {120, 120, 120}) { std::vector<Vector3D> vtxsd; - std::transform(vtxs.begin(), vtxs.end(), std::back_inserter(vtxsd), - [](auto& v) { return v.template cast<double>(); }); + std::transform( + vtxs.begin(), vtxs.end(), std::back_inserter(vtxsd), [](auto& v) { + return v.template cast<double>(); + }); face(vtxsd, color); } @@ -94,8 +101,11 @@ class IVisualization { * @copydoc Acts::IVisualization::line(const Vector3F&, const Vector3F&, * color_type) */ - void line(const Vector3F& a, const Vector3F& b, - color_type color = {120, 120, 120}) { + void + line( + const Vector3F& a, + const Vector3F& b, + color_type color = {120, 120, 120}) { Vector3D ad = a.template cast<double>(); Vector3D bd = b.template cast<double>(); line(ad, bd, color); @@ -107,7 +117,8 @@ class IVisualization { * @param os The output stream * @param hlp The helper instance */ -inline std::ostream& operator<<(std::ostream& os, const IVisualization& hlp) { +inline std::ostream& +operator<<(std::ostream& os, const IVisualization& hlp) { hlp.write(os); return os; } diff --git a/Core/include/Acts/Utilities/Interpolation.hpp b/Core/include/Acts/Utilities/Interpolation.hpp index a70cbe1b0..3445bb3ca 100644 --- a/Core/include/Acts/Utilities/Interpolation.hpp +++ b/Core/include/Acts/Utilities/Interpolation.hpp @@ -70,17 +70,27 @@ namespace Acts { /// - (4,2,6): 101 = 5 /// - (4,5,3): 110 = 6 /// - (4,5,6): 111 = 7 -template <typename T, size_t N, class Point1, class Point2 = Point1, - class Point3 = Point2, - typename = std::enable_if_t< - detail::can_interpolate<Point1, Point2, Point3, T>::value>> -inline T interpolate(const Point1& position, const Point2& lowerCorner, - const Point3& upperCorner, - const std::array<T, N>& values) { - return detail::interpolate_impl<T, Point1, Point2, Point3, - detail::get_dimension<N>::value - 1, - N>::run(position, lowerCorner, upperCorner, - values); +template < + typename T, + size_t N, + class Point1, + class Point2 = Point1, + class Point3 = Point2, + typename = std::enable_if_t< + detail::can_interpolate<Point1, Point2, Point3, T>::value>> +inline T +interpolate( + const Point1& position, + const Point2& lowerCorner, + const Point3& upperCorner, + const std::array<T, N>& values) { + return detail::interpolate_impl< + T, + Point1, + Point2, + Point3, + detail::get_dimension<N>::value - 1, + N>::run(position, lowerCorner, upperCorner, values); } } // namespace Acts diff --git a/Core/include/Acts/Utilities/Intersection.hpp b/Core/include/Acts/Utilities/Intersection.hpp index 749580139..619c51a17 100644 --- a/Core/include/Acts/Utilities/Intersection.hpp +++ b/Core/include/Acts/Utilities/Intersection.hpp @@ -34,8 +34,11 @@ struct Intersection { /// @param slength is the path length to the intersection /// @param svalid is a boolean indicating if intersection is valid /// @param dist is the distance to the closes surface boundary - Intersection(const Vector3D& sinter, double slength, bool svalid, - double dist = 0.) + Intersection( + const Vector3D& sinter, + double slength, + bool svalid, + double dist = 0.) : position(sinter), pathLength(slength), distance(dist), valid(svalid) {} /// Default constructor @@ -49,7 +52,8 @@ struct Intersection { /// Smaller operator for sorting, /// - it respects the validity of the intersection /// @param si is the intersection for testing - bool operator<(const Intersection& si) const { + bool + operator<(const Intersection& si) const { if (!valid) { return false; } @@ -64,7 +68,8 @@ struct Intersection { /// Greater operator for sorting, /// - it respects the validity of the intersection /// @param si is the intersection for testing - bool operator>(const Intersection& si) const { + bool + operator>(const Intersection& si) const { if (!valid) { return false; } @@ -97,8 +102,10 @@ class ObjectIntersection { /// @param sInter is the intersection /// @param sObject is the object to be instersected /// @param dir is the direction of the intersection - ObjectIntersection(const Intersection& sInter, const object_t* sObject, - NavigationDirection dir = forward) + ObjectIntersection( + const Intersection& sInter, + const object_t* sObject, + NavigationDirection dir = forward) : intersection(sInter), object(sObject), representation(sObject), @@ -110,14 +117,16 @@ class ObjectIntersection { /// @brief smaller operator for ordering & sorting /// /// @param oi is the source intersection for comparison - bool operator<(const ObjectIntersection<object_t>& oi) const { + bool + operator<(const ObjectIntersection<object_t>& oi) const { return (intersection < oi.intersection); } /// @brief greater operator for ordering & sorting /// /// @param oi is the source intersection for comparison - bool operator>(const ObjectIntersection<object_t>& oi) const { + bool + operator>(const ObjectIntersection<object_t>& oi) const { return (intersection > oi.intersection); } }; @@ -144,9 +153,11 @@ class FullIntersection { /// @param sRepresentation is the surface representation of the object /// @param dir is the direction /// - FullIntersection(const Intersection& sInter, const object_t* sObject, - const representation_t* sRepresentation, - NavigationDirection dir = forward) + FullIntersection( + const Intersection& sInter, + const object_t* sObject, + const representation_t* sRepresentation, + NavigationDirection dir = forward) : intersection(sInter), object(sObject), representation(sRepresentation), @@ -158,14 +169,16 @@ class FullIntersection { /// @brief smaller operator for ordering & sorting /// /// @param fi is the full intersection to be tested - bool operator<(const FullIntersection<object_t, representation_t>& fi) const { + bool + operator<(const FullIntersection<object_t, representation_t>& fi) const { return (intersection < fi.intersection); } /// @brief greater operator for ordering & sorting /// /// @param fi is the full intersection to be tested - bool operator>(const FullIntersection<object_t, representation_t>& fi) const { + bool + operator>(const FullIntersection<object_t, representation_t>& fi) const { return (intersection > fi.intersection); } }; @@ -179,7 +192,8 @@ struct SameSurfaceIntersection { /// @param i1 First intersection to test /// @param i2 Second intersection to test template <typename intersection_t> - bool operator()(const intersection_t& i1, const intersection_t& i2) const { + bool + operator()(const intersection_t& i1, const intersection_t& i2) const { return (i1.object == i2.object); } }; @@ -193,15 +207,17 @@ struct VoidIntersectionCorrector { VoidIntersectionCorrector() = default; // Void Corrector parameter constructor - VoidIntersectionCorrector(const Vector3D& /*unused*/, - const Vector3D& /*unused*/, double /*unused*/) {} + VoidIntersectionCorrector( + const Vector3D& /*unused*/, + const Vector3D& /*unused*/, + double /*unused*/) {} /// Boolean() operator - returns false for void modifier explicit operator bool() const { return false; } /// empty correction interface - bool operator()(Vector3D& /*unused*/, Vector3D& /*unused*/, - double /*unused*/) { + bool + operator()(Vector3D& /*unused*/, Vector3D& /*unused*/, double /*unused*/) { return false; } @@ -209,7 +225,8 @@ struct VoidIntersectionCorrector { /// /// @stay put and don't do antyhing template <typename step_t> - bool operator()(step_t& /*unused*/) const { + bool + operator()(step_t& /*unused*/) const { return false; } }; diff --git a/Core/include/Acts/Utilities/Logger.hpp b/Core/include/Acts/Utilities/Logger.hpp index 72315d5c2..14b116233 100644 --- a/Core/include/Acts/Utilities/Logger.hpp +++ b/Core/include/Acts/Utilities/Logger.hpp @@ -230,7 +230,8 @@ class OutStream final { /// /// @param [in] input content added to the stream template <typename T> - OutStream& operator<<(T&& input) { + OutStream& + operator<<(T&& input) { m_stream << std::forward<T>(input); return *this; } @@ -241,7 +242,8 @@ class OutStream final { /// /// @param [in] f stream modifier template <typename T> - OutStream& operator<<(T& (*f)(T&)) { + OutStream& + operator<<(T& (*f)(T&)) { f(m_stream); return *this; } @@ -273,7 +275,10 @@ class DefaultFilterPolicy final : public OutputFilterPolicy { /// @param [in] lvl debug level of debug message /// /// @return @c true if @p lvl >= #m_level, otherwise @c false - bool doPrint(const Level& lvl) const override { return m_level <= lvl; } + bool + doPrint(const Level& lvl) const override { + return m_level <= lvl; + } private: /// threshold debug level for messages to be processed @@ -301,7 +306,8 @@ class OutputDecorator : public OutputPrintPolicy { /// /// This function delegates the flushing of the debug message to its wrapped /// object. - void flush(const Level& lvl, const std::ostringstream& input) override { + void + flush(const Level& lvl, const std::ostringstream& input) override { m_wrappee->flush(lvl, input); } @@ -320,8 +326,10 @@ class NamedOutputDecorator final : public OutputDecorator { /// @param [in] wrappee output print policy object to be wrapped /// @param [in] name name to be added to debug message /// @param [in] maxWidth maximum width of field used for name - NamedOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, - const std::string& name, unsigned int maxWidth = 15) + NamedOutputDecorator( + std::unique_ptr<OutputPrintPolicy> wrappee, + const std::string& name, + unsigned int maxWidth = 15) : OutputDecorator(std::move(wrappee)), m_name(name), m_maxWidth(maxWidth) {} @@ -333,7 +341,8 @@ class NamedOutputDecorator final : public OutputDecorator { /// /// This function prepends the given name to the debug message and then /// delegates the flushing of the whole message to its wrapped object. - void flush(const Level& lvl, const std::ostringstream& input) override { + void + flush(const Level& lvl, const std::ostringstream& input) override { std::ostringstream os; os << std::left << std::setw(m_maxWidth) << m_name.substr(0, m_maxWidth - 3) << input.str(); @@ -357,8 +366,9 @@ class TimedOutputDecorator final : public OutputDecorator { /// /// @param [in] wrappee output print policy object to be wrapped /// @param [in] format format of time stamp (see std::strftime) - TimedOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, - const std::string& format = "%X") + TimedOutputDecorator( + std::unique_ptr<OutputPrintPolicy> wrappee, + const std::string& format = "%X") : OutputDecorator(std::move(wrappee)), m_format(format) {} /// @brief flush the debug message to the destination stream @@ -368,7 +378,8 @@ class TimedOutputDecorator final : public OutputDecorator { /// /// This function prepends a time stamp to the debug message and then /// delegates the flushing of the whole message to its wrapped object. - void flush(const Level& lvl, const std::ostringstream& input) override { + void + flush(const Level& lvl, const std::ostringstream& input) override { std::ostringstream os; os << std::left << std::setw(12) << now() << input.str(); OutputDecorator::flush(lvl, os); @@ -378,7 +389,8 @@ class TimedOutputDecorator final : public OutputDecorator { /// @brief get current time stamp /// /// @return current time stamp as string - std::string now() const { + std::string + now() const { char buffer[20]; time_t t; std::time(&t); @@ -408,7 +420,8 @@ class ThreadOutputDecorator final : public OutputDecorator { /// /// This function prepends the thread ID to the debug message and then /// delegates the flushing of the whole message to its wrapped object. - void flush(const Level& lvl, const std::ostringstream& input) override { + void + flush(const Level& lvl, const std::ostringstream& input) override { std::ostringstream os; os << std::left << std::setw(20) << std::this_thread::get_id() << input.str(); @@ -434,7 +447,8 @@ class LevelOutputDecorator final : public OutputDecorator { /// /// This function prepends the debug level to the debug message and then /// delegates the flushing of the whole message to its wrapped object. - void flush(const Level& lvl, const std::ostringstream& input) override { + void + flush(const Level& lvl, const std::ostringstream& input) override { std::ostringstream os; os << std::left << std::setw(10) << toString(lvl) << input.str(); OutputDecorator::flush(lvl, os); @@ -446,9 +460,10 @@ class LevelOutputDecorator final : public OutputDecorator { /// @param [in] lvl debug level /// /// @return string representation of debug level - std::string toString(const Level& lvl) const { - static const char* const buffer[] = {"VERBOSE", "DEBUG", "INFO", - "WARNING", "ERROR", "FATAL"}; + std::string + toString(const Level& lvl) const { + static const char* const buffer[] = { + "VERBOSE", "DEBUG", "INFO", "WARNING", "ERROR", "FATAL"}; return buffer[lvl]; } }; @@ -470,7 +485,8 @@ class DefaultPrintPolicy final : public OutputPrintPolicy { /// /// @param [in] lvl debug level of debug message /// @param [in] input text of debug message - void flush(const Level& /*lvl*/, const std::ostringstream& input) final { + void + flush(const Level& /*lvl*/, const std::ostringstream& input) final { (*m_out) << input.str() << std::endl; } @@ -492,8 +508,9 @@ class Logger { /// /// @param [in] pPrint policy for printing debug messages /// @param [in] pFilter policy for filtering debug messages - Logger(std::unique_ptr<Logging::OutputPrintPolicy> pPrint, - std::unique_ptr<Logging::OutputFilterPolicy> pFilter) + Logger( + std::unique_ptr<Logging::OutputPrintPolicy> pPrint, + std::unique_ptr<Logging::OutputFilterPolicy> pFilter) : m_printPolicy(std::move(pPrint)), m_filterPolicy(std::move(pFilter)) {} /// @brief decide whether a message with a given debug level has to be printed @@ -501,7 +518,8 @@ class Logger { /// @param [in] lvl debug level of debug message /// /// @return @c true if debug message should be printed, otherwise @c false - bool doPrint(const Logging::Level& lvl) const { + bool + doPrint(const Logging::Level& lvl) const { return m_filterPolicy->doPrint(lvl); } @@ -515,10 +533,13 @@ class Logger { /// of scope. /// /// @return output stream object with internal cache for debug message - Logging::OutStream log(const Logging::Level& lvl) const { - return Logging::OutStream(std::bind(&Logging::OutputPrintPolicy::flush, - m_printPolicy.get(), lvl, - std::placeholders::_1)); + Logging::OutStream + log(const Logging::Level& lvl) const { + return Logging::OutStream(std::bind( + &Logging::OutputPrintPolicy::flush, + m_printPolicy.get(), + lvl, + std::placeholders::_1)); } private: @@ -543,7 +564,8 @@ class Logger { /// /// @return pointer to logging instance std::unique_ptr<const Logger> getDefaultLogger( - const std::string& name, const Logging::Level& lvl, + const std::string& name, + const Logging::Level& lvl, std::ostream* log_stream = &std::cout); } // namespace Acts diff --git a/Core/include/Acts/Utilities/ObjHelper.hpp b/Core/include/Acts/Utilities/ObjHelper.hpp index c45abf648..543848ee5 100644 --- a/Core/include/Acts/Utilities/ObjHelper.hpp +++ b/Core/include/Acts/Utilities/ObjHelper.hpp @@ -20,8 +20,9 @@ namespace Acts { template <typename T = double> class ObjHelper : public IVisualization { public: - static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>, - "Use either double or float"); + static_assert( + std::is_same_v<T, double> || std::is_same_v<T, float>, + "Use either double or float"); /** * Stored value type, should be double or float @@ -41,8 +42,9 @@ class ObjHelper : public IVisualization { /** * @copydoc Acts::IVisualization::vertex() */ - void vertex(const Vector3D& vtx, - IVisualization::color_type color = {0, 0, 0}) override { + void + vertex(const Vector3D& vtx, IVisualization::color_type color = {0, 0, 0}) + override { (void)color; // suppress unused warning m_vertices.push_back(vtx.template cast<value_type>()); } @@ -51,8 +53,11 @@ class ObjHelper : public IVisualization { * @copydoc Acts::IVisualization::line() * @note This function ist not implemented for the OBJ format. */ - void line(const Vector3D& /*a*/, const Vector3D& /*b*/, - IVisualization::color_type color = {0, 0, 0}) override { + void + line( + const Vector3D& /*a*/, + const Vector3D& /*b*/, + IVisualization::color_type color = {0, 0, 0}) override { (void)color; // suppress unused warning // not implemented throw std::runtime_error("Line not implemented for OBJ"); @@ -61,8 +66,10 @@ class ObjHelper : public IVisualization { /** * @copydoc Acts::IVisualization::face() */ - void face(const std::vector<Vector3D>& vtxs, - IVisualization::color_type color = {0, 0, 0}) override { + void + face( + const std::vector<Vector3D>& vtxs, + IVisualization::color_type color = {0, 0, 0}) override { (void)color; // suppress unused warning face_type idxs; idxs.reserve(vtxs.size()); @@ -76,7 +83,8 @@ class ObjHelper : public IVisualization { /** * @copydoc Acts::IVisualization::write() */ - void write(std::ostream& os) const override { + void + write(std::ostream& os) const override { for (const vertex_type& vtx : m_vertices) { os << "v " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n"; } @@ -93,7 +101,8 @@ class ObjHelper : public IVisualization { /** * @copydoc Acts::IVisualization::clear() */ - void clear() override { + void + clear() override { m_vertices.clear(); m_faces.clear(); } diff --git a/Core/include/Acts/Utilities/ParameterDefinitions.hpp b/Core/include/Acts/Utilities/ParameterDefinitions.hpp index 0eb272ee8..857d98004 100644 --- a/Core/include/Acts/Utilities/ParameterDefinitions.hpp +++ b/Core/include/Acts/Utilities/ParameterDefinitions.hpp @@ -15,40 +15,53 @@ #include <type_traits> /// typedefs for parameter identifier and parameter value must be present -static_assert(std::is_enum<Acts::ParID_t>::value, - "'ParID_t' is not an enum type"); -static_assert(std::is_floating_point<Acts::ParValue_t>::value, - "'ParValue_t' is not floating point type"); +static_assert( + std::is_enum<Acts::ParID_t>::value, + "'ParID_t' is not an enum type"); +static_assert( + std::is_floating_point<Acts::ParValue_t>::value, + "'ParValue_t' is not floating point type"); /// parameter ID type must be convertible to size_t -static_assert(std::is_convertible<Acts::ParID_t, size_t>::value, - "'ParID_t' is not convertible to size_t"); +static_assert( + std::is_convertible<Acts::ParID_t, size_t>::value, + "'ParID_t' is not convertible to size_t"); /// number of global parameter must be at least 2 (for the two local parameters) -static_assert(Acts::BoundParsDim > 1, - "total number of global parameters must be >= 2"); +static_assert( + Acts::BoundParsDim > 1, + "total number of global parameters must be >= 2"); /// several constants for the local parameters need to be defined -static_assert(Acts::eLOC_0 != Acts::eLOC_1, - "local parameters must have different IDs"); -static_assert(Acts::eLOC_R == Acts::eLOC_0 or Acts::eLOC_R == Acts::eLOC_1, - "local radius must be a local parameter"); -static_assert(Acts::eLOC_PHI == Acts::eLOC_0 or Acts::eLOC_PHI == Acts::eLOC_1, - "local phi must be a local parameter"); -static_assert(Acts::eLOC_RPHI == Acts::eLOC_0 or - Acts::eLOC_RPHI == Acts::eLOC_1, - "local r x phi must be a local parameter"); -static_assert(Acts::eLOC_Z == Acts::eLOC_0 or Acts::eLOC_Z == Acts::eLOC_1, - "local z must be a local parameter"); -static_assert(Acts::eLOC_X == Acts::eLOC_0 or Acts::eLOC_X == Acts::eLOC_1, - "local x must be a local parameter"); -static_assert(Acts::eLOC_Y == Acts::eLOC_0 or Acts::eLOC_Y == Acts::eLOC_1, - "local y must be a local parameter"); -static_assert(Acts::eLOC_D0 == Acts::eLOC_0 or Acts::eLOC_D0 == Acts::eLOC_1, - "d0 must be a local parameter"); -static_assert(Acts::eLOC_Z0 == Acts::eLOC_0 or Acts::eLOC_Z0 == Acts::eLOC_1, - "z0 must be a local parameter"); +static_assert( + Acts::eLOC_0 != Acts::eLOC_1, + "local parameters must have different IDs"); +static_assert( + Acts::eLOC_R == Acts::eLOC_0 or Acts::eLOC_R == Acts::eLOC_1, + "local radius must be a local parameter"); +static_assert( + Acts::eLOC_PHI == Acts::eLOC_0 or Acts::eLOC_PHI == Acts::eLOC_1, + "local phi must be a local parameter"); +static_assert( + Acts::eLOC_RPHI == Acts::eLOC_0 or Acts::eLOC_RPHI == Acts::eLOC_1, + "local r x phi must be a local parameter"); +static_assert( + Acts::eLOC_Z == Acts::eLOC_0 or Acts::eLOC_Z == Acts::eLOC_1, + "local z must be a local parameter"); +static_assert( + Acts::eLOC_X == Acts::eLOC_0 or Acts::eLOC_X == Acts::eLOC_1, + "local x must be a local parameter"); +static_assert( + Acts::eLOC_Y == Acts::eLOC_0 or Acts::eLOC_Y == Acts::eLOC_1, + "local y must be a local parameter"); +static_assert( + Acts::eLOC_D0 == Acts::eLOC_0 or Acts::eLOC_D0 == Acts::eLOC_1, + "d0 must be a local parameter"); +static_assert( + Acts::eLOC_Z0 == Acts::eLOC_0 or Acts::eLOC_Z0 == Acts::eLOC_1, + "z0 must be a local parameter"); /// check for par_type_t definition -static_assert(sizeof(Acts::par_type_t<Acts::eLOC_0>) > 0, - "'par_type_t' is not defined"); \ No newline at end of file +static_assert( + sizeof(Acts::par_type_t<Acts::eLOC_0>) > 0, + "'par_type_t' is not defined"); \ No newline at end of file diff --git a/Core/include/Acts/Utilities/ParameterTypes.hpp b/Core/include/Acts/Utilities/ParameterTypes.hpp index e97d52563..9e5e0294f 100644 --- a/Core/include/Acts/Utilities/ParameterTypes.hpp +++ b/Core/include/Acts/Utilities/ParameterTypes.hpp @@ -27,12 +27,14 @@ struct unbound_parameter { /// @return identical input parameter value /// template <typename T> - static T getValue(const T& input) { + static T + getValue(const T& input) { return input; } template <typename T> - static T getDifference(const T& first, const T& second) { + static T + getDifference(const T& first, const T& second) { return first - second; } }; @@ -72,12 +74,14 @@ struct bound_parameter { /// @c bound_parameter<U,MIN,MAX>::max. /// template <typename U> - static U getValue(const U& input) { + static U + getValue(const U& input) { return (input > max) ? max : ((input < min) ? min : input); } template <typename U> - static U getDifference(const U& first, const U& second) { + static U + getDifference(const U& first, const U& second) { return getValue(first) - getValue(second); } }; @@ -112,7 +116,8 @@ struct cyclic_parameter { /// parameter type. /// template <typename U> - static U getValue(const U& input) { + static U + getValue(const U& input) { if (min <= input && input < max) { return input; } else { @@ -121,12 +126,13 @@ struct cyclic_parameter { } template <typename U> - static U getDifference(const U& first, const U& second) { + static U + getDifference(const U& first, const U& second) { static constexpr U half_period = (max - min) / 2; U tmp = getValue(first) - getValue(second); - return (tmp < -half_period - ? tmp + 2 * half_period - : (tmp > half_period ? tmp - 2 * half_period : tmp)); + return ( + tmp < -half_period ? tmp + 2 * half_period + : (tmp > half_period ? tmp - 2 * half_period : tmp)); } }; diff --git a/Core/include/Acts/Utilities/PlyHelper.hpp b/Core/include/Acts/Utilities/PlyHelper.hpp index 2b75bb687..225babbac 100644 --- a/Core/include/Acts/Utilities/PlyHelper.hpp +++ b/Core/include/Acts/Utilities/PlyHelper.hpp @@ -16,8 +16,9 @@ namespace Acts { template <typename T = double> class PlyHelper : public IVisualization { public: - static_assert(std::is_same_v<T, double> || std::is_same_v<T, float>, - "Use either double or float"); + static_assert( + std::is_same_v<T, double> || std::is_same_v<T, float>, + "Use either double or float"); /** * Stored value type, should be double or float @@ -37,16 +38,20 @@ class PlyHelper : public IVisualization { /** * @copydoc Acts::IVisualization::vertex() */ - void vertex(const Vector3D& vtx, - IVisualization::color_type color = {120, 120, 120}) override { + void + vertex( + const Vector3D& vtx, + IVisualization::color_type color = {120, 120, 120}) override { m_vertices.emplace_back(vtx.template cast<value_type>(), color); } /** * @copydoc Acts::IVisualization::line() */ - void face(const std::vector<Vector3D>& vtxs, - IVisualization::color_type color = {120, 120, 120}) override { + void + face( + const std::vector<Vector3D>& vtxs, + IVisualization::color_type color = {120, 120, 120}) override { face_type idxs; idxs.reserve(vtxs.size()); for (const auto& vtx : vtxs) { @@ -59,8 +64,11 @@ class PlyHelper : public IVisualization { /** * @copydoc Acts::IVisualization::face() */ - void line(const Vector3D& a, const Vector3D& b, - IVisualization::color_type color = {120, 120, 120}) override { + void + line( + const Vector3D& a, + const Vector3D& b, + IVisualization::color_type color = {120, 120, 120}) override { vertex(a, color); size_t idx_a = m_vertices.size() - 1; vertex(b, color); @@ -71,7 +79,8 @@ class PlyHelper : public IVisualization { /** * @copydoc Acts::IVisualization::write() */ - void write(std::ostream& os) const override { + void + write(std::ostream& os) const override { os << "ply\n"; os << "format ascii 1.0\n"; os << "element vertex " << m_vertices.size() << "\n"; @@ -119,7 +128,8 @@ class PlyHelper : public IVisualization { /** * @copydoc Acts::IVisualization::clear() */ - void clear() override { + void + clear() override { m_vertices.clear(); m_faces.clear(); m_edges.clear(); diff --git a/Core/include/Acts/Utilities/Ray.hpp b/Core/include/Acts/Utilities/Ray.hpp index 5f4369306..c5241d259 100644 --- a/Core/include/Acts/Utilities/Ray.hpp +++ b/Core/include/Acts/Utilities/Ray.hpp @@ -36,15 +36,24 @@ class Ray { /// Getter for the origin /// @return The origin - const vertex_type& origin() const { return m_origin; } + const vertex_type& + origin() const { + return m_origin; + } /// Getter for the direction /// @return The direction - const vertex_type& dir() const { return m_dir; } + const vertex_type& + dir() const { + return m_dir; + } /// Getter for the element wise inverse of the direction. /// @return The element wise inverse. - const vertex_array_type& idir() const { return m_idir; } + const vertex_array_type& + idir() const { + return m_idir; + } /// Transforms this ray using a given transform and returns a new instance /// @param trf The transform to apply @@ -73,7 +82,8 @@ class Ray { /// @param ray The ray to write to @p os /// @return The outstream given in @p os template <typename T, size_t D> -std::ostream& operator<<(std::ostream& os, const Ray<T, D>& ray) { +std::ostream& +operator<<(std::ostream& os, const Ray<T, D>& ray) { ray.dump(os); return os; } diff --git a/Core/include/Acts/Utilities/Ray.ipp b/Core/include/Acts/Utilities/Ray.ipp index 335e407be..cfe40c45e 100644 --- a/Core/include/Acts/Utilities/Ray.ipp +++ b/Core/include/Acts/Utilities/Ray.ipp @@ -12,7 +12,8 @@ template <typename value_t, size_t DIM> Acts::Ray<value_t, DIM>::Ray(const vertex_type& origin, const vertex_type& dir) : m_origin(origin), m_dir(dir.normalized()), m_idir(1 / m_dir.array()) {} template <typename value_t, size_t DIM> -std::ostream& Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const { +std::ostream& +Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const { os << "Ray("; for (size_t i = 0; i < DIM; i++) { if (i > 0) { @@ -33,22 +34,24 @@ std::ostream& Acts::Ray<value_t, DIM>::toStream(std::ostream& os) const { } template <typename value_t, size_t DIM> -Acts::Ray<value_t, DIM> Acts::Ray<value_t, DIM>::transformed( - const transform_type& trf) const { +Acts::Ray<value_t, DIM> +Acts::Ray<value_t, DIM>::transformed(const transform_type& trf) const { return Ray<value_t, DIM>(trf * m_origin, trf.rotation() * m_dir); } template <typename value_t, size_t DIM> template <size_t D, std::enable_if_t<D == 3, int>> -void Acts::Ray<value_t, DIM>::draw(IVisualization& helper, - value_type far_distance) const { +void +Acts::Ray<value_t, DIM>::draw(IVisualization& helper, value_type far_distance) + const { static_assert(DIM == 3, "OBJ is only supported in 3D"); helper.line(m_origin, (m_origin + m_dir * far_distance).eval()); } template <typename U, size_t V> -std::ostream& operator<<(std::ostream& os, const Acts::Ray<U, V>& ray) { +std::ostream& +operator<<(std::ostream& os, const Acts::Ray<U, V>& ray) { ray.dump(os); return os; } diff --git a/Core/include/Acts/Utilities/Result.hpp b/Core/include/Acts/Utilities/Result.hpp index e18937b86..645f761cc 100644 --- a/Core/include/Acts/Utilities/Result.hpp +++ b/Core/include/Acts/Utilities/Result.hpp @@ -56,7 +56,8 @@ class Result { * @param other The other result instance, rvalue reference * @return The assigned instance */ - Result<T, E>& operator=(Result<T, E>&& other) { + Result<T, E>& + operator=(Result<T, E>&& other) { m_var = std::move(other.m_var); return *this; } @@ -75,10 +76,13 @@ class Result { * @param value The potential value, could be an actual valid value or an * error. */ - template <typename T2, typename _E = E, typename _T = T, - typename = std::enable_if_t<!std::is_same_v<_T, _E> && - !std::is_constructible_v<_T, _E> && - !std::is_constructible_v<_E, _T>>> + template < + typename T2, + typename _E = E, + typename _T = T, + typename = std::enable_if_t< + !std::is_same_v<_T, _E> && !std::is_constructible_v<_T, _E> && + !std::is_constructible_v<_E, _T>>> Result(T2 value) noexcept : m_var(std::move(value)) {} /** @@ -90,11 +94,15 @@ class Result { * error. * @return The assigned instance */ - template <typename T2, typename _E = E, typename _T = T, - typename = std::enable_if_t<!std::is_same_v<_T, _E> && - !std::is_constructible_v<_T, _E> && - !std::is_constructible_v<_E, _T>>> - Result<T, E>& operator=(T2 value) noexcept { + template < + typename T2, + typename _E = E, + typename _T = T, + typename = std::enable_if_t< + !std::is_same_v<_T, _E> && !std::is_constructible_v<_T, _E> && + !std::is_constructible_v<_E, _T>>> + Result<T, E>& + operator=(T2 value) noexcept { m_var = std::move(value); return *this; } @@ -104,7 +112,8 @@ class Result { * @param value The valid value to assign. Will not be converted to E. * @return Initialized result object */ - static Result<T, E> success(T value) { + static Result<T, E> + success(T value) { return Result<T, E>( std::variant<T, E>{std::in_place_index<0>, std::move(value)}); } @@ -114,7 +123,8 @@ class Result { * @param value The error to assign. Will not be converted to T. * @return Initialized result object */ - static Result<T, E> failure(E error) { + static Result<T, E> + failure(E error) { return Result<T, E>( std::variant<T, E>{std::in_place_index<1>, std::move(error)}); } @@ -123,7 +133,10 @@ class Result { * Checks whether this result contains a valid value, and no error. * @return bool Whether result contains an error or not. */ - bool ok() const noexcept { return m_var.index() == 0; } + bool + ok() const noexcept { + return m_var.index() == 0; + } /** * Returns a reference into the variant to the valid value. @@ -137,21 +150,30 @@ class Result { * @note If `res.ok()` this method will abort (noexcept) * @return Reference to the error */ - E& error() & noexcept { return std::get<E>(m_var); } + E& + error() & + noexcept { + return std::get<E>(m_var); + } /** * Returns the error by-value. * @note If `res.ok()` this method will abort (noexcept) * @return The error */ - E error() && noexcept { return std::move(std::get<E>(m_var)); } + E + error() && + noexcept { + return std::move(std::get<E>(m_var)); + } /** * Retrieves the valid value from the result object. * @note This is the lvalue version, returns a reference to the value * @return The valid value as a reference */ - T& value() & { + T& + value() & { if (m_var.index() != 0) { if constexpr (std::is_same_v<E, std::error_code>) { std::stringstream ss; @@ -173,7 +195,8 @@ class Result { * by-value and moves out of the variant. * @return The valid value by value, moved out of the variant. */ - T value() && { + T + value() && { if (m_var.index() != 0) { if constexpr (std::is_same_v<E, std::error_code>) { std::stringstream ss; @@ -234,7 +257,8 @@ class Result<void, E> { * Move assignment operator * @param other The other result object, rvalue ref */ - Result<void, E>& operator=(Result<void, E>&& other) noexcept { + Result<void, E>& + operator=(Result<void, E>&& other) noexcept { m_opt = std::move(other.m_opt); return *this; } @@ -254,7 +278,8 @@ class Result<void, E> { * @return The assigned instance */ template <typename E2> - Result<void, E>& operator=(E2 error) { + Result<void, E>& + operator=(E2 error) { m_opt = std::move(error); return *this; } @@ -263,14 +288,18 @@ class Result<void, E> { * Static factory function to initialize the result in the ok state. * @return Result object, in ok state */ - static Result<void, E> success() { return Result<void, E>(); } + static Result<void, E> + success() { + return Result<void, E>(); + } /** * Static factory function to initialize the result in the error state. * @param error The errorr to initialize with. * @return Result object, in error state. */ - static Result<void, E> failure(E error) { + static Result<void, E> + failure(E error) { return Result<void, E>(std::move(error)); } @@ -278,21 +307,32 @@ class Result<void, E> { * Checks whether this result is in the ok state, and no error. * @return bool Whether result contains an error or not. */ - bool ok() const noexcept { return !m_opt; } + bool + ok() const noexcept { + return !m_opt; + } /** * Returns a reference to the error stored in the result. * @note If `res.ok()` this method will abort (noexcept) * @return Reference to the error */ - E& error() & noexcept { return *m_opt; } + E& + error() & + noexcept { + return *m_opt; + } /** * Returns the error by-value. * @note If `res.ok()` this method will abort (noexcept) * @return Reference to the error */ - E error() && noexcept { return std::move(*m_opt); } + E + error() && + noexcept { + return std::move(*m_opt); + } private: std::optional<E> m_opt; diff --git a/Core/include/Acts/Utilities/ThrowAssert.hpp b/Core/include/Acts/Utilities/ThrowAssert.hpp index 419dc11f3..86183794f 100644 --- a/Core/include/Acts/Utilities/ThrowAssert.hpp +++ b/Core/include/Acts/Utilities/ThrowAssert.hpp @@ -31,7 +31,8 @@ class AssertionFailureException : public std::exception { /// @tparam T type of anything /// @param value const ref to anything template <typename T> - StreamFormatter& operator<<(const T& value) { + StreamFormatter& + operator<<(const T& value) { stream << value; return *this; } @@ -42,9 +43,11 @@ class AssertionFailureException : public std::exception { /// @param file The current file /// @param line The current line /// @param msg The message to print if assertion fails - AssertionFailureException(const std::string& expression, - const std::string& file, int line, - const std::string& msg) { + AssertionFailureException( + const std::string& expression, + const std::string& file, + int line, + const std::string& msg) { std::ostringstream os; if (!msg.empty()) { @@ -58,7 +61,10 @@ class AssertionFailureException : public std::exception { } /// The assertion message - const char* what() const throw() override { return report.c_str(); } + const char* + what() const throw() override { + return report.c_str(); + } private: std::string report; @@ -69,6 +75,8 @@ class AssertionFailureException : public std::exception { #define throw_assert(EXPRESSION, MESSAGE) \ if (!(EXPRESSION)) { \ throw Acts::AssertionFailureException( \ - #EXPRESSION, __FILE__, __LINE__, \ + #EXPRESSION, \ + __FILE__, \ + __LINE__, \ (Acts::AssertionFailureException::StreamFormatter() << MESSAGE)); \ } diff --git a/Core/include/Acts/Utilities/TypeTraits.hpp b/Core/include/Acts/Utilities/TypeTraits.hpp index d7ff64549..2878be75f 100644 --- a/Core/include/Acts/Utilities/TypeTraits.hpp +++ b/Core/include/Acts/Utilities/TypeTraits.hpp @@ -61,8 +61,12 @@ struct nonesuch { * @tparam Op The operation to test * @tparam Args Arguments to the operation */ -template <class Default, class AlwaysVoid, template <class...> class Op, - class... Args> +template < + class Default, + class AlwaysVoid, + template <class...> + class Op, + class... Args> struct detector { using value_t = std::false_type; using type = Default; @@ -202,8 +206,12 @@ namespace concept { * @tparam M The method trait, as generated by METHOD_TRAIT * @tparam Arguments The argument types that make up the signature. */ - template <typename T, typename R, template <class...> class M, - typename... Arguments> + template < + typename T, + typename R, + template <class...> + class M, + typename... Arguments> constexpr bool has_method = M<T, R, Arguments...>::template tv<T>::value; /** @@ -399,9 +407,11 @@ namespace concept { static constexpr bool value = false; \ }; \ template <typename T_> \ - struct tv<T_, std::enable_if_t< \ - is_detected_exact<R, qual_ret, T_, Arguments...>::value, \ - int>> { \ + struct tv< \ + T_, \ + std::enable_if_t< \ + is_detected_exact<R, qual_ret, T_, Arguments...>::value, \ + int>> { \ /* This is only ever evaluate if the method exists!*/ \ static constexpr bool value = \ is_detected<fptr_meta_t, T, Arguments...>::value; \ diff --git a/Core/include/Acts/Utilities/detail/Axis.hpp b/Core/include/Acts/Utilities/detail/Axis.hpp index d418d3369..49f9f573f 100644 --- a/Core/include/Acts/Utilities/detail/Axis.hpp +++ b/Core/include/Acts/Utilities/detail/Axis.hpp @@ -65,7 +65,8 @@ class NeighborHoodIndices { size_t operator*() const { return m_current; } - iterator& operator++() { + iterator& + operator++() { ++m_current; if (m_current == m_end1) { m_current = m_begin2; @@ -74,26 +75,40 @@ class NeighborHoodIndices { return *this; } - bool operator==(const iterator& it) const { + bool + operator==(const iterator& it) const { return (m_current == it.m_current) && (m_wrapped == it.m_wrapped); } - bool operator!=(const iterator& it) const { return !(*this == it); } + bool + operator!=(const iterator& it) const { + return !(*this == it); + } private: size_t m_current, m_end1, m_begin2; bool m_wrapped; }; - iterator begin() const { return iterator(m_begin1, m_end1, m_begin2); } + iterator + begin() const { + return iterator(m_begin1, m_end1, m_begin2); + } - iterator end() const { return iterator(m_end2); } + iterator + end() const { + return iterator(m_end2); + } // Number of indices that will be produced if this sequence is iterated - size_t size() const { return (m_end1 - m_begin1) + (m_end2 - m_begin2); } + size_t + size() const { + return (m_end1 - m_begin1) + (m_end2 - m_begin2); + } // Collect the sequence of indices into an std::vector - std::vector<size_t> collect() const { + std::vector<size_t> + collect() const { std::vector<size_t> result; result.reserve(this->size()); for (size_t idx : *this) { @@ -147,17 +162,26 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// @brief returns whether the axis is equidistant /// /// @return bool is equidistant - bool isEquidistant() const override { return true; } + bool + isEquidistant() const override { + return true; + } /// @brief returns whether the axis is variable /// /// @return bool is variable - bool isVariable() const override { return false; } + bool + isVariable() const override { + return false; + } /// @brief returns the boundary type set in the template param /// /// @return @c AxisBoundaryType of this axis - AxisBoundaryType getBoundaryType() const override { return bdt; } + AxisBoundaryType + getBoundaryType() const override { + return bdt; + } /// @brief Get #size bins which neighbor the one given /// @@ -166,7 +190,8 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// @param [in] idx requested bin index /// @param [in] sizes how many neighboring bins (up/down) /// @return Set of neighboring bin indices (global) - NeighborHoodIndices neighborHoodIndices(size_t idx, size_t size = 1) const { + NeighborHoodIndices + neighborHoodIndices(size_t idx, size_t size = 1) const { return neighborHoodIndices(idx, std::make_pair(size, size)); } @@ -180,11 +205,12 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// @note Open varies given bin and allows 0 and NBins+1 (underflow, /// overflow) /// as neighbors - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> - NeighborHoodIndices neighborHoodIndices(size_t idx, - std::pair<size_t, size_t> sizes = { - 1, 1}) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> + NeighborHoodIndices + neighborHoodIndices(size_t idx, std::pair<size_t, size_t> sizes = {1, 1}) + const { constexpr int min = 0; const int max = getNBins() + 1; const int itmin = std::max(min, int(idx - sizes.first)); @@ -201,11 +227,12 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// @return Set of neighboring bin indices (global) /// @note Bound varies given bin and allows 1 and NBins (regular bins) /// as neighbors - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> - NeighborHoodIndices neighborHoodIndices(size_t idx, - std::pair<size_t, size_t> sizes = { - 1, 1}) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> + NeighborHoodIndices + neighborHoodIndices(size_t idx, std::pair<size_t, size_t> sizes = {1, 1}) + const { if (idx <= 0 || idx >= (getNBins() + 1)) { return NeighborHoodIndices(); } @@ -225,11 +252,12 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// @return Set of neighboring bin indices (global) /// @note Closed varies given bin and allows bins on the opposite /// side of the axis as neighbors. (excludes underflow / overflow) - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> - NeighborHoodIndices neighborHoodIndices(size_t idx, - std::pair<size_t, size_t> sizes = { - 1, 1}) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> + NeighborHoodIndices + neighborHoodIndices(size_t idx, std::pair<size_t, size_t> sizes = {1, 1}) + const { // Handle invalid indices if (idx <= 0 || idx >= (getNBins() + 1)) { return NeighborHoodIndices(); @@ -267,9 +295,11 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @param [in] bin The bin to wrap /// @return valid bin index - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> - size_t wrapBin(int bin) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> + size_t + wrapBin(int bin) const { return std::max(std::min(bin, static_cast<int>(getNBins()) + 1), 0); } @@ -279,9 +309,11 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @param [in] bin The bin to wrap /// @return valid bin index - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> - size_t wrapBin(int bin) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> + size_t + wrapBin(int bin) const { return std::max(std::min(bin, static_cast<int>(getNBins())), 1); } @@ -291,9 +323,11 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @param [in] bin The bin to wrap /// @return valid bin index - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> - size_t wrapBin(int bin) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> + size_t + wrapBin(int bin) const { const int w = getNBins(); return 1 + (w + ((bin - 1) % w)) % w; // return int(bin<1)*w - int(bin>w)*w + bin; @@ -309,14 +343,18 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// bin with lower bound @c l and upper bound @c u. /// @note Bin indices start at @c 1. The underflow bin has the index @c 0 /// while the index <tt>nBins + 1</tt> indicates the overflow bin . - size_t getBin(double x) const { + size_t + getBin(double x) const { return wrapBin(std::floor((x - getMin()) / getBinWidth()) + 1); } /// @brief get bin width /// /// @return constant width for all bins - double getBinWidth(size_t /*bin*/ = 0) const { return m_width; } + double + getBinWidth(size_t /*bin*/ = 0) const { + return m_width; + } /// @brief get lower bound of bin /// @@ -328,7 +366,8 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @note Bin intervals have a closed lower bound, i.e. the lower boundary /// belongs to the bin with the given bin index. - double getBinLowerBound(size_t bin) const { + double + getBinLowerBound(size_t bin) const { return getMin() + (bin - 1) * getBinWidth(); } @@ -342,7 +381,8 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @note Bin intervals have an open upper bound, i.e. the upper boundary /// does @b not belong to the bin with the given bin index. - double getBinUpperBound(size_t bin) const { + double + getBinUpperBound(size_t bin) const { return getMin() + bin * getBinWidth(); } @@ -353,24 +393,34 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @pre @c bin must be a valid bin index (excluding under-/overflow bins), /// i.e. \f$1 \le \text{bin} \le \text{nBins}\f$ - double getBinCenter(size_t bin) const { + double + getBinCenter(size_t bin) const { return getMin() + (bin - 0.5) * getBinWidth(); } /// @brief get maximum of binning range /// /// @return maximum of binning range - double getMax() const override { return m_max; } + double + getMax() const override { + return m_max; + } /// @brief get minimum of binning range /// /// @return minimum of binning range - double getMin() const override { return m_min; } + double + getMin() const override { + return m_min; + } /// @brief get total number of bins /// /// @return total number of bins (excluding under-/overflow bins) - size_t getNBins() const override { return m_bins; } + size_t + getNBins() const override { + return m_bins; + } /// @brief check whether value is inside axis limits /// @@ -379,11 +429,15 @@ class Axis<AxisType::Equidistant, bdt> final : public IAxis { /// /// @post If @c true is returned, the bin containing the given value is a /// valid bin, i.e. it is neither the underflow nor the overflow bin. - bool isInside(double x) const { return (m_min <= x) && (x < m_max); } + bool + isInside(double x) const { + return (m_min <= x) && (x < m_max); + } /// @brief Return a vector of bin edges /// @return Vector which contains the bin edges - std::vector<double> getBinEdges() const override { + std::vector<double> + getBinEdges() const override { std::vector<double> binEdges; for (size_t i = 1; i <= m_bins; i++) { binEdges.push_back(getBinLowerBound(i)); @@ -424,17 +478,26 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// @brief returns whether the axis is equidistante /// /// @return bool is equidistant - bool isEquidistant() const override { return false; } + bool + isEquidistant() const override { + return false; + } /// @brief returns whether the axis is variable /// /// @return bool is variable - bool isVariable() const override { return true; } + bool + isVariable() const override { + return true; + } /// @brief returns the boundary type set in the template param /// /// @return @c AxisBoundaryType of this axis - AxisBoundaryType getBoundaryType() const override { return bdt; } + AxisBoundaryType + getBoundaryType() const override { + return bdt; + } /// @brief Get #size bins which neighbor the one given /// @@ -443,7 +506,8 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// @param [in] idx requested bin index /// @param [in] size how many neighboring bins /// @return Set of neighboring bin indices (global) - NeighborHoodIndices neighborHoodIndices(size_t idx, size_t size = 1) const { + NeighborHoodIndices + neighborHoodIndices(size_t idx, size_t size = 1) const { return neighborHoodIndices(idx, std::make_pair(size, size)); } @@ -457,11 +521,12 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// @note Open varies given bin and allows 0 and NBins+1 (underflow, /// overflow) /// as neighbors - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> - NeighborHoodIndices neighborHoodIndices(size_t idx, - std::pair<size_t, size_t> sizes = { - 1, 1}) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> + NeighborHoodIndices + neighborHoodIndices(size_t idx, std::pair<size_t, size_t> sizes = {1, 1}) + const { constexpr int min = 0; const int max = getNBins() + 1; const int itmin = std::max(min, int(idx - sizes.first)); @@ -478,11 +543,12 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// @return Set of neighboring bin indices (global) /// @note Bound varies given bin and allows 1 and NBins (regular bins) /// as neighbors - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> - NeighborHoodIndices neighborHoodIndices(size_t idx, - std::pair<size_t, size_t> sizes = { - 1, 1}) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> + NeighborHoodIndices + neighborHoodIndices(size_t idx, std::pair<size_t, size_t> sizes = {1, 1}) + const { if (idx <= 0 || idx >= (getNBins() + 1)) { return NeighborHoodIndices(); } @@ -502,11 +568,12 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// @return Set of neighboring bin indices (global) /// @note Closed varies given bin and allows bins on the opposite /// side of the axis as neighbors. (excludes underflow / overflow) - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> - NeighborHoodIndices neighborHoodIndices(size_t idx, - std::pair<size_t, size_t> sizes = { - 1, 1}) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> + NeighborHoodIndices + neighborHoodIndices(size_t idx, std::pair<size_t, size_t> sizes = {1, 1}) + const { // Handle invalid indices if (idx <= 0 || idx >= (getNBins() + 1)) { return NeighborHoodIndices(); @@ -544,9 +611,11 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @param [in] bin The bin to wrap /// @return valid bin index - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> - size_t wrapBin(int bin) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Open, int> = 0> + size_t + wrapBin(int bin) const { return std::max(std::min(bin, static_cast<int>(getNBins()) + 1), 0); } @@ -556,9 +625,11 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @param [in] bin The bin to wrap /// @return valid bin index - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> - size_t wrapBin(int bin) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Bound, int> = 0> + size_t + wrapBin(int bin) const { return std::max(std::min(bin, static_cast<int>(getNBins())), 1); } @@ -568,9 +639,11 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @param [in] bin The bin to wrap /// @return valid bin index - template <AxisBoundaryType T = bdt, - std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> - size_t wrapBin(int bin) const { + template < + AxisBoundaryType T = bdt, + std::enable_if_t<T == AxisBoundaryType::Closed, int> = 0> + size_t + wrapBin(int bin) const { const int w = getNBins(); return 1 + (w + ((bin - 1) % w)) % w; // return int(bin<1)*w - int(bin>w)*w + bin; @@ -586,7 +659,8 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// bin with lower bound @c l and upper bound @c u. /// @note Bin indices start at @c 1. The underflow bin has the index @c 0 /// while the index <tt>nBins + 1</tt> indicates the overflow bin . - size_t getBin(double x) const { + size_t + getBin(double x) const { const auto it = std::upper_bound(std::begin(m_binEdges), std::end(m_binEdges), x); return wrapBin(std::distance(std::begin(m_binEdges), it)); @@ -599,7 +673,8 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @pre @c bin must be a valid bin index (excluding under-/overflow bins), /// i.e. \f$1 \le \text{bin} \le \text{nBins}\f$ - double getBinWidth(size_t bin) const { + double + getBinWidth(size_t bin) const { return m_binEdges.at(bin) - m_binEdges.at(bin - 1); } @@ -613,7 +688,10 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @note Bin intervals have a closed lower bound, i.e. the lower boundary /// belongs to the bin with the given bin index. - double getBinLowerBound(size_t bin) const { return m_binEdges.at(bin - 1); } + double + getBinLowerBound(size_t bin) const { + return m_binEdges.at(bin - 1); + } /// @brief get upper bound of bin /// @@ -625,7 +703,10 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @note Bin intervals have an open upper bound, i.e. the upper boundary /// does @b not belong to the bin with the given bin index. - double getBinUpperBound(size_t bin) const { return m_binEdges.at(bin); } + double + getBinUpperBound(size_t bin) const { + return m_binEdges.at(bin); + } /// @brief get bin center /// @@ -634,24 +715,34 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @pre @c bin must be a valid bin index (excluding under-/overflow bins), /// i.e. \f$1 \le \text{bin} \le \text{nBins}\f$ - double getBinCenter(size_t bin) const { + double + getBinCenter(size_t bin) const { return 0.5 * (getBinLowerBound(bin) + getBinUpperBound(bin)); } /// @brief get maximum of binning range /// /// @return maximum of binning range - double getMax() const override { return m_binEdges.back(); } + double + getMax() const override { + return m_binEdges.back(); + } /// @brief get minimum of binning range /// /// @return minimum of binning range - double getMin() const override { return m_binEdges.front(); } + double + getMin() const override { + return m_binEdges.front(); + } /// @brief get total number of bins /// /// @return total number of bins (excluding under-/overflow bins) - size_t getNBins() const override { return m_binEdges.size() - 1; } + size_t + getNBins() const override { + return m_binEdges.size() - 1; + } /// @brief check whether value is inside axis limits /// @@ -660,13 +751,17 @@ class Axis<AxisType::Variable, bdt> final : public IAxis { /// /// @post If @c true is returned, the bin containing the given value is a /// valid bin, i.e. it is neither the underflow nor the overflow bin. - bool isInside(double x) const { + bool + isInside(double x) const { return (m_binEdges.front() <= x) && (x < m_binEdges.back()); } /// @brief Return a vector of bin edges /// @return Vector which contains the bin edges - std::vector<double> getBinEdges() const override { return m_binEdges; } + std::vector<double> + getBinEdges() const override { + return m_binEdges; + } private: /// vector of bin edges (sorted in ascending order) diff --git a/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp b/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp index f6aea54cd..52bf0edb2 100644 --- a/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp +++ b/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp @@ -112,15 +112,27 @@ struct par_type<ParDef::eLOC_1> { template <> struct par_type<ParDef::ePHI> { - static constexpr double pMin() { return -M_PI; } - static constexpr double pMax() { return M_PI; } + static constexpr double + pMin() { + return -M_PI; + } + static constexpr double + pMax() { + return M_PI; + } using type = cyclic_parameter<double, pMin, pMax>; }; template <> struct par_type<ParDef::eTHETA> { - static constexpr double pMin() { return 0; } - static constexpr double pMax() { return M_PI; } + static constexpr double + pMin() { + return 0; + } + static constexpr double + pMax() { + return M_PI; + } using type = bound_parameter<double, pMin, pMax>; }; diff --git a/Core/include/Acts/Utilities/detail/Extendable.hpp b/Core/include/Acts/Utilities/detail/Extendable.hpp index 6598d6ad3..432549d0e 100644 --- a/Core/include/Acts/Utilities/detail/Extendable.hpp +++ b/Core/include/Acts/Utilities/detail/Extendable.hpp @@ -74,8 +74,8 @@ struct Extendable { /// /// @param aps The extensions to be appended to the new Extendable template <typename... appendices_t> - Extendable<extensions_t..., appendices_t...> append( - appendices_t... aps) const { + Extendable<extensions_t..., appendices_t...> + append(appendices_t... aps) const { auto catTuple = std::tuple_cat(m_extensions, std::tuple<appendices_t...>(aps...)); return Extendable<extensions_t..., appendices_t...>(std::move(catTuple)); @@ -85,7 +85,8 @@ struct Extendable { /// /// @tparam extension_t Type of the Extension to be retrieved template <typename extension_t> - const extension_t& get() const { + const extension_t& + get() const { return std::get<extension_t>(m_extensions); } @@ -93,19 +94,26 @@ struct Extendable { /// /// @tparam extension_t Type of the Extension to be retrieved template <typename extension_t> - extension_t& get() { + extension_t& + get() { return std::get<extension_t>(m_extensions); } /// Const retrieval of the extension tuype /// /// @tparam extension_t Type of the Extension to be retrieved - const std::tuple<extensions_t...>& tuple() const { return m_extensions; } + const std::tuple<extensions_t...>& + tuple() const { + return m_extensions; + } /// Non-Const retrieval of the extendsion tuype /// /// @tparam extension_t Type of the Extension to be retrieved - std::tuple<extensions_t...>& tuple() { return m_extensions; } + std::tuple<extensions_t...>& + tuple() { + return m_extensions; + } private: std::tuple<extensions_t...> m_extensions; diff --git a/Core/include/Acts/Utilities/detail/Grid.hpp b/Core/include/Acts/Utilities/detail/Grid.hpp index bb1437a80..6e3988b9e 100644 --- a/Core/include/Acts/Utilities/detail/Grid.hpp +++ b/Core/include/Acts/Utilities/detail/Grid.hpp @@ -71,7 +71,8 @@ class Grid final { /// Therefore, the look-up will never fail. // template <class Point> - reference atPosition(const Point& point) { + reference + atPosition(const Point& point) { return m_values.at(globalBinFromPosition(point)); } @@ -90,7 +91,8 @@ class Grid final { /// @note The look-up considers under-/overflow bins along each axis. /// Therefore, the look-up will never fail. template <class Point> - const_reference atPosition(const Point& point) const { + const_reference + atPosition(const Point& point) const { return m_values.at(globalBinFromPosition(point)); } @@ -99,14 +101,20 @@ class Grid final { /// @param [in] bin global bin number /// @return reference to value stored in bin containing the given /// point - reference at(size_t bin) { return m_values.at(bin); } + reference + at(size_t bin) { + return m_values.at(bin); + } /// @brief access value stored in bin with given global bin number /// /// @param [in] bin global bin number /// @return const-reference to value stored in bin containing the given /// point - const_reference at(size_t bin) const { return m_values.at(bin); } + const_reference + at(size_t bin) const { + return m_values.at(bin); + } /// @brief access value stored in bin with given local bin numbers /// @@ -116,7 +124,8 @@ class Grid final { /// /// @pre All local bin indices must be a valid index for the corresponding /// axis (including the under-/overflow bin for this axis). - reference atLocalBins(const index_t& localBins) { + reference + atLocalBins(const index_t& localBins) { return m_values.at(globalBinFromLocalBins(localBins)); } @@ -128,7 +137,8 @@ class Grid final { /// /// @pre All local bin indices must be a valid index for the corresponding /// axis (including the under-/overflow bin for this axis). - const_reference atLocalBins(const index_t& localBins) const { + const_reference + atLocalBins(const index_t& localBins) const { return m_values.at(globalBinFromLocalBins(localBins)); } @@ -144,15 +154,18 @@ class Grid final { /// dimensions where d is dimensionality of the grid. It must lie /// within the grid range (i.e. not within a under-/overflow bin). template <class Point> - detail::GlobalNeighborHoodIndices<DIM> closestPointsIndices( - const Point& position) const { + detail::GlobalNeighborHoodIndices<DIM> + closestPointsIndices(const Point& position) const { return rawClosestPointsIndices(localBinsFromPosition(position)); } /// @brief dimensionality of grid /// /// @return number of axes spanning the grid - static constexpr size_t dimensions() { return DIM; } + static constexpr size_t + dimensions() { + return DIM; + } /// @brief get center position of bin with given local bin numbers /// @@ -161,7 +174,8 @@ class Grid final { /// /// @pre All local bin indices must be a valid index for the corresponding /// axis (excluding the under-/overflow bins for each axis). - std::array<double, DIM> binCenter(const index_t& localBins) const { + std::array<double, DIM> + binCenter(const index_t& localBins) const { return grid_helper::getBinCenter(localBins, m_axes); } @@ -177,7 +191,8 @@ class Grid final { /// dimensions where d is dimensionality of the grid. /// @note This could be a under-/overflow bin along one or more axes. template <class Point> - size_t globalBinFromPosition(const Point& point) const { + size_t + globalBinFromPosition(const Point& point) const { return globalBinFromLocalBins(localBinsFromPosition(point)); } @@ -188,7 +203,8 @@ class Grid final { /// /// @pre All local bin indices must be a valid index for the corresponding /// axis (including the under-/overflow bin for this axis). - size_t globalBinFromLocalBins(const index_t& localBins) const { + size_t + globalBinFromLocalBins(const index_t& localBins) const { return grid_helper::getGlobalBin(localBins, m_axes); } @@ -205,7 +221,8 @@ class Grid final { /// dimensions where d is dimensionality of the grid. /// @note This could be a under-/overflow bin along one or more axes. template <class Point> - index_t localBinsFromPosition(const Point& point) const { + index_t + localBinsFromPosition(const Point& point) const { return grid_helper::getLocalBinIndices(point, m_axes); } @@ -217,7 +234,8 @@ class Grid final { /// /// @note Local bin indices can contain under-/overflow bins along the /// corresponding axis. - index_t localBinsFromGlobalBin(size_t bin) const { + index_t + localBinsFromGlobalBin(size_t bin) const { return grid_helper::getLocalBinIndices(bin, m_axes); } @@ -228,7 +246,8 @@ class Grid final { /// /// @pre @c localBins must only contain valid bin indices (excluding /// underflow bins). - point_t lowerLeftBinEdge(const index_t& localBins) const { + point_t + lowerLeftBinEdge(const index_t& localBins) const { return grid_helper::getLowerLeftBinEdge(localBins, m_axes); } @@ -239,7 +258,8 @@ class Grid final { /// /// @pre @c localBins must only contain valid bin indices (excluding /// overflow bins). - point_t upperRightBinEdge(const index_t& localBins) const { + point_t + upperRightBinEdge(const index_t& localBins) const { return grid_helper::getUpperRightBinEdge(localBins, m_axes); } @@ -248,24 +268,34 @@ class Grid final { /// @return array giving the number of bins along all axes /// /// @note Not including under- and overflow bins - index_t numLocalBins() const { return grid_helper::getNBins(m_axes); } + index_t + numLocalBins() const { + return grid_helper::getNBins(m_axes); + } /// @brief get the minimum value of all axes of one grid /// /// @return array returning the minima of all given axes - point_t minPosition() const { return grid_helper::getMin(m_axes); } + point_t + minPosition() const { + return grid_helper::getMin(m_axes); + } /// @brief get the maximum value of all axes of one grid /// /// @return array returning the maxima of all given axes - point_t maxPosition() const { return grid_helper::getMax(m_axes); } + point_t + maxPosition() const { + return grid_helper::getMax(m_axes); + } /// @brief set all overflow and underflow bins to a certain value /// /// @param [in] value value to be inserted in every overflow and underflow /// bin of the grid. /// - void setExteriorBins(const value_type& value) { + void + setExteriorBins(const value_type& value) { for (size_t index : grid_helper::exteriorBinIndices(m_axes)) { at(index) = value; } @@ -297,10 +327,15 @@ class Grid final { /// @note Bin values are interpreted as being the field values at the /// lower-left corner of the corresponding hyper-box. template < - class Point, typename U = T, + class Point, + typename U = T, typename = std::enable_if_t<can_interpolate< - Point, std::array<double, DIM>, std::array<double, DIM>, U>::value>> - T interpolate(const Point& point) const { + Point, + std::array<double, DIM>, + std::array<double, DIM>, + U>::value>> + T + interpolate(const Point& point) const { // there are 2^DIM corner points used during the interpolation constexpr size_t nCorners = 1 << DIM; @@ -321,8 +356,11 @@ class Grid final { neighbors.at(i++) = at(index); } - return Acts::interpolate(point, lowerLeftBinEdge(llIndices), - upperRightBinEdge(llIndices), neighbors); + return Acts::interpolate( + point, + lowerLeftBinEdge(llIndices), + upperRightBinEdge(llIndices), + neighbors); } /// @brief check whether given point is inside grid limits @@ -337,7 +375,8 @@ class Grid final { /// is a valid bin, i.e. it is neither a underflow nor an overflow bin /// along any axis. template <class Point> - bool isInside(const Point& position) const { + bool + isInside(const Point& position) const { return grid_helper::isInside(position, m_axes); } @@ -356,8 +395,8 @@ class Grid final { /// Ignoring the truncation of the neighborhood size reaching beyond /// over-/underflow bins, the neighborhood is of size \f$2 \times /// \text{size}+1\f$ along each dimension. - detail::GlobalNeighborHoodIndices<DIM> neighborHoodIndices( - const index_t& localBins, size_t size = 1u) const { + detail::GlobalNeighborHoodIndices<DIM> + neighborHoodIndices(const index_t& localBins, size_t size = 1u) const { return grid_helper::neighborHoodIndices(localBins, size, m_axes); } @@ -366,15 +405,19 @@ class Grid final { /// @return total number of bins in the grid /// /// @note This number contains under-and overflow bins along all axes. - size_t size() const { + size_t + size() const { index_t nBinsArray = numLocalBins(); // add under-and overflow bins for each axis and multiply all bins return std::accumulate( - nBinsArray.begin(), nBinsArray.end(), 1, + nBinsArray.begin(), + nBinsArray.end(), + 1, [](const size_t& a, const size_t& b) { return a * (b + 2); }); } - std::array<const IAxis*, DIM> axes() const { + std::array<const IAxis*, DIM> + axes() const { return grid_helper::getAxes(m_axes); } @@ -387,8 +430,8 @@ class Grid final { // Part of closestPointsIndices that goes after local bins resolution. // Used as an interpolation performance optimization, but not exposed as it // doesn't make that much sense from an API design standpoint. - detail::GlobalNeighborHoodIndices<DIM> rawClosestPointsIndices( - const index_t& localBins) const { + detail::GlobalNeighborHoodIndices<DIM> + rawClosestPointsIndices(const index_t& localBins) const { return grid_helper::closestPointsIndices(localBins, m_axes); } }; diff --git a/Core/include/Acts/Utilities/detail/MPL/type_collector.hpp b/Core/include/Acts/Utilities/detail/MPL/type_collector.hpp index b734c863f..1d9008dce 100644 --- a/Core/include/Acts/Utilities/detail/MPL/type_collector.hpp +++ b/Core/include/Acts/Utilities/detail/MPL/type_collector.hpp @@ -72,9 +72,10 @@ constexpr auto type_collector = [](auto t_, auto predicate, auto extractor) { * @tparam items The items to filter / collect from. */ template <typename helper, typename... items> -constexpr auto type_collector_t = type_collector(hana::tuple_t<items...>, - helper::predicate, - helper::extractor); +constexpr auto type_collector_t = type_collector( + hana::tuple_t<items...>, + helper::predicate, + helper::extractor); /** * Meta function which returns a compile time bool diff --git a/Core/include/Acts/Utilities/detail/grid_helper.hpp b/Core/include/Acts/Utilities/detail/grid_helper.hpp index 5cdba9215..ce4328e47 100644 --- a/Core/include/Acts/Utilities/detail/grid_helper.hpp +++ b/Core/include/Acts/Utilities/detail/grid_helper.hpp @@ -48,8 +48,9 @@ class GlobalNeighborHoodIndices { public: iterator() = default; - iterator(const GlobalNeighborHoodIndices& parent, - std::array<NeighborHoodIndices::iterator, DIM>&& localIndicesIter) + iterator( + const GlobalNeighborHoodIndices& parent, + std::array<NeighborHoodIndices::iterator, DIM>&& localIndicesIter) : m_localIndicesIter(std::move(localIndicesIter)), m_parent(&parent) {} size_t operator*() const { @@ -62,7 +63,8 @@ class GlobalNeighborHoodIndices { return globalIndex; } - iterator& operator++() { + iterator& + operator++() { const auto& localIndices = m_parent->m_localIndices; // Go to the next global index via a lexicographic increment: @@ -81,7 +83,8 @@ class GlobalNeighborHoodIndices { return *this; } - bool operator==(const iterator& it) { + bool + operator==(const iterator& it) { // We know when we've reached the end, so we don't need an end-iterator. // Sadly, in C++, there has to be one. Therefore, we special-case it // heavily so that it's super-efficient to create and compare to. @@ -92,14 +95,18 @@ class GlobalNeighborHoodIndices { } } - bool operator!=(const iterator& it) { return !(*this == it); } + bool + operator!=(const iterator& it) { + return !(*this == it); + } private: std::array<NeighborHoodIndices::iterator, DIM> m_localIndicesIter; const GlobalNeighborHoodIndices* m_parent = nullptr; }; - iterator begin() const { + iterator + begin() const { std::array<NeighborHoodIndices::iterator, DIM> localIndicesIter; for (size_t i = 0; i < DIM; ++i) { localIndicesIter[i] = m_localIndices[i].begin(); @@ -107,10 +114,14 @@ class GlobalNeighborHoodIndices { return iterator(*this, std::move(localIndicesIter)); } - iterator end() const { return iterator(); } + iterator + end() const { + return iterator(); + } // Number of indices that will be produced if this sequence is iterated - size_t size() const { + size_t + size() const { size_t result = m_localIndices[0].size(); for (size_t i = 1; i < DIM; ++i) { result *= m_localIndices[i].size(); @@ -119,7 +130,8 @@ class GlobalNeighborHoodIndices { } // Collect the sequence of indices into an std::vector - std::vector<size_t> collect() const { + std::vector<size_t> + collect() const { std::vector<size_t> result; result.reserve(this->size()); for (size_t idx : *this) { @@ -143,7 +155,8 @@ struct grid_helper_impl; template <size_t N> struct grid_helper_impl { template <class... Axes> - static void getBinCenter( + static void + getBinCenter( std::array<double, sizeof...(Axes)>& center, const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { @@ -152,9 +165,12 @@ struct grid_helper_impl { } template <class... Axes> - static void getGlobalBin(const std::array<size_t, sizeof...(Axes)>& localBins, - const std::tuple<Axes...>& axes, size_t& bin, - size_t& area) { + static void + getGlobalBin( + const std::array<size_t, sizeof...(Axes)>& localBins, + const std::tuple<Axes...>& axes, + size_t& bin, + size_t& area) { const auto& thisAxis = std::get<N>(axes); bin += area * localBins.at(N); // make sure to account for under-/overflow bins @@ -163,18 +179,23 @@ struct grid_helper_impl { } template <class Point, class... Axes> - static void getLocalBinIndices(const Point& point, - const std::tuple<Axes...>& axes, - std::array<size_t, sizeof...(Axes)>& indices) { + static void + getLocalBinIndices( + const Point& point, + const std::tuple<Axes...>& axes, + std::array<size_t, sizeof...(Axes)>& indices) { const auto& thisAxis = std::get<N>(axes); indices.at(N) = thisAxis.getBin(point[N]); grid_helper_impl<N - 1>::getLocalBinIndices(point, axes, indices); } template <class... Axes> - static void getLocalBinIndices(size_t& bin, const std::tuple<Axes...>& axes, - size_t& area, - std::array<size_t, sizeof...(Axes)>& indices) { + static void + getLocalBinIndices( + size_t& bin, + const std::tuple<Axes...>& axes, + size_t& area, + std::array<size_t, sizeof...(Axes)>& indices) { const auto& thisAxis = std::get<N>(axes); // make sure to account for under-/overflow bins size_t new_area = area * (thisAxis.getNBins() + 2); @@ -184,7 +205,8 @@ struct grid_helper_impl { } template <class... Axes> - static void getLowerLeftBinEdge( + static void + getLowerLeftBinEdge( std::array<double, sizeof...(Axes)>& llEdge, const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { @@ -193,7 +215,8 @@ struct grid_helper_impl { } template <class... Axes> - static void getLowerLeftBinIndices( + static void + getLowerLeftBinIndices( std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { localIndices.at(N) = std::get<N>(axes).wrapBin(localIndices.at(N) - 1); @@ -201,22 +224,27 @@ struct grid_helper_impl { } template <class... Axes> - static void getNBins(const std::tuple<Axes...>& axes, - std::array<size_t, sizeof...(Axes)>& nBinsArray) { + static void + getNBins( + const std::tuple<Axes...>& axes, + std::array<size_t, sizeof...(Axes)>& nBinsArray) { // by convention getNBins does not include under-/overflow bins nBinsArray[N] = std::get<N>(axes).getNBins(); grid_helper_impl<N - 1>::getNBins(axes, nBinsArray); } template <class... Axes> - static void getAxes(const std::tuple<Axes...>& axes, - std::array<const IAxis*, sizeof...(Axes)>& axesArr) { + static void + getAxes( + const std::tuple<Axes...>& axes, + std::array<const IAxis*, sizeof...(Axes)>& axesArr) { axesArr[N] = static_cast<const IAxis*>(&std::get<N>(axes)); grid_helper_impl<N - 1>::getAxes(axes, axesArr); } template <class... Axes> - static void getUpperRightBinEdge( + static void + getUpperRightBinEdge( std::array<double, sizeof...(Axes)>& urEdge, const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { @@ -225,7 +253,8 @@ struct grid_helper_impl { } template <class... Axes> - static void getUpperRightBinIndices( + static void + getUpperRightBinIndices( std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { localIndices.at(N) = std::get<N>(axes).wrapBin(localIndices.at(N) + 1); @@ -233,29 +262,36 @@ struct grid_helper_impl { } template <class... Axes> - static void getMin(const std::tuple<Axes...>& axes, - std::array<double, sizeof...(Axes)>& minArray) { + static void + getMin( + const std::tuple<Axes...>& axes, + std::array<double, sizeof...(Axes)>& minArray) { minArray[N] = std::get<N>(axes).getMin(); grid_helper_impl<N - 1>::getMin(axes, minArray); } template <class... Axes> - static void getMax(const std::tuple<Axes...>& axes, - std::array<double, sizeof...(Axes)>& maxArray) { + static void + getMax( + const std::tuple<Axes...>& axes, + std::array<double, sizeof...(Axes)>& maxArray) { maxArray[N] = std::get<N>(axes).getMax(); grid_helper_impl<N - 1>::getMax(axes, maxArray); } template <class Point, class... Axes> - static bool isInside(const Point& position, const std::tuple<Axes...>& axes) { + static bool + isInside(const Point& position, const std::tuple<Axes...>& axes) { bool insideThisAxis = std::get<N>(axes).isInside(position[N]); return insideThisAxis && grid_helper_impl<N - 1>::isInside(position, axes); } template <class... Axes> - static void neighborHoodIndices( + static void + neighborHoodIndices( const std::array<size_t, sizeof...(Axes)>& localIndices, - std::pair<size_t, size_t> sizes, const std::tuple<Axes...>& axes, + std::pair<size_t, size_t> sizes, + const std::tuple<Axes...>& axes, std::array<NeighborHoodIndices, sizeof...(Axes)>& neighborIndices) { // ask n-th axis size_t locIdx = localIndices.at(N); @@ -263,22 +299,24 @@ struct grid_helper_impl { std::get<N>(axes).neighborHoodIndices(locIdx, sizes); neighborIndices.at(N) = locNeighbors; - grid_helper_impl<N - 1>::neighborHoodIndices(localIndices, sizes, axes, - neighborIndices); + grid_helper_impl<N - 1>::neighborHoodIndices( + localIndices, sizes, axes, neighborIndices); } template <class... Axes> - static void exteriorBinIndices(std::array<size_t, sizeof...(Axes)>& idx, - std::array<bool, sizeof...(Axes)> isExterior, - std::set<size_t>& combinations, - const std::tuple<Axes...>& axes) { + static void + exteriorBinIndices( + std::array<size_t, sizeof...(Axes)>& idx, + std::array<bool, sizeof...(Axes)> isExterior, + std::set<size_t>& combinations, + const std::tuple<Axes...>& axes) { // iterate over this axis' bins, remembering which bins are exterior for (size_t i = 0; i < std::get<N>(axes).getNBins() + 2; ++i) { idx.at(N) = i; isExterior.at(N) = (i == 0) || (i == std::get<N>(axes).getNBins() + 1); // vary other axes recursively - grid_helper_impl<N - 1>::exteriorBinIndices(idx, isExterior, combinations, - axes); + grid_helper_impl<N - 1>::exteriorBinIndices( + idx, isExterior, combinations, axes); } } }; @@ -286,7 +324,8 @@ struct grid_helper_impl { template <> struct grid_helper_impl<0u> { template <class... Axes> - static void getBinCenter( + static void + getBinCenter( std::array<double, sizeof...(Axes)>& center, const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { @@ -294,32 +333,40 @@ struct grid_helper_impl<0u> { } template <class... Axes> - static void getGlobalBin(const std::array<size_t, sizeof...(Axes)>& localBins, - const std::tuple<Axes...>& /*axes*/, size_t& bin, - size_t& area) { + static void + getGlobalBin( + const std::array<size_t, sizeof...(Axes)>& localBins, + const std::tuple<Axes...>& /*axes*/, + size_t& bin, + size_t& area) { bin += area * localBins.at(0u); } template <class Point, class... Axes> - static void getLocalBinIndices(const Point& point, - const std::tuple<Axes...>& axes, - std::array<size_t, sizeof...(Axes)>& indices) { + static void + getLocalBinIndices( + const Point& point, + const std::tuple<Axes...>& axes, + std::array<size_t, sizeof...(Axes)>& indices) { const auto& thisAxis = std::get<0u>(axes); indices.at(0u) = thisAxis.getBin(point[0u]); } template <class... Axes> - static void getLocalBinIndices(size_t& bin, - const std::tuple<Axes...>& /*axes*/, - size_t& area, - std::array<size_t, sizeof...(Axes)>& indices) { + static void + getLocalBinIndices( + size_t& bin, + const std::tuple<Axes...>& /*axes*/, + size_t& area, + std::array<size_t, sizeof...(Axes)>& indices) { // make sure to account for under-/overflow bins indices.at(0u) = bin / area; bin %= area; } template <class... Axes> - static void getLowerLeftBinEdge( + static void + getLowerLeftBinEdge( std::array<double, sizeof...(Axes)>& llEdge, const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { @@ -327,27 +374,33 @@ struct grid_helper_impl<0u> { } template <class... Axes> - static void getLowerLeftBinIndices( + static void + getLowerLeftBinIndices( std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { localIndices.at(0u) = std::get<0u>(axes).wrapBin(localIndices.at(0u) - 1); } template <class... Axes> - static void getNBins(const std::tuple<Axes...>& axes, - std::array<size_t, sizeof...(Axes)>& nBinsArray) { + static void + getNBins( + const std::tuple<Axes...>& axes, + std::array<size_t, sizeof...(Axes)>& nBinsArray) { // by convention getNBins does not include under-/overflow bins nBinsArray[0u] = std::get<0u>(axes).getNBins(); } template <class... Axes> - static void getAxes(const std::tuple<Axes...>& axes, - std::array<const IAxis*, sizeof...(Axes)>& axesArr) { + static void + getAxes( + const std::tuple<Axes...>& axes, + std::array<const IAxis*, sizeof...(Axes)>& axesArr) { axesArr[0u] = static_cast<const IAxis*>(&std::get<0u>(axes)); } template <class... Axes> - static void getUpperRightBinEdge( + static void + getUpperRightBinEdge( std::array<double, sizeof...(Axes)>& urEdge, const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { @@ -355,33 +408,41 @@ struct grid_helper_impl<0u> { } template <class... Axes> - static void getUpperRightBinIndices( + static void + getUpperRightBinIndices( std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { localIndices.at(0u) = std::get<0u>(axes).wrapBin(localIndices.at(0u) + 1); } template <class... Axes> - static void getMin(const std::tuple<Axes...>& axes, - std::array<double, sizeof...(Axes)>& minArray) { + static void + getMin( + const std::tuple<Axes...>& axes, + std::array<double, sizeof...(Axes)>& minArray) { minArray[0u] = std::get<0u>(axes).getMin(); } template <class... Axes> - static void getMax(const std::tuple<Axes...>& axes, - std::array<double, sizeof...(Axes)>& maxArray) { + static void + getMax( + const std::tuple<Axes...>& axes, + std::array<double, sizeof...(Axes)>& maxArray) { maxArray[0u] = std::get<0u>(axes).getMax(); } template <class Point, class... Axes> - static bool isInside(const Point& position, const std::tuple<Axes...>& axes) { + static bool + isInside(const Point& position, const std::tuple<Axes...>& axes) { return std::get<0u>(axes).isInside(position[0u]); } template <class... Axes> - static void neighborHoodIndices( + static void + neighborHoodIndices( const std::array<size_t, sizeof...(Axes)>& localIndices, - std::pair<size_t, size_t> sizes, const std::tuple<Axes...>& axes, + std::pair<size_t, size_t> sizes, + const std::tuple<Axes...>& axes, std::array<NeighborHoodIndices, sizeof...(Axes)>& neighborIndices) { // ask 0-th axis size_t locIdx = localIndices.at(0u); @@ -391,10 +452,12 @@ struct grid_helper_impl<0u> { } template <class... Axes> - static void exteriorBinIndices(std::array<size_t, sizeof...(Axes)>& idx, - std::array<bool, sizeof...(Axes)> isExterior, - std::set<size_t>& combinations, - const std::tuple<Axes...>& axes) { + static void + exteriorBinIndices( + std::array<size_t, sizeof...(Axes)>& idx, + std::array<bool, sizeof...(Axes)> isExterior, + std::set<size_t>& combinations, + const std::tuple<Axes...>& axes) { // For each exterior bin on this axis, we will do this auto recordExteriorBin = [&](size_t i) { idx.at(0u) = i; @@ -441,7 +504,8 @@ struct grid_helper { /// @note @c bin must be a valid bin index (excluding under-/overflow bins /// along any axis). template <class... Axes> - static GlobalNeighborHoodIndices<sizeof...(Axes)> closestPointsIndices( + static GlobalNeighborHoodIndices<sizeof...(Axes)> + closestPointsIndices( const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { // get neighboring bins, but only increment. @@ -458,7 +522,8 @@ struct grid_helper { /// @pre @c localIndices must only contain valid bin indices (i.e. excluding /// under-/overflow bins). template <class... Axes> - static std::array<double, sizeof...(Axes)> getBinCenter( + static std::array<double, sizeof...(Axes)> + getBinCenter( const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { std::array<double, sizeof...(Axes)> center; @@ -479,7 +544,8 @@ struct grid_helper { /// @pre All local bin indices must be a valid index for the corresponding /// axis (including the under-/overflow bin for this axis). template <class... Axes> - static size_t getGlobalBin( + static size_t + getGlobalBin( const std::array<size_t, sizeof...(Axes)>& localBins, const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; @@ -506,8 +572,8 @@ struct grid_helper { /// dimensions where d is the number of axis objects in the tuple. /// @note This could be a under-/overflow bin along one or more axes. template <class Point, class... Axes> - static std::array<size_t, sizeof...(Axes)> getLocalBinIndices( - const Point& point, const std::tuple<Axes...>& axes) { + static std::array<size_t, sizeof...(Axes)> + getLocalBinIndices(const Point& point, const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; std::array<size_t, sizeof...(Axes)> indices; @@ -527,8 +593,8 @@ struct grid_helper { /// /// @note Local bin indices can contain under-/overflow bins along any axis. template <class... Axes> - static std::array<size_t, sizeof...(Axes)> getLocalBinIndices( - size_t bin, const std::tuple<Axes...>& axes) { + static std::array<size_t, sizeof...(Axes)> + getLocalBinIndices(size_t bin, const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; size_t area = 1; std::array<size_t, sizeof...(Axes)> indices; @@ -548,7 +614,8 @@ struct grid_helper { /// @pre @c localIndices must only contain valid bin indices (excluding /// underflow bins). template <class... Axes> - static std::array<double, sizeof...(Axes)> getLowerLeftBinEdge( + static std::array<double, sizeof...(Axes)> + getLowerLeftBinEdge( const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { std::array<double, sizeof...(Axes)> llEdge; @@ -572,7 +639,8 @@ struct grid_helper { /// lower-left neighbor which simply means that all local bin indices are /// decremented by one. template <class... Axes> - static std::array<size_t, sizeof...(Axes)> getLowerLeftBinIndices( + static std::array<size_t, sizeof...(Axes)> + getLowerLeftBinIndices( const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; @@ -591,8 +659,8 @@ struct grid_helper { /// /// @note This does not include under-/overflow bins along each axis. template <class... Axes> - static std::array<size_t, sizeof...(Axes)> getNBins( - const std::tuple<Axes...>& axes) { + static std::array<size_t, sizeof...(Axes)> + getNBins(const std::tuple<Axes...>& axes) { std::array<size_t, sizeof...(Axes)> nBinsArray; grid_helper_impl<sizeof...(Axes) - 1>::getNBins(axes, nBinsArray); return nBinsArray; @@ -605,8 +673,8 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return array with copies of the axis template <class... Axes> - static std::array<const IAxis*, sizeof...(Axes)> getAxes( - const std::tuple<Axes...>& axes) { + static std::array<const IAxis*, sizeof...(Axes)> + getAxes(const std::tuple<Axes...>& axes) { std::array<const IAxis*, sizeof...(Axes)> arr; grid_helper_impl<sizeof...(Axes) - 1>::getAxes(axes, arr); return arr; @@ -622,7 +690,8 @@ struct grid_helper { /// @pre @c localIndices must only contain valid bin indices (excluding /// overflow bins). template <class... Axes> - static std::array<double, sizeof...(Axes)> getUpperRightBinEdge( + static std::array<double, sizeof...(Axes)> + getUpperRightBinEdge( const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { std::array<double, sizeof...(Axes)> urEdge; @@ -646,7 +715,8 @@ struct grid_helper { /// upper-right neighbor which simply means that all local bin indices are /// incremented by one. template <class... Axes> - static std::array<size_t, sizeof...(Axes)> getUpperRightBinIndices( + static std::array<size_t, sizeof...(Axes)> + getUpperRightBinIndices( const std::array<size_t, sizeof...(Axes)>& localIndices, const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; @@ -662,8 +732,8 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return array returning the minima of all given axes template <class... Axes> - static std::array<double, sizeof...(Axes)> getMin( - const std::tuple<Axes...>& axes) { + static std::array<double, sizeof...(Axes)> + getMin(const std::tuple<Axes...>& axes) { std::array<double, sizeof...(Axes)> minArray; grid_helper_impl<sizeof...(Axes) - 1>::getMin(axes, minArray); return minArray; @@ -675,8 +745,8 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return array returning the maxima of all given axes template <class... Axes> - static std::array<double, sizeof...(Axes)> getMax( - const std::tuple<Axes...>& axes) { + static std::array<double, sizeof...(Axes)> + getMax(const std::tuple<Axes...>& axes) { std::array<double, sizeof...(Axes)> maxArray; grid_helper_impl<sizeof...(Axes) - 1>::getMax(axes, maxArray); return maxArray; @@ -703,16 +773,18 @@ struct grid_helper { /// of the contained axes /// template <class... Axes> - static GlobalNeighborHoodIndices<sizeof...(Axes)> neighborHoodIndices( + static GlobalNeighborHoodIndices<sizeof...(Axes)> + neighborHoodIndices( const std::array<size_t, sizeof...(Axes)>& localIndices, - std::pair<size_t, size_t> sizes, const std::tuple<Axes...>& axes) { + std::pair<size_t, size_t> sizes, + const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; // length N array which contains local neighbors based on size par std::array<NeighborHoodIndices, sizeof...(Axes)> neighborIndices; // get local bin indices for neighboring bins - grid_helper_impl<MAX>::neighborHoodIndices(localIndices, sizes, axes, - neighborIndices); + grid_helper_impl<MAX>::neighborHoodIndices( + localIndices, sizes, axes, neighborIndices); // Query the number of bins std::array<size_t, sizeof...(Axes)> nBinsArray = getNBins(axes); @@ -722,8 +794,10 @@ struct grid_helper { } template <class... Axes> - static GlobalNeighborHoodIndices<sizeof...(Axes)> neighborHoodIndices( - const std::array<size_t, sizeof...(Axes)>& localIndices, size_t size, + static GlobalNeighborHoodIndices<sizeof...(Axes)> + neighborHoodIndices( + const std::array<size_t, sizeof...(Axes)>& localIndices, + size_t size, const std::tuple<Axes...>& axes) { return neighborHoodIndices(localIndices, std::make_pair(size, size), axes); } @@ -734,14 +808,15 @@ struct grid_helper { /// @param [in] axes actual axis objects spanning the grid /// @return set of global bin indices for all over- and underflow bins template <class... Axes> - static std::set<size_t> exteriorBinIndices(const std::tuple<Axes...>& axes) { + static std::set<size_t> + exteriorBinIndices(const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; std::array<size_t, sizeof...(Axes)> idx; std::array<bool, sizeof...(Axes)> isExterior; std::set<size_t> combinations; - grid_helper_impl<MAX>::exteriorBinIndices(idx, isExterior, combinations, - axes); + grid_helper_impl<MAX>::exteriorBinIndices( + idx, isExterior, combinations, axes); return combinations; } @@ -760,7 +835,8 @@ struct grid_helper { /// @pre The given @c Point type must represent a point in d (or higher) /// dimensions where d is the number of axis objects in the tuple. template <class Point, class... Axes> - static bool isInside(const Point& position, const std::tuple<Axes...>& axes) { + static bool + isInside(const Point& position, const std::tuple<Axes...>& axes) { constexpr size_t MAX = sizeof...(Axes) - 1; return grid_helper_impl<MAX>::isInside(position, axes); } diff --git a/Core/include/Acts/Utilities/detail/interpolation_impl.hpp b/Core/include/Acts/Utilities/detail/interpolation_impl.hpp index 294d7befd..d3fef7044 100644 --- a/Core/include/Acts/Utilities/detail/interpolation_impl.hpp +++ b/Core/include/Acts/Utilities/detail/interpolation_impl.hpp @@ -36,10 +36,10 @@ namespace detail { template <typename Point1, typename Point2, typename Point3, typename Value> struct can_interpolate { template <typename C> - static auto value_type_test(C* c) - -> decltype(C(std::declval<double>() * std::declval<C>() + - std::declval<double>() * std::declval<C>()), - std::true_type()); + static auto value_type_test(C* c) -> decltype( + C(std::declval<double>() * std::declval<C>() + + std::declval<double>() * std::declval<C>()), + std::true_type()); template <typename C> static std::false_type value_type_test(...); @@ -50,14 +50,14 @@ struct can_interpolate { static std::false_type point_type_test(...); static const bool value = - std::is_same<std::true_type, - decltype(value_type_test<Value>(nullptr))>::value and - std::is_same<std::true_type, - decltype(point_type_test<Point1>(nullptr))>::value and - std::is_same<std::true_type, - decltype(point_type_test<Point2>(nullptr))>::value and - std::is_same<std::true_type, - decltype(point_type_test<Point3>(nullptr))>::value; + std::is_same<std::true_type, decltype(value_type_test<Value>(nullptr))>:: + value and + std::is_same<std::true_type, decltype(point_type_test<Point1>(nullptr))>:: + value and + std::is_same<std::true_type, decltype(point_type_test<Point2>(nullptr))>:: + value and + std::is_same<std::true_type, decltype(point_type_test<Point3>(nullptr))>:: + value; }; /// @brief determine number of dimension from power of 2 @@ -94,17 +94,30 @@ struct get_dimension<2u> { /// - @c N is the number of hyper box corners which is \f$2^d\f$ where \f$d\f$ /// is the dimensionality of the hyper box. The dimensionality must be /// consistent with the provided @c Point types. -template <typename T, class Point1, class Point2, class Point3, size_t D, - size_t N> +template < + typename T, + class Point1, + class Point2, + class Point3, + size_t D, + size_t N> struct interpolate_impl; /// @cond // recursive implementation of linear interpolation in multiple dimensions -template <typename T, class Point1, class Point2, class Point3, size_t D, - size_t N> +template < + typename T, + class Point1, + class Point2, + class Point3, + size_t D, + size_t N> struct interpolate_impl { - static T run(const Point1& pos, const Point2& lowerLeft, - const Point3& upperRight, const std::array<T, N>& fields) { + static T + run(const Point1& pos, + const Point2& lowerLeft, + const Point3& upperRight, + const std::array<T, N>& fields) { // get distance to lower boundary relative to total bin width const double f = (pos[D] - lowerLeft[D]) / (upperRight[D] - lowerLeft[D]); @@ -121,8 +134,11 @@ struct interpolate_impl { // simple linear interpolation in 1D template <typename T, class Point1, class Point2, class Point3, size_t D> struct interpolate_impl<T, Point1, Point2, Point3, D, 2u> { - static T run(const Point1& pos, const Point2& lowerLeft, - const Point3& upperRight, const std::array<T, 2u>& fields) { + static T + run(const Point1& pos, + const Point2& lowerLeft, + const Point3& upperRight, + const std::array<T, 2u>& fields) { // get distance to lower boundary relative to total bin width const double f = (pos[D] - lowerLeft[D]) / (upperRight[D] - lowerLeft[D]); diff --git a/Core/include/Acts/Utilities/detail/periodic.hpp b/Core/include/Acts/Utilities/detail/periodic.hpp index 1cfd91f9a..f874bcb51 100644 --- a/Core/include/Acts/Utilities/detail/periodic.hpp +++ b/Core/include/Acts/Utilities/detail/periodic.hpp @@ -14,7 +14,8 @@ namespace detail { /// Wrap a periodic value back into the nominal range. template <typename T> -inline T wrap_periodic(T value, T start, T range) { +inline T +wrap_periodic(T value, T start, T range) { using std::floor; // only wrap if really necessary T diff = value - start; @@ -25,13 +26,15 @@ inline T wrap_periodic(T value, T start, T range) { /// Calculate the equivalent angle in the [0, 2*pi) range. template <typename T> -inline T radian_pos(T x) { +inline T +radian_pos(T x) { return wrap_periodic<T>(x, T(0), T(2 * M_PI)); } /// Calculate the equivalent angle in the [-pi, pi) range. template <typename T> -inline T radian_sym(T x) { +inline T +radian_sym(T x) { return wrap_periodic<T>(x, T(-M_PI), T(2 * M_PI)); } diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp index dd2427ba5..6ce9138a9 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp @@ -32,8 +32,10 @@ namespace Acts { /// @tparam input_track_t Track object type /// @tparam propagator_t Propagator type -template <typename bfield_t, typename input_track_t, - typename propagator_t = Propagator<EigenStepper<bfield_t>>> +template < + typename bfield_t, + typename input_track_t, + typename propagator_t = Propagator<EigenStepper<bfield_t>>> class FullBilloirVertexFitter : public IVertexFitter<input_track_t, propagator_t> { public: @@ -59,10 +61,11 @@ class FullBilloirVertexFitter propagator(propagatorIn) {} /// Constructor with default propagator - template <typename T = propagator_t, - std::enable_if_t< - std::is_same<T, Propagator<EigenStepper<bfield_t>>>::value, - int> = 0> + template < + typename T = propagator_t, + std::enable_if_t< + std::is_same<T, Propagator<EigenStepper<bfield_t>>>::value, + int> = 0> Config(const bfield_t& bIn) : bField(bIn), ltConfig(bIn), @@ -75,8 +78,9 @@ class FullBilloirVertexFitter /// @brief Constructor used if input_track_t type == BoundParameters /// /// @param cfg Configuration object - template <typename T = input_track_t, - std::enable_if_t<std::is_same<T, BoundParameters>::value, int> = 0> + template < + typename T = input_track_t, + std::enable_if_t<std::is_same<T, BoundParameters>::value, int> = 0> FullBilloirVertexFitter(const Config& cfg) : m_cfg(cfg), extractParameters([](T params) { return params; }) {} @@ -84,8 +88,9 @@ class FullBilloirVertexFitter /// /// @param cfg Configuration object /// @param func Function extracting BoundParameters from input_track_t object - FullBilloirVertexFitter(const Config& cfg, - std::function<BoundParameters(input_track_t)> func) + FullBilloirVertexFitter( + const Config& cfg, + std::function<BoundParameters(input_track_t)> func) : m_cfg(cfg), extractParameters(func) {} /// @brief Default destructor @@ -118,8 +123,9 @@ class FullBilloirVertexFitter /// @param thetaIn Theta /// /// @return Pair of (corrected phi, corrected theta) - std::pair<double, double> correctPhiThetaPeriodicity(double phiIn, - double thetaIn) const; + std::pair<double, double> correctPhiThetaPeriodicity( + double phiIn, + double thetaIn) const; }; } // namespace Acts diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp index 388ba0a28..a6cce801a 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp @@ -114,8 +114,11 @@ Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>::fit( } auto result = m_cfg.linFactory.linearizeTrack( - vFitterOptions.geoContext, vFitterOptions.magFieldContext, - &trackParams, linPoint, m_cfg.propagator); + vFitterOptions.geoContext, + vFitterOptions.magFieldContext, + &trackParams, + linPoint, + m_cfg.propagator); if (result.ok()) { const auto linTrack = *result; double d0 = linTrack.parametersAtPCA[ParID_t::eLOC_D0]; @@ -128,8 +131,8 @@ Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>::fit( double fPhi = trackMomenta[iTrack][0]; double fTheta = trackMomenta[iTrack][1]; double fQOvP = trackMomenta[iTrack][2]; - BilloirTrack<input_track_t> currentBilloirTrack(trackContainer, - linTrack); + BilloirTrack<input_track_t> currentBilloirTrack( + trackContainer, linTrack); // calculate dqi = deltaQ[i] currentBilloirTrack.deltaQ[0] = d0; @@ -280,9 +283,10 @@ Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>::fit( bTrack.chi2 = ((bTrack.deltaQ - bTrack.DiMat * deltaV - bTrack.EiMat * deltaP) .transpose()) - .dot(bTrack.linTrack.covarianceAtPCA.inverse() * - (bTrack.deltaQ - bTrack.DiMat * deltaV - - bTrack.EiMat * deltaP)); + .dot( + bTrack.linTrack.covarianceAtPCA.inverse() * + (bTrack.deltaQ - bTrack.DiMat * deltaV - + bTrack.EiMat * deltaP)); newChi2 += bTrack.chi2; ++iTrack; @@ -301,8 +305,9 @@ Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>::fit( linPoint[2]); newChi2 += (deltaTrk.transpose()) - .dot(vFitterOptions.vertexConstraint.covariance().inverse() * - deltaTrk); + .dot( + vFitterOptions.vertexConstraint.covariance().inverse() * + deltaTrk); } if (!std::isnormal(newChi2)) { @@ -333,12 +338,14 @@ Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>::fit( paramVec << 0., 0., trackMomenta[iTrack](0), trackMomenta[iTrack](1), trackMomenta[iTrack](2), 0.; - BoundParameters refittedParams(vFitterOptions.geoContext, - std::move(covDeltaPmat[iTrack]), - paramVec, perigee); + BoundParameters refittedParams( + vFitterOptions.geoContext, + std::move(covDeltaPmat[iTrack]), + paramVec, + perigee); - TrackAtVertex<input_track_t> trackVx(bTrack.chi2, refittedParams, - bTrack.originalTrack); + TrackAtVertex<input_track_t> trackVx( + bTrack.chi2, refittedParams, bTrack.originalTrack); tracksAtVertex.push_back(std::move(trackVx)); ++iTrack; } @@ -349,10 +356,9 @@ Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>::fit( } template <typename bfield_t, typename input_track_t, typename propagator_t> -std::pair<double, double> Acts::FullBilloirVertexFitter< - bfield_t, input_track_t, - propagator_t>::correctPhiThetaPeriodicity(double phiIn, - double thetaIn) const { +std::pair<double, double> +Acts::FullBilloirVertexFitter<bfield_t, input_track_t, propagator_t>:: + correctPhiThetaPeriodicity(double phiIn, double thetaIn) const { double tmpPhi = std::fmod(phiIn, 2 * M_PI); // temp phi if (tmpPhi > M_PI) { tmpPhi -= 2 * M_PI; diff --git a/Core/include/Acts/Vertexing/IVertexFitter.hpp b/Core/include/Acts/Vertexing/IVertexFitter.hpp index 6b55d469f..ac3510df6 100644 --- a/Core/include/Acts/Vertexing/IVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/IVertexFitter.hpp @@ -30,10 +30,11 @@ struct VertexFitterOptions { /// @param gctx The goemetry context for this fit /// @param mctx The magnetic context for this fit /// @param pconstraint The pointing contraint to a vertex - VertexFitterOptions(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx, - const Vertex<input_track_t>& vconstr = - Vertex<input_track_t>(Vector3D(0., 0., 0.))) + VertexFitterOptions( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx, + const Vertex<input_track_t>& vconstr = + Vertex<input_track_t>(Vector3D(0., 0., 0.))) : geoContext(gctx), magFieldContext(mctx), vertexConstraint(vconstr) {} /// Context object for the geometry diff --git a/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp b/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp index 08f827c78..48e709e21 100644 --- a/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp +++ b/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp @@ -26,8 +26,9 @@ class ImpactPoint3dEstimator { /// @param refPos Position to calculate distance to /// /// @return Distance - double calculateDistance(const BoundParameters& params, - const Vector3D& refPos) const; + double calculateDistance( + const BoundParameters& params, + const Vector3D& refPos) const; }; } // namespace Acts diff --git a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp index fc423c0ea..81c1144f4 100644 --- a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp @@ -72,18 +72,20 @@ class IterativeVertexFinder { /// /// @note Initializes default LinearizedTrackFactory and ZScanVertexFinder /// as seed finder - Config(const bfield_t& bIn, - std::unique_ptr<IVertexFitter<input_track_t, propagator_t>> fitter, - const propagator_t& propagatorIn) + Config( + const bfield_t& bIn, + std::unique_ptr<IVertexFitter<input_track_t, propagator_t>> fitter, + const propagator_t& propagatorIn) : bField(bIn), vertexFitter(std::move(fitter)), linFactory( typename LinearizedTrackFactory<bfield_t, propagator_t>::Config( bField)), propagator(propagatorIn), - zScanFinderCfg( - typename ZScanVertexFinder<bfield_t, BoundParameters, - propagator_t>::Config(propagator)), + zScanFinderCfg(typename ZScanVertexFinder< + bfield_t, + BoundParameters, + propagator_t>::Config(propagator)), seedFinder(ZScanVertexFinder<bfield_t, BoundParameters, propagator_t>( std::move(zScanFinderCfg))) {} @@ -133,11 +135,13 @@ class IterativeVertexFinder { /// /// @param cfg Configuration object /// @param logger The logging instance - template <typename T = input_track_t, - std::enable_if_t<std::is_same<T, BoundParameters>::value, int> = 0> - IterativeVertexFinder(Config& cfg, - std::unique_ptr<const Logger> logger = getDefaultLogger( - "IterativeVertexFinder", Logging::INFO)) + template < + typename T = input_track_t, + std::enable_if_t<std::is_same<T, BoundParameters>::value, int> = 0> + IterativeVertexFinder( + Config& cfg, + std::unique_ptr<const Logger> logger = + getDefaultLogger("IterativeVertexFinder", Logging::INFO)) : m_cfg(std::move(cfg)), m_extractParameters([](T params) { return params; }), m_logger(std::move(logger)) {} @@ -147,10 +151,11 @@ class IterativeVertexFinder { /// @param cfg Configuration object /// @param func Function extracting BoundParameters from input_track_t object /// @param logger The logging instance - IterativeVertexFinder(Config& cfg, - std::function<BoundParameters(input_track_t)> func, - std::unique_ptr<const Logger> logger = getDefaultLogger( - "IterativeVertexFinder", Logging::INFO)) + IterativeVertexFinder( + Config& cfg, + std::function<BoundParameters(input_track_t)> func, + std::unique_ptr<const Logger> logger = + getDefaultLogger("IterativeVertexFinder", Logging::INFO)) : m_cfg(std::move(cfg)), m_extractParameters(func), m_logger(std::move(logger)) {} @@ -180,7 +185,10 @@ class IterativeVertexFinder { std::unique_ptr<const Logger> m_logger; /// Private access to logging instance - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// @brief Method that calls seed finder to retrieve a vertex seed /// @@ -194,8 +202,9 @@ class IterativeVertexFinder { /// /// @param perigeesToFit Tracks to be removed from seedTracks /// @param seedTracks List to remove tracks from - void removeAllTracks(const std::vector<input_track_t>& perigeesToFit, - std::vector<input_track_t>& seedTracks) const; + void removeAllTracks( + const std::vector<input_track_t>& perigeesToFit, + std::vector<input_track_t>& seedTracks) const; /// @brief Function for calculating how compatible /// a given track is to a given vertex @@ -204,7 +213,8 @@ class IterativeVertexFinder { /// @param vertex Vertex /// @param vFinderOptions Vertex finder options Result<double> getCompatibility( - const BoundParameters& params, const Vertex<input_track_t>& vertex, + const BoundParameters& params, + const Vertex<input_track_t>& vertex, const VertexFinderOptions<input_track_t>& vFinderOptions) const; /// @brief Function that removes used tracks compatible with diff --git a/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp b/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp index 4cd32eae4..804966f64 100644 --- a/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp @@ -24,7 +24,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::find( // Construct the vertex fitter options from vertex finder options VertexFitterOptions<input_track_t> vFitterOptions( - vFinderOptions.geoContext, vFinderOptions.magFieldContext, + vFinderOptions.geoContext, + vFinderOptions.magFieldContext, vFinderOptions.vertexConstraint); // List of vertices to be filled below @@ -48,8 +49,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::find( std::vector<input_track_t> perigeesToFitSplitVertex; // Fill vector with tracks to fit, only compatible with seed: - fillPerigeesToFit(seedTracks, seedVertex, perigeesToFit, - perigeesToFitSplitVertex); + fillPerigeesToFit( + seedTracks, seedVertex, perigeesToFit, perigeesToFitSplitVertex); ACTS_DEBUG("Perigees used for fit: " << perigeesToFit.size()); /// Begin vertex fit @@ -103,8 +104,13 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::find( // but add tracks which may have been missed auto result = reassignTracksToNewVertex( - vertexCollection, currentVertex, perigeesToFit, seedTracks, - origTracks, vFitterOptions, vFinderOptions); + vertexCollection, + currentVertex, + perigeesToFit, + seedTracks, + origTracks, + vFitterOptions, + vFinderOptions); if (!result.ok()) { return result.error(); } @@ -113,8 +119,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::find( } // end reassignTracksAfterFirstFit case // still good vertex? might have changed in the meanwhile if (isGoodVertex) { - removeUsedCompatibleTracks(currentVertex, perigeesToFit, seedTracks, - vFinderOptions); + removeUsedCompatibleTracks( + currentVertex, perigeesToFit, seedTracks, vFinderOptions); ACTS_DEBUG( "Number of seed tracks after removal of compatible tracks " @@ -131,8 +137,11 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::find( if (!isGoodSplitVertex) { removeAllTracks(perigeesToFitSplitVertex, seedTracks); } else { - removeUsedCompatibleTracks(currentSplitVertex, perigeesToFitSplitVertex, - seedTracks, vFinderOptions); + removeUsedCompatibleTracks( + currentSplitVertex, + perigeesToFitSplitVertex, + seedTracks, + vFinderOptions); } } // Now fill vertex collection with vertex @@ -151,8 +160,9 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::find( } template <typename bfield_t, typename input_track_t, typename propagator_t> -Acts::Result<Acts::Vertex<input_track_t>> Acts:: - IterativeVertexFinder<bfield_t, input_track_t, propagator_t>::getVertexSeed( +Acts::Result<Acts::Vertex<input_track_t>> +Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: + getVertexSeed( const std::vector<input_track_t>& seedTracks, const VertexFinderOptions<input_track_t>& vFinderOptions) const { auto res = m_cfg.seedFinder.find(seedTracks, vFinderOptions); @@ -165,11 +175,12 @@ Acts::Result<Acts::Vertex<input_track_t>> Acts:: } // current seed is last element in collection Vertex<input_track_t> seedVertex = vertexCollection.back(); - ACTS_DEBUG("Seed found at position: (" - << seedVertex.fullPosition()[eX] << ", " - << seedVertex.fullPosition()[eY] << ", " - << seedVertex.fullPosition()[eZ] << ", " << seedVertex.time() - << "). Number of input tracks: " << seedTracks.size()); + ACTS_DEBUG( + "Seed found at position: (" + << seedVertex.fullPosition()[eX] << ", " + << seedVertex.fullPosition()[eY] << ", " + << seedVertex.fullPosition()[eZ] << ", " << seedVertex.time() + << "). Number of input tracks: " << seedTracks.size()); return seedVertex; } else { ACTS_DEBUG("No seed found. Number of input tracks: " << seedTracks.size()); @@ -178,9 +189,11 @@ Acts::Result<Acts::Vertex<input_track_t>> Acts:: } template <typename bfield_t, typename input_track_t, typename propagator_t> -void Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: - removeAllTracks(const std::vector<input_track_t>& perigeesToFit, - std::vector<input_track_t>& seedTracks) const { +void +Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: + removeAllTracks( + const std::vector<input_track_t>& perigeesToFit, + std::vector<input_track_t>& seedTracks) const { auto seedBegin = seedTracks.begin(); auto seedEnd = seedTracks.end(); @@ -209,12 +222,16 @@ template <typename bfield_t, typename input_track_t, typename propagator_t> Acts::Result<double> Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: getCompatibility( - const BoundParameters& params, const Vertex<input_track_t>& vertex, + const BoundParameters& params, + const Vertex<input_track_t>& vertex, const VertexFinderOptions<input_track_t>& vFinderOptions) const { // Linearize track auto result = m_cfg.linFactory.linearizeTrack( - vFinderOptions.geoContext, vFinderOptions.magFieldContext, ¶ms, - vertex.fullPosition(), m_cfg.propagator); + vFinderOptions.geoContext, + vFinderOptions.magFieldContext, + ¶ms, + vertex.fullPosition(), + m_cfg.propagator); if (!result.ok()) { return result.error(); } @@ -279,7 +296,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: // remove track from perigeesToFit if compatible found = false; for (auto perigeesToFitIter = perigeesToFitBegin; - perigeesToFitIter != perigeesToFitEnd; ++perigeesToFitIter) { + perigeesToFitIter != perigeesToFitEnd; + ++perigeesToFitIter) { if (m_extractParameters(*perigeesToFitIter) == m_extractParameters(trackAtVtx.originalTrack)) { found = true; @@ -296,8 +314,9 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: } } // end iteration over tracksAtVertex - ACTS_DEBUG("After removal of tracks belonging to vertex, " - << seedTracks.size() << " seed tracks left."); + ACTS_DEBUG( + "After removal of tracks belonging to vertex, " << seedTracks.size() + << " seed tracks left."); // Now start considering outliers // perigeesToFit that are left here were below @@ -309,8 +328,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: for (const auto& myPerigeeToFit : perigeesToFit) { // calculate chi2 w.r.t. last fitted vertex - auto result = getCompatibility(m_extractParameters(myPerigeeToFit), - myVertex, vFinderOptions); + auto result = getCompatibility( + m_extractParameters(myPerigeeToFit), myVertex, vFinderOptions); if (!result.ok()) { return result.error(); @@ -337,7 +356,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: } else { // Remove track from current vertex for (auto trackAtVtxIter = trackAtVtxBegin; - trackAtVtxIter != trackAtVtxEnd; ++trackAtVtxIter) { + trackAtVtxIter != trackAtVtxEnd; + ++trackAtVtxIter) { if (m_extractParameters(trackAtVtxIter->originalTrack) == m_extractParameters(myPerigeeToFit)) { ACTS_DEBUG( @@ -360,7 +380,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: } template <typename bfield_t, typename input_track_t, typename propagator_t> -void Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: +void +Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: fillPerigeesToFit( const std::vector<input_track_t>& perigeeList, const Vertex<input_track_t>& seedVertex, @@ -378,8 +399,9 @@ void Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: } else if (numberOfTracks <= 4 && !m_cfg.createSplitVertices) { perigeesToFitOut.push_back(sTrack); ++count; - } else if (numberOfTracks <= 4 * m_cfg.splitVerticesTrkInvFraction && - m_cfg.createSplitVertices) { + } else if ( + numberOfTracks <= 4 * m_cfg.splitVerticesTrkInvFraction && + m_cfg.createSplitVertices) { // Only few tracks left, put them into fit regardless their position if (count % m_cfg.splitVerticesTrkInvFraction == 0) { perigeesToFitOut.push_back(sTrack); @@ -396,8 +418,9 @@ void Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: double distance = m_cfg.ipEst.calculateDistance(sTrackParams, seedVertex.position()); - double error = sqrt((*(sTrackParams.covariance()))(eLOC_D0, eLOC_D0) + - (*(sTrackParams.covariance()))(eLOC_Z0, eLOC_Z0)); + double error = sqrt( + (*(sTrackParams.covariance()))(eLOC_D0, eLOC_D0) + + (*(sTrackParams.covariance()))(eLOC_Z0, eLOC_Z0)); if (error == 0.) { ACTS_WARNING("Error is zero. Setting to 1."); @@ -476,7 +499,8 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: // delete it later // when all tracks used to fit current vertex are deleted seedTracks.push_back(*std::find_if( - origTracks.begin(), origTracks.end(), + origTracks.begin(), + origTracks.end(), [&trackPerigee, this](auto origTrack) { return trackPerigee == m_extractParameters(origTrack); })); @@ -499,8 +523,9 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: vertexIt.setTracksAtVertex(tracksAtVertex); } // end loop over all vertices - ACTS_DEBUG("Added " << numberOfAddedTracks - << " tracks from old (other) vertices for new fit"); + ACTS_DEBUG( + "Added " << numberOfAddedTracks + << " tracks from old (other) vertices for new fit"); // override current vertex with new fit // set first to default vertex to be able to check if still good vertex @@ -535,18 +560,22 @@ Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: if (!isGoodVertex) { removeAllTracks(perigeesToFit, seedTracks); - ACTS_DEBUG("Going to new iteration with " - << seedTracks.size() << "seed tracks after BAD vertex."); + ACTS_DEBUG( + "Going to new iteration with " << seedTracks.size() + << "seed tracks after BAD vertex."); } return Result<bool>::success(isGoodVertex); } template <typename bfield_t, typename input_track_t, typename propagator_t> -int Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: +int +Acts::IterativeVertexFinder<bfield_t, input_track_t, propagator_t>:: countSignificantTracks(const Vertex<input_track_t>& vtx) const { - return std::count_if(vtx.tracks().begin(), vtx.tracks().end(), - [this](TrackAtVertex<input_track_t> trk) { - return trk.trackWeight > m_cfg.cutOffTrackWeight; - }); + return std::count_if( + vtx.tracks().begin(), + vtx.tracks().end(), + [this](TrackAtVertex<input_track_t> trk) { + return trk.trackWeight > m_cfg.cutOffTrackWeight; + }); } diff --git a/Core/include/Acts/Vertexing/LinearizedTrack.hpp b/Core/include/Acts/Vertexing/LinearizedTrack.hpp index 3be7dc6cf..f6a1f0d36 100644 --- a/Core/include/Acts/Vertexing/LinearizedTrack.hpp +++ b/Core/include/Acts/Vertexing/LinearizedTrack.hpp @@ -44,13 +44,15 @@ struct LinearizedTrack { LinearizedTrack() = default; - LinearizedTrack(const BoundVector& paramsAtPCA, - const BoundSymMatrix& parCovarianceAtPCA, - const SpacePointVector& linPoint, - const SpacePointToBoundMatrix& posJacobian, - const ActsMatrixD<BoundParsDim, 3>& momJacobian, - const SpacePointVector& position, const Vector3D& momentum, - const BoundVector& constTerm) + LinearizedTrack( + const BoundVector& paramsAtPCA, + const BoundSymMatrix& parCovarianceAtPCA, + const SpacePointVector& linPoint, + const SpacePointToBoundMatrix& posJacobian, + const ActsMatrixD<BoundParsDim, 3>& momJacobian, + const SpacePointVector& position, + const Vector3D& momentum, + const BoundVector& constTerm) : parametersAtPCA(paramsAtPCA), covarianceAtPCA(parCovarianceAtPCA), linearizationPoint(linPoint), diff --git a/Core/include/Acts/Vertexing/LinearizedTrackFactory.hpp b/Core/include/Acts/Vertexing/LinearizedTrackFactory.hpp index 4a1476b3f..572e0af14 100644 --- a/Core/include/Acts/Vertexing/LinearizedTrackFactory.hpp +++ b/Core/include/Acts/Vertexing/LinearizedTrackFactory.hpp @@ -39,9 +39,11 @@ namespace Acts { /// @tparam propagator_t Propagator type /// @tparam action_list_t Propagator action list type /// @tparam aborter_list_t Propagator aborter list type -template <typename bfield_t, typename propagator_t, - typename action_list_t = ActionList<>, - typename aborter_list_t = AbortList<>> +template < + typename bfield_t, + typename propagator_t, + typename action_list_t = ActionList<>, + typename aborter_list_t = AbortList<>> class LinearizedTrackFactory { public: struct Config { @@ -64,11 +66,12 @@ class LinearizedTrackFactory { /// @param propagator Propagator /// /// @return Linearized track - Result<LinearizedTrack> linearizeTrack(const GeometryContext& gctx, - const MagneticFieldContext& mctx, - const BoundParameters* params, - const SpacePointVector& linPoint, - const propagator_t& propagator) const; + Result<LinearizedTrack> linearizeTrack( + const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const BoundParameters* params, + const SpacePointVector& linPoint, + const propagator_t& propagator) const; private: // Configuration object diff --git a/Core/include/Acts/Vertexing/LinearizedTrackFactory.ipp b/Core/include/Acts/Vertexing/LinearizedTrackFactory.ipp index 3c1b6858d..a418f17b0 100644 --- a/Core/include/Acts/Vertexing/LinearizedTrackFactory.ipp +++ b/Core/include/Acts/Vertexing/LinearizedTrackFactory.ipp @@ -8,16 +8,24 @@ #include "Acts/Surfaces/PerigeeSurface.hpp" -template <typename bfield_t, typename propagator_t, typename action_list_t, - typename aborter_list_t> - -Acts::Result<Acts::LinearizedTrack> Acts::LinearizedTrackFactory< - bfield_t, propagator_t, action_list_t, - aborter_list_t>::linearizeTrack(const GeometryContext& gctx, - const MagneticFieldContext& mctx, - const BoundParameters* params, - const SpacePointVector& linPoint, - const propagator_t& propagator) const { +template < + typename bfield_t, + typename propagator_t, + typename action_list_t, + typename aborter_list_t> + +Acts::Result<Acts::LinearizedTrack> +Acts::LinearizedTrackFactory< + bfield_t, + propagator_t, + action_list_t, + aborter_list_t>:: + linearizeTrack( + const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const BoundParameters* params, + const SpacePointVector& linPoint, + const propagator_t& propagator) const { if (params == nullptr) { return LinearizedTrack(); } @@ -161,7 +169,13 @@ Acts::Result<Acts::LinearizedTrack> Acts::LinearizedTrackFactory< BoundVector constTerm = predParamsAtPCA - positionJacobian * positionAtPCA - momentumJacobian * momentumAtPCA; - return LinearizedTrack(paramsAtPCA, parCovarianceAtPCA, linPoint, - positionJacobian, momentumJacobian, positionAtPCA, - momentumAtPCA, constTerm); + return LinearizedTrack( + paramsAtPCA, + parCovarianceAtPCA, + linPoint, + positionJacobian, + momentumJacobian, + positionAtPCA, + momentumAtPCA, + constTerm); } diff --git a/Core/include/Acts/Vertexing/TrackAtVertex.hpp b/Core/include/Acts/Vertexing/TrackAtVertex.hpp index eab8b6e2e..762329c46 100644 --- a/Core/include/Acts/Vertexing/TrackAtVertex.hpp +++ b/Core/include/Acts/Vertexing/TrackAtVertex.hpp @@ -30,8 +30,10 @@ struct TrackAtVertex { /// @param paramsAtVertex Fitted perigee parameter /// @param originalParams Original perigee parameter - TrackAtVertex(double chi2perTrack, const BoundParameters& paramsAtVertex, - const input_track_t& originalParams) + TrackAtVertex( + double chi2perTrack, + const BoundParameters& paramsAtVertex, + const input_track_t& originalParams) : chi2Track(chi2perTrack), fittedParams(paramsAtVertex), originalTrack(originalParams), diff --git a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp index 32cd2b524..f961391aa 100644 --- a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp +++ b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp @@ -30,9 +30,11 @@ struct ImpactParametersAndSigma { double PVsigmaz0SinTheta = 0.; }; -template <typename input_track_t, typename propagator_t, - typename action_list_t = ActionList<>, - typename aborter_list_t = AbortList<>> +template < + typename input_track_t, + typename propagator_t, + typename action_list_t = ActionList<>, + typename aborter_list_t = AbortList<>> /// @class TrackToVertexIPEstimator estimates the impact parameters and their /// errors of a given track w.r.t. a vertex @@ -41,9 +43,9 @@ class TrackToVertexIPEstimator { /// @brief Default constructor /// /// @param logger Logging instance - TrackToVertexIPEstimator(std::unique_ptr<const Logger> logger = - getDefaultLogger("TrackToVertexIPEstimator", - Logging::INFO)) + TrackToVertexIPEstimator( + std::unique_ptr<const Logger> logger = + getDefaultLogger("TrackToVertexIPEstimator", Logging::INFO)) : m_logger(std::move(logger)) {} /// @brief Move constructor @@ -60,8 +62,10 @@ class TrackToVertexIPEstimator { /// @param vtx Vertex the track belongs to /// @param propagator Propagator Result<std::unique_ptr<ImpactParametersAndSigma>> estimate( - const GeometryContext& gctx, const MagneticFieldContext& mctx, - const BoundParameters& track, const Vertex<input_track_t>& vtx, + const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const BoundParameters& track, + const Vertex<input_track_t>& vtx, const propagator_t& propagator) const; private: @@ -69,7 +73,10 @@ class TrackToVertexIPEstimator { std::unique_ptr<const Logger> m_logger; /// Private access to logging instance - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } }; } // namespace Acts diff --git a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp index 204e7b5ac..1aef97084 100644 --- a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp +++ b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp @@ -8,16 +8,23 @@ #include "Acts/Surfaces/PerigeeSurface.hpp" -template <typename input_track_t, typename propagator_t, typename action_list_t, - typename aborter_list_t> +template < + typename input_track_t, + typename propagator_t, + typename action_list_t, + typename aborter_list_t> Acts::Result<std::unique_ptr<Acts::ImpactParametersAndSigma>> Acts::TrackToVertexIPEstimator< - input_track_t, propagator_t, action_list_t, - aborter_list_t>::estimate(const GeometryContext& gctx, - const MagneticFieldContext& mctx, - const BoundParameters& track, - const Vertex<input_track_t>& vtx, - const propagator_t& propagator) const { + input_track_t, + propagator_t, + action_list_t, + aborter_list_t>:: + estimate( + const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const BoundParameters& track, + const Vertex<input_track_t>& vtx, + const propagator_t& propagator) const { // estimating the d0 and its significance by propagating the trajectory state // towards // the vertex position. By this time the vertex should NOT contain this @@ -28,8 +35,8 @@ Acts::TrackToVertexIPEstimator< const std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(lp); - PropagatorOptions<action_list_t, aborter_list_t> propagatorOptions(gctx, - mctx); + PropagatorOptions<action_list_t, aborter_list_t> propagatorOptions( + gctx, mctx); // Do the propagation to linPoint auto result = propagator.propagate(track, *perigeeSurface, propagatorOptions); diff --git a/Core/include/Acts/Vertexing/Vertex.hpp b/Core/include/Acts/Vertexing/Vertex.hpp index c27027fac..85d27718d 100644 --- a/Core/include/Acts/Vertexing/Vertex.hpp +++ b/Core/include/Acts/Vertexing/Vertex.hpp @@ -40,17 +40,20 @@ class Vertex { /// @param position Vertex position /// @param covariance Position covariance matrix /// @param tracks Vector of tracks associated with the vertex - Vertex(const Vector3D& position, const ActsSymMatrixD<3>& covariance, - std::vector<TrackAtVertex<input_track_t>>& tracks); + Vertex( + const Vector3D& position, + const ActsSymMatrixD<3>& covariance, + std::vector<TrackAtVertex<input_track_t>>& tracks); /// @brief Vertex constructor /// /// @param position Full vertex position /// @param covariance 4x4 covariance matrix /// @param tracks Vector of tracks associated with the vertex - Vertex(const SpacePointVector& position, - const SpacePointSymMatrix& covariance, - std::vector<TrackAtVertex<input_track_t>>& tracks); + Vertex( + const SpacePointVector& position, + const SpacePointSymMatrix& covariance, + std::vector<TrackAtVertex<input_track_t>>& tracks); /// @return Returns 3-position Vector3D position() const; diff --git a/Core/include/Acts/Vertexing/Vertex.ipp b/Core/include/Acts/Vertexing/Vertex.ipp index e7e3ce998..21a683fd8 100644 --- a/Core/include/Acts/Vertexing/Vertex.ipp +++ b/Core/include/Acts/Vertexing/Vertex.ipp @@ -23,7 +23,8 @@ Acts::Vertex<input_track_t>::Vertex(const SpacePointVector& position) template <typename input_track_t> Acts::Vertex<input_track_t>::Vertex( - const Vector3D& position, const ActsSymMatrixD<3>& covariance, + const Vector3D& position, + const ActsSymMatrixD<3>& covariance, std::vector<TrackAtVertex<input_track_t>>& tracks) : m_tracksAtVertex(std::move(tracks)) { m_position.setZero(); @@ -34,36 +35,40 @@ Acts::Vertex<input_track_t>::Vertex( template <typename input_track_t> Acts::Vertex<input_track_t>::Vertex( - const SpacePointVector& position, const SpacePointSymMatrix& covariance, + const SpacePointVector& position, + const SpacePointSymMatrix& covariance, std::vector<TrackAtVertex<input_track_t>>& tracks) : m_position(position), m_covariance(covariance), m_tracksAtVertex(std::move(tracks)) {} template <typename input_track_t> -Acts::Vector3D Acts::Vertex<input_track_t>::position() const { +Acts::Vector3D +Acts::Vertex<input_track_t>::position() const { return VectorHelpers::position(m_position); } template <typename input_track_t> -Acts::ParValue_t Acts::Vertex<input_track_t>::time() const { +Acts::ParValue_t +Acts::Vertex<input_track_t>::time() const { return VectorHelpers::time(m_position); } template <typename input_track_t> -const Acts::SpacePointVector& Acts::Vertex<input_track_t>::fullPosition() - const { +const Acts::SpacePointVector& +Acts::Vertex<input_track_t>::fullPosition() const { return m_position; } template <typename input_track_t> -Acts::ActsSymMatrixD<3> Acts::Vertex<input_track_t>::covariance() const { +Acts::ActsSymMatrixD<3> +Acts::Vertex<input_track_t>::covariance() const { return m_covariance.block<3, 3>(0, 0); } template <typename input_track_t> -const Acts::SpacePointSymMatrix& Acts::Vertex<input_track_t>::fullCovariance() - const { +const Acts::SpacePointSymMatrix& +Acts::Vertex<input_track_t>::fullCovariance() const { return m_covariance; } @@ -75,49 +80,59 @@ Acts::Vertex<input_track_t>::tracks() const { } template <typename input_track_t> -std::pair<double, double> Acts::Vertex<input_track_t>::fitQuality() const { +std::pair<double, double> +Acts::Vertex<input_track_t>::fitQuality() const { return std::pair<double, double>(m_chiSquared, m_numberDoF); } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setPosition(const Vector3D& position, - ParValue_t time) { +void +Acts::Vertex<input_track_t>::setPosition( + const Vector3D& position, + ParValue_t time) { VectorHelpers::position(m_position) = position; VectorHelpers::time(m_position) = time; } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setFullPosition( +void +Acts::Vertex<input_track_t>::setFullPosition( const SpacePointVector& fullPosition) { m_position = fullPosition; } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setTime(ParValue_t time) { +void +Acts::Vertex<input_track_t>::setTime(ParValue_t time) { VectorHelpers::time(m_position) = time; } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setCovariance( +void +Acts::Vertex<input_track_t>::setCovariance( const ActsSymMatrixD<3>& covariance) { m_covariance.block<3, 3>(0, 0) = covariance; } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setFullCovariance( +void +Acts::Vertex<input_track_t>::setFullCovariance( const SpacePointSymMatrix& covariance) { m_covariance = covariance; } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setTracksAtVertex( +void +Acts::Vertex<input_track_t>::setTracksAtVertex( const std::vector<TrackAtVertex<input_track_t>>& tracks) { m_tracksAtVertex = std::move(tracks); } template <typename input_track_t> -void Acts::Vertex<input_track_t>::setFitQuality(double chiSquared, - double numberDoF) { +void +Acts::Vertex<input_track_t>::setFitQuality( + double chiSquared, + double numberDoF) { m_chiSquared = chiSquared; m_numberDoF = numberDoF; } diff --git a/Core/include/Acts/Vertexing/VertexFinderOptions.hpp b/Core/include/Acts/Vertexing/VertexFinderOptions.hpp index 7861bd901..aa3900dce 100644 --- a/Core/include/Acts/Vertexing/VertexFinderOptions.hpp +++ b/Core/include/Acts/Vertexing/VertexFinderOptions.hpp @@ -22,10 +22,11 @@ struct VertexFinderOptions { /// @param gctx The goemetry context for this fit /// @param mctx The magnetic context for this fit /// @param vconstr The pointing contraint to a vertex - VertexFinderOptions(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx, - const Vertex<input_track_t>& vconstr = - Vertex<input_track_t>(Vector3D(0., 0., 0.))) + VertexFinderOptions( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx, + const Vertex<input_track_t>& vconstr = + Vertex<input_track_t>(Vector3D(0., 0., 0.))) : geoContext(gctx), magFieldContext(mctx), vertexConstraint(vconstr) {} /// Context object for the geometry diff --git a/Core/include/Acts/Vertexing/VertexingError.hpp b/Core/include/Acts/Vertexing/VertexingError.hpp index c51734b2e..4e82117fb 100644 --- a/Core/include/Acts/Vertexing/VertexingError.hpp +++ b/Core/include/Acts/Vertexing/VertexingError.hpp @@ -25,9 +25,13 @@ namespace detail { class VertexingErrorCategory : public std::error_category { public: // Return a short descriptive name for the category - const char* name() const noexcept final { return "VertexingError"; } + const char* + name() const noexcept final { + return "VertexingError"; + } // Return what each enum means in text - std::string message(int c) const final { + std::string + message(int c) const final { switch (static_cast<VertexingError>(c)) { case VertexingError::NumericFailure: return "Numeric failure in calculation."; @@ -43,12 +47,14 @@ class VertexingErrorCategory : public std::error_category { } // namespace detail // Declare a global function returning a static instance of the custom category -extern inline const detail::VertexingErrorCategory& VertexingErrorCategory() { +extern inline const detail::VertexingErrorCategory& +VertexingErrorCategory() { static detail::VertexingErrorCategory c; return c; } -inline std::error_code make_error_code(Acts::VertexingError e) { +inline std::error_code +make_error_code(Acts::VertexingError e) { return {static_cast<int>(e), Acts::VertexingErrorCategory()}; } } // namespace Acts diff --git a/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp b/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp index c8dedafd0..3526a5624 100644 --- a/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp @@ -69,11 +69,13 @@ class ZScanVertexFinder { /// /// @param cfg Configuration object /// @param logger The logging instance - template <typename T = input_track_t, - std::enable_if_t<std::is_same<T, BoundParameters>::value, int> = 0> - ZScanVertexFinder(Config cfg, - std::unique_ptr<const Logger> logger = - getDefaultLogger("ZScanVertexFinder", Logging::INFO)) + template < + typename T = input_track_t, + std::enable_if_t<std::is_same<T, BoundParameters>::value, int> = 0> + ZScanVertexFinder( + Config cfg, + std::unique_ptr<const Logger> logger = + getDefaultLogger("ZScanVertexFinder", Logging::INFO)) : m_cfg(std::move(cfg)), m_extractParameters([](T params) { return params; }), m_logger(std::move(logger)) {} @@ -83,10 +85,11 @@ class ZScanVertexFinder { /// @param cfg Configuration object /// @param func Function extracting BoundParameters from input_track_t object /// @param logger Logging instance - ZScanVertexFinder(Config cfg, - std::function<BoundParameters(input_track_t)> func, - std::unique_ptr<const Logger> logger = - getDefaultLogger("ZScanVertexFinder", Logging::INFO)) + ZScanVertexFinder( + Config cfg, + std::function<BoundParameters(input_track_t)> func, + std::unique_ptr<const Logger> logger = + getDefaultLogger("ZScanVertexFinder", Logging::INFO)) : m_cfg(std::move(cfg)), m_extractParameters(func), m_logger(std::move(logger)) {} @@ -118,7 +121,10 @@ class ZScanVertexFinder { std::unique_ptr<const Logger> m_logger; /// Private access to logging instance - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } }; } // namespace Acts diff --git a/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp b/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp index 4c1b15297..9b6b12b35 100644 --- a/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp @@ -31,8 +31,11 @@ Acts::ZScanVertexFinder<bfield_t, input_track_t, propagator_t>::find( if (useConstraint && vFinderOptions.vertexConstraint.covariance()(0, 0) != 0) { auto estRes = m_cfg.ipEstimator.estimate( - vFinderOptions.geoContext, vFinderOptions.magFieldContext, params, - vFinderOptions.vertexConstraint, m_cfg.propagator); + vFinderOptions.geoContext, + vFinderOptions.magFieldContext, + params, + vFinderOptions.vertexConstraint, + m_cfg.propagator); if (estRes.ok()) { ipas = std::move(*estRes); } else { @@ -49,9 +52,9 @@ Acts::ZScanVertexFinder<bfield_t, input_track_t, propagator_t>::find( double chi2IP = std::pow(ipas->IPd0 / ipas->sigmad0, 2); if (!m_cfg.disableAllWeights) { - z0AndWeight.second = - 1. / (1. + std::exp((chi2IP - m_cfg.constraintcutoff) / - m_cfg.constrainttemp)); + z0AndWeight.second = 1. / (1. + std::exp( + (chi2IP - m_cfg.constraintcutoff) / + m_cfg.constrainttemp)); // overflow protection if (!std::isnormal(z0AndWeight.second)) { z0AndWeight.second = 0.; @@ -97,9 +100,11 @@ Acts::ZScanVertexFinder<bfield_t, input_track_t, propagator_t>::find( } // constraint x()/y() equals 0 if no constraint - SpacePointVector output(vFinderOptions.vertexConstraint.position().x(), - vFinderOptions.vertexConstraint.position().y(), - ZResult, vFinderOptions.vertexConstraint.time()); + SpacePointVector output( + vFinderOptions.vertexConstraint.position().x(), + vFinderOptions.vertexConstraint.position().y(), + ZResult, + vFinderOptions.vertexConstraint.time()); Vertex<input_track_t> vtxResult = Vertex<input_track_t>(output); // Vector to be filled with one single vertex diff --git a/Core/src/EventData/TrackParametersBase.cpp b/Core/src/EventData/TrackParametersBase.cpp index b18387c1f..376a80214 100644 --- a/Core/src/EventData/TrackParametersBase.cpp +++ b/Core/src/EventData/TrackParametersBase.cpp @@ -13,7 +13,8 @@ #include "Acts/EventData/TrackParametersBase.hpp" namespace Acts { -std::ostream& TrackParametersBase::print(std::ostream& sl) const { +std::ostream& +TrackParametersBase::print(std::ostream& sl) const { // set stream output format auto old_precision = sl.precision(7); auto old_flags = sl.setf(std::ios::fixed); diff --git a/Core/src/Geometry/AbstractVolume.cpp b/Core/src/Geometry/AbstractVolume.cpp index 3c573908b..7ebf9c15b 100644 --- a/Core/src/Geometry/AbstractVolume.cpp +++ b/Core/src/Geometry/AbstractVolume.cpp @@ -31,7 +31,8 @@ Acts::AbstractVolume::boundarySurfaces() const { return m_boundarySurfaces; } -void Acts::AbstractVolume::createBoundarySurfaces() { +void +Acts::AbstractVolume::createBoundarySurfaces() { // transform Surfaces To BoundarySurfaces std::vector<std::shared_ptr<const Surface>> surfaces = Volume::volumeBounds().decomposeToSurfaces(m_transform.get()); @@ -49,8 +50,8 @@ void Acts::AbstractVolume::createBoundarySurfaces() { AbstractVolume* outer = (inner) != nullptr ? nullptr : this; // create the boundary surface BoundarySurfacePtr bSurface = - std::make_shared<const BoundarySurfaceT<AbstractVolume>>(std::move(sf), - inner, outer); + std::make_shared<const BoundarySurfaceT<AbstractVolume>>( + std::move(sf), inner, outer); m_boundarySurfaces.push_back(bSurface); } } diff --git a/Core/src/Geometry/BinUtility.cpp b/Core/src/Geometry/BinUtility.cpp index 396688507..a7dff24fa 100644 --- a/Core/src/Geometry/BinUtility.cpp +++ b/Core/src/Geometry/BinUtility.cpp @@ -17,6 +17,7 @@ #include <iostream> /**Overload of << operator for std::ostream for debug output*/ -std::ostream& Acts::operator<<(std::ostream& sl, const BinUtility& bgen) { +std::ostream& +Acts::operator<<(std::ostream& sl, const BinUtility& bgen) { return bgen.toStream(sl); } diff --git a/Core/src/Geometry/ConeLayer.cpp b/Core/src/Geometry/ConeLayer.cpp index f5c278969..75c30cd4f 100644 --- a/Core/src/Geometry/ConeLayer.cpp +++ b/Core/src/Geometry/ConeLayer.cpp @@ -17,19 +17,22 @@ #include "Acts/Surfaces/ConeBounds.hpp" #include "Acts/Utilities/Definitions.hpp" -Acts::ConeLayer::ConeLayer(std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const ConeBounds> cbounds, - std::unique_ptr<SurfaceArray> surfaceArray, - double thickness, - std::unique_ptr<ApproachDescriptor> ade, - LayerType laytyp) +Acts::ConeLayer::ConeLayer( + std::shared_ptr<const Transform3D> transform, + std::shared_ptr<const ConeBounds> cbounds, + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness, + std::unique_ptr<ApproachDescriptor> ade, + LayerType laytyp) : ConeSurface(std::move(transform), std::move(cbounds)), Layer(std::move(surfaceArray), thickness, std::move(ade), laytyp) {} -const Acts::ConeSurface& Acts::ConeLayer::surfaceRepresentation() const { +const Acts::ConeSurface& +Acts::ConeLayer::surfaceRepresentation() const { return (*this); } -Acts::ConeSurface& Acts::ConeLayer::surfaceRepresentation() { +Acts::ConeSurface& +Acts::ConeLayer::surfaceRepresentation() { return (*this); } diff --git a/Core/src/Geometry/CuboidVolumeBounds.cpp b/Core/src/Geometry/CuboidVolumeBounds.cpp index bf6570933..d2f2fb320 100644 --- a/Core/src/Geometry/CuboidVolumeBounds.cpp +++ b/Core/src/Geometry/CuboidVolumeBounds.cpp @@ -21,8 +21,10 @@ Acts::CuboidVolumeBounds::CuboidVolumeBounds() : VolumeBounds(), m_valueStore(bv_length, 0.) {} -Acts::CuboidVolumeBounds::CuboidVolumeBounds(double halex, double haley, - double halez) +Acts::CuboidVolumeBounds::CuboidVolumeBounds( + double halex, + double haley, + double halez) : VolumeBounds(), m_valueStore(bv_length, 0.), m_xyBounds(nullptr), @@ -46,8 +48,8 @@ Acts::CuboidVolumeBounds::CuboidVolumeBounds(const CuboidVolumeBounds& bobo) Acts::CuboidVolumeBounds::~CuboidVolumeBounds() = default; -Acts::CuboidVolumeBounds& Acts::CuboidVolumeBounds::operator=( - const CuboidVolumeBounds& bobo) { +Acts::CuboidVolumeBounds& +Acts::CuboidVolumeBounds::operator=(const CuboidVolumeBounds& bobo) { if (this != &bobo) { m_valueStore = bobo.m_valueStore; m_xyBounds = bobo.m_xyBounds; @@ -69,47 +71,47 @@ Acts::CuboidVolumeBounds::decomposeToSurfaces( rSurfaces.reserve(6); // face surfaces xy ------------------------------------- // (1) - at negative local z - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(0., 1., 0.)) * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(0., 1., 0.)) * + Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), m_xyBounds)); // (2) - at positive local z - tTransform = new Transform3D(transform * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), m_xyBounds)); // face surfaces yz ------------------------------------- // transmute cyclical // (3) - at negative local x - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(0., 0., 1.)) * - Translation3D(Vector3D(halflengthX(), 0., 0)) * - AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0)) * - AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(0., 0., 1.)) * + Translation3D(Vector3D(halflengthX(), 0., 0)) * + AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0)) * + AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), m_yzBounds)); // (4) - at positive local x - tTransform = new Transform3D(transform * - Translation3D(Vector3D(halflengthX(), 0., 0.)) * - AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(halflengthX(), 0., 0.)) * + AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), m_yzBounds)); // face surfaces zx ------------------------------------- // (5) - at negative local y - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * - Translation3D(Vector3D(0., halflengthY(), 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * + Translation3D(Vector3D(0., halflengthY(), 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), m_zxBounds)); // (6) - at positive local y - tTransform = new Transform3D(transform * - Translation3D(Vector3D(0., halflengthY(), 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(0., halflengthY(), 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), m_zxBounds)); // return the surfaces @@ -118,29 +120,32 @@ Acts::CuboidVolumeBounds::decomposeToSurfaces( std::shared_ptr<const Acts::RectangleBounds> Acts::CuboidVolumeBounds::faceXYRectangleBounds() const { - return std::make_shared<const RectangleBounds>(m_valueStore.at(bv_halfX), - m_valueStore.at(bv_halfY)); + return std::make_shared<const RectangleBounds>( + m_valueStore.at(bv_halfX), m_valueStore.at(bv_halfY)); } std::shared_ptr<const Acts::RectangleBounds> Acts::CuboidVolumeBounds::faceYZRectangleBounds() const { - return std::make_shared<const RectangleBounds>(m_valueStore.at(bv_halfY), - m_valueStore.at(bv_halfZ)); + return std::make_shared<const RectangleBounds>( + m_valueStore.at(bv_halfY), m_valueStore.at(bv_halfZ)); } std::shared_ptr<const Acts::RectangleBounds> Acts::CuboidVolumeBounds::faceZXRectangleBounds() const { - return std::make_shared<const RectangleBounds>(m_valueStore.at(bv_halfZ), - m_valueStore.at(bv_halfX)); + return std::make_shared<const RectangleBounds>( + m_valueStore.at(bv_halfZ), m_valueStore.at(bv_halfX)); } // ostream operator overload -std::ostream& Acts::CuboidVolumeBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::CuboidVolumeBounds::toStream(std::ostream& sl) const { return dumpT(sl); } -Acts::Volume::BoundingBox Acts::CuboidVolumeBounds::boundingBox( - const Acts::Transform3D* trf, const Vector3D& envelope, +Acts::Volume::BoundingBox +Acts::CuboidVolumeBounds::boundingBox( + const Acts::Transform3D* trf, + const Vector3D& envelope, const Volume* entity) const { Vector3D vmin(-halflengthX(), -halflengthY(), -halflengthZ()); Vector3D vmax(halflengthX(), halflengthY(), halflengthZ()); diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 119b51137..39daf746c 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -39,8 +39,10 @@ Acts::CuboidVolumeBuilder::buildSurface( if (cfg.detElementConstructor) { surface = Surface::makeShared<PlaneSurface>( cfg.rBounds, - *(cfg.detElementConstructor(std::make_shared<const Transform3D>(trafo), - cfg.rBounds, cfg.thickness))); + *(cfg.detElementConstructor( + std::make_shared<const Transform3D>(trafo), + cfg.rBounds, + cfg.thickness))); } else { surface = Surface::makeShared<PlaneSurface>( std::make_shared<const Transform3D>(trafo), cfg.rBounds); @@ -49,7 +51,8 @@ Acts::CuboidVolumeBuilder::buildSurface( return surface; } -std::shared_ptr<const Acts::Layer> Acts::CuboidVolumeBuilder::buildLayer( +std::shared_ptr<const Acts::Layer> +Acts::CuboidVolumeBuilder::buildLayer( const GeometryContext& gctx, Acts::CuboidVolumeBuilder::LayerConfig& cfg) const { // Build the surface @@ -64,12 +67,18 @@ std::shared_ptr<const Acts::Layer> Acts::CuboidVolumeBuilder::buildLayer( lCfg.surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(); LayerCreator layerCreator(lCfg); - return layerCreator.planeLayer(gctx, {cfg.surface}, cfg.binsY, cfg.binsZ, - BinningValue::binX, boost::none, - std::make_shared<const Transform3D>(trafo)); + return layerCreator.planeLayer( + gctx, + {cfg.surface}, + cfg.binsY, + cfg.binsZ, + BinningValue::binX, + boost::none, + std::make_shared<const Transform3D>(trafo)); } -std::pair<double, double> Acts::CuboidVolumeBuilder::binningRange( +std::pair<double, double> +Acts::CuboidVolumeBuilder::binningRange( const GeometryContext& /*gctx*/, const Acts::CuboidVolumeBuilder::VolumeConfig& cfg) const { using namespace UnitLiterals; @@ -88,7 +97,8 @@ std::pair<double, double> Acts::CuboidVolumeBuilder::binningRange( return minMax; } -std::shared_ptr<Acts::TrackingVolume> Acts::CuboidVolumeBuilder::buildVolume( +std::shared_ptr<Acts::TrackingVolume> +Acts::CuboidVolumeBuilder::buildVolume( const GeometryContext& gctx, Acts::CuboidVolumeBuilder::VolumeConfig& cfg) const { // Build transformation @@ -139,21 +149,31 @@ std::shared_ptr<Acts::TrackingVolume> Acts::CuboidVolumeBuilder::buildVolume( LayerArrayCreator::Config lacCnf; LayerArrayCreator layArrCreator( lacCnf, getDefaultLogger("LayerArrayCreator", Logging::INFO)); - std::unique_ptr<const LayerArray> layArr( - layArrCreator.layerArray(gctx, layVec, minMax.first, minMax.second, - BinningType::arbitrary, BinningValue::binX)); + std::unique_ptr<const LayerArray> layArr(layArrCreator.layerArray( + gctx, + layVec, + minMax.first, + minMax.second, + BinningType::arbitrary, + BinningValue::binX)); // Build TrackingVolume auto trackVolume = TrackingVolume::create( - std::make_shared<const Transform3D>(trafo), bounds, cfg.volumeMaterial, - std::move(layArr), nullptr, cfg.name); + std::make_shared<const Transform3D>(trafo), + bounds, + cfg.volumeMaterial, + std::move(layArr), + nullptr, + cfg.name); trackVolume->sign(GeometrySignature::Global); return trackVolume; } -Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( - const GeometryContext& gctx, Acts::TrackingVolumePtr /*unused*/, +Acts::MutableTrackingVolumePtr +Acts::CuboidVolumeBuilder::trackingVolume( + const GeometryContext& gctx, + Acts::TrackingVolumePtr /*unused*/, Acts::VolumeBoundsPtr /*unused*/) const { // Build volumes std::vector<std::shared_ptr<TrackingVolume>> volumes; @@ -165,11 +185,15 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( // Glue volumes for (unsigned int i = 0; i < volumes.size() - 1; i++) { volumes[i + 1]->glueTrackingVolume( - gctx, BoundarySurfaceFace::negativeFaceYZ, volumes[i], + gctx, + BoundarySurfaceFace::negativeFaceYZ, + volumes[i], BoundarySurfaceFace::positiveFaceYZ); - volumes[i]->glueTrackingVolume(gctx, BoundarySurfaceFace::positiveFaceYZ, - volumes[i + 1], - BoundarySurfaceFace::negativeFaceYZ); + volumes[i]->glueTrackingVolume( + gctx, + BoundarySurfaceFace::positiveFaceYZ, + volumes[i + 1], + BoundarySurfaceFace::negativeFaceYZ); } // Translation @@ -189,11 +213,11 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( // Set bin boundaries along binning std::vector<float> binBoundaries; - binBoundaries.push_back(volumes[0]->center().x() - - m_cfg.volumeCfg[0].length.x() * 0.5); + binBoundaries.push_back( + volumes[0]->center().x() - m_cfg.volumeCfg[0].length.x() * 0.5); for (size_t i = 0; i < volumes.size(); i++) { - binBoundaries.push_back(volumes[i]->center().x() + - m_cfg.volumeCfg[i].length.x() * 0.5); + binBoundaries.push_back( + volumes[i]->center().x() + m_cfg.volumeCfg[i].length.x() * 0.5); } // Build binning diff --git a/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp b/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp index bd9032232..5d20ebf93 100644 --- a/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CutoutCylinderVolumeBounds.cpp @@ -19,12 +19,14 @@ #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/IVisualization.hpp" -Acts::VolumeBounds* Acts::CutoutCylinderVolumeBounds::clone() const { +Acts::VolumeBounds* +Acts::CutoutCylinderVolumeBounds::clone() const { return new CutoutCylinderVolumeBounds(*this); } -bool Acts::CutoutCylinderVolumeBounds::inside(const Acts::Vector3D& gpos, - double tol) const { +bool +Acts::CutoutCylinderVolumeBounds::inside(const Acts::Vector3D& gpos, double tol) + const { // first check whether we are in the outer envelope at all (ignore r_med) using VectorHelpers::perp; using VectorHelpers::phi; @@ -121,8 +123,10 @@ Acts::CutoutCylinderVolumeBounds::decomposeToSurfaces( return surfaces; } -Acts::Volume::BoundingBox Acts::CutoutCylinderVolumeBounds::boundingBox( - const Acts::Transform3D* trf, const Acts::Vector3D& envelope, +Acts::Volume::BoundingBox +Acts::CutoutCylinderVolumeBounds::boundingBox( + const Acts::Transform3D* trf, + const Acts::Vector3D& envelope, const Acts::Volume* entity) const { Vector3D vmin, vmax; @@ -137,8 +141,8 @@ Acts::Volume::BoundingBox Acts::CutoutCylinderVolumeBounds::boundingBox( return trf == nullptr ? box : box.transformed(*trf); } -std::ostream& Acts::CutoutCylinderVolumeBounds::toStream( - std::ostream& sl) const { +std::ostream& +Acts::CutoutCylinderVolumeBounds::toStream(std::ostream& sl) const { sl << "Acts::CutoutCylinderVolumeBounds(\n"; sl << "rmin = " << m_rmin << " rmed = " << m_rmed << " rmax = " << m_rmax << "\n"; @@ -146,8 +150,10 @@ std::ostream& Acts::CutoutCylinderVolumeBounds::toStream( return sl; } -void Acts::CutoutCylinderVolumeBounds::draw( - IVisualization& helper, const Transform3D& transform) const { +void +Acts::CutoutCylinderVolumeBounds::draw( + IVisualization& helper, + const Transform3D& transform) const { std::vector<std::shared_ptr<const Acts::Surface>> surfaces = decomposeToSurfaces(&transform); for (const auto& srf : surfaces) { diff --git a/Core/src/Geometry/CylinderLayer.cpp b/Core/src/Geometry/CylinderLayer.cpp index d3e349c1c..7a4e2775b 100644 --- a/Core/src/Geometry/CylinderLayer.cpp +++ b/Core/src/Geometry/CylinderLayer.cpp @@ -24,8 +24,10 @@ using Acts::VectorHelpers::phi; Acts::CylinderLayer::CylinderLayer( const std::shared_ptr<const Transform3D>& transform, const std::shared_ptr<const CylinderBounds>& cBounds, - std::unique_ptr<SurfaceArray> surfaceArray, double thickness, - std::unique_ptr<ApproachDescriptor> ades, LayerType laytyp) + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness, + std::unique_ptr<ApproachDescriptor> ades, + LayerType laytyp) : CylinderSurface(transform, cBounds), Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) { // create the representing volume @@ -47,16 +49,18 @@ Acts::CylinderLayer::CylinderLayer( } } -const Acts::CylinderSurface& Acts::CylinderLayer::surfaceRepresentation() - const { +const Acts::CylinderSurface& +Acts::CylinderLayer::surfaceRepresentation() const { return (*this); } -Acts::CylinderSurface& Acts::CylinderLayer::surfaceRepresentation() { +Acts::CylinderSurface& +Acts::CylinderLayer::surfaceRepresentation() { return (*this); } -void Acts::CylinderLayer::buildApproachDescriptor() { +void +Acts::CylinderLayer::buildApproachDescriptor() { // delete and reset as you build a new one m_approachDescriptor.reset(nullptr); diff --git a/Core/src/Geometry/CylinderVolumeBounds.cpp b/Core/src/Geometry/CylinderVolumeBounds.cpp index 58373138d..d6fe5284e 100644 --- a/Core/src/Geometry/CylinderVolumeBounds.cpp +++ b/Core/src/Geometry/CylinderVolumeBounds.cpp @@ -35,8 +35,10 @@ Acts::CylinderVolumeBounds::CylinderVolumeBounds(double radius, double halez) m_valueStore.at(bv_halfZ) = std::abs(halez); } -Acts::CylinderVolumeBounds::CylinderVolumeBounds(double rinner, double router, - double halez) +Acts::CylinderVolumeBounds::CylinderVolumeBounds( + double rinner, + double router, + double halez) : VolumeBounds(), m_valueStore(4, 0.) { m_valueStore.at(bv_innerRadius) = std::abs(rinner); m_valueStore.at(bv_outerRadius) = std::abs(router); @@ -44,8 +46,11 @@ Acts::CylinderVolumeBounds::CylinderVolumeBounds(double rinner, double router, m_valueStore.at(bv_halfZ) = std::abs(halez); } -Acts::CylinderVolumeBounds::CylinderVolumeBounds(double rinner, double router, - double haphi, double halez) +Acts::CylinderVolumeBounds::CylinderVolumeBounds( + double rinner, + double router, + double haphi, + double halez) : VolumeBounds(), m_valueStore(4, 0.) { m_valueStore.at(bv_innerRadius) = std::abs(rinner); m_valueStore.at(bv_outerRadius) = std::abs(router); @@ -53,8 +58,9 @@ Acts::CylinderVolumeBounds::CylinderVolumeBounds(double rinner, double router, m_valueStore.at(bv_halfZ) = std::abs(halez); } -Acts::CylinderVolumeBounds::CylinderVolumeBounds(const CylinderBounds& cBounds, - double thickness) +Acts::CylinderVolumeBounds::CylinderVolumeBounds( + const CylinderBounds& cBounds, + double thickness) : VolumeBounds(), m_valueStore(4, 0.) { double cR = cBounds.r(); m_valueStore.at(bv_innerRadius) = cR - 0.5 * thickness; @@ -63,8 +69,9 @@ Acts::CylinderVolumeBounds::CylinderVolumeBounds(const CylinderBounds& cBounds, m_valueStore.at(bv_halfZ) = cBounds.halflengthZ(); } -Acts::CylinderVolumeBounds::CylinderVolumeBounds(const RadialBounds& rBounds, - double thickness) +Acts::CylinderVolumeBounds::CylinderVolumeBounds( + const RadialBounds& rBounds, + double thickness) : VolumeBounds(), m_valueStore(4, 0.) { m_valueStore.at(bv_innerRadius) = rBounds.rMin(); m_valueStore.at(bv_outerRadius) = rBounds.rMax(); @@ -78,8 +85,8 @@ Acts::CylinderVolumeBounds::CylinderVolumeBounds( Acts::CylinderVolumeBounds::~CylinderVolumeBounds() = default; -Acts::CylinderVolumeBounds& Acts::CylinderVolumeBounds::operator=( - const CylinderVolumeBounds& cylbo) { +Acts::CylinderVolumeBounds& +Acts::CylinderVolumeBounds::operator=(const CylinderVolumeBounds& cylbo) { if (this != &cylbo) { m_valueStore = cylbo.m_valueStore; } @@ -102,14 +109,14 @@ Acts::CylinderVolumeBounds::decomposeToSurfaces( std::shared_ptr<const DiscBounds> dBounds = discBounds(); // bottom Disc (negative z) - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * + Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<DiscSurface>( std::shared_ptr<const Transform3D>(tTransform), dBounds)); // top Disc (positive z) - tTransform = new Transform3D(transform * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<DiscSurface>( std::shared_ptr<const Transform3D>(tTransform), dBounds)); @@ -147,21 +154,24 @@ Acts::CylinderVolumeBounds::decomposeToSurfaces( std::shared_ptr<const Acts::CylinderBounds> Acts::CylinderVolumeBounds::innerCylinderBounds() const { return std::make_shared<const CylinderBounds>( - m_valueStore.at(bv_innerRadius), m_valueStore.at(bv_halfPhiSector), + m_valueStore.at(bv_innerRadius), + m_valueStore.at(bv_halfPhiSector), m_valueStore.at(bv_halfZ)); } std::shared_ptr<const Acts::CylinderBounds> Acts::CylinderVolumeBounds::outerCylinderBounds() const { return std::make_shared<const CylinderBounds>( - m_valueStore.at(bv_outerRadius), m_valueStore.at(bv_halfPhiSector), + m_valueStore.at(bv_outerRadius), + m_valueStore.at(bv_halfPhiSector), m_valueStore.at(bv_halfZ)); } -std::shared_ptr<const Acts::DiscBounds> Acts::CylinderVolumeBounds::discBounds() - const { +std::shared_ptr<const Acts::DiscBounds> +Acts::CylinderVolumeBounds::discBounds() const { return std::shared_ptr<const DiscBounds>(new RadialBounds( - m_valueStore.at(bv_innerRadius), m_valueStore.at(bv_outerRadius), + m_valueStore.at(bv_innerRadius), + m_valueStore.at(bv_outerRadius), m_valueStore.at(bv_halfPhiSector))); } @@ -172,12 +182,15 @@ Acts::CylinderVolumeBounds::sectorPlaneBounds() const { m_valueStore.at(bv_halfZ))); } -std::ostream& Acts::CylinderVolumeBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::CylinderVolumeBounds::toStream(std::ostream& sl) const { return dumpT<std::ostream>(sl); } -Acts::Volume::BoundingBox Acts::CylinderVolumeBounds::boundingBox( - const Transform3D* trf, const Vector3D& envelope, +Acts::Volume::BoundingBox +Acts::CylinderVolumeBounds::boundingBox( + const Transform3D* trf, + const Vector3D& envelope, const Volume* entity) const { double xmax, xmin, ymax, ymin; xmax = outerRadius(); @@ -203,8 +216,10 @@ Acts::Volume::BoundingBox Acts::CylinderVolumeBounds::boundingBox( return trf == nullptr ? box : box.transformed(*trf); } -void Acts::CylinderVolumeBounds::draw(IVisualization& helper, - const Transform3D& transform) const { +void +Acts::CylinderVolumeBounds::draw( + IVisualization& helper, + const Transform3D& transform) const { std::vector<std::shared_ptr<const Acts::Surface>> surfaces = decomposeToSurfaces(&transform); for (const auto& srf : surfaces) { diff --git a/Core/src/Geometry/CylinderVolumeBuilder.cpp b/Core/src/Geometry/CylinderVolumeBuilder.cpp index ce9b405f4..bee7374cf 100644 --- a/Core/src/Geometry/CylinderVolumeBuilder.cpp +++ b/Core/src/Geometry/CylinderVolumeBuilder.cpp @@ -29,21 +29,24 @@ Acts::CylinderVolumeBuilder::CylinderVolumeBuilder( Acts::CylinderVolumeBuilder::~CylinderVolumeBuilder() = default; -void Acts::CylinderVolumeBuilder::setConfiguration( +void +Acts::CylinderVolumeBuilder::setConfiguration( const Acts::CylinderVolumeBuilder::Config& cvbConfig) { // @todo check consistency // copy the configuration m_cfg = cvbConfig; } -void Acts::CylinderVolumeBuilder::setLogger( +void +Acts::CylinderVolumeBuilder::setLogger( std::unique_ptr<const Logger> newLogger) { m_logger = std::move(newLogger); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeBuilder::trackingVolume( - const GeometryContext& gctx, TrackingVolumePtr existingVolume, + const GeometryContext& gctx, + TrackingVolumePtr existingVolume, VolumeBoundsPtr externalBounds) const { ACTS_DEBUG("Configured to build volume : " << m_cfg.volumeName); @@ -130,22 +133,25 @@ Acts::CylinderVolumeBuilder::trackingVolume( std::string layerConfiguration = "|"; if (wConfig.nVolumeConfig) { // negative layers are present - ACTS_VERBOSE("Negative layers are present: rmin, rmax | zmin, zmax = " - << wConfig.nVolumeConfig.toString()); + ACTS_VERBOSE( + "Negative layers are present: rmin, rmax | zmin, zmax = " + << wConfig.nVolumeConfig.toString()); // add to the string output layerConfiguration += " Negative Endcap |"; } if (wConfig.cVolumeConfig) { // central layers are present - ACTS_VERBOSE("Central layers are present: rmin, rmax | zmin, zmax = " - << wConfig.cVolumeConfig.toString()); + ACTS_VERBOSE( + "Central layers are present: rmin, rmax | zmin, zmax = " + << wConfig.cVolumeConfig.toString()); // add to the string output layerConfiguration += " Barrel |"; } if (wConfig.pVolumeConfig) { // positive layers are present - ACTS_VERBOSE("Positive layers are present: rmin, rmax | zmin, zmax = " - << wConfig.pVolumeConfig.toString()); + ACTS_VERBOSE( + "Positive layers are present: rmin, rmax | zmin, zmax = " + << wConfig.pVolumeConfig.toString()); // add to the string output layerConfiguration += " Positive Endcap |"; } @@ -154,19 +160,21 @@ Acts::CylinderVolumeBuilder::trackingVolume( // (B) LAYER Config SYNCHRONISATION ---------------------------------- // synchronise the layer config - ACTS_VERBOSE("Configurations after layer parsing " << '\n' - << wConfig.toString()); + ACTS_VERBOSE( + "Configurations after layer parsing " << '\n' + << wConfig.toString()); // first let us arrange the new container volume wConfig.configureContainerVolume(); - ACTS_VERBOSE("Configuration after container synchronisation " - << '\n' - << wConfig.toString()); + ACTS_VERBOSE( + "Configuration after container synchronisation " << '\n' + << wConfig.toString()); // now let's understand the wrapping if needed if (wConfig.existingVolumeConfig) { wConfig.wrapInsertAttach(); - ACTS_VERBOSE("Configuration after wrapping, insertion, attachment " - << '\n' - << wConfig.toString()); + ACTS_VERBOSE( + "Configuration after wrapping, insertion, attachment " + << '\n' + << wConfig.toString()); } else { // no wrapping around inner volume needed // however there could be central, positive & negative volume which will @@ -177,34 +185,42 @@ Acts::CylinderVolumeBuilder::trackingVolume( // (C) VOLUME CREATION ---------------------------------- auto tvHelper = m_cfg.trackingVolumeHelper; // the barrel is always created - auto barrel = - wConfig.cVolumeConfig - ? tvHelper->createTrackingVolume( - gctx, wConfig.cVolumeConfig.layers, m_cfg.volumeMaterial, - wConfig.cVolumeConfig.rMin, wConfig.cVolumeConfig.rMax, - wConfig.cVolumeConfig.zMin, wConfig.cVolumeConfig.zMax, - m_cfg.volumeName + "::Barrel") - : nullptr; + auto barrel = wConfig.cVolumeConfig ? tvHelper->createTrackingVolume( + gctx, + wConfig.cVolumeConfig.layers, + m_cfg.volumeMaterial, + wConfig.cVolumeConfig.rMin, + wConfig.cVolumeConfig.rMax, + wConfig.cVolumeConfig.zMin, + wConfig.cVolumeConfig.zMax, + m_cfg.volumeName + "::Barrel") + : nullptr; // the negative endcap is created if present - auto nEndcap = - wConfig.nVolumeConfig - ? tvHelper->createTrackingVolume( - gctx, wConfig.nVolumeConfig.layers, m_cfg.volumeMaterial, - wConfig.nVolumeConfig.rMin, wConfig.nVolumeConfig.rMax, - wConfig.nVolumeConfig.zMin, wConfig.nVolumeConfig.zMax, - m_cfg.volumeName + "::NegativeEndcap") - : nullptr; + auto nEndcap = wConfig.nVolumeConfig + ? tvHelper->createTrackingVolume( + gctx, + wConfig.nVolumeConfig.layers, + m_cfg.volumeMaterial, + wConfig.nVolumeConfig.rMin, + wConfig.nVolumeConfig.rMax, + wConfig.nVolumeConfig.zMin, + wConfig.nVolumeConfig.zMax, + m_cfg.volumeName + "::NegativeEndcap") + : nullptr; // the positive endcap is created - auto pEndcap = - wConfig.pVolumeConfig - ? tvHelper->createTrackingVolume( - gctx, wConfig.pVolumeConfig.layers, m_cfg.volumeMaterial, - wConfig.pVolumeConfig.rMin, wConfig.pVolumeConfig.rMax, - wConfig.pVolumeConfig.zMin, wConfig.pVolumeConfig.zMax, - m_cfg.volumeName + "::PositiveEndcap") - : nullptr; + auto pEndcap = wConfig.pVolumeConfig + ? tvHelper->createTrackingVolume( + gctx, + wConfig.pVolumeConfig.layers, + m_cfg.volumeMaterial, + wConfig.pVolumeConfig.rMin, + wConfig.pVolumeConfig.rMax, + wConfig.pVolumeConfig.zMin, + wConfig.pVolumeConfig.zMax, + m_cfg.volumeName + "::PositiveEndcap") + : nullptr; ACTS_DEBUG("Newly created volume(s) will be " << wConfig.wConditionScreen); // standalone container, full wrapping, full insertion & if no existing volume @@ -245,9 +261,15 @@ Acts::CylinderVolumeBuilder::trackingVolume( if (wConfig.fGapVolumeConfig) { // create the gap volume auto fGap = tvHelper->createGapTrackingVolume( - gctx, m_cfg.volumeMaterial, wConfig.fGapVolumeConfig.rMin, - wConfig.fGapVolumeConfig.rMax, wConfig.fGapVolumeConfig.zMin, - wConfig.fGapVolumeConfig.zMax, 1, false, m_cfg.volumeName + "::fGap"); + gctx, + m_cfg.volumeMaterial, + wConfig.fGapVolumeConfig.rMin, + wConfig.fGapVolumeConfig.rMax, + wConfig.fGapVolumeConfig.zMin, + wConfig.fGapVolumeConfig.zMax, + 1, + false, + m_cfg.volumeName + "::fGap"); // push it back into the list existingContainer.push_back(fGap); } @@ -255,9 +277,15 @@ Acts::CylinderVolumeBuilder::trackingVolume( if (wConfig.sGapVolumeConfig) { // create the gap volume auto sGap = tvHelper->createGapTrackingVolume( - gctx, m_cfg.volumeMaterial, wConfig.sGapVolumeConfig.rMin, - wConfig.sGapVolumeConfig.rMax, wConfig.sGapVolumeConfig.zMin, - wConfig.sGapVolumeConfig.zMax, 1, false, m_cfg.volumeName + "::sGap"); + gctx, + m_cfg.volumeMaterial, + wConfig.sGapVolumeConfig.rMin, + wConfig.sGapVolumeConfig.rMax, + wConfig.sGapVolumeConfig.zMin, + wConfig.sGapVolumeConfig.zMax, + 1, + false, + m_cfg.volumeName + "::sGap"); // push it back into the list existingContainer.push_back(sGap); } @@ -316,8 +344,10 @@ Acts::CylinderVolumeBuilder::trackingVolume( } // ----------------------------- -Acts::VolumeConfig Acts::CylinderVolumeBuilder::analyzeLayers( - const GeometryContext& gctx, const LayerVector& lVector) const { +Acts::VolumeConfig +Acts::CylinderVolumeBuilder::analyzeLayers( + const GeometryContext& gctx, + const LayerVector& lVector) const { // @TODO add envelope tolerance // // return object diff --git a/Core/src/Geometry/CylinderVolumeHelper.cpp b/Core/src/Geometry/CylinderVolumeHelper.cpp index 9089d197a..d44a2948a 100644 --- a/Core/src/Geometry/CylinderVolumeHelper.cpp +++ b/Core/src/Geometry/CylinderVolumeHelper.cpp @@ -36,24 +36,27 @@ Acts::CylinderVolumeHelper::CylinderVolumeHelper( } // configuration -void Acts::CylinderVolumeHelper::setConfiguration( +void +Acts::CylinderVolumeHelper::setConfiguration( const Acts::CylinderVolumeHelper::Config& cvhConfig) { // @todo check consistency // copy the configuration m_cfg = cvhConfig; } -void Acts::CylinderVolumeHelper::setLogger( - std::unique_ptr<const Logger> newLogger) { +void +Acts::CylinderVolumeHelper::setLogger(std::unique_ptr<const Logger> newLogger) { m_logger = std::move(newLogger); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createTrackingVolume( - const GeometryContext& gctx, const LayerVector& layers, + const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const IVolumeMaterial> volumeMaterial, std::shared_ptr<const VolumeBounds> volumeBounds, - std::shared_ptr<const Transform3D> transform, const std::string& volumeName, + std::shared_ptr<const Transform3D> transform, + const std::string& volumeName, BinningType bType) const { // the final one to build / sensitive Volume / Bounds MutableTrackingVolumePtr tVolume = nullptr; @@ -87,9 +90,17 @@ Acts::CylinderVolumeHelper::createTrackingVolume( BinningValue bValue = binR; // check the dimension and fill raw data - if (not estimateAndCheckDimension(gctx, layers, cylinderBounds, transform, - rMinRaw, rMaxRaw, zMinRaw, zMaxRaw, - bValue, bType)) { + if (not estimateAndCheckDimension( + gctx, + layers, + cylinderBounds, + transform, + rMinRaw, + rMaxRaw, + zMinRaw, + zMaxRaw, + bValue, + bType)) { ACTS_WARNING( "[!] Problem with given dimensions - return nullptr and " "delete provided objects"); @@ -119,10 +130,10 @@ Acts::CylinderVolumeHelper::createTrackingVolume( // create the Layer Array layerArray = (bValue == binR) - ? m_cfg.layerArrayCreator->layerArray(gctx, layers, rMin, - rMax, bType, bValue) - : m_cfg.layerArrayCreator->layerArray(gctx, layers, zMin, - zMax, bType, bValue); + ? m_cfg.layerArrayCreator->layerArray( + gctx, layers, rMin, rMax, bType, bValue) + : m_cfg.layerArrayCreator->layerArray( + gctx, layers, zMin, zMax, bType, bValue); } // layers are created and done // make sure the ownership of the bounds is correct @@ -131,8 +142,13 @@ Acts::CylinderVolumeHelper::createTrackingVolume( ? volumeBounds : std::shared_ptr<const VolumeBounds>(cylinderBounds); // finally create the TrackingVolume - tVolume = TrackingVolume::create(transform, volumeBoundsFinal, volumeMaterial, - std::move(layerArray), nullptr, volumeName); + tVolume = TrackingVolume::create( + transform, + volumeBoundsFinal, + volumeMaterial, + std::move(layerArray), + nullptr, + volumeName); // screen output ACTS_VERBOSE( "Created cylindrical volume at z-position :" << tVolume->center().z()); @@ -143,24 +159,31 @@ Acts::CylinderVolumeHelper::createTrackingVolume( std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createTrackingVolume( - const GeometryContext& gctx, const LayerVector& layers, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin, - double rMax, double zMin, double zMax, const std::string& volumeName, + const GeometryContext& gctx, + const LayerVector& layers, + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double rMin, + double rMax, + double zMin, + double zMax, + const std::string& volumeName, BinningType bType) const { // that's what is needed CylinderVolumeBounds* cBounds = nullptr; // screen output ACTS_VERBOSE("Create cylindrical TrackingVolume '" << volumeName << "'."); - ACTS_VERBOSE(" -> with given dimensions of (rMin/rMax/zMin/Max) = " - << rMin << " / " << rMax << " / " << zMin << " / " << zMax); + ACTS_VERBOSE( + " -> with given dimensions of (rMin/rMax/zMin/Max) = " + << rMin << " / " << rMax << " / " << zMin << " / " << zMax); // check for consistency if (zMin > zMax || rMin > rMax) { - ACTS_WARNING("Inconsistent dimensions given :" - << ((zMin > zMax) ? " zMin > zMax (" : " rMin > rMax (") - << ((zMin > zMax) ? zMin : rMin) << " > " - << ((zMin > zMax) ? zMax : rMax) << " ) - return 0"); + ACTS_WARNING( + "Inconsistent dimensions given :" + << ((zMin > zMax) ? " zMin > zMax (" : " rMin > rMax (") + << ((zMin > zMax) ? zMin : rMin) << " > " + << ((zMin > zMax) ? zMax : rMax) << " ) - return 0"); return nullptr; } @@ -178,20 +201,31 @@ Acts::CylinderVolumeHelper::createTrackingVolume( Translation3D(0., 0., zPosition)) : nullptr; // call to the creation method with Bounds & Translation3D - return createTrackingVolume(gctx, layers, volumeMaterial, - VolumeBoundsPtr(cBounds), transform, volumeName, - bType); + return createTrackingVolume( + gctx, + layers, + volumeMaterial, + VolumeBoundsPtr(cBounds), + transform, + volumeName, + bType); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createGapTrackingVolume( const GeometryContext& gctx, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin, - double rMax, double zMin, double zMax, unsigned int materialLayers, - bool cylinder, const std::string& volumeName) const { + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double rMin, + double rMax, + double zMin, + double zMax, + unsigned int materialLayers, + bool cylinder, + const std::string& volumeName) const { // screen output - ACTS_VERBOSE("Create cylindrical gap TrackingVolume '" - << volumeName << "' with (rMin/rMax/zMin/Max) = "); + ACTS_VERBOSE( + "Create cylindrical gap TrackingVolume '" + << volumeName << "' with (rMin/rMax/zMin/Max) = "); ACTS_VERBOSE('\t' << rMin << " / " << rMax << " / " << zMin << " / " << zMax); // assing min/max @@ -211,21 +245,35 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( } // now call the main method - return createGapTrackingVolume(gctx, volumeMaterial, rMin, rMax, zMin, zMax, - layerPositions, cylinder, volumeName, - arbitrary); + return createGapTrackingVolume( + gctx, + volumeMaterial, + rMin, + rMax, + zMin, + zMax, + layerPositions, + cylinder, + volumeName, + arbitrary); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createGapTrackingVolume( const GeometryContext& gctx, - std::shared_ptr<const IVolumeMaterial> volumeMaterial, double rMin, - double rMax, double zMin, double zMax, - const std::vector<double>& layerPositions, bool cylinder, - const std::string& volumeName, BinningType bType) const { + std::shared_ptr<const IVolumeMaterial> volumeMaterial, + double rMin, + double rMax, + double zMin, + double zMax, + const std::vector<double>& layerPositions, + bool cylinder, + const std::string& volumeName, + BinningType bType) const { // screen output - ACTS_VERBOSE("Create cylindrical gap TrackingVolume '" - << volumeName << "' with (rMin/rMax/zMin/Max) = "); + ACTS_VERBOSE( + "Create cylindrical gap TrackingVolume '" + << volumeName << "' with (rMin/rMax/zMin/Max) = "); ACTS_VERBOSE('\t' << rMin << " / " << rMax << " / " << zMin << " / " << zMax); // create the layers @@ -242,9 +290,12 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( double zMaxLayer = zMax; // create the layer layers.push_back(createCylinderLayer( - 0.5 * (zMinLayer + zMaxLayer), (*layerPropIter), - std::abs(0.5 * (zMaxLayer - zMinLayer)), m_cfg.passiveLayerThickness, - m_cfg.passiveLayerPhiBins, m_cfg.passiveLayerRzBins)); + 0.5 * (zMinLayer + zMaxLayer), + (*layerPropIter), + std::abs(0.5 * (zMaxLayer - zMinLayer)), + m_cfg.passiveLayerThickness, + m_cfg.passiveLayerPhiBins, + m_cfg.passiveLayerRzBins)); } else { // take the envelopes into account @@ -252,18 +303,23 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( double rMaxLayer = rMax; // create the layer layers.push_back(createDiscLayer( - (*layerPropIter), rMinLayer, rMaxLayer, m_cfg.passiveLayerThickness, - m_cfg.passiveLayerPhiBins, m_cfg.passiveLayerRzBins)); + (*layerPropIter), + rMinLayer, + rMaxLayer, + m_cfg.passiveLayerThickness, + m_cfg.passiveLayerPhiBins, + m_cfg.passiveLayerRzBins)); } } // now call the createTrackingVolume() method - return createTrackingVolume(gctx, layers, volumeMaterial, rMin, rMax, zMin, - zMax, volumeName, bType); + return createTrackingVolume( + gctx, layers, volumeMaterial, rMin, rMax, zMin, zMax, volumeName, bType); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createContainerTrackingVolume( - const GeometryContext& gctx, const TrackingVolumeVector& volumes) const { + const GeometryContext& gctx, + const TrackingVolumeVector& volumes) const { // check if you have more than one volume if (volumes.size() <= (size_t)1) { ACTS_WARNING( @@ -273,19 +329,21 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( } // screen output std::string volumeName = "{ "; - ACTS_VERBOSE("[start] Creating a container volume with " << volumes.size() - << " sub volumes:"); + ACTS_VERBOSE( + "[start] Creating a container volume with " << volumes.size() + << " sub volumes:"); // volumes need to be sorted in either r or z - both increasing // set the iterator to the volumes, the first and the end auto firstVolume = volumes.begin(); auto lastVolume = volumes.end(); for (size_t ivol = 0; firstVolume != lastVolume; ++firstVolume, ++ivol) { - ACTS_VERBOSE(" - volume (" << ivol - << ") is : " << (*firstVolume)->volumeName()); - ACTS_VERBOSE(" at position : " << (*firstVolume)->center().x() << ", " - << (*firstVolume)->center().y() << ", " - << (*firstVolume)->center().z()); + ACTS_VERBOSE( + " - volume (" << ivol << ") is : " << (*firstVolume)->volumeName()); + ACTS_VERBOSE( + " at position : " << (*firstVolume)->center().x() << ", " + << (*firstVolume)->center().y() << ", " + << (*firstVolume)->center().z()); ACTS_VERBOSE(" with bounds : " << (*firstVolume)->volumeBounds()); // put the name together @@ -321,8 +379,9 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( return nullptr; } // check whether it is a r-binned case or a z-binned case - bool rCase = std::abs(firstVolumeBounds->innerRadius() - - lastVolumeBounds->innerRadius()) > 0.1; + bool rCase = std::abs( + firstVolumeBounds->innerRadius() - + lastVolumeBounds->innerRadius()) > 0.1; // fill these ones depending on the rCase though assignment - no parsing at // that stage @@ -379,12 +438,14 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( } // we have the bounds and the volume array, create the volume std::shared_ptr<TrackingVolume> topVolume = TrackingVolume::create( - topVolumeTransform, VolumeBoundsPtr(topVolumeBounds), volumeArray, + topVolumeTransform, + VolumeBoundsPtr(topVolumeBounds), + volumeArray, volumeName); // glueing section // -------------------------------------------------------------------------------------- - if (not interGlueTrackingVolume(gctx, topVolume, rCase, rMin, rGlueMin, rMax, - zSep1, zSep2)) { + if (not interGlueTrackingVolume( + gctx, topVolume, rCase, rMin, rGlueMin, rMax, zSep1, zSep2)) { ACTS_WARNING( "Problem with inter-glueing of TrackingVolumes (needed) - " "returning 0 "); @@ -399,21 +460,29 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( /** private helper method to estimate and check the dimensions of a tracking * volume */ -bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( - const GeometryContext& gctx, const LayerVector& layers, +bool +Acts::CylinderVolumeHelper::estimateAndCheckDimension( + const GeometryContext& gctx, + const LayerVector& layers, const CylinderVolumeBounds*& cylinderVolumeBounds, - std::shared_ptr<const Transform3D>& transform, double& rMinClean, - double& rMaxClean, double& zMinClean, double& zMaxClean, - BinningValue& bValue, BinningType /*unused*/) const { + std::shared_ptr<const Transform3D>& transform, + double& rMinClean, + double& rMaxClean, + double& zMinClean, + double& zMaxClean, + BinningValue& bValue, + BinningType /*unused*/) const { // some verbose output - ACTS_VERBOSE("Parsing the " << layers.size() - << " layers to gather overall dimensions"); + ACTS_VERBOSE( + "Parsing the " << layers.size() + << " layers to gather overall dimensions"); if (cylinderVolumeBounds != nullptr) - ACTS_DEBUG("Cylinder volume bounds are given: (rmin/rmax/dz) = " - << "(" << cylinderVolumeBounds->innerRadius() << "/" - << cylinderVolumeBounds->outerRadius() << "/" - << cylinderVolumeBounds->halflengthZ() << ")"); + ACTS_DEBUG( + "Cylinder volume bounds are given: (rmin/rmax/dz) = " + << "(" << cylinderVolumeBounds->innerRadius() << "/" + << cylinderVolumeBounds->outerRadius() << "/" + << cylinderVolumeBounds->halflengthZ() << ")"); // prepare for parsing the layers double layerRmin = 10e10; @@ -502,16 +571,18 @@ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( new CylinderVolumeBounds(layerRmin, layerRmax, halflengthFromLayer); } - ACTS_VERBOSE(" -> dimensions from layers (rMin/rMax/zMin/zMax) = " - << layerRmin << " / " << layerRmax << " / " << layerZmin << " / " - << layerZmax); + ACTS_VERBOSE( + " -> dimensions from layers (rMin/rMax/zMin/zMax) = " + << layerRmin << " / " << layerRmax << " / " << layerZmin << " / " + << layerZmax); double zFromTransform = transform ? transform->translation().z() : 0.; - ACTS_VERBOSE(" -> while created bounds are (rMin/rMax/zMin/zMax) = " - << cylinderVolumeBounds->innerRadius() << " / " - << cylinderVolumeBounds->outerRadius() << " / " - << zFromTransform - cylinderVolumeBounds->halflengthZ() << " / " - << zFromTransform + cylinderVolumeBounds->halflengthZ()); + ACTS_VERBOSE( + " -> while created bounds are (rMin/rMax/zMin/zMax) = " + << cylinderVolumeBounds->innerRadius() << " / " + << cylinderVolumeBounds->outerRadius() << " / " + << zFromTransform - cylinderVolumeBounds->halflengthZ() << " / " + << zFromTransform + cylinderVolumeBounds->halflengthZ()); // both is NOW given --- check it ----------------------------- if (cylinderVolumeBounds != nullptr) { @@ -525,16 +596,20 @@ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( ACTS_WARNING( "Provided layers are not contained by volume ! Bailing out. "); ACTS_WARNING("- zFromTransform: " << zFromTransform); - ACTS_WARNING("- volumeZmin:" - << zFromTransform - cylinderVolumeBounds->halflengthZ() - << ", layerZmin: " << layerZmin); - ACTS_WARNING("- volumeZmax: " - << zFromTransform + cylinderVolumeBounds->halflengthZ() - << ", layerZmax: " << layerZmax); - ACTS_WARNING("- volumeRmin: " << cylinderVolumeBounds->innerRadius() - << ", layerRmin: " << layerRmin); - ACTS_WARNING("- volumeRmax: " << cylinderVolumeBounds->outerRadius() - << ", layerRmax: " << layerRmax); + ACTS_WARNING( + "- volumeZmin:" << zFromTransform - + cylinderVolumeBounds->halflengthZ() + << ", layerZmin: " << layerZmin); + ACTS_WARNING( + "- volumeZmax: " << zFromTransform + + cylinderVolumeBounds->halflengthZ() + << ", layerZmax: " << layerZmax); + ACTS_WARNING( + "- volumeRmin: " << cylinderVolumeBounds->innerRadius() + << ", layerRmin: " << layerRmin); + ACTS_WARNING( + "- volumeRmax: " << cylinderVolumeBounds->outerRadius() + << ", layerRmax: " << layerRmax); return false; } } @@ -543,12 +618,19 @@ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( return true; } -bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( - const GeometryContext& gctx, const std::shared_ptr<TrackingVolume>& tVolume, - bool rBinned, double rMin, double rGlueMin, double rMax, double zMin, +bool +Acts::CylinderVolumeHelper::interGlueTrackingVolume( + const GeometryContext& gctx, + const std::shared_ptr<TrackingVolume>& tVolume, + bool rBinned, + double rMin, + double rGlueMin, + double rMax, + double zMin, double zMax) const { - ACTS_VERBOSE("Glue contained TrackingVolumes of container '" - << tVolume->volumeName() << "'."); + ACTS_VERBOSE( + "Glue contained TrackingVolumes of container '" << tVolume->volumeName() + << "'."); // only go on if you have confinedVolumes if (tVolume->confinedVolumes()) { @@ -602,8 +684,17 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( std::const_pointer_cast<TrackingVolume>(*tVolIter); std::shared_ptr<TrackingVolume> tVol2 = std::const_pointer_cast<TrackingVolume>(*(++tVolIter)); - glueTrackingVolumes(gctx, tVol1, tubeOuterCover, tVol2, - tubeInnerCover, rMin, rGlueMin, rMax, zMin, zMax); + glueTrackingVolumes( + gctx, + tVol1, + tubeOuterCover, + tVol2, + tubeInnerCover, + rMin, + rGlueMin, + rMax, + zMin, + zMax); } } } else { @@ -611,8 +702,9 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( // loop over the volumes for (; tVolIter != tVolEnd;) { // screen output - ACTS_VERBOSE("z-binning: Processing volume '" - << (*tVolIter)->volumeName() << "'."); + ACTS_VERBOSE( + "z-binning: Processing volume '" << (*tVolIter)->volumeName() + << "'."); std::shared_ptr<TrackingVolume> tVol = std::const_pointer_cast<TrackingVolume>(*tVolIter); if (tVolIter == tVolFirst) { @@ -628,8 +720,17 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( std::const_pointer_cast<TrackingVolume>(*tVolIter); std::shared_ptr<TrackingVolume> tVol2 = std::const_pointer_cast<TrackingVolume>(*(++tVolIter)); - glueTrackingVolumes(gctx, tVol1, positiveFaceXY, tVol2, - negativeFaceXY, rMin, rGlueMin, rMax, zMin, zMax); + glueTrackingVolumes( + gctx, + tVol1, + positiveFaceXY, + tVol2, + negativeFaceXY, + rMin, + rGlueMin, + rMax, + zMin, + zMax); } } } @@ -641,8 +742,8 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( gctx, glueVolumesNegativeFace, binR); // register the glue voluems - glueDescr.registerGlueVolumes(negativeFaceXY, - glueVolumesNegativeFaceArray); + glueDescr.registerGlueVolumes( + negativeFaceXY, glueVolumesNegativeFaceArray); } if (!glueVolumesPositiveFace.empty()) { // create the outside volume array @@ -650,8 +751,8 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( gctx, glueVolumesPositiveFace, binR); // register the glue voluems - glueDescr.registerGlueVolumes(positiveFaceXY, - glueVolumesPositiveFaceArray); + glueDescr.registerGlueVolumes( + positiveFaceXY, glueVolumesPositiveFaceArray); } if (!glueVolumesInnerTube.empty()) { // create the outside volume array @@ -670,25 +771,33 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( glueDescr.registerGlueVolumes(tubeOuterCover, glueVolumesOuterTubeArray); } - ACTS_VERBOSE("[GV] Register " << glueVolumesNegativeFace.size() - << " volumes at face negativeFaceXY:"); + ACTS_VERBOSE( + "[GV] Register " << glueVolumesNegativeFace.size() + << " volumes at face negativeFaceXY:"); for (tVolIter = glueVolumesNegativeFace.begin(); - tVolIter != glueVolumesNegativeFace.end(); ++tVolIter) + tVolIter != glueVolumesNegativeFace.end(); + ++tVolIter) ACTS_VERBOSE(" -> volume '" << (*tVolIter)->volumeName() << "'"); - ACTS_VERBOSE("[GV] Register " << glueVolumesPositiveFace.size() - << " volumes at face positiveFaceXY: "); + ACTS_VERBOSE( + "[GV] Register " << glueVolumesPositiveFace.size() + << " volumes at face positiveFaceXY: "); for (tVolIter = glueVolumesPositiveFace.begin(); - tVolIter != glueVolumesPositiveFace.end(); ++tVolIter) + tVolIter != glueVolumesPositiveFace.end(); + ++tVolIter) ACTS_VERBOSE(" -> volume '" << (*tVolIter)->volumeName() << "'"); - ACTS_VERBOSE("[GV] Register " << glueVolumesInnerTube.size() - << " volumes at face tubeInnerCover: "); + ACTS_VERBOSE( + "[GV] Register " << glueVolumesInnerTube.size() + << " volumes at face tubeInnerCover: "); for (tVolIter = glueVolumesInnerTube.begin(); - tVolIter != glueVolumesInnerTube.end(); ++tVolIter) + tVolIter != glueVolumesInnerTube.end(); + ++tVolIter) ACTS_VERBOSE(" -> volume '" << (*tVolIter)->volumeName() << "'"); - ACTS_VERBOSE("[GV] Register " << glueVolumesOuterTube.size() - << " volumes at face tubeOuterCover:"); + ACTS_VERBOSE( + "[GV] Register " << glueVolumesOuterTube.size() + << " volumes at face tubeOuterCover:"); for (tVolIter = glueVolumesOuterTube.begin(); - tVolIter != glueVolumesOuterTube.end(); ++tVolIter) + tVolIter != glueVolumesOuterTube.end(); + ++tVolIter) ACTS_VERBOSE(" -> volume '" << (*tVolIter)->volumeName()); } // return success @@ -696,11 +805,18 @@ bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( } /** private helper method to fill the glue volumes (or the volume itself in) */ -void Acts::CylinderVolumeHelper::glueTrackingVolumes( - const GeometryContext& gctx, const std::shared_ptr<TrackingVolume>& tvolOne, - BoundarySurfaceFace faceOne, const std::shared_ptr<TrackingVolume>& tvolTwo, - BoundarySurfaceFace faceTwo, double rMin, double rGlueMin, double rMax, - double zMin, double zMax) const { +void +Acts::CylinderVolumeHelper::glueTrackingVolumes( + const GeometryContext& gctx, + const std::shared_ptr<TrackingVolume>& tvolOne, + BoundarySurfaceFace faceOne, + const std::shared_ptr<TrackingVolume>& tvolTwo, + BoundarySurfaceFace faceTwo, + double rMin, + double rGlueMin, + double rMax, + double zMin, + double zMax) const { // get the two gluevolume descriptors const GlueVolumesDescriptor& gvDescriptorOne = tvolOne->glueVolumesDescriptor(); @@ -711,16 +827,16 @@ void Acts::CylinderVolumeHelper::glueTrackingVolumes( gvDescriptorOne.glueVolumes(faceOne) ? gvDescriptorOne.glueVolumes(faceOne)->arrayObjects().size() : 0; - ACTS_VERBOSE("GlueVolumeDescriptor of volume '" - << tvolOne->volumeName() << "' has " << volOneGlueVols << " @ " - << faceOne); + ACTS_VERBOSE( + "GlueVolumeDescriptor of volume '" << tvolOne->volumeName() << "' has " + << volOneGlueVols << " @ " << faceOne); size_t volTwoGlueVols = gvDescriptorTwo.glueVolumes(faceTwo) ? gvDescriptorTwo.glueVolumes(faceTwo)->arrayObjects().size() : 0; - ACTS_VERBOSE("GlueVolumeDescriptor of volume '" - << tvolTwo->volumeName() << "' has " << volTwoGlueVols << " @ " - << faceTwo); + ACTS_VERBOSE( + "GlueVolumeDescriptor of volume '" << tvolTwo->volumeName() << "' has " + << volTwoGlueVols << " @ " << faceTwo); // they could still be a container though - should not happen usually TrackingVolumePtr glueVolOne = @@ -739,38 +855,40 @@ void Acts::CylinderVolumeHelper::glueTrackingVolumes( // check the cases if (volOneGlueVols <= 1 && volTwoGlueVols <= 1) { // (i) one -> one - ACTS_VERBOSE(" glue : one[ " << glueVolOne->volumeName() << " @ " - << faceOne << " ]-to-one[ " - << glueVolTwo->volumeName() << " @ " - << faceTwo << " ]"); + ACTS_VERBOSE( + " glue : one[ " << glueVolOne->volumeName() << " @ " << faceOne + << " ]-to-one[ " << glueVolTwo->volumeName() + << " @ " << faceTwo << " ]"); // one to one is easy - mutableGlueVolOne->glueTrackingVolume(gctx, faceOne, mutableGlueVolTwo, - faceTwo); + mutableGlueVolOne->glueTrackingVolume( + gctx, faceOne, mutableGlueVolTwo, faceTwo); } else if (volOneGlueVols <= 1) { // (ii) one -> many - ACTS_VERBOSE(" glue : one[ " - << glueVolOne->volumeName() << " @ " << faceOne - << " ]-to-many[ " << tvolTwo->volumeName() << " @ " << faceTwo - << " ]"); + ACTS_VERBOSE( + " glue : one[ " << glueVolOne->volumeName() << " @ " << faceOne + << " ]-to-many[ " << tvolTwo->volumeName() << " @ " + << faceTwo << " ]"); auto mutableFaceTwoVolumes = std::const_pointer_cast<TrackingVolumeArray>( gvDescriptorTwo.glueVolumes(faceTwo)); - mutableGlueVolOne->glueTrackingVolumes(gctx, faceOne, mutableFaceTwoVolumes, - faceTwo); + mutableGlueVolOne->glueTrackingVolumes( + gctx, faceOne, mutableFaceTwoVolumes, faceTwo); } else if (volTwoGlueVols <= 1) { // (iii) many -> one - ACTS_VERBOSE(" glue : many[ " - << tvolOne->volumeName() << " @ " << faceOne << " ]-to-one[ " - << glueVolTwo->volumeName() << " @ " << faceTwo << " ]"); + ACTS_VERBOSE( + " glue : many[ " << tvolOne->volumeName() << " @ " << faceOne + << " ]-to-one[ " << glueVolTwo->volumeName() + << " @ " << faceTwo << " ]"); auto mutableFaceOneVolumes = std::const_pointer_cast<TrackingVolumeArray>( gvDescriptorOne.glueVolumes(faceOne)); - mutableGlueVolTwo->glueTrackingVolumes(gctx, faceTwo, mutableFaceOneVolumes, - faceOne); + mutableGlueVolTwo->glueTrackingVolumes( + gctx, faceTwo, mutableFaceOneVolumes, faceOne); } else { // (iv) glue array to array - ACTS_VERBOSE(" glue : many[ " - << tvolOne->volumeName() << " @ " << faceOne << " ]-to-many[ " - << tvolTwo->volumeName() << " @ " << faceTwo << " ]"); + ACTS_VERBOSE( + " glue : many[ " << tvolOne->volumeName() << " @ " << faceOne + << " ]-to-many[ " << tvolTwo->volumeName() + << " @ " << faceTwo << " ]"); // create the BoundarySurface as shared pointer std::shared_ptr<const BoundarySurfaceT<TrackingVolume>> boundarySurface = @@ -789,8 +907,8 @@ void Acts::CylinderVolumeHelper::glueTrackingVolumes( // (1) create the BoundaryCylinderSurface // now create the CylinderSurface std::shared_ptr<const Surface> cSurface = - Surface::makeShared<CylinderSurface>(transform, rGlueMin, - 0.5 * (zMax - zMin)); + Surface::makeShared<CylinderSurface>( + transform, rGlueMin, 0.5 * (zMax - zMin)); ACTS_VERBOSE( " creating a new cylindrical boundary surface " "with bounds = " @@ -798,7 +916,8 @@ void Acts::CylinderVolumeHelper::glueTrackingVolumes( ACTS_VERBOSE(" at " << cSurface->center(gctx).transpose()); boundarySurface = std::make_shared<const BoundarySurfaceT<TrackingVolume>>( - std::move(cSurface), gvDescriptorOne.glueVolumes(faceOne), + std::move(cSurface), + gvDescriptorOne.glueVolumes(faceOne), gvDescriptorTwo.glueVolumes(faceTwo)); } else { // Calculate correct position for disc surface @@ -824,7 +943,8 @@ void Acts::CylinderVolumeHelper::glueTrackingVolumes( ACTS_VERBOSE(" at " << dSurface->center(gctx).transpose()); boundarySurface = std::make_shared<const BoundarySurfaceT<TrackingVolume>>( - std::move(dSurface), gvDescriptorOne.glueVolumes(faceOne), + std::move(dSurface), + gvDescriptorOne.glueVolumes(faceOne), gvDescriptorTwo.glueVolumes(faceTwo)); } // update the volume with the boundary surface accordingly @@ -845,11 +965,14 @@ void Acts::CylinderVolumeHelper::glueTrackingVolumes( } /** Private method - helper method not to duplicate code */ -void Acts::CylinderVolumeHelper::addFaceVolumes( - const std::shared_ptr<TrackingVolume>& tvol, BoundarySurfaceFace glueFace, +void +Acts::CylinderVolumeHelper::addFaceVolumes( + const std::shared_ptr<TrackingVolume>& tvol, + BoundarySurfaceFace glueFace, TrackingVolumeVector& vols) const { - ACTS_VERBOSE("Adding face volumes of face " << glueFace << " for the volume '" - << tvol->volumeName() << "'."); + ACTS_VERBOSE( + "Adding face volumes of face " << glueFace << " for the volume '" + << tvol->volumeName() << "'."); // retrieve the gluevolume descriptor const GlueVolumesDescriptor& gvDescriptor = tvol->glueVolumesDescriptor(); // if volumes are registered: take them @@ -862,8 +985,8 @@ void Acts::CylinderVolumeHelper::addFaceVolumes( vols.push_back(*volIter); } // screen output - ACTS_VERBOSE(vols.size() - << " navigation volumes registered as glue volumes."); + ACTS_VERBOSE( + vols.size() << " navigation volumes registered as glue volumes."); } else { // the volume itself is on navigation level ACTS_VERBOSE(" -> adding only volume itself (at navigation level)."); @@ -872,12 +995,15 @@ void Acts::CylinderVolumeHelper::addFaceVolumes( } std::shared_ptr<const Acts::Layer> -Acts::CylinderVolumeHelper::createCylinderLayer(double z, double r, - double halflengthZ, - double thickness, int binsPhi, - int binsZ) const { - ACTS_VERBOSE("Creating a CylinderLayer at position " << z << " and radius " - << r); +Acts::CylinderVolumeHelper::createCylinderLayer( + double z, + double r, + double halflengthZ, + double thickness, + int binsPhi, + int binsZ) const { + ACTS_VERBOSE( + "Creating a CylinderLayer at position " << z << " and radius " << r); // positioning std::shared_ptr<const Transform3D> transform = (std::abs(z) > 0.1) @@ -885,37 +1011,46 @@ Acts::CylinderVolumeHelper::createCylinderLayer(double z, double r, : nullptr; // z-binning - BinUtility layerBinUtility(binsZ, z - halflengthZ, z + halflengthZ, open, - binZ); + BinUtility layerBinUtility( + binsZ, z - halflengthZ, z + halflengthZ, open, binZ); if (binsPhi == 1) { // the BinUtility for the material // ---------------------> create material for the layer surface - ACTS_VERBOSE(" -> Preparing the binned material with " << binsZ - << " bins in Z. "); + ACTS_VERBOSE( + " -> Preparing the binned material with " << binsZ << " bins in Z. "); } else { // break the phi symmetry // update the BinUtility: local position on Cylinder is rPhi, z - BinUtility layerBinUtilityPhiZ(binsPhi, -r * M_PI, +r * M_PI, closed, - binPhi); + BinUtility layerBinUtilityPhiZ( + binsPhi, -r * M_PI, +r * M_PI, closed, binPhi); layerBinUtilityPhiZ += layerBinUtility; // ---------------------> create material for the layer surface - ACTS_VERBOSE(" -> Preparing the binned material with " - << binsPhi << " / " << binsZ << " bins in phi / Z. "); + ACTS_VERBOSE( + " -> Preparing the binned material with " << binsPhi << " / " << binsZ + << " bins in phi / Z. "); } // @todo create the SurfaceMaterial // bounds for cylinderical surface CylinderBounds* cylinderBounds = new CylinderBounds(r, halflengthZ); // create the cylinder return CylinderLayer::create( - transform, std::shared_ptr<const CylinderBounds>(cylinderBounds), nullptr, + transform, + std::shared_ptr<const CylinderBounds>(cylinderBounds), + nullptr, thickness); } -std::shared_ptr<const Acts::Layer> Acts::CylinderVolumeHelper::createDiscLayer( - double z, double rMin, double rMax, double thickness, int binsPhi, +std::shared_ptr<const Acts::Layer> +Acts::CylinderVolumeHelper::createDiscLayer( + double z, + double rMin, + double rMax, + double thickness, + int binsPhi, int binsR) const { - ACTS_VERBOSE("Creating a DiscLayer at position " << z << " and rMin/rMax " - << rMin << " / " << rMax); + ACTS_VERBOSE( + "Creating a DiscLayer at position " << z << " and rMin/rMax " << rMin + << " / " << rMax); // positioning std::shared_ptr<const Transform3D> transform = @@ -926,20 +1061,23 @@ std::shared_ptr<const Acts::Layer> Acts::CylinderVolumeHelper::createDiscLayer( // R is the primary binning for the material BinUtility materialBinUtility(binsR, rMin, rMax, open, binR); if (binsPhi == 1) { - ACTS_VERBOSE(" -> Preparing the binned material with " << binsR - << " bins in R. "); + ACTS_VERBOSE( + " -> Preparing the binned material with " << binsR << " bins in R. "); } else { // also binning in phi chosen materialBinUtility += BinUtility(binsPhi, -M_PI, M_PI, closed, binPhi); - ACTS_VERBOSE(" -> Preparing the binned material with " - << binsPhi << " / " << binsR << " bins in phi / R. "); + ACTS_VERBOSE( + " -> Preparing the binned material with " << binsPhi << " / " << binsR + << " bins in phi / R. "); } // @todo create the SurfaceMaterial // bounds for disk-like surface RadialBounds* discBounds = new RadialBounds(rMin, rMax); // create the disc - return DiscLayer::create(transform, - std::shared_ptr<const DiscBounds>(discBounds), - nullptr, thickness); + return DiscLayer::create( + transform, + std::shared_ptr<const DiscBounds>(discBounds), + nullptr, + thickness); } diff --git a/Core/src/Geometry/DiscLayer.cpp b/Core/src/Geometry/DiscLayer.cpp index a7dfb26fd..b09218fc3 100644 --- a/Core/src/Geometry/DiscLayer.cpp +++ b/Core/src/Geometry/DiscLayer.cpp @@ -24,12 +24,13 @@ using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; -Acts::DiscLayer::DiscLayer(const std::shared_ptr<const Transform3D>& transform, - const std::shared_ptr<const DiscBounds>& dbounds, - std::unique_ptr<SurfaceArray> surfaceArray, - double thickness, - std::unique_ptr<ApproachDescriptor> ades, - LayerType laytyp) +Acts::DiscLayer::DiscLayer( + const std::shared_ptr<const Transform3D>& transform, + const std::shared_ptr<const DiscBounds>& dbounds, + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness, + std::unique_ptr<ApproachDescriptor> ades, + LayerType laytyp) : DiscSurface(transform, dbounds), Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) { // In case we have Radial bounds @@ -55,15 +56,18 @@ Acts::DiscLayer::DiscLayer(const std::shared_ptr<const Transform3D>& transform, } } -const Acts::DiscSurface& Acts::DiscLayer::surfaceRepresentation() const { +const Acts::DiscSurface& +Acts::DiscLayer::surfaceRepresentation() const { return (*this); } -Acts::DiscSurface& Acts::DiscLayer::surfaceRepresentation() { +Acts::DiscSurface& +Acts::DiscLayer::surfaceRepresentation() { return (*this); } -void Acts::DiscLayer::buildApproachDescriptor() { +void +Acts::DiscLayer::buildApproachDescriptor() { // delete it m_approachDescriptor.reset(nullptr); // take the boundary surfaces of the representving volume if they exist diff --git a/Core/src/Geometry/DoubleTrapezoidVolumeBounds.cpp b/Core/src/Geometry/DoubleTrapezoidVolumeBounds.cpp index 99394f864..9faddaf98 100644 --- a/Core/src/Geometry/DoubleTrapezoidVolumeBounds.cpp +++ b/Core/src/Geometry/DoubleTrapezoidVolumeBounds.cpp @@ -23,8 +23,12 @@ Acts::DoubleTrapezoidVolumeBounds::DoubleTrapezoidVolumeBounds() : VolumeBounds(), m_valueStore(bv_length, 0.) {} Acts::DoubleTrapezoidVolumeBounds::DoubleTrapezoidVolumeBounds( - double minhalex, double medhalex, double maxhalex, double haley1, - double haley2, double halez) + double minhalex, + double medhalex, + double maxhalex, + double haley1, + double haley2, + double halez) : VolumeBounds(), m_valueStore(bv_length, 0.) { m_valueStore.at(bv_minHalfX) = minhalex; m_valueStore.at(bv_medHalfX) = medhalex; @@ -32,12 +36,12 @@ Acts::DoubleTrapezoidVolumeBounds::DoubleTrapezoidVolumeBounds( m_valueStore.at(bv_halfY1) = haley1; m_valueStore.at(bv_halfY2) = haley2; m_valueStore.at(bv_halfZ) = halez; - m_valueStore.at(bv_alpha1) = - atan2(m_valueStore.at(bv_medHalfX) - m_valueStore.at(bv_minHalfX), - 2. * m_valueStore.at(bv_halfY1)); - m_valueStore.at(bv_alpha2) = - atan2(m_valueStore.at(bv_medHalfX) - m_valueStore.at(bv_maxHalfX), - 2. * m_valueStore.at(bv_halfY2)); + m_valueStore.at(bv_alpha1) = atan2( + m_valueStore.at(bv_medHalfX) - m_valueStore.at(bv_minHalfX), + 2. * m_valueStore.at(bv_halfY1)); + m_valueStore.at(bv_alpha2) = atan2( + m_valueStore.at(bv_medHalfX) - m_valueStore.at(bv_maxHalfX), + 2. * m_valueStore.at(bv_halfY2)); } Acts::DoubleTrapezoidVolumeBounds::DoubleTrapezoidVolumeBounds( @@ -46,7 +50,8 @@ Acts::DoubleTrapezoidVolumeBounds::DoubleTrapezoidVolumeBounds( Acts::DoubleTrapezoidVolumeBounds::~DoubleTrapezoidVolumeBounds() = default; -Acts::DoubleTrapezoidVolumeBounds& Acts::DoubleTrapezoidVolumeBounds::operator=( +Acts::DoubleTrapezoidVolumeBounds& +Acts::DoubleTrapezoidVolumeBounds::operator=( const Acts::DoubleTrapezoidVolumeBounds& trabo) { if (this != &trabo) { m_valueStore = trabo.m_valueStore; @@ -73,46 +78,49 @@ Acts::DoubleTrapezoidVolumeBounds::decomposeToSurfaces( const Transform3D* tTransform = nullptr; // (1) - at negative local z - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(0., 1., 0.)) * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(0., 1., 0.)) * + Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceXYDiamondBounds()))); // (2) - at positive local z - tTransform = new Transform3D(transform * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceXYDiamondBounds()))); // face surfaces yz // transmute cyclical // (3) - at point A, attached to alpha opening angle - Vector3D A(diamondCenter - minHalflengthX() * diamondX - - 2 * halflengthY1() * diamondY); + Vector3D A( + diamondCenter - minHalflengthX() * diamondX - + 2 * halflengthY1() * diamondY); AngleAxis3D alpha1ZRotation(alpha1(), Vector3D(0., 0., 1.)); RotationMatrix3D alpha1Rotation( diamondRotation * alpha1ZRotation * AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); RectangleBounds* faceAlpha1Bounds = faceAlpha1RectangleBounds(); - Vector3D faceAlpha1Position(A + alpha1Rotation.col(0) * - faceAlpha1Bounds->halflengthX()); + Vector3D faceAlpha1Position( + A + alpha1Rotation.col(0) * faceAlpha1Bounds->halflengthX()); tTransform = new Transform3D(Translation3D(faceAlpha1Position) * alpha1Rotation); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceAlpha1Bounds))); // (4) - at point B, attached to beta opening angle - Vector3D B(diamondCenter + minHalflengthX() * diamondX - - 2 * halflengthY1() * diamondY); + Vector3D B( + diamondCenter + minHalflengthX() * diamondX - + 2 * halflengthY1() * diamondY); AngleAxis3D beta1ZRotation(-alpha1(), Vector3D(0., 0., 1.)); - RotationMatrix3D beta1Rotation(diamondRotation * beta1ZRotation * - AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); + RotationMatrix3D beta1Rotation( + diamondRotation * beta1ZRotation * + AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(0.5 * M_PI, Vector3D(0., 0., 1.))); RectangleBounds* faceBeta1Bounds = faceBeta1RectangleBounds(); - Vector3D faceBeta1Position(B + beta1Rotation.col(0) * - faceBeta1Bounds->halflengthX()); + Vector3D faceBeta1Position( + B + beta1Rotation.col(0) * faceBeta1Bounds->halflengthX()); tTransform = new Transform3D(Translation3D(faceBeta1Position) * beta1Rotation); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( @@ -121,32 +129,34 @@ Acts::DoubleTrapezoidVolumeBounds::decomposeToSurfaces( // face surfaces yz // transmute cyclical // (5) - at point A', attached to alpha opening angle - Vector3D AA(diamondCenter - maxHalflengthX() * diamondX + - 2 * halflengthY2() * diamondY); + Vector3D AA( + diamondCenter - maxHalflengthX() * diamondX + + 2 * halflengthY2() * diamondY); AngleAxis3D alpha2ZRotation(-alpha2(), Vector3D(0., 0., 1.)); RotationMatrix3D alpha2Rotation( diamondRotation * alpha2ZRotation * AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * AngleAxis3D(-0.5 * M_PI, Vector3D(0., 0., 1.))); RectangleBounds* faceAlpha2Bounds = faceAlpha2RectangleBounds(); - Vector3D faceAlpha2Position(AA + alpha2Rotation.col(0) * - faceAlpha2Bounds->halflengthX()); + Vector3D faceAlpha2Position( + AA + alpha2Rotation.col(0) * faceAlpha2Bounds->halflengthX()); tTransform = new Transform3D(Translation3D(faceAlpha2Position) * alpha2Rotation); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceAlpha2Bounds))); // (6) - at point B', attached to beta opening angle - Vector3D BB(diamondCenter + maxHalflengthX() * diamondX + - 2 * halflengthY2() * diamondY); + Vector3D BB( + diamondCenter + maxHalflengthX() * diamondX + + 2 * halflengthY2() * diamondY); AngleAxis3D beta2ZRotation(alpha2(), Vector3D(0., 0., 1.)); RotationMatrix3D beta2Rotation( diamondRotation * beta2ZRotation * AngleAxis3D(0.5 * M_PI, Vector3D(0., 1., 0.)) * AngleAxis3D(-0.5 * M_PI, Vector3D(0., 0., 1.))); RectangleBounds* faceBeta2Bounds = faceBeta2RectangleBounds(); - Vector3D faceBeta2Position(BB + beta2Rotation.col(0) * - faceBeta2Bounds->halflengthX()); + Vector3D faceBeta2Position( + BB + beta2Rotation.col(0) * faceBeta2Bounds->halflengthX()); tTransform = new Transform3D(Translation3D(faceBeta2Position) * beta2Rotation); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( @@ -154,11 +164,11 @@ Acts::DoubleTrapezoidVolumeBounds::decomposeToSurfaces( std::shared_ptr<const PlanarBounds>(faceBeta2Bounds))); // face surfaces zx // (7) - at negative local y - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * - Translation3D(Vector3D(0., 2 * halflengthY1(), 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * + Translation3D(Vector3D(0., 2 * halflengthY1(), 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceZXRectangleBoundsBottom()))); @@ -175,11 +185,13 @@ Acts::DoubleTrapezoidVolumeBounds::decomposeToSurfaces( } // faces in xy -Acts::DiamondBounds* Acts::DoubleTrapezoidVolumeBounds::faceXYDiamondBounds() - const { +Acts::DiamondBounds* +Acts::DoubleTrapezoidVolumeBounds::faceXYDiamondBounds() const { return new DiamondBounds( - m_valueStore.at(bv_minHalfX), m_valueStore.at(bv_medHalfX), - m_valueStore.at(bv_maxHalfX), 2 * m_valueStore.at(bv_halfY1), + m_valueStore.at(bv_minHalfX), + m_valueStore.at(bv_medHalfX), + m_valueStore.at(bv_maxHalfX), + 2 * m_valueStore.at(bv_halfY1), 2 * m_valueStore.at(bv_halfY2)); } @@ -213,18 +225,19 @@ Acts::DoubleTrapezoidVolumeBounds::faceBeta2RectangleBounds() const { Acts::RectangleBounds* Acts::DoubleTrapezoidVolumeBounds::faceZXRectangleBoundsBottom() const { - return new RectangleBounds(m_valueStore.at(bv_halfZ), - m_valueStore.at(bv_minHalfX)); + return new RectangleBounds( + m_valueStore.at(bv_halfZ), m_valueStore.at(bv_minHalfX)); } Acts::RectangleBounds* Acts::DoubleTrapezoidVolumeBounds::faceZXRectangleBoundsTop() const { - return new RectangleBounds(m_valueStore.at(bv_halfZ), - m_valueStore.at(bv_maxHalfX)); + return new RectangleBounds( + m_valueStore.at(bv_halfZ), m_valueStore.at(bv_maxHalfX)); } -bool Acts::DoubleTrapezoidVolumeBounds::inside(const Vector3D& pos, - double tol) const { +bool +Acts::DoubleTrapezoidVolumeBounds::inside(const Vector3D& pos, double tol) + const { if (std::abs(pos.z()) > m_valueStore.at(bv_halfZ) + tol) { return false; } @@ -242,13 +255,15 @@ bool Acts::DoubleTrapezoidVolumeBounds::inside(const Vector3D& pos, } // ostream operator overload -std::ostream& Acts::DoubleTrapezoidVolumeBounds::toStream( - std::ostream& sl) const { +std::ostream& +Acts::DoubleTrapezoidVolumeBounds::toStream(std::ostream& sl) const { return dumpT<std::ostream>(sl); } -Acts::Volume::BoundingBox Acts::DoubleTrapezoidVolumeBounds::boundingBox( - const Transform3D* trf, const Vector3D& envelope, +Acts::Volume::BoundingBox +Acts::DoubleTrapezoidVolumeBounds::boundingBox( + const Transform3D* trf, + const Vector3D& envelope, const Volume* entity) const { float minx = minHalflengthX(); float medx = medHalflengthX(); diff --git a/Core/src/Geometry/GenericApproachDescriptor.cpp b/Core/src/Geometry/GenericApproachDescriptor.cpp index 5330dbc3b..7718b2f9d 100644 --- a/Core/src/Geometry/GenericApproachDescriptor.cpp +++ b/Core/src/Geometry/GenericApproachDescriptor.cpp @@ -10,7 +10,8 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Intersection.hpp" -void Acts::GenericApproachDescriptor::registerLayer(const Layer& lay) { +void +Acts::GenericApproachDescriptor::registerLayer(const Layer& lay) { // go through the surfaces for (auto& sf : m_surfaceCache) { auto mutableSf = const_cast<Surface*>(sf); @@ -19,12 +20,13 @@ void Acts::GenericApproachDescriptor::registerLayer(const Layer& lay) { } Acts::ObjectIntersection<Acts::Surface> -Acts::GenericApproachDescriptor::approachSurface(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc corrfnc) const { +Acts::GenericApproachDescriptor::approachSurface( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc corrfnc) const { // the intersection estimates std::vector<ObjectIntersection<Surface>> sIntersections; sIntersections.reserve(m_surfaceCache.size()); diff --git a/Core/src/Geometry/GenericCuboidVolumeBounds.cpp b/Core/src/Geometry/GenericCuboidVolumeBounds.cpp index c6b9d4962..7ca0ce4d5 100644 --- a/Core/src/Geometry/GenericCuboidVolumeBounds.cpp +++ b/Core/src/Geometry/GenericCuboidVolumeBounds.cpp @@ -35,27 +35,28 @@ Acts::GenericCuboidVolumeBounds::GenericCuboidVolumeBounds( size_t idx = 0; - auto handle_face = [&](const auto& a, const auto& b, const auto& c, - const auto& d) { - // we assume a b c d to be counter clockwise - const Vector3D ab = b - a, ac = c - a; - Vector3D normal = ab.cross(ac).normalized(); + auto handle_face = + [&](const auto& a, const auto& b, const auto& c, const auto& d) { + // we assume a b c d to be counter clockwise + const Vector3D ab = b - a, ac = c - a; + Vector3D normal = ab.cross(ac).normalized(); - if ((cog - a).dot(normal) < 0) { - // normal points outwards, flip normal - normal *= -1.; - } + if ((cog - a).dot(normal) < 0) { + // normal points outwards, flip normal + normal *= -1.; + } - // get rid of -0 values if present - normal += Vector3D::Zero(); + // get rid of -0 values if present + normal += Vector3D::Zero(); - // check if d is on the surface - throw_assert((std::abs((a - d).dot(normal)) < 1e-6), - "Four points do not lie on the same plane!"); + // check if d is on the surface + throw_assert( + (std::abs((a - d).dot(normal)) < 1e-6), + "Four points do not lie on the same plane!"); - m_normals[idx] = normal; - idx++; - }; + m_normals[idx] = normal; + idx++; + }; // handle faces handle_face(m_vertices[0], m_vertices[1], m_vertices[2], m_vertices[3]); @@ -66,12 +67,14 @@ Acts::GenericCuboidVolumeBounds::GenericCuboidVolumeBounds( handle_face(m_vertices[1], m_vertices[0], m_vertices[4], m_vertices[5]); } -Acts::VolumeBounds* Acts::GenericCuboidVolumeBounds::clone() const { +Acts::VolumeBounds* +Acts::GenericCuboidVolumeBounds::clone() const { return new GenericCuboidVolumeBounds(*this); } -bool Acts::GenericCuboidVolumeBounds::inside(const Acts::Vector3D& gpos, - double tol) const { +bool +Acts::GenericCuboidVolumeBounds::inside(const Acts::Vector3D& gpos, double tol) + const { constexpr std::array<size_t, 6> vtxs = {0, 4, 0, 1, 2, 1}; // needs to be on same side, get ref bool ref = std::signbit((gpos - m_vertices[vtxs[0]]).dot(m_normals[0])); @@ -103,7 +106,9 @@ Acts::GenericCuboidVolumeBounds::decomposeToSurfaces( cog *= 0.125; // 1/8. - auto make_surface = [&](const auto& a, const auto& b, const auto& c, + auto make_surface = [&](const auto& a, + const auto& b, + const auto& c, const auto& d) { // calculate centroid of these points Vector3D ctrd = (a + b + c + d) / 4.; @@ -163,8 +168,8 @@ Acts::GenericCuboidVolumeBounds::decomposeToSurfaces( return surfaces; } -std::ostream& Acts::GenericCuboidVolumeBounds::toStream( - std::ostream& sl) const { +std::ostream& +Acts::GenericCuboidVolumeBounds::toStream(std::ostream& sl) const { sl << "Acts::GenericCuboidVolumeBounds: vertices (x, y, z) =\n"; for (size_t i = 0; i < 8; i++) { if (i > 0) { @@ -175,8 +180,10 @@ std::ostream& Acts::GenericCuboidVolumeBounds::toStream( return sl; } -Acts::Volume::BoundingBox Acts::GenericCuboidVolumeBounds::boundingBox( - const Acts::Transform3D* trf, const Vector3D& envelope, +Acts::Volume::BoundingBox +Acts::GenericCuboidVolumeBounds::boundingBox( + const Acts::Transform3D* trf, + const Vector3D& envelope, const Volume* entity) const { Vector3D vmin, vmax; @@ -197,13 +204,15 @@ Acts::Volume::BoundingBox Acts::GenericCuboidVolumeBounds::boundingBox( return {entity, vmin - envelope, vmax + envelope}; } -void Acts::GenericCuboidVolumeBounds::draw(IVisualization& helper, - const Transform3D& transform) const { - auto draw_face = [&](const auto& a, const auto& b, const auto& c, - const auto& d) { - helper.face(std::vector<Vector3D>( - {transform * a, transform * b, transform * c, transform * d})); - }; +void +Acts::GenericCuboidVolumeBounds::draw( + IVisualization& helper, + const Transform3D& transform) const { + auto draw_face = + [&](const auto& a, const auto& b, const auto& c, const auto& d) { + helper.face(std::vector<Vector3D>( + {transform * a, transform * b, transform * c, transform * d})); + }; draw_face(m_vertices[0], m_vertices[1], m_vertices[2], m_vertices[3]); draw_face(m_vertices[4], m_vertices[5], m_vertices[6], m_vertices[7]); diff --git a/Core/src/Geometry/GeometryID.cpp b/Core/src/Geometry/GeometryID.cpp index 5bf49a9c6..053919692 100644 --- a/Core/src/Geometry/GeometryID.cpp +++ b/Core/src/Geometry/GeometryID.cpp @@ -12,25 +12,28 @@ #include "Acts/Geometry/GeometryID.hpp" -bool Acts::operator<(const Acts::GeometryID& one, const Acts::GeometryID& two) { +bool +Acts::operator<(const Acts::GeometryID& one, const Acts::GeometryID& two) { return (one.value() < two.value()); } -bool Acts::operator<=(const Acts::GeometryID& one, - const Acts::GeometryID& two) { +bool +Acts::operator<=(const Acts::GeometryID& one, const Acts::GeometryID& two) { return (one.value() <= two.value()); } -bool Acts::operator>(const Acts::GeometryID& one, const Acts::GeometryID& two) { +bool +Acts::operator>(const Acts::GeometryID& one, const Acts::GeometryID& two) { return (one.value() > two.value()); } -bool Acts::operator>=(const Acts::GeometryID& one, - const Acts::GeometryID& two) { +bool +Acts::operator>=(const Acts::GeometryID& one, const Acts::GeometryID& two) { return (one.value() >= two.value()); } -std::ostream& Acts::operator<<(std::ostream& sl, const Acts::GeometryID& tid) { +std::ostream& +Acts::operator<<(std::ostream& sl, const Acts::GeometryID& tid) { sl << tid.value(); return sl; } diff --git a/Core/src/Geometry/GlueVolumesDescriptor.cpp b/Core/src/Geometry/GlueVolumesDescriptor.cpp index 43a909cac..f9057e51f 100644 --- a/Core/src/Geometry/GlueVolumesDescriptor.cpp +++ b/Core/src/Geometry/GlueVolumesDescriptor.cpp @@ -16,8 +16,9 @@ #include "Acts/Geometry/TrackingVolume.hpp" Acts::GlueVolumesDescriptor::GlueVolumesDescriptor( - const std::map<BoundarySurfaceFace, - std::shared_ptr<const TrackingVolumeArray>>& gvs) + const std::map< + BoundarySurfaceFace, + std::shared_ptr<const TrackingVolumeArray>>& gvs) : m_glueVolumes(gvs) { // fill the available faces for (auto& gvIter : m_glueVolumes) { @@ -25,7 +26,8 @@ Acts::GlueVolumesDescriptor::GlueVolumesDescriptor( } } -void Acts::GlueVolumesDescriptor::registerGlueVolumes( +void +Acts::GlueVolumesDescriptor::registerGlueVolumes( Acts::BoundarySurfaceFace bsf, std::shared_ptr<const TrackingVolumeArray> gvs) { // register the face @@ -48,7 +50,8 @@ Acts::GlueVolumesDescriptor::glueVolumes(Acts::BoundarySurfaceFace bsf) const { return nullptr; } -std::string Acts::GlueVolumesDescriptor::screenOutput() const { +std::string +Acts::GlueVolumesDescriptor::screenOutput() const { std::stringstream sl; sl << "Acts::GlueVolumesDescriptor: " << std::endl; const std::vector<Acts::BoundarySurfaceFace>& glueFaceVector = glueFaces(); @@ -70,8 +73,8 @@ std::string Acts::GlueVolumesDescriptor::screenOutput() const { return sl.str(); } -std::ostream& Acts::operator<<(std::ostream& sl, - const GlueVolumesDescriptor& gvd) { +std::ostream& +Acts::operator<<(std::ostream& sl, const GlueVolumesDescriptor& gvd) { sl << gvd.screenOutput(); return sl; } diff --git a/Core/src/Geometry/Layer.cpp b/Core/src/Geometry/Layer.cpp index 9b60f7574..477a0d1e7 100644 --- a/Core/src/Geometry/Layer.cpp +++ b/Core/src/Geometry/Layer.cpp @@ -17,8 +17,11 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BinUtility.hpp" -Acts::Layer::Layer(std::unique_ptr<SurfaceArray> surfaceArray, double thickness, - std::unique_ptr<ApproachDescriptor> ades, LayerType laytyp) +Acts::Layer::Layer( + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness, + std::unique_ptr<ApproachDescriptor> ades, + LayerType laytyp) : m_nextLayers(NextLayers(nullptr, nullptr)), m_surfaceArray(surfaceArray.release()), m_layerThickness(thickness), @@ -37,16 +40,20 @@ Acts::Layer::Layer(std::unique_ptr<SurfaceArray> surfaceArray, double thickness, } } -const Acts::ApproachDescriptor* Acts::Layer::approachDescriptor() const { +const Acts::ApproachDescriptor* +Acts::Layer::approachDescriptor() const { return m_approachDescriptor.get(); } -Acts::ApproachDescriptor* Acts::Layer::approachDescriptor() { +Acts::ApproachDescriptor* +Acts::Layer::approachDescriptor() { return const_cast<ApproachDescriptor*>(m_approachDescriptor.get()); } -void Acts::Layer::closeGeometry(const IMaterialDecorator* materialDecorator, - const GeometryID& layerID) { +void +Acts::Layer::closeGeometry( + const IMaterialDecorator* materialDecorator, + const GeometryID& layerID) { // set the volumeID of this assignGeoID(layerID); // assign to the representing surface diff --git a/Core/src/Geometry/LayerArrayCreator.cpp b/Core/src/Geometry/LayerArrayCreator.cpp index 8cf79aa5e..6084e3e41 100644 --- a/Core/src/Geometry/LayerArrayCreator.cpp +++ b/Core/src/Geometry/LayerArrayCreator.cpp @@ -27,11 +27,16 @@ #include "Acts/Utilities/BinnedArrayXD.hpp" #include "Acts/Utilities/Definitions.hpp" -std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( - const GeometryContext& gctx, const LayerVector& layersInput, double min, - double max, BinningType bType, BinningValue bValue) const { - ACTS_VERBOSE("Build LayerArray with " << layersInput.size() - << " layers at input."); +std::unique_ptr<const Acts::LayerArray> +Acts::LayerArrayCreator::layerArray( + const GeometryContext& gctx, + const LayerVector& layersInput, + double min, + double max, + BinningType bType, + BinningValue bValue) const { + ACTS_VERBOSE( + "Build LayerArray with " << layersInput.size() << " layers at input."); ACTS_VERBOSE(" min/max provided : " << min << " / " << max); ACTS_VERBOSE(" binning type : " << bType); ACTS_VERBOSE(" binning value : " << bValue); @@ -55,14 +60,15 @@ std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( case equidistant: { // loop over layers and put them in for (auto& layIter : layers) { - ACTS_VERBOSE("equidistant : registering a Layer at binning position : " - << (layIter->binningPosition(gctx, bValue))); + ACTS_VERBOSE( + "equidistant : registering a Layer at binning position : " + << (layIter->binningPosition(gctx, bValue))); layerOrderVector.push_back(LayerOrderPosition( layIter, layIter->binningPosition(gctx, bValue))); } // create the binUitlity - binUtility = std::make_unique<const BinUtility>(layers.size(), min, max, - open, bValue); + binUtility = std::make_unique<const BinUtility>( + layers.size(), min, max, open, bValue); ACTS_VERBOSE("equidistant : created a BinUtility as " << *binUtility); } break; @@ -98,16 +104,20 @@ std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( } // if layers are overlapping bail out if (navigationValue > (layerValue - 0.5 * layerThickness)) { - ACTS_ERROR("Layers are overlapping at: " - << layerValue - 0.5 * layerThickness - << ". This should never happen. " - "Please check your geometry description."); + ACTS_ERROR( + "Layers are overlapping at: " + << layerValue - 0.5 * layerThickness + << ". This should never happen. " + "Please check your geometry description."); } // create the navigation layer surface from the layer std::shared_ptr<const Surface> navLayerSurface = - createNavigationSurface(gctx, *layIter, bValue, - -std::abs(layerValue - navigationValue)); + createNavigationSurface( + gctx, + *layIter, + bValue, + -std::abs(layerValue - navigationValue)); ACTS_VERBOSE( "arbitrary : creating a NavigationLayer at " << (navLayerSurface->binningPosition(gctx, bValue)).x() << ", " @@ -121,10 +131,11 @@ std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( // push the original layer in layerOrderVector.push_back(LayerOrderPosition( layIter, layIter->binningPosition(gctx, bValue))); - ACTS_VERBOSE("arbitrary : registering MaterialLayer at " - << (layIter->binningPosition(gctx, bValue)).x() << ", " - << (layIter->binningPosition(gctx, bValue)).y() << ", " - << (layIter->binningPosition(gctx, bValue)).z()); + ACTS_VERBOSE( + "arbitrary : registering MaterialLayer at " + << (layIter->binningPosition(gctx, bValue)).x() << ", " + << (layIter->binningPosition(gctx, bValue)).y() << ", " + << (layIter->binningPosition(gctx, bValue)).z()); // remember the last lastLayer = layIter; } @@ -136,8 +147,8 @@ std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( if (navigationValue != max) { // create the navigation layer surface from the layer std::shared_ptr<const Surface> navLayerSurface = - createNavigationSurface(gctx, *lastLayer, bValue, - navigationValue - layerValue); + createNavigationSurface( + gctx, *lastLayer, bValue, navigationValue - layerValue); ACTS_VERBOSE( "arbitrary : creating a NavigationLayer at " << (navLayerSurface->binningPosition(gctx, bValue)).x() << ", " @@ -151,8 +162,8 @@ std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( // now close the boundaries boundaries.push_back(max); // some screen output - ACTS_VERBOSE(layerOrderVector.size() - << " Layers (material + navigation) built. "); + ACTS_VERBOSE( + layerOrderVector.size() << " Layers (material + navigation) built. "); // create the BinUtility binUtility = std::make_unique<const BinUtility>(boundaries, open, bValue); ACTS_VERBOSE("arbitrary : created a BinUtility as " << *binUtility); @@ -164,12 +175,15 @@ std::unique_ptr<const Acts::LayerArray> Acts::LayerArrayCreator::layerArray( } } // return the binned array - return std::make_unique<const BinnedArrayXD<LayerPtr>>(layerOrderVector, - std::move(binUtility)); + return std::make_unique<const BinnedArrayXD<LayerPtr>>( + layerOrderVector, std::move(binUtility)); } -std::shared_ptr<Acts::Surface> Acts::LayerArrayCreator::createNavigationSurface( - const GeometryContext& gctx, const Layer& layer, BinningValue bValue, +std::shared_ptr<Acts::Surface> +Acts::LayerArrayCreator::createNavigationSurface( + const GeometryContext& gctx, + const Layer& layer, + BinningValue bValue, double offset) const { // surface reference const Surface& layerSurface = layer.surfaceRepresentation(); diff --git a/Core/src/Geometry/LayerCreator.cpp b/Core/src/Geometry/LayerCreator.cpp index b19e4d705..85d83e298 100644 --- a/Core/src/Geometry/LayerCreator.cpp +++ b/Core/src/Geometry/LayerCreator.cpp @@ -27,25 +27,31 @@ using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; -Acts::LayerCreator::LayerCreator(const Acts::LayerCreator::Config& lcConfig, - std::unique_ptr<const Logger> logger) +Acts::LayerCreator::LayerCreator( + const Acts::LayerCreator::Config& lcConfig, + std::unique_ptr<const Logger> logger) : m_cfg(lcConfig), m_logger(std::move(logger)) {} -void Acts::LayerCreator::setConfiguration( +void +Acts::LayerCreator::setConfiguration( const Acts::LayerCreator::Config& lcConfig) { // @todo check consistency // copy the configuration m_cfg = lcConfig; } -void Acts::LayerCreator::setLogger(std::unique_ptr<const Logger> newLogger) { +void +Acts::LayerCreator::setLogger(std::unique_ptr<const Logger> newLogger) { m_logger = std::move(newLogger); } -Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( +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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsPhi, + size_t binsZ, + boost::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -58,22 +64,25 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( double envZShift = 0.5 * (-protoLayer.envZ.first + protoLayer.envZ.second); double layerZ = binPosZ + envZShift; - double layerHalfZ = 0.5 * std::abs(protoLayer.maxZ + protoLayer.envZ.second - - (protoLayer.minZ - protoLayer.envZ.first)); + double layerHalfZ = 0.5 * std::abs( + protoLayer.maxZ + protoLayer.envZ.second - + (protoLayer.minZ - protoLayer.envZ.first)); double layerThickness = (protoLayer.maxR - protoLayer.minR) + protoLayer.envR.first + protoLayer.envR.second; ACTS_VERBOSE("Creating a cylindrical Layer:"); ACTS_VERBOSE(" - with layer R = " << layerR); - ACTS_VERBOSE(" - from R min/max = " << protoLayer.minR << " / " - << protoLayer.maxR); + ACTS_VERBOSE( + " - from R min/max = " << protoLayer.minR << " / " << protoLayer.maxR); ACTS_VERBOSE(" - with R thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envR.first << " / " - << protoLayer.envR.second); + ACTS_VERBOSE( + " - incl envelope = " << protoLayer.envR.first << " / " + << protoLayer.envR.second); - ACTS_VERBOSE(" - with z min/max = " - << protoLayer.minZ << " (-" << protoLayer.envZ.first << ") / " - << protoLayer.maxZ << " (+" << protoLayer.envZ.second << ")"); + ACTS_VERBOSE( + " - with z min/max = " + << protoLayer.minZ << " (-" << protoLayer.envZ.first << ") / " + << protoLayer.maxZ << " (+" << protoLayer.envZ.second << ")"); ACTS_VERBOSE(" - z center = " << layerZ); ACTS_VERBOSE(" - halflength z = " << layerHalfZ); @@ -88,10 +97,12 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( ACTS_VERBOSE(" - layer z shift = " << -layerZ); } - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.minPhi << " / " - << protoLayer.maxPhi); - ACTS_VERBOSE(" - # of modules = " << surfaces.size() << " ordered in ( " - << binsPhi << " x " << binsZ << ")"); + ACTS_VERBOSE( + " - with phi min/max = " << protoLayer.minPhi << " / " + << protoLayer.maxPhi); + ACTS_VERBOSE( + " - # of modules = " << surfaces.size() << " ordered in ( " << binsPhi + << " x " << binsZ << ")"); std::unique_ptr<SurfaceArray> sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder( @@ -105,9 +116,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( new CylinderBounds(layerR, layerHalfZ)); // create the layer - MutableLayerPtr cLayer = - CylinderLayer::create(transform, cBounds, std::move(sArray), - layerThickness, std::move(ad), active); + MutableLayerPtr cLayer = CylinderLayer::create( + transform, + cBounds, + std::move(sArray), + layerThickness, + std::move(ad), + active); if (!cLayer) ACTS_ERROR("Creation of cylinder layer did not succeed!"); @@ -117,10 +132,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( return cLayer; } -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, + std::vector<std::shared_ptr<const Surface>> surfaces, + BinningType bTypePhi, + BinningType bTypeZ, + boost::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -133,8 +151,9 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( double envZShift = 0.5 * (-protoLayer.envZ.first + protoLayer.envZ.second); double layerZ = binPosZ + envZShift; - double layerHalfZ = 0.5 * std::abs(protoLayer.maxZ + protoLayer.envZ.second - - (protoLayer.minZ - protoLayer.envZ.first)); + double layerHalfZ = 0.5 * std::abs( + protoLayer.maxZ + protoLayer.envZ.second - + (protoLayer.minZ - protoLayer.envZ.first)); double layerThickness = (protoLayer.maxR - protoLayer.minR) + protoLayer.envR.first + protoLayer.envR.second; @@ -142,14 +161,16 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( // adjust the layer radius ACTS_VERBOSE("Creating a cylindrical Layer:"); ACTS_VERBOSE(" - with layer R = " << layerR); - ACTS_VERBOSE(" - from R min/max = " << protoLayer.minR << " / " - << protoLayer.maxR); + ACTS_VERBOSE( + " - from R min/max = " << protoLayer.minR << " / " << protoLayer.maxR); ACTS_VERBOSE(" - with R thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envR.first << " / " - << protoLayer.envR.second); - ACTS_VERBOSE(" - with z min/max = " - << protoLayer.minZ << " (-" << protoLayer.envZ.first << ") / " - << protoLayer.maxZ << " (+" << protoLayer.envZ.second << ")"); + ACTS_VERBOSE( + " - incl envelope = " << protoLayer.envR.first << " / " + << protoLayer.envR.second); + ACTS_VERBOSE( + " - with z min/max = " + << protoLayer.minZ << " (-" << protoLayer.envZ.first << ") / " + << protoLayer.maxZ << " (+" << protoLayer.envZ.second << ")"); ACTS_VERBOSE(" - z center = " << layerZ); ACTS_VERBOSE(" - halflength z = " << layerHalfZ); @@ -162,8 +183,9 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( ACTS_VERBOSE(" - layer z shift = " << -layerZ); } - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.minPhi << " / " - << protoLayer.maxPhi); + ACTS_VERBOSE( + " - with phi min/max = " << protoLayer.minPhi << " / " + << protoLayer.maxPhi); ACTS_VERBOSE(" - # of modules = " << surfaces.size() << ""); // create the surface array @@ -180,9 +202,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( new CylinderBounds(layerR, layerHalfZ)); // create the layer - MutableLayerPtr cLayer = - CylinderLayer::create(transform, cBounds, std::move(sArray), - layerThickness, std::move(ad), active); + MutableLayerPtr cLayer = CylinderLayer::create( + transform, + cBounds, + std::move(sArray), + layerThickness, + std::move(ad), + active); if (!cLayer) ACTS_ERROR("Creation of cylinder layer did not succeed!"); @@ -192,10 +218,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( return cLayer; } -Acts::MutableLayerPtr Acts::LayerCreator::discLayer( +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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsR, + size_t binsPhi, + boost::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -209,18 +238,22 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( // adjust the layer radius ACTS_VERBOSE("Creating a disk Layer:"); ACTS_VERBOSE(" - at Z position = " << layerZ); - ACTS_VERBOSE(" - from Z min/max = " << protoLayer.minZ << " / " - << protoLayer.maxZ); + ACTS_VERBOSE( + " - from Z min/max = " << protoLayer.minZ << " / " << protoLayer.maxZ); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envZ.first << " / " - << protoLayer.envZ.second); - ACTS_VERBOSE(" - with R min/max = " - << protoLayer.minR << " (-" << protoLayer.envR.first << ") / " - << protoLayer.maxR << " (+" << protoLayer.envR.second << ")"); - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.minPhi << " / " - << protoLayer.maxPhi); - ACTS_VERBOSE(" - # of modules = " << surfaces.size() << " ordered in ( " - << binsR << " x " << binsPhi << ")"); + ACTS_VERBOSE( + " - incl envelope = " << protoLayer.envZ.first << " / " + << protoLayer.envZ.second); + ACTS_VERBOSE( + " - with R min/max = " + << protoLayer.minR << " (-" << protoLayer.envR.first << ") / " + << protoLayer.maxR << " (+" << protoLayer.envR.second << ")"); + ACTS_VERBOSE( + " - with phi min/max = " << protoLayer.minPhi << " / " + << protoLayer.maxPhi); + ACTS_VERBOSE( + " - # of modules = " << surfaces.size() << " ordered in ( " << binsR + << " x " << binsPhi << ")"); // create the layer transforms if not given if (!transform) { @@ -244,9 +277,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( // create the layers // we use the same transform here as for the layer itself // for disk this is fine since we don't bin in Z, so does not matter - MutableLayerPtr dLayer = - DiscLayer::create(transform, dBounds, std::move(sArray), layerThickness, - std::move(ad), active); + MutableLayerPtr dLayer = DiscLayer::create( + transform, + dBounds, + std::move(sArray), + layerThickness, + std::move(ad), + active); if (!dLayer) ACTS_ERROR("Creation of disc layer did not succeed!"); @@ -255,10 +292,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( return dLayer; } -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, + std::vector<std::shared_ptr<const Surface>> surfaces, + BinningType bTypeR, + BinningType bTypePhi, + boost::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -272,16 +312,19 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( // adjust the layer radius ACTS_VERBOSE("Creating a disk Layer:"); ACTS_VERBOSE(" - at Z position = " << layerZ); - ACTS_VERBOSE(" - from Z min/max = " << protoLayer.minZ << " / " - << protoLayer.maxZ); + ACTS_VERBOSE( + " - from Z min/max = " << protoLayer.minZ << " / " << protoLayer.maxZ); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); - ACTS_VERBOSE(" - incl envelope = " << protoLayer.envZ.first << " / " - << protoLayer.envZ.second); - ACTS_VERBOSE(" - with R min/max = " - << protoLayer.minR << " (-" << protoLayer.envR.first << ") / " - << protoLayer.maxR << " (+" << protoLayer.envR.second << ")"); - ACTS_VERBOSE(" - with phi min/max = " << protoLayer.minPhi << " / " - << protoLayer.maxPhi); + ACTS_VERBOSE( + " - incl envelope = " << protoLayer.envZ.first << " / " + << protoLayer.envZ.second); + ACTS_VERBOSE( + " - with R min/max = " + << protoLayer.minR << " (-" << protoLayer.envR.first << ") / " + << protoLayer.maxR << " (+" << protoLayer.envR.second << ")"); + ACTS_VERBOSE( + " - with phi min/max = " << protoLayer.minPhi << " / " + << protoLayer.maxPhi); ACTS_VERBOSE(" - # of modules = " << surfaces.size()); // create the layer transforms if not given @@ -305,9 +348,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( protoLayer.maxR + protoLayer.envR.second); // create the layers - MutableLayerPtr dLayer = - DiscLayer::create(transform, dBounds, std::move(sArray), layerThickness, - std::move(ad), active); + MutableLayerPtr dLayer = DiscLayer::create( + transform, + dBounds, + std::move(sArray), + layerThickness, + std::move(ad), + active); if (!dLayer) ACTS_ERROR("Creation of disc layer did not succeed!"); associateSurfacesToLayer(*dLayer); @@ -315,10 +362,14 @@ Acts::MutableLayerPtr Acts::LayerCreator::discLayer( return dLayer; } -Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( +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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t bins1, + size_t bins2, + BinningValue bValue, + boost::optional<ProtoLayer> _protoLayer, std::shared_ptr<const Transform3D> transform, std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer = @@ -351,12 +402,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( double centerZ = 0.5 * (protoLayer.maxZ + protoLayer.minZ); ACTS_VERBOSE("Creating a plane Layer:"); - ACTS_VERBOSE(" - with layer center = " - << "(" << centerX << ", " << centerY << ", " << centerZ << ")"); - ACTS_VERBOSE(" - from X min/max = " << protoLayer.minX << " / " - << protoLayer.maxX); - ACTS_VERBOSE(" - from Y min/max = " << protoLayer.minY << " / " - << protoLayer.maxY); + ACTS_VERBOSE( + " - with layer center = " + << "(" << centerX << ", " << centerY << ", " << centerZ << ")"); + ACTS_VERBOSE( + " - from X min/max = " << protoLayer.minX << " / " << protoLayer.maxX); + ACTS_VERBOSE( + " - from Y min/max = " << protoLayer.minY << " / " << protoLayer.maxY); ACTS_VERBOSE(" - with Z thickness = " << layerThickness); // create the layer transforms if not given @@ -366,9 +418,9 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( // double shift = (layerZ + envZShift); transform = std::make_shared<const Transform3D>( Translation3D(centerX, centerY, centerZ)); - ACTS_VERBOSE(" - layer shift = " - << "(" << centerX << ", " << centerY << ", " << centerZ - << ")"); + ACTS_VERBOSE( + " - layer shift = " + << "(" << centerX << ", " << centerY << ", " << centerZ << ")"); } std::unique_ptr<SurfaceArray> sArray; @@ -384,9 +436,13 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( new RectangleBounds(layerHalf1, layerHalf2)); // create the layer - MutableLayerPtr pLayer = - PlaneLayer::create(transform, pBounds, std::move(sArray), layerThickness, - std::move(ad), active); + MutableLayerPtr pLayer = PlaneLayer::create( + transform, + pBounds, + std::move(sArray), + layerThickness, + std::move(ad), + active); if (!pLayer) ACTS_ERROR("Creation of plane layer did not succeed!"); @@ -396,7 +452,8 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( return pLayer; } -void Acts::LayerCreator::associateSurfacesToLayer(Layer& layer) const { +void +Acts::LayerCreator::associateSurfacesToLayer(Layer& layer) const { if (layer.surfaceArray() != nullptr) { auto surfaces = layer.surfaceArray()->surfaces(); @@ -407,8 +464,10 @@ void Acts::LayerCreator::associateSurfacesToLayer(Layer& layer) const { } } -bool Acts::LayerCreator::checkBinning(const GeometryContext& gctx, - const SurfaceArray& sArray) const { +bool +Acts::LayerCreator::checkBinning( + const GeometryContext& gctx, + const SurfaceArray& sArray) const { // do consistency check: can we access all sensitive surfaces // through the binning? If not, surfaces get lost and the binning does not // work @@ -439,9 +498,12 @@ bool Acts::LayerCreator::checkBinning(const GeometryContext& gctx, } std::vector<const Acts::Surface*> diff; - std::set_difference(sensitiveSurfaces.begin(), sensitiveSurfaces.end(), - accessibleSurfaces.begin(), accessibleSurfaces.end(), - std::inserter(diff, diff.begin())); + std::set_difference( + sensitiveSurfaces.begin(), + sensitiveSurfaces.end(), + accessibleSurfaces.begin(), + accessibleSurfaces.end(), + std::inserter(diff, diff.begin())); ACTS_VERBOSE(" - Checked " << nBinsChecked << " valid bins"); @@ -463,9 +525,9 @@ bool Acts::LayerCreator::checkBinning(const GeometryContext& gctx, for (const auto& srf : diff) { // have to choose BinningValue here Vector3D ctr = srf->binningPosition(gctx, binR); - ACTS_ERROR(" Surface(x=" << ctr.x() << ", y=" << ctr.y() - << ", z=" << ctr.z() << ", r=" << perp(ctr) - << ", phi=" << phi(ctr) << ")"); + ACTS_ERROR( + " Surface(x=" << ctr.x() << ", y=" << ctr.y() << ", z=" << ctr.z() + << ", r=" << perp(ctr) << ", phi=" << phi(ctr) << ")"); } } else { diff --git a/Core/src/Geometry/NavigationLayer.cpp b/Core/src/Geometry/NavigationLayer.cpp index c7f6682da..3b2cc1c24 100644 --- a/Core/src/Geometry/NavigationLayer.cpp +++ b/Core/src/Geometry/NavigationLayer.cpp @@ -14,7 +14,8 @@ #include "Acts/Surfaces/Surface.hpp" Acts::NavigationLayer::NavigationLayer( - std::shared_ptr<const Surface> surfaceRepresentation, double thickness) + std::shared_ptr<const Surface> surfaceRepresentation, + double thickness) : Acts::Layer(nullptr), m_surfaceRepresentation(std::move(surfaceRepresentation)) { m_layerThickness = thickness; diff --git a/Core/src/Geometry/PassiveLayerBuilder.cpp b/Core/src/Geometry/PassiveLayerBuilder.cpp index 27458cc83..9828771ad 100644 --- a/Core/src/Geometry/PassiveLayerBuilder.cpp +++ b/Core/src/Geometry/PassiveLayerBuilder.cpp @@ -26,54 +26,60 @@ Acts::PassiveLayerBuilder::PassiveLayerBuilder( setConfiguration(plConfig); } -void Acts::PassiveLayerBuilder::setConfiguration( +void +Acts::PassiveLayerBuilder::setConfiguration( const PassiveLayerBuilder::Config& plConfig) { //!< @todo add configuration check m_cfg = plConfig; } -void Acts::PassiveLayerBuilder::setLogger( - std::unique_ptr<const Logger> newLogger) { +void +Acts::PassiveLayerBuilder::setLogger(std::unique_ptr<const Logger> newLogger) { m_logger = std::move(newLogger); } -const Acts::LayerVector Acts::PassiveLayerBuilder::positiveLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::PassiveLayerBuilder::positiveLayers(const GeometryContext& gctx) const { return endcapLayers(gctx, 1); } -const Acts::LayerVector Acts::PassiveLayerBuilder::negativeLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::PassiveLayerBuilder::negativeLayers(const GeometryContext& gctx) const { return endcapLayers(gctx, -1); } -const Acts::LayerVector Acts::PassiveLayerBuilder::endcapLayers( - const Acts::GeometryContext& /*gctx*/, int side) const { +const Acts::LayerVector +Acts::PassiveLayerBuilder::endcapLayers( + const Acts::GeometryContext& /*gctx*/, + int side) const { LayerVector eLayers; // pos/neg layers size_t numpnLayers = m_cfg.posnegLayerPositionZ.size(); if (numpnLayers != 0u) { - ACTS_DEBUG("Configured to build " << numpnLayers - << " passive layers on side :" << side); + ACTS_DEBUG( + "Configured to build " << numpnLayers + << " passive layers on side :" << side); eLayers.reserve(numpnLayers); // loop through for (size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) { // some screen output - ACTS_VERBOSE("- build layers " - << (ipnl) - << " at = " << side * m_cfg.posnegLayerPositionZ.at(ipnl) - << " and rMin/rMax = " << m_cfg.posnegLayerRmin.at(ipnl) - << " / " << m_cfg.posnegLayerRmax.at(ipnl)); + ACTS_VERBOSE( + "- build layers " + << (ipnl) << " at = " << side * m_cfg.posnegLayerPositionZ.at(ipnl) + << " and rMin/rMax = " << m_cfg.posnegLayerRmin.at(ipnl) << " / " + << m_cfg.posnegLayerRmax.at(ipnl)); // create the share disc bounds std::shared_ptr<const DiscBounds> dBounds = - std::make_shared<const RadialBounds>(m_cfg.posnegLayerRmin.at(ipnl), - m_cfg.posnegLayerRmax.at(ipnl)); + std::make_shared<const RadialBounds>( + m_cfg.posnegLayerRmin.at(ipnl), m_cfg.posnegLayerRmax.at(ipnl)); // create the layer transforms const Transform3D* eTransform = new Transform3D( Translation3D(0., 0., side * m_cfg.posnegLayerPositionZ.at(ipnl))); // create the layers MutableLayerPtr eLayer = DiscLayer::create( - std::shared_ptr<const Transform3D>(eTransform), dBounds, nullptr, + std::shared_ptr<const Transform3D>(eTransform), + dBounds, + nullptr, m_cfg.posnegLayerThickness.at(ipnl)); // assign the material to the layer surface @@ -92,22 +98,23 @@ const Acts::LayerVector Acts::PassiveLayerBuilder::endcapLayers( return eLayers; } -const Acts::LayerVector Acts::PassiveLayerBuilder::centralLayers( +const Acts::LayerVector +Acts::PassiveLayerBuilder::centralLayers( const Acts::GeometryContext& /*gctx*/) const { LayerVector cLayers; // the central layers size_t numcLayers = m_cfg.centralLayerRadii.size(); if (numcLayers != 0u) { - ACTS_DEBUG("Configured to build " << numcLayers - << " passive central layers."); + ACTS_DEBUG( + "Configured to build " << numcLayers << " passive central layers."); cLayers.reserve(numcLayers); // loop through for (size_t icl = 0; icl < numcLayers; ++icl) { // some screen output - ACTS_VERBOSE("- build layer " - << icl - << " with radius = " << m_cfg.centralLayerRadii.at(icl) - << " and halfZ = " << m_cfg.centralLayerHalflengthZ.at(icl)); + ACTS_VERBOSE( + "- build layer " << icl << " with radius = " + << m_cfg.centralLayerRadii.at(icl) << " and halfZ = " + << m_cfg.centralLayerHalflengthZ.at(icl)); // create the layer and push it back auto cBounds = std::make_shared<const CylinderBounds>( m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl)); diff --git a/Core/src/Geometry/PlaneLayer.cpp b/Core/src/Geometry/PlaneLayer.cpp index 2ee8fae51..faac6ea67 100644 --- a/Core/src/Geometry/PlaneLayer.cpp +++ b/Core/src/Geometry/PlaneLayer.cpp @@ -19,12 +19,13 @@ #include "Acts/Utilities/Definitions.hpp" #include "Acts/Utilities/Helpers.hpp" -Acts::PlaneLayer::PlaneLayer(std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const PlanarBounds>& pbounds, - std::unique_ptr<SurfaceArray> surfaceArray, - double thickness, - std::unique_ptr<ApproachDescriptor> ades, - LayerType laytyp) +Acts::PlaneLayer::PlaneLayer( + std::shared_ptr<const Transform3D> transform, + std::shared_ptr<const PlanarBounds>& pbounds, + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness, + std::unique_ptr<ApproachDescriptor> ades, + LayerType laytyp) : PlaneSurface(std::move(transform), pbounds), Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) { // @todo create representing volume @@ -40,15 +41,18 @@ Acts::PlaneLayer::PlaneLayer(std::shared_ptr<const Transform3D> transform, } } -const Acts::PlaneSurface& Acts::PlaneLayer::surfaceRepresentation() const { +const Acts::PlaneSurface& +Acts::PlaneLayer::surfaceRepresentation() const { return (*this); } -Acts::PlaneSurface& Acts::PlaneLayer::surfaceRepresentation() { +Acts::PlaneSurface& +Acts::PlaneLayer::surfaceRepresentation() { return (*this); } -void Acts::PlaneLayer::buildApproachDescriptor() { +void +Acts::PlaneLayer::buildApproachDescriptor() { // delete it m_approachDescriptor.reset(nullptr); // delete the surfaces diff --git a/Core/src/Geometry/ProtoLayer.cpp b/Core/src/Geometry/ProtoLayer.cpp index 4492a966a..cbdcd7fb4 100644 --- a/Core/src/Geometry/ProtoLayer.cpp +++ b/Core/src/Geometry/ProtoLayer.cpp @@ -20,8 +20,9 @@ using Acts::VectorHelpers::phi; namespace Acts { -ProtoLayer::ProtoLayer(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces) { +ProtoLayer::ProtoLayer( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces) { measure(gctx, surfaces); } @@ -31,8 +32,8 @@ ProtoLayer::ProtoLayer( measure(gctx, unpack_shared_vector(surfaces)); } -double ProtoLayer::radialDistance(const Vector3D& pos1, - const Vector3D& pos2) const { +double +ProtoLayer::radialDistance(const Vector3D& pos1, const Vector3D& pos2) const { Vector2D p1(pos1.x(), pos1.y()); Vector2D p2(pos2.x(), pos2.y()); @@ -56,7 +57,8 @@ double ProtoLayer::radialDistance(const Vector3D& pos1, return dist; } -std::ostream& ProtoLayer::toStream(std::ostream& sl) const { +std::ostream& +ProtoLayer::toStream(std::ostream& sl) const { sl << "ProtoLayer with dimensions (min/max)" << std::endl; sl << " - r : " << minR << " - " << envR.first << " / " << maxR << " + " << envR.second << std::endl; @@ -68,8 +70,10 @@ std::ostream& ProtoLayer::toStream(std::ostream& sl) const { return sl; } -void ProtoLayer::measure(const GeometryContext& gctx, - const std::vector<const Surface*>& surfaces) { +void +ProtoLayer::measure( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces) { minR = std::numeric_limits<double>::max(); maxR = std::numeric_limits<double>::lowest(); minX = std::numeric_limits<double>::max(); @@ -111,10 +115,12 @@ void ProtoLayer::measure(const GeometryContext& gctx, // thickness double locz = side != 0 ? 0.5 * thickness : -0.5 * thickness; // p1 & p2 vectors - Vector3D p2(sTransform * - Vector3D(vertices.at(iv).x(), vertices.at(iv).y(), locz)); - Vector3D p1(sTransform * Vector3D(vertices.at(ivp).x(), - vertices.at(ivp).y(), locz)); + Vector3D p2( + sTransform * + Vector3D(vertices.at(iv).x(), vertices.at(iv).y(), locz)); + Vector3D p1( + sTransform * + Vector3D(vertices.at(ivp).x(), vertices.at(ivp).y(), locz)); maxX = std::max(maxX, p2.x()); minX = std::min(minX, p2.x()); diff --git a/Core/src/Geometry/SurfaceArrayCreator.cpp b/Core/src/Geometry/SurfaceArrayCreator.cpp index 471ca727c..14d1ce984 100644 --- a/Core/src/Geometry/SurfaceArrayCreator.cpp +++ b/Core/src/Geometry/SurfaceArrayCreator.cpp @@ -30,8 +30,10 @@ using Acts::VectorHelpers::phi; 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsPhi, + size_t binsZ, + boost::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 @@ -40,16 +42,17 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ACTS_VERBOSE("Creating a SurfaceArray on a cylinder"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") - ACTS_VERBOSE(" -- with phi x z = " << binsPhi << " x " << binsZ << " = " - << binsPhi * binsZ << " bins."); + ACTS_VERBOSE( + " -- with phi x z = " << binsPhi << " x " << binsZ << " = " + << binsPhi * binsZ << " bins."); Transform3D transform = transformOpt != nullptr ? *transformOpt : Transform3D::Identity(); - ProtoAxis pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, - protoLayer, transform, binsPhi); - ProtoAxis pAxisZ = createEquidistantAxis(gctx, surfacesRaw, binZ, protoLayer, - transform, binsZ); + ProtoAxis pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform, binsPhi); + ProtoAxis pAxisZ = createEquidistantAxis( + gctx, surfacesRaw, binZ, protoLayer, transform, binsZ); double R = protoLayer.maxR - protoLayer.minR; @@ -65,23 +68,27 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( }; std::unique_ptr<SurfaceArray::ISurfaceGridLookup> sl = - makeSurfaceGridLookup2D<detail::AxisBoundaryType::Closed, - detail::AxisBoundaryType::Bound>( + makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Closed, + detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxisPhi, pAxisZ); sl->fill(gctx, surfacesRaw); completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( - std::move(sl), std::move(surfaces), + std::move(sl), + std::move(surfaces), std::make_shared<const Transform3D>(transform)); } 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + BinningType bTypePhi, + BinningType bTypeZ, + boost::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 @@ -96,8 +103,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ProtoAxis pAxisZ; if (bTypePhi == equidistant) { - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, protoLayer, - transform, 0); + pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform, 0); } else { pAxisPhi = createVariableAxis(gctx, surfacesRaw, binPhi, protoLayer, transform); @@ -121,8 +128,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( }; std::unique_ptr<SurfaceArray::ISurfaceGridLookup> sl = - makeSurfaceGridLookup2D<detail::AxisBoundaryType::Closed, - detail::AxisBoundaryType::Bound>( + makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Closed, + detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxisPhi, pAxisZ); sl->fill(gctx, surfacesRaw); @@ -135,19 +143,23 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ACTS_VERBOSE("Creating a SurfaceArray on a cylinder"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") - ACTS_VERBOSE(" -- with phi x z = " << bins0 << " x " << bins1 << " = " - << bins0 * bins1 << " bins."); + ACTS_VERBOSE( + " -- with phi x z = " << bins0 << " x " << bins1 << " = " + << bins0 * bins1 << " bins."); return std::make_unique<SurfaceArray>( - std::move(sl), std::move(surfaces), + std::move(sl), + std::move(surfaces), std::make_shared<const Transform3D>(transform)); } 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t binsR, + size_t binsPhi, + boost::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 @@ -159,10 +171,10 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( Transform3D transform = transformOpt != nullptr ? *transformOpt : Transform3D::Identity(); - ProtoAxis pAxisR = createEquidistantAxis(gctx, surfacesRaw, binR, protoLayer, - transform, binsR); - ProtoAxis pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, - protoLayer, transform, binsPhi); + ProtoAxis pAxisR = createEquidistantAxis( + gctx, surfacesRaw, binR, protoLayer, transform, binsR); + ProtoAxis pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform, binsPhi); double Z = 0.5 * (protoLayer.minZ + protoLayer.maxZ); ACTS_VERBOSE("- z-position of disk estimated as " << Z); @@ -179,8 +191,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( }; std::unique_ptr<SurfaceArray::ISurfaceGridLookup> sl = - makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, - detail::AxisBoundaryType::Closed>( + makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Bound, + detail::AxisBoundaryType::Closed>( globalToLocal, localToGlobal, pAxisR, pAxisPhi); // get the number of bins @@ -189,21 +202,25 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( size_t bins1 = axes.at(1)->getNBins(); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") - ACTS_VERBOSE(" -- with r x phi = " << bins0 << " x " << bins1 << " = " - << bins0 * bins1 << " bins."); + ACTS_VERBOSE( + " -- with r x phi = " << bins0 << " x " << bins1 << " = " + << bins0 * bins1 << " bins."); sl->fill(gctx, surfacesRaw); completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( - std::move(sl), std::move(surfaces), + std::move(sl), + std::move(surfaces), std::make_shared<const Transform3D>(transform)); } 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + BinningType bTypeR, + BinningType bTypePhi, + boost::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 @@ -244,7 +261,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( }; std::transform( - phiModules.begin(), phiModules.end(), std::back_inserter(nPhiModules), + phiModules.begin(), + phiModules.end(), + std::back_inserter(nPhiModules), [&equal, this](std::vector<const Surface*> surfaces_) -> size_t { return this->findKeySurfaces(surfaces_, equal).size(); }); @@ -257,14 +276,14 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( // @TODO: check in extrapolation size_t nBinsPhi = (*std::min_element(nPhiModules.begin(), nPhiModules.end())); - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, protoLayer, - transform, nBinsPhi); + pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform, nBinsPhi); } else { // use regular determination if (bTypePhi == equidistant) { - pAxisPhi = createEquidistantAxis(gctx, surfacesRaw, binPhi, protoLayer, - transform, 0); + pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform, 0); } else { pAxisPhi = createVariableAxis(gctx, surfacesRaw, binPhi, protoLayer, transform); @@ -286,8 +305,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( }; std::unique_ptr<SurfaceArray::ISurfaceGridLookup> sl = - makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, - detail::AxisBoundaryType::Closed>( + makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Bound, + detail::AxisBoundaryType::Closed>( globalToLocal, localToGlobal, pAxisR, pAxisPhi); // get the number of bins @@ -296,14 +316,16 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( size_t bins1 = axes.at(1)->getNBins(); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") - ACTS_VERBOSE(" -- with r x phi = " << bins0 << " x " << bins1 << " = " - << bins0 * bins1 << " bins."); + ACTS_VERBOSE( + " -- with r x phi = " << bins0 << " x " << bins1 << " = " + << bins0 * bins1 << " bins."); sl->fill(gctx, surfacesRaw); completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( - std::move(sl), std::move(surfaces), + std::move(sl), + std::move(surfaces), std::make_shared<const Transform3D>(transform)); } @@ -311,8 +333,10 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( 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, + std::vector<std::shared_ptr<const Surface>> surfaces, + size_t bins1, + size_t bins2, + BinningValue bValue, boost::optional<ProtoLayer> protoLayerOpt, const std::shared_ptr<const Transform3D>& transformOpt) const { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); @@ -322,8 +346,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( ACTS_VERBOSE("Creating a SurfaceArray on a plance"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") - ACTS_VERBOSE(" -- with " << bins1 << " x " << bins2 << " = " << bins1 * bins2 - << " bins."); + ACTS_VERBOSE( + " -- with " << bins1 << " x " << bins2 << " = " << bins1 * bins2 + << " bins."); // Transformation Transform3D transform = @@ -344,32 +369,35 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( // Axis along the binning switch (bValue) { case BinningValue::binX: { - ProtoAxis pAxis1 = createEquidistantAxis(gctx, surfacesRaw, binY, - protoLayer, transform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis(gctx, surfacesRaw, binZ, - protoLayer, transform, bins2); - sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, - detail::AxisBoundaryType::Bound>( + ProtoAxis pAxis1 = createEquidistantAxis( + gctx, surfacesRaw, binY, protoLayer, transform, bins1); + ProtoAxis pAxis2 = createEquidistantAxis( + gctx, surfacesRaw, binZ, protoLayer, transform, bins2); + sl = makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Bound, + detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } case BinningValue::binY: { - ProtoAxis pAxis1 = createEquidistantAxis(gctx, surfacesRaw, binX, - protoLayer, transform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis(gctx, surfacesRaw, binZ, - protoLayer, transform, bins2); - sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, - detail::AxisBoundaryType::Bound>( + ProtoAxis pAxis1 = createEquidistantAxis( + gctx, surfacesRaw, binX, protoLayer, transform, bins1); + ProtoAxis pAxis2 = createEquidistantAxis( + gctx, surfacesRaw, binZ, protoLayer, transform, bins2); + sl = makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Bound, + detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } case BinningValue::binZ: { - ProtoAxis pAxis1 = createEquidistantAxis(gctx, surfacesRaw, binX, - protoLayer, transform, bins1); - ProtoAxis pAxis2 = createEquidistantAxis(gctx, surfacesRaw, binY, - protoLayer, transform, bins2); - sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, - detail::AxisBoundaryType::Bound>( + ProtoAxis pAxis1 = createEquidistantAxis( + gctx, surfacesRaw, binX, protoLayer, transform, bins1); + ProtoAxis pAxis2 = createEquidistantAxis( + gctx, surfacesRaw, binY, protoLayer, transform, bins2); + sl = makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Bound, + detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxis1, pAxis2); break; } @@ -385,12 +413,14 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( - std::move(sl), std::move(surfaces), + std::move(sl), + std::move(surfaces), std::make_shared<const Transform3D>(transform)); //!< @todo implement - take from ATLAS complex TRT builder } -std::vector<const Acts::Surface*> Acts::SurfaceArrayCreator::findKeySurfaces( +std::vector<const Acts::Surface*> +Acts::SurfaceArrayCreator::findKeySurfaces( const std::vector<const Surface*>& surfaces, const std::function<bool(const Surface*, const Surface*)>& equal) const { std::vector<const Surface*> keys; @@ -410,8 +440,10 @@ std::vector<const Acts::Surface*> Acts::SurfaceArrayCreator::findKeySurfaces( return keys; } -size_t Acts::SurfaceArrayCreator::determineBinCount( - const GeometryContext& gctx, const std::vector<const Surface*>& surfaces, +size_t +Acts::SurfaceArrayCreator::determineBinCount( + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, BinningValue bValue) const { auto matcher = m_cfg.surfaceMatcher; auto equal = [&gctx, &bValue, &matcher](const Surface* a, const Surface* b) { @@ -424,8 +456,11 @@ size_t Acts::SurfaceArrayCreator::determineBinCount( Acts::SurfaceArrayCreator::ProtoAxis Acts::SurfaceArrayCreator::createVariableAxis( - const GeometryContext& gctx, const std::vector<const Surface*>& surfaces, - BinningValue bValue, ProtoLayer protoLayer, Transform3D& transform) const { + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, + BinningValue bValue, + ProtoLayer protoLayer, + Transform3D& transform) const { if (surfaces.empty()) { throw std::logic_error( "No surfaces handed over for creating arbitrary bin utility!"); @@ -443,11 +478,14 @@ Acts::SurfaceArrayCreator::createVariableAxis( std::vector<double> bValues; if (bValue == Acts::binPhi) { - std::stable_sort(keys.begin(), keys.end(), - [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (phi(a->binningPosition(gctx, binPhi)) < - phi(b->binningPosition(gctx, binPhi))); - }); + std::stable_sort( + keys.begin(), + keys.end(), + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return ( + phi(a->binningPosition(gctx, binPhi)) < + phi(b->binningPosition(gctx, binPhi))); + }); double maxPhi = 0.5 * (phi(keys.at(0)->binningPosition(gctx, binPhi)) + phi(keys.at(1)->binningPosition(gctx, binPhi))); @@ -484,22 +522,26 @@ Acts::SurfaceArrayCreator::createVariableAxis( // get the global vertices std::vector<Acts::Vector3D> backVertices = makeGlobalVertices(gctx, *backSurface, backBounds->vertices()); - double maxBValue = phi( - *std::max_element(backVertices.begin(), backVertices.end(), - [](const Acts::Vector3D& a, const Acts::Vector3D& b) { - return phi(a) < phi(b); - })); + double maxBValue = phi(*std::max_element( + backVertices.begin(), + backVertices.end(), + [](const Acts::Vector3D& a, const Acts::Vector3D& b) { + return phi(a) < phi(b); + })); bValues.push_back(maxBValue); bValues.push_back(M_PI); } else if (bValue == Acts::binZ) { - std::stable_sort(keys.begin(), keys.end(), - [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (a->binningPosition(gctx, binZ).z() < - b->binningPosition(gctx, binZ).z()); - }); + std::stable_sort( + keys.begin(), + keys.end(), + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return ( + a->binningPosition(gctx, binZ).z() < + b->binningPosition(gctx, binZ).z()); + }); bValues.push_back(protoLayer.minZ); bValues.push_back(protoLayer.maxZ); @@ -516,11 +558,14 @@ Acts::SurfaceArrayCreator::createVariableAxis( previous = (*surface)->binningPosition(gctx, binZ).z(); } } else { // binR - std::stable_sort(keys.begin(), keys.end(), - [&gctx](const Acts::Surface* a, const Acts::Surface* b) { - return (perp(a->binningPosition(gctx, binR)) < - perp(b->binningPosition(gctx, binR))); - }); + std::stable_sort( + keys.begin(), + keys.end(), + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return ( + perp(a->binningPosition(gctx, binR)) < + perp(b->binningPosition(gctx, binR))); + }); bValues.push_back(protoLayer.minR); bValues.push_back(protoLayer.maxR); @@ -545,8 +590,8 @@ Acts::SurfaceArrayCreator::createVariableAxis( " (binX = 0, binY = 1, binZ = 2, binR = 3, binPhi = 4, " "binRPhi = 5, binH = 6, binEta = 7)"); ACTS_VERBOSE(" Number of bins: " << (bValues.size() - 1)); - ACTS_VERBOSE(" (Min/Max) = (" << bValues.front() << "/" - << bValues.back() << ")"); + ACTS_VERBOSE( + " (Min/Max) = (" << bValues.front() << "/" << bValues.back() << ")"); ProtoAxis pAxis; pAxis.bType = arbitrary; @@ -559,8 +604,11 @@ Acts::SurfaceArrayCreator::createVariableAxis( Acts::SurfaceArrayCreator::ProtoAxis Acts::SurfaceArrayCreator::createEquidistantAxis( - const GeometryContext& gctx, const std::vector<const Surface*>& surfaces, - BinningValue bValue, ProtoLayer protoLayer, Transform3D& transform, + const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, + BinningValue bValue, + ProtoLayer protoLayer, + Transform3D& transform, size_t nBins) const { if (surfaces.empty()) { throw std::logic_error( @@ -598,15 +646,16 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( // set the binning option for phi // sort first in phi const Acts::Surface* maxElem = *std::max_element( - surfaces.begin(), surfaces.end(), + surfaces.begin(), + surfaces.end(), [&gctx](const Acts::Surface* a, const Acts::Surface* b) { return phi(a->binningPosition(gctx, binR)) < phi(b->binningPosition(gctx, binR)); }); // get the key surfaces at the different phi positions - auto equal = [&gctx, &bValue, &matcher](const Surface* a, - const Surface* b) { + auto equal = [&gctx, &bValue, &matcher]( + const Surface* a, const Surface* b) { return matcher(gctx, bValue, a, b); }; keys = findKeySurfaces(surfaces, equal); @@ -703,8 +752,10 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( return pAxis; } -std::vector<Acts::Vector3D> Acts::SurfaceArrayCreator::makeGlobalVertices( - const GeometryContext& gctx, const Acts::Surface& surface, +std::vector<Acts::Vector3D> +Acts::SurfaceArrayCreator::makeGlobalVertices( + const GeometryContext& gctx, + const Acts::Surface& surface, const std::vector<Acts::Vector2D>& locVertices) const { std::vector<Acts::Vector3D> globVertices; for (auto& vertex : locVertices) { diff --git a/Core/src/Geometry/TrackingGeometry.cpp b/Core/src/Geometry/TrackingGeometry.cpp index 16e419d92..ba022daa4 100644 --- a/Core/src/Geometry/TrackingGeometry.cpp +++ b/Core/src/Geometry/TrackingGeometry.cpp @@ -30,8 +30,10 @@ Acts::TrackingGeometry::TrackingGeometry( Acts::TrackingGeometry::~TrackingGeometry() = default; -const Acts::TrackingVolume* Acts::TrackingGeometry::lowestTrackingVolume( - const GeometryContext& gctx, const Acts::Vector3D& gp) const { +const Acts::TrackingVolume* +Acts::TrackingGeometry::lowestTrackingVolume( + const GeometryContext& gctx, + const Acts::Vector3D& gp) const { const TrackingVolume* searchVolume = m_world.get(); const TrackingVolume* currentVolume = nullptr; while (currentVolume != searchVolume && (searchVolume != nullptr)) { @@ -41,19 +43,19 @@ const Acts::TrackingVolume* Acts::TrackingGeometry::lowestTrackingVolume( return currentVolume; } -const Acts::TrackingVolume* Acts::TrackingGeometry::highestTrackingVolume() - const { +const Acts::TrackingVolume* +Acts::TrackingGeometry::highestTrackingVolume() const { return (m_world.get()); } -void Acts::TrackingGeometry::sign(GeometrySignature geosit, - GeometryType geotype) { +void +Acts::TrackingGeometry::sign(GeometrySignature geosit, GeometryType geotype) { auto mutableWorld = std::const_pointer_cast<TrackingVolume>(m_world); mutableWorld->sign(geosit, geotype); } -const Acts::TrackingVolume* Acts::TrackingGeometry::trackingVolume( - const std::string& name) const { +const Acts::TrackingVolume* +Acts::TrackingGeometry::trackingVolume(const std::string& name) const { auto sVol = m_trackingVolumes.begin(); sVol = m_trackingVolumes.find(name); if (sVol != m_trackingVolumes.end()) { @@ -62,22 +64,27 @@ const Acts::TrackingVolume* Acts::TrackingGeometry::trackingVolume( return nullptr; } -const Acts::Layer* Acts::TrackingGeometry::associatedLayer( - const GeometryContext& gctx, const Acts::Vector3D& gp) const { +const Acts::Layer* +Acts::TrackingGeometry::associatedLayer( + const GeometryContext& gctx, + const Acts::Vector3D& gp) const { const TrackingVolume* lowestVol = (lowestTrackingVolume(gctx, gp)); return lowestVol->associatedLayer(gctx, gp); } -void Acts::TrackingGeometry::registerBeamTube( +void +Acts::TrackingGeometry::registerBeamTube( std::shared_ptr<const PerigeeSurface> beam) { m_beam = std::move(beam); } -const Acts::Surface* Acts::TrackingGeometry::getBeamline() const { +const Acts::Surface* +Acts::TrackingGeometry::getBeamline() const { return m_beam.get(); } -void Acts::TrackingGeometry::visitSurfaces( +void +Acts::TrackingGeometry::visitSurfaces( const std::function<void(const Acts::Surface*)>& visitor) const { highestTrackingVolume()->visitSurfaces(visitor); } diff --git a/Core/src/Geometry/TrackingGeometryBuilder.cpp b/Core/src/Geometry/TrackingGeometryBuilder.cpp index a3af9dcb9..b3ad00fa2 100644 --- a/Core/src/Geometry/TrackingGeometryBuilder.cpp +++ b/Core/src/Geometry/TrackingGeometryBuilder.cpp @@ -26,14 +26,16 @@ Acts::TrackingGeometryBuilder::TrackingGeometryBuilder( setConfiguration(cgbConfig); } -void Acts::TrackingGeometryBuilder::setConfiguration( +void +Acts::TrackingGeometryBuilder::setConfiguration( const Acts::TrackingGeometryBuilder::Config& cgbConfig) { // @todo check consistency // copy the configuration m_cfg = cgbConfig; } -void Acts::TrackingGeometryBuilder::setLogger( +void +Acts::TrackingGeometryBuilder::setLogger( std::unique_ptr<const Logger> newLogger) { m_logger = std::move(newLogger); } diff --git a/Core/src/Geometry/TrackingVolume.cpp b/Core/src/Geometry/TrackingVolume.cpp index 30bcacce8..530c4e4dc 100644 --- a/Core/src/Geometry/TrackingVolume.cpp +++ b/Core/src/Geometry/TrackingVolume.cpp @@ -29,7 +29,8 @@ Acts::TrackingVolume::TrackingVolume() m_name("undefined") {} Acts::TrackingVolume::TrackingVolume( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volbounds, + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volbounds, const std::shared_ptr<const TrackingVolumeArray>& containedVolumeArray, const std::string& volumeName) : Volume(std::move(htrans), std::move(volbounds)), @@ -44,7 +45,8 @@ Acts::TrackingVolume::TrackingVolume( // constructor for arguments Acts::TrackingVolume::TrackingVolume( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volumeBounds, + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volumeBounds, std::shared_ptr<const IVolumeMaterial> volumeMaterial, std::unique_ptr<const LayerArray> staticLayerArray, std::shared_ptr<const TrackingVolumeArray> containedVolumeArray, @@ -60,7 +62,8 @@ Acts::TrackingVolume::TrackingVolume( // constructor for arguments Acts::TrackingVolume::TrackingVolume( - std::shared_ptr<const Transform3D> htrans, VolumeBoundsPtr volbounds, + std::shared_ptr<const Transform3D> htrans, + VolumeBoundsPtr volbounds, std::vector<std::unique_ptr<Volume::BoundingBox>> boxStore, std::vector<std::unique_ptr<const Volume>> descendants, const Volume::BoundingBox* top, @@ -84,8 +87,10 @@ Acts::TrackingVolume::~TrackingVolume() { delete m_glueVolumeDescriptor; } -const Acts::TrackingVolume* Acts::TrackingVolume::lowestTrackingVolume( - const GeometryContext& /*gctx*/, const Vector3D& gp) const { +const Acts::TrackingVolume* +Acts::TrackingVolume::lowestTrackingVolume( + const GeometryContext& /*gctx*/, + const Vector3D& gp) const { // confined static volumes - highest hierarchy if (m_confinedVolumes) { return (m_confinedVolumes->object(gp).get()); @@ -95,8 +100,8 @@ const Acts::TrackingVolume* Acts::TrackingVolume::lowestTrackingVolume( return this; } -void Acts::TrackingVolume::sign(GeometrySignature geosign, - GeometryType geotype) { +void +Acts::TrackingVolume::sign(GeometrySignature geosign, GeometryType geotype) { // never overwrite what is already signed, that's a crime if (m_geometrySignature == Unsigned) { m_geometrySignature = geosign; @@ -119,7 +124,8 @@ Acts::TrackingVolume::boundarySurfaces() const { return (m_boundarySurfaces); } -void Acts::TrackingVolume::createBoundarySurfaces() { +void +Acts::TrackingVolume::createBoundarySurfaces() { // transform Surfaces To BoundarySurfaces std::vector<std::shared_ptr<const Surface>> surfaces = Volume::volumeBounds().decomposeToSurfaces(m_transform.get()); @@ -137,15 +143,17 @@ void Acts::TrackingVolume::createBoundarySurfaces() { TrackingVolume* outer = (inner) != nullptr ? nullptr : this; // create the boundary surface m_boundarySurfaces.push_back( - std::make_shared<const BoundarySurfaceT<TrackingVolume>>(std::move(sf), - inner, outer)); + std::make_shared<const BoundarySurfaceT<TrackingVolume>>( + std::move(sf), inner, outer)); // increase the counter ++sfCounter; } } -void Acts::TrackingVolume::glueTrackingVolume( - const GeometryContext& gctx, BoundarySurfaceFace bsfMine, +void +Acts::TrackingVolume::glueTrackingVolume( + const GeometryContext& gctx, + BoundarySurfaceFace bsfMine, const std::shared_ptr<TrackingVolume>& neighbor, BoundarySurfaceFace bsfNeighbor) { // find the connection of the two tracking volumes : binR returns the center @@ -176,8 +184,10 @@ void Acts::TrackingVolume::glueTrackingVolume( } } -void Acts::TrackingVolume::glueTrackingVolumes( - const GeometryContext& gctx, BoundarySurfaceFace bsfMine, +void +Acts::TrackingVolume::glueTrackingVolumes( + const GeometryContext& gctx, + BoundarySurfaceFace bsfMine, const std::shared_ptr<TrackingVolumeArray>& neighbors, BoundarySurfaceFace bsfNeighbor) { // find the connection of the two tracking volumes : binR returns the center @@ -214,26 +224,29 @@ void Acts::TrackingVolume::glueTrackingVolumes( } } -void Acts::TrackingVolume::updateBoundarySurface( +void +Acts::TrackingVolume::updateBoundarySurface( BoundarySurfaceFace bsf, std::shared_ptr<const BoundarySurfaceT<TrackingVolume>> bs) { m_boundarySurfaces.at(bsf) = std::move(bs); } -void Acts::TrackingVolume::registerGlueVolumeDescriptor( - GlueVolumesDescriptor* gvd) { +void +Acts::TrackingVolume::registerGlueVolumeDescriptor(GlueVolumesDescriptor* gvd) { delete m_glueVolumeDescriptor; m_glueVolumeDescriptor = gvd; } -Acts::GlueVolumesDescriptor& Acts::TrackingVolume::glueVolumesDescriptor() { +Acts::GlueVolumesDescriptor& +Acts::TrackingVolume::glueVolumesDescriptor() { if (m_glueVolumeDescriptor == nullptr) { m_glueVolumeDescriptor = new GlueVolumesDescriptor; } return (*m_glueVolumeDescriptor); } -void Acts::TrackingVolume::synchronizeLayers(double envelope) const { +void +Acts::TrackingVolume::synchronizeLayers(double envelope) const { // case a : Layers exist // msgstream << MSG::VERBOSE << " -> synchronizing Layer dimensions of // TrackingVolume '" << volumeName() << "'." << endreq; @@ -267,7 +280,8 @@ void Acts::TrackingVolume::synchronizeLayers(double envelope) const { } } -void Acts::TrackingVolume::interlinkLayers() { +void +Acts::TrackingVolume::interlinkLayers() { if (m_confinedLayers) { auto& layers = m_confinedLayers->arrayObjects(); @@ -297,9 +311,11 @@ void Acts::TrackingVolume::interlinkLayers() { } } -void Acts::TrackingVolume::closeGeometry( +void +Acts::TrackingVolume::closeGeometry( const IMaterialDecorator* materialDecorator, - std::map<std::string, const TrackingVolume*>& volumeMap, size_t& vol) { + std::map<std::string, const TrackingVolume*>& volumeMap, + size_t& vol) { // insert the volume into the map volumeMap[volumeName()] = this; @@ -377,7 +393,8 @@ void Acts::TrackingVolume::closeGeometry( } } -void Acts::TrackingVolume::visitSurfaces( +void +Acts::TrackingVolume::visitSurfaces( const std::function<void(const Acts::Surface*)>& visitor) const { if (!m_confinedVolumes) { // no sub volumes => loop over the confined layers diff --git a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp index f7aead170..953a0dbb1 100644 --- a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp @@ -20,7 +20,8 @@ std::shared_ptr<const Acts::TrackingVolumeArray> Acts::TrackingVolumeArrayCreator::trackingVolumeArray( - const GeometryContext& gctx, const TrackingVolumeVector& tVolumes, + const GeometryContext& gctx, + const TrackingVolumeVector& tVolumes, BinningValue bValue) const { // MSG_VERBOSE("Create VolumeArray of "<< tVolumes.size() << " TrackingVolumes // with binning in : " << binningValueNames[bValue] ); diff --git a/Core/src/Geometry/TrapezoidVolumeBounds.cpp b/Core/src/Geometry/TrapezoidVolumeBounds.cpp index b8ba8b8d0..a225c963a 100644 --- a/Core/src/Geometry/TrapezoidVolumeBounds.cpp +++ b/Core/src/Geometry/TrapezoidVolumeBounds.cpp @@ -24,24 +24,30 @@ Acts::TrapezoidVolumeBounds::TrapezoidVolumeBounds() : VolumeBounds(), m_valueStore(bv_length, 0.) {} -Acts::TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, - double maxhalex, - double haley, double halez) +Acts::TrapezoidVolumeBounds::TrapezoidVolumeBounds( + double minhalex, + double maxhalex, + double haley, + double halez) : VolumeBounds(), m_valueStore(bv_length, 0.) { m_valueStore.at(bv_minHalfX) = minhalex; m_valueStore.at(bv_maxHalfX) = maxhalex; m_valueStore.at(bv_halfY) = haley; m_valueStore.at(bv_halfZ) = halez; m_valueStore.at(bv_alpha) = - atan((m_valueStore.at(bv_maxHalfX) - m_valueStore.at(bv_minHalfX)) / 2 / - m_valueStore.at(bv_halfY)) + + atan( + (m_valueStore.at(bv_maxHalfX) - m_valueStore.at(bv_minHalfX)) / 2 / + m_valueStore.at(bv_halfY)) + 0.5 * M_PI; m_valueStore.at(bv_beta) = m_valueStore.at(bv_alpha); } -Acts::TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, - double haley, double halez, - double alpha, double beta) +Acts::TrapezoidVolumeBounds::TrapezoidVolumeBounds( + double minhalex, + double haley, + double halez, + double alpha, + double beta) : VolumeBounds(), m_valueStore(bv_length, 0.) { m_valueStore.at(bv_minHalfX) = minhalex; m_valueStore.at(bv_halfY) = haley; @@ -59,8 +65,8 @@ Acts::TrapezoidVolumeBounds::TrapezoidVolumeBounds( Acts::TrapezoidVolumeBounds::~TrapezoidVolumeBounds() = default; -Acts::TrapezoidVolumeBounds& Acts::TrapezoidVolumeBounds::operator=( - const TrapezoidVolumeBounds& trabo) { +Acts::TrapezoidVolumeBounds& +Acts::TrapezoidVolumeBounds::operator=(const TrapezoidVolumeBounds& trabo) { if (this != &trabo) { m_valueStore = trabo.m_valueStore; } @@ -84,15 +90,15 @@ Acts::TrapezoidVolumeBounds::decomposeToSurfaces( // (1) - at negative local z std::shared_ptr<const PlanarBounds> xytBounds(faceXYTrapezoidBounds()); - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(0., 1., 0.)) * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(0., 1., 0.)) * + Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), xytBounds)); // (2) - at positive local z - tTransform = new Transform3D(transform * - Translation3D(Vector3D(0., 0., halflengthZ()))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(0., 0., halflengthZ()))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), xytBounds)); @@ -111,11 +117,12 @@ Acts::TrapezoidVolumeBounds::decomposeToSurfaces( faceAlphaRectangleBounds()); // Vector3D // faceAlphaPosition(A+faceAlphaRotation.colX()*faceAlphaBounds->halflengthX()); - Vector3D faceAlphaPosition0(-0.5 * (minHalflengthX() + maxHalflengthX()), 0., - 0.); + Vector3D faceAlphaPosition0( + -0.5 * (minHalflengthX() + maxHalflengthX()), 0., 0.); Vector3D faceAlphaPosition = transform * faceAlphaPosition0; - tTransform = new Transform3D(Translation3D(faceAlphaPosition) * - (trapezoidRotation * faceAlphaRotation)); + tTransform = new Transform3D( + Translation3D(faceAlphaPosition) * + (trapezoidRotation * faceAlphaRotation)); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), faceAlphaBounds)); @@ -131,29 +138,29 @@ Acts::TrapezoidVolumeBounds::decomposeToSurfaces( std::shared_ptr<const PlanarBounds> faceBetaBounds(faceBetaRectangleBounds()); // Vector3D // faceBetaPosition(B+faceBetaRotation.colX()*faceBetaBounds->halflengthX()); - Vector3D faceBetaPosition0(0.5 * (minHalflengthX() + maxHalflengthX()), 0., - 0.); + Vector3D faceBetaPosition0( + 0.5 * (minHalflengthX() + maxHalflengthX()), 0., 0.); Vector3D faceBetaPosition = transform * faceBetaPosition0; - tTransform = new Transform3D(Translation3D(faceBetaPosition) * - (trapezoidRotation * faceBetaRotation)); + tTransform = new Transform3D( + Translation3D(faceBetaPosition) * (trapezoidRotation * faceBetaRotation)); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), faceBetaBounds)); // face surfaces zx // (5) - at negative local x - tTransform = - new Transform3D(transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * - Translation3D(Vector3D(0., halflengthY(), 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); + tTransform = new Transform3D( + transform * AngleAxis3D(M_PI, Vector3D(1., 0., 0.)) * + Translation3D(Vector3D(0., halflengthY(), 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceZXRectangleBoundsBottom()))); // (6) - at positive local x - tTransform = new Transform3D(transform * - Translation3D(Vector3D(0., halflengthY(), 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * - AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); + tTransform = new Transform3D( + transform * Translation3D(Vector3D(0., halflengthY(), 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(0., 1., 0.)) * + AngleAxis3D(-0.5 * M_PI, Vector3D(1., 0., 0.))); rSurfaces.push_back(Surface::makeShared<PlaneSurface>( std::shared_ptr<const Transform3D>(tTransform), std::shared_ptr<const PlanarBounds>(faceZXRectangleBoundsTop()))); @@ -161,22 +168,23 @@ Acts::TrapezoidVolumeBounds::decomposeToSurfaces( return rSurfaces; } -Acts::TrapezoidBounds* Acts::TrapezoidVolumeBounds::faceXYTrapezoidBounds() - const { - return new TrapezoidBounds(m_valueStore.at(bv_minHalfX), - m_valueStore.at(bv_maxHalfX), - m_valueStore.at(bv_halfY)); +Acts::TrapezoidBounds* +Acts::TrapezoidVolumeBounds::faceXYTrapezoidBounds() const { + return new TrapezoidBounds( + m_valueStore.at(bv_minHalfX), + m_valueStore.at(bv_maxHalfX), + m_valueStore.at(bv_halfY)); } -Acts::RectangleBounds* Acts::TrapezoidVolumeBounds::faceAlphaRectangleBounds() - const { +Acts::RectangleBounds* +Acts::TrapezoidVolumeBounds::faceAlphaRectangleBounds() const { return new RectangleBounds( m_valueStore.at(bv_halfY) / cos(m_valueStore.at(bv_alpha) - 0.5 * M_PI), m_valueStore.at(bv_halfZ)); } -Acts::RectangleBounds* Acts::TrapezoidVolumeBounds::faceBetaRectangleBounds() - const { +Acts::RectangleBounds* +Acts::TrapezoidVolumeBounds::faceBetaRectangleBounds() const { return new RectangleBounds( m_valueStore.at(bv_halfY) / cos(m_valueStore.at(bv_beta) - 0.5 * M_PI), m_valueStore.at(bv_halfZ)); @@ -184,22 +192,22 @@ Acts::RectangleBounds* Acts::TrapezoidVolumeBounds::faceBetaRectangleBounds() Acts::RectangleBounds* Acts::TrapezoidVolumeBounds::faceZXRectangleBoundsBottom() const { - return new RectangleBounds(m_valueStore.at(bv_halfZ), - m_valueStore.at(bv_minHalfX)); + return new RectangleBounds( + m_valueStore.at(bv_halfZ), m_valueStore.at(bv_minHalfX)); } -Acts::RectangleBounds* Acts::TrapezoidVolumeBounds::faceZXRectangleBoundsTop() - const { +Acts::RectangleBounds* +Acts::TrapezoidVolumeBounds::faceZXRectangleBoundsTop() const { // double delta = (m_valueStore.at(bv_alpha) < m_valueStore.at(bv_beta)) ? // m_valueStore.at(bv_alpha) - M_PI/2. : m_valueStore.at(bv_beta) - M_PI/2.; // return new RectangleBounds(m_valueStore.at(bv_halfZ), // 0.5*(m_valueStore.at(bv_minHalfX)+m_valueStore.at(bv_minHalfX)+2.*m_valueStore.at(bv_halfY)/cos(delta))); - return new RectangleBounds(m_valueStore.at(bv_halfZ), - m_valueStore.at(bv_maxHalfX)); + return new RectangleBounds( + m_valueStore.at(bv_halfZ), m_valueStore.at(bv_maxHalfX)); } -bool Acts::TrapezoidVolumeBounds::inside(const Vector3D& pos, - double tol) const { +bool +Acts::TrapezoidVolumeBounds::inside(const Vector3D& pos, double tol) const { if (std::abs(pos.z()) > m_valueStore.at(bv_halfZ) + tol) { return false; } @@ -213,12 +221,15 @@ bool Acts::TrapezoidVolumeBounds::inside(const Vector3D& pos, return inside; } -std::ostream& Acts::TrapezoidVolumeBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::TrapezoidVolumeBounds::toStream(std::ostream& sl) const { return dumpT<std::ostream>(sl); } -Acts::Volume::BoundingBox Acts::TrapezoidVolumeBounds::boundingBox( - const Acts::Transform3D* trf, const Vector3D& envelope, +Acts::Volume::BoundingBox +Acts::TrapezoidVolumeBounds::boundingBox( + const Acts::Transform3D* trf, + const Vector3D& envelope, const Volume* entity) const { double minx = minHalflengthX(); double maxx = maxHalflengthX(); diff --git a/Core/src/Geometry/Volume.cpp b/Core/src/Geometry/Volume.cpp index 03dd3d8dd..b5809d37f 100644 --- a/Core/src/Geometry/Volume.cpp +++ b/Core/src/Geometry/Volume.cpp @@ -27,16 +27,19 @@ Acts::Volume::Volume() m_volumeBounds(nullptr), m_orientedBoundingBox(BoundingBox(this, {0, 0, 0}, {0, 0, 0})) {} -Acts::Volume::Volume(const std::shared_ptr<const Transform3D>& htrans, - std::shared_ptr<const VolumeBounds> volbounds) +Acts::Volume::Volume( + const std::shared_ptr<const Transform3D>& htrans, + std::shared_ptr<const VolumeBounds> volbounds) : GeometryObject(), m_transform(htrans), - m_itransform(m_transform ? m_transform->inverse() - : Transform3D::Identity()), + m_itransform( + m_transform ? m_transform->inverse() : Transform3D::Identity()), m_center(s_origin), m_volumeBounds(std::move(volbounds)), m_orientedBoundingBox(m_volumeBounds->boundingBox( - nullptr, {0.05_mm, 0.05_mm, 0.05_mm}, this)) { + nullptr, + {0.05_mm, 0.05_mm, 0.05_mm}, + this)) { if (htrans) { m_center = htrans->translation(); } @@ -45,12 +48,14 @@ Acts::Volume::Volume(const std::shared_ptr<const Transform3D>& htrans, Acts::Volume::Volume(const Volume& vol, const Transform3D* shift) : GeometryObject(), m_transform(vol.m_transform), - m_itransform(m_transform ? m_transform->inverse() - : Transform3D::Identity()), + m_itransform( + m_transform ? m_transform->inverse() : Transform3D::Identity()), m_center(s_origin), m_volumeBounds(vol.m_volumeBounds), m_orientedBoundingBox(m_volumeBounds->boundingBox( - nullptr, {0.05_mm, 0.05_mm, 0.05_mm}, this)) { + nullptr, + {0.05_mm, 0.05_mm, 0.05_mm}, + this)) { // apply the shift if it exists if (shift != nullptr) { m_transform = std::make_shared<const Transform3D>(transform() * (*shift)); @@ -63,8 +68,10 @@ Acts::Volume::Volume(const Volume& vol, const Transform3D* shift) Acts::Volume::~Volume() = default; -const Acts::Vector3D Acts::Volume::binningPosition( - const GeometryContext& /*gctx*/, Acts::BinningValue bValue) const { +const Acts::Vector3D +Acts::Volume::binningPosition( + const GeometryContext& /*gctx*/, + Acts::BinningValue bValue) const { // for most of the binning types it is actually the center, // just for R-binning types the if (bValue == Acts::binR || bValue == Acts::binRPhi) { @@ -76,7 +83,8 @@ const Acts::Vector3D Acts::Volume::binningPosition( } // assignment operator -Acts::Volume& Acts::Volume::operator=(const Acts::Volume& vol) { +Acts::Volume& +Acts::Volume::operator=(const Acts::Volume& vol) { if (this != &vol) { m_transform = vol.m_transform; m_center = vol.m_center; @@ -85,11 +93,13 @@ Acts::Volume& Acts::Volume::operator=(const Acts::Volume& vol) { return *this; } -Acts::Volume* Acts::Volume::clone() const { +Acts::Volume* +Acts::Volume::clone() const { return new Acts::Volume(*this); } -bool Acts::Volume::inside(const Acts::Vector3D& gpos, double tol) const { +bool +Acts::Volume::inside(const Acts::Vector3D& gpos, double tol) const { if (!m_transform) { return (volumeBounds()).inside(gpos, tol); } @@ -97,16 +107,18 @@ bool Acts::Volume::inside(const Acts::Vector3D& gpos, double tol) const { return (volumeBounds()).inside(posInVolFrame, tol); } -std::ostream& Acts::operator<<(std::ostream& sl, const Acts::Volume& vol) { +std::ostream& +Acts::operator<<(std::ostream& sl, const Acts::Volume& vol) { sl << "Volume with " << vol.volumeBounds() << std::endl; return sl; } -Acts::Volume::BoundingBox Acts::Volume::boundingBox( - const Vector3D& envelope) const { +Acts::Volume::BoundingBox +Acts::Volume::boundingBox(const Vector3D& envelope) const { return m_volumeBounds->boundingBox(m_transform.get(), envelope, this); } -const Acts::Volume::BoundingBox& Acts::Volume::orientedBoundingBox() const { +const Acts::Volume::BoundingBox& +Acts::Volume::orientedBoundingBox() const { return m_orientedBoundingBox; } diff --git a/Core/src/Geometry/VolumeBounds.cpp b/Core/src/Geometry/VolumeBounds.cpp index 6800e8e06..c9edf3198 100644 --- a/Core/src/Geometry/VolumeBounds.cpp +++ b/Core/src/Geometry/VolumeBounds.cpp @@ -13,6 +13,7 @@ #include "Acts/Geometry/VolumeBounds.hpp" /**Overload of << operator for std::ostream for debug output*/ -std::ostream& Acts::operator<<(std::ostream& sl, const Acts::VolumeBounds& vb) { +std::ostream& +Acts::operator<<(std::ostream& sl, const Acts::VolumeBounds& vb) { return vb.toStream(sl); } diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index 9bfd27ba0..f6909077c 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -16,15 +16,20 @@ using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; -Acts::InterpolatedBFieldMapper< - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>> -Acts::fieldMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, - std::array<size_t, 2> nBinsRZ)>& - localToGlobalBin, - std::vector<double> rPos, std::vector<double> zPos, - std::vector<Acts::Vector2D> bField, double lengthUnit, - double BFieldUnit, bool firstQuadrant) { +Acts::InterpolatedBFieldMapper<Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>> +Acts::fieldMapperRZ( + const std::function< + size_t(std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ)>& + localToGlobalBin, + std::vector<double> rPos, + std::vector<double> zPos, + std::vector<Acts::Vector2D> bField, + double lengthUnit, + double BFieldUnit, + bool firstQuadrant) { // [1] Create Grid // sort the values std::sort(rPos.begin(), rPos.end()); @@ -57,15 +62,16 @@ Acts::fieldMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, } // Create the axis for the grid - Acts::detail::EquidistantAxis rAxis(rMin * lengthUnit, rMax * lengthUnit, - nBinsR); - Acts::detail::EquidistantAxis zAxis(zMin * lengthUnit, zMax * lengthUnit, - nBinsZ); + Acts::detail::EquidistantAxis rAxis( + rMin * lengthUnit, rMax * lengthUnit, nBinsR); + Acts::detail::EquidistantAxis zAxis( + zMin * lengthUnit, zMax * lengthUnit, nBinsZ); // Create the grid - using Grid_t = - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>; + using Grid_t = Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>; Grid_t grid(std::make_tuple(std::move(rAxis), std::move(zAxis))); // [2] Set the bField values @@ -120,20 +126,26 @@ Acts::fieldMapperRZ(const std::function<size_t(std::array<size_t, 2> binsRZ, // [5] Create the mapper & BField Service // create field mapping - return Acts::InterpolatedBFieldMapper<Grid_t>(transformPos, transformBField, - std::move(grid)); + return Acts::InterpolatedBFieldMapper<Grid_t>( + transformPos, transformBField, std::move(grid)); } Acts::InterpolatedBFieldMapper<Acts::detail::Grid< - Acts::Vector3D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis, Acts::detail::EquidistantAxis>> + Acts::Vector3D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>> Acts::fieldMapperXYZ( - const std::function<size_t(std::array<size_t, 3> binsXYZ, - std::array<size_t, 3> nBinsXYZ)>& + const std::function< + size_t(std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ)>& localToGlobalBin, - std::vector<double> xPos, std::vector<double> yPos, - std::vector<double> zPos, std::vector<Acts::Vector3D> bField, - double lengthUnit, double BFieldUnit, bool firstOctant) { + std::vector<double> xPos, + std::vector<double> yPos, + std::vector<double> zPos, + std::vector<Acts::Vector3D> bField, + double lengthUnit, + double BFieldUnit, + bool firstOctant) { // [1] Create Grid // Sort the values std::sort(xPos.begin(), xPos.end()); @@ -182,17 +194,18 @@ Acts::fieldMapperXYZ( nBinsY = 2 * nBinsY - 1; nBinsZ = 2 * nBinsZ - 1; } - Acts::detail::EquidistantAxis xAxis(xMin * lengthUnit, xMax * lengthUnit, - nBinsX); - Acts::detail::EquidistantAxis yAxis(yMin * lengthUnit, yMax * lengthUnit, - nBinsY); - Acts::detail::EquidistantAxis zAxis(zMin * lengthUnit, zMax * lengthUnit, - nBinsZ); + Acts::detail::EquidistantAxis xAxis( + xMin * lengthUnit, xMax * lengthUnit, nBinsX); + Acts::detail::EquidistantAxis yAxis( + yMin * lengthUnit, yMax * lengthUnit, nBinsY); + Acts::detail::EquidistantAxis zAxis( + zMin * lengthUnit, zMax * lengthUnit, nBinsZ); // Create the grid - using Grid_t = - Acts::detail::Grid<Acts::Vector3D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>; + using Grid_t = Acts::detail::Grid< + Acts::Vector3D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>; Grid_t grid( std::make_tuple(std::move(xAxis), std::move(yAxis), std::move(zAxis))); @@ -240,17 +253,19 @@ Acts::fieldMapperXYZ( // [5] Create the mapper & BField Service // create field mapping - return Acts::InterpolatedBFieldMapper<Grid_t>(transformPos, transformBField, - std::move(grid)); + return Acts::InterpolatedBFieldMapper<Grid_t>( + transformPos, transformBField, std::move(grid)); } -Acts::InterpolatedBFieldMapper< - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>> -Acts::solenoidFieldMapper(std::pair<double, double> rlim, - std::pair<double, double> zlim, - std::pair<size_t, size_t> nbins, - const SolenoidBField& field) { +Acts::InterpolatedBFieldMapper<Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>> +Acts::solenoidFieldMapper( + std::pair<double, double> rlim, + std::pair<double, double> zlim, + std::pair<size_t, size_t> nbins, + const SolenoidBField& field) { double rMin, rMax, zMin, zMax; std::tie(rMin, rMax) = rlim; std::tie(zMin, zMax) = zlim; @@ -269,9 +284,10 @@ Acts::solenoidFieldMapper(std::pair<double, double> rlim, Acts::detail::EquidistantAxis zAxis(zMin, zMax, nBinsZ); // Create the grid - using Grid_t = - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>; + using Grid_t = Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>; Grid_t grid(std::make_tuple(std::move(rAxis), std::move(zAxis))); // Create the transformation for the position @@ -294,8 +310,8 @@ Acts::solenoidFieldMapper(std::pair<double, double> rlim, cos_phi = 1.; sin_phi = 0.; } - return Acts::Vector3D(bfield.x() * cos_phi, bfield.x() * sin_phi, - bfield.y()); + return Acts::Vector3D( + bfield.x() * cos_phi, bfield.x() * sin_phi, bfield.y()); }; // iterate over all bins, set their value to the solenoid value @@ -318,7 +334,7 @@ Acts::solenoidFieldMapper(std::pair<double, double> rlim, // Create the mapper & BField Service // create field mapping - Acts::InterpolatedBFieldMapper<Grid_t> mapper(transformPos, transformBField, - std::move(grid)); + Acts::InterpolatedBFieldMapper<Grid_t> mapper( + transformPos, transformBField, std::move(grid)); return mapper; } diff --git a/Core/src/MagneticField/SolenoidBField.cpp b/Core/src/MagneticField/SolenoidBField.cpp index f85cadfb9..dd48a20c2 100644 --- a/Core/src/MagneticField/SolenoidBField.cpp +++ b/Core/src/MagneticField/SolenoidBField.cpp @@ -21,7 +21,8 @@ Acts::SolenoidBField::SolenoidBField(Config config) : m_cfg(std::move(config)) { m_scale = m_cfg.bMagCenter / field.norm(); } -Acts::Vector3D Acts::SolenoidBField::getField(const Vector3D& position) const { +Acts::Vector3D +Acts::SolenoidBField::getField(const Vector3D& position) const { using VectorHelpers::perp; Vector2D rzPos(perp(position), position.z()); Vector2D rzField = multiCoilField(rzPos, m_scale); @@ -36,28 +37,34 @@ Acts::Vector3D Acts::SolenoidBField::getField(const Vector3D& position) const { return xyzField; } -Acts::Vector3D Acts::SolenoidBField::getField(const Vector3D& position, - Cache& /*cache*/) const { +Acts::Vector3D +Acts::SolenoidBField::getField(const Vector3D& position, Cache& /*cache*/) + const { return getField(position); } -Acts::Vector2D Acts::SolenoidBField::getField(const Vector2D& position) const { +Acts::Vector2D +Acts::SolenoidBField::getField(const Vector2D& position) const { return multiCoilField(position, m_scale); } -Acts::Vector3D Acts::SolenoidBField::getFieldGradient( - const Vector3D& position, ActsMatrixD<3, 3>& /*derivative*/) const { +Acts::Vector3D +Acts::SolenoidBField::getFieldGradient( + const Vector3D& position, + ActsMatrixD<3, 3>& /*derivative*/) const { return getField(position); } -Acts::Vector3D Acts::SolenoidBField::getFieldGradient( - const Vector3D& position, ActsMatrixD<3, 3>& /*derivative*/, +Acts::Vector3D +Acts::SolenoidBField::getFieldGradient( + const Vector3D& position, + ActsMatrixD<3, 3>& /*derivative*/, Cache& /*cache*/) const { return getField(position); } -Acts::Vector2D Acts::SolenoidBField::multiCoilField(const Vector2D& pos, - double scale) const { +Acts::Vector2D +Acts::SolenoidBField::multiCoilField(const Vector2D& pos, double scale) const { // iterate over all coils Vector2D resultField(0, 0); for (size_t coil = 0; coil < m_cfg.nCoils; coil++) { @@ -69,12 +76,13 @@ Acts::Vector2D Acts::SolenoidBField::multiCoilField(const Vector2D& pos, return resultField; } -Acts::Vector2D Acts::SolenoidBField::singleCoilField(const Vector2D& pos, - double scale) const { +Acts::Vector2D +Acts::SolenoidBField::singleCoilField(const Vector2D& pos, double scale) const { return {B_r(pos, scale), B_z(pos, scale)}; } -double Acts::SolenoidBField::B_r(const Vector2D& pos, double scale) const { +double +Acts::SolenoidBField::B_r(const Vector2D& pos, double scale) const { // _ // 2 / pi / 2 2 2 - 1 / 2 // E (k ) = | ( 1 - k sin {theta} ) dtheta @@ -111,7 +119,8 @@ double Acts::SolenoidBField::B_r(const Vector2D& pos, double scale) const { return r / pos[0] * constant * B; } -double Acts::SolenoidBField::B_z(const Vector2D& pos, double scale) const { +double +Acts::SolenoidBField::B_z(const Vector2D& pos, double scale) const { // _ // 2 / pi / 2 2 2 - 1 / 2 // E (k ) = | ( 1 - k sin {theta} ) dtheta @@ -148,7 +157,8 @@ double Acts::SolenoidBField::B_z(const Vector2D& pos, double scale) const { return constant * B; } -double Acts::SolenoidBField::k2(double r, double z) const { +double +Acts::SolenoidBField::k2(double r, double z) const { // 2 4Rr // k = --------------- // 2 2 diff --git a/Core/src/Material/AccumulatedSurfaceMaterial.cpp b/Core/src/Material/AccumulatedSurfaceMaterial.cpp index 262903f36..76840c3d6 100644 --- a/Core/src/Material/AccumulatedSurfaceMaterial.cpp +++ b/Core/src/Material/AccumulatedSurfaceMaterial.cpp @@ -23,7 +23,8 @@ Acts::AccumulatedSurfaceMaterial::AccumulatedSurfaceMaterial(double splitFactor) // Binned Material constructor with split factor Acts::AccumulatedSurfaceMaterial::AccumulatedSurfaceMaterial( - const BinUtility& binUtility, double splitFactor) + const BinUtility& binUtility, + double splitFactor) : m_binUtility(binUtility), m_splitFactor(splitFactor) { size_t bins0 = m_binUtility.bins(0); size_t bins1 = m_binUtility.bins(1); @@ -32,8 +33,11 @@ Acts::AccumulatedSurfaceMaterial::AccumulatedSurfaceMaterial( } // Assign a material properites object -std::array<size_t, 3> Acts::AccumulatedSurfaceMaterial::accumulate( - const Vector2D& lp, const MaterialProperties& mp, double pathCorrection) { +std::array<size_t, 3> +Acts::AccumulatedSurfaceMaterial::accumulate( + const Vector2D& lp, + const MaterialProperties& mp, + double pathCorrection) { if (m_binUtility.dimensions() == 0) { m_accumulatedMaterial[0][0].accumulate(mp, pathCorrection); return {0, 0, 0}; @@ -45,8 +49,11 @@ std::array<size_t, 3> Acts::AccumulatedSurfaceMaterial::accumulate( } // Assign a material properites object -std::array<size_t, 3> Acts::AccumulatedSurfaceMaterial::accumulate( - const Vector3D& gp, const MaterialProperties& mp, double pathCorrection) { +std::array<size_t, 3> +Acts::AccumulatedSurfaceMaterial::accumulate( + const Vector3D& gp, + const MaterialProperties& mp, + double pathCorrection) { if (m_binUtility.dimensions() == 0) { m_accumulatedMaterial[0][0].accumulate(mp, pathCorrection); return {0, 0, 0}; @@ -57,7 +64,8 @@ std::array<size_t, 3> Acts::AccumulatedSurfaceMaterial::accumulate( } // Average the information accumulated during one event -void Acts::AccumulatedSurfaceMaterial::trackAverage( +void +Acts::AccumulatedSurfaceMaterial::trackAverage( const std::vector<std::array<size_t, 3>>& trackBins) { // The touched bins are known, so you can access them directly if (not trackBins.empty()) { diff --git a/Core/src/Material/AccumulatedVolumeMaterial.cpp b/Core/src/Material/AccumulatedVolumeMaterial.cpp index 88108ac12..20384825e 100644 --- a/Core/src/Material/AccumulatedVolumeMaterial.cpp +++ b/Core/src/Material/AccumulatedVolumeMaterial.cpp @@ -12,7 +12,8 @@ #include "Acts/Material/AccumulatedVolumeMaterial.hpp" -void Acts::AccumulatedVolumeMaterial::accumulate(const Material& mat) { +void +Acts::AccumulatedVolumeMaterial::accumulate(const Material& mat) { // If nothing is set it is vacuum if (mat.A() == 0. || mat.Z() == 0. || mat.rho() == 0.) { m_vacuumEntries++; @@ -35,7 +36,8 @@ void Acts::AccumulatedVolumeMaterial::accumulate(const Material& mat) { } } -Acts::Material Acts::AccumulatedVolumeMaterial::average() { +Acts::Material +Acts::AccumulatedVolumeMaterial::average() { if (m_materialEntries > 0) { /// The following rescaling is a combination of two steps. /// 1) All material entries are averaged. @@ -45,9 +47,12 @@ Acts::Material Acts::AccumulatedVolumeMaterial::average() { float scalor = m_materialEntries * m_materialEntries; float totalEntries = (float)(m_vacuumEntries + m_materialEntries); // Create the material - return Material(m_totalX0 * totalEntries / scalor, - m_totalL0 * totalEntries / scalor, m_totalA / totalEntries, - m_totalZ / totalEntries, m_totalRho / totalEntries); + return Material( + m_totalX0 * totalEntries / scalor, + m_totalL0 * totalEntries / scalor, + m_totalA / totalEntries, + m_totalZ / totalEntries, + m_totalRho / totalEntries); } // Create vacuum return Material(); diff --git a/Core/src/Material/BinnedSurfaceMaterial.cpp b/Core/src/Material/BinnedSurfaceMaterial.cpp index b65bc9b95..9ad25cb4b 100644 --- a/Core/src/Material/BinnedSurfaceMaterial.cpp +++ b/Core/src/Material/BinnedSurfaceMaterial.cpp @@ -14,7 +14,8 @@ #include "Acts/Material/MaterialProperties.hpp" Acts::BinnedSurfaceMaterial::BinnedSurfaceMaterial( - const BinUtility& binUtility, MaterialPropertiesVector fullProperties, + const BinUtility& binUtility, + MaterialPropertiesVector fullProperties, double splitFactor) : ISurfaceMaterial(splitFactor), m_binUtility(binUtility) { // fill the material with deep copy @@ -22,14 +23,15 @@ Acts::BinnedSurfaceMaterial::BinnedSurfaceMaterial( } Acts::BinnedSurfaceMaterial::BinnedSurfaceMaterial( - const BinUtility& binUtility, MaterialPropertiesMatrix fullProperties, + const BinUtility& binUtility, + MaterialPropertiesMatrix fullProperties, double splitFactor) : ISurfaceMaterial(splitFactor), m_binUtility(binUtility), m_fullMaterial(std::move(fullProperties)) {} -Acts::BinnedSurfaceMaterial& Acts::BinnedSurfaceMaterial::operator*=( - double scale) { +Acts::BinnedSurfaceMaterial& +Acts::BinnedSurfaceMaterial::operator*=(double scale) { for (auto& materialVector : m_fullMaterial) { for (auto& materialBin : materialVector) { (materialBin) *= scale; @@ -38,15 +40,16 @@ Acts::BinnedSurfaceMaterial& Acts::BinnedSurfaceMaterial::operator*=( return (*this); } -const Acts::MaterialProperties& Acts::BinnedSurfaceMaterial::materialProperties( - const Vector2D& lp) const { +const Acts::MaterialProperties& +Acts::BinnedSurfaceMaterial::materialProperties(const Vector2D& lp) const { // the first bin size_t ibin0 = m_binUtility.bin(lp, 0); size_t ibin1 = m_binUtility.max(1) != 0u ? m_binUtility.bin(lp, 1) : 0; return m_fullMaterial[ibin1][ibin0]; } -const Acts::MaterialProperties& Acts::BinnedSurfaceMaterial::materialProperties( +const Acts::MaterialProperties& +Acts::BinnedSurfaceMaterial::materialProperties( const Acts::Vector3D& gp) const { // the first bin size_t ibin0 = m_binUtility.bin(gp, 0); @@ -54,7 +57,8 @@ const Acts::MaterialProperties& Acts::BinnedSurfaceMaterial::materialProperties( return m_fullMaterial[ibin1][ibin0]; } -std::ostream& Acts::BinnedSurfaceMaterial::toStream(std::ostream& sl) const { +std::ostream& +Acts::BinnedSurfaceMaterial::toStream(std::ostream& sl) const { sl << "Acts::BinnedSurfaceMaterial : " << std::endl; sl << " - Number of Material bins [0,1] : " << m_binUtility.max(0) + 1 << " / " << m_binUtility.max(1) + 1 << std::endl; diff --git a/Core/src/Material/HomogeneousSurfaceMaterial.cpp b/Core/src/Material/HomogeneousSurfaceMaterial.cpp index b89b6a37f..24811f996 100644 --- a/Core/src/Material/HomogeneousSurfaceMaterial.cpp +++ b/Core/src/Material/HomogeneousSurfaceMaterial.cpp @@ -14,18 +14,19 @@ #include "Acts/Material/MaterialProperties.hpp" Acts::HomogeneousSurfaceMaterial::HomogeneousSurfaceMaterial( - const MaterialProperties& full, double splitFactor) + const MaterialProperties& full, + double splitFactor) : ISurfaceMaterial(splitFactor), m_fullMaterial(full) {} -Acts::HomogeneousSurfaceMaterial& Acts::HomogeneousSurfaceMaterial::operator*=( - double scale) { +Acts::HomogeneousSurfaceMaterial& +Acts::HomogeneousSurfaceMaterial::operator*=(double scale) { // scale the sub properties m_fullMaterial *= scale; return (*this); } -std::ostream& Acts::HomogeneousSurfaceMaterial::toStream( - std::ostream& sl) const { +std::ostream& +Acts::HomogeneousSurfaceMaterial::toStream(std::ostream& sl) const { sl << "Acts::HomogeneousSurfaceMaterial : " << std::endl; sl << " - fullMaterial : " << m_fullMaterial << std::endl; sl << " - split factor : " << m_splitFactor << std::endl; diff --git a/Core/src/Material/MaterialMapUtils.cpp b/Core/src/Material/MaterialMapUtils.cpp index 7d777e54c..c4ddfcde1 100644 --- a/Core/src/Material/MaterialMapUtils.cpp +++ b/Core/src/Material/MaterialMapUtils.cpp @@ -16,14 +16,19 @@ using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; -auto Acts::materialMapperRZ( - const std::function<size_t(std::array<size_t, 2> binsRZ, - std::array<size_t, 2> nBinsRZ)>& +auto +Acts::materialMapperRZ( + const std::function< + size_t(std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ)>& materialVectorToGridMapper, - std::vector<double> rPos, std::vector<double> zPos, - std::vector<Acts::Material> material, double lengthUnit) - -> MaterialMapper<detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis>> { + std::vector<double> rPos, + std::vector<double> zPos, + std::vector<Acts::Material> material, + double lengthUnit) + -> MaterialMapper<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis>> { // [1] Decompose material std::vector<ActsVectorF<5>> materialVector; materialVector.reserve(material.size()); @@ -64,8 +69,8 @@ auto Acts::materialMapperRZ( detail::EquidistantAxis zAxis(zMin * lengthUnit, zMax * lengthUnit, nBinsZ); // Create the grid - using Grid_t = detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis>; + using Grid_t = detail:: + Grid<ActsVectorF<5>, detail::EquidistantAxis, detail::EquidistantAxis>; Grid_t grid(std::make_tuple(std::move(rAxis), std::move(zAxis))); // [3] Set the material values @@ -93,20 +98,27 @@ auto Acts::materialMapperRZ( // [5] Create the mapper & BField Service // create material mapping - return MaterialMapper<detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis>>(transformPos, - std::move(grid)); + return MaterialMapper<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis>>(transformPos, std::move(grid)); } -auto Acts::materialMapperXYZ( - const std::function<size_t(std::array<size_t, 3> binsXYZ, - std::array<size_t, 3> nBinsXYZ)>& +auto +Acts::materialMapperXYZ( + const std::function< + size_t(std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ)>& materialVectorToGridMapper, - std::vector<double> xPos, std::vector<double> yPos, - std::vector<double> zPos, std::vector<Material> material, double lengthUnit) - -> MaterialMapper< - detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis, detail::EquidistantAxis>> { + std::vector<double> xPos, + std::vector<double> yPos, + std::vector<double> zPos, + std::vector<Material> material, + double lengthUnit) + -> MaterialMapper<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis>> { // [1] Decompose material std::vector<ActsVectorF<5>> materialVector; materialVector.reserve(material.size()); @@ -158,8 +170,11 @@ auto Acts::materialMapperXYZ( detail::EquidistantAxis yAxis(yMin * lengthUnit, yMax * lengthUnit, nBinsY); detail::EquidistantAxis zAxis(zMin * lengthUnit, zMax * lengthUnit, nBinsZ); // Create the grid - using Grid_t = detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis, detail::EquidistantAxis>; + using Grid_t = detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis>; Grid_t grid( std::make_tuple(std::move(xAxis), std::move(yAxis), std::move(zAxis))); @@ -189,8 +204,9 @@ auto Acts::materialMapperXYZ( // [5] Create the mapper & BField Service // create material mapping - return MaterialMapper< - detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis, detail::EquidistantAxis>>( - transformPos, std::move(grid)); + return MaterialMapper<detail::Grid< + ActsVectorF<5>, + detail::EquidistantAxis, + detail::EquidistantAxis, + detail::EquidistantAxis>>(transformPos, std::move(grid)); } \ No newline at end of file diff --git a/Core/src/Material/MaterialProperties.cpp b/Core/src/Material/MaterialProperties.cpp index 2f131a813..9b69b2dda 100644 --- a/Core/src/Material/MaterialProperties.cpp +++ b/Core/src/Material/MaterialProperties.cpp @@ -16,25 +16,33 @@ Acts::MaterialProperties::MaterialProperties(float thickness) : m_thickness(thickness) {} -Acts::MaterialProperties::MaterialProperties(float Xo, float Lo, float averageA, - float averageZ, float averageRho, - float thickness) +Acts::MaterialProperties::MaterialProperties( + float Xo, + float Lo, + float averageA, + float averageZ, + float averageRho, + float thickness) : m_material(Xo, Lo, averageA, averageZ, averageRho), m_thickness(thickness), m_dInX0(Xo * Xo > 10e-10 ? thickness / Xo : 0.), m_dInL0(Lo * Lo > 10e-10 ? thickness / Lo : 0.) {} -Acts::MaterialProperties::MaterialProperties(const Material& material, - float thickness) +Acts::MaterialProperties::MaterialProperties( + const Material& material, + float thickness) : m_material(material), m_thickness(thickness), - m_dInX0(material.X0() * material.X0() > 10e-10 ? thickness / material.X0() - : 0.), - m_dInL0(material.L0() * material.L0() > 10e-10 ? thickness / material.L0() - : 0.) {} + m_dInX0( + material.X0() * material.X0() > 10e-10 ? thickness / material.X0() + : 0.), + m_dInL0( + material.L0() * material.L0() > 10e-10 ? thickness / material.L0() + : 0.) {} Acts::MaterialProperties::MaterialProperties( - const std::vector<MaterialProperties>& matLayers, bool unitThickness) + const std::vector<MaterialProperties>& matLayers, + bool unitThickness) : m_material(), m_thickness(0.), m_dInX0(0.), m_dInL0(0.) { double rho = 0.; double A = 0.; @@ -68,7 +76,8 @@ Acts::MaterialProperties::MaterialProperties( } } -Acts::MaterialProperties& Acts::MaterialProperties::operator*=(float scale) { +Acts::MaterialProperties& +Acts::MaterialProperties::operator*=(float scale) { // assuming rescaling of the material thickness m_dInX0 *= scale; m_dInL0 *= scale; @@ -76,7 +85,8 @@ Acts::MaterialProperties& Acts::MaterialProperties::operator*=(float scale) { return (*this); } -void Acts::MaterialProperties::scaleToUnitThickness() { +void +Acts::MaterialProperties::scaleToUnitThickness() { // And 'condense to unit thickness' if configured double t = thickness(); double X0 = m_material.X0() / t; @@ -88,8 +98,8 @@ void Acts::MaterialProperties::scaleToUnitThickness() { m_thickness = 1.; } -std::ostream& Acts::operator<<(std::ostream& sl, - const MaterialProperties& mprop) { +std::ostream& +Acts::operator<<(std::ostream& sl, const MaterialProperties& mprop) { if (mprop) { sl << "Acts::MaterialProperties: " << std::endl; sl << " - thickness/X0 = " diff --git a/Core/src/Material/ProtoSurfaceMaterial.cpp b/Core/src/Material/ProtoSurfaceMaterial.cpp index 4330ac769..bfe0e9842 100644 --- a/Core/src/Material/ProtoSurfaceMaterial.cpp +++ b/Core/src/Material/ProtoSurfaceMaterial.cpp @@ -15,12 +15,13 @@ Acts::ProtoSurfaceMaterial::ProtoSurfaceMaterial(const BinUtility& binUtility) : ISurfaceMaterial(), m_binUtility(binUtility) {} -Acts::ProtoSurfaceMaterial& Acts::ProtoSurfaceMaterial::operator*=( - double /*scale*/) { +Acts::ProtoSurfaceMaterial& +Acts::ProtoSurfaceMaterial::operator*=(double /*scale*/) { return (*this); } -std::ostream& Acts::ProtoSurfaceMaterial::toStream(std::ostream& sl) const { +std::ostream& +Acts::ProtoSurfaceMaterial::toStream(std::ostream& sl) const { sl << "Acts::ProtoSurfaceMaterial : " << std::endl; if (m_binUtility.bins(0) * m_binUtility.bins(1) > 1) { sl << " - Number of Material bins [0,1] : " << m_binUtility.bins(0) diff --git a/Core/src/Material/SurfaceMaterialMapper.cpp b/Core/src/Material/SurfaceMaterialMapper.cpp index c9d98e2d9..cded59e13 100644 --- a/Core/src/Material/SurfaceMaterialMapper.cpp +++ b/Core/src/Material/SurfaceMaterialMapper.cpp @@ -24,14 +24,17 @@ #include "Acts/Utilities/BinUtility.hpp" Acts::SurfaceMaterialMapper::SurfaceMaterialMapper( - const Config& cfg, StraightLinePropagator propagator, + const Config& cfg, + StraightLinePropagator propagator, std::unique_ptr<const Logger> slogger) : m_cfg(cfg), m_propagator(std::move(propagator)), m_logger(std::move(slogger)) {} -Acts::SurfaceMaterialMapper::State Acts::SurfaceMaterialMapper::createState( - const GeometryContext& gctx, const MagneticFieldContext& mctx, +Acts::SurfaceMaterialMapper::State +Acts::SurfaceMaterialMapper::createState( + const GeometryContext& gctx, + const MagneticFieldContext& mctx, const TrackingGeometry& tGeometry) const { // Parse the geometry and find all surfaces with material proxies auto world = tGeometry.highestTrackingVolume(); @@ -40,18 +43,21 @@ Acts::SurfaceMaterialMapper::State Acts::SurfaceMaterialMapper::createState( State mState(gctx, mctx); resolveMaterialSurfaces(mState, *world); - ACTS_DEBUG(mState.accumulatedMaterial.size() - << " Surfaces with PROXIES collected ... "); + ACTS_DEBUG( + mState.accumulatedMaterial.size() + << " Surfaces with PROXIES collected ... "); for (auto& smg : mState.accumulatedMaterial) { ACTS_VERBOSE(" -> Surface in with id " << smg.first.toString()); } return mState; } -void Acts::SurfaceMaterialMapper::resolveMaterialSurfaces( - State& mState, const TrackingVolume& tVolume) const { - ACTS_VERBOSE("Checking volume '" << tVolume.volumeName() - << "' for material surfaces.") +void +Acts::SurfaceMaterialMapper::resolveMaterialSurfaces( + State& mState, + const TrackingVolume& tVolume) const { + ACTS_VERBOSE( + "Checking volume '" << tVolume.volumeName() << "' for material surfaces.") // check the boundary surfaces for (auto& bSurface : tVolume.boundarySurfaces()) { checkAndInsert(mState, bSurface->surfaceRepresentation()); @@ -93,8 +99,10 @@ void Acts::SurfaceMaterialMapper::resolveMaterialSurfaces( } } -void Acts::SurfaceMaterialMapper::checkAndInsert(State& mState, - const Surface& surface) const { +void +Acts::SurfaceMaterialMapper::checkAndInsert( + State& mState, + const Surface& surface) const { auto surfaceMaterial = surface.surfaceMaterial(); // check if the surface has a proxy if (surfaceMaterial != nullptr) { @@ -137,7 +145,8 @@ void Acts::SurfaceMaterialMapper::checkAndInsert(State& mState, } } -void Acts::SurfaceMaterialMapper::finalizeMaps(State& mState) const { +void +Acts::SurfaceMaterialMapper::finalizeMaps(State& mState) const { // iterate over the map to call the total average for (auto& accMaterial : mState.accumulatedMaterial) { mState.surfaceMaterial[accMaterial.first] = @@ -145,11 +154,13 @@ void Acts::SurfaceMaterialMapper::finalizeMaps(State& mState) const { } } -void Acts::SurfaceMaterialMapper::mapMaterialTrack( - State& mState, const RecordedMaterialTrack& mTrack) const { +void +Acts::SurfaceMaterialMapper::mapMaterialTrack( + State& mState, + const RecordedMaterialTrack& mTrack) const { // Neutral curvilinear parameters - NeutralCurvilinearParameters start(nullptr, mTrack.first.first, - mTrack.first.second, 0.); + NeutralCurvilinearParameters start( + nullptr, mTrack.first.first, mTrack.first.second, 0.); // Prepare Action list and abort list using DebugOutput = detail::DebugOutputActor; @@ -157,8 +168,8 @@ void Acts::SurfaceMaterialMapper::mapMaterialTrack( using ActionList = ActionList<MaterialSurfaceCollector, DebugOutput>; using AbortList = AbortList<detail::EndOfWorldReached>; - PropagatorOptions<ActionList, AbortList> options(mState.geoContext, - mState.magFieldContext); + PropagatorOptions<ActionList, AbortList> options( + mState.geoContext, mState.magFieldContext); options.debug = m_cfg.mapperDebugOutput; // Now collect the material layers by using the straight line propagator @@ -168,12 +179,14 @@ void Acts::SurfaceMaterialMapper::mapMaterialTrack( // Retrieve the recorded material from the recorded material track const auto& rMaterial = mTrack.second.materialInteractions; - ACTS_VERBOSE("Retrieved " << rMaterial.size() - << " recorded material properties to map.") + ACTS_VERBOSE( + "Retrieved " << rMaterial.size() + << " recorded material properties to map.") // These should be mapped onto the mapping surfaces found - ACTS_VERBOSE("Found " << mappingSurfaces.size() - << " mapping surfaces for this track."); + ACTS_VERBOSE( + "Found " << mappingSurfaces.size() + << " mapping surfaces for this track."); // Run the mapping process, i.e. take the recorded material and map it // onto the mapping surfaces diff --git a/Core/src/Material/VolumeMaterialMapper.cpp b/Core/src/Material/VolumeMaterialMapper.cpp index a317269a6..c28c53c48 100644 --- a/Core/src/Material/VolumeMaterialMapper.cpp +++ b/Core/src/Material/VolumeMaterialMapper.cpp @@ -38,8 +38,8 @@ using MaterialGrid3D = /// maximum value, number of bins} /// /// @return The grid -Grid2D createGrid(std::array<double, 3> gridAxis1, - std::array<double, 3> gridAxis2) { +Grid2D +createGrid(std::array<double, 3> gridAxis1, std::array<double, 3> gridAxis2) { // get the number of bins size_t nBinsAxis1 = gridAxis1[2]; size_t nBinsAxis2 = gridAxis2[2]; @@ -75,9 +75,11 @@ Grid2D createGrid(std::array<double, 3> gridAxis1, /// maximum value, number of bins} /// /// @return The grid -Grid3D createGrid(std::array<double, 3> gridAxis1, - std::array<double, 3> gridAxis2, - std::array<double, 3> gridAxis3) { +Grid3D +createGrid( + std::array<double, 3> gridAxis1, + std::array<double, 3> gridAxis2, + std::array<double, 3> gridAxis3) { // get the number of bins size_t nBinsAxis1 = gridAxis1[2]; size_t nBinsAxis2 = gridAxis2[2]; @@ -119,8 +121,10 @@ Grid3D createGrid(std::array<double, 3> gridAxis1, /// of @p mPoints to the grid points by its local index /// /// @return The average material grid decomposed into classification numbers -MaterialGrid2D mapMaterialPoints( - Grid2D& grid, const RecordedMaterial& mPoints, +MaterialGrid2D +mapMaterialPoints( + Grid2D& grid, + const RecordedMaterial& mPoints, const std::function<Grid2D::index_t(const Acts::Vector3D&, const Grid2D&)>& matchToGridPoint) { // Walk over each point @@ -157,8 +161,10 @@ MaterialGrid2D mapMaterialPoints( /// of @p mPoints to the grid points by its local index /// /// @return The average material grid decomposed into classification numbers -MaterialGrid3D mapMaterialPoints( - Grid3D& grid, const RecordedMaterial& mPoints, +MaterialGrid3D +mapMaterialPoints( + Grid3D& grid, + const RecordedMaterial& mPoints, const std::function<Grid3D::index_t(const Acts::Vector3D&, const Grid3D&)>& matchToGridPoint) { // Walk over each point @@ -187,8 +193,10 @@ MaterialGrid3D mapMaterialPoints( } } // namespace -MaterialGrid2D Acts::createMaterialGrid( - std::array<double, 3> gridAxis1, std::array<double, 3> gridAxis2, +MaterialGrid2D +Acts::createMaterialGrid( + std::array<double, 3> gridAxis1, + std::array<double, 3> gridAxis2, const RecordedMaterial& mPoints, const std::function<Grid2D::index_t(const Vector3D&, const Grid2D&)>& matchToGridPoint) { @@ -196,12 +204,15 @@ MaterialGrid2D Acts::createMaterialGrid( return mapMaterialPoints(grid, mPoints, matchToGridPoint); } -MaterialGrid3D Acts::createMaterialGrid( - std::array<double, 3> gridAxis1, std::array<double, 3> gridAxis2, - std::array<double, 3> gridAxis3, const RecordedMaterial& mPoints, +MaterialGrid3D +Acts::createMaterialGrid( + std::array<double, 3> gridAxis1, + std::array<double, 3> gridAxis2, + std::array<double, 3> gridAxis3, + const RecordedMaterial& mPoints, const std::function<Grid3D::index_t(const Vector3D&, const Grid3D&)>& matchToGridPoint) { - Grid3D grid = createGrid(std::move(gridAxis1), std::move(gridAxis2), - std::move(gridAxis3)); + Grid3D grid = createGrid( + std::move(gridAxis1), std::move(gridAxis2), std::move(gridAxis3)); return mapMaterialPoints(grid, mPoints, matchToGridPoint); } \ No newline at end of file diff --git a/Core/src/Surfaces/ConeBounds.cpp b/Core/src/Surfaces/ConeBounds.cpp index 226bd5a4d..32300ab40 100644 --- a/Core/src/Surfaces/ConeBounds.cpp +++ b/Core/src/Surfaces/ConeBounds.cpp @@ -19,13 +19,24 @@ #include "Acts/Utilities/detail/periodic.hpp" -Acts::ConeBounds::ConeBounds(double alpha, bool symm, double halfphi, - double avphi) - : ConeBounds(alpha, symm ? -std::numeric_limits<double>::infinity() : 0, - std::numeric_limits<double>::infinity(), halfphi, avphi) {} +Acts::ConeBounds::ConeBounds( + double alpha, + bool symm, + double halfphi, + double avphi) + : ConeBounds( + alpha, + symm ? -std::numeric_limits<double>::infinity() : 0, + std::numeric_limits<double>::infinity(), + halfphi, + avphi) {} -Acts::ConeBounds::ConeBounds(double alpha, double zmin, double zmax, - double halfphi, double avphi) +Acts::ConeBounds::ConeBounds( + double alpha, + double zmin, + double zmax, + double halfphi, + double avphi) : m_alpha(alpha), m_tanAlpha(std::tan(alpha)), m_zMin(zmin), @@ -35,15 +46,18 @@ Acts::ConeBounds::ConeBounds(double alpha, double zmin, double zmax, Acts::ConeBounds::~ConeBounds() = default; -Acts::ConeBounds* Acts::ConeBounds::clone() const { +Acts::ConeBounds* +Acts::ConeBounds::clone() const { return new ConeBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::ConeBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::ConeBounds::type() const { return SurfaceBounds::Cone; } -std::vector<TDD_real_t> Acts::ConeBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::ConeBounds::valueStore() const { std::vector<TDD_real_t> values(ConeBounds::bv_length); values[ConeBounds::bv_alpha] = alpha(); values[ConeBounds::bv_minZ] = minZ(); @@ -54,7 +68,8 @@ std::vector<TDD_real_t> Acts::ConeBounds::valueStore() const { } /// Shift r-phi coordinate to be centered around the average phi. -Acts::Vector2D Acts::ConeBounds::shifted(const Acts::Vector2D& lpos) const { +Acts::Vector2D +Acts::ConeBounds::shifted(const Acts::Vector2D& lpos) const { using Acts::detail::radian_sym; auto x = r(lpos[eLOC_Z]); // cone radius at the local position @@ -66,20 +81,24 @@ Acts::Vector2D Acts::ConeBounds::shifted(const Acts::Vector2D& lpos) const { return shifted; } -bool Acts::ConeBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { +bool +Acts::ConeBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { auto rphiHalf = r(lpos[eLOC_Z]) * halfPhiSector(); - return bcheck.isInside(shifted(lpos), Vector2D(-rphiHalf, minZ()), - Vector2D(rphiHalf, maxZ())); + return bcheck.isInside( + shifted(lpos), Vector2D(-rphiHalf, minZ()), Vector2D(rphiHalf, maxZ())); } -double Acts::ConeBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { +double +Acts::ConeBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { auto rphiHalf = r(lpos[eLOC_Z]) * halfPhiSector(); return BoundaryCheck(true).distance( shifted(lpos), Vector2D(-rphiHalf, minZ()), Vector2D(rphiHalf, maxZ())); } -std::ostream& Acts::ConeBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::ConeBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::ConeBounds: (tanAlpha, minZ, maxZ, averagePhi, halfPhiSector) " diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 30257680d..157a25ad1 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -27,52 +27,63 @@ using Acts::VectorHelpers::phi; Acts::ConeSurface::ConeSurface(const ConeSurface& other) : GeometryObject(), Surface(other), m_bounds(other.m_bounds) {} -Acts::ConeSurface::ConeSurface(const GeometryContext& gctx, - const ConeSurface& other, - const Transform3D& transf) +Acts::ConeSurface::ConeSurface( + const GeometryContext& gctx, + const ConeSurface& other, + const Transform3D& transf) : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) {} -Acts::ConeSurface::ConeSurface(std::shared_ptr<const Transform3D> htrans, - double alpha, bool symmetric) +Acts::ConeSurface::ConeSurface( + std::shared_ptr<const Transform3D> htrans, + double alpha, + bool symmetric) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::make_shared<const ConeBounds>(alpha, symmetric)) {} -Acts::ConeSurface::ConeSurface(std::shared_ptr<const Transform3D> htrans, - double alpha, double zmin, double zmax, - double halfPhi) +Acts::ConeSurface::ConeSurface( + std::shared_ptr<const Transform3D> htrans, + double alpha, + double zmin, + double zmax, + double halfPhi) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::make_shared<const ConeBounds>(alpha, zmin, zmax, halfPhi)) { } -Acts::ConeSurface::ConeSurface(std::shared_ptr<const Transform3D> htrans, - const std::shared_ptr<const ConeBounds>& cbounds) +Acts::ConeSurface::ConeSurface( + std::shared_ptr<const Transform3D> htrans, + const std::shared_ptr<const ConeBounds>& cbounds) : GeometryObject(), Surface(std::move(htrans)), m_bounds(cbounds) { throw_assert(cbounds, "ConeBounds must not be nullptr"); } -const Acts::Vector3D Acts::ConeSurface::binningPosition( - const GeometryContext& gctx, Acts::BinningValue bValue) const { +const Acts::Vector3D +Acts::ConeSurface::binningPosition( + const GeometryContext& gctx, + Acts::BinningValue bValue) const { const Vector3D& sfCenter = center(gctx); // special binning type for R-type methods if (bValue == Acts::binR || bValue == Acts::binRPhi) { - return Vector3D(sfCenter.x() + bounds().r(sfCenter.z()), sfCenter.y(), - sfCenter.z()); + return Vector3D( + sfCenter.x() + bounds().r(sfCenter.z()), sfCenter.y(), sfCenter.z()); } // give the center as default for all of these binning types // binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta return sfCenter; } -Acts::Surface::SurfaceType Acts::ConeSurface::type() const { +Acts::Surface::SurfaceType +Acts::ConeSurface::type() const { return Surface::Cone; } -Acts::ConeSurface& Acts::ConeSurface::operator=(const ConeSurface& other) { +Acts::ConeSurface& +Acts::ConeSurface::operator=(const ConeSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -80,13 +91,15 @@ Acts::ConeSurface& Acts::ConeSurface::operator=(const ConeSurface& other) { return *this; } -const Acts::Vector3D Acts::ConeSurface::rotSymmetryAxis( - const GeometryContext& gctx) const { +const Acts::Vector3D +Acts::ConeSurface::rotSymmetryAxis(const GeometryContext& gctx) const { return std::move(transform(gctx).matrix().block<3, 1>(0, 2)); } -const Acts::RotationMatrix3D Acts::ConeSurface::referenceFrame( - const GeometryContext& gctx, const Vector3D& pos, +const Acts::RotationMatrix3D +Acts::ConeSurface::referenceFrame( + const GeometryContext& gctx, + const Vector3D& pos, const Vector3D& /*unused*/) const { RotationMatrix3D mFrame; // construct the measurement frame @@ -106,10 +119,12 @@ const Acts::RotationMatrix3D Acts::ConeSurface::referenceFrame( return mFrame; } -void Acts::ConeSurface::localToGlobal(const GeometryContext& gctx, - const Vector2D& lpos, - const Vector3D& /*unused*/, - Vector3D& gpos) const { +void +Acts::ConeSurface::localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& /*unused*/, + Vector3D& gpos) const { // create the position in the local 3d frame double r = lpos[Acts::eLOC_Z] * bounds().tanAlpha(); double phi = lpos[Acts::eLOC_RPHI] / r; @@ -120,10 +135,12 @@ void Acts::ConeSurface::localToGlobal(const GeometryContext& gctx, } } -bool Acts::ConeSurface::globalToLocal(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& /*unused*/, - Vector2D& lpos) const { +bool +Acts::ConeSurface::globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& /*unused*/, + Vector2D& lpos) const { Vector3D loc3Dframe = m_transform ? (transform(gctx).inverse() * gpos) : gpos; double r = loc3Dframe.z() * bounds().tanAlpha(); lpos = Vector2D(r * atan2(loc3Dframe.y(), loc3Dframe.x()), loc3Dframe.z()); @@ -133,15 +150,19 @@ bool Acts::ConeSurface::globalToLocal(const GeometryContext& gctx, return ((std::abs(perp(loc3Dframe) - r) > inttol) ? false : true); } -double Acts::ConeSurface::pathCorrection(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& mom) const { +double +Acts::ConeSurface::pathCorrection( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) Vector3D posLocal = m_transform ? transform(gctx).inverse() * gpos : gpos; double phi = VectorHelpers::phi(posLocal); double sgn = posLocal.z() > 0. ? -1. : +1.; - Vector3D normalC(cos(phi) * bounds().cosAlpha(), - sin(phi) * bounds().cosAlpha(), sgn * bounds().sinAlpha()); + Vector3D normalC( + cos(phi) * bounds().cosAlpha(), + sin(phi) * bounds().cosAlpha(), + sgn * bounds().sinAlpha()); if (m_transform) { normalC = transform(gctx) * normalC; } @@ -150,34 +171,42 @@ double Acts::ConeSurface::pathCorrection(const GeometryContext& gctx, return std::abs(1. / cAlpha); } -std::string Acts::ConeSurface::name() const { +std::string +Acts::ConeSurface::name() const { return "Acts::ConeSurface"; } -std::shared_ptr<Acts::ConeSurface> Acts::ConeSurface::clone( - const GeometryContext& gctx, const Transform3D& shift) const { +std::shared_ptr<Acts::ConeSurface> +Acts::ConeSurface::clone(const GeometryContext& gctx, const Transform3D& shift) + const { return std::shared_ptr<ConeSurface>(this->clone_impl(gctx, shift)); } -Acts::ConeSurface* Acts::ConeSurface::clone_impl( - const GeometryContext& gctx, const Transform3D& shift) const { +Acts::ConeSurface* +Acts::ConeSurface::clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const { return new ConeSurface(gctx, *this, shift); } -const Acts::Vector3D Acts::ConeSurface::normal(const GeometryContext& gctx, - const Acts::Vector2D& lp) const { +const Acts::Vector3D +Acts::ConeSurface::normal(const GeometryContext& gctx, const Acts::Vector2D& lp) + const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) double phi = lp[Acts::eLOC_RPHI] / (bounds().r(lp[Acts::eLOC_Z])), sgn = lp[Acts::eLOC_Z] > 0 ? -1. : +1.; - Vector3D localNormal(cos(phi) * bounds().cosAlpha(), - sin(phi) * bounds().cosAlpha(), - sgn * bounds().sinAlpha()); + Vector3D localNormal( + cos(phi) * bounds().cosAlpha(), + sin(phi) * bounds().cosAlpha(), + sgn * bounds().sinAlpha()); return m_transform ? Vector3D(transform(gctx).linear() * localNormal) : localNormal; } -const Acts::Vector3D Acts::ConeSurface::normal( - const GeometryContext& gctx, const Acts::Vector3D& gpos) const { +const Acts::Vector3D +Acts::ConeSurface::normal( + const GeometryContext& gctx, + const Acts::Vector3D& gpos) const { // get it into the cylinder frame if needed // @todo respect opening angle Vector3D pos3D = gpos; @@ -188,7 +217,8 @@ const Acts::Vector3D Acts::ConeSurface::normal( return pos3D.normalized(); } -const Acts::ConeBounds& Acts::ConeSurface::bounds() const { +const Acts::ConeBounds& +Acts::ConeSurface::bounds() const { // is safe because no constructor w/o bounds exists return (*m_bounds.get()); } diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index d3297efa9..7456e2dce 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -27,12 +27,17 @@ Acts::CylinderBounds::CylinderBounds(double radius, double halfZ) m_closed = true; } -Acts::CylinderBounds::CylinderBounds(double radius, double halfPhi, - double halfZ) +Acts::CylinderBounds::CylinderBounds( + double radius, + double halfPhi, + double halfZ) : CylinderBounds(radius, 0, halfPhi, halfZ) {} -Acts::CylinderBounds::CylinderBounds(double radius, double averagePhi, - double halfPhi, double halfZ) +Acts::CylinderBounds::CylinderBounds( + double radius, + double averagePhi, + double halfPhi, + double halfZ) : m_radius(std::abs(radius)), m_avgPhi(detail::radian_sym(averagePhi)), m_halfPhi(std::abs(halfPhi)), @@ -45,15 +50,18 @@ Acts::CylinderBounds::CylinderBounds(double radius, double averagePhi, Acts::CylinderBounds::~CylinderBounds() = default; -Acts::CylinderBounds* Acts::CylinderBounds::clone() const { +Acts::CylinderBounds* +Acts::CylinderBounds::clone() const { return new CylinderBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::CylinderBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::CylinderBounds::type() const { return SurfaceBounds::Cylinder; } -std::vector<TDD_real_t> Acts::CylinderBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::CylinderBounds::valueStore() const { std::vector<TDD_real_t> values(CylinderBounds::bv_length); values[CylinderBounds::bv_radius] = m_radius; values[CylinderBounds::bv_averagePhi] = m_avgPhi; @@ -63,14 +71,16 @@ std::vector<TDD_real_t> Acts::CylinderBounds::valueStore() const { } // Convert from (r*phi,z) to (phi,z) centered around phi0 -Acts::Vector2D Acts::CylinderBounds::shifted(const Acts::Vector2D& lpos) const { +Acts::Vector2D +Acts::CylinderBounds::shifted(const Acts::Vector2D& lpos) const { return { Acts::detail::radian_sym((lpos[Acts::eLOC_RPHI] / m_radius) - m_avgPhi), lpos[Acts::eLOC_Z]}; } // Jacobian from (r*phi,z) to (phi,z) -Acts::ActsSymMatrixD<2> Acts::CylinderBounds::jacobian() const { +Acts::ActsSymMatrixD<2> +Acts::CylinderBounds::jacobian() const { ActsSymMatrixD<2> j; j(0, eLOC_RPHI) = 1 / m_radius; j(0, eLOC_Z) = 0; @@ -79,15 +89,19 @@ Acts::ActsSymMatrixD<2> Acts::CylinderBounds::jacobian() const { return j; } -bool Acts::CylinderBounds::inside(const Vector2D& lpos, - const BoundaryCheck& bcheck) const { +bool +Acts::CylinderBounds::inside(const Vector2D& lpos, const BoundaryCheck& bcheck) + const { return bcheck.transformed(jacobian()) - .isInside(shifted(lpos), Vector2D(-m_halfPhi, -m_halfZ), - Vector2D(m_halfPhi, m_halfZ)); + .isInside( + shifted(lpos), + Vector2D(-m_halfPhi, -m_halfZ), + Vector2D(m_halfPhi, m_halfZ)); } -bool Acts::CylinderBounds::inside3D(const Vector3D& pos, - const BoundaryCheck& bcheck) const { +bool +Acts::CylinderBounds::inside3D(const Vector3D& pos, const BoundaryCheck& bcheck) + const { // additional tolerance from the boundary check if configred bool checkAbsolute = bcheck.m_type == BoundaryCheck::Type::eAbsolute; @@ -100,25 +114,27 @@ bool Acts::CylinderBounds::inside3D(const Vector3D& pos, std::abs(perp(pos) - m_radius)) { return false; } else if (checkAbsolute && m_closed) { - return ((s_onSurfaceTolerance + addToleranceZ + m_halfZ) >= - std::abs(pos.z())); + return ( + (s_onSurfaceTolerance + addToleranceZ + m_halfZ) >= std::abs(pos.z())); } // detailed, but slower check Vector2D lpos(detail::radian_sym(phi(pos) - m_avgPhi), pos.z()); return bcheck.transformed(jacobian()) - .isInside(lpos, Vector2D(-m_halfPhi, -m_halfZ), - Vector2D(m_halfPhi, m_halfZ)); + .isInside( + lpos, Vector2D(-m_halfPhi, -m_halfZ), Vector2D(m_halfPhi, m_halfZ)); } -double Acts::CylinderBounds::distanceToBoundary( - const Acts::Vector2D& lpos) const { - return BoundaryCheck(true).distance(shifted(lpos), - Vector2D(-m_halfPhi, -m_halfZ), - Vector2D(m_halfPhi, m_halfZ)); +double +Acts::CylinderBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { + return BoundaryCheck(true).distance( + shifted(lpos), + Vector2D(-m_halfPhi, -m_halfZ), + Vector2D(m_halfPhi, m_halfZ)); } // ostream operator overload -std::ostream& Acts::CylinderBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::CylinderBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::CylinderBounds: (radius, averagePhi, halfPhiSector, " diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index ee2de8f52..5b1def2ab 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -27,21 +27,26 @@ using Acts::VectorHelpers::phi; Acts::CylinderSurface::CylinderSurface(const CylinderSurface& other) : GeometryObject(), Surface(other), m_bounds(other.m_bounds) {} -Acts::CylinderSurface::CylinderSurface(const GeometryContext& gctx, - const CylinderSurface& other, - const Transform3D& transf) +Acts::CylinderSurface::CylinderSurface( + const GeometryContext& gctx, + const CylinderSurface& other, + const Transform3D& transf) : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) {} Acts::CylinderSurface::CylinderSurface( - std::shared_ptr<const Transform3D> htrans, double radius, double hlength) + std::shared_ptr<const Transform3D> htrans, + double radius, + double hlength) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::make_shared<const CylinderBounds>(radius, hlength)) {} Acts::CylinderSurface::CylinderSurface( - std::shared_ptr<const Transform3D> htrans, double radius, double hphi, + std::shared_ptr<const Transform3D> htrans, + double radius, + double hphi, double hlength) : GeometryObject(), Surface(std::move(htrans)), @@ -62,8 +67,8 @@ Acts::CylinderSurface::CylinderSurface( throw_assert(cbounds, "CylinderBounds must not be nullptr"); } -Acts::CylinderSurface& Acts::CylinderSurface::operator=( - const CylinderSurface& other) { +Acts::CylinderSurface& +Acts::CylinderSurface::operator=(const CylinderSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -72,15 +77,17 @@ Acts::CylinderSurface& Acts::CylinderSurface::operator=( } // return the binning position for ordering in the BinnedArray -const Acts::Vector3D Acts::CylinderSurface::binningPosition( - const GeometryContext& gctx, BinningValue bValue) const { +const Acts::Vector3D +Acts::CylinderSurface::binningPosition( + const GeometryContext& gctx, + BinningValue bValue) const { const Acts::Vector3D& sfCenter = center(gctx); // special binning type for R-type methods if (bValue == Acts::binR || bValue == Acts::binRPhi) { double R = bounds().r(); double phi = m_bounds ? m_bounds->averagePhi() : 0.; - return Vector3D(sfCenter.x() + R * cos(phi), sfCenter.y() + R * sin(phi), - sfCenter.z()); + return Vector3D( + sfCenter.x() + R * cos(phi), sfCenter.y() + R * sin(phi), sfCenter.z()); } // give the center as default for all of these binning types // binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta @@ -88,8 +95,10 @@ const Acts::Vector3D Acts::CylinderSurface::binningPosition( } // return the measurement frame: it's the tangential plane -const Acts::RotationMatrix3D Acts::CylinderSurface::referenceFrame( - const GeometryContext& gctx, const Vector3D& gpos, +const Acts::RotationMatrix3D +Acts::CylinderSurface::referenceFrame( + const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& /*unused*/) const { RotationMatrix3D mFrame; // construct the measurement frame @@ -107,14 +116,17 @@ const Acts::RotationMatrix3D Acts::CylinderSurface::referenceFrame( return mFrame; } -Acts::Surface::SurfaceType Acts::CylinderSurface::type() const { +Acts::Surface::SurfaceType +Acts::CylinderSurface::type() const { return Surface::Cylinder; } -void Acts::CylinderSurface::localToGlobal(const GeometryContext& gctx, - const Vector2D& lpos, - const Vector3D& /*unused*/, - Vector3D& gpos) const { +void +Acts::CylinderSurface::localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& /*unused*/, + Vector3D& gpos) const { // create the position in the local 3d frame double r = bounds().r(); double phi = lpos[Acts::eLOC_RPHI] / r; @@ -122,10 +134,12 @@ void Acts::CylinderSurface::localToGlobal(const GeometryContext& gctx, gpos = transform(gctx) * gpos; } -bool Acts::CylinderSurface::globalToLocal(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& /*unused*/, - Vector2D& lpos) const { +bool +Acts::CylinderSurface::globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& /*unused*/, + Vector2D& lpos) const { // get the transform & transform global position into cylinder frame // @todo clean up intolerance parameters // transform it to the globalframe: CylinderSurfaces are allowed to have 0 @@ -145,29 +159,38 @@ bool Acts::CylinderSurface::globalToLocal(const GeometryContext& gctx, return ((std::abs(radius - bounds().r()) > inttol) ? false : true); } -std::string Acts::CylinderSurface::name() const { +std::string +Acts::CylinderSurface::name() const { return "Acts::CylinderSurface"; } -std::shared_ptr<Acts::CylinderSurface> Acts::CylinderSurface::clone( - const GeometryContext& gctx, const Transform3D& shift) const { +std::shared_ptr<Acts::CylinderSurface> +Acts::CylinderSurface::clone( + const GeometryContext& gctx, + const Transform3D& shift) const { return std::shared_ptr<CylinderSurface>(this->clone_impl(gctx, shift)); } -Acts::CylinderSurface* Acts::CylinderSurface::clone_impl( - const GeometryContext& gctx, const Transform3D& shift) const { +Acts::CylinderSurface* +Acts::CylinderSurface::clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const { return new CylinderSurface(gctx, *this, shift); } -const Acts::Vector3D Acts::CylinderSurface::normal( - const GeometryContext& gctx, const Acts::Vector2D& lpos) const { +const Acts::Vector3D +Acts::CylinderSurface::normal( + const GeometryContext& gctx, + const Acts::Vector2D& lpos) const { double phi = lpos[Acts::eLOC_RPHI] / m_bounds->r(); Vector3D localNormal(cos(phi), sin(phi), 0.); return Vector3D(transform(gctx).matrix().block<3, 3>(0, 0) * localNormal); } -const Acts::Vector3D Acts::CylinderSurface::normal( - const GeometryContext& gctx, const Acts::Vector3D& gpos) const { +const Acts::Vector3D +Acts::CylinderSurface::normal( + const GeometryContext& gctx, + const Acts::Vector3D& gpos) const { const Transform3D& sfTransform = transform(gctx); // get it into the cylinder frame Vector3D pos3D = sfTransform.inverse() * gpos; @@ -177,20 +200,26 @@ const Acts::Vector3D Acts::CylinderSurface::normal( return sfTransform.linear() * pos3D.normalized(); } -double Acts::CylinderSurface::pathCorrection(const GeometryContext& gctx, - const Acts::Vector3D& gpos, - const Acts::Vector3D& mom) const { +double +Acts::CylinderSurface::pathCorrection( + const GeometryContext& gctx, + const Acts::Vector3D& gpos, + const Acts::Vector3D& mom) const { Vector3D normalT = normal(gctx, gpos); double cosAlpha = normalT.dot(mom.normalized()); return std::fabs(1. / cosAlpha); } -const Acts::CylinderBounds& Acts::CylinderSurface::bounds() const { +const Acts::CylinderBounds& +Acts::CylinderSurface::bounds() const { return (*m_bounds.get()); } -Acts::PolyhedronRepresentation Acts::CylinderSurface::polyhedronRepresentation( - const GeometryContext& gctx, size_t l0div, size_t /*unused*/) const { +Acts::PolyhedronRepresentation +Acts::CylinderSurface::polyhedronRepresentation( + const GeometryContext& gctx, + size_t l0div, + size_t /*unused*/) const { std::vector<Vector3D> vertices; std::vector<std::vector<size_t>> faces; diff --git a/Core/src/Surfaces/DiamondBounds.cpp b/Core/src/Surfaces/DiamondBounds.cpp index 612e820d4..e5b455b52 100644 --- a/Core/src/Surfaces/DiamondBounds.cpp +++ b/Core/src/Surfaces/DiamondBounds.cpp @@ -17,8 +17,12 @@ #include <iomanip> #include <iostream> -Acts::DiamondBounds::DiamondBounds(double x1, double x2, double x3, double y1, - double y2) +Acts::DiamondBounds::DiamondBounds( + double x1, + double x2, + double x3, + double y1, + double y2) : m_x1(std::abs(x1)), m_x2(std::abs(x2)), m_x3(std::abs(x3)), @@ -31,15 +35,18 @@ Acts::DiamondBounds::DiamondBounds(double x1, double x2, double x3, double y1, Acts::DiamondBounds::~DiamondBounds() = default; -Acts::DiamondBounds* Acts::DiamondBounds::clone() const { +Acts::DiamondBounds* +Acts::DiamondBounds::clone() const { return new DiamondBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::DiamondBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::DiamondBounds::type() const { return SurfaceBounds::Diamond; } -std::vector<TDD_real_t> Acts::DiamondBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::DiamondBounds::valueStore() const { std::vector<TDD_real_t> values(DiamondBounds::bv_length); values[DiamondBounds::bv_x1] = x1(); values[DiamondBounds::bv_x2] = x2(); @@ -49,28 +56,37 @@ std::vector<TDD_real_t> Acts::DiamondBounds::valueStore() const { return values; } -bool Acts::DiamondBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { +bool +Acts::DiamondBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { return bcheck.isInside(lpos, vertices()); } -double Acts::DiamondBounds::distanceToBoundary( - const Acts::Vector2D& lpos) const { +double +Acts::DiamondBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { return BoundaryCheck(true).distance(lpos, vertices()); } -std::vector<Acts::Vector2D> Acts::DiamondBounds::vertices() const { +std::vector<Acts::Vector2D> +Acts::DiamondBounds::vertices() const { // vertices starting from lower right in clock-wise order - return {{x1(), -y1()}, {x2(), 0}, {x3(), y2()}, - {-x3(), y2()}, {-x2(), 0}, {-x1(), -y1()}}; + return {{x1(), -y1()}, + {x2(), 0}, + {x3(), y2()}, + {-x3(), y2()}, + {-x2(), 0}, + {-x1(), -y1()}}; } -const Acts::RectangleBounds& Acts::DiamondBounds::boundingBox() const { +const Acts::RectangleBounds& +Acts::DiamondBounds::boundingBox() const { return m_boundingBox; } // ostream operator overload -std::ostream& Acts::DiamondBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::DiamondBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::DiamondBounds: (x1, x2, x3, " diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index ed510f77c..042def5ee 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -30,40 +30,57 @@ using Acts::VectorHelpers::phi; Acts::DiscSurface::DiscSurface(const DiscSurface& other) : GeometryObject(), Surface(other), m_bounds(other.m_bounds) {} -Acts::DiscSurface::DiscSurface(const GeometryContext& gctx, - const DiscSurface& other, - const Transform3D& transf) +Acts::DiscSurface::DiscSurface( + const GeometryContext& gctx, + const DiscSurface& other, + const Transform3D& transf) : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) {} -Acts::DiscSurface::DiscSurface(std::shared_ptr<const Transform3D> htrans, - double rmin, double rmax, double hphisec) +Acts::DiscSurface::DiscSurface( + std::shared_ptr<const Transform3D> htrans, + double rmin, + double rmax, + double hphisec) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::make_shared<const RadialBounds>(rmin, rmax, hphisec)) {} -Acts::DiscSurface::DiscSurface(std::shared_ptr<const Transform3D> htrans, - double minhalfx, double maxhalfx, double maxR, - double minR, double avephi, double stereo) +Acts::DiscSurface::DiscSurface( + std::shared_ptr<const Transform3D> htrans, + double minhalfx, + double maxhalfx, + double maxR, + double minR, + double avephi, + double stereo) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::make_shared<const DiscTrapezoidalBounds>( - minhalfx, maxhalfx, maxR, minR, avephi, stereo)) {} - -Acts::DiscSurface::DiscSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const DiscBounds> dbounds) + minhalfx, + maxhalfx, + maxR, + minR, + avephi, + stereo)) {} + +Acts::DiscSurface::DiscSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const DiscBounds> dbounds) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::move(dbounds)) {} -Acts::DiscSurface::DiscSurface(const std::shared_ptr<const DiscBounds>& dbounds, - const DetectorElementBase& detelement) +Acts::DiscSurface::DiscSurface( + const std::shared_ptr<const DiscBounds>& dbounds, + const DetectorElementBase& detelement) : GeometryObject(), Surface(detelement), m_bounds(dbounds) { throw_assert(dbounds, "nullptr as DiscBounds"); } -Acts::DiscSurface& Acts::DiscSurface::operator=(const DiscSurface& other) { +Acts::DiscSurface& +Acts::DiscSurface::operator=(const DiscSurface& other) { if (this != &other) { Acts::Surface::operator=(other); m_bounds = other.m_bounds; @@ -71,33 +88,40 @@ Acts::DiscSurface& Acts::DiscSurface::operator=(const DiscSurface& other) { return *this; } -Acts::Surface::SurfaceType Acts::DiscSurface::type() const { +Acts::Surface::SurfaceType +Acts::DiscSurface::type() const { return Surface::Disc; } -void Acts::DiscSurface::localToGlobal(const GeometryContext& gctx, - const Vector2D& lpos, - const Vector3D& /*gmom*/, - Vector3D& gpos) const { +void +Acts::DiscSurface::localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& /*gmom*/, + Vector3D& gpos) const { // create the position in the local 3d frame - Vector3D loc3Dframe(lpos[Acts::eLOC_R] * cos(lpos[Acts::eLOC_PHI]), - lpos[Acts::eLOC_R] * sin(lpos[Acts::eLOC_PHI]), 0.); + Vector3D loc3Dframe( + lpos[Acts::eLOC_R] * cos(lpos[Acts::eLOC_PHI]), + lpos[Acts::eLOC_R] * sin(lpos[Acts::eLOC_PHI]), + 0.); // transport it to the globalframe (very unlikely that this is not needed) gpos = transform(gctx) * loc3Dframe; } -bool Acts::DiscSurface::globalToLocal(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& /*gmom*/, - Vector2D& lpos) const { +bool +Acts::DiscSurface::globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& /*gmom*/, + Vector2D& lpos) const { // transport it to the globalframe (very unlikely that this is not needed) Vector3D loc3Dframe = (transform(gctx).inverse()) * gpos; lpos = Acts::Vector2D(perp(loc3Dframe), phi(loc3Dframe)); return ((std::abs(loc3Dframe.z()) > s_onSurfaceTolerance) ? false : true); } -const Acts::Vector2D Acts::DiscSurface::localPolarToLocalCartesian( - const Vector2D& locpol) const { +const Acts::Vector2D +Acts::DiscSurface::localPolarToLocalCartesian(const Vector2D& locpol) const { const DiscTrapezoidalBounds* dtbo = dynamic_cast<const Acts::DiscTrapezoidalBounds*>(&(bounds())); if (dtbo != nullptr) { @@ -114,46 +138,59 @@ const Acts::Vector2D Acts::DiscSurface::localPolarToLocalCartesian( Pos[Acts::eLOC_Y] * sin(phi) + Pos[Acts::eLOC_X] * cos(phi)); return Vector2D(locPos[Acts::eLOC_X], locPos[Acts::eLOC_Y]); } - return Vector2D(locpol[Acts::eLOC_R] * cos(locpol[Acts::eLOC_PHI]), - locpol[Acts::eLOC_R] * sin(locpol[Acts::eLOC_PHI])); + return Vector2D( + locpol[Acts::eLOC_R] * cos(locpol[Acts::eLOC_PHI]), + locpol[Acts::eLOC_R] * sin(locpol[Acts::eLOC_PHI])); } -const Acts::Vector3D Acts::DiscSurface::localCartesianToGlobal( - const GeometryContext& gctx, const Vector2D& lpos) const { +const Acts::Vector3D +Acts::DiscSurface::localCartesianToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos) const { Vector3D loc3Dframe(lpos[Acts::eLOC_X], lpos[Acts::eLOC_Y], 0.); return Vector3D(transform(gctx) * loc3Dframe); } -const Acts::Vector2D Acts::DiscSurface::globalToLocalCartesian( - const GeometryContext& gctx, const Vector3D& gpos, +const Acts::Vector2D +Acts::DiscSurface::globalToLocalCartesian( + const GeometryContext& gctx, + const Vector3D& gpos, double /*unused*/) const { Vector3D loc3Dframe = (transform(gctx).inverse()) * gpos; return Vector2D(loc3Dframe.x(), loc3Dframe.y()); } -std::string Acts::DiscSurface::name() const { +std::string +Acts::DiscSurface::name() const { return "Acts::DiscSurface"; } -std::shared_ptr<Acts::DiscSurface> Acts::DiscSurface::clone( - const GeometryContext& gctx, const Transform3D& shift) const { +std::shared_ptr<Acts::DiscSurface> +Acts::DiscSurface::clone(const GeometryContext& gctx, const Transform3D& shift) + const { return std::shared_ptr<DiscSurface>(this->clone_impl(gctx, shift)); } -Acts::DiscSurface* Acts::DiscSurface::clone_impl( - const GeometryContext& gctx, const Transform3D& shift) const { +Acts::DiscSurface* +Acts::DiscSurface::clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const { return new DiscSurface(gctx, *this, shift); } -const Acts::SurfaceBounds& Acts::DiscSurface::bounds() const { +const Acts::SurfaceBounds& +Acts::DiscSurface::bounds() const { if (m_bounds) { return (*(m_bounds.get())); } return s_noBounds; } -Acts::PolyhedronRepresentation Acts::DiscSurface::polyhedronRepresentation( - const GeometryContext& gctx, size_t l0div, size_t /*unused*/) const { +Acts::PolyhedronRepresentation +Acts::DiscSurface::polyhedronRepresentation( + const GeometryContext& gctx, + size_t l0div, + size_t /*unused*/) const { std::vector<Vector3D> vertices; std::vector<std::vector<size_t>> faces; diff --git a/Core/src/Surfaces/DiscTrapezoidalBounds.cpp b/Core/src/Surfaces/DiscTrapezoidalBounds.cpp index 24b5eeb25..98f4e9631 100644 --- a/Core/src/Surfaces/DiscTrapezoidalBounds.cpp +++ b/Core/src/Surfaces/DiscTrapezoidalBounds.cpp @@ -18,10 +18,13 @@ #include "Acts/Utilities/detail/periodic.hpp" -Acts::DiscTrapezoidalBounds::DiscTrapezoidalBounds(double minhalfx, - double maxhalfx, double maxR, - double minR, double avephi, - double stereo) +Acts::DiscTrapezoidalBounds::DiscTrapezoidalBounds( + double minhalfx, + double maxhalfx, + double maxR, + double minR, + double avephi, + double stereo) : m_rMin(std::min(std::abs(minR), std::abs(maxR))), m_rMax(std::max(std::abs(minR), std::abs(maxR))), m_minHalfX(std::abs(minhalfx)), @@ -31,15 +34,18 @@ Acts::DiscTrapezoidalBounds::DiscTrapezoidalBounds(double minhalfx, Acts::DiscTrapezoidalBounds::~DiscTrapezoidalBounds() = default; -Acts::DiscTrapezoidalBounds* Acts::DiscTrapezoidalBounds::clone() const { +Acts::DiscTrapezoidalBounds* +Acts::DiscTrapezoidalBounds::clone() const { return new DiscTrapezoidalBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::DiscTrapezoidalBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::DiscTrapezoidalBounds::type() const { return SurfaceBounds::DiscTrapezoidal; } -std::vector<TDD_real_t> Acts::DiscTrapezoidalBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::DiscTrapezoidalBounds::valueStore() const { std::vector<TDD_real_t> values(DiscTrapezoidalBounds::bv_length); values[bv_rMin] = rMin(); values[bv_rMax] = rMax(); @@ -50,13 +56,14 @@ std::vector<TDD_real_t> Acts::DiscTrapezoidalBounds::valueStore() const { return values; } -Acts::Vector2D Acts::DiscTrapezoidalBounds::toLocalXY( - const Acts::Vector2D& lpos) const { +Acts::Vector2D +Acts::DiscTrapezoidalBounds::toLocalXY(const Acts::Vector2D& lpos) const { return {lpos[eLOC_R] * std::sin(lpos[eLOC_PHI] - m_avgPhi), lpos[eLOC_R] * std::cos(lpos[eLOC_PHI] - m_avgPhi)}; } -Acts::ActsMatrixD<2, 2> Acts::DiscTrapezoidalBounds::jacobianToLocalXY( +Acts::ActsMatrixD<2, 2> +Acts::DiscTrapezoidalBounds::jacobianToLocalXY( const Acts::Vector2D& lpos) const { ActsMatrixD<2, 2> jacobian; jacobian(0, eLOC_R) = std::sin(lpos[eLOC_PHI] - m_avgPhi); @@ -66,8 +73,10 @@ Acts::ActsMatrixD<2, 2> Acts::DiscTrapezoidalBounds::jacobianToLocalXY( return jacobian; } -bool Acts::DiscTrapezoidalBounds::inside( - const Acts::Vector2D& lpos, const Acts::BoundaryCheck& bcheck) const { +bool +Acts::DiscTrapezoidalBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { Vector2D vertices[] = {{minHalflengthX(), rMin()}, {maxHalflengthX(), rMax()}, {-maxHalflengthX(), rMax()}, @@ -76,7 +85,8 @@ bool Acts::DiscTrapezoidalBounds::inside( return bcheck.transformed(jacobian).isInside(toLocalXY(lpos), vertices); } -double Acts::DiscTrapezoidalBounds::distanceToBoundary( +double +Acts::DiscTrapezoidalBounds::distanceToBoundary( const Acts::Vector2D& lpos) const { Vector2D vertices[] = {{minHalflengthX(), rMin()}, {maxHalflengthX(), rMax()}, @@ -86,7 +96,8 @@ double Acts::DiscTrapezoidalBounds::distanceToBoundary( } // ostream operator overload -std::ostream& Acts::DiscTrapezoidalBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::DiscTrapezoidalBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::DiscTrapezoidalBounds: (innerRadius, outerRadius, hMinX, " diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index 0c96931fe..1c99e23ac 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -22,29 +22,37 @@ using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; -Acts::EllipseBounds::EllipseBounds(double minRadius0, double minRadius1, - double maxRadius0, double maxRadius1, - double averagePhi, double halfPhi) +Acts::EllipseBounds::EllipseBounds( + double minRadius0, + double minRadius1, + double maxRadius0, + double maxRadius1, + double averagePhi, + double halfPhi) : m_rMinX(std::abs(minRadius0)), m_rMinY(std::abs(minRadius1)), m_rMaxX(std::abs(maxRadius0)), m_rMaxY(std::abs(maxRadius1)), m_avgPhi(detail::radian_sym(averagePhi)), m_halfPhi(std::abs(halfPhi)), - m_boundingBox(std::max(minRadius0, maxRadius0), - std::max(minRadius1, maxRadius1)) {} + m_boundingBox( + std::max(minRadius0, maxRadius0), + std::max(minRadius1, maxRadius1)) {} Acts::EllipseBounds::~EllipseBounds() = default; -Acts::EllipseBounds* Acts::EllipseBounds::clone() const { +Acts::EllipseBounds* +Acts::EllipseBounds::clone() const { return new EllipseBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::EllipseBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::EllipseBounds::type() const { return SurfaceBounds::Ellipse; } -std::vector<TDD_real_t> Acts::EllipseBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::EllipseBounds::valueStore() const { std::vector<TDD_real_t> values(EllipseBounds::bv_length); values[EllipseBounds::bv_rMinX] = m_rMinX; values[EllipseBounds::bv_rMinY] = m_rMinY; @@ -55,13 +63,16 @@ std::vector<TDD_real_t> Acts::EllipseBounds::valueStore() const { return values; } -static inline double square(double x) { +static inline double +square(double x) { return x * x; } /// @warning This **only** works for tolerance-based checks -bool Acts::EllipseBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { +bool +Acts::EllipseBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { double tol0 = bcheck.m_tolerance[0]; double tol1 = bcheck.m_tolerance[1]; double phi = detail::radian_sym(VectorHelpers::phi(lpos) - averagePhi()); @@ -71,8 +82,9 @@ bool Acts::EllipseBounds::inside(const Acts::Vector2D& lpos, bool insideInner = (rMinX() <= tol0) || (rMinY() <= tol0) || (1 < (square(lpos[Acts::eLOC_X] / (rMinX() - tol0)) + square(lpos[Acts::eLOC_Y] / (rMinY() - tol0)))); - bool insideOuter = ((square(lpos[Acts::eLOC_X] / (rMaxX() + tol0)) + - square(lpos[Acts::eLOC_Y] / (rMaxY() + tol0))) < 1); + bool insideOuter = + ((square(lpos[Acts::eLOC_X] / (rMaxX() + tol0)) + + square(lpos[Acts::eLOC_Y] / (rMaxY() + tol0))) < 1); return (insidePhi && insideInner && insideOuter); } @@ -82,7 +94,8 @@ bool Acts::EllipseBounds::inside(const Acts::Vector2D& lpos, // and m_valueStore.at(EllipseBounds::bv_rMaxX) ~= // m_valueStore.at(EllipseBounds::bv_rMaxY) // -double Acts::EllipseBounds::distanceToBoundary(const Vector2D& lpos) const { +double +Acts::EllipseBounds::distanceToBoundary(const Vector2D& lpos) const { double r = perp(lpos); if (r == 0) { return std::min(rMinX(), rMinY()); @@ -144,17 +157,20 @@ double Acts::EllipseBounds::distanceToBoundary(const Vector2D& lpos) const { return sf; } -std::vector<Acts::Vector2D> Acts::EllipseBounds::vertices() const { +std::vector<Acts::Vector2D> +Acts::EllipseBounds::vertices() const { // 2017-04-08 msmk: this is definitely too coarse return {{rMaxX(), 0}, {0, rMaxY()}, {-rMaxX(), 0}, {0, -rMaxY()}}; } -const Acts::RectangleBounds& Acts::EllipseBounds::boundingBox() const { +const Acts::RectangleBounds& +Acts::EllipseBounds::boundingBox() const { return m_boundingBox; } // ostream operator overload -std::ostream& Acts::EllipseBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::EllipseBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::EllipseBounds: (innerRadiusX, innerRadiusY, outerRadiusX, " diff --git a/Core/src/Surfaces/LineBounds.cpp b/Core/src/Surfaces/LineBounds.cpp index 75b069c00..b7b03f786 100644 --- a/Core/src/Surfaces/LineBounds.cpp +++ b/Core/src/Surfaces/LineBounds.cpp @@ -20,34 +20,41 @@ Acts::LineBounds::LineBounds(double radius, double halez) Acts::LineBounds::~LineBounds() = default; -Acts::LineBounds* Acts::LineBounds::clone() const { +Acts::LineBounds* +Acts::LineBounds::clone() const { return new LineBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::LineBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::LineBounds::type() const { return SurfaceBounds::Line; } -std::vector<TDD_real_t> Acts::LineBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::LineBounds::valueStore() const { std::vector<TDD_real_t> values(LineBounds::bv_length); values[LineBounds::bv_radius] = r(); values[LineBounds::bv_halfZ] = halflengthZ(); return values; } -bool Acts::LineBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { - return bcheck.isInside(lpos, Vector2D(0, -halflengthZ()), - Vector2D(r(), halflengthZ())); +bool +Acts::LineBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { + return bcheck.isInside( + lpos, Vector2D(0, -halflengthZ()), Vector2D(r(), halflengthZ())); } -double Acts::LineBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { +double +Acts::LineBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { // per definition the min Distance of a correct local position is r return lpos[Acts::eLOC_R]; } // ostream operator overload -std::ostream& Acts::LineBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::LineBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::LineBounds: (radius, halflengthInZ) = "; diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index e165be963..a957bd569 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -19,20 +19,24 @@ #include "Acts/Utilities/ThrowAssert.hpp" -Acts::LineSurface::LineSurface(std::shared_ptr<const Transform3D> htrans, - double radius, double halez) +Acts::LineSurface::LineSurface( + std::shared_ptr<const Transform3D> htrans, + double radius, + double halez) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::make_shared<const LineBounds>(radius, halez)) {} -Acts::LineSurface::LineSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const LineBounds> lbounds) +Acts::LineSurface::LineSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const LineBounds> lbounds) : GeometryObject(), Surface(std::move(htrans)), m_bounds(std::move(lbounds)) {} -Acts::LineSurface::LineSurface(const std::shared_ptr<const LineBounds>& lbounds, - const DetectorElementBase& detelement) +Acts::LineSurface::LineSurface( + const std::shared_ptr<const LineBounds>& lbounds, + const DetectorElementBase& detelement) : GeometryObject(), Surface(detelement), m_bounds(lbounds) { throw_assert(lbounds, "LineBounds must not be nullptr"); } @@ -40,14 +44,16 @@ Acts::LineSurface::LineSurface(const std::shared_ptr<const LineBounds>& lbounds, Acts::LineSurface::LineSurface(const LineSurface& other) : GeometryObject(), Surface(other), m_bounds(other.m_bounds) {} -Acts::LineSurface::LineSurface(const GeometryContext& gctx, - const LineSurface& other, - const Transform3D& transf) +Acts::LineSurface::LineSurface( + const GeometryContext& gctx, + const LineSurface& other, + const Transform3D& transf) : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) {} -Acts::LineSurface& Acts::LineSurface::operator=(const LineSurface& other) { +Acts::LineSurface& +Acts::LineSurface::operator=(const LineSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; diff --git a/Core/src/Surfaces/PerigeeSurface.cpp b/Core/src/Surfaces/PerigeeSurface.cpp index 18e6dd580..bf9342793 100644 --- a/Core/src/Surfaces/PerigeeSurface.cpp +++ b/Core/src/Surfaces/PerigeeSurface.cpp @@ -29,39 +29,47 @@ Acts::PerigeeSurface::PerigeeSurface( Acts::PerigeeSurface::PerigeeSurface(const PerigeeSurface& other) : GeometryObject(), LineSurface(other) {} -Acts::PerigeeSurface::PerigeeSurface(const GeometryContext& gctx, - const PerigeeSurface& other, - const Transform3D& transf) +Acts::PerigeeSurface::PerigeeSurface( + const GeometryContext& gctx, + const PerigeeSurface& other, + const Transform3D& transf) : GeometryObject(), LineSurface(gctx, other, transf) {} -Acts::PerigeeSurface& Acts::PerigeeSurface::operator=( - const PerigeeSurface& other) { +Acts::PerigeeSurface& +Acts::PerigeeSurface::operator=(const PerigeeSurface& other) { if (this != &other) { LineSurface::operator=(other); } return *this; } -std::shared_ptr<Acts::PerigeeSurface> Acts::PerigeeSurface::clone( - const GeometryContext& gctx, const Transform3D& shift) const { +std::shared_ptr<Acts::PerigeeSurface> +Acts::PerigeeSurface::clone( + const GeometryContext& gctx, + const Transform3D& shift) const { return std::shared_ptr<PerigeeSurface>(this->clone_impl(gctx, shift)); } -Acts::PerigeeSurface* Acts::PerigeeSurface::clone_impl( - const GeometryContext& gctx, const Transform3D& shift) const { +Acts::PerigeeSurface* +Acts::PerigeeSurface::clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const { return new PerigeeSurface(gctx, *this, shift); } -Acts::Surface::SurfaceType Acts::PerigeeSurface::type() const { +Acts::Surface::SurfaceType +Acts::PerigeeSurface::type() const { return Surface::Perigee; } -std::string Acts::PerigeeSurface::name() const { +std::string +Acts::PerigeeSurface::name() const { return "Acts::PerigeeSurface"; } -std::ostream& Acts::PerigeeSurface::toStream(const GeometryContext& gctx, - std::ostream& sl) const { +std::ostream& +Acts::PerigeeSurface::toStream(const GeometryContext& gctx, std::ostream& sl) + const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::PerigeeSurface:" << std::endl; diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index d3e1bd431..3b7eee8c5 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -23,9 +23,10 @@ Acts::PlaneSurface::PlaneSurface(const PlaneSurface& other) : GeometryObject(), Surface(other), m_bounds(other.m_bounds) {} -Acts::PlaneSurface::PlaneSurface(const GeometryContext& gctx, - const PlaneSurface& other, - const Transform3D& transf) +Acts::PlaneSurface::PlaneSurface( + const GeometryContext& gctx, + const PlaneSurface& other, + const Transform3D& transf) : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) {} @@ -60,11 +61,13 @@ Acts::PlaneSurface::PlaneSurface( throw_assert(pbounds, "PlaneBounds must not be nullptr"); } -Acts::PlaneSurface::PlaneSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const PlanarBounds> pbounds) +Acts::PlaneSurface::PlaneSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const PlanarBounds> pbounds) : Surface(std::move(htrans)), m_bounds(std::move(pbounds)) {} -Acts::PlaneSurface& Acts::PlaneSurface::operator=(const PlaneSurface& other) { +Acts::PlaneSurface& +Acts::PlaneSurface::operator=(const PlaneSurface& other) { if (this != &other) { Surface::operator=(other); m_bounds = other.m_bounds; @@ -72,47 +75,58 @@ Acts::PlaneSurface& Acts::PlaneSurface::operator=(const PlaneSurface& other) { return *this; } -Acts::Surface::SurfaceType Acts::PlaneSurface::type() const { +Acts::Surface::SurfaceType +Acts::PlaneSurface::type() const { return Surface::Plane; } -void Acts::PlaneSurface::localToGlobal(const GeometryContext& gctx, - const Vector2D& lpos, - const Vector3D& /*gmom*/, - Vector3D& gpos) const { +void +Acts::PlaneSurface::localToGlobal( + const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& /*gmom*/, + Vector3D& gpos) const { Vector3D loc3Dframe(lpos[Acts::eLOC_X], lpos[Acts::eLOC_Y], 0.); /// the chance that there is no transform is almost 0, let's apply it gpos = transform(gctx) * loc3Dframe; } -bool Acts::PlaneSurface::globalToLocal(const GeometryContext& gctx, - const Vector3D& gpos, - const Vector3D& /*gmom*/, - Acts::Vector2D& lpos) const { +bool +Acts::PlaneSurface::globalToLocal( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& /*gmom*/, + Acts::Vector2D& lpos) const { /// the chance that there is no transform is almost 0, let's apply it Vector3D loc3Dframe = (transform(gctx).inverse()) * gpos; lpos = Vector2D(loc3Dframe.x(), loc3Dframe.y()); - return ((loc3Dframe.z() * loc3Dframe.z() > - s_onSurfaceTolerance * s_onSurfaceTolerance) - ? false - : true); + return ( + (loc3Dframe.z() * loc3Dframe.z() > + s_onSurfaceTolerance * s_onSurfaceTolerance) + ? false + : true); } -std::string Acts::PlaneSurface::name() const { +std::string +Acts::PlaneSurface::name() const { return "Acts::PlaneSurface"; } -std::shared_ptr<Acts::PlaneSurface> Acts::PlaneSurface::clone( - const GeometryContext& gctx, const Transform3D& shift) const { +std::shared_ptr<Acts::PlaneSurface> +Acts::PlaneSurface::clone(const GeometryContext& gctx, const Transform3D& shift) + const { return std::shared_ptr<PlaneSurface>(this->clone_impl(gctx, shift)); } -Acts::PlaneSurface* Acts::PlaneSurface::clone_impl( - const GeometryContext& gctx, const Transform3D& shift) const { +Acts::PlaneSurface* +Acts::PlaneSurface::clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const { return new PlaneSurface(gctx, *this, shift); } -const Acts::SurfaceBounds& Acts::PlaneSurface::bounds() const { +const Acts::SurfaceBounds& +Acts::PlaneSurface::bounds() const { if (m_bounds) { return (*m_bounds.get()); } diff --git a/Core/src/Surfaces/PolyhedronRepresentation.cpp b/Core/src/Surfaces/PolyhedronRepresentation.cpp index 6d37aae75..39aba3e43 100644 --- a/Core/src/Surfaces/PolyhedronRepresentation.cpp +++ b/Core/src/Surfaces/PolyhedronRepresentation.cpp @@ -10,7 +10,8 @@ #include "Acts/Surfaces/PolyhedronRepresentation.hpp" -std::string Acts::PolyhedronRepresentation::objString(size_t vtxOffset) const { +std::string +Acts::PolyhedronRepresentation::objString(size_t vtxOffset) const { std::stringstream sstr; for (const auto& vtx : vertices) { diff --git a/Core/src/Surfaces/RadialBounds.cpp b/Core/src/Surfaces/RadialBounds.cpp index 3772d8136..a1a130910 100644 --- a/Core/src/Surfaces/RadialBounds.cpp +++ b/Core/src/Surfaces/RadialBounds.cpp @@ -21,8 +21,11 @@ Acts::RadialBounds::RadialBounds(double minrad, double maxrad, double hphisec) : RadialBounds(minrad, maxrad, 0, hphisec) {} -Acts::RadialBounds::RadialBounds(double minrad, double maxrad, double avephi, - double hphisec) +Acts::RadialBounds::RadialBounds( + double minrad, + double maxrad, + double avephi, + double hphisec) : m_rMin(std::min(minrad, maxrad)), m_rMax(std::max(minrad, maxrad)), m_avgPhi(detail::radian_sym(avephi)), @@ -30,15 +33,18 @@ Acts::RadialBounds::RadialBounds(double minrad, double maxrad, double avephi, Acts::RadialBounds::~RadialBounds() = default; -Acts::RadialBounds* Acts::RadialBounds::clone() const { +Acts::RadialBounds* +Acts::RadialBounds::clone() const { return new RadialBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::RadialBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::RadialBounds::type() const { return SurfaceBounds::Disc; } -std::vector<TDD_real_t> Acts::RadialBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::RadialBounds::valueStore() const { std::vector<TDD_real_t> values(RadialBounds::bv_length); values[RadialBounds::bv_rMin] = rMin(); values[RadialBounds::bv_rMax] = rMax(); @@ -47,28 +53,35 @@ std::vector<TDD_real_t> Acts::RadialBounds::valueStore() const { return values; } -Acts::Vector2D Acts::RadialBounds::shifted(const Acts::Vector2D& lpos) const { +Acts::Vector2D +Acts::RadialBounds::shifted(const Acts::Vector2D& lpos) const { Vector2D tmp; tmp[eLOC_R] = lpos[eLOC_R]; tmp[eLOC_PHI] = detail::radian_sym(lpos[eLOC_PHI] - averagePhi()); return tmp; } -bool Acts::RadialBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { - return bcheck.isInside(shifted(lpos), Vector2D(rMin(), -halfPhiSector()), - Vector2D(rMax(), halfPhiSector())); +bool +Acts::RadialBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { + return bcheck.isInside( + shifted(lpos), + Vector2D(rMin(), -halfPhiSector()), + Vector2D(rMax(), halfPhiSector())); } -double Acts::RadialBounds::distanceToBoundary( - const Acts::Vector2D& lpos) const { - return BoundaryCheck(true).distance(shifted(lpos), - Vector2D(rMin(), -halfPhiSector()), - Vector2D(rMax(), halfPhiSector())); +double +Acts::RadialBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { + return BoundaryCheck(true).distance( + shifted(lpos), + Vector2D(rMin(), -halfPhiSector()), + Vector2D(rMax(), halfPhiSector())); } // ostream operator overload -std::ostream& Acts::RadialBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::RadialBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::RadialBounds: (innerRadius, outerRadius, hPhiSector) = "; diff --git a/Core/src/Surfaces/RectangleBounds.cpp b/Core/src/Surfaces/RectangleBounds.cpp index 534185702..0c017bd75 100644 --- a/Core/src/Surfaces/RectangleBounds.cpp +++ b/Core/src/Surfaces/RectangleBounds.cpp @@ -20,31 +20,37 @@ Acts::RectangleBounds::RectangleBounds(double halex, double haley) : m_min(-halex, -haley), m_max(halex, haley) {} -Acts::RectangleBounds::RectangleBounds(const Vector2D& vmin, - const Vector2D& vmax) +Acts::RectangleBounds::RectangleBounds( + const Vector2D& vmin, + const Vector2D& vmax) : m_min(vmin), m_max(vmax) {} -Acts::RectangleBounds* Acts::RectangleBounds::clone() const { +Acts::RectangleBounds* +Acts::RectangleBounds::clone() const { return new RectangleBounds(*this); } -std::vector<TDD_real_t> Acts::RectangleBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::RectangleBounds::valueStore() const { std::vector<TDD_real_t> values(RectangleBounds::bv_length); values = {m_min.x(), m_min.y(), m_max.x(), m_max.y()}; return values; } -bool Acts::RectangleBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { +bool +Acts::RectangleBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { return bcheck.isInside(lpos, m_min, m_max); } -double Acts::RectangleBounds::distanceToBoundary( - const Acts::Vector2D& lpos) const { +double +Acts::RectangleBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { return BoundaryCheck(true).distance(lpos, m_min, m_max); } -std::vector<Acts::Vector2D> Acts::RectangleBounds::vertices() const { +std::vector<Acts::Vector2D> +Acts::RectangleBounds::vertices() const { // counter-clockwise starting from bottom-right corner return { {m_max.x(), m_min.y()}, @@ -54,12 +60,14 @@ std::vector<Acts::Vector2D> Acts::RectangleBounds::vertices() const { }; } -const Acts::RectangleBounds& Acts::RectangleBounds::boundingBox() const { +const Acts::RectangleBounds& +Acts::RectangleBounds::boundingBox() const { return (*this); } // ostream operator overload -std::ostream& Acts::RectangleBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::RectangleBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::RectangleBounds: (hlX, hlY) = " diff --git a/Core/src/Surfaces/StrawSurface.cpp b/Core/src/Surfaces/StrawSurface.cpp index f8d55714f..9c3577149 100644 --- a/Core/src/Surfaces/StrawSurface.cpp +++ b/Core/src/Surfaces/StrawSurface.cpp @@ -19,12 +19,15 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" -Acts::StrawSurface::StrawSurface(std::shared_ptr<const Transform3D> htrans, - double radius, double halez) +Acts::StrawSurface::StrawSurface( + std::shared_ptr<const Transform3D> htrans, + double radius, + double halez) : GeometryObject(), LineSurface(std::move(htrans), radius, halez) {} -Acts::StrawSurface::StrawSurface(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const LineBounds> lbounds) +Acts::StrawSurface::StrawSurface( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const LineBounds> lbounds) : GeometryObject(), LineSurface(std::move(htrans), std::move(lbounds)) {} Acts::StrawSurface::StrawSurface( @@ -35,12 +38,14 @@ Acts::StrawSurface::StrawSurface( Acts::StrawSurface::StrawSurface(const Acts::StrawSurface& other) : GeometryObject(), LineSurface(other) {} -Acts::StrawSurface::StrawSurface(const GeometryContext& gctx, - const StrawSurface& other, - const Transform3D& transf) +Acts::StrawSurface::StrawSurface( + const GeometryContext& gctx, + const StrawSurface& other, + const Transform3D& transf) : GeometryObject(), LineSurface(gctx, other, transf) {} -Acts::StrawSurface& Acts::StrawSurface::operator=(const StrawSurface& other) { +Acts::StrawSurface& +Acts::StrawSurface::operator=(const StrawSurface& other) { if (this != &other) { LineSurface::operator=(other); m_bounds = other.m_bounds; @@ -48,18 +53,24 @@ Acts::StrawSurface& Acts::StrawSurface::operator=(const StrawSurface& other) { return *this; } -std::shared_ptr<Acts::StrawSurface> Acts::StrawSurface::clone( - const GeometryContext& gctx, const Transform3D& shift) const { +std::shared_ptr<Acts::StrawSurface> +Acts::StrawSurface::clone(const GeometryContext& gctx, const Transform3D& shift) + const { return std::shared_ptr<StrawSurface>(this->clone_impl(gctx, shift)); } -Acts::StrawSurface* Acts::StrawSurface::clone_impl( - const GeometryContext& gctx, const Transform3D& shift) const { +Acts::StrawSurface* +Acts::StrawSurface::clone_impl( + const GeometryContext& gctx, + const Transform3D& shift) const { return new StrawSurface(gctx, *this, shift); } -Acts::PolyhedronRepresentation Acts::StrawSurface::polyhedronRepresentation( - const GeometryContext& gctx, size_t l0div, size_t /*l1div*/) const { +Acts::PolyhedronRepresentation +Acts::StrawSurface::polyhedronRepresentation( + const GeometryContext& gctx, + size_t l0div, + size_t /*l1div*/) const { std::vector<Vector3D> vertices; std::vector<std::vector<size_t>> faces; diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index a4e605e5e..777ff1e67 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -30,8 +30,10 @@ Acts::Surface::Surface(const Surface& other) m_transform(other.m_transform), m_surfaceMaterial(other.m_surfaceMaterial) {} -Acts::Surface::Surface(const GeometryContext& gctx, const Surface& other, - const Transform3D& shift) +Acts::Surface::Surface( + const GeometryContext& gctx, + const Surface& other, + const Transform3D& shift) : GeometryObject(), m_transform(std::make_shared<const Transform3D>( Transform3D(shift * other.transform(gctx)))), @@ -40,9 +42,12 @@ Acts::Surface::Surface(const GeometryContext& gctx, const Surface& other, Acts::Surface::~Surface() = default; -bool Acts::Surface::isOnSurface(const GeometryContext& gctx, - const Vector3D& gpos, const Vector3D& gmom, - const BoundaryCheck& bcheck) const { +bool +Acts::Surface::isOnSurface( + const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + const BoundaryCheck& bcheck) const { // create the local position Vector2D lpos; // global to local transformation @@ -54,15 +59,18 @@ bool Acts::Surface::isOnSurface(const GeometryContext& gctx, return false; } -std::shared_ptr<Acts::Surface> Acts::Surface::getSharedPtr() { +std::shared_ptr<Acts::Surface> +Acts::Surface::getSharedPtr() { return shared_from_this(); } -std::shared_ptr<const Acts::Surface> Acts::Surface::getSharedPtr() const { +std::shared_ptr<const Acts::Surface> +Acts::Surface::getSharedPtr() const { return shared_from_this(); } -Acts::Surface& Acts::Surface::operator=(const Surface& other) { +Acts::Surface& +Acts::Surface::operator=(const Surface& other) { if (&other != this) { GeometryObject::operator=(other); // detector element, identifier & layer association are unique @@ -74,7 +82,8 @@ Acts::Surface& Acts::Surface::operator=(const Surface& other) { return *this; } -bool Acts::Surface::operator==(const Surface& other) const { +bool +Acts::Surface::operator==(const Surface& other) const { // (a) fast exit for pointer comparison if (&other == this) { return true; @@ -107,8 +116,8 @@ bool Acts::Surface::operator==(const Surface& other) const { } // overload dump for stream operator -std::ostream& Acts::Surface::toStream(const GeometryContext& gctx, - std::ostream& sl) const { +std::ostream& +Acts::Surface::toStream(const GeometryContext& gctx, std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(4); sl << name() << std::endl; @@ -131,6 +140,7 @@ std::ostream& Acts::Surface::toStream(const GeometryContext& gctx, return sl; } -bool Acts::Surface::operator!=(const Acts::Surface& sf) const { +bool +Acts::Surface::operator!=(const Acts::Surface& sf) const { return !(operator==(sf)); } diff --git a/Core/src/Surfaces/SurfaceArray.cpp b/Core/src/Surfaces/SurfaceArray.cpp index c1bf681f3..172d63462 100644 --- a/Core/src/Surfaces/SurfaceArray.cpp +++ b/Core/src/Surfaces/SurfaceArray.cpp @@ -32,8 +32,9 @@ Acts::SurfaceArray::SurfaceArray(std::shared_ptr<const Surface> srf) m_surfacesRawPointers.push_back(m_surfaces.at(0).get()); } -std::ostream& Acts::SurfaceArray::toStream(const GeometryContext& /*gctx*/, - std::ostream& sl) const { +std::ostream& +Acts::SurfaceArray::toStream(const GeometryContext& /*gctx*/, std::ostream& sl) + const { sl << std::fixed << std::setprecision(4); sl << "SurfaceArray:" << std::endl; sl << " - no surfaces: " << m_surfaces.size() << std::endl; diff --git a/Core/src/Surfaces/TrapezoidBounds.cpp b/Core/src/Surfaces/TrapezoidBounds.cpp index 6c5f12b2a..9f308957e 100644 --- a/Core/src/Surfaces/TrapezoidBounds.cpp +++ b/Core/src/Surfaces/TrapezoidBounds.cpp @@ -16,8 +16,10 @@ #include <iomanip> #include <iostream> -Acts::TrapezoidBounds::TrapezoidBounds(double minhalex, double maxhalex, - double haley) +Acts::TrapezoidBounds::TrapezoidBounds( + double minhalex, + double maxhalex, + double haley) : m_minHalfX(std::abs(minhalex)), m_maxHalfX(std::abs(maxhalex)), m_halfY(std::abs(haley)), @@ -25,15 +27,18 @@ Acts::TrapezoidBounds::TrapezoidBounds(double minhalex, double maxhalex, Acts::TrapezoidBounds::~TrapezoidBounds() = default; -Acts::TrapezoidBounds* Acts::TrapezoidBounds::clone() const { +Acts::TrapezoidBounds* +Acts::TrapezoidBounds::clone() const { return new TrapezoidBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::TrapezoidBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::TrapezoidBounds::type() const { return SurfaceBounds::Trapezoid; } -std::vector<TDD_real_t> Acts::TrapezoidBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::TrapezoidBounds::valueStore() const { std::vector<TDD_real_t> values(TrapezoidBounds::bv_length); values[TrapezoidBounds::bv_minHalfX] = minHalflengthX(); values[TrapezoidBounds::bv_maxHalfX] = maxHalflengthX(); @@ -41,17 +46,20 @@ std::vector<TDD_real_t> Acts::TrapezoidBounds::valueStore() const { return values; } -bool Acts::TrapezoidBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { +bool +Acts::TrapezoidBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { return bcheck.isInside(lpos, vertices()); } -double Acts::TrapezoidBounds::distanceToBoundary( - const Acts::Vector2D& lpos) const { +double +Acts::TrapezoidBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { return BoundaryCheck(true).distance(lpos, vertices()); } -std::vector<Acts::Vector2D> Acts::TrapezoidBounds::vertices() const { +std::vector<Acts::Vector2D> +Acts::TrapezoidBounds::vertices() const { // counter-clockwise from bottom-right corner return {{minHalflengthX(), -halflengthY()}, {maxHalflengthX(), halflengthY()}, @@ -59,11 +67,13 @@ std::vector<Acts::Vector2D> Acts::TrapezoidBounds::vertices() const { {-minHalflengthX(), -halflengthY()}}; } -const Acts::RectangleBounds& Acts::TrapezoidBounds::boundingBox() const { +const Acts::RectangleBounds& +Acts::TrapezoidBounds::boundingBox() const { return m_boundingBox; } -std::ostream& Acts::TrapezoidBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::TrapezoidBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::TrapezoidBounds: (minHlengthX, maxHlengthX, hlengthY) = " diff --git a/Core/src/Surfaces/TriangleBounds.cpp b/Core/src/Surfaces/TriangleBounds.cpp index 779289cb3..e2f0eb05f 100644 --- a/Core/src/Surfaces/TriangleBounds.cpp +++ b/Core/src/Surfaces/TriangleBounds.cpp @@ -28,15 +28,18 @@ Acts::TriangleBounds::TriangleBounds(const std::array<Vector2D, 3>& vertices) Acts::TriangleBounds::~TriangleBounds() = default; -Acts::TriangleBounds* Acts::TriangleBounds::clone() const { +Acts::TriangleBounds* +Acts::TriangleBounds::clone() const { return new TriangleBounds(*this); } -Acts::SurfaceBounds::BoundsType Acts::TriangleBounds::type() const { +Acts::SurfaceBounds::BoundsType +Acts::TriangleBounds::type() const { return SurfaceBounds::Triangle; } -std::vector<TDD_real_t> Acts::TriangleBounds::valueStore() const { +std::vector<TDD_real_t> +Acts::TriangleBounds::valueStore() const { std::vector<TDD_real_t> values(TriangleBounds::bv_length); values[TriangleBounds::bv_x1] = m_vertices[0].x(); values[TriangleBounds::bv_y1] = m_vertices[0].y(); @@ -47,26 +50,31 @@ std::vector<TDD_real_t> Acts::TriangleBounds::valueStore() const { return values; } -bool Acts::TriangleBounds::inside(const Acts::Vector2D& lpos, - const Acts::BoundaryCheck& bcheck) const { +bool +Acts::TriangleBounds::inside( + const Acts::Vector2D& lpos, + const Acts::BoundaryCheck& bcheck) const { return bcheck.isInside(lpos, m_vertices); } -double Acts::TriangleBounds::distanceToBoundary( - const Acts::Vector2D& lpos) const { +double +Acts::TriangleBounds::distanceToBoundary(const Acts::Vector2D& lpos) const { return BoundaryCheck(true).distance(lpos, m_vertices); } -std::vector<Acts::Vector2D> Acts::TriangleBounds::vertices() const { +std::vector<Acts::Vector2D> +Acts::TriangleBounds::vertices() const { return {std::begin(m_vertices), std::end(m_vertices)}; } -const Acts::RectangleBounds& Acts::TriangleBounds::boundingBox() const { +const Acts::RectangleBounds& +Acts::TriangleBounds::boundingBox() const { return m_boundingBox; } // ostream operator overload -std::ostream& Acts::TriangleBounds::toStream(std::ostream& sl) const { +std::ostream& +Acts::TriangleBounds::toStream(std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::TriangleBounds: generating vertices (X, Y)"; diff --git a/Core/src/Utilities/Logger.cpp b/Core/src/Utilities/Logger.cpp index a18e67092..ea0f40744 100644 --- a/Core/src/Utilities/Logger.cpp +++ b/Core/src/Utilities/Logger.cpp @@ -10,9 +10,11 @@ namespace Acts { -std::unique_ptr<const Logger> getDefaultLogger(const std::string& name, - const Logging::Level& lvl, - std::ostream* log_stream) { +std::unique_ptr<const Logger> +getDefaultLogger( + const std::string& name, + const Logging::Level& lvl, + std::ostream* log_stream) { using namespace Logging; auto output = std::make_unique<LevelOutputDecorator>( std::make_unique<NamedOutputDecorator>( diff --git a/Core/src/Vertexing/FsmwMode1dFinder.cpp b/Core/src/Vertexing/FsmwMode1dFinder.cpp index 9041d0d13..c4b75d773 100644 --- a/Core/src/Vertexing/FsmwMode1dFinder.cpp +++ b/Core/src/Vertexing/FsmwMode1dFinder.cpp @@ -15,7 +15,8 @@ Acts::FsmwMode1dFinder::FsmwMode1dFinder(double firstFraction, double fraction) : m_firstFraction(firstFraction), m_fraction(fraction) {} -Acts::Result<double> Acts::FsmwMode1dFinder::getMode( +Acts::Result<double> +Acts::FsmwMode1dFinder::getMode( std::vector<std::pair<double, double>> inputVector) const { if (inputVector.empty()) { return VertexingError::EmptyInput; @@ -26,10 +27,12 @@ Acts::Result<double> Acts::FsmwMode1dFinder::getMode( // first of all order the vector according to the double value - std::sort(inputVector.begin(), inputVector.end(), - [](std::pair<double, double> a, std::pair<double, double> b) { - return a.first < b.first; - }); + std::sort( + inputVector.begin(), + inputVector.end(), + [](std::pair<double, double> a, std::pair<double, double> b) { + return a.first < b.first; + }); // begin to consider a certain number of elements according to the fraction auto begin = inputVector.begin(); diff --git a/Core/src/Vertexing/ImpactPoint3dEstimator.cpp b/Core/src/Vertexing/ImpactPoint3dEstimator.cpp index c53c4f13f..b25a09cce 100644 --- a/Core/src/Vertexing/ImpactPoint3dEstimator.cpp +++ b/Core/src/Vertexing/ImpactPoint3dEstimator.cpp @@ -8,8 +8,10 @@ #include "Acts/Vertexing/ImpactPoint3dEstimator.hpp" -double Acts::ImpactPoint3dEstimator::calculateDistance( - const BoundParameters& params, const Vector3D& refPos) const { +double +Acts::ImpactPoint3dEstimator::calculateDistance( + const BoundParameters& params, + const Vector3D& refPos) const { // normalized momentum const Vector3D normMomentum = params.momentum().normalized(); diff --git a/Legacy/include/Acts/Propagator/AtlasStepper.hpp b/Legacy/include/Acts/Propagator/AtlasStepper.hpp index bbba29426..a95d7b20c 100644 --- a/Legacy/include/Acts/Propagator/AtlasStepper.hpp +++ b/Legacy/include/Acts/Propagator/AtlasStepper.hpp @@ -61,10 +61,12 @@ class AtlasStepper { /// @param[in] ndir The navigation direction w.r.t. parameters /// @param[in] ssize the steps size limitation template <typename Parameters> - State(std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx, - const Parameters& pars, NavigationDirection ndir = forward, - double ssize = std::numeric_limits<double>::max()) + State( + std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx, + const Parameters& pars, + NavigationDirection ndir = forward, + double ssize = std::numeric_limits<double>::max()) : state_ready(false), navDir(ndir), useJacobian(false), @@ -310,31 +312,39 @@ class AtlasStepper { /// @param [in,out] state is the stepper state associated with the track /// the magnetic field cell is used (and potentially updated) /// @param [in] pos is the field position - Vector3D getField(State& state, const Vector3D& pos) const { + Vector3D + getField(State& state, const Vector3D& pos) const { // get the field from the cell state.field = m_bField.getField(pos, state.fieldCache); return state.field; } - Vector3D position(const State& state) const { + Vector3D + position(const State& state) const { return Vector3D(state.pVector[0], state.pVector[1], state.pVector[2]); } - Vector3D direction(const State& state) const { + Vector3D + direction(const State& state) const { return Vector3D(state.pVector[4], state.pVector[5], state.pVector[6]); } - double momentum(const State& state) const { + double + momentum(const State& state) const { return 1. / std::abs(state.pVector[7]); } /// Charge access - double charge(const State& state) const { + double + charge(const State& state) const { return state.pVector[7] > 0. ? 1. : -1.; } /// Time access - double time(const State& state) const { return state.t0 + state.pVector[3]; } + double + time(const State& state) const { + return state.t0 + state.pVector[3]; + } /// Tests if the state reached a surface /// @@ -342,9 +352,10 @@ class AtlasStepper { /// @param [in] surface Surface that is tested /// /// @return Boolean statement if surface is reached by state - bool surfaceReached(const State& state, const Surface* surface) const { - return surface->isOnSurface(state.geoContext, position(state), - direction(state), true); + bool + surfaceReached(const State& state, const Surface* surface) const { + return surface->isOnSurface( + state.geoContext, position(state), direction(state), true); } /// Create and return the bound state at the current position @@ -359,8 +370,8 @@ class AtlasStepper { /// - the parameters at the surface /// - the stepwise jacobian towards it /// - and the path length (from start - for ordering) - BoundState boundState(State& state, const Surface& surface, - bool /*unused*/) const { + BoundState + boundState(State& state, const Surface& surface, bool /*unused*/) const { // the convert method invalidates the state (in case it's reused) state.state_ready = false; @@ -377,12 +388,17 @@ class AtlasStepper { } // Fill the end parameters - BoundParameters parameters(state.geoContext, std::move(cov), gp, mom, - charge(state), state.t0 + state.pVector[3], - surface.getSharedPtr()); - - return BoundState(std::move(parameters), state.jacobian, - state.pathAccumulated); + BoundParameters parameters( + state.geoContext, + std::move(cov), + gp, + mom, + charge(state), + state.t0 + state.pVector[3], + surface.getSharedPtr()); + + return BoundState( + std::move(parameters), state.jacobian, state.pathAccumulated); } /// Create and return a curvilinear state at the current position @@ -396,7 +412,8 @@ class AtlasStepper { /// - the curvilinear parameters at given position /// - the stepweise jacobian towards it /// - and the path length (from start - for ordering) - CurvilinearState curvilinearState(State& state, bool /*unused*/) const { + CurvilinearState + curvilinearState(State& state, bool /*unused*/) const { // the convert method invalidates the state (in case it's reused) state.state_ready = false; // @@ -410,18 +427,19 @@ class AtlasStepper { cov = std::make_unique<const Covariance>(state.cov); } - CurvilinearParameters parameters(std::move(cov), gp, mom, charge(state), - state.t0 + state.pVector[3]); + CurvilinearParameters parameters( + std::move(cov), gp, mom, charge(state), state.t0 + state.pVector[3]); - return CurvilinearState(std::move(parameters), state.jacobian, - state.pathAccumulated); + return CurvilinearState( + std::move(parameters), state.jacobian, state.pathAccumulated); } /// The state update method /// /// @param [in,out] state The stepper state for /// @param [in] pars The new track parameters at start - void update(State& state, const BoundParameters& pars) const { + void + update(State& state, const BoundParameters& pars) const { // state is ready - noting to do if (state.state_ready) { return; @@ -591,8 +609,13 @@ class AtlasStepper { /// @param uposition the updated position /// @param udirection the updated direction /// @param p the updated momentum value - void update(State& state, const Vector3D& uposition, - const Vector3D& udirection, double up, double time) const { + void + update( + State& state, + const Vector3D& uposition, + const Vector3D& udirection, + double up, + double time) const { // update the vector state.pVector[0] = uposition[0]; state.pVector[1] = uposition[1]; @@ -605,7 +628,8 @@ class AtlasStepper { } /// Return a corrector - VoidIntersectionCorrector corrector(State& /*unused*/) const { + VoidIntersectionCorrector + corrector(State& /*unused*/) const { return VoidIntersectionCorrector(); } @@ -618,7 +642,8 @@ class AtlasStepper { /// reinitialized at the new position /// /// @return the full transport jacobian - void covarianceTransport(State& state, bool /*unused*/) const { + void + covarianceTransport(State& state, bool /*unused*/) const { double P[59]; for (unsigned int i = 0; i < 59; ++i) { P[i] = state.pVector[i]; @@ -768,8 +793,9 @@ class AtlasStepper { /// @param [in] surface is the surface to which the covariance is forwarded to /// @param [in] reinitialize is a flag to steer whether the state should be /// reinitialized at the new position - void covarianceTransport(State& state, const Surface& surface, - bool /*unused*/) const { + void + covarianceTransport(State& state, const Surface& surface, bool /*unused*/) + const { Acts::Vector3D gp(state.pVector[0], state.pVector[1], state.pVector[2]); Acts::Vector3D mom(state.pVector[4], state.pVector[5], state.pVector[6]); mom /= std::abs(state.pVector[7]); @@ -936,7 +962,8 @@ class AtlasStepper { if (surface.type() == Surface::Disc) { // the vector from the disc surface to the p const auto& sfc = surface.center(state.geoContext); - double d[3] = {state.pVector[0] - sfc(0), state.pVector[1] - sfc(1), + double d[3] = {state.pVector[0] - sfc(0), + state.pVector[1] - sfc(1), state.pVector[2] - sfc(2)}; // this needs the transformation to polar coordinates double RC = d[0] * Ax[0] + d[1] * Ax[1] + d[2] * Ax[2]; @@ -1021,7 +1048,8 @@ class AtlasStepper { /// /// @param state is the provided stepper state (caller keeps thread locality) template <typename propagator_state_t> - Result<double> step(propagator_state_t& state) const { + Result<double> + step(propagator_state_t& state) const { // we use h for keeping the nominclature with the original atlas code double h = state.stepping.stepSize; bool Jac = state.stepping.useJacobian; diff --git a/Legacy/include/Acts/Seeding/AtlasSeedfinder.hpp b/Legacy/include/Acts/Seeding/AtlasSeedfinder.hpp index e5b0a39ff..8787ace74 100644 --- a/Legacy/include/Acts/Seeding/AtlasSeedfinder.hpp +++ b/Legacy/include/Acts/Seeding/AtlasSeedfinder.hpp @@ -203,21 +203,30 @@ class AtlasSeedfinder { SPForSeed<SpacePoint>* newSpacePoint(SpacePoint* const&); - void newOneSeed(SPForSeed<SpacePoint>*&, SPForSeed<SpacePoint>*&, - SPForSeed<SpacePoint>*&, float, float); - - void newOneSeedWithCurvaturesComparison(SPForSeed<SpacePoint>*&, - SPForSeed<SpacePoint>*&, float); + void newOneSeed( + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + float, + float); + + void newOneSeedWithCurvaturesComparison( + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + float); void fillSeeds(); void fillLists(); void erase(); void production3Sp(); - void production3Sp(typename std::list<SPForSeed<SpacePoint>*>::iterator*, - typename std::list<SPForSeed<SpacePoint>*>::iterator*, - typename std::list<SPForSeed<SpacePoint>*>::iterator*, - typename std::list<SPForSeed<SpacePoint>*>::iterator*, int, - int, int&); + void production3Sp( + typename std::list<SPForSeed<SpacePoint>*>::iterator*, + typename std::list<SPForSeed<SpacePoint>*>::iterator*, + typename std::list<SPForSeed<SpacePoint>*>::iterator*, + typename std::list<SPForSeed<SpacePoint>*>::iterator*, + int, + int, + int&); void findNext(); bool isZCompatible(float&); @@ -229,7 +238,8 @@ class AtlasSeedfinder { /////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline const Seed<SpacePoint>* AtlasSeedfinder<SpacePoint>::next() { +inline const Seed<SpacePoint>* +AtlasSeedfinder<SpacePoint>::next() { do { if (i_seed == i_seede) { findNext(); @@ -243,7 +253,8 @@ inline const Seed<SpacePoint>* AtlasSeedfinder<SpacePoint>::next() { } template <typename SpacePoint> -inline bool AtlasSeedfinder<SpacePoint>::isZCompatible(float& Zv) { +inline bool +AtlasSeedfinder<SpacePoint>::isZCompatible(float& Zv) { if (Zv < m_zminU || Zv > m_zmaxU) { return false; } else { @@ -256,8 +267,8 @@ inline bool AtlasSeedfinder<SpacePoint>::isZCompatible(float& Zv) { /////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline SPForSeed<SpacePoint>* AtlasSeedfinder<SpacePoint>::newSpacePoint( - SpacePoint* const& sp) { +inline SPForSeed<SpacePoint>* +AtlasSeedfinder<SpacePoint>::newSpacePoint(SpacePoint* const& sp) { SPForSeed<SpacePoint>* sps; float r[3]; @@ -291,7 +302,8 @@ inline SPForSeed<SpacePoint>* AtlasSeedfinder<SpacePoint>::newSpacePoint( class comCurvature { public: template <typename SpacePoint> - bool operator()( + bool + operator()( const std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>& i1, const std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>& i2) { return i1.first < i2.first; diff --git a/Legacy/include/Acts/Seeding/AtlasSeedfinder.ipp b/Legacy/include/Acts/Seeding/AtlasSeedfinder.ipp index 243256054..d1d7106d5 100644 --- a/Legacy/include/Acts/Seeding/AtlasSeedfinder.ipp +++ b/Legacy/include/Acts/Seeding/AtlasSeedfinder.ipp @@ -149,9 +149,11 @@ Acts::Legacy::AtlasSeedfinder<SpacePoint>::~AtlasSeedfinder() { /////////////////////////////////////////////////////////////////// template <typename SpacePoint> template <class RandIter> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::newEvent(int iteration, - RandIter spBegin, - RandIter spEnd) { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::newEvent( + int iteration, + RandIter spBegin, + RandIter spEnd) { iteration <= 0 ? m_iteration = 0 : m_iteration = iteration; erase(); m_dzdrmin = m_dzdrmin0; @@ -220,7 +222,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::newEvent(int iteration, /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::find3Sp() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::find3Sp() { m_zminU = m_zmin; m_zmaxU = m_zmax; @@ -242,7 +245,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::find3Sp() { // Find next set space points /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::findNext() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::findNext() { if (m_endlist) { return; } @@ -260,7 +264,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::findNext() { // Initiate frame work for seed generator /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::buildFrameWork() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::buildFrameWork() { m_ptmin = fabs(m_ptmin); if (m_ptmin < 100.) { @@ -443,7 +448,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::buildFrameWork() { // Initiate beam frame work for seed generator /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::buildBeamFrameWork() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::buildBeamFrameWork() { double bx = m_config.beamPosX; double by = m_config.beamPosY; double bz = m_config.beamPosZ; @@ -457,8 +463,10 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::buildBeamFrameWork() { // Initiate beam frame work for seed generator /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::convertToBeamFrameWork( - SpacePoint* const& sp, float* r) { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::convertToBeamFrameWork( + SpacePoint* const& sp, + float* r) { r[0] = float(sp->x) - m_xbeam; r[1] = float(sp->y) - m_ybeam; r[2] = float(sp->z) - m_zbeam; @@ -468,7 +476,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::convertToBeamFrameWork( // Initiate space points seed maker /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::fillLists() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::fillLists() { const float pi2 = 2. * M_PI; typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator r, re; @@ -559,7 +568,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::fillLists() { // Erase space point information /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::erase() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::erase() { for (int i = 0; i != m_nrfz; ++i) { int n = rfz_index[i]; rfz_map[n] = 0; @@ -576,7 +586,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::erase() { // Production 3 space points seeds /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::production3Sp() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::production3Sp() { // if less than 3 sp in total if (m_nsaz < 3) { return; @@ -640,12 +651,15 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::production3Sp() { // Production 3 space points seeds for full scan /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::production3Sp( +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::production3Sp( typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator* rb, typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator* rbe, typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator* rt, typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator* rte, - int NB, int NT, int& nseed) { + int NB, + int NT, + int& nseed) { typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator r0 = rb[0], r; if (!m_endlist) { @@ -880,10 +894,13 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::production3Sp( // New 3 space points pro seeds /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::newOneSeed( +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::newOneSeed( Acts::Legacy::SPForSeed<SpacePoint>*& p1, Acts::Legacy::SPForSeed<SpacePoint>*& p2, - Acts::Legacy::SPForSeed<SpacePoint>*& p3, float z, float q) { + Acts::Legacy::SPForSeed<SpacePoint>*& p3, + float z, + float q) { // if the number of seeds already in m_OneSeeds does not exceed m_maxOneSize // then insert the current SP into m_mapOneSeeds and m_OneSeeds. if (m_nOneSeeds < m_maxOneSize) { @@ -899,9 +916,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::newOneSeed( // Then remove all entries after the newly inserted entry equal to the new // seed. else { - typename std::multimap< - float, Acts::Legacy::InternalSeed<SpacePoint>*>::reverse_iterator l = - m_mapOneSeeds.rbegin(); + typename std::multimap<float, Acts::Legacy::InternalSeed<SpacePoint>*>:: + reverse_iterator l = m_mapOneSeeds.rbegin(); if ((*l).first <= q) { return; @@ -910,9 +926,8 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::newOneSeed( Acts::Legacy::InternalSeed<SpacePoint>* s = (*l).second; s->set(p1, p2, p3, z); - typename std::multimap< - float, Acts::Legacy::InternalSeed<SpacePoint>*>::iterator i = - m_mapOneSeeds.insert(std::make_pair(q, s)); + typename std::multimap<float, Acts::Legacy::InternalSeed<SpacePoint>*>:: + iterator i = m_mapOneSeeds.insert(std::make_pair(q, s)); for (++i; i != m_mapOneSeeds.end(); ++i) { if ((*i).second == s) { @@ -927,10 +942,11 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>::newOneSeed( // New 3 space points pro seeds production /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>:: - newOneSeedWithCurvaturesComparison( - Acts::Legacy::SPForSeed<SpacePoint>*& SPb, - Acts::Legacy::SPForSeed<SpacePoint>*& SP0, float Zob) { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::newOneSeedWithCurvaturesComparison( + Acts::Legacy::SPForSeed<SpacePoint>*& SPb, + Acts::Legacy::SPForSeed<SpacePoint>*& SP0, + float Zob) { // allowed (1/helixradius)-delta between 2 seeds const float dC = .00003; @@ -1035,13 +1051,13 @@ void Acts::Legacy::AtlasSeedfinder<SpacePoint>:: // Fill seeds /////////////////////////////////////////////////////////////////// template <class SpacePoint> -void Acts::Legacy::AtlasSeedfinder<SpacePoint>::fillSeeds() { +void +Acts::Legacy::AtlasSeedfinder<SpacePoint>::fillSeeds() { m_fillOneSeeds = 0; - typename std::multimap<float, Acts::Legacy::InternalSeed<SpacePoint> - *>::iterator lf = m_mapOneSeeds.begin(), - l = m_mapOneSeeds.begin(), - le = m_mapOneSeeds.end(); + typename std::multimap<float, Acts::Legacy::InternalSeed<SpacePoint>*>:: + iterator lf = m_mapOneSeeds.begin(), + l = m_mapOneSeeds.begin(), le = m_mapOneSeeds.end(); if (l == le) { return; diff --git a/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp b/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp index 932f6edd5..72266664f 100644 --- a/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp +++ b/Legacy/include/Acts/Seeding/LegacyInternalSeed.hpp @@ -24,20 +24,41 @@ class InternalSeed { public: InternalSeed(); - InternalSeed(SPForSeed<SpacePoint>*&, SPForSeed<SpacePoint>*&, - SPForSeed<SpacePoint>*&, float); + InternalSeed( + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + float); InternalSeed(const InternalSeed<SpacePoint>&); virtual ~InternalSeed(); InternalSeed<SpacePoint>& operator=(const InternalSeed<SpacePoint>&); - SPForSeed<SpacePoint>* spacepoint0() { return m_s0; } - SPForSeed<SpacePoint>* spacepoint1() { return m_s1; } - SPForSeed<SpacePoint>* spacepoint2() { return m_s2; } - const float& z() const { return m_z; } - const float& quality() const { return m_q; } + SPForSeed<SpacePoint>* + spacepoint0() { + return m_s0; + } + SPForSeed<SpacePoint>* + spacepoint1() { + return m_s1; + } + SPForSeed<SpacePoint>* + spacepoint2() { + return m_s2; + } + const float& + z() const { + return m_z; + } + const float& + quality() const { + return m_q; + } - void set(SPForSeed<SpacePoint>*&, SPForSeed<SpacePoint>*&, - SPForSeed<SpacePoint>*&, float); + void set( + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + SPForSeed<SpacePoint>*&, + float); bool setQuality(float); @@ -65,8 +86,8 @@ inline InternalSeed<SpacePoint>::InternalSeed() { } template <typename SpacePoint> -inline InternalSeed<SpacePoint>& InternalSeed<SpacePoint>::operator=( - const InternalSeed& sp) { +inline InternalSeed<SpacePoint>& +InternalSeed<SpacePoint>::operator=(const InternalSeed& sp) { if (&sp != this) { m_z = sp.m_z; m_q = sp.m_q; @@ -78,10 +99,11 @@ inline InternalSeed<SpacePoint>& InternalSeed<SpacePoint>::operator=( } template <typename SpacePoint> -inline InternalSeed<SpacePoint>::InternalSeed(SPForSeed<SpacePoint>*& s0, - SPForSeed<SpacePoint>*& s1, - SPForSeed<SpacePoint>*& s2, - float z) { +inline InternalSeed<SpacePoint>::InternalSeed( + SPForSeed<SpacePoint>*& s0, + SPForSeed<SpacePoint>*& s1, + SPForSeed<SpacePoint>*& s2, + float z) { set(s0, s1, s2, z); m_q = 0.; } @@ -108,9 +130,12 @@ inline InternalSeed<SpacePoint>::~InternalSeed() {} ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline void InternalSeed<SpacePoint>::set(SPForSeed<SpacePoint>*& s0, - SPForSeed<SpacePoint>*& s1, - SPForSeed<SpacePoint>*& s2, float z) { +inline void +InternalSeed<SpacePoint>::set( + SPForSeed<SpacePoint>*& s0, + SPForSeed<SpacePoint>*& s1, + SPForSeed<SpacePoint>*& s2, + float z) { m_z = z; m_s0 = s0; m_s1 = s1; @@ -122,7 +147,8 @@ inline void InternalSeed<SpacePoint>::set(SPForSeed<SpacePoint>*& s0, ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline bool InternalSeed<SpacePoint>::set3(Acts::Legacy::Seed<SpacePoint>& s) { +inline bool +InternalSeed<SpacePoint>::set3(Acts::Legacy::Seed<SpacePoint>& s) { bool pixb = !m_s0->spacepoint->clusterList().second; bool pixt = !m_s2->spacepoint->clusterList().second; @@ -150,7 +176,8 @@ inline bool InternalSeed<SpacePoint>::set3(Acts::Legacy::Seed<SpacePoint>& s) { ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline bool InternalSeed<SpacePoint>::setQuality(float q) { +inline bool +InternalSeed<SpacePoint>::setQuality(float q) { m_q = q; bool pixb = !m_s0->spacepoint->clusterList().second; bool pixt = !m_s2->spacepoint->clusterList().second; diff --git a/Legacy/include/Acts/Seeding/LegacySeed.hpp b/Legacy/include/Acts/Seeding/LegacySeed.hpp index 98f0396f1..d257bbbb9 100644 --- a/Legacy/include/Acts/Seeding/LegacySeed.hpp +++ b/Legacy/include/Acts/Seeding/LegacySeed.hpp @@ -48,28 +48,32 @@ class Seed { ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline const std::list<const SpacePoint*>& Seed<SpacePoint>::spacePoints() - const { +inline const std::list<const SpacePoint*>& +Seed<SpacePoint>::spacePoints() const { return this->m_spacepoints; } template <typename SpacePoint> -inline void Seed<SpacePoint>::erase() { +inline void +Seed<SpacePoint>::erase() { m_spacepoints.erase(m_spacepoints.begin(), m_spacepoints.end()); } template <typename SpacePoint> -inline void Seed<SpacePoint>::add(const SpacePoint*& p) { +inline void +Seed<SpacePoint>::add(const SpacePoint*& p) { m_spacepoints.push_back(p); } template <typename SpacePoint> -inline void Seed<SpacePoint>::setZVertex(const double& z) { +inline void +Seed<SpacePoint>::setZVertex(const double& z) { m_zvertex = z; } template <typename SpacePoint> -inline const double& Seed<SpacePoint>::zVertex() const { +inline const double& +Seed<SpacePoint>::zVertex() const { return m_zvertex; } @@ -84,7 +88,8 @@ Seed<SpacePoint>::Seed(const Seed<SpacePoint>& s) { } template <typename SpacePoint> -Seed<SpacePoint>& Seed<SpacePoint>::operator=(const Seed<SpacePoint>& s) { +Seed<SpacePoint>& +Seed<SpacePoint>::operator=(const Seed<SpacePoint>& s) { m_spacepoints = s.spacePoints(); m_zvertex = s.zVertex(); return *this; @@ -94,8 +99,11 @@ template <typename SpacePoint> Seed<SpacePoint>::Seed() {} template <typename SpacePoint> -Seed<SpacePoint>::Seed(const SpacePoint* b, const SpacePoint* m, - const SpacePoint* u, const double vertex) { +Seed<SpacePoint>::Seed( + const SpacePoint* b, + const SpacePoint* m, + const SpacePoint* u, + const double vertex) { m_zvertex = vertex; m_spacepoints.push_back(b); m_spacepoints.push_back(m); diff --git a/Legacy/include/Acts/Seeding/SPForSeed.hpp b/Legacy/include/Acts/Seeding/SPForSeed.hpp index e2a9f00e8..73d58d7c8 100644 --- a/Legacy/include/Acts/Seeding/SPForSeed.hpp +++ b/Legacy/include/Acts/Seeding/SPForSeed.hpp @@ -51,17 +51,47 @@ class SPForSeed { void setParam(const float&); const SpacePoint* spacepoint; - const float& x() const { return m_x; } - const float& y() const { return m_y; } - const float& z() const { return m_z; } - const float& radius() const { return m_r; } - float phi() const { return atan2(m_y, m_x); } - const float& covr() const { return m_covr; } - const float& covz() const { return m_covz; } - const float& param() const { return m_param; } - const float& quality() const { return m_q; } - - const int& surface() const { return m_surface; } + const float& + x() const { + return m_x; + } + const float& + y() const { + return m_y; + } + const float& + z() const { + return m_z; + } + const float& + radius() const { + return m_r; + } + float + phi() const { + return atan2(m_y, m_x); + } + const float& + covr() const { + return m_covr; + } + const float& + covz() const { + return m_covz; + } + const float& + param() const { + return m_param; + } + const float& + quality() const { + return m_q; + } + + const int& + surface() const { + return m_surface; + } protected: float m_x; // x-coordinate in beam system coordinates @@ -94,8 +124,8 @@ inline SPForSeed<SpacePoint>::SPForSeed() { } template <typename SpacePoint> -inline SPForSeed<SpacePoint>& SPForSeed<SpacePoint>::operator=( - const SPForSeed<SpacePoint>& sp) { +inline SPForSeed<SpacePoint>& +SPForSeed<SpacePoint>::operator=(const SPForSeed<SpacePoint>& sp) { if (&sp != this) { spacepoint = sp.spacepoint; m_x = sp.m_x; @@ -116,8 +146,10 @@ inline SPForSeed<SpacePoint>::SPForSeed(SpacePoint* const& sp, const float* r) { } template <typename SpacePoint> -inline SPForSeed<SpacePoint>::SPForSeed(SpacePoint* const& sp, const float* r, - const float* sc) { +inline SPForSeed<SpacePoint>::SPForSeed( + SpacePoint* const& sp, + const float* r, + const float* sc) { set(sp, r, sc); m_param = 0.; } @@ -143,7 +175,8 @@ inline SPForSeed<SpacePoint>::~SPForSeed() {} ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline void SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r) { +inline void +SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r) { spacepoint = sp; m_x = r[0]; m_y = r[1]; @@ -182,8 +215,11 @@ inline void SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r) { ///////////////////////////////////////////////////////////////////////////////// template <typename SpacePoint> -inline void SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r, - const float* sc) { +inline void +SPForSeed<SpacePoint>::set( + SpacePoint* const& sp, + const float* r, + const float* sc) { spacepoint = sp; m_x = r[0]; m_y = r[1]; @@ -237,11 +273,13 @@ inline void SPForSeed<SpacePoint>::set(SpacePoint* const& sp, const float* r, // } } template <typename SpacePoint> -inline void SPForSeed<SpacePoint>::setParam(const float& p) { +inline void +SPForSeed<SpacePoint>::setParam(const float& p) { m_param = p; } template <typename SpacePoint> -inline void SPForSeed<SpacePoint>::setQuality(float q) { +inline void +SPForSeed<SpacePoint>::setQuality(float q) { if (q <= m_q) { m_q = q; } diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp index e8cedff61..ffa4d10df 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp @@ -222,52 +222,63 @@ class ActsExtension : public IActsExtension { std::shared_ptr<const DigitizationModule> m_digitizationModule{nullptr}; }; -inline bool ActsExtension::isBeampipe() const { +inline bool +ActsExtension::isBeampipe() const { return m_cfg.isBeampipe; } -inline bool ActsExtension::isBarrel() const { +inline bool +ActsExtension::isBarrel() const { return m_cfg.isBarrel; } -inline bool ActsExtension::isEndcap() const { +inline bool +ActsExtension::isEndcap() const { return m_cfg.isEndcap; } -inline bool ActsExtension::isLayer() const { +inline bool +ActsExtension::isLayer() const { return m_cfg.isLayer; } -inline bool ActsExtension::hasSupportMaterial() const { +inline bool +ActsExtension::hasSupportMaterial() const { if ((m_cfg.materialBins1 > 0) || (m_cfg.materialBins2 > 0)) { return true; } return false; } -inline std::pair<size_t, size_t> ActsExtension::materialBins() const { - std::pair<size_t, size_t> materialBins(m_cfg.materialBins1, - m_cfg.materialBins2); +inline std::pair<size_t, size_t> +ActsExtension::materialBins() const { + std::pair<size_t, size_t> materialBins( + m_cfg.materialBins1, m_cfg.materialBins2); return (materialBins); } -inline Acts::LayerMaterialPos ActsExtension::layerMaterialPosition() const { +inline Acts::LayerMaterialPos +ActsExtension::layerMaterialPosition() const { return m_cfg.layerMaterialPosition; } -inline const std::string ActsExtension::axes() const { +inline const std::string +ActsExtension::axes() const { return m_cfg.axes; } -inline bool ActsExtension::buildEnvelope() const { +inline bool +ActsExtension::buildEnvelope() const { return ((m_cfg.envelopeR > 0.) && (m_cfg.envelopeZ > 0.)); } -inline double ActsExtension::envelopeR() const { +inline double +ActsExtension::envelopeR() const { return (m_cfg.envelopeR); } -inline double ActsExtension::envelopeZ() const { +inline double +ActsExtension::envelopeZ() const { return (m_cfg.envelopeR); } diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp index bcb7646c4..e99850016 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp @@ -21,11 +21,14 @@ namespace Acts { /// Sort function which sorts dd4hep::DetElement by their ID /// @param[in][out] det the dd4hep::DetElements to be sorted -void sortDetElementsByID(std::vector<dd4hep::DetElement>& det) { - sort(det.begin(), det.end(), - [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); +void +sortDetElementsByID(std::vector<dd4hep::DetElement>& det) { + sort( + det.begin(), + det.end(), + [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { + return (a.id() < b.id()); + }); } /// @brief Global method which creates the TrackingGeometry from DD4hep input @@ -83,8 +86,10 @@ void sortDetElementsByID(std::vector<dd4hep::DetElement>& det) { std::unique_ptr<const TrackingGeometry> convertDD4hepDetector( dd4hep::DetElement worldDetElement, Logging::Level loggingLevel = Logging::Level::INFO, - BinningType bTypePhi = equidistant, BinningType bTypeR = equidistant, - BinningType bTypeZ = equidistant, double layerEnvelopeR = UnitConstants::mm, + BinningType bTypePhi = equidistant, + BinningType bTypeR = equidistant, + BinningType bTypeZ = equidistant, + double layerEnvelopeR = UnitConstants::mm, double layerEnvelopeZ = UnitConstants::mm, double defaultLayerThickness = UnitConstants::fm, const std::function<void(std::vector<dd4hep::DetElement>& detectors)>& @@ -133,8 +138,10 @@ std::unique_ptr<const TrackingGeometry> convertDD4hepDetector( std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( dd4hep::DetElement subDetector, Logging::Level loggingLevel = Logging::Level::INFO, - BinningType bTypePhi = equidistant, BinningType bTypeR = equidistant, - BinningType bTypeZ = equidistant, double layerEnvelopeR = UnitConstants::mm, + BinningType bTypePhi = equidistant, + BinningType bTypeR = equidistant, + BinningType bTypeZ = equidistant, + double layerEnvelopeR = UnitConstants::mm, double layerEnvelopeZ = UnitConstants::mm, double defaultLayerThickness = UnitConstants::fm); @@ -150,8 +157,9 @@ std::shared_ptr<const CylinderVolumeHelper> cylinderVolumeHelper_dd4hep( /// detectors should be collected /// @param [out] subdetectors the DD4hep::DetElements of the sub detectors /// contained by detElement -void collectSubDetectors_dd4hep(dd4hep::DetElement& detElement, - std::vector<dd4hep::DetElement>& subdetectors); +void collectSubDetectors_dd4hep( + dd4hep::DetElement& detElement, + std::vector<dd4hep::DetElement>& subdetectors); /// Method internally used by convertDD4hepDetector to collect all volumes of a /// compound detector @@ -159,14 +167,16 @@ void collectSubDetectors_dd4hep(dd4hep::DetElement& detElement, /// compounds should be collected /// @param [out] compounds the DD4hep::DetElements of the compounds contained by /// detElement -void collectCompounds_dd4hep(dd4hep::DetElement& detElement, - std::vector<dd4hep::DetElement>& compounds); +void collectCompounds_dd4hep( + dd4hep::DetElement& detElement, + std::vector<dd4hep::DetElement>& compounds); /// Method internally used by convertDD4hepDetector /// @param [in] detElement the dd4hep::DetElement of the volume of which the /// layers should be collected /// @param [out] layers the DD4hep::DetElements of the layers contained by /// detElement -void collectLayers_dd4hep(dd4hep::DetElement& detElement, - std::vector<dd4hep::DetElement>& layers); +void collectLayers_dd4hep( + dd4hep::DetElement& detElement, + std::vector<dd4hep::DetElement>& layers); } // namespace Acts diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp index 58b86df84..289bfa95a 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp @@ -73,8 +73,10 @@ class DD4hepDetectorElement : public TGeoDetectorElement { /// translated into a cylindrical surface. /// @param material Possible material of detector element DD4hepDetectorElement( - const dd4hep::DetElement detElement, const std::string& axes = "XYZ", - double scalor = 1., bool isDisc = false, + const dd4hep::DetElement detElement, + const std::string& axes = "XYZ", + double scalor = 1., + bool isDisc = false, std::shared_ptr<const ISurfaceMaterial> material = nullptr, std::shared_ptr<const DigitizationModule> digitizationModule = nullptr); diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp index 36b025b5e..9f2ef59ec 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp @@ -78,8 +78,9 @@ class DD4hepLayerBuilder : public ILayerBuilder { /// Constructor /// @param config is the configuration struct /// @param logger is the logging instance - DD4hepLayerBuilder(const Acts::DD4hepLayerBuilder::Config& config, - std::unique_ptr<const Logger> logger); + DD4hepLayerBuilder( + const Acts::DD4hepLayerBuilder::Config& config, + std::unique_ptr<const Logger> logger); /// Destructor ~DD4hepLayerBuilder() override; @@ -126,7 +127,10 @@ class DD4hepLayerBuilder : public ILayerBuilder { std::unique_ptr<const Logger> m_logger; /// Private access to the logger - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// Private helper function collecting all sensitive detector elements of a /// layer @@ -148,7 +152,8 @@ class DD4hepLayerBuilder : public ILayerBuilder { /// as disc (e.g. for endcaps) this flag should be set to true /// @param axes the orientation of the modules to the Acts frame std::shared_ptr<const Acts::Surface> createSensitiveSurface( - const dd4hep::DetElement& detElement, bool isDisc = false, + const dd4hep::DetElement& detElement, + bool isDisc = false, const std::string& axes = "XYZ") const; // Private helper function to convert the TGeo transformation matrix into @@ -159,11 +164,13 @@ class DD4hepLayerBuilder : public ILayerBuilder { const TGeoMatrix* tGeoTrans) const; }; -inline const std::string& DD4hepLayerBuilder::identification() const { +inline const std::string& +DD4hepLayerBuilder::identification() const { return m_cfg.configurationName; } -inline DD4hepLayerBuilder::Config DD4hepLayerBuilder::getConfiguration() const { +inline DD4hepLayerBuilder::Config +DD4hepLayerBuilder::getConfiguration() const { return m_cfg; } diff --git a/Plugins/DD4hep/src/ActsExtension.cpp b/Plugins/DD4hep/src/ActsExtension.cpp index 7f5198dba..6479c758a 100644 --- a/Plugins/DD4hep/src/ActsExtension.cpp +++ b/Plugins/DD4hep/src/ActsExtension.cpp @@ -22,8 +22,9 @@ Acts::ActsExtension::ActsExtension(const Config& cfg) setConfiguration(cfg); } -Acts::ActsExtension::ActsExtension(const ActsExtension& det, - const dd4hep::DetElement& /*elem*/) +Acts::ActsExtension::ActsExtension( + const ActsExtension& det, + const dd4hep::DetElement& /*elem*/) : Acts::IActsExtension(), m_cfg(det.m_cfg), m_material(det.m_material) {} Acts::ActsExtension::ActsExtension( @@ -43,7 +44,8 @@ Acts::ActsExtension::ActsExtension( for (auto& mat : materials) { Acts::Material pm{float(mat.first.radLength() * UnitConstants::cm), float(mat.first.intLength() * UnitConstants::cm), - float(mat.first.A()), float(mat.first.Z()), + float(mat.first.A()), + float(mat.first.Z()), float(mat.first.density() / pow(UnitConstants::cm, 3))}; partialMaterial.push_back( Acts::MaterialProperties(pm, mat.second * UnitConstants::mm)); @@ -53,7 +55,8 @@ Acts::ActsExtension::ActsExtension( m_material = std::make_shared<Acts::HomogeneousSurfaceMaterial>(matprop); } -void Acts::ActsExtension::setConfiguration( +void +Acts::ActsExtension::setConfiguration( const Acts::ActsExtension::Config& config) { // @todo check consistency // copy the configuration diff --git a/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp b/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp index 9ecc3ed65..331acb7a9 100644 --- a/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp +++ b/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp @@ -24,10 +24,16 @@ #include "TGeoManager.h" namespace Acts { -std::unique_ptr<const TrackingGeometry> convertDD4hepDetector( - dd4hep::DetElement worldDetElement, Logging::Level loggingLevel, - BinningType bTypePhi, BinningType bTypeR, BinningType bTypeZ, - double layerEnvelopeR, double layerEnvelopeZ, double defaultLayerThickness, +std::unique_ptr<const TrackingGeometry> +convertDD4hepDetector( + dd4hep::DetElement worldDetElement, + Logging::Level loggingLevel, + BinningType bTypePhi, + BinningType bTypeR, + BinningType bTypeZ, + double layerEnvelopeR, + double layerEnvelopeZ, + double defaultLayerThickness, const std::function<void(std::vector<dd4hep::DetElement>& detectors)>& sortSubDetectors, const Acts::GeometryContext& gctx) { @@ -53,8 +59,14 @@ std::unique_ptr<const TrackingGeometry> convertDD4hepDetector( for (auto& subDetector : subDetectors) { // create volume builder auto volBuilder = volumeBuilder_dd4hep( - subDetector, loggingLevel, bTypePhi, bTypeR, bTypeZ, layerEnvelopeR, - layerEnvelopeZ, defaultLayerThickness); + subDetector, + loggingLevel, + bTypePhi, + bTypeR, + bTypeZ, + layerEnvelopeR, + layerEnvelopeZ, + defaultLayerThickness); if (volBuilder) { // distinguish beam pipe if (volBuilder->getConfiguration().buildToRadiusZero) { @@ -81,15 +93,17 @@ std::unique_ptr<const TrackingGeometry> convertDD4hepDetector( } std::vector<std::function<std::shared_ptr<TrackingVolume>( - const GeometryContext&, const TrackingVolumePtr&, + const GeometryContext&, + const TrackingVolumePtr&, const VolumeBoundsPtr&)>> volumeFactories; for (const auto& vb : volumeBuilders) { volumeFactories.push_back( - [vb](const GeometryContext& vgctx, - const std::shared_ptr<const TrackingVolume>& inner, - const VolumeBoundsPtr&) { + [vb]( + const GeometryContext& vgctx, + const std::shared_ptr<const TrackingVolume>& inner, + const VolumeBoundsPtr&) { return vb->trackingVolume(vgctx, inner); }); } @@ -105,10 +119,15 @@ std::unique_ptr<const TrackingGeometry> convertDD4hepDetector( return (trackingGeometryBuilder->trackingGeometry(gctx)); } -std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( - dd4hep::DetElement subDetector, Logging::Level loggingLevel, - BinningType bTypePhi, BinningType bTypeR, BinningType bTypeZ, - double layerEnvelopeR, double layerEnvelopeZ, +std::shared_ptr<const CylinderVolumeBuilder> +volumeBuilder_dd4hep( + dd4hep::DetElement subDetector, + Logging::Level loggingLevel, + BinningType bTypePhi, + BinningType bTypeR, + BinningType bTypeZ, + double layerEnvelopeR, + double layerEnvelopeZ, double defaultLayerThickness) { // create cylinder volume helper auto volumeHelper = cylinderVolumeHelper_dd4hep(); @@ -124,12 +143,13 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( } catch (std::runtime_error& e) { } if (subDetector.type() == "compound") { - ACTS_VERBOSE("[D] Subdetector : '" - << subDetector.name() - << "' has no ActsExtension and has type compound - " - "handling as a compound volume (a hierachy of a " - "barrel-endcap structure) and resolving the " - "subvolumes..."); + ACTS_VERBOSE( + "[D] Subdetector : '" + << subDetector.name() + << "' has no ActsExtension and has type compound - " + "handling as a compound volume (a hierachy of a " + "barrel-endcap structure) and resolving the " + "subvolumes..."); // Now create the Layerbuilders and Volumebuilder // the layers /// the dd4hep::DetElements of the layers of the negative volume @@ -150,9 +170,10 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( bool pEndCap = false; bool barrel = false; for (auto& volumeDetElement : compounds) { - ACTS_VERBOSE("[V] Volume : '" - << subDetector.name() - << "'is a compound volume -> resolve now the sub volumes"); + ACTS_VERBOSE( + "[V] Volume : '" + << subDetector.name() + << "'is a compound volume -> resolve now the sub volumes"); // get the dimensions of the volume TGeoShape* geoShape = @@ -165,9 +186,9 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( ->GetTranslation()[2] * UnitConstants::cm; } else { - throw std::logic_error(std::string("Volume of DetElement: ") + - volumeDetElement.name() + - std::string(" has no shape!")); + throw std::logic_error( + std::string("Volume of DetElement: ") + volumeDetElement.name() + + std::string(" has no shape!")); } // check if it has a volume extension telling if it is a barrel or an // endcap @@ -218,9 +239,10 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( "hierarchy."); } barrel = true; - ACTS_VERBOSE("[V] Subvolume : " - << volumeDetElement.name() - << " is a cylinder volume -> handling as a barrel"); + ACTS_VERBOSE( + "[V] Subvolume : " + << volumeDetElement.name() + << " is a cylinder volume -> handling as a barrel"); collectLayers_dd4hep(volumeDetElement, centralLayers); } else { throw std::logic_error( @@ -266,8 +288,11 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( dd4hep::Material ddmaterial = subDetector.volume().material(); auto volumeMaterial = std::make_shared<const Acts::HomogeneousVolumeMaterial>(Acts::Material( - ddmaterial.radLength(), ddmaterial.intLength(), ddmaterial.A(), - ddmaterial.Z(), ddmaterial.density())); + ddmaterial.radLength(), + ddmaterial.intLength(), + ddmaterial.A(), + ddmaterial.Z(), + ddmaterial.density())); // the configuration object of the volume builder Acts::CylinderVolumeBuilder::Config cvbConfig; @@ -289,9 +314,9 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( return cylinderVolumeBuilder; } else if ((subDetExtension != nullptr) && subDetExtension->isBeampipe()) { - ACTS_VERBOSE("[D] Subdetector : " - << subDetector.name() - << " is the beampipe - building beam pipe."); + ACTS_VERBOSE( + "[D] Subdetector : " << subDetector.name() + << " is the beampipe - building beam pipe."); // get the dimensions of the volume TGeoShape* geoShape = subDetector.placement().ptr()->GetVolume()->GetShape(); @@ -313,8 +338,10 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( dd4hep::Material ddmaterial = subDetector.volume().material(); Acts::MaterialProperties bpMaterial( ddmaterial.radLength() * UnitConstants::cm, - ddmaterial.intLength() * UnitConstants::cm, ddmaterial.A(), - ddmaterial.Z(), ddmaterial.density() / pow(Acts::UnitConstants::cm, 3), + ddmaterial.intLength() * UnitConstants::cm, + ddmaterial.A(), + ddmaterial.Z(), + ddmaterial.density() / pow(Acts::UnitConstants::cm, 3), fabs(tube->GetRmax() - tube->GetRmin()) * UnitConstants::cm); // configure the beam pipe layer builder @@ -341,15 +368,16 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( // beam pipe volume builder auto beamPipeVolumeBuilder = std::make_shared<const Acts::CylinderVolumeBuilder>( - cvbConfig, Acts::getDefaultLogger( - subDetector.name() + std::string("VolumdeBuilder"), - loggingLevel)); + cvbConfig, + Acts::getDefaultLogger( + subDetector.name() + std::string("VolumdeBuilder"), + loggingLevel)); return beamPipeVolumeBuilder; } else if ((subDetExtension != nullptr) && subDetExtension->isBarrel()) { - ACTS_VERBOSE("[D] Subdetector: " - << subDetector.name() - << " is a Barrel volume - building barrel."); + ACTS_VERBOSE( + "[D] Subdetector: " << subDetector.name() + << " is a Barrel volume - building barrel."); /// the dd4hep::DetElements of the layers of the central volume std::vector<dd4hep::DetElement> centralLayers; collectLayers_dd4hep(subDetector, centralLayers); @@ -381,9 +409,9 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( subDetector.placement().ptr()->GetVolume()->GetShape(); // this should not happen if (geoShape == nullptr) { - throw std::logic_error(std::string("Volume of DetElement: ") + - subDetector.name() + - std::string(" has no a shape!")); + throw std::logic_error( + std::string("Volume of DetElement: ") + subDetector.name() + + std::string(" has no a shape!")); } // get the possible material @@ -391,8 +419,11 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( dd4hep::Material ddmaterial = subDetector.volume().material(); auto volumeMaterial = std::make_shared<const Acts::HomogeneousVolumeMaterial>(Acts::Material( - ddmaterial.radLength(), ddmaterial.intLength(), ddmaterial.A(), - ddmaterial.Z(), ddmaterial.density())); + ddmaterial.radLength(), + ddmaterial.intLength(), + ddmaterial.A(), + ddmaterial.Z(), + ddmaterial.density())); cvbConfig.layerEnvelopeR = std::make_pair(layerEnvelopeR, layerEnvelopeR); cvbConfig.layerEnvelopeZ = layerEnvelopeZ; cvbConfig.trackingVolumeHelper = volumeHelper; @@ -421,8 +452,8 @@ std::shared_ptr<const CylinderVolumeBuilder> volumeBuilder_dd4hep( } } -std::shared_ptr<const Acts::CylinderVolumeHelper> cylinderVolumeHelper_dd4hep( - Logging::Level loggingLevel) { +std::shared_ptr<const Acts::CylinderVolumeHelper> +cylinderVolumeHelper_dd4hep(Logging::Level loggingLevel) { // create cylindervolumehelper which can be used by all instances // hand over LayerArrayCreator Acts::LayerArrayCreator::Config lacConfig; @@ -445,8 +476,10 @@ std::shared_ptr<const Acts::CylinderVolumeHelper> cylinderVolumeHelper_dd4hep( return cylinderVolumeHelper; } -void collectCompounds_dd4hep(dd4hep::DetElement& detElement, - std::vector<dd4hep::DetElement>& compounds) { +void +collectCompounds_dd4hep( + dd4hep::DetElement& detElement, + std::vector<dd4hep::DetElement>& compounds) { const dd4hep::DetElement::Children& children = detElement.children(); for (auto& child : children) { dd4hep::DetElement childDetElement = child.second; @@ -464,8 +497,10 @@ void collectCompounds_dd4hep(dd4hep::DetElement& detElement, } } -void collectSubDetectors_dd4hep(dd4hep::DetElement& detElement, - std::vector<dd4hep::DetElement>& subdetectors) { +void +collectSubDetectors_dd4hep( + dd4hep::DetElement& detElement, + std::vector<dd4hep::DetElement>& subdetectors) { const dd4hep::DetElement::Children& children = detElement.children(); for (auto& child : children) { dd4hep::DetElement childDetElement = child.second; @@ -487,8 +522,10 @@ void collectSubDetectors_dd4hep(dd4hep::DetElement& detElement, } } -void collectLayers_dd4hep(dd4hep::DetElement& detElement, - std::vector<dd4hep::DetElement>& layers) { +void +collectLayers_dd4hep( + dd4hep::DetElement& detElement, + std::vector<dd4hep::DetElement>& layers) { const dd4hep::DetElement::Children& children = detElement.children(); for (auto& child : children) { dd4hep::DetElement childDetElement = child.second; diff --git a/Plugins/DD4hep/src/DD4hepDetectorElement.cpp b/Plugins/DD4hep/src/DD4hepDetectorElement.cpp index 0dffde9e6..947b7885e 100644 --- a/Plugins/DD4hep/src/DD4hepDetectorElement.cpp +++ b/Plugins/DD4hep/src/DD4hepDetectorElement.cpp @@ -14,12 +14,19 @@ #include "DD4hep/CartesianGridXY.h" Acts::DD4hepDetectorElement::DD4hepDetectorElement( - const dd4hep::DetElement detElement, const std::string& axes, double scalor, - bool isDisc, std::shared_ptr<const Acts::ISurfaceMaterial> material, + const dd4hep::DetElement detElement, + const std::string& axes, + double scalor, + bool isDisc, + std::shared_ptr<const Acts::ISurfaceMaterial> material, std::shared_ptr<const Acts::DigitizationModule> digitizationModule) - : Acts::TGeoDetectorElement(Identifier(detElement.volumeID()), - detElement.nominal().worldTransformation(), - detElement.placement().ptr(), axes, scalor, - isDisc, std::move(material), - std::move(digitizationModule)), + : Acts::TGeoDetectorElement( + Identifier(detElement.volumeID()), + detElement.nominal().worldTransformation(), + detElement.placement().ptr(), + axes, + scalor, + isDisc, + std::move(material), + std::move(digitizationModule)), m_detElement(std::move(detElement)) {} diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 66bde8126..fa7364c51 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -40,13 +40,14 @@ Acts::DD4hepLayerBuilder::DD4hepLayerBuilder( Acts::DD4hepLayerBuilder::~DD4hepLayerBuilder() = default; -void Acts::DD4hepLayerBuilder::setConfiguration( +void +Acts::DD4hepLayerBuilder::setConfiguration( const Acts::DD4hepLayerBuilder::Config& config) { m_cfg = config; } -const Acts::LayerVector Acts::DD4hepLayerBuilder::negativeLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::DD4hepLayerBuilder::negativeLayers(const GeometryContext& gctx) const { LayerVector layers; if (m_cfg.negativeLayers.empty()) { ACTS_VERBOSE("[L] No layers handed over for negative volume."); @@ -140,10 +141,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::negativeLayers( std::pair<size_t, size_t> materialBins = detExtension->materialBins(); size_t bins1 = materialBins.first; size_t bins2 = materialBins.second; - Acts::BinUtility materialBinUtil(bins1, -M_PI, M_PI, Acts::closed, - Acts::binPhi); - materialBinUtil += Acts::BinUtility(bins2, pl.minR, pl.maxR, Acts::open, - Acts::binR, transform); + Acts::BinUtility materialBinUtil( + bins1, -M_PI, M_PI, Acts::closed, Acts::binPhi); + materialBinUtil += Acts::BinUtility( + bins2, pl.minR, pl.maxR, Acts::open, Acts::binR, transform); // and create material proxy to mark layer for material mapping materialProxy = std::make_shared<const ProtoSurfaceMaterial>(materialBinUtil); @@ -173,15 +174,17 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::negativeLayers( std::shared_ptr<Acts::DiscSurface> innerBoundary = Surface::makeShared<Acts::DiscSurface>( - std::make_shared<const Transform3D>(Translation3D(innerPos) * - transform->rotation()), - pl.minR, pl.maxR); + std::make_shared<const Transform3D>( + Translation3D(innerPos) * transform->rotation()), + pl.minR, + pl.maxR); std::shared_ptr<Acts::DiscSurface> outerBoundary = Surface::makeShared<Acts::DiscSurface>( - std::make_shared<const Transform3D>(Translation3D(outerPos) * - transform->rotation()), - pl.minR, pl.maxR); + std::make_shared<const Transform3D>( + Translation3D(outerPos) * transform->rotation()), + pl.minR, + pl.maxR); std::shared_ptr<Acts::DiscSurface> centralSurface = Surface::makeShared<Acts::DiscSurface>(transform, pl.minR, pl.maxR); @@ -222,13 +225,22 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::negativeLayers( auto dBounds = std::make_shared<const RadialBounds>(pl.minR, pl.maxR); double thickness = std::fabs(pl.maxZ - pl.minZ); // Create the layer containing the sensitive surface - negativeLayer = - DiscLayer::create(transform, dBounds, std::move(sArray), thickness, - std::move(approachDescriptor), Acts::active); + negativeLayer = DiscLayer::create( + transform, + dBounds, + std::move(sArray), + thickness, + std::move(approachDescriptor), + Acts::active); } else { negativeLayer = m_cfg.layerCreator->discLayer( - gctx, layerSurfaces, m_cfg.bTypeR, m_cfg.bTypePhi, pl, transform, + gctx, + layerSurfaces, + m_cfg.bTypeR, + m_cfg.bTypePhi, + pl, + transform, std::move(approachDescriptor)); } @@ -239,12 +251,13 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::negativeLayers( if (!boost::iequals(ddmaterial.name(), "vacuum")) { Material layerMaterial( ddmaterial.radLength() * Acts::UnitConstants::cm, - ddmaterial.intLength() * Acts::UnitConstants::cm, ddmaterial.A(), + ddmaterial.intLength() * Acts::UnitConstants::cm, + ddmaterial.A(), ddmaterial.Z(), ddmaterial.density() / pow(Acts::UnitConstants::cm, 3)); - MaterialProperties materialProperties(layerMaterial, - fabs(pl.maxR - pl.minR)); + MaterialProperties materialProperties( + layerMaterial, fabs(pl.maxR - pl.minR)); surfMaterial = std::make_shared<const HomogeneousSurfaceMaterial>( materialProperties); @@ -260,8 +273,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::negativeLayers( return layers; } -const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::DD4hepLayerBuilder::centralLayers(const GeometryContext& gctx) const { LayerVector layers; if (m_cfg.centralLayers.empty()) { ACTS_VERBOSE("[L] No layers handed over for central volume!"); @@ -362,10 +375,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( size_t bins1 = materialBins.first; size_t bins2 = materialBins.second; - Acts::BinUtility materialBinUtil(bins1, -M_PI, M_PI, Acts::closed, - Acts::binPhi); - materialBinUtil += Acts::BinUtility(bins2, -halfZ, halfZ, Acts::open, - Acts::binZ, transform); + Acts::BinUtility materialBinUtil( + bins1, -M_PI, M_PI, Acts::closed, Acts::binPhi); + materialBinUtil += Acts::BinUtility( + bins2, -halfZ, halfZ, Acts::open, Acts::binZ, transform); // and create material proxy to mark layer for material mapping materialProxy = std::make_shared<const ProtoSurfaceMaterial>(materialBinUtil); @@ -418,12 +431,21 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( new CylinderBounds(layerR, halfZ)); // Create the layer containing the sensitive surface centralLayer = CylinderLayer::create( - transform, cBounds, std::move(sArray), thickness, - std::move(approachDescriptor), Acts::active); + transform, + cBounds, + std::move(sArray), + thickness, + std::move(approachDescriptor), + Acts::active); } else { centralLayer = m_cfg.layerCreator->cylinderLayer( - gctx, layerSurfaces, m_cfg.bTypePhi, m_cfg.bTypeZ, pl, transform, + gctx, + layerSurfaces, + m_cfg.bTypePhi, + m_cfg.bTypeZ, + pl, + transform, std::move(approachDescriptor)); } @@ -434,12 +456,13 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( if (!boost::iequals(ddmaterial.name(), "vacuum")) { Material layerMaterial( ddmaterial.radLength() * Acts::UnitConstants::cm, - ddmaterial.intLength() * Acts::UnitConstants::cm, ddmaterial.A(), + ddmaterial.intLength() * Acts::UnitConstants::cm, + ddmaterial.A(), ddmaterial.Z(), ddmaterial.density() / pow(Acts::UnitConstants::cm, 3)); - MaterialProperties materialProperties(layerMaterial, - fabs(pl.maxR - pl.minR)); + MaterialProperties materialProperties( + layerMaterial, fabs(pl.maxR - pl.minR)); surfMaterial = std::make_shared<const HomogeneousSurfaceMaterial>( materialProperties); @@ -456,8 +479,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( return layers; } -const Acts::LayerVector Acts::DD4hepLayerBuilder::positiveLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::DD4hepLayerBuilder::positiveLayers(const GeometryContext& gctx) const { LayerVector layers; if (m_cfg.positiveLayers.empty()) { ACTS_VERBOSE("[L] No layers handed over for positive volume!"); @@ -551,10 +574,10 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::positiveLayers( std::pair<size_t, size_t> materialBins = detExtension->materialBins(); size_t bins1 = materialBins.first; size_t bins2 = materialBins.second; - Acts::BinUtility materialBinUtil(bins1, -M_PI, M_PI, Acts::closed, - Acts::binPhi); - materialBinUtil += Acts::BinUtility(bins2, pl.minR, pl.maxR, Acts::open, - Acts::binR, transform); + Acts::BinUtility materialBinUtil( + bins1, -M_PI, M_PI, Acts::closed, Acts::binPhi); + materialBinUtil += Acts::BinUtility( + bins2, pl.minR, pl.maxR, Acts::open, Acts::binR, transform); // and create material proxy to mark layer for material mapping materialProxy = std::make_shared<const ProtoSurfaceMaterial>(materialBinUtil); @@ -583,14 +606,16 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::positiveLayers( } auto innerBoundary = Surface::makeShared<Acts::DiscSurface>( - std::make_shared<const Transform3D>(Translation3D(innerPos) * - transform->rotation()), - pl.minR, pl.maxR); + std::make_shared<const Transform3D>( + Translation3D(innerPos) * transform->rotation()), + pl.minR, + pl.maxR); auto outerBoundary = Surface::makeShared<Acts::DiscSurface>( - std::make_shared<const Transform3D>(Translation3D(outerPos) * - transform->rotation()), - pl.minR, pl.maxR); + std::make_shared<const Transform3D>( + Translation3D(outerPos) * transform->rotation()), + pl.minR, + pl.maxR); auto centralSurface = Surface::makeShared<Acts::DiscSurface>(transform, pl.minR, pl.maxR); @@ -630,13 +655,22 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::positiveLayers( auto dBounds = std::make_shared<const RadialBounds>(pl.minR, pl.maxR); double thickness = std::fabs(pl.maxZ - pl.minZ); // Create the layer containing the sensitive surface - positiveLayer = - DiscLayer::create(transform, dBounds, std::move(sArray), thickness, - std::move(approachDescriptor), Acts::active); + positiveLayer = DiscLayer::create( + transform, + dBounds, + std::move(sArray), + thickness, + std::move(approachDescriptor), + Acts::active); } else { positiveLayer = m_cfg.layerCreator->discLayer( - gctx, layerSurfaces, m_cfg.bTypeR, m_cfg.bTypePhi, pl, transform, + gctx, + layerSurfaces, + m_cfg.bTypeR, + m_cfg.bTypePhi, + pl, + transform, std::move(approachDescriptor)); } @@ -647,12 +681,13 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::positiveLayers( if (!boost::iequals(ddmaterial.name(), "vacuum")) { Material layerMaterial( ddmaterial.radLength() * Acts::UnitConstants::cm, - ddmaterial.intLength() * Acts::UnitConstants::cm, ddmaterial.A(), + ddmaterial.intLength() * Acts::UnitConstants::cm, + ddmaterial.A(), ddmaterial.Z(), ddmaterial.density() / pow(Acts::UnitConstants::cm, 3)); - MaterialProperties materialProperties(layerMaterial, - fabs(pl.maxR - pl.minR)); + MaterialProperties materialProperties( + layerMaterial, fabs(pl.maxR - pl.minR)); surfMaterial = std::make_shared<const HomogeneousSurfaceMaterial>( materialProperties); @@ -667,7 +702,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::positiveLayers( return layers; } -void Acts::DD4hepLayerBuilder::resolveSensitive( +void +Acts::DD4hepLayerBuilder::resolveSensitive( const dd4hep::DetElement& detElement, std::vector<std::shared_ptr<const Acts::Surface>>& surfaces, const std::string& axes) const { @@ -687,7 +723,8 @@ void Acts::DD4hepLayerBuilder::resolveSensitive( std::shared_ptr<const Acts::Surface> Acts::DD4hepLayerBuilder::createSensitiveSurface( - const dd4hep::DetElement& detElement, bool isDisc, + const dd4hep::DetElement& detElement, + bool isDisc, const std::string& axes) const { // access the possible material std::shared_ptr<const Acts::ISurfaceMaterial> material = nullptr; @@ -704,8 +741,8 @@ Acts::DD4hepLayerBuilder::createSensitiveSurface( auto digiModule = detExtension->digitizationModule(); // create the corresponding detector element Acts::DD4hepDetectorElement* dd4hepDetElement = - new Acts::DD4hepDetectorElement(detElement, axes, UnitConstants::cm, - isDisc, material, digiModule); + new Acts::DD4hepDetectorElement( + detElement, axes, UnitConstants::cm, isDisc, material, digiModule); // return the surface return dd4hepDetElement->surface().getSharedPtr(); @@ -721,8 +758,9 @@ Acts::DD4hepLayerBuilder::convertTransform(const TGeoMatrix* tGeoTrans) const { Acts::Vector3D(rotation[0], rotation[3], rotation[6]), Acts::Vector3D(rotation[1], rotation[4], rotation[7]), Acts::Vector3D(rotation[2], rotation[5], rotation[8]), - Acts::Vector3D(translation[0] * UnitConstants::cm, - translation[1] * UnitConstants::cm, - translation[2] * UnitConstants::cm))); + Acts::Vector3D( + translation[0] * UnitConstants::cm, + translation[1] * UnitConstants::cm, + translation[2] * UnitConstants::cm))); return (transform); } diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp index 277dd27b9..8ed43af23 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp @@ -45,8 +45,10 @@ class CartesianSegmentation : public Segmentation { /// @param mBounds are the rectangle bounds of the sensitive volume /// @param numCellsX is the number of cells in X /// @param numCellsY is the number of cells in Y - CartesianSegmentation(const std::shared_ptr<const PlanarBounds>& mBounds, - size_t numCellsX, size_t numCellsY = 1); + CartesianSegmentation( + const std::shared_ptr<const PlanarBounds>& mBounds, + size_t numCellsX, + size_t numCellsY = 1); /// @todo contructor from BinUtilities for more complex readouts /// @@ -57,8 +59,9 @@ class CartesianSegmentation : public Segmentation { /// /// @note if both RectangleBounds and BinUtility are provided, no check is /// done for consitency - CartesianSegmentation(std::shared_ptr<const BinUtility> bUtility, - std::shared_ptr<const PlanarBounds> mBounds = nullptr); + CartesianSegmentation( + std::shared_ptr<const BinUtility> bUtility, + std::shared_ptr<const PlanarBounds> mBounds = nullptr); /// Virtual Destructor ~CartesianSegmentation() override; @@ -67,12 +70,13 @@ class CartesianSegmentation : public Segmentation { /// /// Create the segmentation surfaces in X and Y for rectangular shapes /// These are needed for a full three dimensional module - void createSegmentationSurfaces(SurfacePtrVector& boundarySurfaces, - SurfacePtrVector& segmentationSurfacesX, - SurfacePtrVector& segmentationSurfacesY, - double halfThickness, - int readoutDirection = 1., - double lorentzAngle = 0.) const final; + void createSegmentationSurfaces( + SurfacePtrVector& boundarySurfaces, + SurfacePtrVector& segmentationSurfacesX, + SurfacePtrVector& segmentationSurfacesY, + double halfThickness, + int readoutDirection = 1., + double lorentzAngle = 0.) const final; /// @copydoc Segmentation::cell DigitizationCell cell(const Vector3D& position) const final; @@ -87,11 +91,12 @@ class CartesianSegmentation : public Segmentation { /// correct for lorentz effect if needed /// /// @copydoc Segmentation::digitizationStep - DigitizationStep digitizationStep(const Vector3D& startStep, - const Vector3D& endStep, - double halfThickness, - int readoutDirection = 1, - double lorentzAngle = 0.) const final; + DigitizationStep digitizationStep( + const Vector3D& startStep, + const Vector3D& endStep, + double halfThickness, + int readoutDirection = 1, + double lorentzAngle = 0.) const final; /// return the surface bounds by reference /// specialization for Rectangle Bounds @@ -112,31 +117,35 @@ class CartesianSegmentation : public Segmentation { std::shared_ptr<const BinUtility> m_binUtility; /// bin Utility }; -inline const PlanarBounds& CartesianSegmentation::moduleBounds() const { +inline const PlanarBounds& +CartesianSegmentation::moduleBounds() const { return (*(m_activeBounds.get())); } -inline const BinUtility& CartesianSegmentation::binUtility() const { +inline const BinUtility& +CartesianSegmentation::binUtility() const { return (*(m_binUtility.get())); } template <class T> -DigitizationCell CartesianSegmentation::cellT(const T& position) const { - return DigitizationCell(m_binUtility->bin(position, 0), - m_binUtility->bin(position, 1)); +DigitizationCell +CartesianSegmentation::cellT(const T& position) const { + return DigitizationCell( + m_binUtility->bin(position, 0), m_binUtility->bin(position, 1)); } -inline DigitizationCell CartesianSegmentation::cell( - const Vector3D& position) const { +inline DigitizationCell +CartesianSegmentation::cell(const Vector3D& position) const { return cellT<Vector3D>(position); } -inline DigitizationCell CartesianSegmentation::cell( - const Vector2D& position) const { +inline DigitizationCell +CartesianSegmentation::cell(const Vector2D& position) const { return cellT<Vector2D>(position); } -inline std::pair<double, double> CartesianSegmentation::pitch() const { +inline std::pair<double, double> +CartesianSegmentation::pitch() const { auto boundingBox = m_activeBounds->boundingBox(); auto values = boundingBox.valueStore(); double pitchX = 2. * values[0] / m_binUtility->bins(0); diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/Clusterization.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/Clusterization.hpp index 66d8d7bc5..e54284846 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/Clusterization.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/Clusterization.hpp @@ -31,8 +31,10 @@ namespace Acts { /// cells which belong to each cluster) template <typename cell_t> std::vector<std::vector<cell_t>> createClusters( - std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, size_t nBins0, - bool commonCorner = true, double energyCut = 0.); + std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, + size_t nBins0, + bool commonCorner = true, + double energyCut = 0.); /// @brief fillCluster /// This function is a helper function internally used by Acts::createClusters. @@ -54,10 +56,13 @@ std::vector<std::vector<cell_t>> createClusters( /// corner should be merged into one cluster /// @param [in] energyCut possible energy cut to be applied template <typename cell_t> -void fillCluster(std::vector<std::vector<cell_t>>& mergedCells, - std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, - size_t index, size_t nBins0, bool commonCorner = true, - double energyCut = 0.); +void fillCluster( + std::vector<std::vector<cell_t>>& mergedCells, + std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, + size_t index, + size_t nBins0, + bool commonCorner = true, + double energyCut = 0.); } // namespace Acts #include "Acts/Plugins/Digitization/detail/Clusterization.ipp" diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationCell.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationCell.hpp index bc88caf53..4b8acdac0 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationCell.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationCell.hpp @@ -34,7 +34,8 @@ struct DigitizationCell { /// calculate the energy deposit differently. Furthermore this allows to apply /// an energy cut, because the energy deposit can also be stored for digital /// readout. - virtual void addCell(const DigitizationCell& dc, bool analogueReadout) { + virtual void + addCell(const DigitizationCell& dc, bool analogueReadout) { if (analogueReadout) { data += dc.data; } @@ -45,7 +46,10 @@ struct DigitizationCell { /// calculate the energy deposit differently. Furthermore this allows to apply /// an energy cut, because the energy deposit can also be stored for digital /// readout. - virtual double depositedEnergy() const { return data; } + virtual double + depositedEnergy() const { + return data; + } }; /// @brief DigitizationStep for further handling @@ -77,10 +81,14 @@ struct DigitizationStep { /// @param exitP is the exit position from the cell /// @param projectedPosition is the position on the readout surface /// @param cellPosition is the nominal position of the cell - DigitizationStep(double sl, double dl, const DigitizationCell& dc, - const Vector3D& entryP, const Vector3D& exitP, - const Vector2D& projectedPosition, - const Vector2D& cellPosition) + DigitizationStep( + double sl, + double dl, + const DigitizationCell& dc, + const Vector3D& entryP, + const Vector3D& exitP, + const Vector2D& projectedPosition, + const Vector2D& cellPosition) : stepLength(sl), driftLength(dl), stepCell(dc), diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp index bbb08cdc9..87bba3a92 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp @@ -52,10 +52,13 @@ class DigitizationModule { /// @param halfThickness is the half thickness of the module /// @param readoutDirection is the readout drift direction /// @param lorentzAngle is the lorentz drift angle - DigitizationModule(std::shared_ptr<const Segmentation> moduleSegmentation, - double halfThickness, int readoutDirection, - double lorentzAngle, double energyThreshold = 0., - bool analogue = false); + DigitizationModule( + std::shared_ptr<const Segmentation> moduleSegmentation, + double halfThickness, + int readoutDirection, + double lorentzAngle, + double energyThreshold = 0., + bool analogue = false); /// Virtual Destructor virtual ~DigitizationModule() = default; @@ -99,16 +102,18 @@ class DigitizationModule { /// @param end is the end position of the step /// /// @return stepSurfaces are the surfaces to test - const SurfacePtrVector stepSurfaces(const Vector3D& start, - const Vector3D& end) const; + const SurfacePtrVector stepSurfaces( + const Vector3D& start, + const Vector3D& end) const; /// Fill the associated digitsation cell from this start and end position, /// correct for lorentz effect if needed /// /// @param start is the start position of the step /// @param end is the end position of the step - const DigitizationStep digitizationStep(const Vector3D& start, - const Vector3D& end) const; + const DigitizationStep digitizationStep( + const Vector3D& start, + const Vector3D& end) const; /// Return the bounding surfaces inlcuding top and bottom const SurfacePtrVector& boundarySurfaces() const; @@ -142,47 +147,55 @@ class DigitizationModule { SurfacePtrVector m_segmentationSurfacesY; }; -inline double DigitizationModule::halfThickness() const { +inline double +DigitizationModule::halfThickness() const { return m_halfThickness; } -inline int DigitizationModule::readoutDirection() const { +inline int +DigitizationModule::readoutDirection() const { return m_readoutDirection; } -inline double DigitizationModule::lorentzAngle() const { +inline double +DigitizationModule::lorentzAngle() const { return m_lorentzAngle; } -inline double DigitizationModule::energyThreshold() const { +inline double +DigitizationModule::energyThreshold() const { return m_energyThreshold; } -inline bool DigitizationModule::analogue() const { +inline bool +DigitizationModule::analogue() const { return m_analogue; } -inline const Segmentation& DigitizationModule::segmentation() const { +inline const Segmentation& +DigitizationModule::segmentation() const { return (*(m_segmentation.get())); } -inline const SurfacePtrVector& DigitizationModule::boundarySurfaces() const { +inline const SurfacePtrVector& +DigitizationModule::boundarySurfaces() const { return m_boundarySurfaces; } -inline const SurfacePtrVector& DigitizationModule::segmentationSurfacesX() - const { +inline const SurfacePtrVector& +DigitizationModule::segmentationSurfacesX() const { return m_segmentationSurfacesX; } -inline const SurfacePtrVector& DigitizationModule::segmentationSurfacesY() - const { +inline const SurfacePtrVector& +DigitizationModule::segmentationSurfacesY() const { return m_segmentationSurfacesY; } -inline const DigitizationStep DigitizationModule::digitizationStep( - const Vector3D& start, const Vector3D& end) const { - return m_segmentation->digitizationStep(start, end, m_halfThickness, - m_readoutDirection, m_lorentzAngle); +inline const DigitizationStep +DigitizationModule::digitizationStep(const Vector3D& start, const Vector3D& end) + const { + return m_segmentation->digitizationStep( + start, end, m_halfThickness, m_readoutDirection, m_lorentzAngle); } } // namespace Acts diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp index 53bda6473..b15e28e92 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp @@ -25,15 +25,24 @@ struct DoubleHitSpacePoint { /// @brief Getter of the first element in @p spacePoint /// @return First element in @p spacePoint - double x() const { return spacePoint(0); } + double + x() const { + return spacePoint(0); + } /// @brief Getter of the second element in @p spacePoint /// @return Second element in @p spacePoint - double y() const { return spacePoint(1); } + double + y() const { + return spacePoint(1); + } /// @brief Getter of the third element in @p spacePoint /// @return Third element in @p spacePoint - double z() const { return spacePoint(2); } + double + z() const { + return spacePoint(2); + } }; /// @class TwoHitsSpacePointBuilder @@ -84,8 +93,9 @@ class SpacePointBuilder<DoubleHitSpacePoint> { const GeometryContext& gctx, const std::vector<const PlanarModuleCluster*>& clustersFront, const std::vector<const PlanarModuleCluster*>& clustersBack, - std::vector<std::pair<const PlanarModuleCluster*, - const PlanarModuleCluster*>>& clusterPairs) const; + std::vector< + std::pair<const PlanarModuleCluster*, const PlanarModuleCluster*>>& + clusterPairs) const; /// @brief Calculates the space points out of a given collection of clusters /// on several strip detectors and stores the data @@ -96,8 +106,9 @@ class SpacePointBuilder<DoubleHitSpacePoint> { /// @note If no configuration is set, the default values will be used void calculateSpacePoints( const GeometryContext& gctx, - const std::vector<std::pair<const PlanarModuleCluster*, - const PlanarModuleCluster*>>& clusterPairs, + const std::vector< + std::pair<const PlanarModuleCluster*, const PlanarModuleCluster*>>& + clusterPairs, std::vector<DoubleHitSpacePoint>& spacePoints) const; private: @@ -146,22 +157,24 @@ class SpacePointBuilder<DoubleHitSpacePoint> { /// @param cluster object related to the cluster that holds the necessary /// information /// @return vector of the global coordinates of the cluster - Vector3D globalCoords(const GeometryContext& gctx, - const PlanarModuleCluster& cluster) const; + Vector3D globalCoords( + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const; /// @brief Calculates (Delta theta)^2 + (Delta phi)^2 between two clusters /// @param pos1 position of the first cluster /// @param pos2 position the second cluster /// @return the squared sum within configuration parameters, otherwise -1 - double differenceOfClustersChecked(const Vector3D& pos1, - const Vector3D& pos2) const; + double differenceOfClustersChecked(const Vector3D& pos1, const Vector3D& pos2) + const; /// @brief Calculates the top and bottom ends of a SDE /// that corresponds to a given hit /// @param cluster object that stores the information about the hit /// @return vectors to the top and bottom end of the SDE std::pair<Vector3D, Vector3D> endsOfStrip( - const GeometryContext& gctx, const PlanarModuleCluster& cluster) const; + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const; /// @brief Calculates a space point whithout using the vertex /// @note This is mostly to resolve space points from cosmic data @@ -173,8 +186,11 @@ class SpacePointBuilder<DoubleHitSpacePoint> { /// 1. if it failed /// @note The meaning of the parameter is explained in more detail in the /// function body - double calcPerpProj(const Vector3D& a, const Vector3D& c, const Vector3D& q, - const Vector3D& r) const; + double calcPerpProj( + const Vector3D& a, + const Vector3D& c, + const Vector3D& q, + const Vector3D& r) const; /// @brief This function tests if a space point can be estimated by a more /// tolerant treatment of construction. In fact, this function indirectly diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleCluster.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleCluster.hpp index 471223970..d08a0d028 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleCluster.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleCluster.hpp @@ -38,14 +38,20 @@ class PlanarModuleCluster /// @param [in] loc0 is the local position in the first coordinate /// @param [in] loc1 is the local position in the second coordinate /// @param [in] dCells is the vector of digitization cells - PlanarModuleCluster(std::shared_ptr<const Surface> mSurface, - const Identifier& /*cIdentifier*/, ActsSymMatrixD<2> cov, - double loc0, double loc1, - std::vector<DigitizationCell> dCells, - const DigitizationModule* dModule = nullptr) + PlanarModuleCluster( + std::shared_ptr<const Surface> mSurface, + const Identifier& /*cIdentifier*/, + ActsSymMatrixD<2> cov, + double loc0, + double loc1, + std::vector<DigitizationCell> dCells, + const DigitizationModule* dModule = nullptr) : Measurement_t<ParDef::eLOC_0, ParDef::eLOC_1>( - std::move(mSurface), {}, // original measurement - std::move(cov), loc0, loc1), + std::move(mSurface), + {}, // original measurement + std::move(cov), + loc0, + loc1), m_digitizationCells(std::move(dCells)), m_digitizationModule(dModule) {} @@ -69,8 +75,8 @@ PlanarModuleCluster::digitizationCells() const { return m_digitizationCells; } -inline const DigitizationModule* PlanarModuleCluster::digitizationModule() - const { +inline const DigitizationModule* +PlanarModuleCluster::digitizationModule() const { return m_digitizationModule; } } // namespace Acts diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp index ed2373c29..799688878 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp @@ -30,8 +30,9 @@ class PlanarModuleStepper { /// /// @param pmsConfig is the configuration /// @param mlogger is the logging istance - PlanarModuleStepper(std::unique_ptr<const Logger> mlogger = getDefaultLogger( - "PlanarModuleStepper", Logging::INFO)); + PlanarModuleStepper( + std::unique_ptr<const Logger> mlogger = + getDefaultLogger("PlanarModuleStepper", Logging::INFO)); /// Destructor ~PlanarModuleStepper() = default; @@ -44,10 +45,11 @@ class PlanarModuleStepper { /// @param endPoint is the end postion of the stepping /// /// @return is the vector of digitization steps - std::vector<DigitizationStep> cellSteps(const GeometryContext& gctx, - const DigitizationModule& dmodule, - const Vector3D& startPoint, - const Vector3D& endPoint) const; + std::vector<DigitizationStep> cellSteps( + const GeometryContext& gctx, + const DigitizationModule& dmodule, + const Vector3D& startPoint, + const Vector3D& endPoint) const; /// Calculate the steps caused by this track - fast simulation interface /// @@ -57,21 +59,26 @@ class PlanarModuleStepper { /// @param trackDirection is the track direction at the instersection /// /// @return is the vector of digitization steps - std::vector<DigitizationStep> cellSteps(const GeometryContext& gctx, - const DigitizationModule& dmodule, - const Vector2D& moduleIntersection, - const Vector3D& trackDirection) const; + std::vector<DigitizationStep> cellSteps( + const GeometryContext& gctx, + const DigitizationModule& dmodule, + const Vector2D& moduleIntersection, + const Vector3D& trackDirection) const; /// Set logging instance /// /// @param logger is the logging instance to be set - void setLogger(std::unique_ptr<const Logger> logger) { + void + setLogger(std::unique_ptr<const Logger> logger) { m_logger = std::move(logger); } private: /// Private access method to the logging instance - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// logging instance std::unique_ptr<const Logger> m_logger; diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/Segmentation.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/Segmentation.hpp index e6fceb6b8..5353b079c 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/Segmentation.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/Segmentation.hpp @@ -53,8 +53,10 @@ class Segmentation { virtual void createSegmentationSurfaces( SurfacePtrVector& boundarySurfaces, SurfacePtrVector& segmentationSurfacesX, - SurfacePtrVector& segmentationSurfacesY, double halfThickness, - int readoutDirection, double lorentzAngle) const = 0; + SurfacePtrVector& segmentationSurfacesY, + double halfThickness, + int readoutDirection, + double lorentzAngle) const = 0; /// Get the digitization cell fropm a 3D position /// - ignores the shift, i.e. assumenes in to be in cell frame @@ -89,11 +91,12 @@ class Segmentation { /// @param lorentzAngle is the lorentz angle measured from local z towards x /// /// @return is a fully calculated digitzation step - virtual DigitizationStep digitizationStep(const Vector3D& start, - const Vector3D& end, - double halfThickness, - int readoutDirection, - double lorentzAngle) const = 0; + virtual DigitizationStep digitizationStep( + const Vector3D& start, + const Vector3D& end, + double halfThickness, + int readoutDirection, + double lorentzAngle) const = 0; /// return the surface bounds by reference virtual const SurfaceBounds& moduleBounds() const = 0; diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp index 65cb20ea2..14fc59a61 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp @@ -23,15 +23,24 @@ struct SingleHitSpacePoint { /// @brief Getter of the first element in @p spacePoint /// @return First element in @p spacePoint - double x() const { return spacePoint(0); } + double + x() const { + return spacePoint(0); + } /// @brief Getter of the second element in @p spacePoint /// @return Second element in @p spacePoint - double y() const { return spacePoint(1); } + double + y() const { + return spacePoint(1); + } /// @brief Getter of the third element in @p spacePoint /// @return Third element in @p spacePoint - double z() const { return spacePoint(2); } + double + z() const { + return spacePoint(2); + } }; /// @class OneHitSpacePointBuilder @@ -73,8 +82,9 @@ class SpacePointBuilder<SingleHitSpacePoint> { /// @param cluster object related to the cluster that holds the necessary /// information /// @return vector of the global coordinates of the cluster - Vector3D globalCoords(const GeometryContext& gctx, - const PlanarModuleCluster& cluster) const; + Vector3D globalCoords( + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const; }; } // namespace Acts diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/detail/Clusterization.ipp b/Plugins/Digitization/include/Acts/Plugins/Digitization/detail/Clusterization.ipp index bbbfe7763..079e3e93a 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/detail/Clusterization.ipp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/detail/Clusterization.ipp @@ -12,9 +12,12 @@ #include <vector> template <typename cell_t> -std::vector<std::vector<cell_t>> Acts::createClusters( - std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, size_t nBins0, - bool commonCorner, double energyCut) { +std::vector<std::vector<cell_t>> +Acts::createClusters( + std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, + size_t nBins0, + bool commonCorner, + double energyCut) { // the output std::vector<std::vector<cell_t>> mergedCells; // now go through cells and label @@ -29,8 +32,8 @@ std::vector<std::vector<cell_t>> Acts::createClusters( // set cell to be used already cell.second.second = true; // fill all cells belonging to that cluster - fillCluster(mergedCells, cellMap, cell.first, nBins0, commonCorner, - energyCut); + fillCluster( + mergedCells, cellMap, cell.first, nBins0, commonCorner, energyCut); } } // return the grouped together cells @@ -38,10 +41,14 @@ std::vector<std::vector<cell_t>> Acts::createClusters( } template <typename cell_t> -void Acts::fillCluster( +void +Acts::fillCluster( std::vector<std::vector<cell_t>>& mergedCells, - std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, size_t index, - size_t nBins0, bool commonCorner, double energyCut) { + std::unordered_map<size_t, std::pair<cell_t, bool>>& cellMap, + size_t index, + size_t nBins0, + bool commonCorner, + double energyCut) { // go recursively through all neighbours of this cell, if present // calculate neighbour indices first constexpr int iMin = -1; @@ -66,8 +73,14 @@ void Acts::fillCluster( } } else { if (commonCorner) { - neighbourIndices = {jMin + iMin, jMin, jMin + iMax, iMin, - iMax, jMax + iMin, jMax, jMax + iMax}; + neighbourIndices = {jMin + iMin, + jMin, + jMin + iMax, + iMin, + iMax, + jMax + iMin, + jMax, + jMax + iMax}; } else { neighbourIndices = {jMin, iMin, iMax, jMax}; } @@ -92,8 +105,8 @@ void Acts::fillCluster( // set cell to be used already search->second.second = true; // add all neighbours to cluster - fillCluster(mergedCells, cellMap, newIndex, nBins0, commonCorner, - energyCut); + fillCluster( + mergedCells, cellMap, newIndex, nBins0, commonCorner, energyCut); } // check if was used already } // check if neighbour is there } // go through neighbour indics diff --git a/Plugins/Digitization/src/CartesianSegmentation.cpp b/Plugins/Digitization/src/CartesianSegmentation.cpp index 41bc1b5be..21b395f0f 100644 --- a/Plugins/Digitization/src/CartesianSegmentation.cpp +++ b/Plugins/Digitization/src/CartesianSegmentation.cpp @@ -18,15 +18,22 @@ #include "Acts/Utilities/Helpers.hpp" Acts::CartesianSegmentation::CartesianSegmentation( - const std::shared_ptr<const PlanarBounds>& mBounds, size_t numCellsX, + const std::shared_ptr<const PlanarBounds>& mBounds, + size_t numCellsX, size_t numCellsY) : m_activeBounds(mBounds), m_binUtility(nullptr) { auto mutableBinUtility = std::make_shared<BinUtility>( - numCellsX, -mBounds->boundingBox().halflengthX(), - mBounds->boundingBox().halflengthX(), Acts::open, Acts::binX); - (*mutableBinUtility) += - BinUtility(numCellsY, -mBounds->boundingBox().halflengthY(), - mBounds->boundingBox().halflengthY(), Acts::open, Acts::binY); + numCellsX, + -mBounds->boundingBox().halflengthX(), + mBounds->boundingBox().halflengthX(), + Acts::open, + Acts::binX); + (*mutableBinUtility) += BinUtility( + numCellsY, + -mBounds->boundingBox().halflengthY(), + mBounds->boundingBox().halflengthY(), + Acts::open, + Acts::binY); m_binUtility = std::const_pointer_cast<const BinUtility>(mutableBinUtility); } @@ -42,10 +49,14 @@ Acts::CartesianSegmentation::CartesianSegmentation( Acts::CartesianSegmentation::~CartesianSegmentation() = default; -void Acts::CartesianSegmentation::createSegmentationSurfaces( - SurfacePtrVector& boundarySurfaces, SurfacePtrVector& segmentationSurfacesX, - SurfacePtrVector& segmentationSurfacesY, double halfThickness, - int readoutDirection, double lorentzAngle) const { +void +Acts::CartesianSegmentation::createSegmentationSurfaces( + SurfacePtrVector& boundarySurfaces, + SurfacePtrVector& segmentationSurfacesX, + SurfacePtrVector& segmentationSurfacesY, + double halfThickness, + int readoutDirection, + double lorentzAngle) const { // may be needed throughout double lorentzAngleTan = tan(lorentzAngle); double lorentzPlaneShiftX = halfThickness * lorentzAngleTan; @@ -57,9 +68,9 @@ void Acts::CartesianSegmentation::createSegmentationSurfaces( // there are some things to consider // - they share the RectangleBounds only if the lorentzAngle is 0 // otherwise only the readout surface has full length bounds like the module - std::shared_ptr<const PlanarBounds> moduleBounds( - new RectangleBounds(m_activeBounds->boundingBox().halflengthX(), - m_activeBounds->boundingBox().halflengthY())); + std::shared_ptr<const PlanarBounds> moduleBounds(new RectangleBounds( + m_activeBounds->boundingBox().halflengthX(), + m_activeBounds->boundingBox().halflengthY())); // - they are separated by half a thickness in z auto mutableReadoutPlaneTransform = std::make_shared<Transform3D>(Transform3D::Identity()); @@ -82,8 +93,8 @@ void Acts::CartesianSegmentation::createSegmentationSurfaces( double lorentzReducedHalfX = m_activeBounds->boundingBox().halflengthX() - fabs(lorentzPlaneShiftX); std::shared_ptr<const PlanarBounds> lorentzReducedBounds( - new RectangleBounds(lorentzReducedHalfX, - m_activeBounds->boundingBox().halflengthY())); + new RectangleBounds( + lorentzReducedHalfX, m_activeBounds->boundingBox().halflengthY())); counterPlaneBounds = lorentzReducedBounds; // now we shift the counter plane in position - this depends on lorentz // angle @@ -118,9 +129,9 @@ void Acts::CartesianSegmentation::createSegmentationSurfaces( std::shared_ptr<const PlanarBounds> lorentzPlaneBounds = (lorentzAngle == 0.) ? xBinBounds - : std::shared_ptr<const PlanarBounds>( - new RectangleBounds(m_activeBounds->boundingBox().halflengthY(), - lorentzPlaneHalfX)); + : std::shared_ptr<const PlanarBounds>(new RectangleBounds( + m_activeBounds->boundingBox().halflengthY(), + lorentzPlaneHalfX)); // now the rotation matrix for the xBins RotationMatrix3D xBinRotationMatrix; @@ -218,8 +229,8 @@ void Acts::CartesianSegmentation::createSegmentationSurfaces( } } -Acts::Vector2D Acts::CartesianSegmentation::cellPosition( - const DigitizationCell& dCell) const { +Acts::Vector2D +Acts::CartesianSegmentation::cellPosition(const DigitizationCell& dCell) const { double bX = m_binUtility->bins(0) > 1 ? m_binUtility->binningData()[0].center(dCell.channel0) : 0.; @@ -231,9 +242,13 @@ Acts::Vector2D Acts::CartesianSegmentation::cellPosition( /** Get the digitization cell from 3D position, it used the projection to the * readout surface to estimate the 2D positon */ -Acts::DigitizationStep Acts::CartesianSegmentation::digitizationStep( - const Vector3D& startStep, const Vector3D& endStep, double halfThickness, - int readoutDirection, double lorentzAngle) const { +Acts::DigitizationStep +Acts::CartesianSegmentation::digitizationStep( + const Vector3D& startStep, + const Vector3D& endStep, + double halfThickness, + int readoutDirection, + double lorentzAngle) const { Vector3D stepCenter = 0.5 * (startStep + endStep); // take the full drift length // this is the absolute drift in z @@ -248,6 +263,12 @@ Acts::DigitizationStep Acts::CartesianSegmentation::digitizationStep( Acts::DigitizationCell dCell = cell(stepCenterProjected); Vector2D cellCenter = cellPosition(dCell); // we are ready to return what we have - return DigitizationStep((endStep - startStep).norm(), driftLength, dCell, - startStep, endStep, stepCenterProjected, cellCenter); + return DigitizationStep( + (endStep - startStep).norm(), + driftLength, + dCell, + startStep, + endStep, + stepCenterProjected, + cellCenter); } diff --git a/Plugins/Digitization/src/DigitizationModule.cpp b/Plugins/Digitization/src/DigitizationModule.cpp index d4de333c6..8639c115a 100644 --- a/Plugins/Digitization/src/DigitizationModule.cpp +++ b/Plugins/Digitization/src/DigitizationModule.cpp @@ -16,8 +16,11 @@ Acts::DigitizationModule::DigitizationModule( std::shared_ptr<const Segmentation> moduleSegmentation, - double halfThickness, int readoutDirection, double lorentzAngle, - double energyThreshold, bool analogue) + double halfThickness, + int readoutDirection, + double lorentzAngle, + double energyThreshold, + bool analogue) : m_halfThickness(halfThickness), @@ -31,11 +34,16 @@ Acts::DigitizationModule::DigitizationModule( m_segmentationSurfacesX(), m_segmentationSurfacesY() { m_segmentation->createSegmentationSurfaces( - m_boundarySurfaces, m_segmentationSurfacesX, m_segmentationSurfacesY, - halfThickness, readoutDirection, lorentzAngle); + m_boundarySurfaces, + m_segmentationSurfacesX, + m_segmentationSurfacesY, + halfThickness, + readoutDirection, + lorentzAngle); } -const Acts::SurfacePtrVector Acts::DigitizationModule::segmentationSurfaces( +const Acts::SurfacePtrVector +Acts::DigitizationModule::segmentationSurfaces( const Acts::DigitizationCell& entryCids, const Acts::DigitizationCell& exitCids) const { SurfacePtrVector sSurfaces; @@ -67,8 +75,10 @@ const Acts::SurfacePtrVector Acts::DigitizationModule::segmentationSurfaces( return sSurfaces; } -const Acts::SurfacePtrVector Acts::DigitizationModule::stepSurfaces( - const Vector3D& start, const Vector3D& end) const { +const Acts::SurfacePtrVector +Acts::DigitizationModule::stepSurfaces( + const Vector3D& start, + const Vector3D& end) const { // prepare the return vector SurfacePtrVector stepSurfaces; diff --git a/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp b/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp index 686fdc78c..279241e91 100644 --- a/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp +++ b/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp @@ -21,7 +21,8 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::SpacePointBuilder( double Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::differenceOfClustersChecked( - const Vector3D& pos1, const Vector3D& pos2) const { + const Vector3D& pos1, + const Vector3D& pos2) const { // Check if measurements are close enough to each other if ((pos1 - pos2).norm() > m_cfg.diffDist) { return -1.; @@ -50,7 +51,8 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::differenceOfClustersChecked( return diffTheta2 + diffPhi2; } -Acts::Vector2D Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::localCoords( +Acts::Vector2D +Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::localCoords( const PlanarModuleCluster& cluster) const { // Local position information auto par = cluster.parameters(); @@ -58,8 +60,10 @@ Acts::Vector2D Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::localCoords( return local; } -Acts::Vector3D Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::globalCoords( - const GeometryContext& gctx, const PlanarModuleCluster& cluster) const { +Acts::Vector3D +Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::globalCoords( + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const { // Receive corresponding surface auto& clusterSurface = cluster.referenceSurface(); @@ -70,12 +74,14 @@ Acts::Vector3D Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::globalCoords( return pos; } -void Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::makeClusterPairs( +void +Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::makeClusterPairs( const GeometryContext& gctx, const std::vector<const PlanarModuleCluster*>& clustersFront, const std::vector<const PlanarModuleCluster*>& clustersBack, - std::vector<std::pair<const PlanarModuleCluster*, - const PlanarModuleCluster*>>& clusterPairs) const { + std::vector< + std::pair<const PlanarModuleCluster*, const PlanarModuleCluster*>>& + clusterPairs) const { // Return if no clusters are given in a vector if (clustersFront.empty() || clustersBack.empty()) { return; @@ -108,11 +114,12 @@ void Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::makeClusterPairs( // Store the best (=closest) result if (clusterMinDist < clustersBack.size()) { - std::pair<const Acts::PlanarModuleCluster*, - const Acts::PlanarModuleCluster*> + std::pair< + const Acts::PlanarModuleCluster*, + const Acts::PlanarModuleCluster*> clusterPair; - clusterPair = std::make_pair(clustersFront[iClustersFront], - clustersBack[clusterMinDist]); + clusterPair = std::make_pair( + clustersFront[iClustersFront], clustersBack[clusterMinDist]); clusterPairs.push_back(clusterPair); } } @@ -163,8 +170,11 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::endsOfStrip( return std::make_pair(topGlobal, bottomGlobal); } -double Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calcPerpProj( - const Acts::Vector3D& a, const Acts::Vector3D& c, const Acts::Vector3D& q, +double +Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calcPerpProj( + const Acts::Vector3D& a, + const Acts::Vector3D& c, + const Acts::Vector3D& q, const Acts::Vector3D& r) const { /// This approach assumes that no vertex is available. This option aims to /// approximate the space points from cosmic data. @@ -189,7 +199,8 @@ double Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calcPerpProj( return 1.; } -bool Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::recoverSpacePoint( +bool +Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::recoverSpacePoint( Acts::SpacePointBuilder<DoubleHitSpacePoint>::SpacePointParameters& spaPoPa) const { /// Consider some cases that would allow an easy exit @@ -269,11 +280,12 @@ bool Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::recoverSpacePoint( return false; } -void Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calculateSpacePoints( +void +Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calculateSpacePoints( const GeometryContext& gctx, - const std::vector<std::pair<const Acts::PlanarModuleCluster*, - const Acts::PlanarModuleCluster*>>& - clusterPairs, + const std::vector<std::pair< + const Acts::PlanarModuleCluster*, + const Acts::PlanarModuleCluster*>>& clusterPairs, std::vector<Acts::DoubleHitSpacePoint>& spacePoints) const { /// Source of algorithm: Athena, SiSpacePointMakerTool::makeSCT_SpacePoint() @@ -337,8 +349,9 @@ void Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calculateSpacePoints( // Check if m and n can be resolved in the interval (-1, 1) if (fabs(spaPoPa.m) <= spaPoPa.limit && - fabs(spaPoPa.n = -spaPoPa.t.dot(spaPoPa.qs) / - spaPoPa.r.dot(spaPoPa.qs)) <= spaPoPa.limit) { + fabs( + spaPoPa.n = -spaPoPa.t.dot(spaPoPa.qs) / + spaPoPa.r.dot(spaPoPa.qs)) <= spaPoPa.limit) { // Store the space point Acts::DoubleHitSpacePoint sp; sp.clusterFront = cp.first; diff --git a/Plugins/Digitization/src/PlanarModuleStepper.cpp b/Plugins/Digitization/src/PlanarModuleStepper.cpp index 88633f75b..2b29b8568 100644 --- a/Plugins/Digitization/src/PlanarModuleStepper.cpp +++ b/Plugins/Digitization/src/PlanarModuleStepper.cpp @@ -20,9 +20,12 @@ Acts::PlanarModuleStepper::PlanarModuleStepper( std::unique_ptr<const Logger> mlogger) : m_logger(std::move(mlogger)) {} -std::vector<Acts::DigitizationStep> Acts::PlanarModuleStepper::cellSteps( - const GeometryContext& gctx, const DigitizationModule& dmodule, - const Vector3D& startPoint, const Vector3D& endPoint) const { +std::vector<Acts::DigitizationStep> +Acts::PlanarModuleStepper::cellSteps( + const GeometryContext& gctx, + const DigitizationModule& dmodule, + const Vector3D& startPoint, + const Vector3D& endPoint) const { // create the return vector std::vector<DigitizationStep> cSteps; @@ -44,10 +47,10 @@ std::vector<Acts::DigitizationStep> Acts::PlanarModuleStepper::cellSteps( if (sIntersection.valid) { // now record stepIntersections.push_back(sIntersection); - ACTS_VERBOSE("Boundary Surface intersected with = " - << sIntersection.position.x() << ", " - << sIntersection.position.y() << ", " - << sIntersection.position.z()); + ACTS_VERBOSE( + "Boundary Surface intersected with = " + << sIntersection.position.x() << ", " << sIntersection.position.y() + << ", " << sIntersection.position.z()); } } // last one is also valid - now sort @@ -69,9 +72,12 @@ std::vector<Acts::DigitizationStep> Acts::PlanarModuleStepper::cellSteps( } // calculate the steps caused by this track - fast simulation interface -std::vector<Acts::DigitizationStep> Acts::PlanarModuleStepper::cellSteps( - const GeometryContext& gctx, const Acts::DigitizationModule& dmodule, - const Vector2D& moduleIntersection, const Vector3D& trackDirection) const { +std::vector<Acts::DigitizationStep> +Acts::PlanarModuleStepper::cellSteps( + const GeometryContext& gctx, + const Acts::DigitizationModule& dmodule, + const Vector2D& moduleIntersection, + const Vector3D& trackDirection) const { // first, intersect the boundary surfaces auto boundarySurfaces = dmodule.boundarySurfaces(); // intersect them - fast exit for cases where @@ -90,10 +96,10 @@ std::vector<Acts::DigitizationStep> Acts::PlanarModuleStepper::cellSteps( if (bIntersection.valid) { // now record boundaryIntersections.push_back(bIntersection); - ACTS_VERBOSE("Boundary Surface intersected with = " - << bIntersection.position.x() << ", " - << bIntersection.position.y() << ", " - << bIntersection.position.z()); + ACTS_VERBOSE( + "Boundary Surface intersected with = " + << bIntersection.position.x() << ", " << bIntersection.position.y() + << ", " << bIntersection.position.z()); } // fast break in case of readout/counter surface hit // the first two attempts are the module faces, if they are hit, @@ -115,6 +121,9 @@ std::vector<Acts::DigitizationStep> Acts::PlanarModuleStepper::cellSteps( return std::vector<Acts::DigitizationStep>(); } // return - return cellSteps(gctx, dmodule, boundaryIntersections[0].position, - boundaryIntersections[1].position); + return cellSteps( + gctx, + dmodule, + boundaryIntersections[0].position, + boundaryIntersections[1].position); } diff --git a/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp b/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp index bea18a4b4..23c9b3582 100644 --- a/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp +++ b/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp @@ -8,7 +8,8 @@ #include "Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp" -Acts::Vector2D Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::localCoords( +Acts::Vector2D +Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::localCoords( const PlanarModuleCluster& cluster) const { // Local position information auto par = cluster.parameters(); @@ -16,8 +17,10 @@ Acts::Vector2D Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::localCoords( return local; } -Acts::Vector3D Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::globalCoords( - const GeometryContext& gctx, const PlanarModuleCluster& cluster) const { +Acts::Vector3D +Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::globalCoords( + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const { // Receive corresponding surface auto& clusterSurface = cluster.referenceSurface(); @@ -28,7 +31,8 @@ Acts::Vector3D Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::globalCoords( return pos; } -void Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::calculateSpacePoints( +void +Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::calculateSpacePoints( const GeometryContext& gctx, const std::vector<const Acts::PlanarModuleCluster*>& clusters, std::vector<Acts::SingleHitSpacePoint>& spacePointStorage) const { diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp index 79a895b1e..f37de1671 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp @@ -70,9 +70,12 @@ class TGeoDetectorElement : public IdentifiedDetectorElement { /// @param digitizationModule Shared pointer to the geometric digitization /// description TGeoDetectorElement( - const Identifier& identifier, TGeoNode* tGeoDetElement, - const TGeoMatrix* mGlobal = nullptr, const std::string& axes = "XYZ", - double scalor = 1., bool isDisc = false, + const Identifier& identifier, + TGeoNode* tGeoDetElement, + const TGeoMatrix* mGlobal = nullptr, + const std::string& axes = "XYZ", + double scalor = 1., + bool isDisc = false, std::shared_ptr<const Acts::ISurfaceMaterial> material = nullptr, std::shared_ptr<const Acts::DigitizationModule> digitizationModule = nullptr); @@ -114,9 +117,12 @@ class TGeoDetectorElement : public IdentifiedDetectorElement { /// @param digitizationModule Shared pointer to the geometric digitization /// description TGeoDetectorElement( - const Identifier& identifier, const TGeoMatrix& transform, - TGeoNode* tGeoDetElement, const std::string& axes = "XYZ", - double scalor = 1., bool isDisc = false, + const Identifier& identifier, + const TGeoMatrix& transform, + TGeoNode* tGeoDetElement, + const std::string& axes = "XYZ", + double scalor = 1., + bool isDisc = false, std::shared_ptr<const Acts::ISurfaceMaterial> material = nullptr, std::shared_ptr<const Acts::DigitizationModule> digitizationModule = nullptr); @@ -163,20 +169,23 @@ class TGeoDetectorElement : public IdentifiedDetectorElement { std::shared_ptr<const Acts::DigitizationModule> m_digitizationModule{nullptr}; }; -inline Identifier TGeoDetectorElement::identifier() const { +inline Identifier +TGeoDetectorElement::identifier() const { return m_identifier; } -inline const Transform3D& TGeoDetectorElement::transform( - const GeometryContext& /*gctx*/) const { +inline const Transform3D& +TGeoDetectorElement::transform(const GeometryContext& /*gctx*/) const { return (*m_transform); } -inline const Surface& TGeoDetectorElement::surface() const { +inline const Surface& +TGeoDetectorElement::surface() const { return (*m_surface); } -inline double TGeoDetectorElement::thickness() const { +inline double +TGeoDetectorElement::thickness() const { return m_thickness; } diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp index d99cbd526..00a640eb5 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp @@ -75,9 +75,10 @@ class TGeoLayerBuilder : public ILayerBuilder { /// Constructor /// @param config is the configuration struct /// @param logger the local logging instance - TGeoLayerBuilder(const Config& config, - std::unique_ptr<const Logger> logger = - getDefaultLogger("LayerArrayCreator", Logging::INFO)); + TGeoLayerBuilder( + const Config& config, + std::unique_ptr<const Logger> logger = + getDefaultLogger("LayerArrayCreator", Logging::INFO)); /// Destructor ~TGeoLayerBuilder() override; @@ -122,7 +123,10 @@ class TGeoLayerBuilder : public ILayerBuilder { Config m_cfg; /// Private access to the logger - const Logger& logger() const { return *m_logger; } + const Logger& + logger() const { + return *m_logger; + } /// logging instance std::unique_ptr<const Logger> m_logger; @@ -136,16 +140,20 @@ class TGeoLayerBuilder : public ILayerBuilder { void resolveSensitive( const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>>& layerSurfaces, - TGeoVolume* tgVolume, TGeoNode* tgNode, const TGeoMatrix& tgTransform, - const LayerConfig& layerConfig, int type, bool correctBranch = false, + TGeoVolume* tgVolume, + TGeoNode* tgNode, + const TGeoMatrix& tgTransform, + const LayerConfig& layerConfig, + int type, + bool correctBranch = false, const std::string& offset = ""); /// Private helper method : build layers /// @param gcts the geometry context of this call /// @param layers is goint to be filled /// @param type is the indication which ones to build -1 | 0 | 1 - void buildLayers(const GeometryContext& gctx, LayerVector& layers, - int type = 0); + void + buildLayers(const GeometryContext& gctx, LayerVector& layers, int type = 0); /// Private helper method : match string with wildcards /// @param wc is the one with the potential wildcard @@ -153,7 +161,8 @@ class TGeoLayerBuilder : public ILayerBuilder { bool match(const char* first, const char* second) const; }; -inline TGeoLayerBuilder::Config TGeoLayerBuilder::getConfiguration() const { +inline TGeoLayerBuilder::Config +TGeoLayerBuilder::getConfiguration() const { return m_cfg; } @@ -162,14 +171,15 @@ TGeoLayerBuilder::detectorElements() const { return m_elementStore; } -inline const std::string& TGeoLayerBuilder::identification() const { +inline const std::string& +TGeoLayerBuilder::identification() const { return m_cfg.configurationName; } // The main function that checks if two given strings // match. The first string may contain wildcard characters -inline bool TGeoLayerBuilder::match(const char* first, - const char* second) const { +inline bool +TGeoLayerBuilder::match(const char* first, const char* second) const { // If we reach at the end of both strings, we are done if (*first == '\0' && *second == '\0') { return true; diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoPrimitivesHelpers.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoPrimitivesHelpers.hpp index c0c01836e..3018a62ed 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoPrimitivesHelpers.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoPrimitivesHelpers.hpp @@ -14,10 +14,12 @@ namespace Acts { namespace TGeoPrimitivesHelpers { -Transform3D makeTransform(const Eigen::Vector3d& rotationMatrixCol0, - const Eigen::Vector3d& rotationMatrixCol1, - const Eigen::Vector3d& rotationMatrixCol2, - const Eigen::Vector3d& translation) { +Transform3D +makeTransform( + const Eigen::Vector3d& rotationMatrixCol0, + const Eigen::Vector3d& rotationMatrixCol1, + const Eigen::Vector3d& rotationMatrixCol2, + const Eigen::Vector3d& translation) { Transform3D trf; trf.matrix().block(0, 0, 3, 1) = rotationMatrixCol0; trf.matrix().block(0, 1, 3, 1) = rotationMatrixCol1; diff --git a/Plugins/TGeo/src/TGeoDetectorElement.cpp b/Plugins/TGeo/src/TGeoDetectorElement.cpp index 2970d41ff..3c5dfecf6 100644 --- a/Plugins/TGeo/src/TGeoDetectorElement.cpp +++ b/Plugins/TGeo/src/TGeoDetectorElement.cpp @@ -26,9 +26,13 @@ #include "TGeoTube.h" Acts::TGeoDetectorElement::TGeoDetectorElement( - const Identifier& identifier, TGeoNode* tGeoDetElement, - const TGeoMatrix* mGlobal, const std::string& axes, double scalor, - bool isDisc, std::shared_ptr<const Acts::ISurfaceMaterial> material, + const Identifier& identifier, + TGeoNode* tGeoDetElement, + const TGeoMatrix* mGlobal, + const std::string& axes, + double scalor, + bool isDisc, + std::shared_ptr<const Acts::ISurfaceMaterial> material, std::shared_ptr<const Acts::DigitizationModule> digitizationModule) : Acts::IdentifiedDetectorElement(), m_detElement(tGeoDetElement), @@ -59,8 +63,10 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( rotation = (nodeTransform->GetRotationMatrix()); } // create the translation - Vector3D colT(scalor * translation[0], scalor * translation[1], - scalor * translation[2]); + Vector3D colT( + scalor * translation[0], + scalor * translation[1], + scalor * translation[2]); Vector3D colX(rotation[0], rotation[3], rotation[6]); Vector3D colY(rotation[1], rotation[4], rotation[7]); Vector3D colZ(rotation[2], rotation[5], rotation[8]); @@ -121,7 +127,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with x/y auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDx1(), scalor * trapezoid->GetDx2(), + scalor * trapezoid->GetDx1(), + scalor * trapezoid->GetDx2(), scalor * 0.5 * (trapezoid->GetDy1() + trapezoid->GetDy2())); // thickness m_thickness = scalor * trapezoid->GetDz(); @@ -164,7 +171,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with x/z auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDx1(), scalor * trapezoid->GetDx2(), + scalor * trapezoid->GetDx1(), + scalor * trapezoid->GetDx2(), scalor * trapezoid->GetDz()); // thickness m_thickness = @@ -209,7 +217,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with y/z auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDy1(), scalor * trapezoid->GetDy2(), + scalor * trapezoid->GetDy1(), + scalor * trapezoid->GetDy2(), scalor * trapezoid->GetDz()); // thickness m_thickness = @@ -253,7 +262,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with y/x auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDy1(), scalor * trapezoid->GetDy2(), + scalor * trapezoid->GetDy1(), + scalor * trapezoid->GetDy2(), scalor * 0.5 * (trapezoid->GetDx1() + trapezoid->GetDx2())); // thickness m_thickness = scalor * trapezoid->GetDz(); @@ -296,7 +306,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with z/y auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDz(), scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), scalor * 0.5 * (trapezoid->GetDy1() + trapezoid->GetDy2())); // thickness m_thickness = @@ -341,7 +352,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with z/x auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDz(), scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), scalor * 0.5 * (trapezoid->GetDx1() + trapezoid->GetDx2())); // thickness m_thickness = @@ -372,9 +384,13 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } Acts::TGeoDetectorElement::TGeoDetectorElement( - const Identifier& identifier, const TGeoMatrix& transform, - TGeoNode* tGeoDetElement, const std::string& axes, double scalor, - bool isDisc, std::shared_ptr<const Acts::ISurfaceMaterial> material, + const Identifier& identifier, + const TGeoMatrix& transform, + TGeoNode* tGeoDetElement, + const std::string& axes, + double scalor, + bool isDisc, + std::shared_ptr<const Acts::ISurfaceMaterial> material, std::shared_ptr<const Acts::DigitizationModule> digitizationModule) : Acts::IdentifiedDetectorElement(), m_detElement(tGeoDetElement), @@ -393,8 +409,10 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( rotation = transform.GetRotationMatrix(); // create the translation - Vector3D colT(scalor * translation[0], scalor * translation[1], - scalor * translation[2]); + Vector3D colT( + scalor * translation[0], + scalor * translation[1], + scalor * translation[2]); Vector3D colX(rotation[0], rotation[3], rotation[6]); Vector3D colY(rotation[1], rotation[4], rotation[7]); Vector3D colZ(rotation[2], rotation[5], rotation[8]); @@ -454,7 +472,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with x/y auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDx1(), scalor * trapezoid->GetDx2(), + scalor * trapezoid->GetDx1(), + scalor * trapezoid->GetDx2(), scalor * 0.5 * (trapezoid->GetDy1() + trapezoid->GetDy2())); // thickness m_thickness = scalor * trapezoid->GetDz(); @@ -497,7 +516,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with x/z auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDx1(), scalor * trapezoid->GetDx2(), + scalor * trapezoid->GetDx1(), + scalor * trapezoid->GetDx2(), scalor * trapezoid->GetDz()); // thickness m_thickness = @@ -542,7 +562,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with y/z auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDy1(), scalor * trapezoid->GetDy2(), + scalor * trapezoid->GetDy1(), + scalor * trapezoid->GetDy2(), scalor * trapezoid->GetDz()); // thickness m_thickness = @@ -586,7 +607,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with y/x auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDy1(), scalor * trapezoid->GetDy2(), + scalor * trapezoid->GetDy1(), + scalor * trapezoid->GetDy2(), scalor * 0.5 * (trapezoid->GetDx1() + trapezoid->GetDx2())); // thickness m_thickness = scalor * trapezoid->GetDz(); @@ -629,7 +651,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with z/y auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDz(), scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), scalor * 0.5 * (trapezoid->GetDy1() + trapezoid->GetDy2())); // thickness m_thickness = @@ -674,7 +697,8 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( if (trapezoid != nullptr) { // bounds with z/x auto trapezoidBounds = std::make_shared<const TrapezoidBounds>( - scalor * trapezoid->GetDz(), scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), + scalor * trapezoid->GetDz(), scalor * 0.5 * (trapezoid->GetDx1() + trapezoid->GetDx2())); // thickness m_thickness = diff --git a/Plugins/TGeo/src/TGeoLayerBuilder.cpp b/Plugins/TGeo/src/TGeoLayerBuilder.cpp index 0cb91bce6..cd3afc691 100644 --- a/Plugins/TGeo/src/TGeoLayerBuilder.cpp +++ b/Plugins/TGeo/src/TGeoLayerBuilder.cpp @@ -22,18 +22,19 @@ Acts::TGeoLayerBuilder::TGeoLayerBuilder( Acts::TGeoLayerBuilder::~TGeoLayerBuilder() = default; -void Acts::TGeoLayerBuilder::setConfiguration( +void +Acts::TGeoLayerBuilder::setConfiguration( const Acts::TGeoLayerBuilder::Config& config) { m_cfg = config; } -void Acts::TGeoLayerBuilder::setLogger( - std::unique_ptr<const Logger> newLogger) { +void +Acts::TGeoLayerBuilder::setLogger(std::unique_ptr<const Logger> newLogger) { m_logger = std::move(newLogger); } -const Acts::LayerVector Acts::TGeoLayerBuilder::negativeLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::TGeoLayerBuilder::negativeLayers(const GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<TGeoLayerBuilder*>(this); LayerVector nVector; @@ -41,8 +42,8 @@ const Acts::LayerVector Acts::TGeoLayerBuilder::negativeLayers( return nVector; } -const Acts::LayerVector Acts::TGeoLayerBuilder::centralLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::TGeoLayerBuilder::centralLayers(const GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<TGeoLayerBuilder*>(this); LayerVector cVector; @@ -50,8 +51,8 @@ const Acts::LayerVector Acts::TGeoLayerBuilder::centralLayers( return cVector; } -const Acts::LayerVector Acts::TGeoLayerBuilder::positiveLayers( - const GeometryContext& gctx) const { +const Acts::LayerVector +Acts::TGeoLayerBuilder::positiveLayers(const GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<TGeoLayerBuilder*>(this); LayerVector pVector; @@ -59,8 +60,11 @@ const Acts::LayerVector Acts::TGeoLayerBuilder::positiveLayers( return pVector; } -void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, - LayerVector& layers, int type) { +void +Acts::TGeoLayerBuilder::buildLayers( + const GeometryContext& gctx, + LayerVector& layers, + int type) { // bail out if you have no gGeoManager if (gGeoManager == nullptr) { return; @@ -84,21 +88,29 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, } break; } // screen output - ACTS_DEBUG(layerType << " Layers : found " << layerConfigs.size() - << " configurations."); + ACTS_DEBUG( + layerType << " Layers : found " << layerConfigs.size() + << " configurations."); for (auto layerCfg : layerConfigs) { // prepare the layer surfaces std::vector<std::shared_ptr<const Surface>> layerSurfaces; - ACTS_DEBUG("- layer configuration found for layer " - << layerCfg.layerName << " with sensor " << layerCfg.sensorName); + ACTS_DEBUG( + "- layer configuration found for layer " + << layerCfg.layerName << " with sensor " << layerCfg.sensorName); // we have to step down from the top volume each time to collect the logical // tree TGeoVolume* tvolume = gGeoManager->GetTopVolume(); if (tvolume != nullptr) { // recursively step down - resolveSensitive(gctx, layerSurfaces, tvolume, nullptr, TGeoIdentity(), - layerCfg, type); + resolveSensitive( + gctx, + layerSurfaces, + tvolume, + nullptr, + TGeoIdentity(), + layerCfg, + type); // screen output ACTS_DEBUG( "- number of senstive sensors found : " << layerSurfaces.size()); @@ -120,11 +132,16 @@ void Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, } } -void Acts::TGeoLayerBuilder::resolveSensitive( +void +Acts::TGeoLayerBuilder::resolveSensitive( const GeometryContext& gctx, std::vector<std::shared_ptr<const Acts::Surface>>& layerSurfaces, - TGeoVolume* tgVolume, TGeoNode* tgNode, const TGeoMatrix& tgTransform, - const LayerConfig& layerConfig, int type, bool correctBranch, + TGeoVolume* tgVolume, + TGeoNode* tgNode, + const TGeoMatrix& tgTransform, + const LayerConfig& layerConfig, + int type, + bool correctBranch, const std::string& offset) { /// some screen output for disk debugging if (type != 0) { @@ -135,9 +152,9 @@ void Acts::TGeoLayerBuilder::resolveSensitive( if (tgVolume != nullptr) { std::string volumeName = tgVolume->GetName(); /// some screen output indicating that the volume was found - ACTS_VERBOSE(offset << "[o] Volume : " << volumeName - << " - checking for volume name " - << layerConfig.layerName); + ACTS_VERBOSE( + offset << "[o] Volume : " << volumeName + << " - checking for volume name " << layerConfig.layerName); // once in the current branch, always in the current branch bool correctVolume = correctBranch; @@ -150,8 +167,8 @@ void Acts::TGeoLayerBuilder::resolveSensitive( // loop over the daughters and collect them auto daugthers = tgVolume->GetNodes(); // screen output - ACTS_VERBOSE(offset << "has " << tgVolume->GetNdaughters() - << " daughters."); + ACTS_VERBOSE( + offset << "has " << tgVolume->GetNdaughters() << " daughters."); // a daughter iterator TIter iObj(daugthers); // while loop over the objects @@ -159,8 +176,16 @@ void Acts::TGeoLayerBuilder::resolveSensitive( // dynamic_cast to a node TGeoNode* node = dynamic_cast<TGeoNode*>(obj); if (node != nullptr) { - resolveSensitive(gctx, layerSurfaces, nullptr, node, tgTransform, - layerConfig, type, correctVolume, offset + " "); + resolveSensitive( + gctx, + layerSurfaces, + nullptr, + node, + tgTransform, + layerConfig, + type, + correctVolume, + offset + " "); } } } else { @@ -177,9 +202,9 @@ void Acts::TGeoLayerBuilder::resolveSensitive( double z = translation[2]; // get the name of the node std::string tNodeName = tgNode->GetName(); - ACTS_VERBOSE(offset << "[>] Node : " << tNodeName - << " - checking for sensor name " - << layerConfig.sensorName); + ACTS_VERBOSE( + offset << "[>] Node : " << tNodeName << " - checking for sensor name " + << layerConfig.sensorName); // find out the branch hit - single layer depth is supported by // sensor==layer bool branchHit = @@ -199,7 +224,10 @@ void Acts::TGeoLayerBuilder::resolveSensitive( ACTS_VERBOSE(offset << "[>>] accepted !"); // create the element auto tgElement = std::make_shared<const Acts::TGeoDetectorElement>( - Identifier(), tgNode, &tgTransform, layerConfig.localAxes, + Identifier(), + tgNode, + &tgTransform, + layerConfig.localAxes, m_cfg.unit); // record the element @todo solve with provided cache m_elementStore.push_back(tgElement); @@ -227,8 +255,16 @@ void Acts::TGeoLayerBuilder::resolveSensitive( // if it's not accepted, get the associated volume TGeoVolume* nodeVolume = tgNode->GetVolume(); // step down one further - resolveSensitive(gctx, layerSurfaces, nodeVolume, nullptr, nTransform, - layerConfig, type, correctBranch, offset + " "); + resolveSensitive( + gctx, + layerSurfaces, + nodeVolume, + nullptr, + nTransform, + layerConfig, + type, + correctBranch, + offset + " "); } } else { ACTS_VERBOSE("No node present."); diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp index 66a37d89d..4e4cad2c4 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp @@ -57,7 +57,8 @@ struct CubicTrackingGeometry { } /// Call operator to build the standard cubic tracking geometry - std::shared_ptr<const TrackingGeometry> operator()() { + std::shared_ptr<const TrackingGeometry> + operator()() { using namespace UnitLiterals; // Set translation vectors @@ -78,7 +79,9 @@ struct CubicTrackingGeometry { trafo.translation() = translations[i]; // Create the detector element auto detElement = std::make_unique<const DetectorElementStub>( - std::make_shared<const Transform3D>(trafo), rBounds, 1._um, + std::make_shared<const Transform3D>(trafo), + rBounds, + 1._um, surfaceMaterial); // And remember the surface surfaces[i] = detElement->surface().getSharedPtr(); @@ -94,8 +97,11 @@ struct CubicTrackingGeometry { std::unique_ptr<SurfaceArray> surArray(new SurfaceArray(surfaces[i])); - layers[i] = PlaneLayer::create(std::make_shared<const Transform3D>(trafo), - rBounds, std::move(surArray), 1._mm); + layers[i] = PlaneLayer::create( + std::make_shared<const Transform3D>(trafo), + rBounds, + std::move(surArray), + 1._mm); auto mutableSurface = const_cast<Surface*>(surfaces[i].get()); mutableSurface->associateLayer(*layers[i]); @@ -116,12 +122,20 @@ struct CubicTrackingGeometry { layVec.push_back(layers[0]); layVec.push_back(layers[1]); std::unique_ptr<const LayerArray> layArr1(layArrCreator.layerArray( - geoContext, layVec, -2_m - 1._mm, -1._m + 1._mm, BinningType::arbitrary, + geoContext, + layVec, + -2_m - 1._mm, + -1._m + 1._mm, + BinningType::arbitrary, BinningValue::binX)); auto trackVolume1 = TrackingVolume::create( - std::make_shared<const Transform3D>(trafoVol1), boundsVol, nullptr, - std::move(layArr1), nullptr, "Volume 1"); + std::make_shared<const Transform3D>(trafoVol1), + boundsVol, + nullptr, + std::move(layArr1), + nullptr, + "Volume 1"); trackVolume1->sign(GeometrySignature::Global); // Build volume for surfaces with positive x-values @@ -131,23 +145,35 @@ struct CubicTrackingGeometry { layVec.clear(); for (i = 2; i < 6; i++) layVec.push_back(layers[i]); - std::unique_ptr<const LayerArray> layArr2( - layArrCreator.layerArray(geoContext, layVec, 1._m - 2._mm, 2._m + 2._mm, - BinningType::arbitrary, BinningValue::binX)); + std::unique_ptr<const LayerArray> layArr2(layArrCreator.layerArray( + geoContext, + layVec, + 1._m - 2._mm, + 2._m + 2._mm, + BinningType::arbitrary, + BinningValue::binX)); auto trackVolume2 = TrackingVolume::create( - std::make_shared<const Transform3D>(trafoVol2), boundsVol, nullptr, - std::move(layArr2), nullptr, "Volume 2"); + std::make_shared<const Transform3D>(trafoVol2), + boundsVol, + nullptr, + std::move(layArr2), + nullptr, + "Volume 2"); trackVolume2->sign(GeometrySignature::Global); // Glue volumes trackVolume2->glueTrackingVolume( - geoContext, BoundarySurfaceFace::negativeFaceYZ, trackVolume1, + geoContext, + BoundarySurfaceFace::negativeFaceYZ, + trackVolume1, BoundarySurfaceFace::positiveFaceYZ); trackVolume1->glueTrackingVolume( - geoContext, BoundarySurfaceFace::positiveFaceYZ, trackVolume2, + geoContext, + BoundarySurfaceFace::positiveFaceYZ, + trackVolume2, BoundarySurfaceFace::negativeFaceYZ); // Build world volume @@ -170,9 +196,11 @@ struct CubicTrackingGeometry { std::shared_ptr<const TrackingVolumeArray> trVolArr( new BinnedArrayXD<TrackingVolumePtr>(tapVec, std::move(bu))); - MutableTrackingVolumePtr mtvpWorld( - TrackingVolume::create(std::make_shared<const Transform3D>(trafoWorld), - worldVol, trVolArr, "World")); + MutableTrackingVolumePtr mtvpWorld(TrackingVolume::create( + std::make_shared<const Transform3D>(trafoWorld), + worldVol, + trVolArr, + "World")); mtvpWorld->sign(GeometrySignature::Global); diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp index 065b046e7..45fd2353e 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp @@ -49,8 +49,12 @@ struct CylindricalTrackingGeometry { /// helper method for cylinder layer /// create the positions for module surfaces on a cylinder - std::vector<Vector3D> modulePositionsCylinder( - double radius, double zStagger, double moduleHalfLength, double lOverlap, + std::vector<Vector3D> + modulePositionsCylinder( + double radius, + double zStagger, + double moduleHalfLength, + double lOverlap, const std::pair<int, int>& binningSchema) { int nPhiBins = binningSchema.first; int nZbins = binningSchema.second; @@ -71,15 +75,16 @@ struct CylindricalTrackingGeometry { for (size_t phiBin = 0; phiBin < size_t(nPhiBins); ++phiBin) { // calculate the current phi value double modulePhi = minPhi + phiBin * phiStep; - mPositions.push_back(Vector3D(moduleR * cos(modulePhi), - moduleR * sin(modulePhi), moduleZ)); + mPositions.push_back(Vector3D( + moduleR * cos(modulePhi), moduleR * sin(modulePhi), moduleZ)); } } return mPositions; } // @brief Call operator for the creation method of the tracking geometry - std::shared_ptr<const TrackingGeometry> operator()() { + std::shared_ptr<const TrackingGeometry> + operator()() { using namespace Acts::UnitLiterals; Logging::Level surfaceLLevel = Logging::INFO; @@ -166,16 +171,16 @@ struct CylindricalTrackingGeometry { std::vector<std::shared_ptr<const Surface>> layerModules; // Module material from input - MaterialProperties moduleMaterialProperties(pcMaterial, - pModuleThickness[ilp]); + MaterialProperties moduleMaterialProperties( + pcMaterial, pModuleThickness[ilp]); // Create a new surface material std::shared_ptr<const ISurfaceMaterial> moduleMaterialPtr = std::shared_ptr<const ISurfaceMaterial>( new Acts::HomogeneousSurfaceMaterial(moduleMaterialProperties)); // The rectangle bounds for all modules - auto mBounds = std::make_shared<RectangleBounds>(pModuleHalfX[ilp], - pModuleHalfY[ilp]); + auto mBounds = std::make_shared<RectangleBounds>( + pModuleHalfX[ilp], pModuleHalfY[ilp]); // Create the module centers auto moduleCenters = modulePositionsCylinder( pLayerRadii[ilp], 2_mm, pModuleHalfY[ilp], 5_mm, pLayerBinning[ilp]); @@ -184,13 +189,17 @@ struct CylindricalTrackingGeometry { // The association transform double modulePhi = VectorHelpers::phi(mCenter); // Local z axis is the normal vector - Vector3D moduleLocalZ(cos(modulePhi + pModuleTiltPhi[ilp]), - sin(modulePhi + pModuleTiltPhi[ilp]), 0.); + Vector3D moduleLocalZ( + cos(modulePhi + pModuleTiltPhi[ilp]), + sin(modulePhi + pModuleTiltPhi[ilp]), + 0.); // Local y axis is the global z axis Vector3D moduleLocalY(0., 0., 1); // Local x axis the normal to local y,z - Vector3D moduleLocalX(-sin(modulePhi + pModuleTiltPhi[ilp]), - cos(modulePhi + pModuleTiltPhi[ilp]), 0.); + Vector3D moduleLocalX( + -sin(modulePhi + pModuleTiltPhi[ilp]), + cos(modulePhi + pModuleTiltPhi[ilp]), + 0.); // Create the RotationMatrix RotationMatrix3D moduleRotation; moduleRotation.col(0) = moduleLocalX; @@ -198,11 +207,13 @@ struct CylindricalTrackingGeometry { moduleRotation.col(2) = moduleLocalZ; // Get the moduleTransform std::shared_ptr<Transform3D> mModuleTransform = - std::make_shared<Transform3D>(Translation3D(mCenter) * - moduleRotation); + std::make_shared<Transform3D>( + Translation3D(mCenter) * moduleRotation); // Create the detector element auto detElement = std::make_unique<const DetectorElementStub>( - mModuleTransform, mBounds, pModuleThickness[ilp], + mModuleTransform, + mBounds, + pModuleThickness[ilp], moduleMaterialPtr); layerModules.push_back(detElement->surface().getSharedPtr()); @@ -212,8 +223,11 @@ struct CylindricalTrackingGeometry { ProtoLayer protoLayer(geoContext, layerModules); protoLayer.envR = {0.5, 0.5}; auto pLayer = layerCreator->cylinderLayer( - geoContext, std::move(layerModules), pLayerBinning[ilp].first, - pLayerBinning[ilp].second, protoLayer); + geoContext, + std::move(layerModules), + pLayerBinning[ilp].first, + pLayerBinning[ilp].second, + protoLayer); auto approachSurfaces = pLayer->approachDescriptor()->containedSurfaces(); auto mutableOuterSurface = const_cast<Acts::Surface*>(approachSurfaces.at(1)); @@ -224,14 +238,18 @@ struct CylindricalTrackingGeometry { } // loop over layers // layer array - auto pLayerArray = layerArrayCreator->layerArray(geoContext, pLayers, 25., - 300., arbitrary, binR); + auto pLayerArray = layerArrayCreator->layerArray( + geoContext, pLayers, 25., 300., arbitrary, binR); auto pVolumeBounds = std::make_shared<const CylinderVolumeBounds>(25., 300., 1100.); // create the Tracking volume - auto pVolume = TrackingVolume::create(nullptr, pVolumeBounds, nullptr, - std::move(pLayerArray), nullptr, - "Pixel::Barrel"); + auto pVolume = TrackingVolume::create( + nullptr, + pVolumeBounds, + nullptr, + std::move(pLayerArray), + nullptr, + "Pixel::Barrel"); // The combined volume auto detectorVolume = cylinderVolumeHelper->createContainerTrackingVolume( diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp index ed353d91a..a560e254a 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp @@ -49,7 +49,8 @@ class DetectorElementStub : public DetectorElementBase { /// @param material is the (optional) Surface material associated to it DetectorElementStub( std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const PlanarBounds> pBounds, double thickness, + std::shared_ptr<const PlanarBounds> pBounds, + double thickness, std::shared_ptr<const ISurfaceMaterial> material = nullptr) : DetectorElementBase(), m_elementTransform(std::move(transform)), @@ -68,7 +69,8 @@ class DetectorElementStub : public DetectorElementBase { /// @param material is the (optional) Surface material associated to it DetectorElementStub( std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const LineBounds> lBounds, double thickness, + std::shared_ptr<const LineBounds> lBounds, + double thickness, std::shared_ptr<const ISurfaceMaterial> material = nullptr) : DetectorElementBase(), m_elementTransform(std::move(transform)), @@ -104,16 +106,18 @@ class DetectorElementStub : public DetectorElementBase { double m_elementThickness{0.}; }; -inline const Transform3D& DetectorElementStub::transform( - const GeometryContext& /*gctx*/) const { +inline const Transform3D& +DetectorElementStub::transform(const GeometryContext& /*gctx*/) const { return *m_elementTransform; } -inline const Surface& DetectorElementStub::surface() const { +inline const Surface& +DetectorElementStub::surface() const { return *m_elementSurface; } -inline double DetectorElementStub::thickness() const { +inline double +DetectorElementStub::thickness() const { return m_elementThickness; } } // namespace Test diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/FloatComparisons.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/FloatComparisons.hpp index 089d1152e..8bc0ebc27 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/FloatComparisons.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/FloatComparisons.hpp @@ -66,7 +66,8 @@ using predicate_result = boost::test_tools::predicate_result; using ScalarComparison = std::function<predicate_result(double, double)>; -ScalarComparison closeOrSmall(double reltol, double small) { +ScalarComparison +closeOrSmall(double reltol, double small) { return [=](double val, double ref) -> predicate_result { // Perform the comparison, exit on success if (std::abs(ref) >= small) { @@ -93,7 +94,8 @@ ScalarComparison closeOrSmall(double reltol, double small) { }; } -ScalarComparison closeAbs(double abstol) { +ScalarComparison +closeAbs(double abstol) { return [=](double val, double ref) -> predicate_result { // Perform the comparison, exit on success if (std::abs(ref - val) <= abstol) { @@ -113,21 +115,25 @@ ScalarComparison closeAbs(double abstol) { // Matrix comparison backend (called by Eigen-related compare() overloads) template <typename Derived1, typename Derived2> -predicate_result matrixCompare(const Eigen::DenseBase<Derived1>& val, - const Eigen::DenseBase<Derived2>& ref, - ScalarComparison&& compareImpl) { +predicate_result +matrixCompare( + const Eigen::DenseBase<Derived1>& val, + const Eigen::DenseBase<Derived2>& ref, + ScalarComparison&& compareImpl) { constexpr int rows1 = Eigen::DenseBase<Derived1>::RowsAtCompileTime; constexpr int rows2 = Eigen::DenseBase<Derived2>::RowsAtCompileTime; constexpr int cols1 = Eigen::DenseBase<Derived1>::ColsAtCompileTime; constexpr int cols2 = Eigen::DenseBase<Derived2>::ColsAtCompileTime; - if constexpr (rows1 != Eigen::Dynamic && rows2 != Eigen::Dynamic && - cols1 != Eigen::Dynamic && cols2 != Eigen::Dynamic) { + if constexpr ( + rows1 != Eigen::Dynamic && rows2 != Eigen::Dynamic && + cols1 != Eigen::Dynamic && cols2 != Eigen::Dynamic) { // All dimensions on both are static. Static assert compatibility. - static_assert(rows1 == rows2, - "Input matrices do not have the same number of rows"); - static_assert(cols1 == cols2, - "Input matrices do not have the same number of columns"); + static_assert( + rows1 == rows2, "Input matrices do not have the same number of rows"); + static_assert( + cols1 == cols2, + "Input matrices do not have the same number of columns"); } else { // some are dynamic, do runtime check if (val.rows() != ref.rows() || val.cols() != ref.cols()) { @@ -160,10 +166,14 @@ predicate_result matrixCompare(const Eigen::DenseBase<Derived1>& val, // FIXME: The algorithm only supports ordered containers, so the API should // only accept them. Does someone know a clean way to do that in C++? // -template <typename Container, - typename Enable = typename Container::const_iterator> -predicate_result compare(const Container& val, const Container& ref, - ScalarComparison&& compareImpl) { +template < + typename Container, + typename Enable = typename Container::const_iterator> +predicate_result +compare( + const Container& val, + const Container& ref, + ScalarComparison&& compareImpl) { // Make sure that the two input containers have the same number of items // (in order to provide better error reporting when they don't) size_t numVals = std::distance(std::cbegin(val), std::cend(val)); @@ -208,21 +218,26 @@ predicate_result compare(const Container& val, const Container& ref, // Eigen expression template frontend template <typename T, typename U> -predicate_result compare(const Eigen::DenseBase<T>& val, - const Eigen::DenseBase<U>& ref, - ScalarComparison&& compareImpl) { +predicate_result +compare( + const Eigen::DenseBase<T>& val, + const Eigen::DenseBase<U>& ref, + ScalarComparison&& compareImpl) { return matrixCompare(val.eval(), ref.eval(), std::move(compareImpl)); } // Eigen transform frontend -predicate_result compare(const Transform3D& val, const Transform3D& ref, - ScalarComparison&& compareImpl) { +predicate_result +compare( + const Transform3D& val, + const Transform3D& ref, + ScalarComparison&& compareImpl) { return matrixCompare(val.matrix(), ref.matrix(), std::move(compareImpl)); } // Scalar frontend -predicate_result compare(double val, double ref, - ScalarComparison&& compareImpl) { +predicate_result +compare(double val, double ref, ScalarComparison&& compareImpl) { return compareImpl(val, ref); } } // namespace float_compare_internal @@ -230,40 +245,42 @@ predicate_result compare(double val, double ref, // ...and with all that, we can implement the CHECK_XYZ macros template <typename T, typename U> -boost::test_tools::predicate_result checkCloseRel(const T& val, const U& ref, - double reltol) { +boost::test_tools::predicate_result +checkCloseRel(const T& val, const U& ref, double reltol) { using namespace float_compare_internal; return compare(val, ref, closeOrSmall(reltol, 0.)); } template <typename T, typename U> -boost::test_tools::predicate_result checkCloseAbs(const T& val, const U& ref, - double abstol) { +boost::test_tools::predicate_result +checkCloseAbs(const T& val, const U& ref, double abstol) { using namespace float_compare_internal; return compare(val, ref, closeAbs(abstol)); } template <typename T> -boost::test_tools::predicate_result checkSmall(const T& val, double small) { +boost::test_tools::predicate_result +checkSmall(const T& val, double small) { using namespace float_compare_internal; return compare(val, val, closeOrSmall(0., small)); } template <typename T, typename U> -boost::test_tools::predicate_result checkCloseOrSmall(const T& val, - const U& ref, - double reltol, - double small) { +boost::test_tools::predicate_result +checkCloseOrSmall(const T& val, const U& ref, double reltol, double small) { using namespace float_compare_internal; return compare(val, ref, closeOrSmall(reltol, small)); } template <typename Scalar, int dim> -boost::test_tools::predicate_result checkCloseCovariance( +boost::test_tools::predicate_result +checkCloseCovariance( const ActsSymMatrix<Scalar, dim>& val, - const ActsSymMatrix<Scalar, dim>& ref, double tol) { - static_assert(dim != Eigen::Dynamic, - "Dynamic-size matrices are currently unsupported."); + const ActsSymMatrix<Scalar, dim>& ref, + double tol) { + static_assert( + dim != Eigen::Dynamic, + "Dynamic-size matrices are currently unsupported."); for (int col = 0; col < dim; ++col) { for (int row = col; row < dim; ++row) { diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp index c53b5643d..7db25256d 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp @@ -20,18 +20,22 @@ class LineSurfaceStub : public LineSurface { public: LineSurfaceStub() = delete; // - LineSurfaceStub(std::shared_ptr<const Transform3D> htrans, double radius, - double halfz) + LineSurfaceStub( + std::shared_ptr<const Transform3D> htrans, + double radius, + double halfz) : GeometryObject(), LineSurface(htrans, radius, halfz) { /* nop */ } // - LineSurfaceStub(std::shared_ptr<const Transform3D> htrans, - std::shared_ptr<const LineBounds> lbounds = nullptr) + LineSurfaceStub( + std::shared_ptr<const Transform3D> htrans, + std::shared_ptr<const LineBounds> lbounds = nullptr) : GeometryObject(), LineSurface(htrans, lbounds) { /*nop */ } // - LineSurfaceStub(std::shared_ptr<const LineBounds> lbounds, - const DetectorElementBase& detelement) + LineSurfaceStub( + std::shared_ptr<const LineBounds> lbounds, + const DetectorElementBase& detelement) : GeometryObject(), LineSurface(lbounds, detelement) { /* nop */ } @@ -40,27 +44,36 @@ class LineSurfaceStub : public LineSurface { : GeometryObject(), LineSurface(ls) { /* nop */ } // - LineSurfaceStub(const GeometryContext& gctx, const LineSurfaceStub& ls, - const Transform3D& t) + LineSurfaceStub( + const GeometryContext& gctx, + const LineSurfaceStub& ls, + const Transform3D& t) : GeometryObject(), LineSurface(gctx, ls, t) { /* nop */ } /// pure virtual functions of baseclass implemented here - std::shared_ptr<LineSurfaceStub> clone(const GeometryContext& /*gctx*/, - const Transform3D& /*unused*/) const { + std::shared_ptr<LineSurfaceStub> + clone(const GeometryContext& /*gctx*/, const Transform3D& /*unused*/) const { return nullptr; } /// Return method for the Surface type to avoid dynamic casts - SurfaceType type() const final { return Surface::Straw; } + SurfaceType + type() const final { + return Surface::Straw; + } /// Simply return true to show object exists and is callable - bool constructedOk() const { return true; } + bool + constructedOk() const { + return true; + } using Surface::normal; private: - Surface* clone_impl(const GeometryContext& /*gctx*/, - const Transform3D& /*unused*/) const { + Surface* + clone_impl(const GeometryContext& /*gctx*/, const Transform3D& /*unused*/) + const { return nullptr; } }; diff --git a/Tests/Core/EventData/BoundParametersTests.cpp b/Tests/Core/EventData/BoundParametersTests.cpp index 710872cb2..2b3b913f9 100644 --- a/Tests/Core/EventData/BoundParametersTests.cpp +++ b/Tests/Core/EventData/BoundParametersTests.cpp @@ -43,15 +43,18 @@ GeometryContext tgContext = GeometryContext(); /// BOOST_DATA_TEST_CASE( bound_to_plane_test, - bdata::random((bdata::seed = 1240, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 2351, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 3412, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 1240, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 2351, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 3412, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ bdata::random(( bdata::seed = 5732, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ @@ -62,7 +65,13 @@ BOOST_DATA_TEST_CASE( bdata::seed = 1295, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ bdata::xrange(100), - x, y, z, a, b, c, index) { + x, + y, + z, + a, + b, + c, + index) { (void)index; Vector3D center{x, y, z}; auto transform = std::make_shared<Transform3D>(); @@ -96,25 +105,27 @@ BOOST_DATA_TEST_CASE( BoundParameters ataPlane_from_pars(tgContext, nullptr, pars, pSurface); consistencyCheck(ataPlane_from_pars, pos, mom, 1., 21., pars_array); // constructor from global parameters - BoundParameters ataPlane_from_global(tgContext, nullptr, pos, mom, 1., 21., - pSurface); + BoundParameters ataPlane_from_global( + tgContext, nullptr, pos, mom, 1., 21., pSurface); consistencyCheck(ataPlane_from_global, pos, mom, 1., 21., pars_array); // constructor for neutral parameters - NeutralBoundParameters n_ataPlane_from_pars(tgContext, nullptr, pars, - pSurface); + NeutralBoundParameters n_ataPlane_from_pars( + tgContext, nullptr, pars, pSurface); consistencyCheck(n_ataPlane_from_pars, pos, mom, 0., 21., pars_array); // constructor for neutral global parameters - NeutralBoundParameters n_ataPlane_from_global(tgContext, nullptr, pos, mom, - 21., pSurface); + NeutralBoundParameters n_ataPlane_from_global( + tgContext, nullptr, pos, mom, 21., pSurface); consistencyCheck(n_ataPlane_from_global, pos, mom, 0., 21., pars_array); // check shared ownership of same surface BOOST_CHECK_EQUAL(&ataPlane_from_pars.referenceSurface(), pSurface.get()); - BOOST_CHECK_EQUAL(&ataPlane_from_pars.referenceSurface(), - &ataPlane_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &ataPlane_from_pars.referenceSurface(), + &ataPlane_from_global.referenceSurface()); BOOST_CHECK_EQUAL(&n_ataPlane_from_pars.referenceSurface(), pSurface.get()); - BOOST_CHECK_EQUAL(&n_ataPlane_from_pars.referenceSurface(), - &n_ataPlane_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &n_ataPlane_from_pars.referenceSurface(), + &n_ataPlane_from_global.referenceSurface()); BOOST_CHECK_EQUAL(pSurface.use_count(), 5); // check that the reference frame is the rotation matrix @@ -141,8 +152,9 @@ BOOST_DATA_TEST_CASE( ataPlane_from_pars.set<Acts::eQOP>(tgContext, uqop); ataPlane_from_pars.set<Acts::eT>(tgContext, ut); // we should have a new updated momentum - Vector3D umomentum = 40. * Vector3D(cos(uphi) * sin(utheta), - sin(uphi) * sin(utheta), cos(utheta)); + Vector3D umomentum = + 40. * + Vector3D(cos(uphi) * sin(utheta), sin(uphi) * sin(utheta), cos(utheta)); CHECK_CLOSE_REL(umomentum, ataPlane_from_pars.momentum(), 1e-6); } @@ -151,15 +163,18 @@ BOOST_DATA_TEST_CASE( /// BOOST_DATA_TEST_CASE( bound_to_disc_test, - bdata::random((bdata::seed = 9810, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 1221, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 12132, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 9810, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 1221, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 12132, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ bdata::random(( bdata::seed = 16783, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ @@ -170,7 +185,13 @@ BOOST_DATA_TEST_CASE( bdata::seed = 77615, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ bdata::xrange(100), - x, y, z, a, b, c, index) { + x, + y, + z, + a, + b, + c, + index) { (void)index; Vector3D center{x, y, z}; auto transform = std::make_shared<Transform3D>(); @@ -202,25 +223,27 @@ BOOST_DATA_TEST_CASE( BoundParameters ataDisc_from_pars(tgContext, nullptr, pars, dSurface); consistencyCheck(ataDisc_from_pars, pos, mom, 1., 21., pars_array); // constructor from global parameters - BoundParameters ataDisc_from_global(tgContext, nullptr, pos, mom, 1., 21., - dSurface); + BoundParameters ataDisc_from_global( + tgContext, nullptr, pos, mom, 1., 21., dSurface); consistencyCheck(ataDisc_from_global, pos, mom, 1., 21., pars_array); // constructor for neutral parameters - NeutralBoundParameters n_ataDisc_from_pars(tgContext, nullptr, pars, - dSurface); + NeutralBoundParameters n_ataDisc_from_pars( + tgContext, nullptr, pars, dSurface); consistencyCheck(n_ataDisc_from_pars, pos, mom, 0., 21., pars_array); // constructor for neutral global parameters - NeutralBoundParameters n_ataDisc_from_global(tgContext, nullptr, pos, mom, - 21., dSurface); + NeutralBoundParameters n_ataDisc_from_global( + tgContext, nullptr, pos, mom, 21., dSurface); consistencyCheck(n_ataDisc_from_global, pos, mom, 0., 21., pars_array); // check shared ownership of same surface BOOST_CHECK_EQUAL(&ataDisc_from_pars.referenceSurface(), dSurface.get()); - BOOST_CHECK_EQUAL(&ataDisc_from_pars.referenceSurface(), - &ataDisc_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &ataDisc_from_pars.referenceSurface(), + &ataDisc_from_global.referenceSurface()); BOOST_CHECK_EQUAL(&n_ataDisc_from_pars.referenceSurface(), dSurface.get()); - BOOST_CHECK_EQUAL(&n_ataDisc_from_pars.referenceSurface(), - &n_ataDisc_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &n_ataDisc_from_pars.referenceSurface(), + &n_ataDisc_from_global.referenceSurface()); BOOST_CHECK_EQUAL(dSurface.use_count(), 5); // check that the reference frame is the @@ -234,15 +257,18 @@ BOOST_DATA_TEST_CASE( /// BOOST_DATA_TEST_CASE( bound_to_cylinder_test, - bdata::random((bdata::seed = 39810, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 21221, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 62132, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 39810, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 21221, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 62132, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ bdata::random(( bdata::seed = 91683, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ @@ -253,7 +279,13 @@ BOOST_DATA_TEST_CASE( bdata::seed = 72615, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ bdata::xrange(100), - x, y, z, a, b, c, index) { + x, + y, + z, + a, + b, + c, + index) { (void)index; Vector3D center{x, y, z}; @@ -292,26 +324,28 @@ BOOST_DATA_TEST_CASE( BoundParameters ataCylinder_from_pars(tgContext, nullptr, pars, cSurface); consistencyCheck(ataCylinder_from_pars, pos, mom, 1., 21., pars_array); // constructor from global parameters - BoundParameters ataCylinder_from_global(tgContext, nullptr, pos, mom, 1., 21., - cSurface); + BoundParameters ataCylinder_from_global( + tgContext, nullptr, pos, mom, 1., 21., cSurface); consistencyCheck(ataCylinder_from_global, pos, mom, 1., 21., pars_array); // constructor for neutral parameters - NeutralBoundParameters n_ataCylinder_from_pars(tgContext, nullptr, pars, - cSurface); + NeutralBoundParameters n_ataCylinder_from_pars( + tgContext, nullptr, pars, cSurface); consistencyCheck(n_ataCylinder_from_pars, pos, mom, 0., 21., pars_array); // constructor for neutral global parameters - NeutralBoundParameters n_ataCylinder_from_global(tgContext, nullptr, pos, mom, - 21., cSurface); + NeutralBoundParameters n_ataCylinder_from_global( + tgContext, nullptr, pos, mom, 21., cSurface); consistencyCheck(n_ataCylinder_from_global, pos, mom, 0., 21., pars_array); // check shared ownership of same surface BOOST_CHECK_EQUAL(&ataCylinder_from_pars.referenceSurface(), cSurface.get()); - BOOST_CHECK_EQUAL(&ataCylinder_from_pars.referenceSurface(), - &ataCylinder_from_global.referenceSurface()); - BOOST_CHECK_EQUAL(&n_ataCylinder_from_pars.referenceSurface(), - cSurface.get()); - BOOST_CHECK_EQUAL(&n_ataCylinder_from_pars.referenceSurface(), - &n_ataCylinder_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &ataCylinder_from_pars.referenceSurface(), + &ataCylinder_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &n_ataCylinder_from_pars.referenceSurface(), cSurface.get()); + BOOST_CHECK_EQUAL( + &n_ataCylinder_from_pars.referenceSurface(), + &n_ataCylinder_from_global.referenceSurface()); BOOST_CHECK_EQUAL(cSurface.use_count(), 5); auto pPosition = ataCylinder_from_pars.position(); @@ -325,8 +359,8 @@ BOOST_DATA_TEST_CASE( refframe.col(1) = transverse_y; refframe.col(2) = normal_at_intersect; // check if the manually constructed reference frame is the provided one - CHECK_CLOSE_REL(ataCylinder_from_pars.referenceFrame(tgContext), refframe, - 1e-6); + CHECK_CLOSE_REL( + ataCylinder_from_pars.referenceFrame(tgContext), refframe, 1e-6); } /// @brief Unit test for parameters at the perigee @@ -336,12 +370,14 @@ BOOST_DATA_TEST_CASE( bdata::random( (bdata::seed = 3980, bdata::distribution = std::uniform_real_distribution<>(-10., 10.))) ^ - bdata::random((bdata::seed = 2221, - bdata::distribution = - std::uniform_real_distribution<>(-10., 10.))) ^ - bdata::random((bdata::seed = 2132, - bdata::distribution = - std::uniform_real_distribution<>(-10., 10.))) ^ + bdata::random( + (bdata::seed = 2221, + bdata::distribution = + std::uniform_real_distribution<>(-10., 10.))) ^ + bdata::random( + (bdata::seed = 2132, + bdata::distribution = + std::uniform_real_distribution<>(-10., 10.))) ^ bdata::random(( bdata::seed = 9183, bdata::distribution = std::uniform_real_distribution<>(0., 0.05))) ^ @@ -349,7 +385,12 @@ BOOST_DATA_TEST_CASE( bdata::seed = 3947, bdata::distribution = std::uniform_real_distribution<>(0., 0.05))) ^ bdata::xrange(100), - x, y, z, a, b, index) { + x, + y, + z, + a, + b, + index) { (void)index; Vector3D center{x, y, z}; auto transform = std::make_shared<Transform3D>(); @@ -375,25 +416,27 @@ BOOST_DATA_TEST_CASE( auto mom = ataPerigee_from_pars.momentum(); consistencyCheck(ataPerigee_from_pars, pos, mom, 1., 21., pars_array); // constructor from global parameters - BoundParameters ataPerigee_from_global(tgContext, nullptr, pos, mom, 1., 21., - pSurface); + BoundParameters ataPerigee_from_global( + tgContext, nullptr, pos, mom, 1., 21., pSurface); consistencyCheck(ataPerigee_from_global, pos, mom, 1., 21., pars_array); // constructor for neutral parameters - NeutralBoundParameters n_ataPerigee_from_pars(tgContext, nullptr, pars, - pSurface); + NeutralBoundParameters n_ataPerigee_from_pars( + tgContext, nullptr, pars, pSurface); consistencyCheck(n_ataPerigee_from_pars, pos, mom, 0., 21., pars_array); // constructor for neutral global parameters - NeutralBoundParameters n_ataPerigee_from_global(tgContext, nullptr, pos, mom, - 21., pSurface); + NeutralBoundParameters n_ataPerigee_from_global( + tgContext, nullptr, pos, mom, 21., pSurface); consistencyCheck(n_ataPerigee_from_global, pos, mom, 0., 21., pars_array); // check shared ownership of same surface BOOST_CHECK_EQUAL(&ataPerigee_from_pars.referenceSurface(), pSurface.get()); - BOOST_CHECK_EQUAL(&ataPerigee_from_pars.referenceSurface(), - &ataPerigee_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &ataPerigee_from_pars.referenceSurface(), + &ataPerigee_from_global.referenceSurface()); BOOST_CHECK_EQUAL(&n_ataPerigee_from_pars.referenceSurface(), pSurface.get()); - BOOST_CHECK_EQUAL(&n_ataPerigee_from_pars.referenceSurface(), - &n_ataPerigee_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &n_ataPerigee_from_pars.referenceSurface(), + &n_ataPerigee_from_global.referenceSurface()); BOOST_CHECK_EQUAL(pSurface.use_count(), 5); } @@ -401,15 +444,18 @@ BOOST_DATA_TEST_CASE( /// BOOST_DATA_TEST_CASE( bound_to_line_test, - bdata::random((bdata::seed = 73980, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 21221, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ - bdata::random((bdata::seed = 62992, - bdata::distribution = - std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 73980, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 21221, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ + bdata::random( + (bdata::seed = 62992, + bdata::distribution = + std::uniform_real_distribution<>(-1000., 1000.))) ^ bdata::random(( bdata::seed = 900683, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ @@ -420,7 +466,13 @@ BOOST_DATA_TEST_CASE( bdata::seed = 1972615, bdata::distribution = std::uniform_real_distribution<>(0., M_PI))) ^ bdata::xrange(100), - x, y, z, a, b, c, index) { + x, + y, + z, + a, + b, + c, + index) { using namespace Acts::UnitLiterals; (void)index; @@ -450,25 +502,27 @@ BOOST_DATA_TEST_CASE( auto mom = ataLine_from_pars.momentum(); consistencyCheck(ataLine_from_pars, pos, mom, 1., 21., pars_array); // constructor from global parameters - BoundParameters ataLine_from_global(tgContext, nullptr, pos, mom, 1., 21., - sSurface); + BoundParameters ataLine_from_global( + tgContext, nullptr, pos, mom, 1., 21., sSurface); consistencyCheck(ataLine_from_global, pos, mom, 1., 21., pars_array); // constructor for neutral parameters - NeutralBoundParameters n_ataLine_from_pars(tgContext, nullptr, pars, - sSurface); + NeutralBoundParameters n_ataLine_from_pars( + tgContext, nullptr, pars, sSurface); consistencyCheck(n_ataLine_from_pars, pos, mom, 0., 21., pars_array); // constructor for neutral global parameters - NeutralBoundParameters n_ataLine_from_global(tgContext, nullptr, pos, mom, - 21., sSurface); + NeutralBoundParameters n_ataLine_from_global( + tgContext, nullptr, pos, mom, 21., sSurface); consistencyCheck(n_ataLine_from_global, pos, mom, 0., 21., pars_array); // check shared ownership of same surface BOOST_CHECK_EQUAL(&ataLine_from_pars.referenceSurface(), sSurface.get()); - BOOST_CHECK_EQUAL(&ataLine_from_pars.referenceSurface(), - &ataLine_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &ataLine_from_pars.referenceSurface(), + &ataLine_from_global.referenceSurface()); BOOST_CHECK_EQUAL(&n_ataLine_from_pars.referenceSurface(), sSurface.get()); - BOOST_CHECK_EQUAL(&n_ataLine_from_pars.referenceSurface(), - &n_ataLine_from_global.referenceSurface()); + BOOST_CHECK_EQUAL( + &n_ataLine_from_pars.referenceSurface(), + &n_ataLine_from_global.referenceSurface()); BOOST_CHECK_EQUAL(sSurface.use_count(), 5); } } // namespace Test diff --git a/Tests/Core/EventData/CurvilinearParametersTests.cpp b/Tests/Core/EventData/CurvilinearParametersTests.cpp index ab0f46c85..76ce42923 100644 --- a/Tests/Core/EventData/CurvilinearParametersTests.cpp +++ b/Tests/Core/EventData/CurvilinearParametersTests.cpp @@ -49,28 +49,38 @@ BOOST_AUTO_TEST_CASE(curvilinear_initialization) { const double oOp = 1. / mom.norm(); // check parameters - consistencyCheck(curvilinear_pos, pos, mom, +1_e, 1_s, - {0., 0., fphi, ftheta, oOp, 1_s}); - consistencyCheck(curvilinear_neg, pos, mom, -1_e, 2.5_s, - {0., 0., fphi, ftheta, -oOp, 2.5_s}); - consistencyCheck(curvilinear_neut, pos, mom, 0., 33.33_s, - {0., 0., fphi, ftheta, oOp, 33.33_s}); + consistencyCheck( + curvilinear_pos, pos, mom, +1_e, 1_s, {0., 0., fphi, ftheta, oOp, 1_s}); + consistencyCheck( + curvilinear_neg, + pos, + mom, + -1_e, + 2.5_s, + {0., 0., fphi, ftheta, -oOp, 2.5_s}); + consistencyCheck( + curvilinear_neut, + pos, + mom, + 0., + 33.33_s, + {0., 0., fphi, ftheta, oOp, 33.33_s}); // check that the created surface is at the position - CHECK_CLOSE_REL(curvilinear_pos.referenceSurface().center(tgContext), pos, - 1e-6); - CHECK_CLOSE_REL(curvilinear_neg.referenceSurface().center(tgContext), pos, - 1e-6); - CHECK_CLOSE_REL(curvilinear_neut.referenceSurface().center(tgContext), pos, - 1e-6); + CHECK_CLOSE_REL( + curvilinear_pos.referenceSurface().center(tgContext), pos, 1e-6); + CHECK_CLOSE_REL( + curvilinear_neg.referenceSurface().center(tgContext), pos, 1e-6); + CHECK_CLOSE_REL( + curvilinear_neut.referenceSurface().center(tgContext), pos, 1e-6); // check that the z-axis of the created surface is along momentum direction - CHECK_CLOSE_REL(curvilinear_pos.referenceSurface().normal(tgContext, pos), - dir, 1e-6); - CHECK_CLOSE_REL(curvilinear_neg.referenceSurface().normal(tgContext, pos), - dir, 1e-6); - CHECK_CLOSE_REL(curvilinear_neut.referenceSurface().normal(tgContext, pos), - dir, 1e-6); + CHECK_CLOSE_REL( + curvilinear_pos.referenceSurface().normal(tgContext, pos), dir, 1e-6); + CHECK_CLOSE_REL( + curvilinear_neg.referenceSurface().normal(tgContext, pos), dir, 1e-6); + CHECK_CLOSE_REL( + curvilinear_neut.referenceSurface().normal(tgContext, pos), dir, 1e-6); // check the reference frame of curvilinear parameters // it is the x-y frame of the created surface @@ -81,12 +91,12 @@ BOOST_AUTO_TEST_CASE(curvilinear_initialization) { mFrame.col(0) = uAxis; mFrame.col(1) = vAxis; mFrame.col(2) = tAxis; - CHECK_CLOSE_OR_SMALL(mFrame, curvilinear_pos.referenceFrame(tgContext), 1e-6, - 1e-9); - CHECK_CLOSE_OR_SMALL(mFrame, curvilinear_neg.referenceFrame(tgContext), 1e-6, - 1e-9); - CHECK_CLOSE_OR_SMALL(mFrame, curvilinear_neut.referenceFrame(tgContext), 1e-6, - 1e-9); + CHECK_CLOSE_OR_SMALL( + mFrame, curvilinear_pos.referenceFrame(tgContext), 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + mFrame, curvilinear_neg.referenceFrame(tgContext), 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + mFrame, curvilinear_neut.referenceFrame(tgContext), 1e-6, 1e-9); /// copy construction test CurvilinearParameters curvilinear_pos_copy(curvilinear_pos); @@ -112,8 +122,10 @@ BOOST_AUTO_TEST_CASE(curvilinear_initialization) { // the position should be updated CHECK_CLOSE_REL(curvilinear_pos_copy.position(), uposition, 1e-6); // it should be the position of the surface - CHECK_CLOSE_REL(curvilinear_pos_copy.referenceSurface().center(tgContext), - uposition, 1e-6); + CHECK_CLOSE_REL( + curvilinear_pos_copy.referenceSurface().center(tgContext), + uposition, + 1e-6); double uphi = 1.2; double utheta = 0.2; @@ -131,12 +143,13 @@ BOOST_AUTO_TEST_CASE(curvilinear_initialization) { 1_GeV; CHECK_CLOSE_REL(umomentum, curvilinear_pos_copy.momentum(), 1e-6); // the updated momentum should be the col(2) of the transform - CHECK_CLOSE_REL(umomentum.normalized(), - curvilinear_pos_copy.referenceSurface() - .transform(tgContext) - .rotation() - .col(2), - 1e-6); + CHECK_CLOSE_REL( + umomentum.normalized(), + curvilinear_pos_copy.referenceSurface() + .transform(tgContext) + .rotation() + .col(2), + 1e-6); } } // namespace Test } // namespace Acts diff --git a/Tests/Core/EventData/FittableTypeTests.cpp b/Tests/Core/EventData/FittableTypeTests.cpp index 62b40d510..93a156bb2 100644 --- a/Tests/Core/EventData/FittableTypeTests.cpp +++ b/Tests/Core/EventData/FittableTypeTests.cpp @@ -50,27 +50,64 @@ BOOST_AUTO_TEST_CASE(index_combination_generation_test) { } { constexpr auto result = detail::unique_ordered_sublists<3>(); - constexpr auto expected = hana::make_tuple(_T(0), _T(1), _T(0, 1), _T(2), - _T(0, 2), _T(1, 2), _T(0, 1, 2)); + constexpr auto expected = hana::make_tuple( + _T(0), _T(1), _T(0, 1), _T(2), _T(0, 2), _T(1, 2), _T(0, 1, 2)); static_assert(result == expected, "At size 3 is not equal"); } { constexpr auto result = detail::unique_ordered_sublists<4>(); - constexpr auto expected = - hana::make_tuple(_T(0), _T(1), _T(0, 1), _T(2), _T(0, 2), _T(1, 2), - _T(0, 1, 2), _T(3), _T(0, 3), _T(1, 3), _T(0, 1, 3), - _T(2, 3), _T(0, 2, 3), _T(1, 2, 3), _T(0, 1, 2, 3)); + constexpr auto expected = hana::make_tuple( + _T(0), + _T(1), + _T(0, 1), + _T(2), + _T(0, 2), + _T(1, 2), + _T(0, 1, 2), + _T(3), + _T(0, 3), + _T(1, 3), + _T(0, 1, 3), + _T(2, 3), + _T(0, 2, 3), + _T(1, 2, 3), + _T(0, 1, 2, 3)); static_assert(result == expected, "At size 4 is not equal"); } { constexpr auto result = detail::unique_ordered_sublists<5>(); constexpr auto expected = hana::make_tuple( - _T(0), _T(1), _T(0, 1), _T(2), _T(0, 2), _T(1, 2), _T(0, 1, 2), _T(3), - _T(0, 3), _T(1, 3), _T(0, 1, 3), _T(2, 3), _T(0, 2, 3), _T(1, 2, 3), - _T(0, 1, 2, 3), _T(4), _T(0, 4), _T(1, 4), _T(0, 1, 4), _T(2, 4), - _T(0, 2, 4), _T(1, 2, 4), _T(0, 1, 2, 4), _T(3, 4), _T(0, 3, 4), - _T(1, 3, 4), _T(0, 1, 3, 4), _T(2, 3, 4), _T(0, 2, 3, 4), - _T(1, 2, 3, 4), _T(0, 1, 2, 3, 4)); + _T(0), + _T(1), + _T(0, 1), + _T(2), + _T(0, 2), + _T(1, 2), + _T(0, 1, 2), + _T(3), + _T(0, 3), + _T(1, 3), + _T(0, 1, 3), + _T(2, 3), + _T(0, 2, 3), + _T(1, 2, 3), + _T(0, 1, 2, 3), + _T(4), + _T(0, 4), + _T(1, 4), + _T(0, 1, 4), + _T(2, 4), + _T(0, 2, 4), + _T(1, 2, 4), + _T(0, 1, 2, 4), + _T(3, 4), + _T(0, 3, 4), + _T(1, 3, 4), + _T(0, 1, 3, 4), + _T(2, 3, 4), + _T(0, 2, 3, 4), + _T(1, 2, 3, 4), + _T(0, 1, 2, 3, 4)); static_assert(result == expected, "At size 5 is not equal"); } } @@ -91,57 +128,72 @@ BOOST_AUTO_TEST_CASE(variant_measurement_generation_test) { { using actual = detail::type_generator_t<meas_factory, 1>; using expected = std::variant<Measurement<SourceLink, 0_p>>; - static_assert(std::is_same<actual, expected>::value, - "Variant is not identical"); + static_assert( + std::is_same<actual, expected>::value, "Variant is not identical"); } { using actual = detail::type_generator_t<meas_factory, 2>; - using expected = - std::variant<Measurement<SourceLink, 0_p>, Measurement<SourceLink, 1_p>, - Measurement<SourceLink, 0_p, 1_p>>; - static_assert(std::is_same<actual, expected>::value, - "Variant is not identical"); + using expected = std::variant< + Measurement<SourceLink, 0_p>, + Measurement<SourceLink, 1_p>, + Measurement<SourceLink, 0_p, 1_p>>; + static_assert( + std::is_same<actual, expected>::value, "Variant is not identical"); } { using actual = detail::type_generator_t<meas_factory, 3>; using expected = std::variant< - Measurement<SourceLink, 0_p>, Measurement<SourceLink, 1_p>, - Measurement<SourceLink, 0_p, 1_p>, Measurement<SourceLink, 2_p>, - Measurement<SourceLink, 0_p, 2_p>, Measurement<SourceLink, 1_p, 2_p>, + Measurement<SourceLink, 0_p>, + Measurement<SourceLink, 1_p>, + Measurement<SourceLink, 0_p, 1_p>, + Measurement<SourceLink, 2_p>, + Measurement<SourceLink, 0_p, 2_p>, + Measurement<SourceLink, 1_p, 2_p>, Measurement<SourceLink, 0_p, 1_p, 2_p>>; - static_assert(std::is_same<actual, expected>::value, - "Variant is not identical"); + static_assert( + std::is_same<actual, expected>::value, "Variant is not identical"); } { using actual = detail::type_generator_t<meas_factory, 4>; using expected = std::variant< - Measurement<SourceLink, 0_p>, Measurement<SourceLink, 1_p>, - Measurement<SourceLink, 0_p, 1_p>, Measurement<SourceLink, 2_p>, - Measurement<SourceLink, 0_p, 2_p>, Measurement<SourceLink, 1_p, 2_p>, - Measurement<SourceLink, 0_p, 1_p, 2_p>, Measurement<SourceLink, 3_p>, - Measurement<SourceLink, 0_p, 3_p>, Measurement<SourceLink, 1_p, 3_p>, + Measurement<SourceLink, 0_p>, + Measurement<SourceLink, 1_p>, + Measurement<SourceLink, 0_p, 1_p>, + Measurement<SourceLink, 2_p>, + Measurement<SourceLink, 0_p, 2_p>, + Measurement<SourceLink, 1_p, 2_p>, + Measurement<SourceLink, 0_p, 1_p, 2_p>, + Measurement<SourceLink, 3_p>, + Measurement<SourceLink, 0_p, 3_p>, + Measurement<SourceLink, 1_p, 3_p>, Measurement<SourceLink, 0_p, 1_p, 3_p>, Measurement<SourceLink, 2_p, 3_p>, Measurement<SourceLink, 0_p, 2_p, 3_p>, Measurement<SourceLink, 1_p, 2_p, 3_p>, Measurement<SourceLink, 0_p, 1_p, 2_p, 3_p>>; - static_assert(std::is_same<actual, expected>::value, - "Variant is not identical"); + static_assert( + std::is_same<actual, expected>::value, "Variant is not identical"); } { using actual = detail::type_generator_t<meas_factory, 5>; using expected = std::variant< - Measurement<SourceLink, 0_p>, Measurement<SourceLink, 1_p>, - Measurement<SourceLink, 0_p, 1_p>, Measurement<SourceLink, 2_p>, - Measurement<SourceLink, 0_p, 2_p>, Measurement<SourceLink, 1_p, 2_p>, - Measurement<SourceLink, 0_p, 1_p, 2_p>, Measurement<SourceLink, 3_p>, - Measurement<SourceLink, 0_p, 3_p>, Measurement<SourceLink, 1_p, 3_p>, + Measurement<SourceLink, 0_p>, + Measurement<SourceLink, 1_p>, + Measurement<SourceLink, 0_p, 1_p>, + Measurement<SourceLink, 2_p>, + Measurement<SourceLink, 0_p, 2_p>, + Measurement<SourceLink, 1_p, 2_p>, + Measurement<SourceLink, 0_p, 1_p, 2_p>, + Measurement<SourceLink, 3_p>, + Measurement<SourceLink, 0_p, 3_p>, + Measurement<SourceLink, 1_p, 3_p>, Measurement<SourceLink, 0_p, 1_p, 3_p>, Measurement<SourceLink, 2_p, 3_p>, Measurement<SourceLink, 0_p, 2_p, 3_p>, Measurement<SourceLink, 1_p, 2_p, 3_p>, Measurement<SourceLink, 0_p, 1_p, 2_p, 3_p>, - Measurement<SourceLink, 4_p>, Measurement<SourceLink, 0_p, 4_p>, + Measurement<SourceLink, 4_p>, + Measurement<SourceLink, 0_p, 4_p>, Measurement<SourceLink, 1_p, 4_p>, Measurement<SourceLink, 0_p, 1_p, 4_p>, Measurement<SourceLink, 2_p, 4_p>, @@ -156,8 +208,8 @@ BOOST_AUTO_TEST_CASE(variant_measurement_generation_test) { Measurement<SourceLink, 0_p, 2_p, 3_p, 4_p>, Measurement<SourceLink, 1_p, 2_p, 3_p, 4_p>, Measurement<SourceLink, 0_p, 1_p, 2_p, 3_p, 4_p>>; - static_assert(std::is_same<actual, expected>::value, - "Variant is not identical"); + static_assert( + std::is_same<actual, expected>::value, "Variant is not identical"); } } } // namespace Test diff --git a/Tests/Core/EventData/MeasurementHelpersTests.cpp b/Tests/Core/EventData/MeasurementHelpersTests.cpp index 3bd4c22b6..23064b5c5 100644 --- a/Tests/Core/EventData/MeasurementHelpersTests.cpp +++ b/Tests/Core/EventData/MeasurementHelpersTests.cpp @@ -32,8 +32,8 @@ BOOST_AUTO_TEST_CASE(getSurface_test) { ActsSymMatrixD<2> cov; cov << 0.04, 0, 0, 0.1; - MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m(cylinder, {}, - std::move(cov), -0.1, 0.45); + MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m( + cylinder, {}, std::move(cov), -0.1, 0.45); FittableMeasurement fm = m; @@ -50,8 +50,8 @@ BOOST_AUTO_TEST_CASE(getSize_test) { ActsSymMatrixD<2> cov; cov << 0.04, 0, 0, 0.1; - MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m(cylinder, {}, - std::move(cov), -0.1, 0.45); + MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m( + cylinder, {}, std::move(cov), -0.1, 0.45); FittableMeasurement fm = m; BOOST_CHECK_EQUAL(MeasurementHelpers::getSize(fm), 2); @@ -70,8 +70,8 @@ BOOST_AUTO_TEST_CASE(MinimalSourceLinkTest) { ActsSymMatrixD<2> cov; cov << 0.04, 0, 0, 0.1; - MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m(cylinder, {}, - std::move(cov), -0.1, 0.45); + MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m( + cylinder, {}, std::move(cov), -0.1, 0.45); FittableMeasurement fm = m; MinimalSourceLink msl{&fm}; @@ -113,11 +113,11 @@ BOOST_AUTO_TEST_CASE(visit_measurement_test) { BOOST_CHECK_EQUAL(cov, covFullConst.topLeftCorner(i, i)); }); - visit_measurement(parFull, covFull, i, - [&](const auto param, const auto cov) { - BOOST_CHECK_EQUAL(param, parFull.head(i)); - BOOST_CHECK_EQUAL(cov, covFull.topLeftCorner(i, i)); - }); + visit_measurement( + parFull, covFull, i, [&](const auto param, const auto cov) { + BOOST_CHECK_EQUAL(param, parFull.head(i)); + BOOST_CHECK_EQUAL(cov, covFull.topLeftCorner(i, i)); + }); } } diff --git a/Tests/Core/EventData/MeasurementTests.cpp b/Tests/Core/EventData/MeasurementTests.cpp index 0d87d47b8..ada2ce436 100644 --- a/Tests/Core/EventData/MeasurementTests.cpp +++ b/Tests/Core/EventData/MeasurementTests.cpp @@ -32,8 +32,8 @@ BOOST_AUTO_TEST_CASE(measurement_initialization) { ActsSymMatrixD<2> cov; cov << 0.04, 0, 0, 0.1; - MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m(cylinder, {}, - std::move(cov), -0.1, 0.45); + MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1> m( + cylinder, {}, std::move(cov), -0.1, 0.45); std::default_random_engine generator(42); @@ -66,8 +66,8 @@ BOOST_AUTO_TEST_CASE(measurement_initialization) { std::vector<MeasurementType<ParDef::eLOC_0, ParDef::eLOC_1>> caMeasurements{ std::move(mcCopy), std::move(mcAssigned)}; - auto plane = Surface::makeShared<PlaneSurface>(Vector3D(0., 0., 0.), - Vector3D(1., 0., 0.)); + auto plane = Surface::makeShared<PlaneSurface>( + Vector3D(0., 0., 0.), Vector3D(1., 0., 0.)); ActsSymMatrixD<1> covp; covp << 0.01; MeasurementType<ParDef::eLOC_0> mp(plane, {}, std::move(covp), 0.1); diff --git a/Tests/Core/EventData/ParameterSetTests.cpp b/Tests/Core/EventData/ParameterSetTests.cpp index 8bf6354ee..0fc07d642 100644 --- a/Tests/Core/EventData/ParameterSetTests.cpp +++ b/Tests/Core/EventData/ParameterSetTests.cpp @@ -35,11 +35,13 @@ namespace { // tolerance used for floating point comparison in this translation unit const double tol = 1e-6; -double get_cyclic_value(double value, double min, double max) { +double +get_cyclic_value(double value, double min, double max) { return value - (max - min) * std::floor((value - min) / (max - min)); } -double get_cyclic_difference(double a, double b, double min, double max) { +double +get_cyclic_difference(double a, double b, double min, double max) { const double period = max - min; const double half_period = period / 2; a = get_cyclic_value(a, min, max); @@ -52,7 +54,8 @@ double get_cyclic_difference(double a, double b, double min, double max) { return diff; } -void check_residuals_for_bound_parameters() { +void +check_residuals_for_bound_parameters() { const double max = par_type_t<ParID_t::eTHETA>::max; const double min = par_type_t<ParID_t::eTHETA>::min; double theta_1 = 0.7 * M_PI; @@ -114,7 +117,8 @@ void check_residuals_for_bound_parameters() { CHECK_CLOSE_REL(bound2.residual(bound1), dTheta, tol); } -void check_residuals_for_cyclic_parameters() { +void +check_residuals_for_cyclic_parameters() { const double max = par_type_t<ParID_t::ePHI>::max; const double min = par_type_t<ParID_t::ePHI>::min; @@ -149,7 +153,8 @@ void check_residuals_for_cyclic_parameters() { CHECK_CLOSE_REL(cyclic2.residual(cyclic1), -dPhi, tol); } -void random_residual_tests() { +void +random_residual_tests() { // random number generators std::default_random_engine e; std::uniform_real_distribution<float> uniform_dist(-1000, 300); @@ -206,10 +211,12 @@ void random_residual_tests() { // phi is a cyclic parameter -> check that (unsigned) difference is not // larger than half period // check that corrected(corrected(phi_2) + residual) == corrected(phi_1) - if (std::abs(get_cyclic_value( - get_cyclic_value(phi_2, phi_min, phi_max) + residual(2), - phi_min, phi_max) - - get_cyclic_value(phi_1, phi_min, phi_max)) > tol or + if (std::abs( + get_cyclic_value( + get_cyclic_value(phi_2, phi_min, phi_max) + residual(2), + phi_min, + phi_max) - + get_cyclic_value(phi_1, phi_min, phi_max)) > tol or std::abs(residual(2)) > (phi_max - phi_min) / 2) { BOOST_CHECK(false); break; @@ -282,12 +289,12 @@ BOOST_AUTO_TEST_CASE(parset_consistency_tests) { // check stored covariance BOOST_CHECK(parSet_with_cov.getCovariance() != 0); BOOST_CHECK(*parSet_with_cov.getCovariance() == cov); - BOOST_CHECK(parSet_with_cov.getUncertainty<ParID_t::eLOC_0>() == - sqrt(cov(0, 0))); - BOOST_CHECK(parSet_with_cov.getUncertainty<ParID_t::eLOC_1>() == - sqrt(cov(1, 1))); - BOOST_CHECK(parSet_with_cov.getUncertainty<ParID_t::ePHI>() == - sqrt(cov(2, 2))); + BOOST_CHECK( + parSet_with_cov.getUncertainty<ParID_t::eLOC_0>() == sqrt(cov(0, 0))); + BOOST_CHECK( + parSet_with_cov.getUncertainty<ParID_t::eLOC_1>() == sqrt(cov(1, 1))); + BOOST_CHECK( + parSet_with_cov.getUncertainty<ParID_t::ePHI>() == sqrt(cov(2, 2))); // same parameter set without covariance matrix ParameterSet<ParID_t::eLOC_0, ParID_t::eLOC_1, ParID_t::ePHI> @@ -297,8 +304,8 @@ BOOST_AUTO_TEST_CASE(parset_consistency_tests) { BOOST_CHECK(parSet_without_cov.getUncertainty<ParID_t::eLOC_0>() < 0); BOOST_CHECK(parSet_without_cov.getUncertainty<ParID_t::eLOC_1>() < 0); BOOST_CHECK(parSet_without_cov.getUncertainty<ParID_t::ePHI>() < 0); - BOOST_CHECK(parSet_without_cov.getParameters() == - parSet_with_cov.getParameters()); + BOOST_CHECK( + parSet_without_cov.getParameters() == parSet_with_cov.getParameters()); // set new covariance matrix parSet_without_cov.setCovariance( @@ -484,22 +491,36 @@ BOOST_AUTO_TEST_CASE(parset_projection_tests) { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1; BOOST_CHECK((ParameterSet<ParID_t::ePHI>::projector() == phi_proj)); - BOOST_CHECK((ParameterSet<ParID_t::eLOC_0, ParID_t::eQOP>::projector() == - loc0_qop_proj)); - BOOST_CHECK((ParameterSet<ParID_t::eLOC_1, ParID_t::eTHETA>::projector() == - loc1_theta_proj)); - BOOST_CHECK((ParameterSet<ParID_t::eLOC_0, ParID_t::eLOC_1, - ParID_t::ePHI>::projector() == loc0_loc1_phi_proj)); BOOST_CHECK( - (ParameterSet<ParID_t::eLOC_0, ParID_t::ePHI, ParID_t::eTHETA, - ParID_t::eQOP>::projector() == loc0_phi_theta_qop_proj)); - BOOST_CHECK((ParameterSet<ParID_t::eLOC_0, ParID_t::eLOC_1, ParID_t::ePHI, - ParID_t::eTHETA, ParID_t::eQOP>::projector() == - loc0_loc1_phi_theta_qop_proj)); + (ParameterSet<ParID_t::eLOC_0, ParID_t::eQOP>::projector() == + loc0_qop_proj)); + BOOST_CHECK( + (ParameterSet<ParID_t::eLOC_1, ParID_t::eTHETA>::projector() == + loc1_theta_proj)); BOOST_CHECK( - (ParameterSet<ParID_t::eLOC_0, ParID_t::eLOC_1, ParID_t::ePHI, - ParID_t::eTHETA, ParID_t::eQOP, ParID_t::eT>::projector() == - loc0_loc1_phi_theta_qop_t_proj)); + (ParameterSet<ParID_t::eLOC_0, ParID_t::eLOC_1, ParID_t::ePHI>:: + projector() == loc0_loc1_phi_proj)); + BOOST_CHECK( + (ParameterSet< + ParID_t::eLOC_0, + ParID_t::ePHI, + ParID_t::eTHETA, + ParID_t::eQOP>::projector() == loc0_phi_theta_qop_proj)); + BOOST_CHECK( + (ParameterSet< + ParID_t::eLOC_0, + ParID_t::eLOC_1, + ParID_t::ePHI, + ParID_t::eTHETA, + ParID_t::eQOP>::projector() == loc0_loc1_phi_theta_qop_proj)); + BOOST_CHECK( + (ParameterSet< + ParID_t::eLOC_0, + ParID_t::eLOC_1, + ParID_t::ePHI, + ParID_t::eTHETA, + ParID_t::eQOP, + ParID_t::eT>::projector() == loc0_loc1_phi_theta_qop_t_proj)); } /** @@ -526,11 +547,13 @@ BOOST_AUTO_TEST_CASE(parset_residual_tests) { // check bound parameter type ParameterSet<ParID_t::eTHETA> bound(nullptr, small_number); - BOOST_CHECK((bound.getParameter<ParID_t::eTHETA>() == - par_type_t<ParID_t::eTHETA>::min)); + BOOST_CHECK( + (bound.getParameter<ParID_t::eTHETA>() == + par_type_t<ParID_t::eTHETA>::min)); bound.setParameter<ParID_t::eTHETA>(large_number); - BOOST_CHECK((bound.getParameter<ParID_t::eTHETA>() == - par_type_t<ParID_t::eTHETA>::max)); + BOOST_CHECK( + (bound.getParameter<ParID_t::eTHETA>() == + par_type_t<ParID_t::eTHETA>::max)); bound.setParameter<ParID_t::eTHETA>(normal_number); BOOST_CHECK((bound.getParameter<ParID_t::eTHETA>() == normal_number)); diff --git a/Tests/Core/EventData/ParametersTestHelper.hpp b/Tests/Core/EventData/ParametersTestHelper.hpp index 6bff01019..98395f2f5 100644 --- a/Tests/Core/EventData/ParametersTestHelper.hpp +++ b/Tests/Core/EventData/ParametersTestHelper.hpp @@ -18,9 +18,14 @@ namespace Acts { namespace Test { template <typename Parameter> -void consistencyCheck(const Parameter& pars, const Vector3D& position, - const Vector3D& momentum, double charge, double time, - std::array<double, BoundParsDim> values) { +void +consistencyCheck( + const Parameter& pars, + const Vector3D& position, + const Vector3D& momentum, + double charge, + double time, + std::array<double, BoundParsDim> values) { // check parameter vector CHECK_CLOSE_ABS(pars.parameters()[eLOC_0], values[0], s_onSurfaceTolerance); CHECK_CLOSE_ABS(pars.parameters()[eLOC_1], values[1], s_onSurfaceTolerance); diff --git a/Tests/Core/EventData/TrackStateTests.cpp b/Tests/Core/EventData/TrackStateTests.cpp index 834bc3ca5..e0105cdc9 100644 --- a/Tests/Core/EventData/TrackStateTests.cpp +++ b/Tests/Core/EventData/TrackStateTests.cpp @@ -40,8 +40,8 @@ BOOST_AUTO_TEST_CASE(track_state_initialization) { std::default_random_engine generator(42); // The plane surface - auto plane = Surface::makeShared<PlaneSurface>(Vector3D{0., 0., 0.}, - Vector3D{1., 0., 0.}); + auto plane = Surface::makeShared<PlaneSurface>( + Vector3D{0., 0., 0.}, Vector3D{1., 0., 0.}); // Construct the 1D measurement ActsSymMatrixD<1> cov1D; @@ -116,8 +116,8 @@ BOOST_AUTO_TEST_CASE(track_state_initialization) { // Test the move assignment for a parameter state BoundTrackState ptsMoveAssigned = std::move(ptsCopyAssigned); - std::vector<BoundTrackState> trackStates = {std::move(mts1DMoveAssigned), - std::move(mts2D), std::move(pts)}; + std::vector<BoundTrackState> trackStates = { + std::move(mts1DMoveAssigned), std::move(mts2D), std::move(pts)}; BOOST_CHECK_EQUAL(trackStates.size(), 3); diff --git a/Tests/Core/Fitter/GainMatrixSmootherTests.cpp b/Tests/Core/Fitter/GainMatrixSmootherTests.cpp index a1b771db1..caf72f7f2 100644 --- a/Tests/Core/Fitter/GainMatrixSmootherTests.cpp +++ b/Tests/Core/Fitter/GainMatrixSmootherTests.cpp @@ -37,12 +37,12 @@ GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { // Make dummy measurement - auto plane1 = Surface::makeShared<PlaneSurface>(Vector3D::UnitX() * 1, - Vector3D::UnitX()); - auto plane2 = Surface::makeShared<PlaneSurface>(Vector3D::UnitX() * 2, - Vector3D::UnitX()); - auto plane3 = Surface::makeShared<PlaneSurface>(Vector3D::UnitX() * 3, - Vector3D::UnitX()); + auto plane1 = Surface::makeShared<PlaneSurface>( + Vector3D::UnitX() * 1, Vector3D::UnitX()); + auto plane2 = Surface::makeShared<PlaneSurface>( + Vector3D::UnitX() * 2, Vector3D::UnitX()); + auto plane3 = Surface::makeShared<PlaneSurface>( + Vector3D::UnitX() * 3, Vector3D::UnitX()); ActsSymMatrixD<2> cov; cov << 0.04, 0, 0, 0.1; @@ -71,13 +71,15 @@ BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { BoundParameters pars( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, plane1); + parValues, + plane1); parValues << 0.301, 0.503, 0.5 * M_PI, 0., 1 / 100., 0.; BoundParameters filt( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, plane1); + parValues, + plane1); TrackState ts{SourceLink{&meas1}}; @@ -94,12 +96,14 @@ BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { pars = BoundParameters( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, plane2); + parValues, + plane2); parValues << 0.27, 0.53, 0.5 * M_PI, 0., 1 / 100., 0.; filt = BoundParameters( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, plane2); + parValues, + plane2); ts.parameter.predicted = std::move(pars); ts.parameter.filtered = std::move(filt); @@ -114,12 +118,14 @@ BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { pars = BoundParameters( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, plane3); + parValues, + plane3); parValues << 0.33, 0.43, 0.5 * M_PI, 0., 1 / 100., 0.; filt = BoundParameters( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, plane3); + parValues, + plane3); ts.parameter.predicted = std::move(pars); ts.parameter.filtered = std::move(filt); @@ -138,8 +144,9 @@ BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { auto& ts1 = trackStates.at(0); BOOST_CHECK(ts1.parameter.smoothed); - BOOST_CHECK_NE(ts1.parameter.filtered->parameters(), - ts1.parameter.smoothed->parameters()); + BOOST_CHECK_NE( + ts1.parameter.filtered->parameters(), + ts1.parameter.smoothed->parameters()); double tol = 1e-6; @@ -154,8 +161,9 @@ BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { auto& ts2 = trackStates.at(1); BOOST_CHECK(ts2.parameter.smoothed); - BOOST_CHECK_NE(ts2.parameter.filtered->parameters(), - ts2.parameter.smoothed->parameters()); + BOOST_CHECK_NE( + ts2.parameter.filtered->parameters(), + ts2.parameter.smoothed->parameters()); expPars << 0.2500000, 0.4700000, 1.5707963, 0.0000000, 0.0100000, 0.0000000; CHECK_CLOSE_ABS(ts2.parameter.smoothed->parameters(), expPars, tol); @@ -164,8 +172,9 @@ BOOST_AUTO_TEST_CASE(gain_matrix_smoother) { auto& ts3 = trackStates.at(2); BOOST_CHECK(ts3.parameter.smoothed); // last one, smoothed == filtered - BOOST_CHECK_EQUAL(ts3.parameter.filtered->parameters(), - ts3.parameter.smoothed->parameters()); + BOOST_CHECK_EQUAL( + ts3.parameter.filtered->parameters(), + ts3.parameter.smoothed->parameters()); expPars << 0.3300000, 0.4300000, 1.5707963, 0.0000000, 0.0100000, 0.0000000; CHECK_CLOSE_ABS(ts3.parameter.smoothed->parameters(), expPars, tol); diff --git a/Tests/Core/Fitter/GainMatrixUpdatorTests.cpp b/Tests/Core/Fitter/GainMatrixUpdatorTests.cpp index 4f8a38c7e..096e629e4 100644 --- a/Tests/Core/Fitter/GainMatrixUpdatorTests.cpp +++ b/Tests/Core/Fitter/GainMatrixUpdatorTests.cpp @@ -57,7 +57,8 @@ BOOST_AUTO_TEST_CASE(gain_matrix_updator) { BoundParameters pars( tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), - parValues, cylinder); + parValues, + cylinder); // "update" track state with "prediction" mState.parameter.predicted = std::move(pars); @@ -78,8 +79,8 @@ BOOST_AUTO_TEST_CASE(gain_matrix_updator) { BOOST_CHECK_EQUAL( MeasurementHelpers::getSurface(*mState.measurement.calibrated), cylinder.get()); - BOOST_CHECK_EQUAL(&(*mState.parameter.filtered).referenceSurface(), - cylinder.get()); + BOOST_CHECK_EQUAL( + &(*mState.parameter.filtered).referenceSurface(), cylinder.get()); // Check for regression. This does NOT test if the math is correct, just that // the result is the same as when the test was written. diff --git a/Tests/Core/Fitter/KalmanFilterTestUtils.hpp b/Tests/Core/Fitter/KalmanFilterTestUtils.hpp index 9ecdbb78e..8d52529d4 100644 --- a/Tests/Core/Fitter/KalmanFilterTestUtils.hpp +++ b/Tests/Core/Fitter/KalmanFilterTestUtils.hpp @@ -61,8 +61,9 @@ class MyExtrapolator { /// dummy class, returns measurement unchanged class NoCalibration { public: - std::unique_ptr<const FitMeas_t> operator()(const FitMeas_t& m, - const BoundParameters&) const; + std::unique_ptr<const FitMeas_t> operator()( + const FitMeas_t& m, + const BoundParameters&) const; }; class CacheGenerator { @@ -75,8 +76,9 @@ MyExtrapolator::MyExtrapolator( : m_exEngine(std::move(exEngine)){}; /// wrapper around extrapolate call to exEngine, setting the right flags -MyCache MyExtrapolator::operator()(const FitMeas_t& m, - const TrackParameters& tp) const { +MyCache +MyExtrapolator::operator()(const FitMeas_t& m, const TrackParameters& tp) + const { auto exCell = std::make_unique<ExtrapolationCell<TrackParameters>>(tp); exCell->addConfigurationMode(ExtrapolationMode::CollectJacobians); (*exCell).pathLimit = 500; @@ -93,13 +95,13 @@ MyCache MyExtrapolator::operator()(const FitMeas_t& m, return c; }; -std::unique_ptr<const FitMeas_t> NoCalibration::operator()( - const FitMeas_t& m, const BoundParameters&) const { +std::unique_ptr<const FitMeas_t> +NoCalibration::operator()(const FitMeas_t& m, const BoundParameters&) const { return std::make_unique<const FitMeas_t>(m); }; -std::unique_ptr<KF::Step<long int>> CacheGenerator::operator()( - MyCache m) const { +std::unique_ptr<KF::Step<long int>> +CacheGenerator::operator()(MyCache m) const { auto step = std::make_unique<KF::Step<long int>>(); step->setPredictedState(std::move(m.parameters)); step->setJacobian(std::move(m.jacobian)); @@ -108,8 +110,8 @@ std::unique_ptr<KF::Step<long int>> CacheGenerator::operator()( }; /// set up extrapolation -std::shared_ptr<IExtrapolationEngine> initExtrapolator( - const std::shared_ptr<const TrackingGeometry>& geo) { +std::shared_ptr<IExtrapolationEngine> +initExtrapolator(const std::shared_ptr<const TrackingGeometry>& geo) { auto propConfig = RungeKuttaEngine<>::Config(); propConfig.fieldService = std::make_shared<ConstantBField>(0, 0, 2_T); auto propEngine = std::make_shared<RungeKuttaEngine<>>(propConfig); diff --git a/Tests/Core/Fitter/KalmanFitterTests.cpp b/Tests/Core/Fitter/KalmanFitterTests.cpp index e05bbd051..1b0c5425d 100644 --- a/Tests/Core/Fitter/KalmanFitterTests.cpp +++ b/Tests/Core/Fitter/KalmanFitterTests.cpp @@ -97,8 +97,11 @@ struct MeasurementCreator { /// @param [in] state State of the propagator /// @param [out] result Vector of matching surfaces template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // monitor the current surface auto surface = state.navigation.currentSurface; if (surface and surface->associatedDetectorElement()) { @@ -113,22 +116,24 @@ struct MeasurementCreator { if (lResolution != vResolution->second.end()) { // Apply global to local Acts::Vector2D lPos; - surface->globalToLocal(state.geoContext, - stepper.position(state.stepping), - stepper.direction(state.stepping), lPos); + surface->globalToLocal( + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + lPos); if (lResolution->second.size() == 1) { double sp = lResolution->second[0].second; cov1D << sp * sp; double dp = sp * gauss(generator); if (lResolution->second[0].first == eLOC_0) { // push back & move a LOC_0 measurement - MeasurementType<eLOC_0> m0(surface->getSharedPtr(), {}, cov1D, - lPos[eLOC_0] + dp); + MeasurementType<eLOC_0> m0( + surface->getSharedPtr(), {}, cov1D, lPos[eLOC_0] + dp); result.push_back(std::move(m0)); } else { // push back & move a LOC_1 measurement - MeasurementType<eLOC_1> m1(surface->getSharedPtr(), {}, cov1D, - lPos[eLOC_1] + dp); + MeasurementType<eLOC_1> m1( + surface->getSharedPtr(), {}, cov1D, lPos[eLOC_1] + dp); result.push_back(std::move(m1)); } } else if (lResolution->second.size() == 2) { @@ -139,9 +144,12 @@ struct MeasurementCreator { double dx = sx * gauss(generator); double dy = sy * gauss(generator); // push back & move a LOC_0, LOC_1 measurement - MeasurementType<eLOC_0, eLOC_1> m01(surface->getSharedPtr(), {}, - cov2D, lPos[eLOC_0] + dx, - lPos[eLOC_1] + dy); + MeasurementType<eLOC_0, eLOC_1> m01( + surface->getSharedPtr(), + {}, + cov2D, + lPos[eLOC_0] + dx, + lPos[eLOC_1] + dy); result.push_back(std::move(m01)); } } @@ -171,7 +179,8 @@ struct MaterialScattering { /// @param [in] state State of the propagation /// @param [in] stepper Stepper of the propagation template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper) const { + void + operator()(propagator_state_t& state, const stepper_t& stepper) const { // Check if there is a surface with material and a covariance is existing if (state.navigation.currentSurface && state.navigation.currentSurface->surfaceMaterial() && @@ -195,9 +204,10 @@ struct MaterialScattering { {std::sin(theta + dTheta) * std::cos(phi + dPhi), std::sin(theta + dTheta) * std::sin(phi + dPhi), std::cos(theta + dTheta)}, - std::max(stepper.momentum(state.stepping) - - std::abs(gauss(generator)) * UnitConstants::MeV, - 0.)); + std::max( + stepper.momentum(state.stepping) - + std::abs(gauss(generator)) * UnitConstants::MeV, + 0.)); } } }; @@ -225,8 +235,8 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { // Build propagator for the measurement creation MeasurementPropagator mPropagator(mStepper, mNavigator); Vector3D mPos(-3_m, 0., 0.), mMom(1_GeV, 0., 0); - SingleCurvilinearTrackParameters<NeutralPolicy> mStart(nullptr, mPos, mMom, - 42_ns); + SingleCurvilinearTrackParameters<NeutralPolicy> mStart( + nullptr, mPos, mMom, 42_ns); // Create action list for the measurement creation using MeasurementActions = ActionList<MeasurementCreator, DebugOutput>; @@ -279,9 +289,11 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { // Make a vector of source links as input to the KF std::vector<SourceLink> sourcelinks; - std::transform(measurements.begin(), measurements.end(), - std::back_inserter(sourcelinks), - [](const auto& m) { return SourceLink{&m}; }); + std::transform( + measurements.begin(), + measurements.end(), + std::back_inserter(sourcelinks), + [](const auto& m) { return SourceLink{&m}; }); // The KalmanFitter - we use the eigen stepper for covariance transport // Build navigator for the measurement creatoin @@ -306,11 +318,11 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { auto covPtr = std::make_unique<const Covariance>(cov); Vector3D rPos(-3_m, 10_um * gauss(generator), 100_um * gauss(generator)); - Vector3D rMom(1_GeV, 0.025_GeV * gauss(generator), - 0.025_GeV * gauss(generator)); + Vector3D rMom( + 1_GeV, 0.025_GeV * gauss(generator), 0.025_GeV * gauss(generator)); - SingleCurvilinearTrackParameters<ChargedPolicy> rStart(std::move(covPtr), - rPos, rMom, 1., 42.); + SingleCurvilinearTrackParameters<ChargedPolicy> rStart( + std::move(covPtr), rPos, rMom, 1., 42.); const Surface* rSurface = &rStart.referenceSurface(); @@ -318,8 +330,8 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { using Smoother = GainMatrixSmoother<BoundParameters>; using KalmanFitter = KalmanFitter<RecoPropagator, Updator, Smoother>; - KalmanFitter kFitter(rPropagator, - getDefaultLogger("KalmanFilter", Logging::VERBOSE)); + KalmanFitter kFitter( + rPropagator, getDefaultLogger("KalmanFilter", Logging::VERBOSE)); KalmanFitterOptions kfOptions(tgContext, mfContext, calContext, rSurface); @@ -331,32 +343,43 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { auto fittedAgainTrack = kFitter.fit(sourcelinks, rStart, kfOptions); auto fittedAgainParameters = fittedAgainTrack.fittedParameters.get(); - CHECK_CLOSE_REL(fittedParameters.parameters().template head<5>(), - fittedAgainParameters.parameters().template head<5>(), 1e-5); - CHECK_CLOSE_ABS(fittedParameters.parameters().template tail<1>(), - fittedAgainParameters.parameters().template tail<1>(), 1e-5); + CHECK_CLOSE_REL( + fittedParameters.parameters().template head<5>(), + fittedAgainParameters.parameters().template head<5>(), + 1e-5); + CHECK_CLOSE_ABS( + fittedParameters.parameters().template tail<1>(), + fittedAgainParameters.parameters().template tail<1>(), + 1e-5); // Change the order of the sourcelinks - std::vector<SourceLink> shuffledMeasurements = { - sourcelinks[3], sourcelinks[2], sourcelinks[1], - sourcelinks[4], sourcelinks[5], sourcelinks[0]}; + std::vector<SourceLink> shuffledMeasurements = {sourcelinks[3], + sourcelinks[2], + sourcelinks[1], + sourcelinks[4], + sourcelinks[5], + sourcelinks[0]}; // Make sure it works for shuffled measurements as well auto fittedShuffledTrack = kFitter.fit(shuffledMeasurements, rStart, kfOptions); auto fittedShuffledParameters = fittedShuffledTrack.fittedParameters.get(); - CHECK_CLOSE_REL(fittedParameters.parameters().template head<5>(), - fittedShuffledParameters.parameters().template head<5>(), - 1e-5); - CHECK_CLOSE_ABS(fittedParameters.parameters().template tail<1>(), - fittedShuffledParameters.parameters().template tail<1>(), - 1e-5); + CHECK_CLOSE_REL( + fittedParameters.parameters().template head<5>(), + fittedShuffledParameters.parameters().template head<5>(), + 1e-5); + CHECK_CLOSE_ABS( + fittedParameters.parameters().template tail<1>(), + fittedShuffledParameters.parameters().template tail<1>(), + 1e-5); // Remove one measurement and find a hole - std::vector<SourceLink> measurementsWithHole = { - sourcelinks[0], sourcelinks[1], sourcelinks[2], sourcelinks[4], - sourcelinks[5]}; + std::vector<SourceLink> measurementsWithHole = {sourcelinks[0], + sourcelinks[1], + sourcelinks[2], + sourcelinks[4], + sourcelinks[5]}; // Make sure it works for shuffled measurements as well auto fittedWithHoleTrack = @@ -370,9 +393,10 @@ BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { // BOOST_CHECK(!Acts::Test::checkCloseRel(fittedParameters.parameters().template // head<5>(), ~ fittedWithHoleParameters.parameters().template head<5>(), ~ // 1e-6)); - BOOST_CHECK(!Acts::Test::checkCloseRel(fittedParameters.parameters(), - fittedWithHoleParameters.parameters(), - 1e-6)); + BOOST_CHECK(!Acts::Test::checkCloseRel( + fittedParameters.parameters(), + fittedWithHoleParameters.parameters(), + 1e-6)); } } // namespace Test diff --git a/Tests/Core/Geometry/AlignmentContextTests.cpp b/Tests/Core/Geometry/AlignmentContextTests.cpp index 71f32a17d..24a0b5fa0 100644 --- a/Tests/Core/Geometry/AlignmentContextTests.cpp +++ b/Tests/Core/Geometry/AlignmentContextTests.cpp @@ -39,8 +39,9 @@ struct AlignmentContext { AlignmentContext() {} /// Constructor with Store and context index - AlignmentContext(std::shared_ptr<const std::array<Transform3D, 2>> aStore, - unsigned int aIndex = 0) + AlignmentContext( + std::shared_ptr<const std::array<Transform3D, 2>> aStore, + unsigned int aIndex = 0) : alignmentStore(std::move(aStore)), alignmentIndex(aIndex) {} }; @@ -59,9 +60,10 @@ class AlignableDetectorElement : public DetectorElementBase { /// @param transform is the transform that element the layer in 3D frame /// @param pBounds is the planar bounds for the planar detector element /// @param thickness is the module thickness - AlignableDetectorElement(std::shared_ptr<const Transform3D> transform, - std::shared_ptr<const PlanarBounds> pBounds, - double thickness) + AlignableDetectorElement( + std::shared_ptr<const Transform3D> transform, + std::shared_ptr<const PlanarBounds> pBounds, + double thickness) : DetectorElementBase(), m_elementTransform(std::move(transform)), m_elementThickness(thickness) { @@ -95,8 +97,8 @@ class AlignableDetectorElement : public DetectorElementBase { double m_elementThickness{0.}; }; -inline const Transform3D& AlignableDetectorElement::transform( - const GeometryContext& gctx) const { +inline const Transform3D& +AlignableDetectorElement::transform(const GeometryContext& gctx) const { auto alignContext = std::any_cast<AlignmentContext>(gctx); if (alignContext.alignmentStore != nullptr and alignContext.alignmentIndex < 2) { @@ -105,11 +107,13 @@ inline const Transform3D& AlignableDetectorElement::transform( return (*m_elementTransform); } -inline const Surface& AlignableDetectorElement::surface() const { +inline const Surface& +AlignableDetectorElement::surface() const { return *m_elementSurface; } -inline double AlignableDetectorElement::thickness() const { +inline double +AlignableDetectorElement::thickness() const { return m_elementThickness; } @@ -147,7 +151,8 @@ BOOST_AUTO_TEST_CASE(AlignmentContextTests) { // The detector element at nominal position AlignableDetectorElement alignedElement( std::make_shared<const Transform3D>(Transform3D::Identity()), - std::make_shared<const RectangleBounds>(100_cm, 100_cm), 1_mm); + std::make_shared<const RectangleBounds>(100_cm, 100_cm), + 1_mm); const auto& alignedSurface = alignedElement.surface(); @@ -178,25 +183,25 @@ BOOST_AUTO_TEST_CASE(AlignmentContextTests) { alignedSurface.isOnSurface(positiveContext, onPositive, dummyMomentum)); // Test local to Global and vice versa - alignedSurface.localToGlobal(defaultContext, localPosition, dummyMomentum, - globalPosition); + alignedSurface.localToGlobal( + defaultContext, localPosition, dummyMomentum, globalPosition); BOOST_CHECK_EQUAL(globalPosition, onNominal); - alignedSurface.globalToLocal(defaultContext, onNominal, dummyMomentum, - localPosition); + alignedSurface.globalToLocal( + defaultContext, onNominal, dummyMomentum, localPosition); BOOST_CHECK_EQUAL(localPosition, Vector2D(3., 3.)); - alignedSurface.localToGlobal(negativeContext, localPosition, dummyMomentum, - globalPosition); + alignedSurface.localToGlobal( + negativeContext, localPosition, dummyMomentum, globalPosition); BOOST_CHECK_EQUAL(globalPosition, onNegative); - alignedSurface.globalToLocal(negativeContext, onNegative, dummyMomentum, - localPosition); + alignedSurface.globalToLocal( + negativeContext, onNegative, dummyMomentum, localPosition); BOOST_CHECK_EQUAL(localPosition, Vector2D(3., 3.)); - alignedSurface.localToGlobal(positiveContext, localPosition, dummyMomentum, - globalPosition); + alignedSurface.localToGlobal( + positiveContext, localPosition, dummyMomentum, globalPosition); BOOST_CHECK_EQUAL(globalPosition, onPositive); - alignedSurface.globalToLocal(positiveContext, onPositive, dummyMomentum, - localPosition); + alignedSurface.globalToLocal( + positiveContext, onPositive, dummyMomentum, localPosition); BOOST_CHECK_EQUAL(localPosition, Vector2D(3., 3.)); } diff --git a/Tests/Core/Geometry/BVHDataTestCase.hpp b/Tests/Core/Geometry/BVHDataTestCase.hpp index 306b9d540..6bd0120ca 100644 --- a/Tests/Core/Geometry/BVHDataTestCase.hpp +++ b/Tests/Core/Geometry/BVHDataTestCase.hpp @@ -65,9 +65,14 @@ gridBoxFactory(size_t n = NBOXES, double hl = 1000, size_t octd = 5) { auto tvBounds = std::make_shared<CuboidVolumeBounds>(hl * 1.1, hl * 1.1, hl * 1.1); - auto tv = - TrackingVolume::create(tvTrf, tvBounds, std::move(boxStore), - std::move(volumes), top, nullptr, "TheVolume"); + auto tv = TrackingVolume::create( + tvTrf, + tvBounds, + std::move(boxStore), + std::move(volumes), + top, + nullptr, + "TheVolume"); auto tg = std::make_shared<TrackingGeometry>(tv); @@ -78,23 +83,37 @@ auto [volumes, tg] = gridBoxFactory(); BOOST_DATA_TEST_CASE( bvhnavigation_test, - bdata::random((bdata::seed = 7, bdata::engine = std::mt19937(), - bdata::distribution = std::uniform_real_distribution<>(-5, - 5))) ^ - bdata::random((bdata::seed = 2, bdata::engine = std::mt19937(), - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 3, bdata::engine = std::mt19937(), - bdata::distribution = - std::uniform_real_distribution<>(-100, 100))) ^ - bdata::random((bdata::seed = 4, bdata::engine = std::mt19937(), - bdata::distribution = - std::uniform_real_distribution<>(-100, 100))) ^ - bdata::random((bdata::seed = 5, bdata::engine = std::mt19937(), - bdata::distribution = - std::uniform_real_distribution<>(-100, 100))) ^ + bdata::random( + (bdata::seed = 7, + bdata::engine = std::mt19937(), + bdata::distribution = std::uniform_real_distribution<>(-5, 5))) ^ + bdata::random( + (bdata::seed = 2, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 3, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(-100, 100))) ^ + bdata::random( + (bdata::seed = 4, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(-100, 100))) ^ + bdata::random( + (bdata::seed = 5, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(-100, 100))) ^ bdata::xrange(NTESTS), - eta, phi, x, y, z, index) { + eta, + phi, + x, + y, + z, + index) { using namespace Acts::UnitLiterals; (void)index; @@ -114,8 +133,8 @@ BOOST_DATA_TEST_CASE( Acts::NavigationOptions<Acts::Surface> no(Acts::forward, true); for (const auto& bndSrf : bndSurfaces) { const auto& srf = bndSrf->surfaceRepresentation(); - auto sri = srf.surfaceIntersectionEstimate(tgContext, ray.origin(), - ray.dir(), no); + auto sri = srf.surfaceIntersectionEstimate( + tgContext, ray.origin(), ray.dir(), no); if (sri) { // does intersect hits.push_back(std::move(sri)); @@ -144,8 +163,8 @@ BOOST_DATA_TEST_CASE( using ActionList = Acts::ActionList<SteppingLogger, DebugOutput>; using AbortConditions = Acts::AbortList<>; - Acts::PropagatorOptions<ActionList, AbortConditions> options(tgContext, - mfContext); + Acts::PropagatorOptions<ActionList, AbortConditions> options( + tgContext, mfContext); options.debug = false; options.pathLimit = 20_m; @@ -153,8 +172,8 @@ BOOST_DATA_TEST_CASE( // this should be irrelevant. double mom = 50_GeV; - Acts::CurvilinearParameters startPar(nullptr, ray.origin(), ray.dir() * mom, - +1, 0.); + Acts::CurvilinearParameters startPar( + nullptr, ray.origin(), ray.dir() * mom, +1, 0.); const auto result = propagator.propagate(startPar, options).value(); diff --git a/Tests/Core/Geometry/ConeLayerTests.cpp b/Tests/Core/Geometry/ConeLayerTests.cpp index 3a2b589c7..3d6693ca2 100644 --- a/Tests/Core/Geometry/ConeLayerTests.cpp +++ b/Tests/Core/Geometry/ConeLayerTests.cpp @@ -73,8 +73,8 @@ BOOST_AUTO_TEST_CASE(ConeLayerConstruction) { auto adPtr = ad.get(); auto pConeLayerWithApproachDescriptor = ConeLayer::create(pTransform, pCone, nullptr, thickness, std::move(ad)); - BOOST_CHECK_EQUAL(pConeLayerWithApproachDescriptor->approachDescriptor(), - adPtr); + BOOST_CHECK_EQUAL( + pConeLayerWithApproachDescriptor->approachDescriptor(), adPtr); // with the layerType specified... auto pConeLayerWithLayerType = ConeLayer::create( pTransform, pCone, nullptr, thickness, std::move(ad), LayerType::passive); @@ -98,8 +98,9 @@ BOOST_AUTO_TEST_CASE(ConeLayerProperties /*, *utf::expected_failures(1)*/) { // const double thickness(1.0); auto pConeLayerFromSurfaces = ConeLayer::create(pTransform, pCone, nullptr); // auto planeSurface = pConeLayer->surfaceRepresentation(); - BOOST_CHECK_EQUAL(pConeLayerFromSurfaces->surfaceRepresentation().name(), - std::string("Acts::ConeSurface")); + BOOST_CHECK_EQUAL( + pConeLayerFromSurfaces->surfaceRepresentation().name(), + std::string("Acts::ConeSurface")); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Geometry/CuboidVolumeBuilderTests.cpp b/Tests/Core/Geometry/CuboidVolumeBuilderTests.cpp index ed301b948..98e677ec3 100644 --- a/Tests/Core/Geometry/CuboidVolumeBuilderTests.cpp +++ b/Tests/Core/Geometry/CuboidVolumeBuilderTests.cpp @@ -71,7 +71,8 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeBuilderTest) { cfg.detElementConstructor = [](std::shared_ptr<const Transform3D> trans, - std::shared_ptr<const RectangleBounds> bounds, double thickness) { + std::shared_ptr<const RectangleBounds> bounds, + double thickness) { return new DetectorElementStub(trans, bounds, thickness); }; surfaceConfig.push_back(cfg); @@ -128,9 +129,10 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeBuilderTest) { std::shared_ptr<TrackingVolume> trVol = cvb.buildVolume(tgContext, volumeConfig); BOOST_CHECK_EQUAL(volumeConfig.layers.size(), 4); - BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(), - volumeConfig.layers.size() * 2 + - 1); // #layers = navigation + material layers + BOOST_CHECK_EQUAL( + trVol->confinedLayers()->arrayObjects().size(), + volumeConfig.layers.size() * 2 + + 1); // #layers = navigation + material layers BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.name); BOOST_CHECK_NE(trVol->volumeMaterial(), nullptr); @@ -138,9 +140,10 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeBuilderTest) { volumeConfig.layers.clear(); trVol = cvb.buildVolume(tgContext, volumeConfig); BOOST_CHECK_EQUAL(volumeConfig.layers.size(), 4); - BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(), - volumeConfig.layers.size() * 2 + - 1); // #layers = navigation + material layers + BOOST_CHECK_EQUAL( + trVol->confinedLayers()->arrayObjects().size(), + volumeConfig.layers.size() * 2 + + 1); // #layers = navigation + material layers BOOST_CHECK_EQUAL(trVol->volumeName(), volumeConfig.name); volumeConfig.layers.clear(); diff --git a/Tests/Core/Geometry/CylinderLayerTests.cpp b/Tests/Core/Geometry/CylinderLayerTests.cpp index 2dc297399..ae1ca2d71 100644 --- a/Tests/Core/Geometry/CylinderLayerTests.cpp +++ b/Tests/Core/Geometry/CylinderLayerTests.cpp @@ -62,8 +62,8 @@ BOOST_AUTO_TEST_CASE(CylinderLayerConstruction) { const double thickness(1.0); auto pCylinderLayerFromSurfaces = CylinderLayer::create(pTransform, pCylinder, nullptr); - BOOST_CHECK_EQUAL(pCylinderLayerFromSurfaces->layerType(), - LayerType::passive); + BOOST_CHECK_EQUAL( + pCylinderLayerFromSurfaces->layerType(), LayerType::passive); // construct with thickness: auto pCylinderLayerWithThickness = CylinderLayer::create(pTransform, pCylinder, nullptr, thickness); @@ -74,14 +74,18 @@ BOOST_AUTO_TEST_CASE(CylinderLayerConstruction) { auto adPtr = ad.get(); auto pCylinderLayerWithApproachDescriptor = CylinderLayer::create( pTransform, pCylinder, nullptr, thickness, std::move(ad)); - BOOST_CHECK_EQUAL(pCylinderLayerWithApproachDescriptor->approachDescriptor(), - adPtr); + BOOST_CHECK_EQUAL( + pCylinderLayerWithApproachDescriptor->approachDescriptor(), adPtr); // with the layerType specified... - auto pCylinderLayerWithLayerType = - CylinderLayer::create(pTransform, pCylinder, nullptr, thickness, - std::move(ad), LayerType::passive); - BOOST_CHECK_EQUAL(pCylinderLayerWithLayerType->layerType(), - LayerType::passive); + auto pCylinderLayerWithLayerType = CylinderLayer::create( + pTransform, + pCylinder, + nullptr, + thickness, + std::move(ad), + LayerType::passive); + BOOST_CHECK_EQUAL( + pCylinderLayerWithLayerType->layerType(), LayerType::passive); } /// Unit test for testing Layer properties @@ -92,8 +96,9 @@ BOOST_AUTO_TEST_CASE(CylinderLayerProperties /*, *utf::expected_failures(1)*/) { auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz); auto pCylinderLayer = CylinderLayer::create(pTransform, pCylinder); // auto planeSurface = pCylinderLayer->surfaceRepresentation(); - BOOST_CHECK_EQUAL(pCylinderLayer->surfaceRepresentation().name(), - std::string("Acts::CylinderSurface")); + BOOST_CHECK_EQUAL( + pCylinderLayer->surfaceRepresentation().name(), + std::string("Acts::CylinderSurface")); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Geometry/CylinderVolumeBoundsTests.cpp b/Tests/Core/Geometry/CylinderVolumeBoundsTests.cpp index 36ba774db..fb586e89e 100644 --- a/Tests/Core/Geometry/CylinderVolumeBoundsTests.cpp +++ b/Tests/Core/Geometry/CylinderVolumeBoundsTests.cpp @@ -29,12 +29,19 @@ namespace Test { BOOST_AUTO_TEST_SUITE(Volumes) /// Unit test for testing the decomposeToSurfaces() function -BOOST_DATA_TEST_CASE(CylinderVolumeBounds_decomposeToSurfaces, - bdata::random(-M_PI, M_PI) ^ bdata::random(-M_PI, M_PI) ^ - bdata::random(-M_PI, M_PI) ^ bdata::random(-10., 10.) ^ - bdata::random(-10., 10.) ^ bdata::random(-10., 10.) ^ - bdata::xrange(100), - alpha, beta, gamma, posX, posY, posZ, index) { +BOOST_DATA_TEST_CASE( + CylinderVolumeBounds_decomposeToSurfaces, + bdata::random(-M_PI, M_PI) ^ bdata::random(-M_PI, M_PI) ^ + bdata::random(-M_PI, M_PI) ^ bdata::random(-10., 10.) ^ + bdata::random(-10., 10.) ^ bdata::random(-10., 10.) ^ + bdata::xrange(100), + alpha, + beta, + gamma, + posX, + posY, + posZ, + index) { (void)index; // Create a test context @@ -64,10 +71,14 @@ BOOST_DATA_TEST_CASE(CylinderVolumeBounds_decomposeToSurfaces, // Test // check if difference is halfZ - sign and direction independent - CHECK_CLOSE_REL((pos - boundarySurfaces.at(0)->center(tgContext)).norm(), - cylBounds.halflengthZ(), 1e-12); - CHECK_CLOSE_REL((pos - boundarySurfaces.at(1)->center(tgContext)).norm(), - cylBounds.halflengthZ(), 1e-12); + CHECK_CLOSE_REL( + (pos - boundarySurfaces.at(0)->center(tgContext)).norm(), + cylBounds.halflengthZ(), + 1e-12); + CHECK_CLOSE_REL( + (pos - boundarySurfaces.at(1)->center(tgContext)).norm(), + cylBounds.halflengthZ(), + 1e-12); // transform to local double posDiscPosZ = (transformPtr->inverse() * boundarySurfaces.at(1)->center(tgContext)).z(); @@ -87,13 +98,15 @@ BOOST_DATA_TEST_CASE(CylinderVolumeBounds_decomposeToSurfaces, CHECK_CLOSE_REL( transformPtr->rotation().col(2).dot( boundarySurfaces.at(1)->normal(tgContext, Acts::Vector2D(0., 0.))), - 1., 1e-12); + 1., + 1e-12); // negative disc durface should point in negative direction in the frame of // the volume CHECK_CLOSE_REL( transformPtr->rotation().col(2).dot( boundarySurfaces.at(0)->normal(tgContext, Acts::Vector2D(0., 0.))), - -1., 1e-12); + -1., + 1e-12); // test in r CHECK_CLOSE_REL(boundarySurfaces.at(3)->center(tgContext), pos, 1e-12); CHECK_CLOSE_REL(boundarySurfaces.at(2)->center(tgContext), pos, 1e-12); diff --git a/Tests/Core/Geometry/CylinderVolumeBuilderTests.cpp b/Tests/Core/Geometry/CylinderVolumeBuilderTests.cpp index cdc9a6b32..1d4dd7a8e 100644 --- a/Tests/Core/Geometry/CylinderVolumeBuilderTests.cpp +++ b/Tests/Core/Geometry/CylinderVolumeBuilderTests.cpp @@ -22,12 +22,18 @@ namespace Acts { namespace Test { /// Unit test for testing the wraps() function of the CylinderVolumeBuilder -BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_wraps, - bdata::random(-11., -15.) ^ bdata::random(11., 15.) ^ - bdata::random(-10., 10.) ^ bdata::random(0., 4.) ^ - bdata::random(11., 15.) ^ bdata::random(10., 15.) ^ - bdata::xrange(100), - left, right, central, inner, outer, length, index) { +BOOST_DATA_TEST_CASE( + CylinderVolumeBuilder_wraps, + bdata::random(-11., -15.) ^ bdata::random(11., 15.) ^ + bdata::random(-10., 10.) ^ bdata::random(0., 4.) ^ + bdata::random(11., 15.) ^ bdata::random(10., 15.) ^ bdata::xrange(100), + left, + right, + central, + inner, + outer, + length, + index) { (void)index; // inner volume VolumeConfig innerConfig; @@ -98,12 +104,18 @@ BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_wraps, /// Unit test for testing the contains(), containsInR() and containsInZ() /// function of the CylinderVolumeBuilder -BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_containes, - bdata::random(-11., -15.) ^ bdata::random(11., 15.) ^ - bdata::random(-10., 10.) ^ bdata::random(0., 4.) ^ - bdata::random(10., 15.) ^ bdata::random(10., 15.) ^ - bdata::xrange(100), - left, right, central, inner, outer, length, index) { +BOOST_DATA_TEST_CASE( + CylinderVolumeBuilder_containes, + bdata::random(-11., -15.) ^ bdata::random(11., 15.) ^ + bdata::random(-10., 10.) ^ bdata::random(0., 4.) ^ + bdata::random(10., 15.) ^ bdata::random(10., 15.) ^ bdata::xrange(100), + left, + right, + central, + inner, + outer, + length, + index) { (void)index; // inner volume VolumeConfig innerConfig; @@ -185,10 +197,12 @@ BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_containes, /// Unit test for testing the coverlapsInR() /// function of the CylinderVolumeBuilder -BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_overlapsInR, - bdata::random(0., 4.) ^ bdata::random(11., 15.) ^ - bdata::xrange(100), - inner, outer, index) { +BOOST_DATA_TEST_CASE( + CylinderVolumeBuilder_overlapsInR, + bdata::random(0., 4.) ^ bdata::random(11., 15.) ^ bdata::xrange(100), + inner, + outer, + index) { (void)index; // reference volume VolumeConfig Config0; @@ -247,10 +261,14 @@ BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_overlapsInR, /// Unit test for testing the coverlapsInZ() /// function of the CylinderVolumeBuilder -BOOST_DATA_TEST_CASE(CylinderVolumeBuilder_overlapsInZ, - bdata::random(-11., -15.) ^ bdata::random(11., 15.) ^ - bdata::random(0., 4.) ^ bdata::xrange(100), - left, right, inner, index) { +BOOST_DATA_TEST_CASE( + CylinderVolumeBuilder_overlapsInZ, + bdata::random(-11., -15.) ^ bdata::random(11., 15.) ^ + bdata::random(0., 4.) ^ bdata::xrange(100), + left, + right, + inner, + index) { (void)index; // inner volume VolumeConfig Config0; diff --git a/Tests/Core/Geometry/DiscLayerTests.cpp b/Tests/Core/Geometry/DiscLayerTests.cpp index 339c3fcc2..8c6c6c1da 100644 --- a/Tests/Core/Geometry/DiscLayerTests.cpp +++ b/Tests/Core/Geometry/DiscLayerTests.cpp @@ -73,8 +73,8 @@ BOOST_AUTO_TEST_CASE(DiscLayerConstruction) { auto adPtr = ad.get(); auto pDiscLayerWithApproachDescriptor = DiscLayer::create(pTransform, pDisc, nullptr, thickness, std::move(ad)); - BOOST_CHECK_EQUAL(pDiscLayerWithApproachDescriptor->approachDescriptor(), - adPtr); + BOOST_CHECK_EQUAL( + pDiscLayerWithApproachDescriptor->approachDescriptor(), adPtr); // with the layerType specified... auto pDiscLayerWithLayerType = DiscLayer::create( pTransform, pDisc, nullptr, thickness, std::move(ad), LayerType::passive); @@ -89,8 +89,9 @@ BOOST_AUTO_TEST_CASE(DiscLayerProperties /*, *utf::expected_failures(1)*/) { auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad); auto pDiscLayer = DiscLayer::create(pTransform, pDisc); // auto planeSurface = pDiscLayer->surfaceRepresentation(); - BOOST_CHECK_EQUAL(pDiscLayer->surfaceRepresentation().name(), - std::string("Acts::DiscSurface")); + BOOST_CHECK_EQUAL( + pDiscLayer->surfaceRepresentation().name(), + std::string("Acts::DiscSurface")); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Geometry/GenericApproachDescriptorTests.cpp b/Tests/Core/Geometry/GenericApproachDescriptorTests.cpp index 790c91e1d..f60139d8a 100644 --- a/Tests/Core/Geometry/GenericApproachDescriptorTests.cpp +++ b/Tests/Core/Geometry/GenericApproachDescriptorTests.cpp @@ -52,8 +52,9 @@ BOOST_AUTO_TEST_CASE(GenericApproachDescriptorConstruction) { } /// Unit test for testing GenericApproachDescriptor properties -BOOST_AUTO_TEST_CASE(GenericApproachDescriptorProperties, - *utf::expected_failures(1)) { +BOOST_AUTO_TEST_CASE( + GenericApproachDescriptorProperties, + *utf::expected_failures(1)) { Vector3D origin{ 0., 0., @@ -72,15 +73,15 @@ BOOST_AUTO_TEST_CASE(GenericApproachDescriptorProperties, SurfaceIntersection surfIntersection = approachDescriptor.approachSurface( tgContext, origin, zDir, forward, bcheck); double expectedIntersection = 20.0; // property of SurfaceStub - CHECK_CLOSE_REL(surfIntersection.intersection.pathLength, - expectedIntersection, 1e-6); + CHECK_CLOSE_REL( + surfIntersection.intersection.pathLength, expectedIntersection, 1e-6); // containedSurfaces() - BOOST_CHECK_EQUAL(approachDescriptor.containedSurfaces().size(), - someSurfaces.size()); + BOOST_CHECK_EQUAL( + approachDescriptor.containedSurfaces().size(), someSurfaces.size()); for (size_t i = 0; i < someSurfaces.size(); i++) { - BOOST_CHECK_EQUAL(approachDescriptor.containedSurfaces().at(i), - someSurfaces.at(i).get()); + BOOST_CHECK_EQUAL( + approachDescriptor.containedSurfaces().at(i), someSurfaces.at(i).get()); } } diff --git a/Tests/Core/Geometry/LayerCreatorTests.cpp b/Tests/Core/Geometry/LayerCreatorTests.cpp index c0f195428..621143c51 100644 --- a/Tests/Core/Geometry/LayerCreatorTests.cpp +++ b/Tests/Core/Geometry/LayerCreatorTests.cpp @@ -49,7 +49,8 @@ GeometryContext tgContext = GeometryContext(); using SrfVec = std::vector<std::shared_ptr<const Surface>>; -void draw_surfaces(const SrfVec& surfaces, const std::string& fname) { +void +draw_surfaces(const SrfVec& surfaces, const std::string& fname) { std::ofstream os; os.open(fname); @@ -97,11 +98,13 @@ struct LayerCreatorFixture { } template <typename... Args> - bool checkBinning(Args&&... args) { + bool + checkBinning(Args&&... args) { return p_LC->checkBinning(std::forward<Args>(args)...); } - bool checkBinContentSize(const SurfaceArray* sArray, size_t n) { + bool + checkBinContentSize(const SurfaceArray* sArray, size_t n) { size_t nBins = sArray->size(); bool result = true; for (size_t i = 0; i < nBins; ++i) { @@ -117,8 +120,12 @@ struct LayerCreatorFixture { return result; } - SrfVec fullPhiTestSurfacesEC(size_t n = 10, double shift = 0, - double zbase = 0, double r = 10) { + SrfVec + fullPhiTestSurfacesEC( + size_t n = 10, + double shift = 0, + double zbase = 0, + double r = 10) { SrfVec res; double phiStep = 2 * M_PI / n; @@ -144,9 +151,14 @@ struct LayerCreatorFixture { return res; } - SrfVec fullPhiTestSurfacesBRL(int n = 10, double shift = 0, double zbase = 0, - double incl = M_PI / 9., double w = 2, - double h = 1.5) { + SrfVec + fullPhiTestSurfacesBRL( + int n = 10, + double shift = 0, + double zbase = 0, + double incl = M_PI / 9., + double w = 2, + double h = 1.5) { SrfVec res; double phiStep = 2 * M_PI / n; @@ -174,7 +186,8 @@ struct LayerCreatorFixture { return res; } - SrfVec makeBarrel(int nPhi, int nZ, double w, double h) { + SrfVec + makeBarrel(int nPhi, int nZ, double w, double h) { double z0 = -(nZ - 1) * w; SrfVec res; @@ -189,8 +202,13 @@ struct LayerCreatorFixture { } std::pair<SrfVec, std::vector<std::pair<const Surface*, const Surface*>>> - makeBarrelStagger(int nPhi, int nZ, double shift = 0, double incl = M_PI / 9., - double w = 2, double h = 1.5) { + makeBarrelStagger( + int nPhi, + int nZ, + double shift = 0, + double incl = M_PI / 9., + double w = 2, + double h = 1.5) { double z0 = -(nZ - 1) * w; SrfVec res; diff --git a/Tests/Core/Geometry/LayerStub.hpp b/Tests/Core/Geometry/LayerStub.hpp index 8873f89f7..9e5818140 100644 --- a/Tests/Core/Geometry/LayerStub.hpp +++ b/Tests/Core/Geometry/LayerStub.hpp @@ -21,9 +21,11 @@ class LayerStub : virtual public SurfaceStub, public Layer { /// copy constructor (deleted in Surface baseclass) LayerStub(const LayerStub& otherLayer) = delete; /// constructor with pointer to SurfaceArray (protected in Layer baseclass) - LayerStub(std::unique_ptr<SurfaceArray> surfaceArray, double thickness = 0, - std::unique_ptr<ApproachDescriptor> ad = nullptr, - LayerType ltype = passive) + LayerStub( + std::unique_ptr<SurfaceArray> surfaceArray, + double thickness = 0, + std::unique_ptr<ApproachDescriptor> ad = nullptr, + LayerType ltype = passive) : SurfaceStub(), Layer(std::move(surfaceArray), thickness, std::move(ad), ltype) {} @@ -34,13 +36,22 @@ class LayerStub : virtual public SurfaceStub, public Layer { LayerStub& operator=(const LayerStub& lay) = delete; /// surfaceRepresentation is pure virtual in baseclass - const Surface& surfaceRepresentation() const override { return (*this); } + const Surface& + surfaceRepresentation() const override { + return (*this); + } - Surface& surfaceRepresentation() override { return (*this); } + Surface& + surfaceRepresentation() override { + return (*this); + } /// simply return true to show a method can be called on the constructed /// object - bool constructedOk() const { return true; } + bool + constructedOk() const { + return true; + } /// Other methods have implementation in baseclass /// templated 'onLayer()' from baseclass ? diff --git a/Tests/Core/Geometry/NavigationLayerTests.cpp b/Tests/Core/Geometry/NavigationLayerTests.cpp index 9a9d8dcd9..eddccf3eb 100644 --- a/Tests/Core/Geometry/NavigationLayerTests.cpp +++ b/Tests/Core/Geometry/NavigationLayerTests.cpp @@ -62,8 +62,8 @@ BOOST_AUTO_TEST_CASE(NavigationLayerProperties, *utf::expected_failures(1)) { // binningPosition(), needs a better test BOOST_CHECK_EQUAL(pNavigationLayer->binningPosition(tgContext, b), origin); // surfaceRepresentation() [looks dangerous] - BOOST_CHECK_EQUAL(rawSurfacePtr, - &(pNavigationLayer->surfaceRepresentation())); + BOOST_CHECK_EQUAL( + rawSurfacePtr, &(pNavigationLayer->surfaceRepresentation())); // isOnLayer() BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, origin, true)); // isOnLayer() diff --git a/Tests/Core/Geometry/PlaneLayerTests.cpp b/Tests/Core/Geometry/PlaneLayerTests.cpp index 1d1bb49cc..b377bff73 100644 --- a/Tests/Core/Geometry/PlaneLayerTests.cpp +++ b/Tests/Core/Geometry/PlaneLayerTests.cpp @@ -77,15 +77,22 @@ BOOST_AUTO_TEST_CASE(PlaneLayerConstruction) { std::unique_ptr<ApproachDescriptor> ad( new GenericApproachDescriptor(aSurfaces)); auto adPtr = ad.get(); - auto pPlaneLayerWithApproachDescriptor = - PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray), - thickness, std::move(ad)); - BOOST_CHECK_EQUAL(pPlaneLayerWithApproachDescriptor->approachDescriptor(), - adPtr); + auto pPlaneLayerWithApproachDescriptor = PlaneLayer::create( + pTransform, + pRectangle, + std::move(pSurfaceArray), + thickness, + std::move(ad)); + BOOST_CHECK_EQUAL( + pPlaneLayerWithApproachDescriptor->approachDescriptor(), adPtr); // with the layerType specified... - auto pPlaneLayerWithLayerType = - PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray), - thickness, std::move(ad), LayerType::passive); + auto pPlaneLayerWithLayerType = PlaneLayer::create( + pTransform, + pRectangle, + std::move(pSurfaceArray), + thickness, + std::move(ad), + LayerType::passive); BOOST_CHECK_EQUAL(pPlaneLayerWithLayerType->layerType(), LayerType::passive); } @@ -97,8 +104,9 @@ BOOST_AUTO_TEST_CASE(PlaneLayerProperties /*, *utf::expected_failures(1)*/) { auto pRectangle = std::make_shared<const RectangleBounds>(halfX, halfY); auto pPlaneLayer = PlaneLayer::create(pTransform, pRectangle); // auto planeSurface = pPlaneLayer->surfaceRepresentation(); - BOOST_CHECK_EQUAL(pPlaneLayer->surfaceRepresentation().name(), - std::string("Acts::PlaneSurface")); + BOOST_CHECK_EQUAL( + pPlaneLayer->surfaceRepresentation().name(), + std::string("Acts::PlaneSurface")); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Geometry/SurfaceArrayCreatorTests.cpp b/Tests/Core/Geometry/SurfaceArrayCreatorTests.cpp index 440b8bcdd..623dc7b07 100644 --- a/Tests/Core/Geometry/SurfaceArrayCreatorTests.cpp +++ b/Tests/Core/Geometry/SurfaceArrayCreatorTests.cpp @@ -51,34 +51,45 @@ struct SurfaceArrayCreatorFixture { std::vector<std::shared_ptr<const Surface>> m_surfaces; SurfaceArrayCreatorFixture() - : m_SAC(SurfaceArrayCreator::Config(), - Acts::getDefaultLogger("SurfaceArrayCreator", - Acts::Logging::VERBOSE)) { + : m_SAC( + SurfaceArrayCreator::Config(), + Acts::getDefaultLogger( + "SurfaceArrayCreator", + Acts::Logging::VERBOSE)) { BOOST_TEST_MESSAGE("setup fixture"); } ~SurfaceArrayCreatorFixture() { BOOST_TEST_MESSAGE("teardown fixture"); } template <typename... Args> - SurfaceArrayCreator::ProtoAxis createEquidistantAxis(Args&&... args) { + SurfaceArrayCreator::ProtoAxis + createEquidistantAxis(Args&&... args) { return m_SAC.createEquidistantAxis(std::forward<Args>(args)...); } template <typename... Args> - SurfaceArrayCreator::ProtoAxis createVariableAxis(Args&&... args) { + SurfaceArrayCreator::ProtoAxis + createVariableAxis(Args&&... args) { return m_SAC.createVariableAxis(std::forward<Args>(args)...); } - template <detail::AxisBoundaryType bdtA, detail::AxisBoundaryType bdtB, - typename... Args> - std::unique_ptr<SurfaceArray::ISurfaceGridLookup> makeSurfaceGridLookup2D( - Args&&... args) { + template < + detail::AxisBoundaryType bdtA, + detail::AxisBoundaryType bdtB, + typename... Args> + std::unique_ptr<SurfaceArray::ISurfaceGridLookup> + makeSurfaceGridLookup2D(Args&&... args) { return m_SAC.makeSurfaceGridLookup2D<bdtA, bdtB>( std::forward<Args>(args)...); } - SrfVec fullPhiTestSurfacesEC(size_t n = 10, double shift = 0, - double zbase = 0, double r = 10, double w = 2, - double h = 1) { + SrfVec + fullPhiTestSurfacesEC( + size_t n = 10, + double shift = 0, + double zbase = 0, + double r = 10, + double w = 2, + double h = 1) { SrfVec res; // TODO: The test is extremely numerically unstable in the face of upward // rounding in this multiplication and division. Find out why. @@ -106,9 +117,14 @@ struct SurfaceArrayCreatorFixture { return res; } - SrfVec fullPhiTestSurfacesBRL(size_t n = 10, double shift = 0, - double zbase = 0, double incl = M_PI / 9., - double w = 2, double h = 1.5) { + SrfVec + fullPhiTestSurfacesBRL( + size_t n = 10, + double shift = 0, + double zbase = 0, + double incl = M_PI / 9., + double w = 2, + double h = 1.5) { SrfVec res; // TODO: The test is extremely numerically unstable in the face of upward // rounding in this multiplication and division. Find out why. @@ -138,8 +154,11 @@ struct SurfaceArrayCreatorFixture { return res; } - SrfVec straightLineSurfaces( - size_t n = 10., double step = 3, const Vector3D& origin = {0, 0, 1.5}, + SrfVec + straightLineSurfaces( + size_t n = 10., + double step = 3, + const Vector3D& origin = {0, 0, 1.5}, const Transform3D& pretrans = Transform3D::Identity(), const Vector3D& dir = {0, 0, 1}) { SrfVec res; @@ -165,7 +184,8 @@ struct SurfaceArrayCreatorFixture { return res; } - SrfVec makeBarrel(int nPhi, int nZ, double w, double h) { + SrfVec + makeBarrel(int nPhi, int nZ, double w, double h) { double z0 = -(nZ - 1) * w; SrfVec res; @@ -180,8 +200,13 @@ struct SurfaceArrayCreatorFixture { } std::pair<SrfVec, std::vector<std::pair<const Surface*, const Surface*>>> - makeBarrelStagger(int nPhi, int nZ, double shift = 0, double incl = M_PI / 9., - double w = 2, double h = 1.5) { + makeBarrelStagger( + int nPhi, + int nZ, + double shift = 0, + double incl = M_PI / 9., + double w = 2, + double h = 1.5) { double z0 = -(nZ - 1) * w; SrfVec res; std::vector<std::pair<const Surface*, const Surface*>> pairs; @@ -226,7 +251,8 @@ struct SurfaceArrayCreatorFixture { } }; -void draw_surfaces(SrfVec surfaces, const std::string& fname) { +void +draw_surfaces(SrfVec surfaces, const std::string& fname) { std::ofstream os; os.open(fname); @@ -260,8 +286,9 @@ void draw_surfaces(SrfVec surfaces, const std::string& fname) { BOOST_AUTO_TEST_SUITE(Tools) -BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, - SurfaceArrayCreatorFixture) { +BOOST_FIXTURE_TEST_CASE( + SurfaceArrayCreator_createEquidistantAxis_Phi, + SurfaceArrayCreatorFixture) { // fail on empty srf vector std::vector<const Surface*> emptyRaw; ProtoLayer pl(tgContext, emptyRaw); @@ -289,8 +316,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, - BinningValue::binPhi, pl, tr); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); @@ -304,10 +331,10 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, - pl, tr); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_EC_2.obj"); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_2.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -320,10 +347,10 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, - pl, tr); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_EC_3.obj"); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -337,11 +364,11 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, pl = ProtoLayer(tgContext, surfaces); surfacesRaw = unpack_shared_vector(surfaces); tr = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, - pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); surfacesRaw = unpack_shared_vector(surfaces); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_EC_4.obj"); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_4.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -357,10 +384,10 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, auto surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, - BinningValue::binPhi, pl, tr); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_BRL_1.obj"); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_1.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -373,10 +400,10 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, - pl, tr); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_BRL_2.obj"); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_2.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -390,10 +417,10 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, - pl, tr); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_BRL_3.obj"); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -407,10 +434,10 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binPhi, - pl, tr); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_BRL_4.obj"); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_4.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); CHECK_CLOSE_REL(axis.min, -M_PI, 1e-6); @@ -424,13 +451,13 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, // single element in phi surfaces = fullPhiTestSurfacesEC(1); auto surfacesRaw = unpack_shared_vector(surfaces); - draw_surfaces(surfaces, - "SurfaceArrayCreator_createEquidistantAxis_EC_Single.obj"); + draw_surfaces( + surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_Single.obj"); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, - BinningValue::binPhi, pl, tr); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); BOOST_CHECK_EQUAL(axis.nBins, 1); CHECK_CLOSE_ABS(axis.max, phi(Vector3D(8, 1, 0)), 1e-3); @@ -438,15 +465,16 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Phi, BOOST_CHECK_EQUAL(axis.bType, equidistant); } -BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, - SurfaceArrayCreatorFixture) { +BOOST_FIXTURE_TEST_CASE( + SurfaceArrayCreator_createEquidistantAxis_Z, + SurfaceArrayCreatorFixture) { // single element in z auto surfaces = straightLineSurfaces(1); auto surfacesRaw = unpack_shared_vector(surfaces); ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); auto trf = Transform3D::Identity(); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binZ, - pl, trf); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_Z_1.obj"); BOOST_CHECK_EQUAL(axis.nBins, 1); CHECK_CLOSE_ABS(axis.max, 3, 1e-6); @@ -460,8 +488,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binZ, pl, - trf); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces( surfaces, (boost::format( @@ -481,8 +509,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binZ, pl, - trf); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_Z_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 10); CHECK_CLOSE_ABS(axis.max, 30.9749, 1e-3); @@ -490,16 +518,17 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_Z, BOOST_CHECK_EQUAL(axis.bType, equidistant); } -BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_R, - SurfaceArrayCreatorFixture) { +BOOST_FIXTURE_TEST_CASE( + SurfaceArrayCreator_createEquidistantAxis_R, + SurfaceArrayCreatorFixture) { // single element in r auto surfaces = fullPhiTestSurfacesEC(1, 0, 0, 15); auto surfacesRaw = unpack_shared_vector(surfaces); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_R_1.obj"); auto trf = Transform3D::Identity(); ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); - auto axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binR, - pl, trf); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 1); CHECK_CLOSE_ABS(axis.max, perp(Vector3D(17, 1, 0)), 1e-3); CHECK_CLOSE_ABS(axis.min, 13, 1e-3); @@ -518,8 +547,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_R, surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); - axis = createEquidistantAxis(tgContext, surfacesRaw, BinningValue::binR, pl, - trf); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 3); CHECK_CLOSE_REL(axis.max, perp(Vector3D(20 + 2, 1, 0)), 1e-3); @@ -532,8 +561,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_createEquidistantAxis_R, // the lowest number of surfaces should be used for the bin count or // as basis for the variable edge procedure // double filling will make sure no surfaces are dropped -BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_dependentBinCounts, - SurfaceArrayCreatorFixture) { +BOOST_FIXTURE_TEST_CASE( + SurfaceArrayCreator_dependentBinCounts, + SurfaceArrayCreatorFixture) { auto ringA = fullPhiTestSurfacesEC(10, 0, 0, 10, 2, 3); auto ringB = fullPhiTestSurfacesEC(15, 0, 0, 15, 2, 3.5); auto ringC = fullPhiTestSurfacesEC(20, 0, 0, 20, 2, 3.8); @@ -551,8 +581,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_dependentBinCounts, BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 10); } -BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_completeBinning, - SurfaceArrayCreatorFixture) { +BOOST_FIXTURE_TEST_CASE( + SurfaceArrayCreator_completeBinning, + SurfaceArrayCreatorFixture) { SrfVec brl = makeBarrel(30, 7, 2, 1); std::vector<const Surface*> brlRaw = unpack_shared_vector(brl); draw_surfaces(brl, "SurfaceArrayCreator_completeBinning_BRL.obj"); @@ -573,7 +604,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_completeBinning, auto sl = std::make_unique< SurfaceArray::SurfaceGridLookup<decltype(phiAxis), decltype(zAxis)>>( - globalToLocal, localToGlobal, + globalToLocal, + localToGlobal, std::make_tuple(std::move(phiAxis), std::move(zAxis))); sl->fill(tgContext, brlRaw); SurfaceArray sa(std::move(sl), brl); @@ -588,8 +620,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_completeBinning, } } -BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, - SurfaceArrayCreatorFixture) { +BOOST_FIXTURE_TEST_CASE( + SurfaceArrayCreator_barrelStagger, + SurfaceArrayCreatorFixture) { auto barrel = makeBarrelStagger(30, 7, 0, M_PI / 9.); auto brl = barrel.first; std::vector<const Surface*> brlRaw = unpack_shared_vector(brl); @@ -616,8 +649,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, return itr * Vector3D(R * std::cos(loc[0]), R * std::sin(loc[0]), loc[1]); }; - auto sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Closed, - detail::AxisBoundaryType::Bound>( + auto sl = makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Closed, + detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxisPhi, pAxisZ); sl->fill(tgContext, brlRaw); @@ -663,8 +697,9 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArrayCreator_barrelStagger, return itr * Vector3D(R * std::cos(loc[0]), R * std::sin(loc[0]), loc[1]); }; - auto sl2 = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Closed, - detail::AxisBoundaryType::Bound>( + auto sl2 = makeSurfaceGridLookup2D< + detail::AxisBoundaryType::Closed, + detail::AxisBoundaryType::Bound>( globalToLocalVar, localToGlobalVar, pAxisPhiVar, pAxisZVar); sl2->fill(tgContext, brlRaw); diff --git a/Tests/Core/Geometry/TrackingGeometryClosureTests.cpp b/Tests/Core/Geometry/TrackingGeometryClosureTests.cpp index cb076f124..9b46ba61a 100644 --- a/Tests/Core/Geometry/TrackingGeometryClosureTests.cpp +++ b/Tests/Core/Geometry/TrackingGeometryClosureTests.cpp @@ -53,22 +53,40 @@ double iov_volumeRadius = /// inner inner volume auto iiVolume = constructCylinderVolume( - tgContext, surfaceHalfLengthZ, iiv_surfaceRadius, surfaceRstagger, - surfaceZoverlap, layerEnvelope, volumeEnvelope, 0., iiv_volumeRadius, + tgContext, + surfaceHalfLengthZ, + iiv_surfaceRadius, + surfaceRstagger, + surfaceZoverlap, + layerEnvelope, + volumeEnvelope, + 0., + iiv_volumeRadius, "InnerInnerVolume"); /// inner outer volume auto ioVolume = constructCylinderVolume( - tgContext, surfaceHalfLengthZ, iov_surfaceRadius, surfaceRstagger, - surfaceZoverlap, layerEnvelope, volumeEnvelope, iiv_volumeRadius, - iov_volumeRadius, "InnerOuterVolume"); + tgContext, + surfaceHalfLengthZ, + iov_surfaceRadius, + surfaceRstagger, + surfaceZoverlap, + layerEnvelope, + volumeEnvelope, + iiv_volumeRadius, + iov_volumeRadius, + "InnerOuterVolume"); // now create the Inner Container volume double volumeHalfZ = (4 * surfaceHalfLengthZ - surfaceZoverlap) + volumeEnvelope; /// the inner volume -auto iVolume = - constructContainerVolume(tgContext, iiVolume, ioVolume, iov_volumeRadius, - volumeHalfZ, "InnerVolume"); +auto iVolume = constructContainerVolume( + tgContext, + iiVolume, + ioVolume, + iov_volumeRadius, + volumeHalfZ, + "InnerVolume"); // outer volume definitions double ov_surfaceRadius = 150_mm; @@ -77,12 +95,24 @@ double ov_volumeRadius = /// inner outer volume auto oVolume = constructCylinderVolume( - tgContext, surfaceHalfLengthZ, ov_surfaceRadius, surfaceRstagger, - surfaceZoverlap, layerEnvelope, volumeEnvelope, iov_volumeRadius, - ov_volumeRadius, "OuterVolume"); + tgContext, + surfaceHalfLengthZ, + ov_surfaceRadius, + surfaceRstagger, + surfaceZoverlap, + layerEnvelope, + volumeEnvelope, + iov_volumeRadius, + ov_volumeRadius, + "OuterVolume"); /// the inner volume auto volume = constructContainerVolume( - tgContext, iVolume, oVolume, ov_volumeRadius, volumeHalfZ, "WorldVolume"); + tgContext, + iVolume, + oVolume, + ov_volumeRadius, + volumeHalfZ, + "WorldVolume"); // creating a TrackingGeometry // -> closs the geometry, this should set the GeometryID diff --git a/Tests/Core/Geometry/TrackingGeometryGeoIDTests.cpp b/Tests/Core/Geometry/TrackingGeometryGeoIDTests.cpp index 87d355faf..be5dbf2e2 100644 --- a/Tests/Core/Geometry/TrackingGeometryGeoIDTests.cpp +++ b/Tests/Core/Geometry/TrackingGeometryGeoIDTests.cpp @@ -46,8 +46,15 @@ double oVvolumeRadius = oVsurfaceRadius + 0.5 * oVsurfaceRstagger + /// inner volume auto iVolume = constructCylinderVolume( - tgContext, iVsurfaceHalfLengthZ, iVsurfaceRadius, iVsurfaceRstagger, - iVsurfaceZoverlap, iVlayerEnvelope, iVvolumeEnvelope, 0., iVvolumeRadius, + tgContext, + iVsurfaceHalfLengthZ, + iVsurfaceRadius, + iVsurfaceRstagger, + iVsurfaceZoverlap, + iVlayerEnvelope, + iVvolumeEnvelope, + 0., + iVvolumeRadius, "InnerVolume"); BOOST_AUTO_TEST_CASE(GeometryID_innervolume_test) { @@ -71,9 +78,16 @@ BOOST_AUTO_TEST_CASE(GeometryID_innervolume_test) { /// outer volume auto oVolume = constructCylinderVolume( - tgContext, oVsurfaceHalfLengthZ, oVsurfaceRadius, oVsurfaceRstagger, - oVsurfaceZoverlap, oVlayerEnvelope, oVvolumeEnvelope, iVvolumeRadius, - oVvolumeRadius, "OuterVolume"); + tgContext, + oVsurfaceHalfLengthZ, + oVsurfaceRadius, + oVsurfaceRstagger, + oVsurfaceZoverlap, + oVlayerEnvelope, + oVvolumeEnvelope, + iVvolumeRadius, + oVvolumeRadius, + "OuterVolume"); BOOST_AUTO_TEST_CASE(GeometryID_outervolume_test) { BOOST_CHECK_EQUAL(0ul, oVolume->geoID().value()); @@ -98,7 +112,12 @@ double oVvolumeHalfZ = (4 * oVsurfaceHalfLengthZ - oVsurfaceZoverlap) + oVvolumeEnvelope; // now create the container volume auto hVolume = constructContainerVolume( - tgContext, iVolume, oVolume, oVvolumeRadius, oVvolumeHalfZ, "Container"); + tgContext, + iVolume, + oVolume, + oVvolumeRadius, + oVvolumeHalfZ, + "Container"); /// pre-check on GeometryID BOOST_AUTO_TEST_CASE(GeometryID_containervolume_test) { diff --git a/Tests/Core/Geometry/TrackingVolumeCreation.hpp b/Tests/Core/Geometry/TrackingVolumeCreation.hpp index c38327ebe..c253354de 100644 --- a/Tests/Core/Geometry/TrackingVolumeCreation.hpp +++ b/Tests/Core/Geometry/TrackingVolumeCreation.hpp @@ -20,11 +20,18 @@ namespace Acts { /// helper function to create a cylinder -TrackingVolumePtr constructCylinderVolume( - const GeometryContext& gctx, double surfaceHalfLengthZ, - double surfaceRadius, double surfaceRstagger, double surfaceZoverlap, - double layerEnvelope, double volumeEnvelope, double innerVolumeR, - double outerVolumeR, const std::string& name) { +TrackingVolumePtr +constructCylinderVolume( + const GeometryContext& gctx, + double surfaceHalfLengthZ, + double surfaceRadius, + double surfaceRstagger, + double surfaceZoverlap, + double layerEnvelope, + double volumeEnvelope, + double innerVolumeR, + double outerVolumeR, + const std::string& name) { /// the surface transforms auto sfnPosition = Vector3D(0., 0., -3 * surfaceHalfLengthZ - surfaceZoverlap); @@ -68,8 +75,11 @@ TrackingVolumePtr constructCylinderVolume( /// now create the Layer auto layer0bounds = std::make_shared<const CylinderBounds>(surfaceRadius, bUmax); - auto layer0 = CylinderLayer::create(nullptr, layer0bounds, std::move(bArray), - surfaceRstagger + 2 * layerEnvelope); + auto layer0 = CylinderLayer::create( + nullptr, + layer0bounds, + std::move(bArray), + surfaceRstagger + 2 * layerEnvelope); std::unique_ptr<const LayerArray> layerArray = std::make_unique<const BinnedArrayXD<LayerPtr>>(layer0); @@ -84,12 +94,14 @@ TrackingVolumePtr constructCylinderVolume( } /// helper function to create a container -MutableTrackingVolumePtr constructContainerVolume(const GeometryContext& gctx, - TrackingVolumePtr iVolume, - TrackingVolumePtr oVolume, - double hVolumeRadius, - double hVolumeHalflength, - const std::string& name) { +MutableTrackingVolumePtr +constructContainerVolume( + const GeometryContext& gctx, + TrackingVolumePtr iVolume, + TrackingVolumePtr oVolume, + double hVolumeRadius, + double hVolumeHalflength, + const std::string& name) { /// create the volume array using VAP = std::pair<TrackingVolumePtr, Vector3D>; std::vector<VAP> volumes = {{iVolume, iVolume->binningPosition(gctx, binR)}, @@ -98,8 +110,8 @@ MutableTrackingVolumePtr constructContainerVolume(const GeometryContext& gctx, auto hVolumeBounds = std::make_shared<const CylinderVolumeBounds>( 0., hVolumeRadius, hVolumeHalflength); /// create the BinUtility & the BinnedArray - auto vUtility = std::make_unique<const BinUtility>(volumes.size(), 0., - hVolumeRadius, open, binR); + auto vUtility = std::make_unique<const BinUtility>( + volumes.size(), 0., hVolumeRadius, open, binR); std::shared_ptr<const TrackingVolumeArray> vArray = std::make_shared<const BinnedArrayXD<TrackingVolumePtr>>( volumes, std::move(vUtility)); diff --git a/Tests/Core/MagneticField/ConstantBFieldTests.cpp b/Tests/Core/MagneticField/ConstantBFieldTests.cpp index 1c6227e86..a2ce66bef 100644 --- a/Tests/Core/MagneticField/ConstantBFieldTests.cpp +++ b/Tests/Core/MagneticField/ConstantBFieldTests.cpp @@ -37,12 +37,19 @@ MagneticFieldContext mfContext = MagneticFieldContext(); /// -# ConstantBField::ConstantBField(Vector3D B) /// -# ConstantBField::getField(const double* xyz, double* B) const /// -# ConstantBField::getField(const Vector3D& pos) const -BOOST_DATA_TEST_CASE(ConstantBField_components, - bdata::random(-2_T, 2_T) ^ bdata::random(-1_T, 4_T) ^ - bdata::random(0_T, 10_T) ^ bdata::random(-10_m, 10_m) ^ - bdata::random(-10_m, 10_m) ^ - bdata::random(-10_m, 10_m) ^ bdata::xrange(10), - x, y, z, bx, by, bz, index) { +BOOST_DATA_TEST_CASE( + ConstantBField_components, + bdata::random(-2_T, 2_T) ^ bdata::random(-1_T, 4_T) ^ + bdata::random(0_T, 10_T) ^ bdata::random(-10_m, 10_m) ^ + bdata::random(-10_m, 10_m) ^ bdata::random(-10_m, 10_m) ^ + bdata::xrange(10), + x, + y, + z, + bx, + by, + bz, + index) { (void)index; BOOST_TEST_CONTEXT("Eigen interface") { const Vector3D Btrue(bx, by, bz); @@ -84,12 +91,19 @@ BOOST_DATA_TEST_CASE(ConstantBField_components, /// -# ConstantBField::setField(const Vector3D& B) /// -# ConstantBField::getField(const double* xyz, double* B) const /// -# ConstantBField::getField(const Vector3D& pos) const -BOOST_DATA_TEST_CASE(ConstantBField_update, - bdata::random(-2_T, 2_T) ^ bdata::random(-1_T, 4_T) ^ - bdata::random(0_T, 10_T) ^ bdata::random(-10_m, 10_m) ^ - bdata::random(-10_m, 10_m) ^ - bdata::random(-10_m, 10_m) ^ bdata::xrange(10), - x, y, z, bx, by, bz, index) { +BOOST_DATA_TEST_CASE( + ConstantBField_update, + bdata::random(-2_T, 2_T) ^ bdata::random(-1_T, 4_T) ^ + bdata::random(0_T, 10_T) ^ bdata::random(-10_m, 10_m) ^ + bdata::random(-10_m, 10_m) ^ bdata::random(-10_m, 10_m) ^ + bdata::xrange(10), + x, + y, + z, + bx, + by, + bz, + index) { (void)index; ConstantBField BField(0, 0, 0); diff --git a/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp b/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp index 771c3e205..55e1d4b88 100644 --- a/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp +++ b/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp @@ -35,7 +35,8 @@ MagneticFieldContext mfContext = MagneticFieldContext(); BOOST_AUTO_TEST_CASE(InterpolatedBFieldMap_rz) { // definition of dummy BField struct BField { - static Vector3D value(const std::array<double, 2>& rz) { + static Vector3D + value(const std::array<double, 2>& rz) { double r = rz.at(0); double z = rz.at(1); // linear in r and z so interpolation should be exact @@ -85,27 +86,27 @@ BOOST_AUTO_TEST_CASE(InterpolatedBFieldMap_rz) { pos << -3, 2.5, 1.7; // test the cache interface BField_t::Cache bCache(mfContext); - CHECK_CLOSE_REL(b.getField(pos, bCache), - BField::value({{perp(pos), pos.z()}}), 1e-6); + CHECK_CLOSE_REL( + b.getField(pos, bCache), BField::value({{perp(pos), pos.z()}}), 1e-6); - CHECK_CLOSE_REL(b.getField(pos, bCache), - BField::value({{perp(pos), pos.z()}}), 1e-6); + CHECK_CLOSE_REL( + b.getField(pos, bCache), BField::value({{perp(pos), pos.z()}}), 1e-6); auto& c = *bCache.fieldCell; BOOST_CHECK(c.isInside(pos)); CHECK_CLOSE_REL(c.getField(pos), BField::value({{perp(pos), pos.z()}}), 1e-6); pos << 0, 1.5, -2.5; BField_t::Cache bCache2(mfContext); - CHECK_CLOSE_REL(b.getField(pos, bCache2), - BField::value({{perp(pos), pos.z()}}), 1e-6); + CHECK_CLOSE_REL( + b.getField(pos, bCache2), BField::value({{perp(pos), pos.z()}}), 1e-6); c = *bCache2.fieldCell; BOOST_CHECK(c.isInside(pos)); CHECK_CLOSE_REL(c.getField(pos), BField::value({{perp(pos), pos.z()}}), 1e-6); pos << 2, 3, -4; BField_t::Cache bCache3(mfContext); - CHECK_CLOSE_REL(b.getField(pos, bCache3), - BField::value({{perp(pos), pos.z()}}), 1e-6); + CHECK_CLOSE_REL( + b.getField(pos, bCache3), BField::value({{perp(pos), pos.z()}}), 1e-6); c = *bCache3.fieldCell; BOOST_CHECK(c.isInside(pos)); CHECK_CLOSE_REL(c.getField(pos), BField::value({{perp(pos), pos.z()}}), 1e-6); diff --git a/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp b/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp index 759afcf99..90656c25d 100644 --- a/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp +++ b/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp @@ -42,7 +42,8 @@ MagneticFieldContext mfContext = MagneticFieldContext(); /// The function does not assert any functionality, it just ensures /// the interface compiles template <class BField_t> -void testInterfaceConsistency(const BField_t& field) { +void +testInterfaceConsistency(const BField_t& field) { using Cache_t = typename BField_t::Cache; Vector3D pos(0, 0, 0); Vector3D B; @@ -71,19 +72,35 @@ BOOST_AUTO_TEST_CASE(TestSolenoidBFieldInterfaceConsistency) { BOOST_AUTO_TEST_CASE(TestInterpolatedBFieldMapInterfaceConsistency) { // define dummy mapper and field cell, we don't need them to do anything struct DummyFieldCell { - Vector3D getField(const Vector3D&) const { return {0, 0, 0}; } - bool isInside(const Vector3D&) const { return true; } + Vector3D + getField(const Vector3D&) const { + return {0, 0, 0}; + } + bool + isInside(const Vector3D&) const { + return true; + } }; struct DummyMapper : DummyFieldCell { using FieldCell = DummyFieldCell; - DummyFieldCell getFieldCell(const Vector3D&) const { + DummyFieldCell + getFieldCell(const Vector3D&) const { return DummyFieldCell(); } - std::vector<size_t> getNBins() const { return {42}; } - std::vector<double> getMin() const { return {5}; } - std::vector<double> getMax() const { return {15}; } + std::vector<size_t> + getNBins() const { + return {42}; + } + std::vector<double> + getMin() const { + return {5}; + } + std::vector<double> + getMax() const { + return {15}; + } }; DummyMapper m; diff --git a/Tests/Core/MagneticField/SolenoidBFieldTests.cpp b/Tests/Core/MagneticField/SolenoidBFieldTests.cpp index bbfa6931a..3019980d4 100644 --- a/Tests/Core/MagneticField/SolenoidBFieldTests.cpp +++ b/Tests/Core/MagneticField/SolenoidBFieldTests.cpp @@ -42,8 +42,8 @@ BOOST_AUTO_TEST_CASE(TestSolenoidBField) { SolenoidBField bField(cfg); SolenoidBField::Cache cache(mfContext); - CHECK_CLOSE_ABS(bField.getField({0, 0, 0}, cache), Vector3D(0, 0, 2.0_T), - 1e-6_T); + CHECK_CLOSE_ABS( + bField.getField({0, 0, 0}, cache), Vector3D(0, 0, 2.0_T), 1e-6_T); // std::ofstream outf("solenoid.csv"); // outf << "x;y;z;B_x;B_y;B_z" << std::endl; diff --git a/Tests/Core/MagneticField/SolenoidFieldBenchmark.cpp b/Tests/Core/MagneticField/SolenoidFieldBenchmark.cpp index d2be716e8..b96a2b5d1 100644 --- a/Tests/Core/MagneticField/SolenoidFieldBenchmark.cpp +++ b/Tests/Core/MagneticField/SolenoidFieldBenchmark.cpp @@ -18,7 +18,8 @@ using namespace Acts::UnitLiterals; -int main(int argc, char* argv[]) { +int +main(int argc, char* argv[]) { size_t n = 1e6; if (argc == 2) { n = std::stoi(argv[1]); @@ -40,8 +41,8 @@ int main(int argc, char* argv[]) { Acts::SolenoidBField bSolenoidField({R, L, nCoils, bMagCenter}); std::cout << "building map" << std::endl; - auto mapper = Acts::solenoidFieldMapper({rMin, rMax}, {zMin, zMax}, - {nBinsR, nBinsZ}, bSolenoidField); + auto mapper = Acts::solenoidFieldMapper( + {rMin, rMax}, {zMin, zMax}, {nBinsR, nBinsZ}, bSolenoidField); using BField_t = Acts::InterpolatedBFieldMap<decltype(mapper)>; BField_t::Config cfg(std::move(mapper)); diff --git a/Tests/Core/Material/AccumulatedMaterialPropertiesTests.cpp b/Tests/Core/Material/AccumulatedMaterialPropertiesTests.cpp index c839a63ba..00449bed7 100644 --- a/Tests/Core/Material/AccumulatedMaterialPropertiesTests.cpp +++ b/Tests/Core/Material/AccumulatedMaterialPropertiesTests.cpp @@ -81,16 +81,18 @@ BOOST_AUTO_TEST_CASE(AccumulatedMaterialProperties_trackaverage_test) { // A/Z should be 0.5 roughly for both CHECK_CLOSE_REL(mpAbc.averageZ() / mpAbc.averageA(), 0.5, 0.0001); // Thickness in X0 is additive - CHECK_CLOSE_REL(mpAbc.thicknessInX0(), - a.thicknessInX0() + b.thicknessInX0() + c.thicknessInX0(), - 0.0001); + CHECK_CLOSE_REL( + mpAbc.thicknessInX0(), + a.thicknessInX0() + b.thicknessInX0() + c.thicknessInX0(), + 0.0001); // Consistency check : X0 - CHECK_CLOSE_REL(mpAbc.thickness() / mpAbc.averageX0(), mpAbc.thicknessInX0(), - 0.0001); + CHECK_CLOSE_REL( + mpAbc.thickness() / mpAbc.averageX0(), mpAbc.thicknessInX0(), 0.0001); // Consistency check : L0 - CHECK_CLOSE_REL(mpAbc.thicknessInL0(), - a.thicknessInL0() + b.thicknessInL0() + c.thicknessInL0(), - 0.0001); + CHECK_CLOSE_REL( + mpAbc.thicknessInL0(), + a.thicknessInL0() + b.thicknessInL0() + c.thicknessInL0(), + 0.0001); // The density scales with the thickness then double rhoTmapped = mpAbc.averageRho() * mpAbc.thickness(); double rhoTadded = @@ -134,8 +136,10 @@ BOOST_AUTO_TEST_CASE(AccumulatedMaterialProperties_totalaverage_test) { BOOST_CHECK_EQUAL(halfA.thicknessInX0(), matAV.thicknessInX0()); BOOST_CHECK_EQUAL(halfA.thicknessInL0(), matAV.thicknessInL0()); - CHECK_CLOSE_REL(halfA.averageRho() * halfA.thickness(), - matAV.averageRho() * matAV.thickness(), 0.0001); + CHECK_CLOSE_REL( + halfA.averageRho() * halfA.thickness(), + matAV.averageRho() * matAV.thickness(), + 0.0001); BOOST_CHECK_EQUAL(2, averageAV.second); // Test: @@ -153,8 +157,10 @@ BOOST_AUTO_TEST_CASE(AccumulatedMaterialProperties_totalaverage_test) { BOOST_CHECK_EQUAL(doubleA.thicknessInX0(), matAA3.thicknessInX0()); BOOST_CHECK_EQUAL(doubleA.thicknessInL0(), matAA3.thicknessInL0()); - CHECK_CLOSE_REL(doubleA.averageRho() * doubleA.thickness(), - matAA3.averageRho() * matAA3.thickness(), 0.0001); + CHECK_CLOSE_REL( + doubleA.averageRho() * doubleA.thickness(), + matAA3.averageRho() * matAA3.thickness(), + 0.0001); BOOST_CHECK_EQUAL(2, averageAA3.second); /// Test: diff --git a/Tests/Core/Material/InterpolatedMaterialMapTests.cpp b/Tests/Core/Material/InterpolatedMaterialMapTests.cpp index e073118dc..94347ec2b 100644 --- a/Tests/Core/Material/InterpolatedMaterialMapTests.cpp +++ b/Tests/Core/Material/InterpolatedMaterialMapTests.cpp @@ -25,10 +25,11 @@ namespace Acts { namespace Test { constexpr unsigned int dim = 2; -using grid_t = detail::Grid<ActsVectorF<5>, detail::EquidistantAxis, - detail::EquidistantAxis>; +using grid_t = detail:: + Grid<ActsVectorF<5>, detail::EquidistantAxis, detail::EquidistantAxis>; -ActsVectorD<dim> trafoGlobalToLocal(const Vector3D& global) { +ActsVectorD<dim> +trafoGlobalToLocal(const Vector3D& global) { return {global.x(), global.y()}; } @@ -53,8 +54,8 @@ BOOST_AUTO_TEST_CASE(InterpolatedMaterialMap_MaterialCell_test) { BOOST_CHECK_EQUAL(materialCell.isInside(Vector3D(0., 0., 2.)), true); // Test the getter - CHECK_CLOSE_REL(materialCell.getMaterial({0.5, 0.5, 0.5}), Material(mat), - 1e-4); + CHECK_CLOSE_REL( + materialCell.getMaterial({0.5, 0.5, 0.5}), Material(mat), 1e-4); } BOOST_AUTO_TEST_CASE(InterpolatedMaterialMap_MaterialMapper_test) { @@ -146,13 +147,15 @@ BOOST_AUTO_TEST_CASE(InterpolatedMaterialMap_test) { InterpolatedMaterialMap<MaterialMapper<grid_t>>::Cache cache; cache.matCell = materialCell; cache.initialized = true; - CHECK_CLOSE_REL(ipolMatMap.getMaterial(Vector3D(0.5, 0.5, 0.5), cache), - Material(mat), 1e-4); + CHECK_CLOSE_REL( + ipolMatMap.getMaterial(Vector3D(0.5, 0.5, 0.5), cache), + Material(mat), + 1e-4); // Test the material map getter auto mapper = ipolMatMap.getMapper(); - BOOST_CHECK_EQUAL(mapper.getMaterial({0.5, 0.5, 0.5}), - matMap.getMaterial({0.5, 0.5, 0.5})); + BOOST_CHECK_EQUAL( + mapper.getMaterial({0.5, 0.5, 0.5}), matMap.getMaterial({0.5, 0.5, 0.5})); for (unsigned int i = 0; i < dim; i++) { BOOST_CHECK_EQUAL(mapper.getNBins()[i], matMap.getNBins()[i]); BOOST_CHECK_EQUAL(mapper.getMin()[i], matMap.getMin()[i]); diff --git a/Tests/Core/Material/MaterialCompositionTests.cpp b/Tests/Core/Material/MaterialCompositionTests.cpp index a8cc8b859..7304f99d1 100644 --- a/Tests/Core/Material/MaterialCompositionTests.cpp +++ b/Tests/Core/Material/MaterialCompositionTests.cpp @@ -61,8 +61,8 @@ BOOST_AUTO_TEST_CASE(ElementFraction_movable_test) { ElementFraction carbonMovedAssigned = std::move(carbonMoved); BOOST_CHECK_EQUAL(12ul, carbonMovedAssigned.element()); - CHECK_CLOSE_REL(carbonFraction, carbonMovedAssigned.fraction(), - elMaxTolerance); + CHECK_CLOSE_REL( + carbonFraction, carbonMovedAssigned.fraction(), elMaxTolerance); } BOOST_AUTO_TEST_CASE(MaterialComposition_construction_test) { @@ -94,22 +94,22 @@ BOOST_AUTO_TEST_CASE(MaterialComposition_construction_test) { MaterialComposition shuffledC(shuffled); // check if the sorting worked BOOST_CHECK_EQUAL(elementsC.size(), shuffledC.size()); - BOOST_CHECK_EQUAL(elementsC.elements()[0].data()[0], - shuffledC.elements()[0].data()[0]); - BOOST_CHECK_EQUAL(elementsC.elements()[1].data()[0], - shuffledC.elements()[1].data()[0]); - BOOST_CHECK_EQUAL(elementsC.elements()[2].data()[0], - shuffledC.elements()[2].data()[0]); - BOOST_CHECK_EQUAL(elementsC.elements()[3].data()[0], - shuffledC.elements()[3].data()[0]); - BOOST_CHECK_EQUAL(elementsC.elements()[0].data()[1], - shuffledC.elements()[0].data()[1]); - BOOST_CHECK_EQUAL(elementsC.elements()[1].data()[1], - shuffledC.elements()[1].data()[1]); - BOOST_CHECK_EQUAL(elementsC.elements()[2].data()[1], - shuffledC.elements()[2].data()[1]); - BOOST_CHECK_EQUAL(elementsC.elements()[3].data()[1], - shuffledC.elements()[3].data()[1]); + BOOST_CHECK_EQUAL( + elementsC.elements()[0].data()[0], shuffledC.elements()[0].data()[0]); + BOOST_CHECK_EQUAL( + elementsC.elements()[1].data()[0], shuffledC.elements()[1].data()[0]); + BOOST_CHECK_EQUAL( + elementsC.elements()[2].data()[0], shuffledC.elements()[2].data()[0]); + BOOST_CHECK_EQUAL( + elementsC.elements()[3].data()[0], shuffledC.elements()[3].data()[0]); + BOOST_CHECK_EQUAL( + elementsC.elements()[0].data()[1], shuffledC.elements()[0].data()[1]); + BOOST_CHECK_EQUAL( + elementsC.elements()[1].data()[1], shuffledC.elements()[1].data()[1]); + BOOST_CHECK_EQUAL( + elementsC.elements()[2].data()[1], shuffledC.elements()[2].data()[1]); + BOOST_CHECK_EQUAL( + elementsC.elements()[3].data()[1], shuffledC.elements()[3].data()[1]); /// or shortly BOOST_CHECK_EQUAL(elementsC, shuffledC); @@ -118,8 +118,9 @@ BOOST_AUTO_TEST_CASE(MaterialComposition_construction_test) { totalFraction += eFraction.fraction(); } // to better fit we need to implement some proper weight scaling - BOOST_CHECK_LT(std::abs(1. - totalFraction), - elementsC.elements().size() * elMaxTolerance); + BOOST_CHECK_LT( + std::abs(1. - totalFraction), + elementsC.elements().size() * elMaxTolerance); } BOOST_AUTO_TEST_CASE(MaterialComposition_movable_test) { diff --git a/Tests/Core/Material/MaterialPropertiesTests.cpp b/Tests/Core/Material/MaterialPropertiesTests.cpp index df9d0e427..9a59bc6e2 100644 --- a/Tests/Core/Material/MaterialPropertiesTests.cpp +++ b/Tests/Core/Material/MaterialPropertiesTests.cpp @@ -67,16 +67,18 @@ BOOST_AUTO_TEST_CASE(MaterialProperties_compound_test) { CHECK_CLOSE_REL(abc.thickness(), 1., 0.0001); // Thickness in X0 is additive - CHECK_CLOSE_REL(abc.thicknessInX0(), - a.thicknessInX0() + b.thicknessInX0() + c.thicknessInX0(), - 0.0001); + CHECK_CLOSE_REL( + abc.thicknessInX0(), + a.thicknessInX0() + b.thicknessInX0() + c.thicknessInX0(), + 0.0001); - CHECK_CLOSE_REL(abc.thickness() / abc.averageX0(), abc.thicknessInX0(), - 0.0001); + CHECK_CLOSE_REL( + abc.thickness() / abc.averageX0(), abc.thicknessInX0(), 0.0001); - CHECK_CLOSE_REL(abc.thicknessInL0(), - a.thicknessInL0() + b.thicknessInL0() + c.thicknessInL0(), - 0.0001); + CHECK_CLOSE_REL( + abc.thicknessInL0(), + a.thicknessInL0() + b.thicknessInL0() + c.thicknessInL0(), + 0.0001); // Thinkness is NOT unit scaled here MaterialProperties abcNS(compound, false); @@ -100,8 +102,10 @@ BOOST_AUTO_TEST_CASE(MaterialProperties_compound_test) { CHECK_CLOSE_REL(abc.thicknessInL0(), abcNS.thicknessInL0(), 0.0001); CHECK_CLOSE_REL(abc.averageA(), abcNS.averageA(), 0.0001); CHECK_CLOSE_REL(abc.averageZ(), abcNS.averageZ(), 0.0001); - CHECK_CLOSE_REL(abc.averageRho() * abc.thickness(), - abcNS.averageRho() * abcNS.thickness(), 0.0001); + CHECK_CLOSE_REL( + abc.averageRho() * abc.thickness(), + abcNS.averageRho() * abcNS.thickness(), + 0.0001); } // Test the Scaling @@ -120,8 +124,10 @@ BOOST_AUTO_TEST_CASE(MaterialProperties_scale_test) { CHECK_CLOSE_REL(mat.thicknessInL0(), 2. * halfMat.thicknessInL0(), 0.0001); // and half the energy loss, given - CHECK_CLOSE_REL(mat.thickness() * mat.averageRho(), - 2. * halfMat.thickness() * halfMat.averageRho(), 0.0001); + CHECK_CLOSE_REL( + mat.thickness() * mat.averageRho(), + 2. * halfMat.thickness() * halfMat.averageRho(), + 0.0001); } } // namespace Test diff --git a/Tests/Core/Material/MaterialTests.cpp b/Tests/Core/Material/MaterialTests.cpp index 7a535426b..8fca19913 100644 --- a/Tests/Core/Material/MaterialTests.cpp +++ b/Tests/Core/Material/MaterialTests.cpp @@ -49,8 +49,8 @@ BOOST_AUTO_TEST_CASE(Material_construction_and_units) { CHECK_CLOSE_REL(silicon.L0(), 465.2_mm, 0.001); CHECK_CLOSE_REL(silicon.Z(), 14., 0.001); CHECK_CLOSE_REL(silicon.A(), 28.0855, 0.001); - CHECK_CLOSE_REL(silicon.rho(), 0.002329_g / std::pow(UnitConstants::cm, 3.0), - 0.001); + CHECK_CLOSE_REL( + silicon.rho(), 0.002329_g / std::pow(UnitConstants::cm, 3.0), 0.001); CHECK_CLOSE_REL(silicon.zOverAtimesRho(), 14. / 28.0855 * 0.002329, 0.0001); ActsVectorF<5> siliconValues; diff --git a/Tests/Core/Material/SurfaceMaterialMapperTests.cpp b/Tests/Core/Material/SurfaceMaterialMapperTests.cpp index 0c425be4a..a841dfdd7 100644 --- a/Tests/Core/Material/SurfaceMaterialMapperTests.cpp +++ b/Tests/Core/Material/SurfaceMaterialMapperTests.cpp @@ -28,7 +28,8 @@ namespace Acts { /// @brief create a small tracking geometry to map some dummy material on -std::shared_ptr<const TrackingGeometry> trackingGeometry() { +std::shared_ptr<const TrackingGeometry> +trackingGeometry() { using namespace Acts::UnitLiterals; BinUtility zbinned(8, -40, 40, open, binZ); diff --git a/Tests/Core/Material/VolumeMaterialMapperTests.cpp b/Tests/Core/Material/VolumeMaterialMapperTests.cpp index 4aa01c2a6..a5e86a340 100644 --- a/Tests/Core/Material/VolumeMaterialMapperTests.cpp +++ b/Tests/Core/Material/VolumeMaterialMapperTests.cpp @@ -61,7 +61,8 @@ using MaterialGrid3D = /// /// @return Local grid point with the closest distance to @p matPos along the /// first axis -Grid2D::index_t mapToBin2D(const Vector3D& matPos, const Grid2D& grid) { +Grid2D::index_t +mapToBin2D(const Vector3D& matPos, const Grid2D& grid) { double dist = std::numeric_limits<double>::max(); size_t index = 0; // Loop through all elements in the first axis @@ -86,7 +87,8 @@ Grid2D::index_t mapToBin2D(const Vector3D& matPos, const Grid2D& grid) { /// /// @return Local grid point with the closest distance to @p matPos along the /// first axis -Grid3D::index_t mapToBin3D(const Vector3D& matPos, const Grid3D& grid) { +Grid3D::index_t +mapToBin3D(const Vector3D& matPos, const Grid3D& grid) { double dist = std::numeric_limits<double>::max(); size_t index = 0; // Loop through all elements in the first axis @@ -109,7 +111,8 @@ Grid3D::index_t mapToBin3D(const Vector3D& matPos, const Grid3D& grid) { /// @param [in] grid Grid that is used for the look-up /// /// @return Local grid point with the closest distance to @p matPos -Grid3D::index_t mapMaterial3D(const Vector3D& matPos, const Grid3D& grid) { +Grid3D::index_t +mapMaterial3D(const Vector3D& matPos, const Grid3D& grid) { double dist = std::numeric_limits<double>::max(); size_t indexX = 0, indexY = 0, indexZ = 0; // Loop through all elements @@ -145,8 +148,11 @@ struct MaterialCollector { using result_type = this_result; template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { if (state.navigation.currentVolume != nullptr) { auto position = stepper.position(state.stepping); result.matTrue.push_back( @@ -209,8 +215,8 @@ BOOST_AUTO_TEST_CASE(VolumeMaterialMapper_tests) { createMaterialGrid(axis1, axis2, axis3, matRecord, mapToBin3D); // Test sizes - BOOST_CHECK_EQUAL(mgrid3d.size(), - (axis1[2] + 2) * (axis2[2] + 2) * (axis3[2] + 2)); + BOOST_CHECK_EQUAL( + mgrid3d.size(), (axis1[2] + 2) * (axis2[2] + 2) * (axis3[2] + 2)); for (size_t index = 0; index < mgrid3d.size(); index++) { // Check the contained data if (index == 0) { @@ -307,14 +313,15 @@ BOOST_AUTO_TEST_CASE(VolumeMaterialMapper_comparison_tests) { // Set some start parameters Vector3D pos(0., 0., 0.); Vector3D mom(1_GeV, 0., 0.); - SingleCurvilinearTrackParameters<NeutralPolicy> sctp(nullptr, pos, mom, - 42_ns); + SingleCurvilinearTrackParameters<NeutralPolicy> sctp( + nullptr, pos, mom, 42_ns); MagneticFieldContext mc; // Launch propagation and gather result - PropagatorOptions<ActionList<MaterialCollector>, - AbortList<detail::EndOfWorldReached>> + PropagatorOptions< + ActionList<MaterialCollector>, + AbortList<detail::EndOfWorldReached>> po(gc, mc); po.maxStepSize = 1._mm; po.maxSteps = 1e6; diff --git a/Tests/Core/Propagator/ActionListTests.cpp b/Tests/Core/Propagator/ActionListTests.cpp index 76c0740ab..0230a6c86 100644 --- a/Tests/Core/Propagator/ActionListTests.cpp +++ b/Tests/Core/Propagator/ActionListTests.cpp @@ -97,14 +97,18 @@ struct DistanceObserver { DistanceObserver(double ptg = 0.) : path_to_go(ptg) {} template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& /*unused*/, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& /*unused*/, + result_type& result) const { result.distance = path_to_go - state.stepping.pathAccumulated; } template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*unused*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/) + const {} }; /// A call counter struct as an actor @@ -118,14 +122,18 @@ struct CallCounter { CallCounter() = default; template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/, - result_type& r) const { + void + operator()( + propagator_state_t& /*unused*/, + const stepper_t& /*unused*/, + result_type& r) const { ++r.calls; } template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*unused*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/) + const {} }; // This tests the implementation of the ActionList diff --git a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp index 056135045..f7559a60e 100644 --- a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp +++ b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp @@ -21,7 +21,8 @@ namespace po = boost::program_options; using namespace Acts; using namespace Acts::UnitLiterals; -int main(int argc, char* argv[]) { +int +main(int argc, char* argv[]) { unsigned int toys = 1; double ptInGeV = 1; double BzInT = 1; @@ -62,8 +63,9 @@ int main(int argc, char* argv[]) { ACTS_LOCAL_LOGGER(std::move(myLogger)); // print information about profiling setup - ACTS_INFO("propagating " << toys << " tracks with pT = " << ptInGeV - << "GeV in a " << BzInT << "T B-field"); + ACTS_INFO( + "propagating " << toys << " tracks with pT = " << ptInGeV << "GeV in a " + << BzInT << "T B-field"); using BField_type = ConstantBField; using Stepper_type = AtlasStepper<BField_type>; @@ -98,10 +100,11 @@ int main(int argc, char* argv[]) { double totalPathLength = 0; for (unsigned int i = 0; i < toys; ++i) { auto r = propagator.propagate(pars, options).value(); - ACTS_DEBUG("reached position (" << r.endParameters->position().x() << ", " - << r.endParameters->position().y() << ", " - << r.endParameters->position().z() - << ") in " << r.steps << " steps"); + ACTS_DEBUG( + "reached position (" << r.endParameters->position().x() << ", " + << r.endParameters->position().y() << ", " + << r.endParameters->position().z() << ") in " + << r.steps << " steps"); totalPathLength += r.pathLength; } diff --git a/Tests/Core/Propagator/AuctioneerTests.cpp b/Tests/Core/Propagator/AuctioneerTests.cpp index 8ff550b2e..a2844e11e 100644 --- a/Tests/Core/Propagator/AuctioneerTests.cpp +++ b/Tests/Core/Propagator/AuctioneerTests.cpp @@ -27,8 +27,8 @@ BOOST_AUTO_TEST_CASE(AuctioneerTest_VoidAuctioneer) { detail::VoidAuctioneer va; std::array<bool, 4> resultVa = va(vecArb); // Test that vector did not change - BOOST_CHECK_EQUAL_COLLECTIONS(vecRes.begin(), vecRes.end(), resultVa.begin(), - resultVa.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + vecRes.begin(), vecRes.end(), resultVa.begin(), resultVa.end()); } BOOST_AUTO_TEST_CASE(AuctioneerTest_FirstValidAuctioneer) { @@ -39,8 +39,8 @@ BOOST_AUTO_TEST_CASE(AuctioneerTest_FirstValidAuctioneer) { std::array<bool, 4> resultFva = fva(vecArb); std::array<bool, 4> expected = {false, true, false, false}; // Test that vector did not change - BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), - resultFva.begin(), resultFva.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + expected.begin(), expected.end(), resultFva.begin(), resultFva.end()); } BOOST_AUTO_TEST_CASE(AuctioneerTest_HighestValidAuctioneer) { @@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE(AuctioneerTest_HighestValidAuctioneer) { std::array<bool, 4> resultFva = fva(vecArb); std::array<bool, 4> expected = {false, false, false, true}; // Test that vector did not change - BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), - resultFva.begin(), resultFva.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + expected.begin(), expected.end(), resultFva.begin(), resultFva.end()); } } // namespace Test } // namespace Acts diff --git a/Tests/Core/Propagator/EigenStepperBenchmark.cpp b/Tests/Core/Propagator/EigenStepperBenchmark.cpp index 2f0346e85..2c7e2c0cd 100644 --- a/Tests/Core/Propagator/EigenStepperBenchmark.cpp +++ b/Tests/Core/Propagator/EigenStepperBenchmark.cpp @@ -21,7 +21,8 @@ namespace po = boost::program_options; using namespace Acts; using namespace Acts::UnitLiterals; -int main(int argc, char* argv[]) { +int +main(int argc, char* argv[]) { unsigned int toys = 1; double ptInGeV = 1; double BzInT = 1; @@ -62,8 +63,9 @@ int main(int argc, char* argv[]) { ACTS_LOCAL_LOGGER(std::move(myLogger)); // print information about profiling setup - ACTS_INFO("propagating " << toys << " tracks with pT = " << ptInGeV - << "GeV in a " << BzInT << "T B-field"); + ACTS_INFO( + "propagating " << toys << " tracks with pT = " << ptInGeV << "GeV in a " + << BzInT << "T B-field"); using BField_type = ConstantBField; using Stepper_type = EigenStepper<BField_type>; @@ -98,10 +100,11 @@ int main(int argc, char* argv[]) { double totalPathLength = 0; for (unsigned int i = 0; i < toys; ++i) { auto r = propagator.propagate(pars, options).value(); - ACTS_DEBUG("reached position (" << r.endParameters->position().x() << ", " - << r.endParameters->position().y() << ", " - << r.endParameters->position().z() - << ") in " << r.steps << " steps"); + ACTS_DEBUG( + "reached position (" << r.endParameters->position().x() << ", " + << r.endParameters->position().y() << ", " + << r.endParameters->position().z() << ") in " + << r.steps << " steps"); totalPathLength += r.pathLength; } diff --git a/Tests/Core/Propagator/ExtrapolatorTests.cpp b/Tests/Core/Propagator/ExtrapolatorTests.cpp index 1724fa571..17c5c4378 100644 --- a/Tests/Core/Propagator/ExtrapolatorTests.cpp +++ b/Tests/Core/Propagator/ExtrapolatorTests.cpp @@ -71,7 +71,8 @@ bool debugMode = false; struct PlaneSelector { /// Call operator /// @param sf The input surface to be checked - bool operator()(const Surface& sf) const { + bool + operator()(const Surface& sf) const { return (sf.type() == Surface::Plane); } }; @@ -80,15 +81,18 @@ struct PlaneSelector { // - simple extrapolation test BOOST_DATA_TEST_CASE( test_extrapolation_, - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 1, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 2, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 1, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 2, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 3, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -96,7 +100,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 4, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; @@ -123,23 +132,26 @@ BOOST_DATA_TEST_CASE( options.maxStepSize = 10_cm; options.pathLimit = 25_cm; - BOOST_CHECK(epropagator.propagate(start, options).value().endParameters != - nullptr); + BOOST_CHECK( + epropagator.propagate(start, options).value().endParameters != nullptr); } // This test case checks that no segmentation fault appears // - this tests the collection of surfaces BOOST_DATA_TEST_CASE( test_surface_collection_, - bdata::random((bdata::seed = 10, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 11, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 12, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 10, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 11, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 12, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 13, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -147,7 +159,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 14, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; @@ -207,15 +224,18 @@ BOOST_DATA_TEST_CASE( // - this tests the collection of surfaces BOOST_DATA_TEST_CASE( test_material_interactor_, - bdata::random((bdata::seed = 20, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 21, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 22, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 20, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 21, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 22, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 23, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -223,7 +243,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 24, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; @@ -257,8 +282,8 @@ BOOST_DATA_TEST_CASE( const auto& result = epropagator.propagate(start, options).value(); if (result.endParameters) { // test that you actually lost some energy - BOOST_CHECK_LT(result.endParameters->momentum().norm(), - start.momentum().norm()); + BOOST_CHECK_LT( + result.endParameters->momentum().norm(), start.momentum().norm()); } if (debugMode) { @@ -272,15 +297,18 @@ BOOST_DATA_TEST_CASE( // - this tests the loop protection BOOST_DATA_TEST_CASE( loop_protection_test, - bdata::random((bdata::seed = 20, - bdata::distribution = - std::uniform_real_distribution<>(0.1_GeV, 0.5_GeV))) ^ - bdata::random((bdata::seed = 21, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 22, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 20, + bdata::distribution = + std::uniform_real_distribution<>(0.1_GeV, 0.5_GeV))) ^ + bdata::random( + (bdata::seed = 21, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 22, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 23, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -288,7 +316,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 24, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; diff --git a/Tests/Core/Propagator/IntersectionCorrectorTests.cpp b/Tests/Core/Propagator/IntersectionCorrectorTests.cpp index 4d8766eaf..8bd2c0a2e 100644 --- a/Tests/Core/Propagator/IntersectionCorrectorTests.cpp +++ b/Tests/Core/Propagator/IntersectionCorrectorTests.cpp @@ -56,10 +56,10 @@ BOOST_AUTO_TEST_CASE(RelativePathCorrectorTests) { Vector3D d0p = Vector3D(-2., 9., 0.).normalized(); double pathp = 13.; - auto intersect = [&tgContext, &position, &direction, - &plane]() -> Intersection { - auto pi = plane->intersectionEstimate(tgContext, position, direction, - forward, false); + auto intersect = + [&tgContext, &position, &direction, &plane]() -> Intersection { + auto pi = plane->intersectionEstimate( + tgContext, position, direction, forward, false); std::cout << "Interseciton it at " << toString(pi.position) << std::endl; return pi; }; diff --git a/Tests/Core/Propagator/JacobianTests.cpp b/Tests/Core/Propagator/JacobianTests.cpp index d8bdbf3bf..26a945581 100644 --- a/Tests/Core/Propagator/JacobianTests.cpp +++ b/Tests/Core/Propagator/JacobianTests.cpp @@ -50,9 +50,11 @@ MagneticFieldContext mfContext = MagneticFieldContext(); /// @param nnomal The nominal normal direction /// @param angleT Rotation around the norminal normal /// @param angleU Roation around the original U axis -std::shared_ptr<Transform3D> createCylindricTransform(const Vector3D& nposition, - double angleX, - double angleY) { +std::shared_ptr<Transform3D> +createCylindricTransform( + const Vector3D& nposition, + double angleX, + double angleY) { Transform3D ctransform; ctransform.setIdentity(); ctransform.pretranslate(nposition); @@ -68,10 +70,12 @@ std::shared_ptr<Transform3D> createCylindricTransform(const Vector3D& nposition, /// @param nnomal The nominal normal direction /// @param angleT Rotation around the norminal normal /// @param angleU Roation around the original U axis -std::shared_ptr<Transform3D> createPlanarTransform(const Vector3D& nposition, - const Vector3D& nnormal, - double angleT, - double angleU) { +std::shared_ptr<Transform3D> +createPlanarTransform( + const Vector3D& nposition, + const Vector3D& nnormal, + double angleT, + double angleU) { // the rotation of the destination surface Vector3D T = nnormal.normalized(); Vector3D U = std::abs(T.dot(Vector3D::UnitZ())) < 0.99 @@ -109,7 +113,8 @@ std::shared_ptr<Transform3D> createPlanarTransform(const Vector3D& nposition, /// Az ->P[6] dAz/ P[14] P[22] P[30] P[38] P[46] P[54] /// CM ->P[7] dCM/ P[15] P[23] P[31] P[39] P[47] P[55] -BoundToFreeMatrix convertToMatrix(const double* P) { +BoundToFreeMatrix +convertToMatrix(const double* P) { // initialize to zero BoundToFreeMatrix jMatrix = BoundToFreeMatrix::Zero(); for (size_t j = 0; j < BoundParsDim; ++j) { @@ -127,7 +132,8 @@ BoundToFreeMatrix convertToMatrix(const double* P) { /// @tparam Parameters the parameter type /// @param pars the parameter object template <typename Parameters> -void testJacobianToGlobal(const Parameters& pars) { +void +testJacobianToGlobal(const Parameters& pars) { // Jacobian creation for Propagator/Steppers // a) ATLAS stepper AtlasStepperType::State astepState(tgContext, mfContext, pars); @@ -174,8 +180,8 @@ BOOST_AUTO_TEST_CASE(JacobianCylinderToGlobalTest) { BoundVector pars; pars << 182.34, -82., 0.134, 0.85, 1. / (100_GeV), 0; - BoundParameters atCylinder(tgContext, std::move(covPtr), std::move(pars), - cSurface); + BoundParameters atCylinder( + tgContext, std::move(covPtr), std::move(pars), cSurface); // run the test testJacobianToGlobal(atCylinder); @@ -196,8 +202,8 @@ BOOST_AUTO_TEST_CASE(JacobianDiscToGlobalTest) { BoundVector pars; pars << 192.34, 1.823, 0.734, 0.235, 1. / (100_GeV), 0; - BoundParameters atDisc(tgContext, std::move(covPtr), std::move(pars), - dSurface); + BoundParameters atDisc( + tgContext, std::move(covPtr), std::move(pars), dSurface); // run the test testJacobianToGlobal(atDisc); @@ -220,8 +226,8 @@ BOOST_AUTO_TEST_CASE(JacobianPlaneToGlobalTest) { BoundVector pars; pars << 12.34, -8722., 2.134, 0.85, 1. / (100_GeV), 0; - BoundParameters atPlane(tgContext, std::move(covPtr), std::move(pars), - pSurface); + BoundParameters atPlane( + tgContext, std::move(covPtr), std::move(pars), pSurface); // run the test testJacobianToGlobal(atPlane); @@ -239,8 +245,8 @@ BOOST_AUTO_TEST_CASE(JacobianPerigeeToGlobalTest) { BoundVector pars; pars << -3.34, -822., -0.734, 0.85, 1. / (100_GeV), 0; - BoundParameters perigee(tgContext, std::move(covPtr), std::move(pars), - pSurface); + BoundParameters perigee( + tgContext, std::move(covPtr), std::move(pars), pSurface); // run the test testJacobianToGlobal(perigee); @@ -260,8 +266,8 @@ BOOST_AUTO_TEST_CASE(JacobianStrawToGlobalTest) { BoundVector pars; pars << -8.34, 812., 0.734, 0.25, 1. / (100_GeV), 0; - BoundParameters atStraw(tgContext, std::move(covPtr), std::move(pars), - sSurface); + BoundParameters atStraw( + tgContext, std::move(covPtr), std::move(pars), sSurface); // run the test testJacobianToGlobal(atStraw); diff --git a/Tests/Core/Propagator/KalmanExtrapolatorTests.cpp b/Tests/Core/Propagator/KalmanExtrapolatorTests.cpp index dcd933462..6f82e0042 100644 --- a/Tests/Core/Propagator/KalmanExtrapolatorTests.cpp +++ b/Tests/Core/Propagator/KalmanExtrapolatorTests.cpp @@ -67,8 +67,11 @@ struct StepWiseActor { /// @param stepper The stepper in use /// @param result is the mutable result state object template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { // Listen to the surface and create bound state where necessary auto surface = state.navigation.currentSurface; if (surface and surface->associatedDetectorElement()) { @@ -98,8 +101,9 @@ struct StepWiseActor { /// @param state is the mutable propagator state object /// @param stepper Stepper used by the propagation template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*state*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*state*/, const stepper_t& /*unused*/) const { + } }; /// @@ -132,8 +136,8 @@ BOOST_AUTO_TEST_CASE(kalman_extrapolator) { // The start position and start parameters Vector3D pos(-3_m, 0., 0.), mom(1_GeV, 0., 0); - SingleCurvilinearTrackParameters<ChargedPolicy> start(std::move(covPtr), pos, - mom, 1., 42.); + SingleCurvilinearTrackParameters<ChargedPolicy> start( + std::move(covPtr), pos, mom, 1., 42.); // Create the ActionList and AbortList using StepWiseResult = StepWiseActor::result_type; diff --git a/Tests/Core/Propagator/LoopProtectionTests.cpp b/Tests/Core/Propagator/LoopProtectionTests.cpp index 0c5c59570..eb4841eb9 100644 --- a/Tests/Core/Propagator/LoopProtectionTests.cpp +++ b/Tests/Core/Propagator/LoopProtectionTests.cpp @@ -59,20 +59,29 @@ struct Stepper { /// the magnetic field cell is used (and potentially /// updated) /// @param [in] pos is the field position - Vector3D getField(SteppingState& /*unused*/, - const Vector3D& /*unused*/) const { + Vector3D + getField(SteppingState& /*unused*/, const Vector3D& /*unused*/) const { // get the field from the cell return field; } /// Access method - position - Vector3D position(const SteppingState& state) const { return state.pos; } + Vector3D + position(const SteppingState& state) const { + return state.pos; + } /// Access method - direction - Vector3D direction(const SteppingState& state) const { return state.dir; } + Vector3D + direction(const SteppingState& state) const { + return state.dir; + } /// Access method - momentum - double momentum(const SteppingState& state) const { return state.p; } + double + momentum(const SteppingState& state) const { + return state.p; + } }; /// @brief mockup of navigation state @@ -108,11 +117,14 @@ BOOST_DATA_TEST_CASE( bdata::random( (bdata::seed = 21, bdata::distribution = std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 22, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 22, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ bdata::xrange(1), - phi, deltaPhi, index) { + phi, + deltaPhi, + index) { (void)index; (void)deltaPhi; @@ -144,20 +156,27 @@ const int skip = 0; // stops where expected BOOST_DATA_TEST_CASE( propagator_loop_protection_test, - bdata::random((bdata::seed = 20, - bdata::distribution = - std::uniform_real_distribution<>(0.5_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 21, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 22, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 20, + bdata::distribution = + std::uniform_real_distribution<>(0.5_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 21, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 22, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 23, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, index) { + pT, + phi, + theta, + charge, + index) { if (index < skip) { return; } diff --git a/Tests/Core/Propagator/MaterialCollectionTests.cpp b/Tests/Core/Propagator/MaterialCollectionTests.cpp index 75a50a4e8..d346f6d97 100644 --- a/Tests/Core/Propagator/MaterialCollectionTests.cpp +++ b/Tests/Core/Propagator/MaterialCollectionTests.cpp @@ -70,8 +70,9 @@ EigenStepper estepper(bField); EigenPropagator epropagator(std::move(estepper), std::move(navigatorES)); StraightLineStepper slstepper; -StraightLinePropagator slpropagator(std::move(slstepper), - std::move(navigatorSL)); +StraightLinePropagator slpropagator( + std::move(slstepper), + std::move(navigatorSL)); const int ntests = 500; const int skip = 0; bool debugModeFwd = false; @@ -90,8 +91,15 @@ bool debugModeBwdStep = false; /// @param charge is the charge of the particle /// @param index is the run index from the test template <typename propagator_t> -void runTest(const propagator_t& prop, double pT, double phi, double theta, - int charge, double time, int index) { +void +runTest( + const propagator_t& prop, + double pT, + double phi, + double theta, + int charge, + double time, + int index) { double dcharge = -1 + 2 * charge; if (index < skip) { @@ -222,8 +230,9 @@ void runTest(const propagator_t& prop, double pT, double phi, double theta, } // forward-backward compatibility test - BOOST_CHECK_EQUAL(bwdMaterial.materialInteractions.size(), - fwdMaterial.materialInteractions.size()); + BOOST_CHECK_EQUAL( + bwdMaterial.materialInteractions.size(), + fwdMaterial.materialInteractions.size()); CHECK_CLOSE_REL(bwdMaterial.materialInX0, fwdMaterial.materialInX0, 1e-3); CHECK_CLOSE_REL(bwdMaterial.materialInL0, bwdMaterial.materialInL0, 1e-3); @@ -411,15 +420,18 @@ void runTest(const propagator_t& prop, double pT, double phi, double theta, // - this tests the collection of surfaces BOOST_DATA_TEST_CASE( test_material_collector, - bdata::random((bdata::seed = 20, - bdata::distribution = - std::uniform_real_distribution<>(0.5_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 21, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 22, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 20, + bdata::distribution = + std::uniform_real_distribution<>(0.5_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 21, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 22, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 23, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -427,7 +439,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 24, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { runTest(epropagator, pT, phi, theta, charge, time, index); runTest(slpropagator, pT, phi, theta, charge, time, index); } diff --git a/Tests/Core/Propagator/NavigatorTests.cpp b/Tests/Core/Propagator/NavigatorTests.cpp index f1d083288..811f7e1b8 100644 --- a/Tests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/Core/Propagator/NavigatorTests.cpp @@ -85,73 +85,107 @@ struct PropagatorState { }; /// Global particle position accessor - Vector3D position(const State& state) const { return state.pos; } + Vector3D + position(const State& state) const { + return state.pos; + } /// Momentum direction accessor - Vector3D direction(const State& state) const { return state.dir; } + Vector3D + direction(const State& state) const { + return state.dir; + } /// Momentum accessor - double momentum(const State& state) const { return state.p; } + double + momentum(const State& state) const { + return state.p; + } /// Charge access - double charge(const State& state) const { return state.q; } + double + charge(const State& state) const { + return state.q; + } /// Time access - double time(const State& state) const { return state.t; } + double + time(const State& state) const { + return state.t; + } /// Return a corrector - VoidIntersectionCorrector corrector(State& /*unused*/) const { + VoidIntersectionCorrector + corrector(State& /*unused*/) const { return VoidIntersectionCorrector(); } - bool surfaceReached(const State& state, const Surface* surface) const { - return surface->isOnSurface(tgContext, position(state), direction(state), - true); + bool + surfaceReached(const State& state, const Surface* surface) const { + return surface->isOnSurface( + tgContext, position(state), direction(state), true); } - BoundState boundState(State& state, const Surface& surface, - bool reinitialize = true) const { + BoundState + boundState(State& state, const Surface& surface, bool reinitialize = true) + const { // suppress unused warning (void)reinitialize; - BoundParameters parameters(tgContext, nullptr, state.pos, - state.p * state.dir, state.q, state.t, - surface.getSharedPtr()); - BoundState bState{std::move(parameters), Jacobian::Identity(), - state.pathAccumulated}; + BoundParameters parameters( + tgContext, + nullptr, + state.pos, + state.p * state.dir, + state.q, + state.t, + surface.getSharedPtr()); + BoundState bState{ + std::move(parameters), Jacobian::Identity(), state.pathAccumulated}; return bState; } - CurvilinearState curvilinearState(State& state, - bool reinitialize = true) const { + CurvilinearState + curvilinearState(State& state, bool reinitialize = true) const { (void)reinitialize; - CurvilinearParameters parameters(nullptr, state.pos, state.p * state.dir, - state.q, state.t); + CurvilinearParameters parameters( + nullptr, state.pos, state.p * state.dir, state.q, state.t); // Create the bound state - CurvilinearState curvState{std::move(parameters), Jacobian::Identity(), - state.pathAccumulated}; + CurvilinearState curvState{ + std::move(parameters), Jacobian::Identity(), state.pathAccumulated}; return curvState; } - void update(State& /*state*/, const BoundParameters& /*pars*/) const {} + void + update(State& /*state*/, const BoundParameters& /*pars*/) const {} - void update(State& /*state*/, const Vector3D& /*uposition*/, - const Vector3D& /*udirection*/, double /*up*/, - double /*time*/) const {} + void + update( + State& /*state*/, + const Vector3D& /*uposition*/, + const Vector3D& /*udirection*/, + double /*up*/, + double /*time*/) const {} - void covarianceTransport(State& /*state*/, - bool /*reinitialize = false*/) const {} + void + covarianceTransport(State& /*state*/, bool /*reinitialize = false*/) const { + } - void covarianceTransport(State& /*unused*/, const Surface& /*surface*/, - bool /*reinitialize = false*/) const {} + void + covarianceTransport( + State& /*unused*/, + const Surface& /*surface*/, + bool /*reinitialize = false*/) const {} - Vector3D getField(State& /*state*/, const Vector3D& /*pos*/) const { + Vector3D + getField(State& /*state*/, const Vector3D& /*pos*/) const { // get the field from the cell return Vector3D(0., 0., 0.); } }; - static_assert(StepperConcept<Stepper>, - "Dummy stepper does not fulfill concept"); + static_assert( + StepperConcept<Stepper>, + "Dummy stepper does not fulfill concept"); /// emulate the options template struct Options { @@ -188,7 +222,8 @@ struct PropagatorState { }; template <typename stepper_state_t> -void step(stepper_state_t& sstate) { +void +step(stepper_state_t& sstate) { // update the cache position sstate.pos = sstate.pos + sstate.stepSize * sstate.dir; // create navigation parameters @@ -239,8 +274,8 @@ BOOST_AUTO_TEST_CASE(Navigator_methods) { // Check that the currentVolume is set BOOST_CHECK_NE(state.navigation.currentVolume, nullptr); // Check that the currentVolume is the startVolume - BOOST_CHECK_EQUAL(state.navigation.currentVolume, - state.navigation.startVolume); + BOOST_CHECK_EQUAL( + state.navigation.currentVolume, state.navigation.startVolume); // Check that the currentSurface is reset to: BOOST_CHECK_EQUAL(state.navigation.currentSurface, nullptr); // No layer has been found @@ -250,14 +285,14 @@ BOOST_AUTO_TEST_CASE(Navigator_methods) { // A layer has been found BOOST_CHECK_EQUAL(state.navigation.navLayers.size(), 1); // The iterator should points to the begin - BOOST_CHECK(state.navigation.navLayerIter == - state.navigation.navLayers.begin()); + BOOST_CHECK( + state.navigation.navLayerIter == state.navigation.navLayers.begin()); // Cache the beam pipe radius double beamPipeRadius = perp(state.navigation.navLayerIter->intersection.position); // step size has been updated - CHECK_CLOSE_ABS(state.stepping.stepSize, beamPipeRadius, - s_onSurfaceTolerance); + CHECK_CLOSE_ABS( + state.stepping.stepSize, beamPipeRadius, s_onSurfaceTolerance); if (debug) { std::cout << "<<< Test 1a >>> initialize at " << toString(state.stepping.pos) << std::endl; @@ -273,8 +308,8 @@ BOOST_AUTO_TEST_CASE(Navigator_methods) { // STATUS navigator.status(state, stepper); // Check that the currentVolume is the still startVolume - BOOST_CHECK_EQUAL(state.navigation.currentVolume, - state.navigation.startVolume); + BOOST_CHECK_EQUAL( + state.navigation.currentVolume, state.navigation.startVolume); // The layer number has not changed BOOST_CHECK_EQUAL(state.navigation.navLayers.size(), 1); // The iterator still points to the begin diff --git a/Tests/Core/Propagator/PropagatorTests.cpp b/Tests/Core/Propagator/PropagatorTests.cpp index c4b03bc88..4c7bddb73 100644 --- a/Tests/Core/Propagator/PropagatorTests.cpp +++ b/Tests/Core/Propagator/PropagatorTests.cpp @@ -55,14 +55,18 @@ struct PerpendicularMeasure { PerpendicularMeasure() = default; template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { result.distance = perp(stepper.position(state.stepping)); } template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*unused*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/) + const {} }; /// An observer that measures the perpendicular distance @@ -84,16 +88,21 @@ struct SurfaceObserver { SurfaceObserver() = default; template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { if (surface && !result.surfaces_passed) { // calculate the distance to the surface - const double distance = - surface - ->intersectionEstimate( - state.geoContext, stepper.position(state.stepping), - stepper.direction(state.stepping), forward, true) - .pathLength; + const double distance = surface + ->intersectionEstimate( + state.geoContext, + stepper.position(state.stepping), + stepper.direction(state.stepping), + forward, + true) + .pathLength; // Adjust the step size so that we cannot cross the target surface state.stepping.stepSize.update(distance, cstep::actor); // return true if you fall below tolerance @@ -107,8 +116,9 @@ struct SurfaceObserver { } template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& /*unused*/, - const stepper_t& /*unused*/) const {} + void + operator()(propagator_state_t& /*unused*/, const stepper_t& /*unused*/) + const {} }; // Global definitions @@ -145,15 +155,18 @@ BOOST_AUTO_TEST_CASE(PropagatorOptions_) { BOOST_DATA_TEST_CASE( cylinder_passage_observer_, - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 1, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 2, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 1, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 2, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 3, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -161,7 +174,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 4, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; @@ -170,8 +188,8 @@ BOOST_DATA_TEST_CASE( using AbortConditionsType = AbortList<>; // setup propagation options - PropagatorOptions<ActionListType, AbortConditionsType> options(tgContext, - mfContext); + PropagatorOptions<ActionListType, AbortConditionsType> options( + tgContext, mfContext); options.pathLimit = 20_m; options.maxStepSize = 1_cm; @@ -202,15 +220,18 @@ BOOST_DATA_TEST_CASE( BOOST_DATA_TEST_CASE( curvilinear_additive_, - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 1, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 2, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 1, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 2, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 3, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -218,7 +239,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 4, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; @@ -260,8 +286,8 @@ BOOST_DATA_TEST_CASE( epropagator.propagate(start, options_1s).value().endParameters; // test that the propagation is additive - CHECK_CLOSE_REL(end_parameters_1s->position(), end_parameters_2s->position(), - 0.001); + CHECK_CLOSE_REL( + end_parameters_1s->position(), end_parameters_2s->position(), 0.001); const auto& cov_1s = *(end_parameters_1s->covariance()); const auto& cov_2s = *(end_parameters_2s->covariance()); @@ -276,15 +302,18 @@ BOOST_DATA_TEST_CASE( BOOST_DATA_TEST_CASE( cylinder_additive_, - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 1, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 2, - bdata::distribution = - std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 1, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 2, + bdata::distribution = + std::uniform_real_distribution<>(1.0, M_PI - 1.0))) ^ bdata::random( (bdata::seed = 3, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -292,7 +321,12 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 4, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { double dcharge = -1 + 2 * charge; (void)index; @@ -337,8 +371,8 @@ BOOST_DATA_TEST_CASE( epropagator.propagate(start, *cSurface, options_1s).value().endParameters; // test that the propagation is additive - CHECK_CLOSE_REL(end_parameters_1s->position(), end_parameters_2s->position(), - 0.001); + CHECK_CLOSE_REL( + end_parameters_1s->position(), end_parameters_2s->position(), 0.001); const auto& cov_1s = (*(end_parameters_1s->covariance())); const auto& cov_2s = (*(end_parameters_2s->covariance())); diff --git a/Tests/Core/Propagator/StepperTests.cpp b/Tests/Core/Propagator/StepperTests.cpp index f28fbd757..8f2b86ad8 100644 --- a/Tests/Core/Propagator/StepperTests.cpp +++ b/Tests/Core/Propagator/StepperTests.cpp @@ -61,7 +61,8 @@ struct EndOfWorld { /// @param [in] stepper Stepper of the propagation /// @return Boolean statement if the particle is still in the detector template <typename propagator_state_t, typename stepper_t> - bool operator()(propagator_state_t& state, const stepper_t& stepper) const { + bool + operator()(propagator_state_t& state, const stepper_t& stepper) const { const double tolerance = state.options.targetTolerance; if (maxX - std::abs(stepper.position(state.stepping).x()) <= tolerance || std::abs(stepper.position(state.stepping).y()) >= 0.5_m || @@ -96,11 +97,14 @@ struct StepCollector { /// @param [in] stepper Stepper of the propagation /// @param [out] result Struct which is filled with the data template <typename propagator_state_t, typename stepper_t> - void operator()(propagator_state_t& state, const stepper_t& stepper, - result_type& result) const { + void + operator()( + propagator_state_t& state, + const stepper_t& stepper, + result_type& result) const { result.position.push_back(stepper.position(state.stepping)); - result.momentum.push_back(stepper.momentum(state.stepping) * - stepper.direction(state.stepping)); + result.momentum.push_back( + stepper.momentum(state.stepping) * stepper.direction(state.stepping)); } }; @@ -154,8 +158,9 @@ BOOST_AUTO_TEST_CASE(step_extension_vacuum_test) { AbortList<EndOfWorld> abortList; // Set options for propagator - DenseStepperPropagatorOptions<ActionList<StepCollector>, - AbortList<EndOfWorld>> + DenseStepperPropagatorOptions< + ActionList<StepCollector>, + AbortList<EndOfWorld>> propOpts(tgContext, mfContext); propOpts.actionList = aList; propOpts.abortList = abortList; @@ -165,15 +170,18 @@ BOOST_AUTO_TEST_CASE(step_extension_vacuum_test) { // Build stepper and propagator ConstantBField bField(Vector3D(0., 0., 0.)); EigenStepper< - ConstantBField, VoidIntersectionCorrector, + ConstantBField, + VoidIntersectionCorrector, StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, detail::HighestValidAuctioneer> es(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension, - DenseEnvironmentExtension>, - detail::HighestValidAuctioneer>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, + detail::HighestValidAuctioneer>, + Navigator> prop(es, naviVac); // Launch and collect results @@ -203,12 +211,17 @@ BOOST_AUTO_TEST_CASE(step_extension_vacuum_test) { propOptsDef.maxSteps = 100; propOptsDef.maxStepSize = 0.5_m; - EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension>> + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension>> esDef(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension>>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension>>, + Navigator> propDef(esDef, naviVac); // Launch and collect results @@ -269,8 +282,9 @@ BOOST_AUTO_TEST_CASE(step_extension_material_test) { AbortList<EndOfWorld> abortList; // Set options for propagator - DenseStepperPropagatorOptions<ActionList<StepCollector>, - AbortList<EndOfWorld>> + DenseStepperPropagatorOptions< + ActionList<StepCollector>, + AbortList<EndOfWorld>> propOpts(tgContext, mfContext); propOpts.actionList = aList; propOpts.abortList = abortList; @@ -281,15 +295,18 @@ BOOST_AUTO_TEST_CASE(step_extension_material_test) { // Build stepper and propagator ConstantBField bField(Vector3D(0., 0., 0.)); EigenStepper< - ConstantBField, VoidIntersectionCorrector, + ConstantBField, + VoidIntersectionCorrector, StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, detail::HighestValidAuctioneer> es(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension, - DenseEnvironmentExtension>, - detail::HighestValidAuctioneer>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, + detail::HighestValidAuctioneer>, + Navigator> prop(es, naviMat); // Launch and collect results @@ -319,8 +336,9 @@ BOOST_AUTO_TEST_CASE(step_extension_material_test) { // Rebuild and check the choice of extension // Set options for propagator - DenseStepperPropagatorOptions<ActionList<StepCollector>, - AbortList<EndOfWorld>> + DenseStepperPropagatorOptions< + ActionList<StepCollector>, + AbortList<EndOfWorld>> propOptsDense(tgContext, mfContext); propOptsDense.actionList = aList; propOptsDense.abortList = abortList; @@ -329,12 +347,17 @@ BOOST_AUTO_TEST_CASE(step_extension_material_test) { propOptsDense.debug = true; // Build stepper and propagator - EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DenseEnvironmentExtension>> + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DenseEnvironmentExtension>> esDense(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DenseEnvironmentExtension>>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DenseEnvironmentExtension>>, + Navigator> propDense(esDense, naviMat); // Launch and collect results @@ -358,15 +381,18 @@ BOOST_AUTO_TEST_CASE(step_extension_material_test) { // Re-launch the configuration with magnetic field bField.setField(0., 1_T, 0.); EigenStepper< - ConstantBField, VoidIntersectionCorrector, + ConstantBField, + VoidIntersectionCorrector, StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, detail::HighestValidAuctioneer> esB(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension, - DenseEnvironmentExtension>, - detail::HighestValidAuctioneer>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, + detail::HighestValidAuctioneer>, + Navigator> propB(esB, naviMat); const auto& resultB = propB.propagate(sbtp, propOptsDense).value(); @@ -444,8 +470,9 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { abortList.get<EndOfWorld>().maxX = 3_m; // Set options for propagator - DenseStepperPropagatorOptions<ActionList<StepCollector>, - AbortList<EndOfWorld>> + DenseStepperPropagatorOptions< + ActionList<StepCollector>, + AbortList<EndOfWorld>> propOpts(tgContext, mfContext); propOpts.actionList = aList; propOpts.abortList = abortList; @@ -455,15 +482,18 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { // Build stepper and propagator ConstantBField bField(Vector3D(0., 1_T, 0.)); EigenStepper< - ConstantBField, VoidIntersectionCorrector, + ConstantBField, + VoidIntersectionCorrector, StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, detail::HighestValidAuctioneer> es(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension, - DenseEnvironmentExtension>, - detail::HighestValidAuctioneer>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension, DenseEnvironmentExtension>, + detail::HighestValidAuctioneer>, + Navigator> prop(es, naviDet); // Launch and collect results @@ -514,12 +544,17 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { propOptsDef.maxStepSize = 0.5_m; // Build stepper and propagator - EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension>> + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension>> esDef(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DefaultExtension>>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DefaultExtension>>, + Navigator> propDef(esDef, naviDet); // Launch and collect results @@ -558,8 +593,9 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { std::move(covPtr), startParams, startMom, 1., 0.); // Set options for propagator - DenseStepperPropagatorOptions<ActionList<StepCollector>, - AbortList<EndOfWorld>> + DenseStepperPropagatorOptions< + ActionList<StepCollector>, + AbortList<EndOfWorld>> propOptsDense(tgContext, mfContext); abortList.get<EndOfWorld>().maxX = 2_m; propOptsDense.actionList = aList; @@ -569,12 +605,17 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { propOptsDense.tolerance = 1e-8; // Build stepper and propagator - EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DenseEnvironmentExtension>> + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DenseEnvironmentExtension>> esDense(bField); - Propagator<EigenStepper<ConstantBField, VoidIntersectionCorrector, - StepperExtensionList<DenseEnvironmentExtension>>, - Navigator> + Propagator< + EigenStepper< + ConstantBField, + VoidIntersectionCorrector, + StepperExtensionList<DenseEnvironmentExtension>>, + Navigator> propDense(esDense, naviDet); // Launch and collect results @@ -586,8 +627,8 @@ BOOST_AUTO_TEST_CASE(step_extension_vacmatvac_test) { // Check the exit situation of the second volume for (unsigned int i = 0; i < stepResultDense.position.size(); i++) { if (2_m - stepResultDense.position[i].x() < 1e-4) { - endParams = std::make_pair(stepResultDense.position[i], - stepResultDense.momentum[i]); + endParams = std::make_pair( + stepResultDense.position[i], stepResultDense.momentum[i]); break; } } diff --git a/Tests/Core/Seeding/ATLASBottomBinFinder.hpp b/Tests/Core/Seeding/ATLASBottomBinFinder.hpp index 587fd8333..c6fc452c4 100644 --- a/Tests/Core/Seeding/ATLASBottomBinFinder.hpp +++ b/Tests/Core/Seeding/ATLASBottomBinFinder.hpp @@ -31,8 +31,10 @@ class ATLASBottomBinFinder : public IBinFinder<SpacePoint> { /// @param phiBin phi index of bin with middle space points /// @param zBin z index of bin with middle space points /// @param binnedSP phi-z grid containing all bins - std::set<size_t> findBins(size_t phiBin, size_t zBin, - const SpacePointGrid<SpacePoint>* binnedSP); + std::set<size_t> findBins( + size_t phiBin, + size_t zBin, + const SpacePointGrid<SpacePoint>* binnedSP); }; } // namespace Acts #include "ATLASBottomBinFinder.ipp" diff --git a/Tests/Core/Seeding/ATLASBottomBinFinder.ipp b/Tests/Core/Seeding/ATLASBottomBinFinder.ipp index a2a5481da..ab8384ff0 100644 --- a/Tests/Core/Seeding/ATLASBottomBinFinder.ipp +++ b/Tests/Core/Seeding/ATLASBottomBinFinder.ipp @@ -9,8 +9,10 @@ // DEBUG: THIS REQUIRES THE BINS TO BE SET TO phi:41 z:11 template <typename SpacePoint> -std::set<size_t> Acts::ATLASBottomBinFinder<SpacePoint>::findBins( - size_t phiBin, size_t zBin, +std::set<size_t> +Acts::ATLASBottomBinFinder<SpacePoint>::findBins( + size_t phiBin, + size_t zBin, const Acts::SpacePointGrid<SpacePoint>* binnedSP) { std::set<size_t> neighbourBins = binnedSP->neighborHoodIndices({phiBin, zBin}, 1); diff --git a/Tests/Core/Seeding/ATLASCuts.hpp b/Tests/Core/Seeding/ATLASCuts.hpp index 78283d9d1..75bd816cc 100644 --- a/Tests/Core/Seeding/ATLASCuts.hpp +++ b/Tests/Core/Seeding/ATLASCuts.hpp @@ -18,18 +18,21 @@ class ATLASCuts : public IExperimentCuts<SpacePoint> { /// @param middle middle space point of the current seed /// @param top top space point of the current seed /// @return seed weight to be added to the seed's weight - float seedWeight(const InternalSpacePoint<SpacePoint>& bottom, - const InternalSpacePoint<SpacePoint>& middle, - const InternalSpacePoint<SpacePoint>& top) const; + float seedWeight( + const InternalSpacePoint<SpacePoint>& bottom, + const InternalSpacePoint<SpacePoint>& middle, + const InternalSpacePoint<SpacePoint>& top) const; /// @param weight the current seed weight /// @param bottom bottom space point of the current seed /// @param middle middle space point of the current seed /// @param top top space point of the current seed /// @return true if the seed should be kept, false if the seed should be /// discarded - bool singleSeedCut(float weight, const InternalSpacePoint<SpacePoint>& bottom, - const InternalSpacePoint<SpacePoint>&, - const InternalSpacePoint<SpacePoint>&) const; + bool singleSeedCut( + float weight, + const InternalSpacePoint<SpacePoint>& bottom, + const InternalSpacePoint<SpacePoint>&, + const InternalSpacePoint<SpacePoint>&) const; /// @param seeds contains pairs of weight and seed created for one middle /// space @@ -43,7 +46,8 @@ class ATLASCuts : public IExperimentCuts<SpacePoint> { }; template <typename SpacePoint> -float ATLASCuts<SpacePoint>::seedWeight( +float +ATLASCuts<SpacePoint>::seedWeight( const InternalSpacePoint<SpacePoint>& bottom, const InternalSpacePoint<SpacePoint>&, const InternalSpacePoint<SpacePoint>& top) const { @@ -58,8 +62,10 @@ float ATLASCuts<SpacePoint>::seedWeight( } template <typename SpacePoint> -bool ATLASCuts<SpacePoint>::singleSeedCut( - float weight, const InternalSpacePoint<SpacePoint>& b, +bool +ATLASCuts<SpacePoint>::singleSeedCut( + float weight, + const InternalSpacePoint<SpacePoint>& b, const InternalSpacePoint<SpacePoint>&, const InternalSpacePoint<SpacePoint>&) const { return !(b.radius() > 150. && weight < 380.); diff --git a/Tests/Core/Seeding/ATLASTopBinFinder.hpp b/Tests/Core/Seeding/ATLASTopBinFinder.hpp index e77c737f7..bda595a1b 100644 --- a/Tests/Core/Seeding/ATLASTopBinFinder.hpp +++ b/Tests/Core/Seeding/ATLASTopBinFinder.hpp @@ -31,8 +31,10 @@ class ATLASTopBinFinder : public IBinFinder<SpacePoint> { /// @param phiBin phi index of bin with middle space points /// @param zBin z index of bin with middle space points /// @param binnedSP phi-z grid containing all bins - std::set<size_t> findBins(size_t phiBin, size_t zBin, - const SpacePointGrid<SpacePoint>* binnedSP); + std::set<size_t> findBins( + size_t phiBin, + size_t zBin, + const SpacePointGrid<SpacePoint>* binnedSP); }; } // namespace Acts diff --git a/Tests/Core/Seeding/ATLASTopBinFinder.ipp b/Tests/Core/Seeding/ATLASTopBinFinder.ipp index 9a1c89ebd..ef90f393f 100644 --- a/Tests/Core/Seeding/ATLASTopBinFinder.ipp +++ b/Tests/Core/Seeding/ATLASTopBinFinder.ipp @@ -8,8 +8,10 @@ // DEBUG: THIS REQUIRES THE BINS TO BE SET TO phi:41 z:11 template <typename SpacePoint> -std::set<size_t> Acts::ATLASTopBinFinder<SpacePoint>::findBins( - size_t phiBin, size_t zBin, +std::set<size_t> +Acts::ATLASTopBinFinder<SpacePoint>::findBins( + size_t phiBin, + size_t zBin, const Acts::SpacePointGrid<SpacePoint>* binnedSP) { std::set<size_t> neighbourBins = binnedSP->neighborHoodIndices({phiBin, zBin}, 1); diff --git a/Tests/Core/Seeding/SeedfinderTest.cpp b/Tests/Core/Seeding/SeedfinderTest.cpp index 1c0af88dd..5be4e2da3 100644 --- a/Tests/Core/Seeding/SeedfinderTest.cpp +++ b/Tests/Core/Seeding/SeedfinderTest.cpp @@ -23,7 +23,8 @@ #include <sstream> #include <utility> -std::vector<const SpacePoint*> readFile(std::string filename) { +std::vector<const SpacePoint*> +readFile(std::string filename) { std::string line; int layer; std::vector<const SpacePoint*> readSP; @@ -62,7 +63,8 @@ std::vector<const SpacePoint*> readFile(std::string filename) { return readSP; } -int main() { +int +main() { std::vector<const SpacePoint*> spVec = readFile("sp.txt"); std::cout << "size of read SP: " << spVec.size() << std::endl; @@ -105,7 +107,8 @@ int main() { spVec.begin(), spVec.end(), ct, bottomBinFinder, topBinFinder); auto start = std::chrono::system_clock::now(); for (Acts::SeedfinderStateIterator<SpacePoint> it = state.begin(); - !(it == state.end()); ++it) { + !(it == state.end()); + ++it) { a.createSeedsForRegion(it, state); } auto end = std::chrono::system_clock::now(); diff --git a/Tests/Core/Seeding/SpacePoint.hpp b/Tests/Core/Seeding/SpacePoint.hpp index 25d7ed12a..e507ed1b8 100644 --- a/Tests/Core/Seeding/SpacePoint.hpp +++ b/Tests/Core/Seeding/SpacePoint.hpp @@ -15,8 +15,20 @@ struct SpacePoint { int surface; float covr; float covz; - float x() const { return m_x; } - float y() const { return m_y; } - float z() const { return m_z; } - float r() const { return m_r; } + float + x() const { + return m_x; + } + float + y() const { + return m_y; + } + float + z() const { + return m_z; + } + float + r() const { + return m_r; + } }; diff --git a/Tests/Core/Seeding/TestCovarianceTool.hpp b/Tests/Core/Seeding/TestCovarianceTool.hpp index dfc07a1b9..00c7f4ea8 100644 --- a/Tests/Core/Seeding/TestCovarianceTool.hpp +++ b/Tests/Core/Seeding/TestCovarianceTool.hpp @@ -25,13 +25,19 @@ class CovarianceTool { /// @param sigma is multiplied with the combined alignment and covariance /// errors template <typename SpacePoint> - Acts::Vector2D getCovariances(const SpacePoint* sp, float zAlign = 0, - float rAlign = 0, float sigma = 1); + Acts::Vector2D getCovariances( + const SpacePoint* sp, + float zAlign = 0, + float rAlign = 0, + float sigma = 1); }; template <typename SpacePoint> -inline Acts::Vector2D CovarianceTool::getCovariances(const SpacePoint* sp, - float zAlign, float rAlign, - float sigma) { +inline Acts::Vector2D +CovarianceTool::getCovariances( + const SpacePoint* sp, + float zAlign, + float rAlign, + float sigma) { Acts::Vector2D cov; cov[0] = ((*sp).covr + rAlign * rAlign) * sigma; cov[1] = ((*sp).covz + zAlign * zAlign) * sigma; diff --git a/Tests/Core/Surfaces/BoundaryCheckBenchmark.cpp b/Tests/Core/Surfaces/BoundaryCheckBenchmark.cpp index f2b45c84f..136b678c1 100644 --- a/Tests/Core/Surfaces/BoundaryCheckBenchmark.cpp +++ b/Tests/Core/Surfaces/BoundaryCheckBenchmark.cpp @@ -21,10 +21,13 @@ using namespace Acts; constexpr int NTESTS = 2 << 15; // trapezoidal area -static const Vector2D POLY[] = { - {0.4, 0.25}, {0.6, 0.25}, {0.8, 0.75}, {0.2, 0.75}}; +static const Vector2D POLY[] = {{0.4, 0.25}, + {0.6, 0.25}, + {0.8, 0.75}, + {0.2, 0.75}}; -std::vector<Vector2D> make_random_points() { +std::vector<Vector2D> +make_random_points() { std::mt19937 rng(42); std::uniform_real_distribution<double> axis(0, 1); @@ -59,7 +62,8 @@ std::vector<Vector2D> make_random_points() { // return check.TestKDOPKDOP(limits, limitsErr); //} -inline bool isInside(const Vector2D& point, const BoundaryCheck& check) { +inline bool +isInside(const Vector2D& point, const BoundaryCheck& check) { return check.isInside(point, POLY); } @@ -71,7 +75,8 @@ struct StopWatch { StopWatch() : start(Clock::now()) {} - void finish(size_t n_trials, const char* name) { + void + finish(size_t n_trials, const char* name) { auto stop = Clock::now(); std::chrono::duration<double, std::micro> total = stop - start; std::chrono::duration<double, std::micro> perTrial = @@ -84,7 +89,8 @@ struct StopWatch { } }; -int main(int /*argc*/, char** /*argv[]*/) { +int +main(int /*argc*/, char** /*argv[]*/) { using std::cout; // absolute check w/o tolerance diff --git a/Tests/Core/Surfaces/ConeBoundsTests.cpp b/Tests/Core/Surfaces/ConeBoundsTests.cpp index 0a76875f0..5dc53a18e 100644 --- a/Tests/Core/Surfaces/ConeBoundsTests.cpp +++ b/Tests/Core/Surfaces/ConeBoundsTests.cpp @@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE(ConeBoundsConstruction) { ConeBounds defaulted5ParamConeBounds(alpha, zMin, zMax); BOOST_CHECK_EQUAL(defaulted5ParamConeBounds.type(), SurfaceBounds::Cone); BOOST_TEST_CHECKPOINT("Five parameter constructor)"); - ConeBounds fiveParamConstructedConeBounds(alpha, zMin, zMax, halfPhi, - averagePhi); + ConeBounds fiveParamConstructedConeBounds( + alpha, zMin, zMax, halfPhi, averagePhi); BOOST_CHECK_EQUAL(fiveParamConstructedConeBounds.type(), SurfaceBounds::Cone); BOOST_TEST_CHECKPOINT("Copy constructor"); ConeBounds copyConstructedConeBounds(fiveParamConstructedConeBounds); diff --git a/Tests/Core/Surfaces/ConeSurfaceTests.cpp b/Tests/Core/Surfaces/ConeSurfaceTests.cpp index 885b9c02f..9e4f4015e 100644 --- a/Tests/Core/Surfaces/ConeSurfaceTests.cpp +++ b/Tests/Core/Surfaces/ConeSurfaceTests.cpp @@ -53,10 +53,11 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceConstruction) { Surface::Cone); // /// Constructor with transform pointer, alpha,z min and max, halfPhiSector - BOOST_CHECK_EQUAL(Surface::makeShared<ConeSurface>(pTransform, alpha, zMin, - zMax, halfPhiSector) - ->type(), - Surface::Cone); + BOOST_CHECK_EQUAL( + Surface::makeShared<ConeSurface>( + pTransform, alpha, zMin, zMax, halfPhiSector) + ->type(), + Surface::Cone); // /// Constructor with transform and ConeBounds pointer @@ -109,7 +110,8 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) { Vector3D binningPosition{0., 1., 2.}; CHECK_CLOSE_ABS( coneSurfaceObject->binningPosition(tgContext, BinningValue::binPhi), - binningPosition, 1e-6); + binningPosition, + 1e-6); // /// Test referenceFrame Vector3D globalPosition{2.0, 2.0, 2.0}; @@ -119,7 +121,9 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) { expectedFrame << -rootHalf, 0., rootHalf, rootHalf, 0., rootHalf, 0., 1., 0.; CHECK_CLOSE_OR_SMALL( coneSurfaceObject->referenceFrame(tgContext, globalPosition, momentum), - expectedFrame, 1e-6, 1e-9); + expectedFrame, + 1e-6, + 1e-9); // /// Test normal, given 3D position Vector3D origin{0., 0., 0.}; @@ -130,29 +134,32 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) { Vector2D positionPiBy2(1.0, M_PI / 2.); Vector3D normalAtPiBy2{0.0312768, 0.92335, -0.382683}; - CHECK_CLOSE_OR_SMALL(coneSurfaceObject->normal(tgContext, positionPiBy2), - normalAtPiBy2, 1e-2, 1e-9); + CHECK_CLOSE_OR_SMALL( + coneSurfaceObject->normal(tgContext, positionPiBy2), + normalAtPiBy2, + 1e-2, + 1e-9); // /// Test rotational symmetry axis Vector3D symmetryAxis{0., 0., 1.}; - CHECK_CLOSE_ABS(coneSurfaceObject->rotSymmetryAxis(tgContext), symmetryAxis, - 1e-6); + CHECK_CLOSE_ABS( + coneSurfaceObject->rotSymmetryAxis(tgContext), symmetryAxis, 1e-6); // /// Test bounds BOOST_CHECK_EQUAL(coneSurfaceObject->bounds().type(), SurfaceBounds::Cone); // /// Test localToGlobal Vector2D localPosition{1.0, M_PI / 2.0}; - coneSurfaceObject->localToGlobal(tgContext, localPosition, momentum, - globalPosition); + coneSurfaceObject->localToGlobal( + tgContext, localPosition, momentum, globalPosition); // std::cout<<globalPosition<<std::endl; Vector3D expectedPosition{0.0220268, 1.65027, 3.5708}; CHECK_CLOSE_REL(globalPosition, expectedPosition, 1e-2); // /// Testing globalToLocal - coneSurfaceObject->globalToLocal(tgContext, globalPosition, momentum, - localPosition); + coneSurfaceObject->globalToLocal( + tgContext, globalPosition, momentum, localPosition); // std::cout<<localPosition<<std::endl; Vector2D expectedLocalPosition{1.0, M_PI / 2.0}; @@ -160,8 +167,8 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) { // /// Test isOnSurface Vector3D offSurface{100, 1, 2}; - BOOST_CHECK(coneSurfaceObject->isOnSurface(tgContext, globalPosition, - momentum, true)); + BOOST_CHECK(coneSurfaceObject->isOnSurface( + tgContext, globalPosition, momentum, true)); BOOST_CHECK( !coneSurfaceObject->isOnSurface(tgContext, offSurface, momentum, true)); // @@ -178,11 +185,12 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) { /// Test pathCorrection CHECK_CLOSE_REL( coneSurfaceObject->pathCorrection(tgContext, offSurface, momentum), - 0.40218866453252877, 0.01); + 0.40218866453252877, + 0.01); // /// Test name - BOOST_CHECK_EQUAL(coneSurfaceObject->name(), - std::string("Acts::ConeSurface")); + BOOST_CHECK_EQUAL( + coneSurfaceObject->name(), std::string("Acts::ConeSurface")); // /// Test dump // TODO 2017-04-12 msmk: check how to correctly check output diff --git a/Tests/Core/Surfaces/CylinderBoundsTests.cpp b/Tests/Core/Surfaces/CylinderBoundsTests.cpp index 3903eeb2c..05e19348a 100644 --- a/Tests/Core/Surfaces/CylinderBoundsTests.cpp +++ b/Tests/Core/Surfaces/CylinderBoundsTests.cpp @@ -29,18 +29,19 @@ BOOST_AUTO_TEST_CASE(CylinderBoundsConstruction) { /// test default construction // CylinderBounds defaultConstructedCylinderBounds; // deleted double radius(0.5), halfz(10.), halfphi(M_PI / 2.0), averagePhi(M_PI / 2.0); - BOOST_CHECK_EQUAL(CylinderBounds(radius, halfz).type(), - SurfaceBounds::Cylinder); - BOOST_CHECK_EQUAL(CylinderBounds(radius, halfphi, halfz).type(), - SurfaceBounds::Cylinder); - BOOST_CHECK_EQUAL(CylinderBounds(radius, averagePhi, halfphi, halfz).type(), - SurfaceBounds::Cylinder); + BOOST_CHECK_EQUAL( + CylinderBounds(radius, halfz).type(), SurfaceBounds::Cylinder); + BOOST_CHECK_EQUAL( + CylinderBounds(radius, halfphi, halfz).type(), SurfaceBounds::Cylinder); + BOOST_CHECK_EQUAL( + CylinderBounds(radius, averagePhi, halfphi, halfz).type(), + SurfaceBounds::Cylinder); // /// test copy construction; CylinderBounds cylinderBounds(radius, halfz); CylinderBounds copyConstructedCylinderBounds(cylinderBounds); - BOOST_CHECK_EQUAL(copyConstructedCylinderBounds.type(), - SurfaceBounds::Cylinder); + BOOST_CHECK_EQUAL( + copyConstructedCylinderBounds.type(), SurfaceBounds::Cylinder); } /// Unit tests for CylinderBounds properties @@ -52,8 +53,8 @@ BOOST_AUTO_TEST_CASE(CylinderBoundsProperties) { double averagePhi(0.0); double halfphi(M_PI / 4.0); CylinderBounds cylinderBoundsObject(nominalRadius, nominalHalfLength); - CylinderBounds cylinderBoundsSegment(nominalRadius, averagePhi, halfphi, - nominalHalfLength); + CylinderBounds cylinderBoundsSegment( + nominalRadius, averagePhi, halfphi, nominalHalfLength); /// test for clone auto pCylinderBoundsClone = cylinderBoundsObject.clone(); BOOST_CHECK_NE(pCylinderBoundsClone, nullptr); @@ -83,15 +84,23 @@ BOOST_AUTO_TEST_CASE(CylinderBoundsProperties) { !cylinderBoundsObject.inside3D(origin3D, trueBoundaryCheckWithTolerance)); /// test for distanceToBoundary - CHECK_CLOSE_REL(cylinderBoundsObject.distanceToBoundary(origin), 0.5, - 1e-6); // fail - CHECK_CLOSE_REL(cylinderBoundsObject.distanceToBoundary(beyondEnd), 10.0, - 1e-6); // pass + CHECK_CLOSE_REL( + cylinderBoundsObject.distanceToBoundary(origin), + 0.5, + 1e-6); // fail + CHECK_CLOSE_REL( + cylinderBoundsObject.distanceToBoundary(beyondEnd), + 10.0, + 1e-6); // pass double sinPiBy8 = std::sin(M_PI / 8.); - CHECK_CLOSE_REL(cylinderBoundsSegment.distanceToBoundary(atPi), sinPiBy8, - 1e-6); // pass - CHECK_CLOSE_REL(cylinderBoundsSegment.distanceToBoundary(origin), 0.5, - 1e-6); // fail + CHECK_CLOSE_REL( + cylinderBoundsSegment.distanceToBoundary(atPi), + sinPiBy8, + 1e-6); // pass + CHECK_CLOSE_REL( + cylinderBoundsSegment.distanceToBoundary(origin), + 0.5, + 1e-6); // fail /// test for r() CHECK_CLOSE_REL(cylinderBoundsObject.r(), nominalRadius, 1e-6); @@ -100,8 +109,10 @@ BOOST_AUTO_TEST_CASE(CylinderBoundsProperties) { CHECK_CLOSE_REL(cylinderBoundsObject.averagePhi(), averagePhi, 1e-6); /// test for halfPhiSector - CHECK_CLOSE_REL(cylinderBoundsSegment.halfPhiSector(), halfphi, - 1e-6); // fail + CHECK_CLOSE_REL( + cylinderBoundsSegment.halfPhiSector(), + halfphi, + 1e-6); // fail /// test for halflengthZ (NOTE: Naming violation) CHECK_CLOSE_REL(cylinderBoundsObject.halflengthZ(), nominalHalfLength, 1e-6); diff --git a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp index de28ad012..5d76de8be 100644 --- a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -52,10 +52,11 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceConstruction) { Surface::Cylinder); // /// Constructor with transform pointer, radius, halfZ and halfPhiSector - BOOST_CHECK_EQUAL(Surface::makeShared<CylinderSurface>(pTransform, radius, - halfPhiSector, halfZ) - ->type(), - Surface::Cylinder); + BOOST_CHECK_EQUAL( + Surface::makeShared<CylinderSurface>( + pTransform, radius, halfPhiSector, halfZ) + ->type(), + Surface::Cylinder); /// Constructor with transform and CylinderBounds pointer auto pCylinderBounds = std::make_shared<const CylinderBounds>(radius, halfZ); @@ -75,8 +76,8 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceConstruction) { /// Copied and transformed auto copiedTransformedCylinderSurface = Surface::makeShared<CylinderSurface>( testContext, *cylinderSurfaceObject, *pTransform); - BOOST_CHECK_EQUAL(copiedTransformedCylinderSurface->type(), - Surface::Cylinder); + BOOST_CHECK_EQUAL( + copiedTransformedCylinderSurface->type(), Surface::Cylinder); /// Construct with nullptr bounds BOOST_CHECK_THROW( @@ -105,7 +106,8 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) { Vector3D binningPosition{0., 1., 2.}; CHECK_CLOSE_ABS( cylinderSurfaceObject->binningPosition(testContext, BinningValue::binPhi), - binningPosition, 1e-9); + binningPosition, + 1e-9); // /// Test referenceFrame double rootHalf = std::sqrt(0.5); @@ -116,65 +118,77 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) { RotationMatrix3D expectedFrame; expectedFrame << rootHalf, 0., rootHalf, rootHalf, 0., -rootHalf, 0., 1., 0.; // check without shift - CHECK_CLOSE_OR_SMALL(cylinderSurfaceObject->referenceFrame( - testContext, globalPosition, momentum), - expectedFrame, 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + cylinderSurfaceObject->referenceFrame( + testContext, globalPosition, momentum), + expectedFrame, + 1e-6, + 1e-9); // check with shift and different momentum - CHECK_CLOSE_OR_SMALL(cylinderSurfaceObject->referenceFrame( - testContext, globalPositionZ, momentum2), - expectedFrame, 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + cylinderSurfaceObject->referenceFrame( + testContext, globalPositionZ, momentum2), + expectedFrame, + 1e-6, + 1e-9); // /// Test normal, given 3D position Vector3D origin{0., 0., 0.}; Vector3D normal3D = {0., -1., 0.}; - CHECK_CLOSE_ABS(cylinderSurfaceObject->normal(testContext, origin), normal3D, - 1e-9); + CHECK_CLOSE_ABS( + cylinderSurfaceObject->normal(testContext, origin), normal3D, 1e-9); Vector3D pos45deg = {rootHalf, 1 + rootHalf, 0.}; Vector3D pos45degZ = {rootHalf, 1 + rootHalf, 4.}; Vector3D normal45deg = {rootHalf, rootHalf, 0.}; // test the normal vector - CHECK_CLOSE_ABS(cylinderSurfaceObject->normal(testContext, pos45deg), - normal45deg, 1e-6 * rootHalf); + CHECK_CLOSE_ABS( + cylinderSurfaceObject->normal(testContext, pos45deg), + normal45deg, + 1e-6 * rootHalf); // thest that the normal vector is independent of z coordinate - CHECK_CLOSE_ABS(cylinderSurfaceObject->normal(testContext, pos45degZ), - normal45deg, 1e-6 * rootHalf); + CHECK_CLOSE_ABS( + cylinderSurfaceObject->normal(testContext, pos45degZ), + normal45deg, + 1e-6 * rootHalf); // /// Test normal given 2D rphi position Vector2D positionPiBy2(1.0, 0.); Vector3D normalAtPiBy2{std::cos(1.), std::sin(1.), 0.}; - CHECK_CLOSE_ABS(cylinderSurfaceObject->normal(testContext, positionPiBy2), - normalAtPiBy2, 1e-9); + CHECK_CLOSE_ABS( + cylinderSurfaceObject->normal(testContext, positionPiBy2), + normalAtPiBy2, + 1e-9); // /// Test rotational symmetry axis Vector3D symmetryAxis{0., 0., 1.}; - CHECK_CLOSE_ABS(cylinderSurfaceObject->rotSymmetryAxis(testContext), - symmetryAxis, 1e-9); + CHECK_CLOSE_ABS( + cylinderSurfaceObject->rotSymmetryAxis(testContext), symmetryAxis, 1e-9); // /// Test bounds - BOOST_CHECK_EQUAL(cylinderSurfaceObject->bounds().type(), - SurfaceBounds::Cylinder); + BOOST_CHECK_EQUAL( + cylinderSurfaceObject->bounds().type(), SurfaceBounds::Cylinder); // /// Test localToGlobal Vector2D localPosition{0., 0.}; - cylinderSurfaceObject->localToGlobal(testContext, localPosition, momentum, - globalPosition); + cylinderSurfaceObject->localToGlobal( + testContext, localPosition, momentum, globalPosition); Vector3D expectedPosition{1, 1, 2}; BOOST_CHECK_EQUAL(globalPosition, expectedPosition); // /// Testing globalToLocal - cylinderSurfaceObject->globalToLocal(testContext, globalPosition, momentum, - localPosition); + cylinderSurfaceObject->globalToLocal( + testContext, globalPosition, momentum, localPosition); Vector2D expectedLocalPosition{0., 0.}; BOOST_CHECK_EQUAL(localPosition, expectedLocalPosition); // /// Test isOnSurface Vector3D offSurface{100, 1, 2}; - BOOST_CHECK(cylinderSurfaceObject->isOnSurface(testContext, globalPosition, - momentum, true)); - BOOST_CHECK(!cylinderSurfaceObject->isOnSurface(testContext, offSurface, - momentum, true)); + BOOST_CHECK(cylinderSurfaceObject->isOnSurface( + testContext, globalPosition, momentum, true)); + BOOST_CHECK(!cylinderSurfaceObject->isOnSurface( + testContext, offSurface, momentum, true)); // /// intersectionEstimate Vector3D direction{-1., 0, 0}; @@ -189,11 +203,12 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) { /// Test pathCorrection CHECK_CLOSE_REL( cylinderSurfaceObject->pathCorrection(testContext, offSurface, momentum), - std::sqrt(3.), 0.01); + std::sqrt(3.), + 0.01); // /// Test name - BOOST_CHECK_EQUAL(cylinderSurfaceObject->name(), - std::string("Acts::CylinderSurface")); + BOOST_CHECK_EQUAL( + cylinderSurfaceObject->name(), std::string("Acts::CylinderSurface")); // /// Test dump boost::test_tools::output_test_stream dumpOuput; diff --git a/Tests/Core/Surfaces/DiamondBoundsTests.cpp b/Tests/Core/Surfaces/DiamondBoundsTests.cpp index 69db85e80..2bfcf2157 100644 --- a/Tests/Core/Surfaces/DiamondBoundsTests.cpp +++ b/Tests/Core/Surfaces/DiamondBoundsTests.cpp @@ -54,8 +54,8 @@ BOOST_AUTO_TEST_CASE(DiamondBoundsConstruction) { BOOST_AUTO_TEST_CASE(DiamondBoundsProperties) { double minHalfX(10.), midHalfX(50.), maxHalfX(30.), halfY1(10.), halfY2(20.); /// Test clone - DiamondBounds diamondBoundsObject(minHalfX, midHalfX, maxHalfX, halfY1, - halfY2); + DiamondBounds diamondBoundsObject( + minHalfX, midHalfX, maxHalfX, halfY1, halfY2); auto pClonedDiamondBoundsObject = diamondBoundsObject.clone(); BOOST_CHECK_NE(pClonedDiamondBoundsObject, nullptr); delete pClonedDiamondBoundsObject; @@ -80,8 +80,8 @@ BOOST_AUTO_TEST_CASE(DiamondBoundsProperties) { BOOST_CHECK_EQUAL(diamondBoundsObject.y2(), halfY2); // /// Test boundingBox - BOOST_CHECK_EQUAL(diamondBoundsObject.boundingBox(), - RectangleBounds(50., 20.)); + BOOST_CHECK_EQUAL( + diamondBoundsObject.boundingBox(), RectangleBounds(50., 20.)); // // clone already tested // @@ -89,10 +89,14 @@ BOOST_AUTO_TEST_CASE(DiamondBoundsProperties) { Vector2D origin(0., 0.); Vector2D outsideBy10(0., 30.); Vector2D inRectangle(15., 0.); - CHECK_CLOSE_REL(diamondBoundsObject.distanceToBoundary(origin), -10., - 1e-6); // makes sense - CHECK_CLOSE_REL(diamondBoundsObject.distanceToBoundary(outsideBy10), 10., - 1e-6); // ok + CHECK_CLOSE_REL( + diamondBoundsObject.distanceToBoundary(origin), + -10., + 1e-6); // makes sense + CHECK_CLOSE_REL( + diamondBoundsObject.distanceToBoundary(outsideBy10), + 10., + 1e-6); // ok // /// Test dump // Acts::DiamondBounds: (minHlengthX, medHlengthX, maxHlengthX, hlengthY1, @@ -113,24 +117,29 @@ BOOST_AUTO_TEST_CASE(DiamondBoundsProperties) { // /// Test vertices (does this need to be implemented in this class?? // auto v=diamondBoundsObject.vertices(); - std::vector<Vector2D> referenceVertices{ - {minHalfX, -halfY1}, {midHalfX, 0.}, {maxHalfX, halfY2}, - {-maxHalfX, halfY2}, {-midHalfX, 0.}, {-minHalfX, -halfY1}}; + std::vector<Vector2D> referenceVertices{{minHalfX, -halfY1}, + {midHalfX, 0.}, + {maxHalfX, halfY2}, + {-maxHalfX, halfY2}, + {-midHalfX, 0.}, + {-minHalfX, -halfY1}}; const auto& actualVertices = diamondBoundsObject.vertices(); - BOOST_CHECK_EQUAL_COLLECTIONS(actualVertices.cbegin(), actualVertices.cend(), - referenceVertices.cbegin(), - referenceVertices.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + actualVertices.cbegin(), + actualVertices.cend(), + referenceVertices.cbegin(), + referenceVertices.cend()); } /// Unit test for testing DiamondBounds assignment BOOST_AUTO_TEST_CASE(DiamondBoundsAssignment) { double minHalfX(10.), midHalfX(20.), maxHalfX(15.), halfY1(5.), halfY2(7.); - DiamondBounds diamondBoundsObject(minHalfX, midHalfX, maxHalfX, halfY1, - halfY2); + DiamondBounds diamondBoundsObject( + minHalfX, midHalfX, maxHalfX, halfY1, halfY2); DiamondBounds similarlyConstructeDiamondBoundsObject( minHalfX, midHalfX, maxHalfX, halfY1, halfY2); /// Test operator == - BOOST_CHECK_EQUAL(diamondBoundsObject, - similarlyConstructeDiamondBoundsObject); + BOOST_CHECK_EQUAL( + diamondBoundsObject, similarlyConstructeDiamondBoundsObject); // /// Test assignment DiamondBounds assignedDiamondBoundsObject(0, 0, 0, 0, 0); // invalid diff --git a/Tests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/Core/Surfaces/DiscSurfaceTests.cpp index f5c1d4d01..c3efeb841 100644 --- a/Tests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/Core/Surfaces/DiscSurfaceTests.cpp @@ -111,73 +111,84 @@ BOOST_AUTO_TEST_CASE(DiscSurface_properties_test, *utf::expected_failures(2)) { Vector3D point3DOnSurface{1.2, 0.0, 0}; BOOST_CHECK(!discSurfaceObject->isOnSurface( tgContext, point3DNotInSector, ignoredMomentum, true)); // passes - BOOST_CHECK(discSurfaceObject->isOnSurface(tgContext, point3DOnSurface, - ignoredMomentum, true)); // passes + BOOST_CHECK(discSurfaceObject->isOnSurface( + tgContext, point3DOnSurface, ignoredMomentum, true)); // passes // /// Test localToGlobal Vector3D returnedPosition{10.9, 8.7, 6.5}; Vector3D expectedPosition{1.2, 0, 0}; Vector2D rPhiOnDisc{1.2, 0.0}; Vector2D rPhiNotInSector{1.2, M_PI}; // outside sector at Phi=0, +/- pi/8 - discSurfaceObject->localToGlobal(tgContext, rPhiOnDisc, ignoredMomentum, - returnedPosition); + discSurfaceObject->localToGlobal( + tgContext, rPhiOnDisc, ignoredMomentum, returnedPosition); CHECK_CLOSE_ABS(returnedPosition, expectedPosition, 1e-6); // - discSurfaceObject->localToGlobal(tgContext, rPhiNotInSector, ignoredMomentum, - returnedPosition); + discSurfaceObject->localToGlobal( + tgContext, rPhiNotInSector, ignoredMomentum, returnedPosition); Vector3D expectedNonPosition{-1.2, 0, 0}; CHECK_CLOSE_ABS(returnedPosition, expectedNonPosition, 1e-6); // /// Test globalToLocal Vector2D returnedLocalPosition{33., 44.}; Vector2D expectedLocalPosition{1.2, 0.0}; - BOOST_CHECK(discSurfaceObject->globalToLocal(tgContext, point3DOnSurface, - ignoredMomentum, - returnedLocalPosition)); // pass + BOOST_CHECK(discSurfaceObject->globalToLocal( + tgContext, + point3DOnSurface, + ignoredMomentum, + returnedLocalPosition)); // pass CHECK_CLOSE_ABS(returnedLocalPosition, expectedLocalPosition, 1e-6); // BOOST_CHECK(!discSurfaceObject->globalToLocal( - tgContext, point3DNotInSector, ignoredMomentum, + tgContext, + point3DNotInSector, + ignoredMomentum, returnedLocalPosition)); // test fails // Vector3D pointOutsideRadius{0.0, 100., 0}; BOOST_CHECK(!discSurfaceObject->globalToLocal( - tgContext, pointOutsideRadius, ignoredMomentum, + tgContext, + pointOutsideRadius, + ignoredMomentum, returnedLocalPosition)); // fails // /// Test localPolarToCartesian Vector2D rPhi1_1{std::sqrt(2.), M_PI / 4.}; Vector2D cartesian1_1{1., 1.}; - CHECK_CLOSE_REL(discSurfaceObject->localPolarToCartesian(rPhi1_1), - cartesian1_1, 1e-6); + CHECK_CLOSE_REL( + discSurfaceObject->localPolarToCartesian(rPhi1_1), cartesian1_1, 1e-6); // /// Test localCartesianToPolar - CHECK_CLOSE_REL(discSurfaceObject->localCartesianToPolar(cartesian1_1), - rPhi1_1, 1e-6); + CHECK_CLOSE_REL( + discSurfaceObject->localCartesianToPolar(cartesian1_1), rPhi1_1, 1e-6); // /// Test localPolarToLocalCartesian - CHECK_CLOSE_REL(discSurfaceObject->localPolarToLocalCartesian(rPhi1_1), - cartesian1_1, 1e-6); + CHECK_CLOSE_REL( + discSurfaceObject->localPolarToLocalCartesian(rPhi1_1), + cartesian1_1, + 1e-6); // /// Test localCartesianToGlobal Vector3D cartesian3D1_1{1., 1., 0.}; CHECK_CLOSE_ABS( discSurfaceObject->localCartesianToGlobal(tgContext, cartesian1_1), - cartesian3D1_1, 1e-6); + cartesian3D1_1, + 1e-6); // /// Test globalToLocalCartesian CHECK_CLOSE_REL( discSurfaceObject->globalToLocalCartesian(tgContext, cartesian3D1_1), - cartesian1_1, 1e-6); + cartesian1_1, + 1e-6); // /// Test pathCorrection double projected3DMomentum = std::sqrt(3.) * 1.e6; - Vector3D momentum{projected3DMomentum, projected3DMomentum, - projected3DMomentum}; + Vector3D momentum{ + projected3DMomentum, projected3DMomentum, projected3DMomentum}; Vector3D ignoredPosition{1.1, 2.2, 3.3}; CHECK_CLOSE_REL( discSurfaceObject->pathCorrection(tgContext, ignoredPosition, momentum), - std::sqrt(3), 0.01); + std::sqrt(3), + 0.01); // /// intersectionEstimate Vector3D globalPosition{1.2, 0.0, -10.}; diff --git a/Tests/Core/Surfaces/DiscTrapezoidalBoundsTests.cpp b/Tests/Core/Surfaces/DiscTrapezoidalBoundsTests.cpp index ef2df8a35..4c1aa704e 100644 --- a/Tests/Core/Surfaces/DiscTrapezoidalBoundsTests.cpp +++ b/Tests/Core/Surfaces/DiscTrapezoidalBoundsTests.cpp @@ -54,24 +54,24 @@ BOOST_AUTO_TEST_CASE(DiscTrapezoidalBoundsProperties) { double minHalfX(1.0), maxHalfX(5.0), rMin(2.0), rMax(6.0), averagePhi(0.0) /*, stereo(0.1)*/; /// Test clone - DiscTrapezoidalBounds discTrapezoidalBoundsObject(minHalfX, maxHalfX, rMin, - rMax, averagePhi); + DiscTrapezoidalBounds discTrapezoidalBoundsObject( + minHalfX, maxHalfX, rMin, rMax, averagePhi); auto pClonedDiscTrapezoidalBounds = discTrapezoidalBoundsObject.clone(); BOOST_CHECK_NE(pClonedDiscTrapezoidalBounds, nullptr); delete pClonedDiscTrapezoidalBounds; // /// Test type() (redundant; already used in constructor confirmation) - BOOST_CHECK_EQUAL(discTrapezoidalBoundsObject.type(), - SurfaceBounds::DiscTrapezoidal); + BOOST_CHECK_EQUAL( + discTrapezoidalBoundsObject.type(), SurfaceBounds::DiscTrapezoidal); // /// Test distanceToBoundary Vector2D origin(0., 0.); Vector2D outside(30., 0.); Vector2D inSurface(2., 0.0); - CHECK_CLOSE_REL(discTrapezoidalBoundsObject.distanceToBoundary(origin), 2.0, - 1e-6); - CHECK_CLOSE_REL(discTrapezoidalBoundsObject.distanceToBoundary(outside), 24.0, - 1e-6); + CHECK_CLOSE_REL( + discTrapezoidalBoundsObject.distanceToBoundary(origin), 2.0, 1e-6); + CHECK_CLOSE_REL( + discTrapezoidalBoundsObject.distanceToBoundary(outside), 24.0, 1e-6); // /// Test dump boost::test_tools::output_test_stream dumpOuput; @@ -116,16 +116,16 @@ BOOST_AUTO_TEST_CASE(DiscTrapezoidalBoundsProperties) { BOOST_AUTO_TEST_CASE(DiscTrapezoidalBoundsAssignment) { double minHalfX(1.0), maxHalfX(5.0), rMin(2.0), rMax(6.0), averagePhi(0.0), stereo(0.1); - DiscTrapezoidalBounds discTrapezoidalBoundsObject(minHalfX, maxHalfX, rMin, - rMax, averagePhi, stereo); + DiscTrapezoidalBounds discTrapezoidalBoundsObject( + minHalfX, maxHalfX, rMin, rMax, averagePhi, stereo); // operator == not implemented in this class // /// Test assignment - DiscTrapezoidalBounds assignedDiscTrapezoidalBoundsObject(2.1, 6.6, 3.4, 4.2, - 33.); + DiscTrapezoidalBounds assignedDiscTrapezoidalBoundsObject( + 2.1, 6.6, 3.4, 4.2, 33.); assignedDiscTrapezoidalBoundsObject = discTrapezoidalBoundsObject; - BOOST_CHECK_EQUAL(assignedDiscTrapezoidalBoundsObject, - discTrapezoidalBoundsObject); + BOOST_CHECK_EQUAL( + assignedDiscTrapezoidalBoundsObject, discTrapezoidalBoundsObject); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Surfaces/EllipseBoundsTests.cpp b/Tests/Core/Surfaces/EllipseBoundsTests.cpp index cd766d0a7..5760c3e25 100644 --- a/Tests/Core/Surfaces/EllipseBoundsTests.cpp +++ b/Tests/Core/Surfaces/EllipseBoundsTests.cpp @@ -38,8 +38,8 @@ BOOST_AUTO_TEST_CASE(EllipseBoundsConstruction) { SurfaceBounds::Ellipse); // /// Copy constructor - EllipseBounds original(minRad1, minRad2, maxRad1, maxRad2, averagePhi, - phiSector); + EllipseBounds original( + minRad1, minRad2, maxRad1, maxRad2, averagePhi, phiSector); EllipseBounds copied(original); BOOST_CHECK_EQUAL(copied.type(), SurfaceBounds::Ellipse); } @@ -50,8 +50,8 @@ BOOST_AUTO_TEST_CASE(EllipseBoundsProperties) { double minRad1(10.), minRad2(15.), maxRad1(15.), maxRad2(20.), averagePhi(0.), phiSector(M_PI / 2.); /// Test clone - EllipseBounds ellipseBoundsObject(minRad1, minRad2, maxRad1, maxRad2, - averagePhi, phiSector); + EllipseBounds ellipseBoundsObject( + minRad1, minRad2, maxRad1, maxRad2, averagePhi, phiSector); auto pClonedEllipseBoundsObject = ellipseBoundsObject.clone(); BOOST_CHECK_NE(pClonedEllipseBoundsObject, nullptr); delete pClonedEllipseBoundsObject; @@ -65,10 +65,14 @@ BOOST_AUTO_TEST_CASE(EllipseBoundsProperties) { Vector2D origin(0., 0.); Vector2D outsideBy10(0., 30.); Vector2D inRectangle(17., 11.); - CHECK_CLOSE_REL(ellipseBoundsObject.distanceToBoundary(origin), 10., - 1e-6); // makes sense - CHECK_CLOSE_REL(ellipseBoundsObject.distanceToBoundary(outsideBy10), 10., - 1e-6); // fails, not clear why + CHECK_CLOSE_REL( + ellipseBoundsObject.distanceToBoundary(origin), + 10., + 1e-6); // makes sense + CHECK_CLOSE_REL( + ellipseBoundsObject.distanceToBoundary(outsideBy10), + 10., + 1e-6); // fails, not clear why // /// Test rMinX BOOST_CHECK_EQUAL(ellipseBoundsObject.rMinX(), minRad1); @@ -88,13 +92,15 @@ BOOST_AUTO_TEST_CASE(EllipseBoundsProperties) { /// Test vertices std::vector<Vector2D> expectedVertices{{15, 0}, {0, 20}, {-15, 0}, {0, -20}}; const auto& actualVertices = ellipseBoundsObject.vertices(); - BOOST_CHECK_EQUAL_COLLECTIONS(actualVertices.cbegin(), actualVertices.cend(), - expectedVertices.cbegin(), - expectedVertices.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + actualVertices.cbegin(), + actualVertices.cend(), + expectedVertices.cbegin(), + expectedVertices.cend()); // /// Test boundingBox - BOOST_CHECK_EQUAL(ellipseBoundsObject.boundingBox(), - RectangleBounds(15., 20.)); + BOOST_CHECK_EQUAL( + ellipseBoundsObject.boundingBox(), RectangleBounds(15., 20.)); // /// Test halfPhiSector BOOST_CHECK_EQUAL(ellipseBoundsObject.halfPhiSector(), M_PI / 2.); @@ -116,13 +122,13 @@ BOOST_AUTO_TEST_CASE(EllipseBoundsProperties) { BOOST_AUTO_TEST_CASE(EllipseBoundsAssignment) { double minRad1(10.), minRad2(15.), maxRad1(15.), maxRad2(20.), averagePhi(0.), phiSector(M_PI / 2.); - EllipseBounds ellipseBoundsObject(minRad1, minRad2, maxRad1, maxRad2, - averagePhi, phiSector); + EllipseBounds ellipseBoundsObject( + minRad1, minRad2, maxRad1, maxRad2, averagePhi, phiSector); EllipseBounds similarlyConstructeEllipseBoundsObject( minRad1, minRad2, maxRad1, maxRad2, averagePhi, phiSector); /// Test operator == - BOOST_CHECK_EQUAL(ellipseBoundsObject, - similarlyConstructeEllipseBoundsObject); + BOOST_CHECK_EQUAL( + ellipseBoundsObject, similarlyConstructeEllipseBoundsObject); // /// Test assignment EllipseBounds assignedEllipseBoundsObject(11., 12., 17., 18., 1.); diff --git a/Tests/Core/Surfaces/LineBoundsTests.cpp b/Tests/Core/Surfaces/LineBoundsTests.cpp index 1c52dc48f..23fb1f97a 100644 --- a/Tests/Core/Surfaces/LineBoundsTests.cpp +++ b/Tests/Core/Surfaces/LineBoundsTests.cpp @@ -65,8 +65,10 @@ BOOST_AUTO_TEST_CASE(LineBoundsProperties) { lineBoundsObject.inside(atRadius, trueBoundaryCheckWithTolerance)); /// test for distanceToBoundary - CHECK_CLOSE_REL(lineBoundsObject.distanceToBoundary(unitR), 1., - 1e-6); // why? + CHECK_CLOSE_REL( + lineBoundsObject.distanceToBoundary(unitR), + 1., + 1e-6); // why? /// test for r() BOOST_CHECK_EQUAL(lineBoundsObject.r(), nominalRadius); @@ -88,8 +90,8 @@ BOOST_AUTO_TEST_CASE(LineBoundsAssignment) { LineBounds assignedLineBounds; assignedLineBounds = lineBoundsObject; BOOST_CHECK_EQUAL(assignedLineBounds.r(), lineBoundsObject.r()); - BOOST_CHECK_EQUAL(assignedLineBounds.halflengthZ(), - lineBoundsObject.halflengthZ()); + BOOST_CHECK_EQUAL( + assignedLineBounds.halflengthZ(), lineBoundsObject.halflengthZ()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Surfaces/LineSurfaceTests.cpp b/Tests/Core/Surfaces/LineSurfaceTests.cpp index 8438513ca..a133778eb 100644 --- a/Tests/Core/Surfaces/LineSurfaceTests.cpp +++ b/Tests/Core/Surfaces/LineSurfaceTests.cpp @@ -65,8 +65,8 @@ BOOST_AUTO_TEST_CASE(LineSurface_Constructors_test) { /// Construct with nullptr bounds DetectorElementStub detElem; - BOOST_CHECK_THROW(LineSurfaceStub nullBounds(nullptr, detElem), - AssertionFailureException); + BOOST_CHECK_THROW( + LineSurfaceStub nullBounds(nullptr, detElem), AssertionFailureException); BOOST_TEST_MESSAGE( "All LineSurface constructors are callable without problem"); @@ -79,8 +79,8 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { auto pTransform = std::make_shared<const Transform3D>(translation); LineSurfaceStub line(pTransform, 2.0, 20.); Vector3D referencePosition{0., 1., 2.}; - CHECK_CLOSE_ABS(referencePosition, line.binningPosition(tgContext, binX), - 1e-6); + CHECK_CLOSE_ABS( + referencePosition, line.binningPosition(tgContext, binX), 1e-6); // // bounds() auto pLineBounds = std::make_shared<const LineBounds>(10.0); @@ -105,13 +105,18 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { tgContext, {0., 0., 0.}, direction.normalized(), navDir, bcheck); BOOST_CHECK(intersection.valid); Vector3D expectedIntersection(0, 1., 2.); - CHECK_CLOSE_ABS(intersection.position, expectedIntersection, - 1e-6); // need more tests.. + CHECK_CLOSE_ABS( + intersection.position, + expectedIntersection, + 1e-6); // need more tests.. // // isOnSurface const Vector3D insidePosition{0., 2.5, 0.}; - BOOST_CHECK(line.isOnSurface(tgContext, insidePosition, mom, - false)); // need better test here + BOOST_CHECK(line.isOnSurface( + tgContext, + insidePosition, + mom, + false)); // need better test here const Vector3D outsidePosition{100., 100., 200.}; BOOST_CHECK(!line.isOnSurface(tgContext, outsidePosition, mom, true)); // @@ -119,8 +124,8 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { Vector3D returnedGlobalPosition{0., 0., 0.}; // Vector2D localPosition{0., 0.}; const Vector3D momentum{300., 200., 0.}; // find better values! - line.localToGlobal(tgContext, localPosition, momentum, - returnedGlobalPosition); + line.localToGlobal( + tgContext, localPosition, momentum, returnedGlobalPosition); const Vector3D expectedGlobalPosition{0, 1, 0}; CHECK_CLOSE_ABS(returnedGlobalPosition, expectedGlobalPosition, 1e-6); // @@ -134,8 +139,8 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { expectedRotationMatrix << -v1, 0., v0, v0, 0., v1, 0., 1., -0.; // std::cout<<returnedRotationMatrix<<std::endl; // std::cout<<expectedRotationMatrix<<std::endl; - CHECK_CLOSE_OR_SMALL(returnedRotationMatrix, expectedRotationMatrix, 1e-6, - 1e-9); + CHECK_CLOSE_OR_SMALL( + returnedRotationMatrix, expectedRotationMatrix, 1e-6, 1e-9); // // name() boost::test_tools::output_test_stream output; @@ -148,8 +153,8 @@ BOOST_AUTO_TEST_CASE(LineSurface_allNamedMethods_test) { // // pathCorrection auto any3DVector = normalVector; - CHECK_CLOSE_REL(line.pathCorrection(tgContext, any3DVector, any3DVector), 1., - 1e-6); + CHECK_CLOSE_REL( + line.pathCorrection(tgContext, any3DVector, any3DVector), 1., 1e-6); } /// Unit test for testing LineSurface assignment BOOST_AUTO_TEST_CASE(LineSurface_assignment_test) { diff --git a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp index 0a4e3fa66..2ca47f9f8 100644 --- a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp +++ b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp @@ -42,17 +42,19 @@ BOOST_AUTO_TEST_CASE(PerigeeSurfaceConstruction) { /// Constructor with Vector3D Vector3D unitXYZ{1., 1., 1.}; auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ); - BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(unitXYZ)->type(), - Surface::Perigee); + BOOST_CHECK_EQUAL( + Surface::makeShared<PerigeeSurface>(unitXYZ)->type(), Surface::Perigee); // /// Constructor with transform pointer, null or valid Translation3D translation{0., 1., 2.}; auto pTransform = std::make_shared<const Transform3D>(translation); auto pNullTransform = std::make_shared<const Transform3D>(); - BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pNullTransform)->type(), - Surface::Perigee); - BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pTransform)->type(), - Surface::Perigee); + BOOST_CHECK_EQUAL( + Surface::makeShared<PerigeeSurface>(pNullTransform)->type(), + Surface::Perigee); + BOOST_CHECK_EQUAL( + Surface::makeShared<PerigeeSurface>(pTransform)->type(), + Surface::Perigee); // /// Copy constructor auto copiedPerigeeSurface = @@ -79,8 +81,8 @@ BOOST_AUTO_TEST_CASE(PerigeeSurfaceProperties) { BOOST_CHECK_EQUAL(perigeeSurfaceObject->type(), Surface::Perigee); // /// Test name - BOOST_CHECK_EQUAL(perigeeSurfaceObject->name(), - std::string("Acts::PerigeeSurface")); + BOOST_CHECK_EQUAL( + perigeeSurfaceObject->name(), std::string("Acts::PerigeeSurface")); // /// Test dump boost::test_tools::output_test_stream dumpOuput; diff --git a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp index 748bcf553..bee855aec 100644 --- a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -121,38 +121,40 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceProperties) { CHECK_CLOSE_OR_SMALL( planeSurfaceObject->referenceFrame(tgContext, globalPosition, momentum), - expectedFrame, 1e-6, 1e-9); + expectedFrame, + 1e-6, + 1e-9); // /// Test normal, given 3D position Vector3D normal3D(0., 0., 1.); BOOST_CHECK_EQUAL(planeSurfaceObject->normal(tgContext), normal3D); // /// Test bounds - BOOST_CHECK_EQUAL(planeSurfaceObject->bounds().type(), - SurfaceBounds::Rectangle); + BOOST_CHECK_EQUAL( + planeSurfaceObject->bounds().type(), SurfaceBounds::Rectangle); /// Test localToGlobal Vector2D localPosition{1.5, 1.7}; - planeSurfaceObject->localToGlobal(tgContext, localPosition, momentum, - globalPosition); + planeSurfaceObject->localToGlobal( + tgContext, localPosition, momentum, globalPosition); // // expected position is the translated one - Vector3D expectedPosition{1.5 + translation.x(), 1.7 + translation.y(), - translation.z()}; + Vector3D expectedPosition{ + 1.5 + translation.x(), 1.7 + translation.y(), translation.z()}; CHECK_CLOSE_REL(globalPosition, expectedPosition, 1e-2); // /// Testing globalToLocal - planeSurfaceObject->globalToLocal(tgContext, globalPosition, momentum, - localPosition); + planeSurfaceObject->globalToLocal( + tgContext, globalPosition, momentum, localPosition); Vector2D expectedLocalPosition{1.5, 1.7}; CHECK_CLOSE_REL(localPosition, expectedLocalPosition, 1e-2); /// Test isOnSurface Vector3D offSurface{0, 1, -2.}; - BOOST_CHECK(planeSurfaceObject->isOnSurface(tgContext, globalPosition, - momentum, true)); + BOOST_CHECK(planeSurfaceObject->isOnSurface( + tgContext, globalPosition, momentum, true)); BOOST_CHECK( !planeSurfaceObject->isOnSurface(tgContext, offSurface, momentum, true)); // @@ -172,8 +174,8 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceProperties) { // 0.01); // /// Test name - BOOST_CHECK_EQUAL(planeSurfaceObject->name(), - std::string("Acts::PlaneSurface")); + BOOST_CHECK_EQUAL( + planeSurfaceObject->name(), std::string("Acts::PlaneSurface")); // /// Test dump // TODO 2017-04-12 msmk: check how to correctly check output diff --git a/Tests/Core/Surfaces/RadialBoundsTests.cpp b/Tests/Core/Surfaces/RadialBoundsTests.cpp index 3c6ba06e5..813bc6764 100644 --- a/Tests/Core/Surfaces/RadialBoundsTests.cpp +++ b/Tests/Core/Surfaces/RadialBoundsTests.cpp @@ -31,12 +31,13 @@ BOOST_AUTO_TEST_CASE(RadialBoundsConstruction) { // RadialBounds defaultConstructedRadialBounds; should be deleted // /// Test construction with radii and default sector - BOOST_CHECK_EQUAL(RadialBounds(minRadius, maxRadius).type(), - SurfaceBounds::Disc); + BOOST_CHECK_EQUAL( + RadialBounds(minRadius, maxRadius).type(), SurfaceBounds::Disc); // /// Test construction with radii and sector half angle - BOOST_CHECK_EQUAL(RadialBounds(minRadius, maxRadius, halfPhiSector).type(), - SurfaceBounds::Disc); + BOOST_CHECK_EQUAL( + RadialBounds(minRadius, maxRadius, halfPhiSector).type(), + SurfaceBounds::Disc); // /// Copy constructor RadialBounds original(minRadius, maxRadius); @@ -60,10 +61,14 @@ BOOST_AUTO_TEST_CASE(RadialBoundsProperties) { Vector2D origin(0., 0.); Vector2D outside(30., 0.); Vector2D inSurface(2., 0.0); - CHECK_CLOSE_REL(radialBoundsObject.distanceToBoundary(origin), 1., - 1e-6); // makes sense - CHECK_CLOSE_REL(radialBoundsObject.distanceToBoundary(outside), 25., - 1e-6); // ok + CHECK_CLOSE_REL( + radialBoundsObject.distanceToBoundary(origin), + 1., + 1e-6); // makes sense + CHECK_CLOSE_REL( + radialBoundsObject.distanceToBoundary(outside), + 25., + 1e-6); // ok // /// Test dump boost::test_tools::output_test_stream dumpOuput; diff --git a/Tests/Core/Surfaces/RectangleBoundsTests.cpp b/Tests/Core/Surfaces/RectangleBoundsTests.cpp index b66387898..444f3e584 100644 --- a/Tests/Core/Surfaces/RectangleBoundsTests.cpp +++ b/Tests/Core/Surfaces/RectangleBoundsTests.cpp @@ -29,13 +29,15 @@ const double NaN = std::numeric_limits<double>::quiet_NaN(); namespace Acts { namespace Test { -void dumpVertices(const RectangleBounds& r) { +void +dumpVertices(const RectangleBounds& r) { const auto& v = r.vertices(); for (const auto& i : v) { std::cout << "(" << i[0] << ", " << i[1] << ")" << std::endl; } } -bool approximatelyEqual(const Vector2D& a, const Vector2D& b) { +bool +approximatelyEqual(const Vector2D& a, const Vector2D& b) { const double dif0 = std::abs(a[0] - b[0]); const double dif1 = std::abs(a[1] - b[1]); const double tol = 1e-9; @@ -46,8 +48,8 @@ BOOST_AUTO_TEST_SUITE(Surfaces) BOOST_AUTO_TEST_CASE(RectangleBoundsConstruction) { const double halfX(10.), halfY(5.); RectangleBounds twentyByTenRectangle(halfX, halfY); - BOOST_CHECK_EQUAL(twentyByTenRectangle.type(), - Acts::SurfaceBounds::Rectangle); + BOOST_CHECK_EQUAL( + twentyByTenRectangle.type(), Acts::SurfaceBounds::Rectangle); // // nonsensical bounds are also permitted, but maybe should not be const double zeroHalfX(0.), zeroHalfY(0.); @@ -57,8 +59,8 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsConstruction) { // // BOOST_TEST_MESSAGE("Initialise with zero dimensions"); RectangleBounds zeroDimensionsRectangle(zeroHalfX, zeroHalfY); - BOOST_CHECK_EQUAL(zeroDimensionsRectangle.type(), - Acts::SurfaceBounds::Rectangle); + BOOST_CHECK_EQUAL( + zeroDimensionsRectangle.type(), Acts::SurfaceBounds::Rectangle); // // BOOST_TEST_MESSAGE("Initialise with infinite dimensions"); RectangleBounds infinite(infHalfX, infHalfY); @@ -70,8 +72,8 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsConstruction) { // // BOOST_TEST_MESSAGE("Initialise with negative dimensions"); RectangleBounds negativeDimensionedRectangle(negHalfX, negHalfY); - BOOST_CHECK_EQUAL(negativeDimensionedRectangle.type(), - Acts::SurfaceBounds::Rectangle); + BOOST_CHECK_EQUAL( + negativeDimensionedRectangle.type(), Acts::SurfaceBounds::Rectangle); } /// Unit test for testing RectangleBounds properties @@ -89,8 +91,11 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsProperties) { {10., -5.}, {10., 5.}, {-10., 5.}, {-10., -5.}}; // equality, ensure ordering is ok const auto& rectVertices = rect.vertices(); - BOOST_CHECK_EQUAL_COLLECTIONS(coords.cbegin(), coords.cend(), - rectVertices.cbegin(), rectVertices.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + coords.cbegin(), + coords.cend(), + rectVertices.cbegin(), + rectVertices.cend()); const Vector2D pointA{1.0, 1.0}, pointB{9.0, 1.0}, outside{10.1, 5.1}; // distance is signed, from boundary to point. (doesn't seem right, given // the name of the method) @@ -107,8 +112,10 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsAssignment) { const auto originalVertices = rectA.vertices(); const auto assignedVertices = rectB.vertices(); BOOST_CHECK_EQUAL_COLLECTIONS( - originalVertices.cbegin(), originalVertices.cend(), - assignedVertices.cbegin(), assignedVertices.cend()); + originalVertices.cbegin(), + originalVertices.cend(), + assignedVertices.cbegin(), + assignedVertices.cend()); } BOOST_AUTO_TEST_CASE(RectangleBoundsClone) { @@ -118,9 +125,11 @@ BOOST_AUTO_TEST_CASE(RectangleBoundsClone) { BOOST_CHECK_NE(rectB, nullptr); const auto& originalVertices = rectA.vertices(); const auto& clonedVertices = rectB->vertices(); - BOOST_CHECK_EQUAL_COLLECTIONS(originalVertices.cbegin(), - originalVertices.cend(), - clonedVertices.cbegin(), clonedVertices.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + originalVertices.cbegin(), + originalVertices.cend(), + clonedVertices.cbegin(), + clonedVertices.cend()); delete rectB; } diff --git a/Tests/Core/Surfaces/StrawSurfaceTests.cpp b/Tests/Core/Surfaces/StrawSurfaceTests.cpp index 44c198852..62c4ddf6b 100644 --- a/Tests/Core/Surfaces/StrawSurfaceTests.cpp +++ b/Tests/Core/Surfaces/StrawSurfaceTests.cpp @@ -99,8 +99,8 @@ BOOST_AUTO_TEST_CASE(StrawSurfaceProperties) { BOOST_CHECK_EQUAL(strawSurfaceObject->type(), Surface::Straw); // /// Test name - BOOST_CHECK_EQUAL(strawSurfaceObject->name(), - std::string("Acts::StrawSurface")); + BOOST_CHECK_EQUAL( + strawSurfaceObject->name(), std::string("Acts::StrawSurface")); // /// Test dump boost::test_tools::output_test_stream dumpOuput; diff --git a/Tests/Core/Surfaces/SurfaceArrayTests.cpp b/Tests/Core/Surfaces/SurfaceArrayTests.cpp index b7b22b280..f99e2407f 100644 --- a/Tests/Core/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/Core/Surfaces/SurfaceArrayTests.cpp @@ -49,8 +49,12 @@ struct SurfaceArrayFixture { SurfaceArrayFixture() { BOOST_TEST_MESSAGE("setup fixture"); } ~SurfaceArrayFixture() { BOOST_TEST_MESSAGE("teardown fixture"); } - SrfVec fullPhiTestSurfacesEC(size_t n = 10, double shift = 0, - double zbase = 0, double r = 10) { + SrfVec + fullPhiTestSurfacesEC( + size_t n = 10, + double shift = 0, + double zbase = 0, + double r = 10) { SrfVec res; double phiStep = 2 * M_PI / n; @@ -76,9 +80,14 @@ struct SurfaceArrayFixture { return res; } - SrfVec fullPhiTestSurfacesBRL(int n = 10, double shift = 0, double zbase = 0, - double incl = M_PI / 9., double w = 2, - double h = 1.5) { + SrfVec + fullPhiTestSurfacesBRL( + int n = 10, + double shift = 0, + double zbase = 0, + double incl = M_PI / 9., + double w = 2, + double h = 1.5) { SrfVec res; double phiStep = 2 * M_PI / n; @@ -106,8 +115,11 @@ struct SurfaceArrayFixture { return res; } - SrfVec straightLineSurfaces( - size_t n = 10., double step = 3, const Vector3D& origin = {0, 0, 1.5}, + SrfVec + straightLineSurfaces( + size_t n = 10., + double step = 3, + const Vector3D& origin = {0, 0, 1.5}, const Transform3D& pretrans = Transform3D::Identity(), const Vector3D& dir = {0, 0, 1}) { SrfVec res; @@ -133,7 +145,8 @@ struct SurfaceArrayFixture { return res; } - SrfVec makeBarrel(int nPhi, int nZ, double w, double h) { + SrfVec + makeBarrel(int nPhi, int nZ, double w, double h) { double z0 = -(nZ - 1) * w; SrfVec res; @@ -147,7 +160,8 @@ struct SurfaceArrayFixture { return res; } - void draw_surfaces(const SrfVec& surfaces, const std::string& fname) { + void + draw_surfaces(const SrfVec& surfaces, const std::string& fname) { std::ofstream os; os.open(fname); @@ -200,13 +214,16 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { }; double R = 10; auto itransform = [angleShift, R](const Vector2D& loc) { - return Vector3D(R * std::cos(loc[0] - angleShift), - R * std::sin(loc[0] - angleShift), loc[1]); + return Vector3D( + R * std::cos(loc[0] - angleShift), + R * std::sin(loc[0] - angleShift), + loc[1]); }; auto sl = std::make_unique< SurfaceArray::SurfaceGridLookup<decltype(phiAxis), decltype(zAxis)>>( - transform, itransform, + transform, + itransform, std::make_tuple(std::move(phiAxis), std::move(zAxis))); sl->fill(tgContext, brlRaw); SurfaceArray sa(std::move(sl), brl); @@ -228,7 +245,8 @@ BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { auto sl2 = std::make_unique< SurfaceArray::SurfaceGridLookup<decltype(phiAxis), decltype(zAxis)>>( - transform, itransform, + transform, + itransform, std::make_tuple(std::move(phiAxis), std::move(zAxis))); // do NOT fill, only completebinning sl2->completeBinning(tgContext, brlRaw); diff --git a/Tests/Core/Surfaces/SurfaceBoundsTests.cpp b/Tests/Core/Surfaces/SurfaceBoundsTests.cpp index e8abbfa0d..b119264ee 100644 --- a/Tests/Core/Surfaces/SurfaceBoundsTests.cpp +++ b/Tests/Core/Surfaces/SurfaceBoundsTests.cpp @@ -35,17 +35,29 @@ class SurfaceBoundsStub : public SurfaceBounds { } ~SurfaceBoundsStub() override { /*nop*/ } - SurfaceBounds* clone() const final { return nullptr; } - BoundsType type() const final { return SurfaceBounds::Other; } - std::vector<TDD_real_t> valueStore() const override { return m_values; } - bool inside(const Vector2D& /*lpos*/, - const BoundaryCheck& /*bcheck*/) const final { + SurfaceBounds* + clone() const final { + return nullptr; + } + BoundsType + type() const final { + return SurfaceBounds::Other; + } + std::vector<TDD_real_t> + valueStore() const override { + return m_values; + } + bool + inside(const Vector2D& /*lpos*/, const BoundaryCheck& /*bcheck*/) + const final { return true; } - double distanceToBoundary(const Vector2D& /*lpos*/) const final { + double + distanceToBoundary(const Vector2D& /*lpos*/) const final { return 10.; } - std::ostream& toStream(std::ostream& sl) const final { + std::ostream& + toStream(std::ostream& sl) const final { sl << "SurfaceBoundsStub"; return sl; } @@ -67,8 +79,11 @@ BOOST_AUTO_TEST_CASE(SurfaceBoundsProperties) { SurfaceBoundsStub surface(5); std::vector<TDD_real_t> reference{0, 1, 2, 3, 4}; const auto& valueStore = surface.valueStore(); - BOOST_CHECK_EQUAL_COLLECTIONS(reference.cbegin(), reference.cend(), - valueStore.cbegin(), valueStore.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + reference.cbegin(), + reference.cend(), + valueStore.cbegin(), + valueStore.cend()); } /// Unit test for testing SurfaceBounds properties BOOST_AUTO_TEST_CASE(SurfaceBoundsEquality) { @@ -83,8 +98,10 @@ BOOST_AUTO_TEST_CASE(SurfaceBoundsEquality) { const auto& surfaceValueStore = surface.valueStore(); const auto& assignedValueStore = assignedSurface.valueStore(); BOOST_CHECK_EQUAL_COLLECTIONS( - surfaceValueStore.cbegin(), surfaceValueStore.cend(), - assignedValueStore.cbegin(), assignedValueStore.cend()); + surfaceValueStore.cbegin(), + surfaceValueStore.cend(), + assignedValueStore.cbegin(), + assignedValueStore.cend()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Surfaces/SurfaceStub.hpp b/Tests/Core/Surfaces/SurfaceStub.hpp index 9349943b2..e3ea51fac 100644 --- a/Tests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/Core/Surfaces/SurfaceStub.hpp @@ -18,8 +18,10 @@ class SurfaceStub : public Surface { public: SurfaceStub(std::shared_ptr<const Transform3D> htrans = nullptr) : GeometryObject(), Surface(htrans) {} - SurfaceStub(const GeometryContext& gctx, const SurfaceStub& sf, - const Transform3D& transf) + SurfaceStub( + const GeometryContext& gctx, + const SurfaceStub& sf, + const Transform3D& transf) : GeometryObject(), Surface(gctx, sf, transf) {} SurfaceStub(const DetectorElementBase& detelement) : GeometryObject(), Surface(detelement) {} @@ -28,85 +30,111 @@ class SurfaceStub : public Surface { } /// Implicit constructor - Surface* clone(const GeometryContext& /*gctx*/, - const Transform3D& /*shift = nullptr*/) const { + Surface* + clone(const GeometryContext& /*gctx*/, const Transform3D& /*shift = nullptr*/) + const { return nullptr; } /// Return method for the Surface type to avoid dynamic casts - SurfaceType type() const final { return Surface::Other; } + SurfaceType + type() const final { + return Surface::Other; + } /// Return method for the normal vector of the surface - const Vector3D normal(const GeometryContext& gctx, - const Vector2D& /*lpos*/) const final { + const Vector3D + normal(const GeometryContext& gctx, const Vector2D& /*lpos*/) const final { return normal(gctx); } - const Vector3D normal(const GeometryContext& gctx, - const Vector3D&) const final { + const Vector3D + normal(const GeometryContext& gctx, const Vector3D&) const final { return normal(gctx); } - const Vector3D normal(const GeometryContext& /*gctx*/) const final { + const Vector3D + normal(const GeometryContext& /*gctx*/) const final { return Vector3D{0., 0., 0.}; } /// Return method for SurfaceBounds - const SurfaceBounds& bounds() const final { + const SurfaceBounds& + bounds() const final { return s_noBounds; // need to improve this for meaningful test } /// Local to global transformation - void localToGlobal(const GeometryContext& /*gctx*/, const Vector2D& /*lpos*/, - const Vector3D& /*gmom*/, Vector3D& /*gpos*/) const final { + void + localToGlobal( + const GeometryContext& /*gctx*/, + const Vector2D& /*lpos*/, + const Vector3D& /*gmom*/, + Vector3D& /*gpos*/) const final { // nop } /// Global to local transformation - bool globalToLocal(const GeometryContext& /*cxt*/, const Vector3D& /*gpos*/, - const Vector3D& /*gmom*/, Vector2D& lpos) const final { + bool + globalToLocal( + const GeometryContext& /*cxt*/, + const Vector3D& /*gpos*/, + const Vector3D& /*gmom*/, + Vector2D& lpos) const final { lpos = Vector2D{20., 20.}; return true; } /// Calculation of the path correction for incident - double pathCorrection(const GeometryContext& /*cxt*/, - const Vector3D& /*gpos*/, - const Vector3D& /*gmom*/) const final { + double + pathCorrection( + const GeometryContext& /*cxt*/, + const Vector3D& /*gpos*/, + const Vector3D& /*gmom*/) const final { return 0.0; } /// Straight line intersection schema from parameters - Intersection intersectionEstimate(const GeometryContext& /*cxt*/, - const Vector3D& /*gpos*/, - const Vector3D& /*gdir*/, - NavigationDirection /*navDir*/, - const BoundaryCheck& /*bcheck*/, - CorrFnc corrfnc = nullptr) const final { + Intersection + intersectionEstimate( + const GeometryContext& /*cxt*/, + const Vector3D& /*gpos*/, + const Vector3D& /*gdir*/, + NavigationDirection /*navDir*/, + const BoundaryCheck& /*bcheck*/, + CorrFnc corrfnc = nullptr) const final { (void)corrfnc; const Intersection is{Vector3D{1, 1, 1}, 20., true}; return is; } /// Inherited from GeometryObject base - const Vector3D binningPosition(const GeometryContext& /*txt*/, - BinningValue /*bValue*/) const final { + const Vector3D + binningPosition(const GeometryContext& /*txt*/, BinningValue /*bValue*/) + const final { const Vector3D v{0.0, 0.0, 0.0}; return v; } /// Return properly formatted class name - std::string name() const final { return std::string("SurfaceStub"); } + std::string + name() const final { + return std::string("SurfaceStub"); + } /// Simply return true to check a method can be called on a constructed object - bool constructedOk() const { return true; } + bool + constructedOk() const { + return true; + } private: /// the bounds of this surface std::shared_ptr<const PlanarBounds> m_bounds; - SurfaceStub* clone_impl(const GeometryContext& /*gctx*/, - const Transform3D& /* shift */) const override { + SurfaceStub* + clone_impl(const GeometryContext& /*gctx*/, const Transform3D& /* shift */) + const override { return nullptr; } }; diff --git a/Tests/Core/Surfaces/SurfaceTests.cpp b/Tests/Core/Surfaces/SurfaceTests.cpp index 432e39624..179167e96 100644 --- a/Tests/Core/Surfaces/SurfaceTests.cpp +++ b/Tests/Core/Surfaces/SurfaceTests.cpp @@ -38,9 +38,15 @@ class MockTrack { // nop } - Vector3D momentum() const { return m_mom; } + Vector3D + momentum() const { + return m_mom; + } - Vector3D position() const { return m_pos; } + Vector3D + position() const { + return m_pos; + } private: Vector3D m_mom; @@ -64,8 +70,8 @@ BOOST_AUTO_TEST_CASE(SurfaceConstruction) { BOOST_CHECK_EQUAL(Surface::Other, SurfaceStub(original).type()); Translation3D translation{0., 1., 2.}; Transform3D transform(translation); - BOOST_CHECK_EQUAL(Surface::Other, - SurfaceStub(tgContext, original, transform).type()); + BOOST_CHECK_EQUAL( + Surface::Other, SurfaceStub(tgContext, original, transform).type()); // need some cruft to make the next one work auto pTransform = std::make_shared<const Transform3D>(translation); std::shared_ptr<const Acts::PlanarBounds> p = @@ -113,8 +119,11 @@ BOOST_AUTO_TEST_CASE(SurfaceProperties, *utf::expected_failures(1)) { BOOST_CHECK_EQUAL(ref.position, intersectionEstimate.position); // isOnSurface BOOST_CHECK(surface.isOnSurface(tgContext, reference, mom, false)); - BOOST_CHECK(surface.isOnSurface(tgContext, reference, mom, - true)); // need to improve bounds() + BOOST_CHECK(surface.isOnSurface( + tgContext, + reference, + mom, + true)); // need to improve bounds() // referenceFrame() RotationMatrix3D unitary; unitary << 1, 0, 0, 0, 1, 0, 0, 0, 1; @@ -122,9 +131,10 @@ BOOST_AUTO_TEST_CASE(SurfaceProperties, *utf::expected_failures(1)) { tgContext, reference, mom); // need more complex case to test BOOST_CHECK_EQUAL(referenceFrame, unitary); // normal() - auto normal = surface.Surface::normal(tgContext, - reference); // needs more complex - // test + auto normal = surface.Surface::normal( + tgContext, + reference); // needs more complex + // test Vector3D zero{0., 0., 0.}; BOOST_CHECK_EQUAL(zero, normal); // pathCorrection is pure virtual @@ -133,8 +143,9 @@ BOOST_AUTO_TEST_CASE(SurfaceProperties, *utf::expected_failures(1)) { auto pNewMaterial = std::make_shared<const HomogeneousSurfaceMaterial>(newProperties); surface.assignSurfaceMaterial(pNewMaterial); - BOOST_CHECK_EQUAL(surface.surfaceMaterial(), - pNewMaterial.get()); // passes ?? + BOOST_CHECK_EQUAL( + surface.surfaceMaterial(), + pNewMaterial.get()); // passes ?? // CHECK_CLOSE_OR_SMALL(surface.transform(tgContext), *pTransform, 1e-6, 1e-9); // type() is pure virtual diff --git a/Tests/Core/Surfaces/TrapezoidBoundsTests.cpp b/Tests/Core/Surfaces/TrapezoidBoundsTests.cpp index f01248cd0..907100ede 100644 --- a/Tests/Core/Surfaces/TrapezoidBoundsTests.cpp +++ b/Tests/Core/Surfaces/TrapezoidBoundsTests.cpp @@ -34,8 +34,9 @@ BOOST_AUTO_TEST_CASE(TrapezoidBoundsConstruction) { // TrapezoidBounds defaultConstructedTrapezoidBounds; // /// Test construction with defining half lengths - BOOST_CHECK_EQUAL(TrapezoidBounds(minHalfX, maxHalfX, halfY).type(), - SurfaceBounds::Trapezoid); + BOOST_CHECK_EQUAL( + TrapezoidBounds(minHalfX, maxHalfX, halfY).type(), + SurfaceBounds::Trapezoid); /// Copy constructor TrapezoidBounds original(minHalfX, maxHalfX, halfY); TrapezoidBounds copied(original); @@ -68,27 +69,32 @@ BOOST_AUTO_TEST_CASE(TrapezoidBoundsProperties, *utf::expected_failures(3)) { Vector2D origin(0., 0.); Vector2D outside(30., 0.); Vector2D inRectangle(2., 0.5); - CHECK_CLOSE_REL(trapezoidBoundsObject.distanceToBoundary(origin), -2., - 1e-6); // makes sense - CHECK_CLOSE_REL(trapezoidBoundsObject.distanceToBoundary(outside), - std::hypot(2., 24.), - 1e-6); // ok + CHECK_CLOSE_REL( + trapezoidBoundsObject.distanceToBoundary(origin), + -2., + 1e-6); // makes sense + CHECK_CLOSE_REL( + trapezoidBoundsObject.distanceToBoundary(outside), + std::hypot(2., 24.), + 1e-6); // ok // /// Test vertices std::vector<Vector2D> expectedVertices{ {1., -2.}, {6., 2.}, {-6., 2.}, {-1., -2.}}; const auto& actualVertices = trapezoidBoundsObject.vertices(); - BOOST_CHECK_EQUAL_COLLECTIONS(actualVertices.cbegin(), actualVertices.cend(), - expectedVertices.cbegin(), - expectedVertices.cend()); + BOOST_CHECK_EQUAL_COLLECTIONS( + actualVertices.cbegin(), + actualVertices.cend(), + expectedVertices.cbegin(), + expectedVertices.cend()); /** for (auto i: trapezoidBoundsObject.vertices()){ std::cout<<i[0]<<", "<<i[1]<<std::endl; }**/ // /// Test boundingBox - BOOST_CHECK_EQUAL(trapezoidBoundsObject.boundingBox(), - RectangleBounds(6., 2.)); + BOOST_CHECK_EQUAL( + trapezoidBoundsObject.boundingBox(), RectangleBounds(6., 2.)); // // diff --git a/Tests/Core/Surfaces/TriangleBoundsTests.cpp b/Tests/Core/Surfaces/TriangleBoundsTests.cpp index e5ea38c83..923cf5db6 100644 --- a/Tests/Core/Surfaces/TriangleBoundsTests.cpp +++ b/Tests/Core/Surfaces/TriangleBoundsTests.cpp @@ -28,7 +28,8 @@ namespace Test { BOOST_AUTO_TEST_SUITE(Surfaces) /// Unit test for creating compliant/non-compliant TriangleBounds object BOOST_AUTO_TEST_CASE(TriangleBoundsConstruction) { - std::array<Vector2D, 3> vertices({{Vector2D(1., 1.), Vector2D(4., 1.), + std::array<Vector2D, 3> vertices({{Vector2D(1., 1.), + Vector2D(4., 1.), Vector2D(4., 5.)}}); // 3-4-5 triangle // test default construction // TriangleBounds defaultConstructedTriangleBounds; //deleted @@ -44,7 +45,8 @@ BOOST_AUTO_TEST_CASE(TriangleBoundsConstruction) { /// Unit tests for TriangleBounds properties BOOST_AUTO_TEST_CASE(TriangleBoundsProperties) { - std::array<Vector2D, 3> vertices({{Vector2D(1., 1.), Vector2D(4., 1.), + std::array<Vector2D, 3> vertices({{Vector2D(1., 1.), + Vector2D(4., 1.), Vector2D(4., 5.)}}); // 3-4-5 triangle /// Test clone TriangleBounds triangleBoundsObject(vertices); @@ -59,11 +61,14 @@ BOOST_AUTO_TEST_CASE(TriangleBoundsProperties) { Vector2D origin(0., 0.); Vector2D outside(30., 1.); Vector2D inTriangle(2., 1.5); - CHECK_CLOSE_REL(triangleBoundsObject.distanceToBoundary(origin), - std::sqrt(2.), - 1e-6); // makes sense - CHECK_CLOSE_REL(triangleBoundsObject.distanceToBoundary(outside), 26., - 1e-6); // ok + CHECK_CLOSE_REL( + triangleBoundsObject.distanceToBoundary(origin), + std::sqrt(2.), + 1e-6); // makes sense + CHECK_CLOSE_REL( + triangleBoundsObject.distanceToBoundary(outside), + 26., + 1e-6); // ok // /// Test vertices : fail; there are in fact 6 vertices (10.03.2017) std::array<Vector2D, 3> expectedVertices = vertices; @@ -71,12 +76,12 @@ BOOST_AUTO_TEST_CASE(TriangleBoundsProperties) { "Following two tests fail because the triangle has six vertices"); BOOST_CHECK_EQUAL(triangleBoundsObject.vertices().size(), (size_t)3); for (size_t i = 0; i < 3; i++) { - CHECK_CLOSE_REL(triangleBoundsObject.vertices().at(i), - expectedVertices.at(i), 1e-6); + CHECK_CLOSE_REL( + triangleBoundsObject.vertices().at(i), expectedVertices.at(i), 1e-6); } /// Test boundingBox NOTE: Bounding box too big - BOOST_CHECK_EQUAL(triangleBoundsObject.boundingBox(), - RectangleBounds(4., 5.)); + BOOST_CHECK_EQUAL( + triangleBoundsObject.boundingBox(), RectangleBounds(4., 5.)); // // @@ -94,7 +99,8 @@ BOOST_AUTO_TEST_CASE(TriangleBoundsProperties) { } /// Unit test for testing TriangleBounds assignment BOOST_AUTO_TEST_CASE(TriangleBoundsAssignment) { - std::array<Vector2D, 3> vertices({{Vector2D(1., 1.), Vector2D(4., 1.), + std::array<Vector2D, 3> vertices({{Vector2D(1., 1.), + Vector2D(4., 1.), Vector2D(4., 5)}}); // 3-4-5 triangle std::array<Vector2D, 3> invalid( {{Vector2D(-1, -1), Vector2D(-1, -1), Vector2D(-1, -1)}}); @@ -108,8 +114,10 @@ BOOST_AUTO_TEST_CASE(TriangleBoundsAssignment) { const auto& assignedVertices = assignedTriangleBoundsObject.vertices(); const auto& originalVertices = triangleBoundsObject.vertices(); BOOST_CHECK_EQUAL_COLLECTIONS( - assignedVertices.cbegin(), assignedVertices.cend(), - originalVertices.cbegin(), originalVertices.cend()); + assignedVertices.cbegin(), + assignedVertices.cend(), + originalVertices.cbegin(), + originalVertices.cend()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Utilities/AxesTests.cpp b/Tests/Core/Utilities/AxesTests.cpp index 0cbf1125a..72792c532 100644 --- a/Tests/Core/Utilities/AxesTests.cpp +++ b/Tests/Core/Utilities/AxesTests.cpp @@ -212,10 +212,10 @@ BOOST_AUTO_TEST_CASE(neighborhood) { BOOST_CHECK(a1.neighborHoodIndices(0, 2).collect() == bins_t({0, 1, 2})); BOOST_CHECK(a1.neighborHoodIndices(1, 2).collect() == bins_t({0, 1, 2, 3})); BOOST_CHECK(a1.neighborHoodIndices(11, 2).collect() == bins_t({9, 10, 11})); - BOOST_CHECK(a1.neighborHoodIndices(10, 2).collect() == - bins_t({8, 9, 10, 11})); - BOOST_CHECK(a1.neighborHoodIndices(5, 2).collect() == - bins_t({3, 4, 5, 6, 7})); + BOOST_CHECK( + a1.neighborHoodIndices(10, 2).collect() == bins_t({8, 9, 10, 11})); + BOOST_CHECK( + a1.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5, 6, 7})); Axis<AxisType::Variable, AxisBoundaryType::Open> a2( {0.0, 2.0, 4.0, 9.0, 10.0}); @@ -231,8 +231,8 @@ BOOST_AUTO_TEST_CASE(neighborhood) { BOOST_CHECK(a2.neighborHoodIndices(1, 2).collect() == bins_t({0, 1, 2, 3})); BOOST_CHECK(a2.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5})); BOOST_CHECK(a2.neighborHoodIndices(4, 2).collect() == bins_t({2, 3, 4, 5})); - BOOST_CHECK(a2.neighborHoodIndices(3, 2).collect() == - bins_t({1, 2, 3, 4, 5})); + BOOST_CHECK( + a2.neighborHoodIndices(3, 2).collect() == bins_t({1, 2, 3, 4, 5})); Axis<AxisType::Equidistant, AxisBoundaryType::Bound> a3(0.0, 1.0, 10u); @@ -249,8 +249,8 @@ BOOST_AUTO_TEST_CASE(neighborhood) { BOOST_CHECK(a3.neighborHoodIndices(1, 2).collect() == bins_t({1, 2, 3})); BOOST_CHECK(a3.neighborHoodIndices(11, 2).collect() == bins_t({})); BOOST_CHECK(a3.neighborHoodIndices(10, 2).collect() == bins_t({8, 9, 10})); - BOOST_CHECK(a3.neighborHoodIndices(5, 2).collect() == - bins_t({3, 4, 5, 6, 7})); + BOOST_CHECK( + a3.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5, 6, 7})); Axis<AxisType::Equidistant, AxisBoundaryType::Closed> a4(0.0, 1.0, 10u); @@ -264,13 +264,13 @@ BOOST_AUTO_TEST_CASE(neighborhood) { BOOST_CHECK(a4.neighborHoodIndices(5, {0, 1}).collect() == bins_t({5, 6})); BOOST_CHECK(a4.neighborHoodIndices(0, 2).collect() == bins_t({})); - BOOST_CHECK(a4.neighborHoodIndices(1, 2).collect() == - bins_t({9, 10, 1, 2, 3})); + BOOST_CHECK( + a4.neighborHoodIndices(1, 2).collect() == bins_t({9, 10, 1, 2, 3})); BOOST_CHECK(a4.neighborHoodIndices(11, 2).collect() == bins_t({})); - BOOST_CHECK(a4.neighborHoodIndices(10, 2).collect() == - bins_t({8, 9, 10, 1, 2})); - BOOST_CHECK(a4.neighborHoodIndices(5, 2).collect() == - bins_t({3, 4, 5, 6, 7})); + BOOST_CHECK( + a4.neighborHoodIndices(10, 2).collect() == bins_t({8, 9, 10, 1, 2})); + BOOST_CHECK( + a4.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5, 6, 7})); Axis<AxisType::Variable, AxisBoundaryType::Bound> a5( {0.0, 2.0, 4.0, 9.0, 9.5, 10.0}); @@ -287,8 +287,8 @@ BOOST_AUTO_TEST_CASE(neighborhood) { BOOST_CHECK(a5.neighborHoodIndices(1, 2).collect() == bins_t({1, 2, 3})); BOOST_CHECK(a5.neighborHoodIndices(6, 2).collect() == bins_t({})); BOOST_CHECK(a5.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5})); - BOOST_CHECK(a5.neighborHoodIndices(3, 2).collect() == - bins_t({1, 2, 3, 4, 5})); + BOOST_CHECK( + a5.neighborHoodIndices(3, 2).collect() == bins_t({1, 2, 3, 4, 5})); Axis<AxisType::Variable, AxisBoundaryType::Closed> a6( {0.0, 2.0, 4.0, 9.0, 9.5, 10.0}); @@ -302,19 +302,19 @@ BOOST_AUTO_TEST_CASE(neighborhood) { BOOST_CHECK(a6.neighborHoodIndices(2, {0, 1}).collect() == bins_t({2, 3})); BOOST_CHECK(a6.neighborHoodIndices(0, 2).collect() == bins_t({})); - BOOST_CHECK(a6.neighborHoodIndices(1, 2).collect() == - bins_t({4, 5, 1, 2, 3})); + BOOST_CHECK( + a6.neighborHoodIndices(1, 2).collect() == bins_t({4, 5, 1, 2, 3})); BOOST_CHECK(a6.neighborHoodIndices(6, 2).collect() == bins_t({})); - BOOST_CHECK(a6.neighborHoodIndices(5, 2).collect() == - bins_t({3, 4, 5, 1, 2})); - BOOST_CHECK(a6.neighborHoodIndices(3, 2).collect() == - bins_t({1, 2, 3, 4, 5})); + BOOST_CHECK( + a6.neighborHoodIndices(5, 2).collect() == bins_t({3, 4, 5, 1, 2})); + BOOST_CHECK( + a6.neighborHoodIndices(3, 2).collect() == bins_t({1, 2, 3, 4, 5})); BOOST_CHECK(a6.neighborHoodIndices(3, {0, 2}).collect() == bins_t({3, 4, 5})); - BOOST_CHECK(a6.neighborHoodIndices(1, 3).collect() == - bins_t({3, 4, 5, 1, 2})); - BOOST_CHECK(a6.neighborHoodIndices(5, 3).collect() == - bins_t({2, 3, 4, 5, 1})); + BOOST_CHECK( + a6.neighborHoodIndices(1, 3).collect() == bins_t({3, 4, 5, 1, 2})); + BOOST_CHECK( + a6.neighborHoodIndices(5, 3).collect() == bins_t({2, 3, 4, 5, 1})); } BOOST_AUTO_TEST_CASE(wrapBin) { diff --git a/Tests/Core/Utilities/BFieldMapUtilsTests.cpp b/Tests/Core/Utilities/BFieldMapUtilsTests.cpp index 2cf707f3a..94f323b0b 100644 --- a/Tests/Core/Utilities/BFieldMapUtilsTests.cpp +++ b/Tests/Core/Utilities/BFieldMapUtilsTests.cpp @@ -46,8 +46,8 @@ BOOST_AUTO_TEST_CASE(bfield_creation) { return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0)); }; // create b field mapper in rz - auto mapper_rz = Acts::fieldMapperRZ(localToGlobalBin_rz, rPos, zPos, - bField_rz, 1, 1, false); + auto mapper_rz = Acts::fieldMapperRZ( + localToGlobalBin_rz, rPos, zPos, bField_rz, 1, 1, false); // check number of bins, minima & maxima std::vector<size_t> nBins_rz = {rPos.size(), zPos.size()}; std::vector<double> minima_rz = {0., 0.}; @@ -68,13 +68,14 @@ BOOST_AUTO_TEST_CASE(bfield_creation) { auto localToGlobalBin_xyz = [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { - return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + - binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); + return ( + binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + + binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); }; // create b field mapper in xyz - auto mapper_xyz = Acts::fieldMapperXYZ(localToGlobalBin_xyz, xPos, yPos, zPos, - bField_xyz, 1, 1, false); + auto mapper_xyz = Acts::fieldMapperXYZ( + localToGlobalBin_xyz, xPos, yPos, zPos, bField_xyz, 1, 1, false); // check number of bins, minima & maxima std::vector<size_t> nBins_xyz = {xPos.size(), yPos.size(), zPos.size()}; std::vector<double> minima_xyz = {0., 0., 0.}; @@ -155,7 +156,12 @@ BOOST_AUTO_TEST_CASE(bfield_symmetry) { [](std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ) { return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0)); }, - rPos, zPos, bField_rz, 1, 1, true); + rPos, + zPos, + bField_rz, + 1, + 1, + true); // check number of bins, minima & maxima std::vector<size_t> nBins_rz = {rPos.size(), 2 * zPos.size() - 1}; @@ -179,14 +185,21 @@ BOOST_AUTO_TEST_CASE(bfield_symmetry) { // the field mapper in xyz auto mapper_xyz = Acts::fieldMapperXYZ( [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { - return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + - binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); + return ( + binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + + binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); }, - xPos, yPos, zPos, bField_xyz, 1, 1, true); + xPos, + yPos, + zPos, + bField_xyz, + 1, + 1, + true); // check number of bins, minima & maxima - std::vector<size_t> nBins_xyz = {2 * xPos.size() - 1, 2 * yPos.size() - 1, - 2 * zPos.size() - 1}; + std::vector<size_t> nBins_xyz = { + 2 * xPos.size() - 1, 2 * yPos.size() - 1, 2 * zPos.size() - 1}; std::vector<double> minima_xyz = {-2., -2., -2.}; std::vector<double> maxima_xyz = {3., 3., 3.}; BOOST_CHECK(mapper_xyz.getNBins() == nBins_xyz); @@ -239,14 +252,19 @@ BOOST_DATA_TEST_CASE( bdata::random( (bdata::seed = 0, bdata::distribution = std::uniform_real_distribution<>(-10., 10.))) ^ - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(-10., 10.))) ^ - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(-20., 20.))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(-10., 10.))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(-20., 20.))) ^ bdata::xrange(10), - x, y, z, index) { + x, + y, + z, + index) { (void)index; std::vector<double> rPos; @@ -279,7 +297,12 @@ BOOST_DATA_TEST_CASE( [](std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ) { return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0)); }, - rPos, zPos, bField_rz, 1, 1, true); + rPos, + zPos, + bField_rz, + 1, + 1, + true); // check number of bins, minima & maxima std::vector<size_t> nBins_rz = {rPos.size(), 2 * zPos.size() - 1}; @@ -301,17 +324,24 @@ BOOST_DATA_TEST_CASE( // the mapper in xyz auto mapper_xyz = Acts::fieldMapperXYZ( [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { - return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + - binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); + return ( + binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + + binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); }, - xPos, yPos, zPos, bField_xyz, 1, 1, true); + xPos, + yPos, + zPos, + bField_xyz, + 1, + 1, + true); // check number of bins, minima & maxima - std::vector<size_t> nBins_xyz = {2 * xPos.size() - 1, 2 * yPos.size() - 1, - 2 * zPos.size() - 1}; + std::vector<size_t> nBins_xyz = { + 2 * xPos.size() - 1, 2 * yPos.size() - 1, 2 * zPos.size() - 1}; std::vector<double> minima_xyz = { -((nBins - 1) * stepR), -((nBins - 1) * stepR), -((nBins - 1) * stepZ)}; - std::vector<double> maxima_xyz = {nBins * stepR, nBins * stepR, - nBins * stepZ}; + std::vector<double> maxima_xyz = { + nBins * stepR, nBins * stepR, nBins * stepZ}; BOOST_CHECK(mapper_xyz.getNBins() == nBins_xyz); // check minimum (should be first value because bin values are always // assigned to the left boundary) diff --git a/Tests/Core/Utilities/BinUtilityTests.cpp b/Tests/Core/Utilities/BinUtilityTests.cpp index 0a85cab5b..a0424818e 100644 --- a/Tests/Core/Utilities/BinUtilityTests.cpp +++ b/Tests/Core/Utilities/BinUtilityTests.cpp @@ -65,8 +65,11 @@ BOOST_AUTO_TEST_CASE(BinUtility_equidistant_binning) { std::vector<size_t> xyzRangeCheck2 = {2, 3, 4}; auto xNrange0 = xUtil_eq.neighbourRange(xyzPosition, 0); - BOOST_CHECK_EQUAL_COLLECTIONS(xNrange0.begin(), xNrange0.end(), - xRangeCheck0.begin(), xRangeCheck0.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + xNrange0.begin(), + xNrange0.end(), + xRangeCheck0.begin(), + xRangeCheck0.end()); auto xNrange1 = xUtil_eq.neighbourRange(xyzPosition, 1); BOOST_CHECK_EQUAL(xNrange1.size(), 1); @@ -77,18 +80,27 @@ BOOST_AUTO_TEST_CASE(BinUtility_equidistant_binning) { BOOST_CHECK_EQUAL(xNrange2[0], 0); auto xyNrange1 = xyUtil_eq.neighbourRange(xyzPosition, 1); - BOOST_CHECK_EQUAL_COLLECTIONS(xyNrange1.begin(), xyNrange1.end(), - xyRangeCheck1.begin(), xyRangeCheck1.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + xyNrange1.begin(), + xyNrange1.end(), + xyRangeCheck1.begin(), + xyRangeCheck1.end()); auto xyzNrange2 = xyzUtil_eq.neighbourRange(xyzPosition, 2); - BOOST_CHECK_EQUAL_COLLECTIONS(xyzNrange2.begin(), xyzNrange2.end(), - xyzRangeCheck2.begin(), xyzRangeCheck2.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + xyzNrange2.begin(), + xyzNrange2.end(), + xyzRangeCheck2.begin(), + xyzRangeCheck2.end()); // Partial range std::vector<size_t> xEdgeCheck = {0, 1}; auto xEdgeRange = xUtil_eq.neighbourRange(edgePosition, 0); - BOOST_CHECK_EQUAL_COLLECTIONS(xEdgeRange.begin(), xEdgeRange.end(), - xEdgeCheck.begin(), xEdgeCheck.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + xEdgeRange.begin(), + xEdgeRange.end(), + xEdgeCheck.begin(), + xEdgeCheck.end()); } } // namespace Test } // namespace Acts diff --git a/Tests/Core/Utilities/BinningDataTests.cpp b/Tests/Core/Utilities/BinningDataTests.cpp index 644d17f02..666d4cbeb 100644 --- a/Tests/Core/Utilities/BinningDataTests.cpp +++ b/Tests/Core/Utilities/BinningDataTests.cpp @@ -132,8 +132,8 @@ BOOST_AUTO_TEST_CASE(BinningData_BinningValue) { BOOST_CHECK_EQUAL(xData_arb_binary.value(xyPosition), 0.5); // r/phi/rphiData - CHECK_CLOSE_REL(rData_eq.value(xyzPosition), sqrt(0.5 * 0.5 + 1.5 * 1.5), - 1e-5); + CHECK_CLOSE_REL( + rData_eq.value(xyzPosition), sqrt(0.5 * 0.5 + 1.5 * 1.5), 1e-5); BOOST_CHECK_EQUAL(rData_eq.value(rphiPosition), 3.5); CHECK_SMALL(phiData_eq.value(phi0Position), 1e-6 * M_PI); @@ -274,10 +274,11 @@ BOOST_AUTO_TEST_CASE(BinningData_open_close) { BOOST_CHECK_EQUAL(xData_eq.searchGlobal(xyzPositionOutside), size_t(9)); BOOST_CHECK_EQUAL(yData_eq.searchGlobal(xyzPositionOutside), size_t(0)); BOOST_CHECK_EQUAL(zData_eq.searchGlobal(xyzPositionOutside), size_t(9)); - BOOST_CHECK_EQUAL(xData_arb.searchGlobal(xyzPositionOutside) + 1, - xData_arb.bins()); - BOOST_CHECK_EQUAL(xData_arb_binary.searchGlobal(xyzPositionOutside) + 1, - xData_arb_binary.bins()); + BOOST_CHECK_EQUAL( + xData_arb.searchGlobal(xyzPositionOutside) + 1, xData_arb.bins()); + BOOST_CHECK_EQUAL( + xData_arb_binary.searchGlobal(xyzPositionOutside) + 1, + xData_arb_binary.bins()); BOOST_CHECK_EQUAL(yData_arb.searchGlobal(xyzPositionOutside), size_t(0)); // increment an open bin @@ -337,9 +338,11 @@ BOOST_AUTO_TEST_CASE(BinningData_open_close) { BOOST_AUTO_TEST_CASE(BinningData_boundaries) { // open values std::vector<float> boundaries = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}; - BOOST_CHECK_EQUAL_COLLECTIONS(xData_eq.boundaries().begin(), - xData_eq.boundaries().end(), boundaries.begin(), - boundaries.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + xData_eq.boundaries().begin(), + xData_eq.boundaries().end(), + boundaries.begin(), + boundaries.end()); float phiStep = M_PI * 2. / 5.; std::vector<float> phiBoundaries_eq = {-M_PI, @@ -384,18 +387,19 @@ BOOST_AUTO_TEST_CASE(BinningData_bincenter) { BOOST_CHECK_EQUAL(xData_arb_binary.center(0), 0.5 * delta); // open values - std::vector<float> center = {0.5, 1.5, 2.5, 3.5, 4.5, - 5.5, 6.5, 7.5, 8.5, 9.5}; + std::vector<float> center = { + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}; for (size_t ib = 0; ib < center.size(); ++ib) { BOOST_CHECK_EQUAL(xData_eq.center(ib), center[ib]); } // running into rounding errors here float phiStep = M_PI * 2. / 5.; - std::vector<float> phiCenters_eq = { - float(-M_PI + 0.5 * phiStep), float(-M_PI + 1.5 * phiStep), - float(-M_PI + 2.5 * phiStep), float(-M_PI + 3.5 * phiStep), - float(-M_PI + 4.5 * phiStep)}; + std::vector<float> phiCenters_eq = {float(-M_PI + 0.5 * phiStep), + float(-M_PI + 1.5 * phiStep), + float(-M_PI + 2.5 * phiStep), + float(-M_PI + 3.5 * phiStep), + float(-M_PI + 4.5 * phiStep)}; for (size_t ib = 0; ib < phiCenters_eq.size(); ++ib) { CHECK_CLOSE_ABS(phiData_eq.center(ib), phiCenters_eq[ib], 1e-3); diff --git a/Tests/Core/Utilities/BoundingBoxTest.cpp b/Tests/Core/Utilities/BoundingBoxTest.cpp index 2ad22a574..57a0d2e4a 100644 --- a/Tests/Core/Utilities/BoundingBoxTest.cpp +++ b/Tests/Core/Utilities/BoundingBoxTest.cpp @@ -766,8 +766,25 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { 778, 779, 780, 788, 789, 790, 791, 799, 800, 801, 802, 811, 812, 813, 824, 879, 890, 901, 912, 923, 934, 945}}, {Frustum3({0, 0, 0}, {0, 0, 1}, M_PI / 8.), - {427, 428, 546, 547, 548, 549, 658, 659, 665, 666, 667, 668, 669, 670, - 680, 681, 780, 791, 802}}, + {427, + 428, + 546, + 547, + 548, + 549, + 658, + 659, + 665, + 666, + 667, + 668, + 669, + 670, + 680, + 681, + 780, + 791, + 802}}, {Frustum3({0, 0, 0}, {0, 0, 1}, M_PI * 3. / 4.), {8, 9, 10, 19, 20, 21, 29, 30, 31, 32, 40, 41, 42, 43, 51, 52, 53, 54, 61, 62, 63, 64, @@ -1032,7 +1049,19 @@ BOOST_AUTO_TEST_CASE(frustum_intersect) { 669, 670, 678, 679, 680, 681, 692, 769, 777, 778, 779, 780, 788, 789, 790, 791, 799, 800, 801, 802, 813, 890, 901, 912, 923, 934}}, {Frustum34({0, 0, 0}, {0, 0, 1}, M_PI / 8.), - {538, 549, 560, 659, 665, 666, 667, 668, 669, 670, 681, 780, 791, + {538, + 549, + 560, + 659, + 665, + 666, + 667, + 668, + 669, + 670, + 681, + 780, + 791, 802}}, {Frustum34({0, 0, 0}, {0, 0, 1}, M_PI * 3. / 4.), {7, 8, 9, 10, 18, 19, 20, 21, 29, 30, 31, diff --git a/Tests/Core/Utilities/GeometryIDTests.cpp b/Tests/Core/Utilities/GeometryIDTests.cpp index 563aa8bd5..c01a1e689 100644 --- a/Tests/Core/Utilities/GeometryIDTests.cpp +++ b/Tests/Core/Utilities/GeometryIDTests.cpp @@ -51,14 +51,14 @@ BOOST_AUTO_TEST_CASE(GeometryID_test) { auto mask = msr.first; auto range = msr.second; /// test range by [0, 1, 2^range-1] - std::vector<geo_id_value> range_values = {0, 1, - (geo_id_value(1) << range) - 1}; + std::vector<geo_id_value> range_values = { + 0, 1, (geo_id_value(1) << range) - 1}; for (auto& idv : range_values) { // create the geometry ID GeometryID geoID(idv, mask); // encode - decode test - BOOST_CHECK_EQUAL(idv, - (ACTS_BIT_DECODE(ACTS_BIT_ENCODE(idv, mask), mask))); + BOOST_CHECK_EQUAL( + idv, (ACTS_BIT_DECODE(ACTS_BIT_ENCODE(idv, mask), mask))); // geo id decoding BOOST_CHECK_EQUAL(idv, geoID.value(mask)); } @@ -87,8 +87,8 @@ BOOST_AUTO_TEST_CASE(FullGeometryID_test) { GeometryID compoundID_cconst(volumeID); GeometryID compoundID_assign = volumeID; - std::vector<GeometryID> compoundIDs = {compoundID_dconst, compoundID_cconst, - compoundID_assign}; + std::vector<GeometryID> compoundIDs = { + compoundID_dconst, compoundID_cconst, compoundID_assign}; /// check the validity after assigning/copying/constructing BOOST_CHECK_EQUAL(1lu, compoundID_dconst.value(GeometryID::volume_mask)); diff --git a/Tests/Core/Utilities/GridTests.cpp b/Tests/Core/Utilities/GridTests.cpp index 2b35b9008..29de37331 100644 --- a/Tests/Core/Utilities/GridTests.cpp +++ b/Tests/Core/Utilities/GridTests.cpp @@ -65,8 +65,9 @@ BOOST_AUTO_TEST_CASE(grid_test_1d_equidistant) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{4}}), 4u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{5}}), 5u); - BOOST_CHECK(g.localBinsFromGlobalBin( - g.globalBinFromPosition(Point({{2.7}}))) == indices({{3}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition(Point({{2.7}}))) == + indices({{3}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2.}}))); @@ -231,8 +232,9 @@ BOOST_AUTO_TEST_CASE(grid_test_2d_equidistant) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{5, 3}}), 28u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{5, 4}}), 29u); - BOOST_CHECK(g.localBinsFromGlobalBin(g.globalBinFromPosition( - Point({{1.2, 0.7}}))) == indices({{2, 1}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition(Point({{1.2, 0.7}}))) == + indices({{2, 1}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2., -1}}))); @@ -385,8 +387,9 @@ BOOST_AUTO_TEST_CASE(grid_test_3d_equidistant) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{3, 4, 2}}), 78u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{3, 4, 3}}), 79u); - BOOST_CHECK(g.localBinsFromGlobalBin(g.globalBinFromPosition( - Point({{1.2, 0.7, 1.4}}))) == indices({{2, 1, 2}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition( + Point({{1.2, 0.7, 1.4}}))) == indices({{2, 1, 2}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2., -1, -2}}))); @@ -415,14 +418,14 @@ BOOST_AUTO_TEST_CASE(grid_test_3d_equidistant) { CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{2, 2, 1}}), Point({{1., 1., 0.}}), 1e-6); // test some upper right-bin edges - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 1, 1}}), Point({{1., 1., 1.}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{2, 3, 2}}), Point({{2., 3., 2.}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 1, 2}}), Point({{1., 1., 2.}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{2, 2, 1}}), Point({{2., 2., 1.}}), - 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 1, 1}}), Point({{1., 1., 1.}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{2, 3, 2}}), Point({{2., 3., 2.}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 1, 2}}), Point({{1., 1., 2.}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{2, 2, 1}}), Point({{2., 2., 1.}}), 1e-6); // initialize grid for (size_t bin = 0; bin < g.size(); ++bin) { @@ -470,8 +473,9 @@ BOOST_AUTO_TEST_CASE(grid_test_1d_variable) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{2}}), 2u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{3}}), 3u); - BOOST_CHECK(g.localBinsFromGlobalBin( - g.globalBinFromPosition(Point({{0.8}}))) == indices({{1}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition(Point({{0.8}}))) == + indices({{1}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2.}}))); @@ -581,8 +585,9 @@ BOOST_AUTO_TEST_CASE(grid_test_2d_variable) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{3, 2}}), 14u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{3, 3}}), 15u); - BOOST_CHECK(g.localBinsFromGlobalBin(g.globalBinFromPosition( - Point({{3.2, 1.8}}))) == indices({{3, 2}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition(Point({{3.2, 1.8}}))) == + indices({{3, 2}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2., -1}}))); @@ -705,8 +710,9 @@ BOOST_AUTO_TEST_CASE(grid_test_3d_variable) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{1, 3, 4}}), 39u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{2, 3, 4}}), 59u); - BOOST_CHECK(g.localBinsFromGlobalBin(g.globalBinFromPosition( - Point({{1.8, 0.7, 3.2}}))) == indices({{2, 2, 3}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition( + Point({{1.8, 0.7, 3.2}}))) == indices({{2, 2, 3}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2., -1, -2}}))); @@ -732,29 +738,29 @@ BOOST_AUTO_TEST_CASE(grid_test_3d_variable) { // test some lower-left bin edges CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{1, 1, 1}}), Point({{0., 0., 0.}}), 1e-6); - CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{1, 1, 2}}), Point({{0., 0., 0.5}}), - 1e-6); + CHECK_CLOSE_ABS( + g.lowerLeftBinEdge({{1, 1, 2}}), Point({{0., 0., 0.5}}), 1e-6); CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{1, 1, 3}}), Point({{0., 0., 3.}}), 1e-6); - CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{1, 2, 1}}), Point({{0., 0.5, 0.}}), - 1e-6); - CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{1, 2, 2}}), Point({{0., 0.5, 0.5}}), - 1e-6); - CHECK_CLOSE_ABS(g.lowerLeftBinEdge({{1, 2, 3}}), Point({{0., 0.5, 3.}}), - 1e-6); + CHECK_CLOSE_ABS( + g.lowerLeftBinEdge({{1, 2, 1}}), Point({{0., 0.5, 0.}}), 1e-6); + CHECK_CLOSE_ABS( + g.lowerLeftBinEdge({{1, 2, 2}}), Point({{0., 0.5, 0.5}}), 1e-6); + CHECK_CLOSE_ABS( + g.lowerLeftBinEdge({{1, 2, 3}}), Point({{0., 0.5, 3.}}), 1e-6); // test some upper right-bin edges - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 1, 1}}), Point({{1., 0.5, 0.5}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 1, 2}}), Point({{1., 0.5, 3.}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 1, 3}}), Point({{1., 0.5, 3.3}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 2, 1}}), Point({{1., 3., 0.5}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 2, 2}}), Point({{1., 3., 3.}}), - 1e-6); - CHECK_CLOSE_ABS(g.upperRightBinEdge({{1, 2, 3}}), Point({{1., 3., 3.3}}), - 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 1, 1}}), Point({{1., 0.5, 0.5}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 1, 2}}), Point({{1., 0.5, 3.}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 1, 3}}), Point({{1., 0.5, 3.3}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 2, 1}}), Point({{1., 3., 0.5}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 2, 2}}), Point({{1., 3., 3.}}), 1e-6); + CHECK_CLOSE_ABS( + g.upperRightBinEdge({{1, 2, 3}}), Point({{1., 3., 3.3}}), 1e-6); // initialize grid for (size_t bin = 0; bin < g.size(); ++bin) { @@ -868,8 +874,9 @@ BOOST_AUTO_TEST_CASE(grid_test_2d_mixed) { BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{5, 2}}), 22u); BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{5, 3}}), 23u); - BOOST_CHECK(g.localBinsFromGlobalBin(g.globalBinFromPosition( - Point({{1.1, 1.7}}))) == indices({{5, 2}})); + BOOST_CHECK( + g.localBinsFromGlobalBin(g.globalBinFromPosition(Point({{1.1, 1.7}}))) == + indices({{5, 2}})); // inside checks BOOST_CHECK(not g.isInside(Point({{-2., -1}}))); @@ -1081,14 +1088,18 @@ BOOST_AUTO_TEST_CASE(neighborhood) { EAxisClosed d(0.0, 1.0, 10u); Grid1Closed_t g1Cl(std::make_tuple(std::move(d))); - BOOST_CHECK(g1Cl.neighborHoodIndices({{0}}, 1).collect() == - bins_t({})); // underflow, makes no sense - BOOST_CHECK(g1Cl.neighborHoodIndices({{11}}, 1).collect() == - bins_t({})); // overflow, makes no sense - BOOST_CHECK(g1Cl.neighborHoodIndices({{1}}, 1).collect() == - bins_t({10, 1, 2})); // overflow, makes no sense - BOOST_CHECK(g1Cl.neighborHoodIndices({{5}}, 1).collect() == - bins_t({4, 5, 6})); // overflow, makes no sense + BOOST_CHECK( + g1Cl.neighborHoodIndices({{0}}, 1).collect() == + bins_t({})); // underflow, makes no sense + BOOST_CHECK( + g1Cl.neighborHoodIndices({{11}}, 1).collect() == + bins_t({})); // overflow, makes no sense + BOOST_CHECK( + g1Cl.neighborHoodIndices({{1}}, 1).collect() == + bins_t({10, 1, 2})); // overflow, makes no sense + BOOST_CHECK( + g1Cl.neighborHoodIndices({{5}}, 1).collect() == + bins_t({4, 5, 6})); // overflow, makes no sense using Grid2Closed_t = Grid<double, EAxisClosed, EAxisClosed>; // typedef Grid<double, EAxisClosed, EAxisClosed, EAxisClosed> @@ -1097,32 +1108,42 @@ BOOST_AUTO_TEST_CASE(neighborhood) { EAxisClosed f(0.0, 1.0, 5u); EAxisClosed g(0.0, 1.0, 5u); Grid2Closed_t g2Cl(std::make_tuple(std::move(e), std::move(f))); - BOOST_CHECK(g2Cl.neighborHoodIndices({{3, 3}}, 1).collect() == - bins_t({16, 17, 18, 23, 24, 25, 30, 31, 32})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 1}}, 1).collect() == - bins_t({40, 36, 37, 12, 8, 9, 19, 15, 16})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 5}}, 1).collect() == - bins_t({39, 40, 36, 11, 12, 8, 18, 19, 15})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 1}}, 1).collect() == - bins_t({33, 29, 30, 40, 36, 37, 12, 8, 9})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 5}}, 1).collect() == - bins_t({32, 33, 29, 39, 40, 36, 11, 12, 8})); - - BOOST_CHECK(g2Cl.neighborHoodIndices({{3, 3}}, 2).collect() == - bins_t({8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 22, 23, 24, - 25, 26, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 1}}, 2).collect() == - bins_t({32, 33, 29, 30, 31, 39, 40, 36, 37, 38, 11, 12, 8, - 9, 10, 18, 19, 15, 16, 17, 25, 26, 22, 23, 24})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 5}}, 2).collect() == - bins_t({31, 32, 33, 29, 30, 38, 39, 40, 36, 37, 10, 11, 12, - 8, 9, 17, 18, 19, 15, 16, 24, 25, 26, 22, 23})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 1}}, 2).collect() == - bins_t({25, 26, 22, 23, 24, 32, 33, 29, 30, 31, 39, 40, 36, - 37, 38, 11, 12, 8, 9, 10, 18, 19, 15, 16, 17})); - BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 5}}, 2).collect() == - bins_t({24, 25, 26, 22, 23, 31, 32, 33, 29, 30, 38, 39, 40, - 36, 37, 10, 11, 12, 8, 9, 17, 18, 19, 15, 16})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{3, 3}}, 1).collect() == + bins_t({16, 17, 18, 23, 24, 25, 30, 31, 32})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{1, 1}}, 1).collect() == + bins_t({40, 36, 37, 12, 8, 9, 19, 15, 16})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{1, 5}}, 1).collect() == + bins_t({39, 40, 36, 11, 12, 8, 18, 19, 15})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{5, 1}}, 1).collect() == + bins_t({33, 29, 30, 40, 36, 37, 12, 8, 9})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{5, 5}}, 1).collect() == + bins_t({32, 33, 29, 39, 40, 36, 11, 12, 8})); + + BOOST_CHECK( + g2Cl.neighborHoodIndices({{3, 3}}, 2).collect() == + bins_t({8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 22, 23, 24, + 25, 26, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{1, 1}}, 2).collect() == + bins_t({32, 33, 29, 30, 31, 39, 40, 36, 37, 38, 11, 12, 8, + 9, 10, 18, 19, 15, 16, 17, 25, 26, 22, 23, 24})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{1, 5}}, 2).collect() == + bins_t({31, 32, 33, 29, 30, 38, 39, 40, 36, 37, 10, 11, 12, + 8, 9, 17, 18, 19, 15, 16, 24, 25, 26, 22, 23})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{5, 1}}, 2).collect() == + bins_t({25, 26, 22, 23, 24, 32, 33, 29, 30, 31, 39, 40, 36, + 37, 38, 11, 12, 8, 9, 10, 18, 19, 15, 16, 17})); + BOOST_CHECK( + g2Cl.neighborHoodIndices({{5, 5}}, 2).collect() == + bins_t({24, 25, 26, 22, 23, 31, 32, 33, 29, 30, 38, 39, 40, + 36, 37, 10, 11, 12, 8, 9, 17, 18, 19, 15, 16})); // @TODO 3D test would be nice, but should essentially not be a problem if // 2D works. diff --git a/Tests/Core/Utilities/HelpersTests.cpp b/Tests/Core/Utilities/HelpersTests.cpp index 3d62c7b71..654a0e9e5 100644 --- a/Tests/Core/Utilities/HelpersTests.cpp +++ b/Tests/Core/Utilities/HelpersTests.cpp @@ -21,7 +21,10 @@ namespace Test { BOOST_AUTO_TEST_SUITE(Utilities) struct MyStruct { - double phi() const { return 42; } + double + phi() const { + return 42; + } }; BOOST_AUTO_TEST_CASE(phi_helper_test) { @@ -107,8 +110,10 @@ BOOST_AUTO_TEST_CASE(toString_test_helper) { BOOST_AUTO_TEST_CASE(shared_vector_helper_test) { { std::vector<std::shared_ptr<int>> vec; - vec = {std::make_shared<int>(5), std::make_shared<int>(9), - std::make_shared<int>(26), std::make_shared<int>(18473)}; + vec = {std::make_shared<int>(5), + std::make_shared<int>(9), + std::make_shared<int>(26), + std::make_shared<int>(18473)}; std::vector<int*> unpacked = unpack_shared_vector(vec); @@ -119,15 +124,17 @@ BOOST_AUTO_TEST_CASE(shared_vector_helper_test) { vec[3].get(), }; - BOOST_CHECK_EQUAL_COLLECTIONS(unpacked.begin(), unpacked.end(), exp.begin(), - exp.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + unpacked.begin(), unpacked.end(), exp.begin(), exp.end()); } // same for const { std::vector<std::shared_ptr<const int>> vec; - vec = {std::make_shared<const int>(5), std::make_shared<const int>(9), - std::make_shared<const int>(26), std::make_shared<const int>(18473)}; + vec = {std::make_shared<const int>(5), + std::make_shared<const int>(9), + std::make_shared<const int>(26), + std::make_shared<const int>(18473)}; std::vector<const int*> unpacked = unpack_shared_vector(vec); @@ -138,8 +145,8 @@ BOOST_AUTO_TEST_CASE(shared_vector_helper_test) { vec[3].get(), }; - BOOST_CHECK_EQUAL_COLLECTIONS(unpacked.begin(), unpacked.end(), exp.begin(), - exp.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + unpacked.begin(), unpacked.end(), exp.begin(), exp.end()); } } @@ -232,7 +239,10 @@ BOOST_AUTO_TEST_CASE(position_helper_test) { template <size_t I> struct functor { - static constexpr size_t invoke() { return I * I * I; } + static constexpr size_t + invoke() { + return I * I * I; + } }; BOOST_AUTO_TEST_CASE(test_matrix_dimension_switch) { diff --git a/Tests/Core/Utilities/InterpolationTests.cpp b/Tests/Core/Utilities/InterpolationTests.cpp index a44525436..e7f219bfa 100644 --- a/Tests/Core/Utilities/InterpolationTests.cpp +++ b/Tests/Core/Utilities/InterpolationTests.cpp @@ -99,10 +99,10 @@ BOOST_AUTO_TEST_CASE(interpolation_3d) { CHECK_CLOSE_REL(interpolate(Point({{1., 3., 2.5}}), low, high, v), 50., 1e-6); CHECK_CLOSE_REL(interpolate(Point({{2., 1., 2.5}}), low, high, v), 40., 1e-6); CHECK_CLOSE_REL(interpolate(Point({{2., 3., 2.5}}), low, high, v), 60., 1e-6); - CHECK_CLOSE_REL(interpolate(Point({{1.5, 2., 2.5}}), low, high, v), 360. / 8, - 1e-6); - CHECK_CLOSE_REL(interpolate(Point({{1.3, 2.1, 1.6}}), low, high, v), 32., - 1e-6); + CHECK_CLOSE_REL( + interpolate(Point({{1.5, 2., 2.5}}), low, high, v), 360. / 8, 1e-6); + CHECK_CLOSE_REL( + interpolate(Point({{1.3, 2.1, 1.6}}), low, high, v), 32., 1e-6); } BOOST_AUTO_TEST_CASE(interpolation_mixed_point_values) { diff --git a/Tests/Core/Utilities/IntersectionTests.cpp b/Tests/Core/Utilities/IntersectionTests.cpp index 4731c32d2..8c60f3d81 100644 --- a/Tests/Core/Utilities/IntersectionTests.cpp +++ b/Tests/Core/Utilities/IntersectionTests.cpp @@ -34,22 +34,22 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { // let's sort the tsf intersection, it should give fst std::sort(tsfpIntersections.begin(), tsfpIntersections.end()); - BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength, - tsfpIntersections[0].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength, - tsfpIntersections[1].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength, - tsfpIntersections[2].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[0].pathLength, tsfpIntersections[0].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[1].pathLength, tsfpIntersections[1].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[2].pathLength, tsfpIntersections[2].pathLength); // let's sort them with greater - std::sort(tsfpIntersections.begin(), tsfpIntersections.end(), - std::greater<>()); - BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength, - tsfpIntersections[2].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength, - tsfpIntersections[1].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength, - tsfpIntersections[0].pathLength); + std::sort( + tsfpIntersections.begin(), tsfpIntersections.end(), std::greater<>()); + BOOST_CHECK_EQUAL( + fstpIntersections[0].pathLength, tsfpIntersections[2].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[1].pathLength, tsfpIntersections[1].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[2].pathLength, tsfpIntersections[0].pathLength); // now let's create one with a non-valid intersection, it should be shuffled // last @@ -58,21 +58,21 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { // shuffle the intersections std::sort(ntfspIntersections.begin(), ntfspIntersections.end()); - BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength, - ntfspIntersections[0].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength, - ntfspIntersections[1].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength, - ntfspIntersections[2].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[0].pathLength, ntfspIntersections[0].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[1].pathLength, ntfspIntersections[1].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[2].pathLength, ntfspIntersections[2].pathLength); BOOST_CHECK_EQUAL(ntfspIntersections[3].valid, false); std::sort(tfnsnpIntersections.begin(), tfnsnpIntersections.end()); - BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength, - tfnsnpIntersections[0].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength, - tfnsnpIntersections[1].pathLength); - BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength, - tfnsnpIntersections[2].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[0].pathLength, tfnsnpIntersections[0].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[1].pathLength, tfnsnpIntersections[1].pathLength); + BOOST_CHECK_EQUAL( + fstpIntersections[2].pathLength, tfnsnpIntersections[2].pathLength); BOOST_CHECK_EQUAL(tfnsnpIntersections[3].valid, false); BOOST_CHECK_EQUAL(tfnsnpIntersections[4].valid, false); @@ -86,22 +86,22 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { // this time around, sort the f-s-t-n to match the t-s-f-n std::sort(fstnIntersections.begin(), fstnIntersections.end()); - BOOST_CHECK_EQUAL(fstnIntersections[0].pathLength, - tsfnIntersections[0].pathLength); - BOOST_CHECK_EQUAL(fstnIntersections[1].pathLength, - tsfnIntersections[1].pathLength); - BOOST_CHECK_EQUAL(fstnIntersections[2].pathLength, - tsfnIntersections[2].pathLength); + BOOST_CHECK_EQUAL( + fstnIntersections[0].pathLength, tsfnIntersections[0].pathLength); + BOOST_CHECK_EQUAL( + fstnIntersections[1].pathLength, tsfnIntersections[1].pathLength); + BOOST_CHECK_EQUAL( + fstnIntersections[2].pathLength, tsfnIntersections[2].pathLength); // let's sort them with greater - std::sort(fstnIntersections.begin(), fstnIntersections.end(), - std::greater<>()); - BOOST_CHECK_EQUAL(fstnIntersections[0].pathLength, - tsfnIntersections[2].pathLength); - BOOST_CHECK_EQUAL(fstnIntersections[1].pathLength, - tsfnIntersections[1].pathLength); - BOOST_CHECK_EQUAL(fstnIntersections[2].pathLength, - tsfnIntersections[0].pathLength); + std::sort( + fstnIntersections.begin(), fstnIntersections.end(), std::greater<>()); + BOOST_CHECK_EQUAL( + fstnIntersections[0].pathLength, tsfnIntersections[2].pathLength); + BOOST_CHECK_EQUAL( + fstnIntersections[1].pathLength, tsfnIntersections[1].pathLength); + BOOST_CHECK_EQUAL( + fstnIntersections[2].pathLength, tsfnIntersections[0].pathLength); // shuffle negative and positive solutions std::vector<Intersection> pnsolutions = {tIp, sIn, sIp, fIn, tIn, fIp}; @@ -127,15 +127,15 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { std::vector<Intersection> tfsznIntersections = {tIn, fIn, sIn, zI}; std::vector<Intersection> ztfsnIntersections = {zI, tIn, fIn, sIn}; - std::sort(tfsznIntersections.begin(), tfsznIntersections.end(), - std::greater<>()); + std::sort( + tfsznIntersections.begin(), tfsznIntersections.end(), std::greater<>()); BOOST_CHECK_EQUAL(tfsznIntersections[0].pathLength, 0.); BOOST_CHECK_EQUAL(tfsznIntersections[1].pathLength, -1.); BOOST_CHECK_EQUAL(tfsznIntersections[2].pathLength, -2.); BOOST_CHECK_EQUAL(tfsznIntersections[3].pathLength, -3.); - std::sort(ztfsnIntersections.begin(), ztfsnIntersections.end(), - std::greater<>()); + std::sort( + ztfsnIntersections.begin(), ztfsnIntersections.end(), std::greater<>()); BOOST_CHECK_EQUAL(ztfsnIntersections[0].pathLength, 0.); BOOST_CHECK_EQUAL(ztfsnIntersections[1].pathLength, -1.); BOOST_CHECK_EQUAL(ztfsnIntersections[2].pathLength, -2.); @@ -144,32 +144,32 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { /// test of the object intersection class BOOST_AUTO_TEST_CASE(ObjectIntersectionTest) { - auto psf6 = Surface::makeShared<PlaneSurface>(Vector3D(6., 0., 0.), - Vector3D(1., 0., 0.)); - auto psf7 = Surface::makeShared<PlaneSurface>(Vector3D(7., 0., 0.), - Vector3D(1., 0., 0.)); - auto psf8 = Surface::makeShared<PlaneSurface>(Vector3D(8., 0., 0.), - Vector3D(1., 0., 0.)); - auto psf9 = Surface::makeShared<PlaneSurface>(Vector3D(9., 0., 0.), - Vector3D(1., 0., 0.)); - auto psf10 = Surface::makeShared<PlaneSurface>(Vector3D(10., 0., 0.), - Vector3D(1., 0., 0.)); + auto psf6 = Surface::makeShared<PlaneSurface>( + Vector3D(6., 0., 0.), Vector3D(1., 0., 0.)); + auto psf7 = Surface::makeShared<PlaneSurface>( + Vector3D(7., 0., 0.), Vector3D(1., 0., 0.)); + auto psf8 = Surface::makeShared<PlaneSurface>( + Vector3D(8., 0., 0.), Vector3D(1., 0., 0.)); + auto psf9 = Surface::makeShared<PlaneSurface>( + Vector3D(9., 0., 0.), Vector3D(1., 0., 0.)); + auto psf10 = Surface::makeShared<PlaneSurface>( + Vector3D(10., 0., 0.), Vector3D(1., 0., 0.)); using PlaneIntersection = ObjectIntersection<PlaneSurface>; - PlaneIntersection int6(Intersection(Vector3D(6., 0., 0.), 6., true), - psf6.get()); - PlaneIntersection int7(Intersection(Vector3D(7., 0., 0.), 7., true), - psf7.get()); - PlaneIntersection int8(Intersection(Vector3D(8., 0., 0.), 8., true), - psf8.get()); - PlaneIntersection int9a(Intersection(Vector3D(9., 0., 0.), 9., true), - psf9.get()); + PlaneIntersection int6( + Intersection(Vector3D(6., 0., 0.), 6., true), psf6.get()); + PlaneIntersection int7( + Intersection(Vector3D(7., 0., 0.), 7., true), psf7.get()); + PlaneIntersection int8( + Intersection(Vector3D(8., 0., 0.), 8., true), psf8.get()); + PlaneIntersection int9a( + Intersection(Vector3D(9., 0., 0.), 9., true), psf9.get()); PlaneIntersection int9b( Intersection(Vector3D(9., 1., 0.), std::sqrt(9. * 9. + 1.), true), psf9.get()); - PlaneIntersection int10(Intersection(Vector3D(10., 0., 0.), 10., true), - psf10.get()); + PlaneIntersection int10( + Intersection(Vector3D(10., 0., 0.), 10., true), psf10.get()); std::vector<PlaneIntersection> firstSet = {int6, int7, int9b, int10}; std::vector<PlaneIntersection> secondSet = {int8, int9a, int9b, int10}; @@ -179,15 +179,23 @@ BOOST_AUTO_TEST_CASE(ObjectIntersectionTest) { std::vector<PlaneIntersection> unionSetCst = {}; // This should give 6 different intersections - std::set_union(firstSet.begin(), firstSet.end(), secondSet.begin(), - secondSet.end(), std::back_inserter(unionSetStd)); + std::set_union( + firstSet.begin(), + firstSet.end(), + secondSet.begin(), + secondSet.end(), + std::back_inserter(unionSetStd)); BOOST_CHECK_EQUAL(unionSetStd.size(), 6); // This should give 5 different inteseciton attempts (for each surface 1) SameSurfaceIntersection onSameSurface; - std::set_union(firstSet.begin(), firstSet.end(), secondSet.begin(), - secondSet.end(), std::back_inserter(unionSetCst), - onSameSurface); + std::set_union( + firstSet.begin(), + firstSet.end(), + secondSet.begin(), + secondSet.end(), + std::back_inserter(unionSetCst), + onSameSurface); BOOST_CHECK_EQUAL(unionSetCst.size(), 5); } diff --git a/Tests/Core/Utilities/LoggerTests.cpp b/Tests/Core/Utilities/LoggerTests.cpp index dc97dbcc8..e8747a2dc 100644 --- a/Tests/Core/Utilities/LoggerTests.cpp +++ b/Tests/Core/Utilities/LoggerTests.cpp @@ -22,9 +22,11 @@ using namespace Acts::Logging; /// @cond namespace detail { -std::unique_ptr<const Logger> create_logger(const std::string& logger_name, - std::ostream* logfile, - Logging::Level lvl) { +std::unique_ptr<const Logger> +create_logger( + const std::string& logger_name, + std::ostream* logfile, + Logging::Level lvl) { auto output = std::make_unique<LevelOutputDecorator>( std::make_unique<NamedOutputDecorator>( std::make_unique<DefaultPrintPolicy>(logfile), logger_name)); @@ -32,7 +34,8 @@ std::unique_ptr<const Logger> create_logger(const std::string& logger_name, return std::make_unique<const Logger>(std::move(output), std::move(print)); } -std::string failure_msg(const std::string& expected, const std::string& found) { +std::string +failure_msg(const std::string& expected, const std::string& found) { return std::string("'") + expected + "' != '" + found + "'"; } } // namespace detail diff --git a/Tests/Core/Utilities/MPLTests.cpp b/Tests/Core/Utilities/MPLTests.cpp index 735193066..2080ec223 100644 --- a/Tests/Core/Utilities/MPLTests.cpp +++ b/Tests/Core/Utilities/MPLTests.cpp @@ -38,12 +38,13 @@ namespace Test { BOOST_AUTO_TEST_CASE(all_of_test) { using detail::all_of_v; - static_assert(not all_of_v<true, true, false>, - "all_of_v<true, true, false> failed"); - static_assert(not all_of_v<false, true, true, false>, - "all_of_v<false, true, true, false> failed"); - static_assert(all_of_v<true, true, true>, - "all_of_v<true, true, true> failed"); + static_assert( + not all_of_v<true, true, false>, "all_of_v<true, true, false> failed"); + static_assert( + not all_of_v<false, true, true, false>, + "all_of_v<false, true, true, false> failed"); + static_assert( + all_of_v<true, true, true>, "all_of_v<true, true, true> failed"); static_assert(all_of_v<true>, "all_of_v<true> failed"); static_assert(not all_of_v<false>, "all_of_v<false> failed"); static_assert(all_of_v<>, "all_of_v<> failed"); @@ -51,26 +52,37 @@ BOOST_AUTO_TEST_CASE(all_of_test) { BOOST_AUTO_TEST_CASE(hana_set_union_test) { // using first = typename bm::set<float, int, char, bool>::type; - constexpr auto first = hana::make_set(hana::type_c<float>, hana::type_c<int>, - hana::type_c<char>, hana::type_c<bool>); + constexpr auto first = hana::make_set( + hana::type_c<float>, + hana::type_c<int>, + hana::type_c<char>, + hana::type_c<bool>); // using second = typename bm::vector<long, int>::type; constexpr auto second = hana::make_set(hana::type_c<long>, hana::type_c<int>); constexpr auto found = hana::union_(first, second); // using found = typename detail::boost_set_merger_t<first, second>; // using expected = typename bm::set<float, int, char, bool, long>::type; - constexpr auto expected = - hana::make_set(hana::type_c<float>, hana::type_c<int>, hana::type_c<char>, - hana::type_c<bool>, hana::type_c<long>); + constexpr auto expected = hana::make_set( + hana::type_c<float>, + hana::type_c<int>, + hana::type_c<char>, + hana::type_c<bool>, + hana::type_c<long>); static_assert(found == expected, "union of hana::sets failed"); } BOOST_AUTO_TEST_CASE(hana_set_to_tuple_test) { - constexpr auto a_set = hana::make_set(hana::type_c<float>, hana::type_c<int>, - hana::type_c<char>, hana::type_c<bool>); - constexpr auto h_tuple = - hana::make_tuple(hana::type_c<float>, hana::type_c<int>, - hana::type_c<char>, hana::type_c<bool>); + constexpr auto a_set = hana::make_set( + hana::type_c<float>, + hana::type_c<int>, + hana::type_c<char>, + hana::type_c<bool>); + constexpr auto h_tuple = hana::make_tuple( + hana::type_c<float>, + hana::type_c<int>, + hana::type_c<char>, + hana::type_c<bool>); static_assert(hana::to<hana::tuple_tag>(a_set) == h_tuple, "not equal"); @@ -94,8 +106,9 @@ BOOST_AUTO_TEST_CASE(unpack_boost_set_as_template_test) { using expected = variadic_struct<float, int, char>; - static_assert(std::is_same<found, expected>::value, - "using boost::mpl::set for variadic templates failed"); + static_assert( + std::is_same<found, expected>::value, + "using boost::mpl::set for variadic templates failed"); static_assert( std::is_same<expected::tuple, std::tuple<float, int, char>>::value, @@ -131,24 +144,26 @@ struct tuple_helper { BOOST_AUTO_TEST_CASE(type_collector_test) { // test some predicates static_assert(detail::has_result_type_v<traits1>, "Did not find result type"); - static_assert(detail::has_result_type_v<traits2<false>>, - "Did not find result type"); - static_assert(not detail::has_result_type_v<traits2<true>>, - "Did find result type"); + static_assert( + detail::has_result_type_v<traits2<false>>, "Did not find result type"); + static_assert( + not detail::has_result_type_v<traits2<true>>, "Did find result type"); static_assert(detail::has_action_type_v<traits1>, "Did not find action type"); - static_assert(detail::has_action_type_v<traits2<false>>, - "Did not find action type"); - static_assert(detail::has_action_type_v<traits2<true>>, - "Did not find action type"); - - constexpr auto found_results = - detail::type_collector_t<detail::result_type_extractor, traits1, - traits2<true>, traits2<false>>; + static_assert( + detail::has_action_type_v<traits2<false>>, "Did not find action type"); + static_assert( + detail::has_action_type_v<traits2<true>>, "Did not find action type"); + + constexpr auto found_results = detail::type_collector_t< + detail::result_type_extractor, + traits1, + traits2<true>, + traits2<false>>; constexpr auto expected_results = hana::make_set(hana::type_c<int>, hana::type_c<bool>); - static_assert(found_results == expected_results, - "Didn't find expected results"); + static_assert( + found_results == expected_results, "Didn't find expected results"); // check unpack using found_results_tuple = decltype( @@ -158,13 +173,15 @@ BOOST_AUTO_TEST_CASE(type_collector_test) { std::is_same<found_results_tuple, expected_results_tuple>::value, "Unpacked results tuple not correct"); - constexpr auto found_actions = - detail::type_collector_t<detail::action_type_extractor, traits1, - traits2<true>, traits2<false>>; + constexpr auto found_actions = detail::type_collector_t< + detail::action_type_extractor, + traits1, + traits2<true>, + traits2<false>>; constexpr auto expected_actions = hana::make_set(hana::type_c<char>, hana::type_c<float>); - static_assert(found_actions == expected_actions, - "Didn't find expected actions"); + static_assert( + found_actions == expected_actions, "Didn't find expected actions"); // check unpack using found_actions_tuple = decltype( @@ -177,27 +194,28 @@ BOOST_AUTO_TEST_CASE(type_collector_test) { BOOST_AUTO_TEST_CASE(has_duplicates_test) { using detail::has_duplicates_v; - static_assert(has_duplicates_v<int, float, char, int>, - "has_duplicates_v failed"); - static_assert(has_duplicates_v<int, int, char, float>, - "has_duplicates_v failed"); - static_assert(has_duplicates_v<int, char, float, float>, - "has_duplicates_v failed"); - static_assert(has_duplicates_v<int, char, char, float>, - "has_duplicates_v failed"); - static_assert(not has_duplicates_v<int, bool, char, float>, - "has_duplicates_v failed"); + static_assert( + has_duplicates_v<int, float, char, int>, "has_duplicates_v failed"); + static_assert( + has_duplicates_v<int, int, char, float>, "has_duplicates_v failed"); + static_assert( + has_duplicates_v<int, char, float, float>, "has_duplicates_v failed"); + static_assert( + has_duplicates_v<int, char, char, float>, "has_duplicates_v failed"); + static_assert( + not has_duplicates_v<int, bool, char, float>, "has_duplicates_v failed"); } BOOST_AUTO_TEST_CASE(any_of_test) { using detail::any_of_v; - static_assert(any_of_v<true, true, false>, - "any_of_v<true, true, false> failed"); - static_assert(any_of_v<false, true, true, false>, - "any_of_v<false, true, true, false> failed"); - static_assert(any_of_v<true, true, true>, - "any_of_v<true, true, true> failed"); + static_assert( + any_of_v<true, true, false>, "any_of_v<true, true, false> failed"); + static_assert( + any_of_v<false, true, true, false>, + "any_of_v<false, true, true, false> failed"); + static_assert( + any_of_v<true, true, true>, "any_of_v<true, true, true> failed"); static_assert(not any_of_v<false, false>, "any_of_v<false, false> failed"); static_assert(any_of_v<true>, "any_of_v<true> failed"); static_assert(not any_of_v<false>, "any_of_v<false> failed"); diff --git a/Tests/Core/Utilities/MaterialMapUtilsTests.cpp b/Tests/Core/Utilities/MaterialMapUtilsTests.cpp index f673ab9ae..d38671412 100644 --- a/Tests/Core/Utilities/MaterialMapUtilsTests.cpp +++ b/Tests/Core/Utilities/MaterialMapUtilsTests.cpp @@ -78,8 +78,9 @@ BOOST_AUTO_TEST_CASE(materialmap_creation) { auto localToGlobalBin_xyz = [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { - return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + - binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); + return ( + binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + + binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); }; // Create material mapper in xyz @@ -114,12 +115,12 @@ BOOST_AUTO_TEST_CASE(materialmap_creation) { // Check the value // in rz case material is phi symmetric (check radius) - CHECK_CLOSE_ABS(value0_rz.classificationNumbers(), - mat0_rz.classificationNumbers(), 1e-9); - CHECK_CLOSE_ABS(value1_rz.classificationNumbers(), - mat1_rz.classificationNumbers(), 1e-9); - CHECK_CLOSE_ABS(value2_rz.classificationNumbers(), - mat2_rz.classificationNumbers(), 1e-9); + CHECK_CLOSE_ABS( + value0_rz.classificationNumbers(), mat0_rz.classificationNumbers(), 1e-9); + CHECK_CLOSE_ABS( + value1_rz.classificationNumbers(), mat1_rz.classificationNumbers(), 1e-9); + CHECK_CLOSE_ABS( + value2_rz.classificationNumbers(), mat2_rz.classificationNumbers(), 1e-9); // Check if filled value is expected value in xyz Vector3D pos0_xyz(0., 0., 0.); @@ -138,12 +139,18 @@ BOOST_AUTO_TEST_CASE(materialmap_creation) { // Check the value // in xyz case material is phi symmetric (check radius) - CHECK_CLOSE_ABS(value0_xyz.classificationNumbers(), - mat0_xyz.classificationNumbers(), 1e-9); - CHECK_CLOSE_ABS(value1_xyz.classificationNumbers(), - mat1_xyz.classificationNumbers(), 1e-9); - CHECK_CLOSE_ABS(value2_xyz.classificationNumbers(), - mat2_xyz.classificationNumbers(), 1e-9); + CHECK_CLOSE_ABS( + value0_xyz.classificationNumbers(), + mat0_xyz.classificationNumbers(), + 1e-9); + CHECK_CLOSE_ABS( + value1_xyz.classificationNumbers(), + mat1_xyz.classificationNumbers(), + 1e-9); + CHECK_CLOSE_ABS( + value2_xyz.classificationNumbers(), + mat2_xyz.classificationNumbers(), + 1e-9); } } // namespace Test } // namespace Acts \ No newline at end of file diff --git a/Tests/Core/Utilities/ResultTests.cpp b/Tests/Core/Utilities/ResultTests.cpp index d0dbad3bd..404a5cde2 100644 --- a/Tests/Core/Utilities/ResultTests.cpp +++ b/Tests/Core/Utilities/ResultTests.cpp @@ -23,7 +23,8 @@ using namespace std::string_literals; namespace { enum class MyError { Failure = 1, SomethingElse = 2 }; -std::error_code make_error_code(MyError e) { +std::error_code +make_error_code(MyError e) { return {static_cast<int>(e), std::generic_category()}; } } // namespace @@ -180,7 +181,8 @@ struct NoCopy { int num; }; -Result<NoCopy> make_nocopy(int i, bool v = true) { +Result<NoCopy> +make_nocopy(int i, bool v = true) { if (!v) { return MyError::Failure; } @@ -216,7 +218,8 @@ BOOST_AUTO_TEST_CASE(CopyBehaviour) { BOOST_CHECK_EQUAL(n4.num, 8); } -Result<void> void_res_func(int b) { +Result<void> +void_res_func(int b) { (void)b; if (b > 5) { return MyError::SomethingElse; diff --git a/Tests/Core/Utilities/TypeTraitsTest.cpp b/Tests/Core/Utilities/TypeTraitsTest.cpp index 635b42c46..4b4e13248 100644 --- a/Tests/Core/Utilities/TypeTraitsTest.cpp +++ b/Tests/Core/Utilities/TypeTraitsTest.cpp @@ -30,15 +30,24 @@ METHOD_TRAIT(foo_method_t, foo); METHOD_TRAIT(bar_method_t, bar); struct E { - int bar(const double&) { return 5; } + int + bar(const double&) { + return 5; + } }; struct E2 { - int bar(const double&) const { return 5; } + int + bar(const double&) const { + return 5; + } }; class E3 { - int bar(const double&) { return 5; } + int + bar(const double&) { + return 5; + } }; BOOST_AUTO_TEST_CASE(TypeTraitsMethods) { @@ -57,8 +66,8 @@ BOOST_AUTO_TEST_CASE(TypeTraitsMethods) { // E does not have method const method with correct signature otherwise // This test ensures a non-const method does not qualify for a // check for a method on the const type - static_assert(!has_method<const E, int, bar_method_t, const double&>, - "failed"); + static_assert( + !has_method<const E, int, bar_method_t, const double&>, "failed"); // E does not have a foo method static_assert(!has_method<E, int, foo_method_t, const double&>, "failed"); @@ -69,8 +78,8 @@ BOOST_AUTO_TEST_CASE(TypeTraitsMethods) { // requirement static_assert(!has_method<E2, int, bar_method_t, const double&>, "failed"); // E2 has method of signature int bar(const double&) const - static_assert(has_method<const E2, int, bar_method_t, const double&>, - "failed"); + static_assert( + has_method<const E2, int, bar_method_t, const double&>, "failed"); // E2 does not have method taking non-ref const double static_assert(!has_method<E2, int, bar_method_t, const double>, "failed"); // E2 does not have method taking non-const ref double @@ -78,11 +87,11 @@ BOOST_AUTO_TEST_CASE(TypeTraitsMethods) { // E2 does not have method taking plain double static_assert(!has_method<E2, int, bar_method_t, double>, "failed"); // E2 does not have method with char return type - static_assert(!has_method<const E2, char, bar_method_t, const double&>, - "failed"); + static_assert( + !has_method<const E2, char, bar_method_t, const double&>, "failed"); // E2 does not have foo method - static_assert(!has_method<const E2, int, foo_method_t, const double&>, - "failed"); + static_assert( + !has_method<const E2, int, foo_method_t, const double&>, "failed"); // E3 does have a method like int bar(const double&) but is private static_assert(!has_method<E3, int, bar_method_t, const double&>, "failed"); @@ -181,11 +190,12 @@ using meta_t = typename T::template meta<void, void>; // combine it into a concept template <typename T> -constexpr bool SomeConcept = - require<has_method<T, double, foo_method_t, double, int>, - has_method<const T, bool, bar_method_t, double&&>, - has_member<T, member_t, bool>, exists<nested_t, T>, - exists<meta_t, T>>; +constexpr bool SomeConcept = require< + has_method<T, double, foo_method_t, double, int>, + has_method<const T, bool, bar_method_t, double&&>, + has_member<T, member_t, bool>, + exists<nested_t, T>, + exists<meta_t, T>>; struct A { bool member; @@ -195,9 +205,15 @@ struct A { template <typename U, typename V> struct meta {}; - double foo(double, int) { return 5; } + double + foo(double, int) { + return 5; + } - bool bar(double&&) const { return true; } + bool + bar(double&&) const { + return true; + } }; struct A2 { @@ -208,23 +224,38 @@ struct A2 { template <typename U> struct meta {}; - double foo(double, int) { return 5; } + double + foo(double, int) { + return 5; + } - bool bar(double&&) const { return true; } + bool + bar(double&&) const { + return true; + } }; struct B { bool different; - int foo(double) { return 5; } + int + foo(double) { + return 5; + } }; struct C { - double foo(int) { return 5; } + double + foo(int) { + return 5; + } }; struct D { - double bar(double) { return 5; } + double + bar(double) { + return 5; + } }; BOOST_AUTO_TEST_CASE(TypeTraitsConcepts) { diff --git a/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp b/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp index 59e491465..bb7adcc04 100644 --- a/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp +++ b/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp @@ -39,7 +39,8 @@ GeometryContext tgContext = GeometryContext(); MagneticFieldContext mfContext = MagneticFieldContext(); template <typename InputTrack_t, typename Propagator_t> -Vertex<InputTrack_t> myFitWrapper( +Vertex<InputTrack_t> +myFitWrapper( IVertexFitter<InputTrack_t, Propagator_t>* fitter, std::vector<InputTrack_t>& tracks, VertexFitterOptions<InputTrack_t> vfOptions) { @@ -59,11 +60,15 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_empty_input_test) { Propagator<EigenStepper<ConstantBField>> propagator(stepper); // Set up Billoir Vertex Fitter - FullBilloirVertexFitter<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>>::Config + FullBilloirVertexFitter< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>>::Config vertexFitterCfg(bField, propagator); - FullBilloirVertexFitter<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>> + FullBilloirVertexFitter< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>> billoirFitter(vertexFitterCfg); // Constraint for vertex fit @@ -79,8 +84,8 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_empty_input_test) { std::vector<BoundParameters> emptyVector; - VertexFitterOptions<BoundParameters> vfOptions(tgContext, mfContext, - myConstraint); + VertexFitterOptions<BoundParameters> vfOptions( + tgContext, mfContext, myConstraint); Vertex<BoundParameters> fittedVertex = billoirFitter.fit(emptyVector, vfOptions).value(); @@ -146,11 +151,15 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { unsigned int nTracks = nTracksDist(gen); // Set up Billoir Vertex Fitter - FullBilloirVertexFitter<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>>::Config + FullBilloirVertexFitter< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>>::Config vertexFitterCfg(bField, propagator); - FullBilloirVertexFitter<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>> + FullBilloirVertexFitter< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>> billoirFitter(vertexFitterCfg); // Constraint for vertex fit Vertex<BoundParameters> myConstraint; @@ -164,8 +173,8 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { myConstraint.setFullPosition(SpacePointVector(0, 0, 0, 0)); VertexFitterOptions<BoundParameters> vfOptions(tgContext, mfContext); - VertexFitterOptions<BoundParameters> vfOptionsConstr(tgContext, mfContext, - myConstraint); + VertexFitterOptions<BoundParameters> vfOptionsConstr( + tgContext, mfContext, myConstraint); // Create position of vertex and perigee surface double x = vXYDist(gen); double y = vXYDist(gen); @@ -204,8 +213,8 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { (*covMat) << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, - perigeeSurface)); + tracks.push_back(BoundParameters( + tgContext, std::move(covMat), paramVec, perigeeSurface)); } // Do the actual fit with 4 tracks without constraint Vertex<BoundParameters> fittedVertex = @@ -240,7 +249,10 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { struct InputTrack { InputTrack(const BoundParameters& params) : m_parameters(params) {} - const BoundParameters& parameters() const { return m_parameters; } + const BoundParameters& + parameters() const { + return m_parameters; + } // store e.g. link to original objects here @@ -279,11 +291,15 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_usertrack_test) { [](InputTrack params) { return params.parameters(); }; // Set up Billoir Vertex Fitter - FullBilloirVertexFitter<ConstantBField, InputTrack, - Propagator<EigenStepper<ConstantBField>>>::Config + FullBilloirVertexFitter< + ConstantBField, + InputTrack, + Propagator<EigenStepper<ConstantBField>>>::Config vertexFitterCfg(bField, propagator); - FullBilloirVertexFitter<ConstantBField, InputTrack, - Propagator<EigenStepper<ConstantBField>>> + FullBilloirVertexFitter< + ConstantBField, + InputTrack, + Propagator<EigenStepper<ConstantBField>>> billoirFitter(vertexFitterCfg, extractParameters); // Constraint for vertex fit @@ -299,8 +315,8 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_usertrack_test) { VertexFitterOptions<InputTrack> vfOptions(tgContext, mfContext); - VertexFitterOptions<InputTrack> vfOptionsConstr(tgContext, mfContext, - myConstraint); + VertexFitterOptions<InputTrack> vfOptionsConstr( + tgContext, mfContext, myConstraint); // Create position of vertex and perigee surface double x = vXYDist(gen); @@ -342,8 +358,8 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_usertrack_test) { (*covMat) << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(InputTrack(BoundParameters(tgContext, std::move(covMat), - paramVec, perigeeSurface))); + tracks.push_back(InputTrack(BoundParameters( + tgContext, std::move(covMat), paramVec, perigeeSurface))); } // Do the actual fit with 4 tracks without constraint diff --git a/Tests/Core/Vertexing/IterativeVertexFinderTests.cpp b/Tests/Core/Vertexing/IterativeVertexFinderTests.cpp index ca1c724e3..66fecccbb 100644 --- a/Tests/Core/Vertexing/IterativeVertexFinderTests.cpp +++ b/Tests/Core/Vertexing/IterativeVertexFinderTests.cpp @@ -90,8 +90,10 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { // Set up propagator with void navigator Propagator<EigenStepper<ConstantBField>> propagator(stepper); - typedef FullBilloirVertexFitter<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>> + typedef FullBilloirVertexFitter< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>> BilloirFitter; // Set up Billoir Vertex Fitter @@ -102,8 +104,10 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { = std::make_unique<BilloirFitter>(vertexFitterCfg); // Vertex Finder - typedef IterativeVertexFinder<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>> + typedef IterativeVertexFinder< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>> VertexFinder; VertexFinder::Config cfg(bField, std::move(bFitterPtr), propagator); cfg.reassignTracksAfterFirstFit = true; @@ -170,8 +174,8 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { 0., 0., 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0., res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0., 0., 0., 0., 0., 1.; - auto params = BoundParameters(tgContext, std::move(covMat), paramVec, - perigeeSurface); + auto params = BoundParameters( + tgContext, std::move(covMat), paramVec, perigeeSurface); tracks.push_back(params); TrackAtVertex<BoundParameters> trAtVt(0., params, params); diff --git a/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp b/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp index c37265ede..895e33c9a 100644 --- a/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp +++ b/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp @@ -119,15 +119,16 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_test) { (*covMat) << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, - perigeeSurface)); + tracks.push_back(BoundParameters( + tgContext, std::move(covMat), paramVec, perigeeSurface)); } - LinearizedTrackFactory<ConstantBField, - Propagator<EigenStepper<ConstantBField>>>::Config - ltConfig(bField); - LinearizedTrackFactory<ConstantBField, - Propagator<EigenStepper<ConstantBField>>> + LinearizedTrackFactory< + ConstantBField, + Propagator<EigenStepper<ConstantBField>>>::Config ltConfig(bField); + LinearizedTrackFactory< + ConstantBField, + Propagator<EigenStepper<ConstantBField>>> linFactory(ltConfig); BoundVector vecBoundZero = BoundVector::Zero(); @@ -138,11 +139,14 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_test) { ActsMatrixD<BoundParsDim, 3>::Zero(); for (const BoundParameters& parameters : tracks) { - LinearizedTrack linTrack = - linFactory - .linearizeTrack(tgContext, mfContext, ¶meters, - SpacePointVector::Zero(), propagator) - .value(); + LinearizedTrack linTrack = linFactory + .linearizeTrack( + tgContext, + mfContext, + ¶meters, + SpacePointVector::Zero(), + propagator) + .value(); BOOST_CHECK_NE(linTrack.parametersAtPCA, vecBoundZero); BOOST_CHECK_NE(linTrack.covarianceAtPCA, matBoundZero); @@ -162,11 +166,12 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_empty_test) { // Set up propagator with void navigator Propagator<EigenStepper<ConstantBField>> propagator(stepper); - LinearizedTrackFactory<ConstantBField, - Propagator<EigenStepper<ConstantBField>>>::Config - ltConfig(bField); - LinearizedTrackFactory<ConstantBField, - Propagator<EigenStepper<ConstantBField>>> + LinearizedTrackFactory< + ConstantBField, + Propagator<EigenStepper<ConstantBField>>>::Config ltConfig(bField); + LinearizedTrackFactory< + ConstantBField, + Propagator<EigenStepper<ConstantBField>>> linFactory(ltConfig); BoundVector vecBoundZero = BoundVector::Zero(); @@ -176,11 +181,14 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_empty_test) { ActsMatrixD<BoundParsDim, 3> matBound2MomZero = ActsMatrixD<BoundParsDim, 3>::Zero(); - LinearizedTrack linTrack = - linFactory - .linearizeTrack(tgContext, mfContext, nullptr, - SpacePointVector(1., 2., 3., 4.), propagator) - .value(); + LinearizedTrack linTrack = linFactory + .linearizeTrack( + tgContext, + mfContext, + nullptr, + SpacePointVector(1., 2., 3., 4.), + propagator) + .value(); BOOST_CHECK_EQUAL(linTrack.parametersAtPCA, vecBoundZero); BOOST_CHECK_EQUAL(linTrack.covarianceAtPCA, matBoundZero); diff --git a/Tests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp b/Tests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp index e56fe49c3..110bbc414 100644 --- a/Tests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp +++ b/Tests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp @@ -110,8 +110,9 @@ BOOST_AUTO_TEST_CASE(track_to_vertex_ip_estimator_test) { double z0_v = z; // Create TrackToVertexIPEstimator - TrackToVertexIPEstimator<BoundParameters, - Propagator<EigenStepper<ConstantBField>>> + TrackToVertexIPEstimator< + BoundParameters, + Propagator<EigenStepper<ConstantBField>>> ipEst; // Construct random track emerging from vicinity of vertex position diff --git a/Tests/Core/Vertexing/ZScanVertexFinderTests.cpp b/Tests/Core/Vertexing/ZScanVertexFinderTests.cpp index 0494bfbb4..8d51a878d 100644 --- a/Tests/Core/Vertexing/ZScanVertexFinderTests.cpp +++ b/Tests/Core/Vertexing/ZScanVertexFinderTests.cpp @@ -127,16 +127,19 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { (*covMat) << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, - perigeeSurface)); + tracks.push_back(BoundParameters( + tgContext, std::move(covMat), paramVec, perigeeSurface)); } - ZScanVertexFinder<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>>::Config - cfg(propagator); + ZScanVertexFinder< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>>::Config cfg(propagator); - ZScanVertexFinder<ConstantBField, BoundParameters, - Propagator<EigenStepper<ConstantBField>>> + ZScanVertexFinder< + ConstantBField, + BoundParameters, + Propagator<EigenStepper<ConstantBField>>> finder(std::move(cfg)); VertexFinderOptions<BoundParameters> vFinderOptions(tgContext, mfContext); @@ -157,7 +160,10 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { struct InputTrack { InputTrack(const BoundParameters& params) : m_parameters(params) {} - const BoundParameters& parameters() const { return m_parameters; } + const BoundParameters& + parameters() const { + return m_parameters; + } // store e.g. link to original objects here @@ -229,21 +235,24 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { (*covMat) << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(InputTrack(BoundParameters(tgContext, std::move(covMat), - paramVec, perigeeSurface))); + tracks.push_back(InputTrack(BoundParameters( + tgContext, std::move(covMat), paramVec, perigeeSurface))); } - ZScanVertexFinder<ConstantBField, InputTrack, - Propagator<EigenStepper<ConstantBField>>>::Config - cfg(propagator); + ZScanVertexFinder< + ConstantBField, + InputTrack, + Propagator<EigenStepper<ConstantBField>>>::Config cfg(propagator); // Create a custom std::function to extract BoundParameters from // user-defined InputTrack std::function<BoundParameters(InputTrack)> extractParameters = [](InputTrack params) { return params.parameters(); }; - ZScanVertexFinder<ConstantBField, InputTrack, - Propagator<EigenStepper<ConstantBField>>> + ZScanVertexFinder< + ConstantBField, + InputTrack, + Propagator<EigenStepper<ConstantBField>>> finder(std::move(cfg), extractParameters); VertexFinderOptions<InputTrack> vFinderOptions(tgContext, mfContext); diff --git a/Tests/Examples/src/CustomDefaultLogger.cpp b/Tests/Examples/src/CustomDefaultLogger.cpp index 67b61e398..9bef98955 100644 --- a/Tests/Examples/src/CustomDefaultLogger.cpp +++ b/Tests/Examples/src/CustomDefaultLogger.cpp @@ -23,8 +23,9 @@ class MirrorOutputDecorator final : public OutputDecorator { /// /// @param [in] wrappee output print policy object to be wrapped /// @param [in] maxWidth maximum width of field used for name - MirrorOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, - unsigned int maxWidth = 180) + MirrorOutputDecorator( + std::unique_ptr<OutputPrintPolicy> wrappee, + unsigned int maxWidth = 180) : OutputDecorator(std::move(wrappee)), m_maxWidth(maxWidth) {} /// @brief flush the debug message to the destination stream @@ -33,7 +34,8 @@ class MirrorOutputDecorator final : public OutputDecorator { /// @param [in] input text of debug message /// /// This function inverts the given string and flushes it to the right. - void flush(const Level& lvl, const std::ostringstream& input) override { + void + flush(const Level& lvl, const std::ostringstream& input) override { std::ostringstream os; std::string text = input.str(); std::reverse(text.begin(), text.end()); @@ -59,9 +61,11 @@ class MirrorOutputDecorator final : public OutputDecorator { /// from right to left. /// /// @return pointer to logging instance -std::unique_ptr<const Logger> getDefaultLogger(const std::string& name, - const Logging::Level& lvl, - std::ostream* log_stream) { +std::unique_ptr<const Logger> +getDefaultLogger( + const std::string& name, + const Logging::Level& lvl, + std::ostream* log_stream) { using namespace Logging; auto output = std::make_unique<LevelOutputDecorator>( std::make_unique<NamedOutputDecorator>( diff --git a/Tests/Integration/ATLSeedingIntegrationTest.cpp b/Tests/Integration/ATLSeedingIntegrationTest.cpp index a8703bf18..ff5e7f6f9 100644 --- a/Tests/Integration/ATLSeedingIntegrationTest.cpp +++ b/Tests/Integration/ATLSeedingIntegrationTest.cpp @@ -23,17 +23,21 @@ struct SpacePoint { float covr = 0.03; float covz = 0.03; std::pair<int, int> m_clusterList = std::pair<int, int>(1, 1); - void setClusterList(int first, int second) { + void + setClusterList(int first, int second) { m_clusterList = std::pair<int, int>(first, second); } - const std::pair<int, int> clusterList() const { return m_clusterList; } + const std::pair<int, int> + clusterList() const { + return m_clusterList; + } int surface; }; // call sequence to create seeds. Seeds are copied as the // call to next() overwrites the previous seed object -std::vector<Acts::Legacy::Seed<SpacePoint>> runSeeding( - std::vector<SpacePoint*> spVec) { +std::vector<Acts::Legacy::Seed<SpacePoint>> +runSeeding(std::vector<SpacePoint*> spVec) { Acts::Legacy::AtlasSeedfinder<SpacePoint> seedMaker; seedMaker.newEvent(0, spVec.begin(), spVec.end()); seedMaker.find3Sp(); @@ -54,8 +58,10 @@ std::vector<Acts::Legacy::Seed<SpacePoint>> runSeeding( // used to sort seeds, ignores z class seedComparator { public: - bool operator()(const Acts::Legacy::Seed<SpacePoint>& s1, - const Acts::Legacy::Seed<SpacePoint>& s2) { + bool + operator()( + const Acts::Legacy::Seed<SpacePoint>& s1, + const Acts::Legacy::Seed<SpacePoint>& s2) { auto sp1It = s1.spacePoints().begin(); auto sp2It = s2.spacePoints().begin(); for (int i = 0; i < 3; i++) { @@ -146,9 +152,13 @@ BOOST_AUTO_TEST_CASE(number_of_seeds_correct_) { // difference between reference and result shows if results exactly the same // (i.e. difference is 0) std::vector<Acts::Legacy::Seed<SpacePoint>> diff; - std::set_difference(refVec.begin(), refVec.end(), seedVec.begin(), - seedVec.end(), std::inserter(diff, diff.begin()), - seedComparator()); + std::set_difference( + refVec.begin(), + refVec.end(), + seedVec.begin(), + seedVec.end(), + std::inserter(diff, diff.begin()), + seedComparator()); BOOST_CHECK(diff.empty()); for (auto sp : spVec) { delete sp; diff --git a/Tests/Integration/InterpolatedSolenoidBFieldTest.cpp b/Tests/Integration/InterpolatedSolenoidBFieldTest.cpp index 7aba5cd56..30b54e85e 100644 --- a/Tests/Integration/InterpolatedSolenoidBFieldTest.cpp +++ b/Tests/Integration/InterpolatedSolenoidBFieldTest.cpp @@ -44,7 +44,8 @@ const double bMagCenter = 2_T; const size_t nBinsR = 150; const size_t nBinsZ = 200; -auto makeFieldMap(const SolenoidBField& field) { +auto +makeFieldMap(const SolenoidBField& field) { std::ofstream ostr("solenoidmap.csv"); ostr << "i;j;r;z;B_r;B_z" << std::endl; @@ -61,9 +62,10 @@ auto makeFieldMap(const SolenoidBField& field) { auto mapper = solenoidFieldMapper({rMin, rMax}, {zMin, zMax}, {nBinsR, nBinsZ}, field); // I know this is the correct grid type - using Grid_t = - Acts::detail::Grid<Acts::Vector2D, Acts::detail::EquidistantAxis, - Acts::detail::EquidistantAxis>; + using Grid_t = Acts::detail::Grid< + Acts::Vector2D, + Acts::detail::EquidistantAxis, + Acts::detail::EquidistantAxis>; const Grid_t& grid = mapper.getGrid(); using index_t = Grid_t::index_t; using point_t = Grid_t::point_t; @@ -104,17 +106,26 @@ StreamWrapper valid(std::ofstream("magfield_lookup.csv")); const int ntests = 10000; BOOST_DATA_TEST_CASE( solenoid_interpolated_bfield_comparison, - bdata::random((bdata::seed = 1, bdata::engine = std::mt19937(), - bdata::distribution = std::uniform_real_distribution<>( - 1.5 * (-L / 2.), 1.5 * L / 2.))) ^ - bdata::random((bdata::seed = 2, bdata::engine = std::mt19937(), - bdata::distribution = - std::uniform_real_distribution<>(0, R * 1.5))) ^ - bdata::random((bdata::seed = 3, bdata::engine = std::mt19937(), - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 1, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(1.5 * (-L / 2.), 1.5 * L / 2.))) ^ + bdata::random( + (bdata::seed = 2, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(0, R * 1.5))) ^ + bdata::random( + (bdata::seed = 3, + bdata::engine = std::mt19937(), + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ bdata::xrange(ntests), - z, r, phi, index) { + z, + r, + phi, + index) { (void)index; if (index % 1000 == 0) { std::cout << index << std::endl; diff --git a/Tests/Integration/PropagationTestBase.hpp b/Tests/Integration/PropagationTestBase.hpp index 7a58b7e1e..03f8a14bb 100644 --- a/Tests/Integration/PropagationTestBase.hpp +++ b/Tests/Integration/PropagationTestBase.hpp @@ -47,117 +47,262 @@ auto threeRandom = (rand1 ^ rand2 ^ rand2); } // namespace ds /// test consistency of forward-backward propagation -BOOST_DATA_TEST_CASE(forward_backward_propagation_, - ds::trackParameters* ds::propagationLimit, pT, phi, theta, - charge, plimit) { +BOOST_DATA_TEST_CASE( + forward_backward_propagation_, + ds::trackParameters* ds::propagationLimit, + pT, + phi, + theta, + charge, + plimit) { // foward backward check atlas stepper - foward_backward(apropagator, pT, phi, theta, charge, plimit, 1_um, 1_eV, - debug); + foward_backward( + apropagator, pT, phi, theta, charge, plimit, 1_um, 1_eV, debug); // foward backward check eigen stepper - foward_backward(epropagator, pT, phi, theta, charge, plimit, 1_um, 1_eV, - debug); + foward_backward( + epropagator, pT, phi, theta, charge, plimit, 1_um, 1_eV, debug); // foward backward check straight line stepper - foward_backward(spropagator, pT, phi, theta, charge, plimit, 1_um, 1_eV, - debug); + foward_backward( + spropagator, pT, phi, theta, charge, plimit, 1_um, 1_eV, debug); } /// test consistency of propagators when approaching a cylinder -BOOST_DATA_TEST_CASE(propagation_to_cylinder_, - ds::trackParameters* ds::propagationFraction ^ - ds::threeRandom, - pT, phi, theta, charge, pfrac, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + propagation_to_cylinder_, + ds::trackParameters* ds::propagationFraction ^ ds::threeRandom, + pT, + phi, + theta, + charge, + pfrac, + rand1, + rand2, + rand3) { // just make sure we can reach it double r = pfrac * std::abs(pT / Bz); r = (r > 2.5_m) ? 2.5_m : r; // check atlas stepper - auto a_at_cylinder = to_cylinder(apropagator, pT, phi, theta, charge, r, - rand1, rand2, rand3, covtpr, debug); + auto a_at_cylinder = to_cylinder( + apropagator, + pT, + phi, + theta, + charge, + r, + rand1, + rand2, + rand3, + covtpr, + debug); // check eigen stepper - auto e_at_cylinder = to_cylinder(epropagator, pT, phi, theta, charge, r, - rand1, rand2, rand3, covtpr, debug); + auto e_at_cylinder = to_cylinder( + epropagator, + pT, + phi, + theta, + charge, + r, + rand1, + rand2, + rand3, + covtpr, + debug); CHECK_CLOSE_ABS(e_at_cylinder.first, a_at_cylinder.first, 10_um); // check without charge - auto s_at_cylinder = to_cylinder(spropagator, pT, phi, theta, 0., r, rand1, - rand2, rand3, covtpr, debug); - e_at_cylinder = to_cylinder(epropagator, pT, phi, theta, 0., r, rand1, rand2, - rand3, covtpr, debug); + auto s_at_cylinder = to_cylinder( + spropagator, pT, phi, theta, 0., r, rand1, rand2, rand3, covtpr, debug); + e_at_cylinder = to_cylinder( + epropagator, pT, phi, theta, 0., r, rand1, rand2, rand3, covtpr, debug); CHECK_CLOSE_ABS(s_at_cylinder.first, e_at_cylinder.first, 10_um); } /// test consistency of propagators to a plane -BOOST_DATA_TEST_CASE(propagation_to_plane_, - ds::trackParameters* ds::propagationLimit ^ - ds::threeRandom, - pT, phi, theta, charge, plimit, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + propagation_to_plane_, + ds::trackParameters* ds::propagationLimit ^ ds::threeRandom, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3) { // to a plane with the atlas stepper auto a_at_plane = to_surface<AtlasPropagatorType, PlaneSurface>( - apropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, + apropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, covtpr); // to a plane with the eigen stepper auto e_at_plane = to_surface<EigenPropagatorType, PlaneSurface>( - epropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, + epropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, covtpr); CHECK_CLOSE_ABS(e_at_plane.first, a_at_plane.first, 1_um); // to a plane with the straight line stepper auto s_at_plane = to_surface<StraightPropagatorType, PlaneSurface>( - spropagator, pT, phi, theta, 0., plimit, rand1, rand2, rand3, true, + spropagator, + pT, + phi, + theta, + 0., + plimit, + rand1, + rand2, + rand3, + true, covtpr); // to a plane with the eigen stepper without charge e_at_plane = to_surface<EigenPropagatorType, PlaneSurface>( - epropagator, pT, phi, theta, 0., plimit, rand1, rand2, rand3, true, + epropagator, + pT, + phi, + theta, + 0., + plimit, + rand1, + rand2, + rand3, + true, covtpr); CHECK_CLOSE_ABS(e_at_plane.first, s_at_plane.first, 1_um); } /// test consistency of propagators to a disc -BOOST_DATA_TEST_CASE(propagation_to_disc_, - ds::trackParameters* ds::propagationLimit ^ - ds::threeRandom, - pT, phi, theta, charge, plimit, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + propagation_to_disc_, + ds::trackParameters* ds::propagationLimit ^ ds::threeRandom, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3) { // to a disc with the atlas stepper auto a_at_disc = to_surface<AtlasPropagatorType, DiscSurface>( - apropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, + apropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, covtpr); // to a disc with the eigen stepper auto e_at_disc = to_surface<EigenPropagatorType, DiscSurface>( - epropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, + epropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, covtpr); CHECK_CLOSE_ABS(e_at_disc.first, a_at_disc.first, 1_um); // to a disc with the straight line stepper auto s_at_disc = to_surface<StraightPropagatorType, DiscSurface>( - spropagator, pT, phi, theta, 0., plimit, rand1, rand2, rand3, true, + spropagator, + pT, + phi, + theta, + 0., + plimit, + rand1, + rand2, + rand3, + true, covtpr); // to a disc with the eigen stepper without charge e_at_disc = to_surface<EigenPropagatorType, DiscSurface>( - epropagator, pT, phi, theta, 0., plimit, rand1, rand2, rand3, true, + epropagator, + pT, + phi, + theta, + 0., + plimit, + rand1, + rand2, + rand3, + true, covtpr); CHECK_CLOSE_ABS(e_at_disc.first, s_at_disc.first, 1_um); } /// test consistency of propagators to a line -BOOST_DATA_TEST_CASE(propagation_to_line_, - ds::trackParameters* ds::propagationLimit ^ - ds::threeRandom, - pT, phi, theta, charge, plimit, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + propagation_to_line_, + ds::trackParameters* ds::propagationLimit ^ ds::threeRandom, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3) { // to a line with the atlas stepper if (debug) { std::cout << "[ >>>> Testing Atlas Propagator <<<< ]" << std::endl; } auto a_at_line = to_surface<AtlasPropagatorType, StrawSurface>( - apropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, false, - covtpr, debug); + apropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + false, + covtpr, + debug); // to a line with the eigen stepper if (debug) { std::cout << "[ >>>> Testing Eigen Propagator <<<< ]" << std::endl; } auto e_at_line = to_surface<EigenPropagatorType, StrawSurface>( - epropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, false, - covtpr, debug); + epropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + false, + covtpr, + debug); CHECK_CLOSE_ABS(e_at_line.first, a_at_line.first, 1_um); if (debug) { @@ -165,12 +310,32 @@ BOOST_DATA_TEST_CASE(propagation_to_line_, } // to a straw with the straight line stepper auto s_at_line = to_surface<StraightPropagatorType, StrawSurface>( - spropagator, pT, phi, theta, 0., plimit, rand1, rand2, rand3, false, - covtpr, debug); + spropagator, + pT, + phi, + theta, + 0., + plimit, + rand1, + rand2, + rand3, + false, + covtpr, + debug); // to a straw with the eigen stepper without charge e_at_line = to_surface<EigenPropagatorType, StrawSurface>( - epropagator, pT, phi, theta, 0., plimit, rand1, rand2, rand3, false, - covtpr, debug); + epropagator, + pT, + phi, + theta, + 0., + plimit, + rand1, + rand2, + rand3, + false, + covtpr, + debug); CHECK_CLOSE_ABS(e_at_line.first, s_at_line.first, 1_um); } @@ -178,9 +343,14 @@ BOOST_DATA_TEST_CASE(propagation_to_line_, /// test correct covariance transport for curvilinear parameters /// this test only works within the /// s_curvilinearProjTolerance (in: Definitions.hpp) -BOOST_DATA_TEST_CASE(covariance_transport_curvilinear_curvilinear_, - ds::trackParameters* ds::propagationLimit, pT, phi, theta, - charge, plimit) { +BOOST_DATA_TEST_CASE( + covariance_transport_curvilinear_curvilinear_, + ds::trackParameters* ds::propagationLimit, + pT, + phi, + theta, + charge, + plimit) { // covariance check for eigen stepper covariance_curvilinear(epropagator, pT, phi, theta, charge, plimit); // covariance check fo atlas stepper @@ -190,29 +360,73 @@ BOOST_DATA_TEST_CASE(covariance_transport_curvilinear_curvilinear_, } // test correct covariance transport from disc to disc -BOOST_DATA_TEST_CASE(covariance_transport_disc_disc_, - ds::trackParameters* ds::propagationLimit ^ - ds::threeRandom, - pT, phi, theta, charge, plimit, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + covariance_transport_disc_disc_, + ds::trackParameters* ds::propagationLimit ^ ds::threeRandom, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3) { // covariance check for atlas stepper covariance_bound<AtlasPropagatorType, DiscSurface, DiscSurface>( - apropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, - true, 1e-1); + apropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, + true, + 1e-1); // covariance check for eigen stepper covariance_bound<EigenPropagatorType, DiscSurface, DiscSurface>( - epropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, - true, 1e-1); + epropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, + true, + 1e-1); // covariance check for straight line stepper covariance_bound<StraightPropagatorType, DiscSurface, DiscSurface>( - spropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, true, - true, 1e-1); + spropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + true, + true, + 1e-1); } // test correct covariance transport from plane to plane -BOOST_DATA_TEST_CASE(covariance_transport_plane_plane_, - ds::trackParameters* ds::propagationLimit ^ - ds::threeRandom, - pT, phi, theta, charge, plimit, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + covariance_transport_plane_plane_, + ds::trackParameters* ds::propagationLimit ^ ds::threeRandom, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3) { // covariance check for atlas stepper covariance_bound<AtlasPropagatorType, PlaneSurface, PlaneSurface>( apropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3); @@ -227,37 +441,89 @@ BOOST_DATA_TEST_CASE(covariance_transport_plane_plane_, // test correct covariance transport from straw to straw // for straw surfaces the numerical fixture is actually more difficult // to calculate -BOOST_DATA_TEST_CASE(covariance_transport_line_line_, - ds::trackParameters* ds::propagationLimit ^ - ds::threeRandom, - pT, phi, theta, charge, plimit, rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + covariance_transport_line_line_, + ds::trackParameters* ds::propagationLimit ^ ds::threeRandom, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3) { // covariance check for atlas stepper covariance_bound<AtlasPropagatorType, StrawSurface, StrawSurface>( - apropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, false, - false, 1e-1); + apropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + false, + false, + 1e-1); // covariance check for eigen stepper covariance_bound<EigenPropagatorType, StrawSurface, StrawSurface>( - epropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, false, - false, 1e-1); + epropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + false, + false, + 1e-1); // covariance check for straight line stepper covariance_bound<StraightPropagatorType, StrawSurface, StrawSurface>( - spropagator, pT, phi, theta, charge, plimit, rand1, rand2, rand3, false, - false, 1e-1); + spropagator, + pT, + phi, + theta, + charge, + plimit, + rand1, + rand2, + rand3, + false, + false, + 1e-1); } /// test correct covariance transport for curvilinear parameters in dense /// environment /// this test only works within the /// s_curvilinearProjTolerance (in: Definitions.hpp) -BOOST_DATA_TEST_CASE(dense_covariance_transport_curvilinear_curvilinear_, - ds::pT* ds::propagationLimit ^ ds::threeRandom, pT, plimit, - rand1, rand2, rand3) { +BOOST_DATA_TEST_CASE( + dense_covariance_transport_curvilinear_curvilinear_, + ds::pT* ds::propagationLimit ^ ds::threeRandom, + pT, + plimit, + rand1, + rand2, + rand3) { // covariance check for eigen stepper in dense environment DensePropagatorType dpropagator = setupDensePropagator(); covariance_curvilinear(dpropagator, pT, 0_degree, 45_degree, 1_e, plimit); covariance_bound<DensePropagatorType, DiscSurface, DiscSurface>( - dpropagator, pT, 0_degree, 45_degree, 1_e, plimit, rand1, rand2, rand3, - true, true, 1e-1); + dpropagator, + pT, + 0_degree, + 45_degree, + 1_e, + plimit, + rand1, + rand2, + rand3, + true, + true, + 1e-1); covariance_bound<DensePropagatorType, PlaneSurface, PlaneSurface>( dpropagator, pT, 0_degree, 45_degree, 1, plimit, rand1, rand2, rand3); } diff --git a/Tests/Integration/PropagationTestHelper.hpp b/Tests/Integration/PropagationTestHelper.hpp index a0eb516a8..b260519bc 100644 --- a/Tests/Integration/PropagationTestHelper.hpp +++ b/Tests/Integration/PropagationTestHelper.hpp @@ -34,10 +34,12 @@ MagneticFieldContext mfContext = MagneticFieldContext(); /// @param nnomal The nominal normal direction /// @param angleT Rotation around the norminal normal /// @param angleU Roation around the original U axis -std::shared_ptr<Transform3D> createPlanarTransform(const Vector3D& nposition, - const Vector3D& nnormal, - double angleT, - double angleU) { +std::shared_ptr<Transform3D> +createPlanarTransform( + const Vector3D& nposition, + const Vector3D& nnormal, + double angleT, + double angleU) { // the rotation of the destination surface Vector3D T = nnormal.normalized(); Vector3D U = std::abs(T.dot(Vector3D::UnitZ())) < 0.99 @@ -65,9 +67,11 @@ std::shared_ptr<Transform3D> createPlanarTransform(const Vector3D& nposition, /// @param nnomal The nominal normal direction /// @param angleT Rotation around the norminal normal /// @param angleU Roation around the original U axis -std::shared_ptr<Transform3D> createCylindricTransform(const Vector3D& nposition, - double angleX, - double angleY) { +std::shared_ptr<Transform3D> +createCylindricTransform( + const Vector3D& nposition, + double angleX, + double angleY) { Transform3D ctransform; ctransform.setIdentity(); ctransform.pretranslate(nposition); @@ -77,12 +81,17 @@ std::shared_ptr<Transform3D> createCylindricTransform(const Vector3D& nposition, } template <typename Propagator_type> -Vector3D constant_field_propagation(const Propagator_type& propagator, - double pT, double phi, double theta, - double charge, double time, double Bz, - double disttol = 0.1 * - Acts::UnitConstants::um, - bool debug = false) { +Vector3D +constant_field_propagation( + const Propagator_type& propagator, + double pT, + double phi, + double theta, + double charge, + double time, + double Bz, + double disttol = 0.1 * Acts::UnitConstants::um, + bool debug = false) { using namespace Acts::UnitLiterals; namespace VH = VectorHelpers; @@ -162,11 +171,17 @@ Vector3D constant_field_propagation(const Propagator_type& propagator, } template <typename Propagator_type> -void foward_backward(const Propagator_type& propagator, double pT, double phi, - double theta, double charge, double plimit, - double disttol = 1 * Acts::UnitConstants::um, - double momtol = 10 * Acts::UnitConstants::keV, - bool debug = false) { +void +foward_backward( + const Propagator_type& propagator, + double pT, + double phi, + double theta, + double charge, + double plimit, + double disttol = 1 * Acts::UnitConstants::um, + double momtol = 10 * Acts::UnitConstants::keV, + bool debug = false) { using namespace Acts::UnitLiterals; // setup propagation options @@ -233,10 +248,19 @@ void foward_backward(const Propagator_type& propagator, double pT, double phi, // test propagation to cylinder template <typename Propagator_type> -std::pair<Vector3D, double> to_cylinder( - const Propagator_type& propagator, double pT, double phi, double theta, - double charge, double plimit, double rand1, double rand2, double /*rand3*/, - bool covtransport = false, bool debug = false) { +std::pair<Vector3D, double> +to_cylinder( + const Propagator_type& propagator, + double pT, + double phi, + double theta, + double charge, + double plimit, + double rand1, + double rand2, + double /*rand3*/, + bool covtransport = false, + bool debug = false) { using namespace Acts::UnitLiterals; // setup propagation options @@ -282,8 +306,8 @@ std::pair<Vector3D, double> to_cylinder( start = new CurvilinearParameters(std::move(covPtr), pos, mom, q, time); // The transform at the destination - auto seTransform = createCylindricTransform(Vector3D(0., 0., 0.), - 0.05 * rand1, 0.05 * rand2); + auto seTransform = createCylindricTransform( + Vector3D(0., 0., 0.), 0.05 * rand1, 0.05 * rand2); auto endSurface = Surface::makeShared<CylinderSurface>( seTransform, plimit, std::numeric_limits<double>::max()); @@ -300,10 +324,20 @@ std::pair<Vector3D, double> to_cylinder( // test propagation to most surfaces template <typename Propagator_type, typename Surface_type> -std::pair<Vector3D, double> to_surface( - const Propagator_type& propagator, double pT, double phi, double theta, - double charge, double plimit, double rand1, double rand2, double rand3, - bool planar = true, bool covtransport = false, bool debug = false) { +std::pair<Vector3D, double> +to_surface( + const Propagator_type& propagator, + double pT, + double phi, + double theta, + double charge, + double plimit, + double rand1, + double rand2, + double rand3, + bool planar = true, + bool covtransport = false, + bool debug = false) { using namespace Acts::UnitLiterals; using DebugOutput = detail::DebugOutputActor; @@ -352,12 +386,13 @@ std::pair<Vector3D, double> to_surface( const auto& tp_s = result_s.endParameters; // The transform at the destination - auto seTransform = planar - ? createPlanarTransform(tp_s->position(), - tp_s->momentum().normalized(), - 0.1 * rand3, 0.1 * rand1) - : createCylindricTransform(tp_s->position(), - 0.05 * rand1, 0.05 * rand2); + auto seTransform = planar ? createPlanarTransform( + tp_s->position(), + tp_s->momentum().normalized(), + 0.1 * rand3, + 0.1 * rand1) + : createCylindricTransform( + tp_s->position(), 0.05 * rand1, 0.05 * rand2); auto endSurface = Surface::makeShared<Surface_type>(seTransform, nullptr); // Increase the path limit - to be safe hitting the surface @@ -393,10 +428,16 @@ std::pair<Vector3D, double> to_surface( } template <typename Propagator_type> -void covariance_curvilinear(const Propagator_type& propagator, double pT, - double phi, double theta, double charge, - double plimit, double reltol = 1e-3, - bool debug = false) { +void +covariance_curvilinear( + const Propagator_type& propagator, + double pT, + double phi, + double theta, + double charge, + double plimit, + double reltol = 1e-3, + bool debug = false) { using namespace Acts::UnitLiterals; covariance_validation_fixture<Propagator_type> fixture(propagator); @@ -448,13 +489,25 @@ void covariance_curvilinear(const Propagator_type& propagator, double pT, CHECK_CLOSE_COVARIANCE(calculated_cov, obtained_cov, reltol); } -template <typename Propagator_type, typename StartSurface_type, - typename DestSurface_type> -void covariance_bound(const Propagator_type& propagator, double pT, double phi, - double theta, double charge, double plimit, double rand1, - double rand2, double rand3, bool startPlanar = true, - bool destPlanar = true, double reltol = 1e-3, - bool debug = false) { +template < + typename Propagator_type, + typename StartSurface_type, + typename DestSurface_type> +void +covariance_bound( + const Propagator_type& propagator, + double pT, + double phi, + double theta, + double charge, + double plimit, + double rand1, + double rand2, + double rand3, + bool startPlanar = true, + bool destPlanar = true, + double reltol = 1e-3, + bool debug = false) { using namespace Acts::UnitLiterals; covariance_validation_fixture<Propagator_type> fixture(propagator); @@ -496,22 +549,24 @@ void covariance_bound(const Propagator_type& propagator, double pT, double phi, const auto& tp_c = result_c.endParameters; auto ssTransform = - startPlanar ? createPlanarTransform(pos, mom.normalized(), 0.1 * rand1, - 0.1 * rand2) + startPlanar ? createPlanarTransform( + pos, mom.normalized(), 0.1 * rand1, 0.1 * rand2) : createCylindricTransform(pos, 0.05 * rand1, 0.05 * rand2); auto seTransform = destPlanar - ? createPlanarTransform(tp_c->position(), - tp_c->momentum().normalized(), - 0.1 * rand3, 0.1 * rand1) - : createCylindricTransform(tp_c->position(), - 0.05 * rand1, 0.05 * rand2); + ? createPlanarTransform( + tp_c->position(), + tp_c->momentum().normalized(), + 0.1 * rand3, + 0.1 * rand1) + : createCylindricTransform( + tp_c->position(), 0.05 * rand1, 0.05 * rand2); auto startSurface = Surface::makeShared<StartSurface_type>(ssTransform, nullptr); - BoundParameters start(tgContext, std::move(covPtr), pos, mom, q, time, - startSurface); - BoundParameters start_wo_c(tgContext, nullptr, pos, mom, q, time, - startSurface); + BoundParameters start( + tgContext, std::move(covPtr), pos, mom, q, time, startSurface); + BoundParameters start_wo_c( + tgContext, nullptr, pos, mom, q, time, startSurface); // increase the path limit - to be safe hitting the surface options.pathLimit *= 2; diff --git a/Tests/Integration/PropagationTests.cpp b/Tests/Integration/PropagationTests.cpp index 2347c5e0f..40ca0a621 100644 --- a/Tests/Integration/PropagationTests.cpp +++ b/Tests/Integration/PropagationTests.cpp @@ -47,9 +47,10 @@ namespace IntegrationTest { using BFieldType = ConstantBField; using EigenStepperType = EigenStepper<BFieldType>; -using DenseStepperType = - EigenStepper<BFieldType, VoidIntersectionCorrector, - StepperExtensionList<DenseEnvironmentExtension>>; +using DenseStepperType = EigenStepper< + BFieldType, + VoidIntersectionCorrector, + StepperExtensionList<DenseEnvironmentExtension>>; using AtlasStepperType = AtlasStepper<BFieldType>; using EigenPropagatorType = Propagator<EigenStepperType>; using DensePropagatorType = Propagator<DenseStepperType, Navigator>; @@ -73,7 +74,8 @@ AtlasPropagatorType apropagator(std::move(astepper)); StraightLineStepper sstepper; StraightPropagatorType spropagator(std::move(sstepper)); -DensePropagatorType setupDensePropagator() { +DensePropagatorType +setupDensePropagator() { CuboidVolumeBuilder::VolumeConfig vConf; vConf.position = {1.5_m, 0., 0.}; vConf.length = {3_m, 1_m, 1_m}; @@ -100,15 +102,18 @@ DensePropagatorType setupDensePropagator() { /// test forward propagation in constant magnetic field BOOST_DATA_TEST_CASE( constant_bfieldforward_propagation_, - bdata::random((bdata::seed = 0, - bdata::distribution = - std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ - bdata::random((bdata::seed = 1, - bdata::distribution = - std::uniform_real_distribution<>(-M_PI, M_PI))) ^ - bdata::random((bdata::seed = 2, - bdata::distribution = - std::uniform_real_distribution<>(0.1, M_PI - 0.1))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = + std::uniform_real_distribution<>(0.4_GeV, 10_GeV))) ^ + bdata::random( + (bdata::seed = 1, + bdata::distribution = + std::uniform_real_distribution<>(-M_PI, M_PI))) ^ + bdata::random( + (bdata::seed = 2, + bdata::distribution = + std::uniform_real_distribution<>(0.1, M_PI - 0.1))) ^ bdata::random( (bdata::seed = 3, bdata::distribution = std::uniform_int_distribution<>(0, 1))) ^ @@ -116,18 +121,23 @@ BOOST_DATA_TEST_CASE( (bdata::seed = 4, bdata::distribution = std::uniform_int_distribution<>(0, 100))) ^ bdata::xrange(ntests), - pT, phi, theta, charge, time, index) { + pT, + phi, + theta, + charge, + time, + index) { if (index < skip) { return; } double dcharge = -1 + 2 * charge; // constant field propagation atlas stepper - auto aposition = constant_field_propagation(apropagator, pT, phi, theta, - dcharge, time, index, Bz); + auto aposition = constant_field_propagation( + apropagator, pT, phi, theta, dcharge, time, index, Bz); // constant field propagation eigen stepper - auto eposition = constant_field_propagation(epropagator, pT, phi, theta, - dcharge, time, index, Bz); + auto eposition = constant_field_propagation( + epropagator, pT, phi, theta, dcharge, time, index, Bz); // check consistency CHECK_CLOSE_REL(eposition, aposition, 1e-6); } diff --git a/Tests/Integration/PropagationTestsAtlasField.cpp b/Tests/Integration/PropagationTestsAtlasField.cpp index 5822cb247..0de63cebb 100644 --- a/Tests/Integration/PropagationTestsAtlasField.cpp +++ b/Tests/Integration/PropagationTestsAtlasField.cpp @@ -44,12 +44,16 @@ namespace Acts { namespace IntegrationTest { // Create a mapper from the a text file -InterpolatedBFieldMap::FieldMapper<3, 3> readFieldXYZ( - std::function<size_t(std::array<size_t, 3> binsXYZ, - std::array<size_t, 3> nBinsXYZ)> +InterpolatedBFieldMap::FieldMapper<3, 3> +readFieldXYZ( + std::function< + size_t(std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ)> localToGlobalBin, - std::string fieldMapFile = "Field.txt", double lengthUnit = 1., - double BFieldUnit = 1., size_t nPoints = 100000, bool firstOctant = false) { + std::string fieldMapFile = "Field.txt", + double lengthUnit = 1., + double BFieldUnit = 1., + size_t nPoints = 100000, + bool firstOctant = false) { /// [1] Read in field map file // Grid position points in x, y and z std::vector<double> xPos; @@ -81,13 +85,20 @@ InterpolatedBFieldMap::FieldMapper<3, 3> readFieldXYZ( } map_file.close(); - return fieldMapperXYZ(localToGlobalBin, xPos, yPos, zPos, bField, lengthUnit, - BFieldUnit, firstOctant); + return fieldMapperXYZ( + localToGlobalBin, + xPos, + yPos, + zPos, + bField, + lengthUnit, + BFieldUnit, + firstOctant); } // create a bfiel map from a mapper -std::shared_ptr<const InterpolatedBFieldMap> atlasBField( - std::string fieldMapFile = "Field.txt") { +std::shared_ptr<const InterpolatedBFieldMap> +atlasBField(std::string fieldMapFile = "Field.txt") { // Declare the mapper concept ::AnyFieldLookup<> mapper; double lengthUnit = UnitConstants::mm; @@ -95,10 +106,13 @@ std::shared_ptr<const InterpolatedBFieldMap> atlasBField( // read the field x,y,z from a text file mapper = readFieldXYZ( [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { - return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + - binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); + return ( + binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) + + binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2)); }, - fieldMapFile, lengthUnit, BFieldUnit); + fieldMapFile, + lengthUnit, + BFieldUnit); // create the config InterpolatedBFieldMap::Config config; config.scale = 1.; diff --git a/Tests/Integration/covariance_validation_fixture.hpp b/Tests/Integration/covariance_validation_fixture.hpp index 67805b8c8..019828a94 100644 --- a/Tests/Integration/covariance_validation_fixture.hpp +++ b/Tests/Integration/covariance_validation_fixture.hpp @@ -31,10 +31,12 @@ struct covariance_validation_fixture { /// this is for covariance propagation validation /// it can either be used for curvilinear transport template <typename StartParameters, typename EndParameters, typename U> - Covariance calculateCovariance(const StartParameters& startPars, - const Covariance& startCov, - const EndParameters& endPars, - const U& options) const { + Covariance + calculateCovariance( + const StartParameters& startPars, + const Covariance& startCov, + const EndParameters& endPars, + const U& options) const { // steps for estimating derivatives const std::array<double, 4> h_steps = {{-2e-4, -1e-4, 1e-4, 2e-4}}; @@ -60,8 +62,8 @@ struct covariance_validation_fixture { x_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eLOC_0>(options.geoContext, - tp.template get<Acts::eLOC_0>() + h); + tp.template set<Acts::eLOC_0>( + options.geoContext, tp.template get<Acts::eLOC_0>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options).value(); x_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -71,8 +73,8 @@ struct covariance_validation_fixture { y_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eLOC_1>(options.geoContext, - tp.template get<Acts::eLOC_1>() + h); + tp.template set<Acts::eLOC_1>( + options.geoContext, tp.template get<Acts::eLOC_1>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options).value(); y_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -82,8 +84,8 @@ struct covariance_validation_fixture { phi_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::ePHI>(options.geoContext, - tp.template get<Acts::ePHI>() + h); + tp.template set<Acts::ePHI>( + options.geoContext, tp.template get<Acts::ePHI>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options).value(); phi_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -100,11 +102,11 @@ struct covariance_validation_fixture { if (current_theta + h < 0) { h = -current_theta; } - tp.template set<Acts::eTHETA>(options.geoContext, - tp.template get<Acts::eTHETA>() + h); + tp.template set<Acts::eTHETA>( + options.geoContext, tp.template get<Acts::eTHETA>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options).value(); - theta_derivatives.push_back((r.endParameters->parameters() - nominal) / - h); + theta_derivatives.push_back( + (r.endParameters->parameters() - nominal) / h); } // variation in q/p @@ -112,8 +114,8 @@ struct covariance_validation_fixture { qop_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eQOP>(options.geoContext, - tp.template get<Acts::eQOP>() + h); + tp.template set<Acts::eQOP>( + options.geoContext, tp.template get<Acts::eQOP>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options).value(); qop_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -123,8 +125,8 @@ struct covariance_validation_fixture { t_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eT>(options.geoContext, - tp.template get<Acts::eT>() + h); + tp.template set<Acts::eT>( + options.geoContext, tp.template get<Acts::eT>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options).value(); t_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -142,8 +144,10 @@ struct covariance_validation_fixture { private: template <unsigned long int N> - static BoundVector fitLinear(const std::vector<BoundVector>& values, - const std::array<double, N>& h) { + static BoundVector + fitLinear( + const std::vector<BoundVector>& values, + const std::array<double, N>& h) { BoundVector A; BoundVector C; A.setZero(); diff --git a/Tests/Plugins/Digitization/CartesianSegmentationTests.cpp b/Tests/Plugins/Digitization/CartesianSegmentationTests.cpp index 6c4e1ccd9..3fdc10345 100644 --- a/Tests/Plugins/Digitization/CartesianSegmentationTests.cpp +++ b/Tests/Plugins/Digitization/CartesianSegmentationTests.cpp @@ -49,8 +49,8 @@ BOOST_AUTO_TEST_CASE(cartesian_segmentation) { SurfacePtrVector segSurfacesXPZL; SurfacePtrVector segSurfacesYPZL; - cSegmentation.createSegmentationSurfaces(boundariesPZL, segSurfacesXPZL, - segSurfacesYPZL, hThickness, 1, 0.); + cSegmentation.createSegmentationSurfaces( + boundariesPZL, segSurfacesXPZL, segSurfacesYPZL, hThickness, 1, 0.); BOOST_CHECK_EQUAL(boundariesPZL.size(), 6); @@ -72,8 +72,8 @@ BOOST_AUTO_TEST_CASE(cartesian_segmentation) { SurfacePtrVector segSurfacesXNZL; SurfacePtrVector segSurfacesYNZL; - cSegmentation.createSegmentationSurfaces(boundariesNZL, segSurfacesXNZL, - segSurfacesYNZL, hThickness, -1, 0.); + cSegmentation.createSegmentationSurfaces( + boundariesNZL, segSurfacesXNZL, segSurfacesYNZL, hThickness, -1, 0.); BOOST_CHECK_EQUAL(boundariesNZL.size(), 6); diff --git a/Tests/Plugins/Digitization/ClusterizationTests.cpp b/Tests/Plugins/Digitization/ClusterizationTests.cpp index 572988f65..9bbfc2378 100644 --- a/Tests/Plugins/Digitization/ClusterizationTests.cpp +++ b/Tests/Plugins/Digitization/ClusterizationTests.cpp @@ -49,8 +49,8 @@ BOOST_AUTO_TEST_CASE(create_Clusters1) { size_t nBins0 = 10; std::vector<size_t> clusterSizes = {2, 2, 2, 3, 6, 6, 7}; std::vector<size_t> clusterSizesCut = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3}; - std::vector<size_t> clusterSizesEdge = {1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 3, 3, 6}; + std::vector<size_t> clusterSizesEdge = { + 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 6}; size_t nClusters = clusterSizes.size(); size_t nClustersCut = clusterSizesCut.size(); size_t nClustersEdge = clusterSizesEdge.size(); @@ -212,8 +212,11 @@ BOOST_AUTO_TEST_CASE(create_Clusters1) { } // check the cluster sizes std::sort(clusterSizes1.begin(), clusterSizes1.end()); - BOOST_CHECK_EQUAL_COLLECTIONS(clusterSizes.begin(), clusterSizes.end(), - clusterSizes1.begin(), clusterSizes1.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + clusterSizes.begin(), + clusterSizes.end(), + clusterSizes1.begin(), + clusterSizes1.end()); // check cells CHECK_CLOSE_REL(data1, nCellsWithoutDuplicates, 1e-5); @@ -236,9 +239,11 @@ BOOST_AUTO_TEST_CASE(create_Clusters1) { } // check the cluster sizes std::sort(clusterSizes2.begin(), clusterSizes2.end()); - BOOST_CHECK_EQUAL_COLLECTIONS(clusterSizesEdge.begin(), - clusterSizesEdge.end(), clusterSizes2.begin(), - clusterSizes2.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + clusterSizesEdge.begin(), + clusterSizesEdge.end(), + clusterSizes2.begin(), + clusterSizes2.end()); // check cells CHECK_CLOSE_REL(data2, nCellsWithoutDuplicates, 1e-5); @@ -261,8 +266,11 @@ BOOST_AUTO_TEST_CASE(create_Clusters1) { } // check the cluster sizes std::sort(clusterSizes3.begin(), clusterSizes3.end()); - BOOST_CHECK_EQUAL_COLLECTIONS(clusterSizes.begin(), clusterSizes.end(), - clusterSizes3.begin(), clusterSizes3.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + clusterSizes.begin(), + clusterSizes.end(), + clusterSizes3.begin(), + clusterSizes3.end()); // check cells CHECK_CLOSE_REL(data3, nCells, 1e-5); @@ -286,8 +294,11 @@ BOOST_AUTO_TEST_CASE(create_Clusters1) { } // check the cluster sizes std::sort(clusterSizes4.begin(), clusterSizes4.end()); - BOOST_CHECK_EQUAL_COLLECTIONS(clusterSizesCut.begin(), clusterSizesCut.end(), - clusterSizes4.begin(), clusterSizes4.end()); + BOOST_CHECK_EQUAL_COLLECTIONS( + clusterSizesCut.begin(), + clusterSizesCut.end(), + clusterSizes4.begin(), + clusterSizes4.end()); // check cells CHECK_CLOSE_REL(data4, nCells, 1e-5); } diff --git a/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp b/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp index b611e3b32..4c9319c8f 100644 --- a/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp +++ b/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp @@ -32,8 +32,10 @@ GeometryContext tgContext = GeometryContext(); /// Unit test for testing the main functions of DoubleHitSpacePointBuilder /// 1) A pair of hits gets added and resolved. /// 2) A pair of hits gets added and rejected. -BOOST_DATA_TEST_CASE(DoubleHitsSpacePointBuilder_basic, bdata::xrange(1), - index) { +BOOST_DATA_TEST_CASE( + DoubleHitsSpacePointBuilder_basic, + bdata::xrange(1), + index) { (void)index; std::cout << "Create first hit" << std::endl; @@ -108,8 +110,9 @@ BOOST_DATA_TEST_CASE(DoubleHitsSpacePointBuilder_basic, bdata::xrange(1), std::cout << "Store both hits" << std::endl; std::vector<DoubleHitSpacePoint> resultSP; - std::vector<std::pair<Acts::PlanarModuleCluster const*, - Acts::PlanarModuleCluster const*>> + std::vector<std::pair< + Acts::PlanarModuleCluster const*, + Acts::PlanarModuleCluster const*>> clusterPairs; SpacePointBuilder<DoubleHitSpacePoint>::DoubleHitSpacePointConfig dhsp_cfg; diff --git a/Tests/Plugins/Digitization/PlanarModuleStepperTests.cpp b/Tests/Plugins/Digitization/PlanarModuleStepperTests.cpp index 86b2ca3ad..0af1e8b67 100644 --- a/Tests/Plugins/Digitization/PlanarModuleStepperTests.cpp +++ b/Tests/Plugins/Digitization/PlanarModuleStepperTests.cpp @@ -63,20 +63,30 @@ GeometryContext tgContext = GeometryContext(); /// guaranteed to be in on the readout/counter plane BOOST_DATA_TEST_CASE( readout_counter_test, - bdata::random((bdata::seed = 0, - bdata::distribution = std::uniform_real_distribution<>( - -halfX + sguardX, halfX - sguardX))) ^ - bdata::random((bdata::seed = 1, - bdata::distribution = std::uniform_real_distribution<>( - -halfX + sguardX, halfX - sguardX))) ^ - bdata::random((bdata::seed = 2, - bdata::distribution = - std::uniform_real_distribution<>(-halfY, halfY))) ^ - bdata::random((bdata::seed = 3, - bdata::distribution = - std::uniform_int_distribution<>(-halfY, halfY))) ^ + bdata::random( + (bdata::seed = 0, + bdata::distribution = std::uniform_real_distribution<>( + -halfX + sguardX, + halfX - sguardX))) ^ + bdata::random( + (bdata::seed = 1, + bdata::distribution = std::uniform_real_distribution<>( + -halfX + sguardX, + halfX - sguardX))) ^ + bdata::random( + (bdata::seed = 2, + bdata::distribution = + std::uniform_real_distribution<>(-halfY, halfY))) ^ + bdata::random( + (bdata::seed = 3, + bdata::distribution = + std::uniform_int_distribution<>(-halfY, halfY))) ^ bdata::xrange(ntests), - entryX, entryY, exitX, exitY, index) { + entryX, + entryY, + exitX, + exitY, + index) { // avoid warning with void (void)index; diff --git a/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp b/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp index 64d4e6424..1d61bf692 100644 --- a/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp +++ b/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp @@ -33,8 +33,10 @@ GeometryContext tgContext = GeometryContext(); /// Unit test for testing the main functions of OneHitSpacePointBuilder /// 1) A resolved dummy hit gets created and added. /// 2) A hit gets added and resolved. -BOOST_DATA_TEST_CASE(SingleHitSpacePointBuilder_basic, bdata::xrange(1), - index) { +BOOST_DATA_TEST_CASE( + SingleHitSpacePointBuilder_basic, + bdata::xrange(1), + index) { (void)index; // Build bounds -- GitLab