From 9965554fede3db4f7da972a130c1bd3cd9fe7c3e Mon Sep 17 00:00:00 2001 From: Paul Gessinger <paul.gessinger@cern.ch> Date: Fri, 24 Aug 2018 18:50:20 +0200 Subject: [PATCH] readability-braces-around-statements --- .static_analysis_limits.yml | 1 + .../Acts/Detector/detail/TrackingVolume.ipp | 13 +- Core/include/Acts/EventData/ParameterSet.hpp | 20 +- .../EventData/SingleBoundTrackParameters.hpp | 12 +- .../Acts/EventData/SingleTrackParameters.hpp | 4 +- .../Acts/EventData/detail/value_corrector.hpp | 6 +- .../Acts/Extrapolator/MaterialInteractor.hpp | 18 +- Core/include/Acts/Extrapolator/Navigator.hpp | 48 ++- .../detail/InteractionFormulas.hpp | 4 +- Core/include/Acts/Layers/detail/Layer.ipp | 79 ++-- .../MagneticField/InterpolatedBFieldMap.hpp | 3 +- Core/include/Acts/Material/Material.hpp | 45 ++- .../Acts/Material/MaterialCollector.hpp | 4 +- .../include/Acts/Material/SurfaceMaterial.hpp | 4 +- .../Propagator/detail/ConstrainedStep.hpp | 6 +- .../detail/IntersectionCorrector.hpp | 4 +- .../detail/StandardAbortConditions.hpp | 11 +- .../include/Acts/Seeding/BarrelSeedFinder.hpp | 4 +- .../Acts/Seeding/detail/cyclic_range.hpp | 7 +- Core/include/Acts/Surfaces/SurfaceArray.hpp | 16 +- Core/include/Acts/Surfaces/SurfaceBounds.hpp | 4 +- .../Acts/Surfaces/detail/ConeSurface.ipp | 14 +- .../Acts/Surfaces/detail/CylinderSurface.ipp | 8 +- .../Acts/Surfaces/detail/DiscSurface.ipp | 4 +- .../Acts/Surfaces/detail/LineSurface.ipp | 18 +- .../Acts/Surfaces/detail/PlaneSurface.ipp | 4 +- .../Acts/Tools/CylinderVolumeBuilder.hpp | 55 ++- .../Acts/Tools/SurfaceArrayCreator.hpp | 6 +- Core/include/Acts/Utilities/BinUtility.hpp | 58 ++- Core/include/Acts/Utilities/BinnedArrayXD.hpp | 21 +- Core/include/Acts/Utilities/BinningData.hpp | 116 ++++-- Core/include/Acts/Utilities/GeometryID.hpp | 4 +- .../include/Acts/Utilities/GeometryObject.hpp | 4 +- Core/include/Acts/Utilities/Helpers.hpp | 49 ++- Core/include/Acts/Utilities/Intersection.hpp | 16 +- .../include/Acts/Utilities/ParameterTypes.hpp | 5 +- Core/include/Acts/Utilities/VariantData.hpp | 30 +- Core/include/Acts/Utilities/detail/Axis.hpp | 16 +- .../detail/RealQuadraticEquation.hpp | 4 +- .../Utilities/detail/interpolation_impl.hpp | 3 +- .../include/Acts/Volumes/BoundarySurfaceT.hpp | 15 +- .../Acts/Volumes/CylinderVolumeBounds.hpp | 11 +- Core/include/Acts/Volumes/Volume.hpp | 4 +- Core/src/Detector/DetachedTrackingVolume.cpp | 4 +- Core/src/Detector/GlueVolumesDescriptor.cpp | 15 +- Core/src/Detector/TrackingGeometry.cpp | 27 +- Core/src/Detector/TrackingVolume.cpp | 78 ++-- Core/src/EventData/TrackParametersBase.cpp | 5 +- Core/src/Layers/CylinderLayer.cpp | 25 +- Core/src/Layers/DiscLayer.cpp | 22 +- Core/src/Layers/Layer.cpp | 16 +- Core/src/Layers/PlaneLayer.cpp | 8 +- Core/src/Layers/ProtoLayer.cpp | 11 +- Core/src/Material/BinnedSurfaceMaterial.cpp | 20 +- Core/src/Material/SurfaceMaterialProxy.cpp | 8 +- Core/src/Surfaces/ConeSurface.cpp | 15 +- Core/src/Surfaces/CylinderBounds.cpp | 4 +- Core/src/Surfaces/CylinderSurface.cpp | 16 +- Core/src/Surfaces/DiscSurface.cpp | 12 +- Core/src/Surfaces/EllipseBounds.cpp | 12 +- Core/src/Surfaces/PerigeeSurface.cpp | 4 +- Core/src/Surfaces/PlaneSurface.cpp | 12 +- Core/src/Surfaces/StrawSurface.cpp | 4 +- Core/src/Surfaces/Surface.cpp | 20 +- Core/src/Surfaces/SurfaceArray.cpp | 16 +- Core/src/Tools/CylinderVolumeBuilder.cpp | 8 +- Core/src/Tools/CylinderVolumeHelper.cpp | 18 +- Core/src/Tools/LayerArrayCreator.cpp | 4 +- Core/src/Tools/LayerCreator.cpp | 8 +- Core/src/Tools/SurfaceArrayCreator.cpp | 26 +- Core/src/Tools/TrackingGeometryBuilder.cpp | 3 +- Core/src/Tools/TrackingVolumeArrayCreator.cpp | 4 +- Core/src/Volumes/CylinderVolumeBounds.cpp | 7 +- .../Volumes/DoubleTrapezoidVolumeBounds.cpp | 16 +- Core/src/Volumes/TrapezoidVolumeBounds.cpp | 12 +- Core/src/Volumes/Volume.cpp | 11 +- .../Acts/Extrapolation/ExtrapolationCell.hpp | 28 +- .../detail/ExtrapolationCell.ipp | 8 +- .../detail/ExtrapolationEngine.ipp | 8 +- .../Extrapolation/detail/RungeKuttaEngine.ipp | 126 ++++--- .../Extrapolation/detail/StaticEngine.ipp | 3 +- .../detail/StaticNavigationEngine.ipp | 20 +- .../include/Acts/Propagator/AtlasStepper.hpp | 24 +- Legacy/include/Acts/Seeding/ATL_Seedmaker.hpp | 9 +- Legacy/include/Acts/Seeding/ATL_Seedmaker.ipp | 337 +++++++++++++----- Legacy/include/Acts/Seeding/InternalSeed.hpp | 6 +- Legacy/include/Acts/Seeding/SPForSeed.hpp | 52 ++- .../Extrapolation/MaterialEffectsEngine.cpp | 7 +- Legacy/src/Extrapolation/RungeKuttaUtils.cpp | 184 +++++++--- Legacy/src/Utilities/MaterialInteraction.cpp | 8 +- .../Acts/Plugins/DD4hep/ActsExtension.hpp | 4 +- Plugins/DD4hep/src/ConvertDD4hepDetector.cpp | 28 +- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 52 ++- .../src/CartesianSegmentation.cpp | 8 +- .../Digitization/src/DigitizationModule.cpp | 34 +- .../Digitization/src/PlanarModuleStepper.cpp | 13 +- .../MaterialMapping/src/MaterialMapper.cpp | 17 +- .../src/SurfaceMaterialRecord.cpp | 3 +- .../Acts/Plugins/TGeo/TGeoLayerBuilder.hpp | 15 +- Plugins/TGeo/src/TGeoDetectorElement.cpp | 224 ++++++++---- Plugins/TGeo/src/TGeoLayerBuilder.cpp | 25 +- .../Detector/TrackingGeometryGeoIDTests.cpp | 18 +- Tests/Core/Extrapolator/ExtrapolatorTests.cpp | 5 +- .../Extrapolator/MaterialCollectionTests.cpp | 16 +- .../Propagator/AtlasPropagatorBenchmark.cpp | 4 +- .../Core/Propagator/AtlasStepperBenchmark.cpp | 4 +- .../Core/Propagator/EigenStepperBenchmark.cpp | 4 +- Tests/Core/Propagator/JacobianTests.cpp | 3 +- Tests/Core/Propagator/LoopProtectionTests.cpp | 4 +- .../Core/Propagator/RungeKuttaEngineTests.cpp | 3 +- Tests/Core/Seeding/SeedingTestsCommon.hpp | 7 +- Tests/Core/Tools/LayerCreatorTests.cpp | 4 +- Tests/Core/Utilities/BFieldMapUtilsTests.cpp | 16 +- Tests/Core/Utilities/BinningDataTests.cpp | 12 +- Tests/Core/Utilities/GridTests.cpp | 28 +- Tests/Integration/PropagationTestBase.hpp | 47 ++- Tests/Integration/PropagationTestHelper.hpp | 8 +- Tests/Integration/PropagationTests.cpp | 4 +- .../covariance_validation_fixture.hpp | 12 +- .../MaterialMapping/MaterialMappingTests.cpp | 10 +- 120 files changed, 1893 insertions(+), 808 deletions(-) diff --git a/.static_analysis_limits.yml b/.static_analysis_limits.yml index af669e1bd..804400d1b 100644 --- a/.static_analysis_limits.yml +++ b/.static_analysis_limits.yml @@ -1,5 +1,6 @@ limits: "modernize-use-using": 0 + "readability-braces-around-statements": 0 ignore: - cppcoreguidelines-pro-type-vararg diff --git a/Core/include/Acts/Detector/detail/TrackingVolume.ipp b/Core/include/Acts/Detector/detail/TrackingVolume.ipp index bfc14df6d..f4624576f 100644 --- a/Core/include/Acts/Detector/detail/TrackingVolume.ipp +++ b/Core/include/Acts/Detector/detail/TrackingVolume.ipp @@ -92,15 +92,18 @@ TrackingVolume::compatibleBoundaries(const parameters_t& parameters, const BoundarySurfaceT<TrackingVolume>* bSurface = bsIter.get(); const auto& bSurfaceRep = bSurface->surfaceRepresentation(); // exclude the on boundary object - if (excludeObject && excludeObject == &bSurfaceRep) continue; + if (excludeObject && excludeObject == &bSurfaceRep) { + continue; + } // intersect the surface SurfaceIntersection bsIntersection = bSurfaceRep.intersectionEstimate(parameters, options, corrfnc); // check if the intersection is valid, but exlude the on-surface case // when requested -- move to intersectionestimate - if (bsIntersection) + if (bsIntersection) { bIntersections.push_back(BoundaryIntersection( bsIntersection.intersection, bSurface, &bSurfaceRep, options.navDir)); + } } // and now sort to get the closest - need custom sort here to respect sign // sort them accordingly to the path length @@ -201,9 +204,10 @@ TrackingVolume::layerCandidatesOrdered(const Layer* sLayer, // punch-through if (sLayer && sLayerIntersection.valid && sLayerIntersection.pathLength < validPathLength - && sLayer->resolve(resolveSensitive, resolveMaterial, resolvePassive)) + && sLayer->resolve(resolveSensitive, resolveMaterial, resolvePassive)) { lIntersections.push_back( LayerIntersection(sLayerIntersection, sLayer, sLayerSurface, pDir)); + } // sort them accordingly to the path length std::sort(lIntersections.begin(), lIntersections.end()); @@ -235,12 +239,13 @@ TrackingVolume::boundarySurfacesOrdered(const parameters_t& pars, // when requested if (bsIntersection.valid && (!skipCurrent - || std::abs(bsIntersection.pathLength) < s_onSurfaceTolerance)) + || std::abs(bsIntersection.pathLength) < s_onSurfaceTolerance)) { bIntersections.push_back( BoundaryIntersection(bsIntersection, bSurface, &(bSurface->surfaceRepresentation()), pDir)); + } } // and now sort to get the closest std::sort(bIntersections.begin(), bIntersections.end()); diff --git a/Core/include/Acts/EventData/ParameterSet.hpp b/Core/include/Acts/EventData/ParameterSet.hpp index baa713bf6..a1ec4fe9c 100644 --- a/Core/include/Acts/EventData/ParameterSet.hpp +++ b/Core/include/Acts/EventData/ParameterSet.hpp @@ -158,8 +158,9 @@ public: ParameterSet(const ParSet_t& copy) : m_vValues(copy.m_vValues), m_pCovariance(nullptr) { - if (copy.m_pCovariance) + if (copy.m_pCovariance) { m_pCovariance = std::make_unique<const CovMatrix_t>(*copy.m_pCovariance); + } } /** @@ -364,8 +365,9 @@ public: if (m_pCovariance) { size_t index = getIndex<parameter>(); return sqrt((*m_pCovariance)(index, index)); - } else + } else { return -1; + } } /** @@ -392,18 +394,24 @@ public: operator==(const ParSet_t& rhs) const { // shortcut comparison with myself - if (&rhs == this) return true; + if (&rhs == this) { + return true; + } // parameter values - if (m_vValues != rhs.m_vValues) return false; + if (m_vValues != rhs.m_vValues) { + return false; + } // both have covariance matrices set if ((m_pCovariance && rhs.m_pCovariance) - && (*m_pCovariance != *rhs.m_pCovariance)) + && (*m_pCovariance != *rhs.m_pCovariance)) { return false; + } // only one has a covariance matrix set if ((m_pCovariance && !rhs.m_pCovariance) - || (!m_pCovariance && rhs.m_pCovariance)) + || (!m_pCovariance && rhs.m_pCovariance)) { return false; + } return true; } diff --git a/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp b/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp index 69e3ceaf0..1f92530dc 100644 --- a/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp @@ -171,7 +171,9 @@ public: /// checks if the surface is free and in such a case deletes it virtual ~SingleBoundTrackParameters() { - if (m_pSurface && m_pSurface->isFree()) delete m_pSurface; + if (m_pSurface && m_pSurface->isFree()) { + delete m_pSurface; + } } /// @brief copy assignment operator - charged/neutral @@ -183,7 +185,9 @@ public: if (this != &rhs) { SingleTrackParameters<ChargePolicy>::operator=(rhs); - if (m_pSurface->isFree()) delete m_pSurface; + if (m_pSurface->isFree()) { + delete m_pSurface; + } m_pSurface = rhs.m_pSurface->isFree() ? rhs.m_pSurface->clone() : rhs.m_pSurface; @@ -201,7 +205,9 @@ public: if (this != &rhs) { SingleTrackParameters<ChargePolicy>::operator=(std::move(rhs)); - if (m_pSurface->isFree()) delete m_pSurface; + if (m_pSurface->isFree()) { + delete m_pSurface; + } m_pSurface = rhs.m_pSurface; rhs.m_pSurface = 0; diff --git a/Core/include/Acts/EventData/SingleTrackParameters.hpp b/Core/include/Acts/EventData/SingleTrackParameters.hpp index 40208bee5..ab54ce7a0 100644 --- a/Core/include/Acts/EventData/SingleTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleTrackParameters.hpp @@ -80,7 +80,9 @@ public: operator==(const TrackParametersBase& rhs) const override { auto casted = dynamic_cast<decltype(this)>(&rhs); - if (!casted) return false; + if (!casted) { + return false; + } return (m_oChargePolicy == casted->m_oChargePolicy && m_oParameters == casted->m_oParameters diff --git a/Core/include/Acts/EventData/detail/value_corrector.hpp b/Core/include/Acts/EventData/detail/value_corrector.hpp index 481d45c19..ac2c7122c 100644 --- a/Core/include/Acts/EventData/detail/value_corrector.hpp +++ b/Core/include/Acts/EventData/detail/value_corrector.hpp @@ -55,8 +55,9 @@ namespace detail { calculate(R& values, unsigned int pos) { using parameter_type = typename par_type<first>::type; - if (parameter_type::may_modify_value) + if (parameter_type::may_modify_value) { values(pos) = parameter_type::getValue(values(pos)); + } value_corrector_impl<R, others...>::calculate(values, pos + 1); } }; @@ -68,8 +69,9 @@ namespace detail { calculate(R& values, unsigned int pos) { using parameter_type = typename par_type<last>::type; - if (parameter_type::may_modify_value) + if (parameter_type::may_modify_value) { values(pos) = parameter_type::getValue(values(pos)); + } } }; /// @endcond diff --git a/Core/include/Acts/Extrapolator/MaterialInteractor.hpp b/Core/include/Acts/Extrapolator/MaterialInteractor.hpp index 8e1e1a198..ee95ea4df 100644 --- a/Core/include/Acts/Extrapolator/MaterialInteractor.hpp +++ b/Core/include/Acts/Extrapolator/MaterialInteractor.hpp @@ -87,10 +87,14 @@ struct MaterialInteractor { // if we are on target, everything should have been done - if (state.navigation.targetReached) return; + if (state.navigation.targetReached) { + return; + } // if switched off, then return - alows run-time configuration - if (!multipleScattering && !energyLoss) return; + if (!multipleScattering && !energyLoss) { + return; + } // a current surface has been assigned by the navigator if (state.navigation.currentSurface @@ -139,8 +143,9 @@ struct MaterialInteractor // to integrate process noise, we need to transport // the covariance to the current position in space - if (state.stepping.covTransport) + if (state.stepping.covTransport) { state.stepping.covarianceTransport(true); + } // get the material thickness - and correct it with incidence double thickness = mProperties->thickness(); @@ -220,15 +225,16 @@ struct MaterialInteractor // save the material interaction mInteraction.sigmaQoP2 = sigmaQoverP * sigmaQoverP; // good in any case for positive direction - if (state.stepping.navDir == forward) + if (state.stepping.navDir == forward) { state.stepping.cov(eQOP, eQOP) += state.stepping.navDir * sigmaQoverP * sigmaQoverP; - else { + } else { // check that covariance entry doesn't become neagive double sEqop = state.stepping.cov(eQOP, eQOP); - if (sEqop > sigmaQoverP * sigmaQoverP) + if (sEqop > sigmaQoverP * sigmaQoverP) { state.stepping.cov(eQOP, eQOP) += state.stepping.navDir * sigmaQoverP * sigmaQoverP; + } } } } diff --git a/Core/include/Acts/Extrapolator/Navigator.hpp b/Core/include/Acts/Extrapolator/Navigator.hpp index a33795766..5d83f159c 100644 --- a/Core/include/Acts/Extrapolator/Navigator.hpp +++ b/Core/include/Acts/Extrapolator/Navigator.hpp @@ -200,10 +200,14 @@ struct Navigator { // void behavior in case no tracking geometry is present - if (!trackingGeometry) return; + if (!trackingGeometry) { + return; + } // turn the navigator into void when you are intructed to do nothing - if (!resolveSensitive && !resolveMaterial && !resolvePassive) return; + if (!resolveSensitive && !resolveMaterial && !resolvePassive) { + return; + } debugLog(state, [&] { return std::string("Entering navigator."); }); @@ -216,7 +220,9 @@ struct Navigator // - If so & the target exists or was hit - it simply returns // - If a target exists and was not yet hit, it checks for it // -> return is always to the stepper - if (navigationBreak(state)) return; + if (navigationBreak(state)) { + return; + } // get a navigation corrector associated to the stepper auto navCorr = state.stepping.corrector(); @@ -295,8 +301,9 @@ struct Navigator { if (state.navigation.navigationBreak) { // target exists and reached, or no target exists - if (state.navigation.targetReached || !state.navigation.targetSurface) + if (state.navigation.targetReached || !state.navigation.targetSurface) { return true; + } // the only advance could have been to the target if (state.navigation.targetSurface->isOnSurface(state.stepping.position(), true)) { @@ -339,7 +346,9 @@ struct Navigator { // No initialisation necessary - if (state.navigation.currentVolume) return false; + if (state.navigation.currentVolume) { + return false; + } debugLog(state, [&] { return std::string("Initializing start volume."); }); @@ -454,13 +463,14 @@ struct Navigator }); state.navigation.currentSurface = state.navigation.navLayerIter->representation; - if (state.navigation.currentSurface) + if (state.navigation.currentSurface) { debugLog(state, [&] { std::stringstream dstream; dstream << "Current surface set to approach surface "; dstream << state.navigation.currentSurface->geoID().toString(); return dstream.str(); }); + } // no returning to the stepper at this stage return false; } @@ -639,8 +649,9 @@ struct Navigator std::stringstream dstream; dstream << state.navigation.navBoundaries.size(); dstream << " boundary candidates found at path(s): "; - for (auto& bc : state.navigation.navBoundaries) + for (auto& bc : state.navigation.navBoundaries) { dstream << bc.intersection.pathLength << " "; + } return dstream.str(); }); // set the iterator, but avoid stepping a zero step @@ -697,13 +708,14 @@ struct Navigator } // store the boundary for eventual actors to work on it state.navigation.currentSurface = boundarySurface; - if (state.navigation.currentSurface) + if (state.navigation.currentSurface) { debugLog(state, [&] { std::stringstream dstream; dstream << "Current surface set to boundary surface "; dstream << state.navigation.currentSurface->geoID().toString(); return dstream.str(); }); + } // resolve the new layer situation if (resolveLayers(state, navCorr)) { // positive layer resolving : @@ -816,8 +828,9 @@ struct Navigator std::stringstream dstream; dstream << state.navigation.navLayers.size(); dstream << " layer candidates found at path(s): "; - for (auto& lc : state.navigation.navLayers) + for (auto& lc : state.navigation.navLayers) { dstream << lc.intersection.pathLength << " "; + } return dstream.str(); }); // set the iterator @@ -845,7 +858,9 @@ struct Navigator state.navigation.navLayerIter->representation = state.navigation.startSurface; // if you found surfaces return to the stepper - if (resolveSurfaces(state, navCorr)) return true; + if (resolveSurfaces(state, navCorr)) { + return true; + } // increase the iterator ++state.navigation.navLayerIter; return false; @@ -939,16 +954,19 @@ struct Navigator = state.navigation.startSurface; } else { state.navigation.currentSurface = layerSurface; - if (state.navigation.currentSurface) + if (state.navigation.currentSurface) { debugLog(state, [&] { std::stringstream dstream; dstream << "Current surface set to layer surface "; dstream << state.navigation.currentSurface->geoID().toString(); return dstream.str(); }); + } } // if you found surfaces return to the stepper - if (resolveSurfaces(state, navCorr)) return true; + if (resolveSurfaces(state, navCorr)) { + return true; + } // increase the iterator ++state.navigation.navLayerIter; } @@ -1104,13 +1122,14 @@ struct Navigator // the surface will only appear due to correct // collect(Property) flag state.navigation.currentSurface = surface; - if (state.navigation.currentSurface) + if (state.navigation.currentSurface) { debugLog(state, [&] { std::stringstream dstream; dstream << "Current surface set to resolved surface "; dstream << state.navigation.currentSurface->geoID().toString(); return dstream.str(); }); + } // break if the surface is the target surface if (surface == state.navigation.targetSurface) { debugLog(state, [&] { @@ -1223,8 +1242,9 @@ private: { if (state.options.debug) { std::string vName = "No Volume"; - if (state.navigation.currentVolume) + if (state.navigation.currentVolume) { vName = state.navigation.currentVolume->volumeName(); + } std::stringstream dstream; dstream << ">>>" << std::setw(state.options.debugPfxWidth) << vName << " | "; diff --git a/Core/include/Acts/Extrapolator/detail/InteractionFormulas.hpp b/Core/include/Acts/Extrapolator/detail/InteractionFormulas.hpp index d59510ecc..f257164dc 100644 --- a/Core/include/Acts/Extrapolator/detail/InteractionFormulas.hpp +++ b/Core/include/Acts/Extrapolator/detail/InteractionFormulas.hpp @@ -139,7 +139,9 @@ namespace detail { double dInX0, bool electron = false) const { - if (dInX0 == 0. || p == 0. || lbeta == 0.) return 0.; + if (dInX0 == 0. || p == 0. || lbeta == 0.) { + return 0.; + } // Highland formula - projected sigma_s // ATL-SOFT-PUB-2008-003 equation (15) if (!electron) { diff --git a/Core/include/Acts/Layers/detail/Layer.ipp b/Core/include/Acts/Layers/detail/Layer.ipp index 519efe6cd..8d94f290c 100644 --- a/Core/include/Acts/Layers/detail/Layer.ipp +++ b/Core/include/Acts/Layers/detail/Layer.ipp @@ -68,7 +68,9 @@ inline const Layer* Layer::nextLayer(const Vector3D& gp, const Vector3D& mom) const { // no binutility -> no chance to find out the direction - if (!m_nextLayerUtility) return nullptr; + if (!m_nextLayerUtility) { + return nullptr; + } return (m_nextLayerUtility->nextDirection(gp, mom) < 0) ? m_nextLayers.first : m_nextLayers.second; } @@ -78,11 +80,16 @@ Layer::resolve(bool resolveSensitive, bool resolveMaterial, bool resolvePassive) const { - if (resolvePassive) return true; - if (resolveSensitive && m_surfaceArray) return true; + if (resolvePassive) { + return true; + } + if (resolveSensitive && m_surfaceArray) { + return true; + } if (resolveMaterial && (m_ssSensitiveSurfaces > 1 || m_ssApproachSurfaces > 1 - || surfaceRepresentation().associatedMaterial())) + || surfaceRepresentation().associatedMaterial())) { return true; + } return false; } @@ -112,8 +119,9 @@ Layer::compatibleSurfaces(const parameters_t& parameters, std::map<const Surface*, bool> accepted; // fast exit - there is nothing to - if (!m_surfaceArray || !m_approachDescriptor || !options.navDir) + if (!m_surfaceArray || !m_approachDescriptor || !options.navDir) { return sIntersections; + } // reserve a few bins sIntersections.reserve(20); @@ -132,10 +140,11 @@ Layer::compatibleSurfaces(const parameters_t& parameters, // indicates wrong direction or faulty setup // -> do not return compatible surfaces since they may lead you on a wrong // navigation path - if (endInter) + if (endInter) { maxPath = endInter.intersection.pathLength; - else + } else { return sIntersections; + } } else { // compatibleSurfaces() should only be called when on the layer, @@ -151,11 +160,17 @@ Layer::compatibleSurfaces(const parameters_t& parameters, auto acceptSurface = [&options, &accepted](const Surface& sf, bool sensitive = false) -> bool { // check for duplicates - if (accepted.find(&sf) != accepted.end()) return false; + if (accepted.find(&sf) != accepted.end()) { + return false; + } // surface is sensitive and you're asked to resolve - if (sensitive && options.resolveSensitive) return true; + if (sensitive && options.resolveSensitive) { + return true; + } // next option: it's a material surface and you want to have it - if (options.resolveMaterial && sf.associatedMaterial()) return true; + if (options.resolveMaterial && sf.associatedMaterial()) { + return true; + } // last option: resovle all return options.resolvePassive; }; @@ -164,9 +179,13 @@ Layer::compatibleSurfaces(const parameters_t& parameters, // [&sIntersections, &options, ¶meters,&corrfnc auto processSurface = [&](const Surface& sf, bool sensitive = false) { // veto if it's start or end surface - if (options.startObject == &sf || options.endObject == &sf) return; + if (options.startObject == &sf || options.endObject == &sf) { + return; + } // veto if it doesn't fit the prescription - if (!acceptSurface(sf, sensitive)) return; + if (!acceptSurface(sf, sensitive)) { + return; + } // the surface intersection SurfaceIntersection sfi = sf.intersectionEstimate(parameters, options, corrfnc); @@ -221,10 +240,11 @@ Layer::compatibleSurfaces(const parameters_t& parameters, processSurface(*layerSurface); // sort according to the path length - if (options.navDir == forward) + if (options.navDir == forward) { std::sort(sIntersections.begin(), sIntersections.end()); - else + } else { std::sort(sIntersections.begin(), sIntersections.end(), std::greater<>()); + } return sIntersections; } @@ -260,7 +280,9 @@ Layer::surfaceOnApproach(const parameters_t& parameters, // let's find the most suitable approach surface SurfaceIntersection aSurface = m_approachDescriptor->approachSurface(parameters, options, corrfnc); - if (aSurface.intersection.valid) return (aSurface); + if (aSurface.intersection.valid) { + return (aSurface); + } } const Surface& rSurface = surfaceRepresentation(); @@ -295,7 +317,9 @@ Layer::getCompatibleSurfaces(const parameters_t& pars, cSurfaces.reserve(20); // fast exit - there is nothing to do nothing to do - if (!m_surfaceArray || !m_approachDescriptor) return cSurfaces; + if (!m_surfaceArray || !m_approachDescriptor) { + return cSurfaces; + } // the test boudnary check is defined by the search type BoundaryCheck tCheck = searchType % 2 ? BoundaryCheck(false) : bcheck; @@ -317,10 +341,11 @@ Layer::getCompatibleSurfaces(const parameters_t& pars, // indicates wrong direction or faulty setup // -> do not return compatible surfaces since they may lead you on a wrong // navigation path - if (endInter.valid && endInter.pathLength > 0.) + if (endInter.valid && endInter.pathLength > 0.) { pathLimit = endInter.pathLength; - else + } else { return cSurfaces; + } } // (A) approach descriptor section @@ -337,11 +362,14 @@ Layer::getCompatibleSurfaces(const parameters_t& pars, // - if the approach surface is the parameter surface // - if the surface is not compatible with the collect for (auto& aSurface : approachSurfaces) { - if (aSurface == startSurface || aSurface == endSurface) continue; + if (aSurface == startSurface || aSurface == endSurface) { + continue; + } // we fill passive always, rest is only for material - if (resolvePassive || aSurface->associatedMaterial()) + if (resolvePassive || aSurface->associatedMaterial()) { testCompatibleSurface( cSurfaces, *aSurface, pos, dir, pDir, tCheck, pathLimit); + } } } @@ -388,9 +416,10 @@ Layer::getCompatibleSurfaces(const parameters_t& pars, crit); } // sensitive surfaces and test them - for (auto& ctSurface : ctestSurfaces) + for (auto& ctSurface : ctestSurfaces) { testCompatibleSurface( cSurfaces, *ctSurface, pos, dir, pDir, tCheck, pathLimit); + } } // end of sensitive surfaces to exist @@ -473,7 +502,9 @@ Layer::surfaceOnApproach(const Vector3D& position, // let's find the approach surface SurfaceIntersection aSurface = m_approachDescriptor->approachSurface( position, momentum, iDir, bcheck); - if (aSurface.intersection.valid) return (aSurface); + if (aSurface.intersection.valid) { + return (aSurface); + } } // allow to stay if you are on the surface if (nDir == anyDirection @@ -493,7 +524,9 @@ Layer::surfaceOnApproach(const Vector3D& position, inline bool Layer::isOnLayer(const Vector3D& gp, const BoundaryCheck& bcheck) const { - if (m_representingVolume) return m_representingVolume->inside(gp); + if (m_representingVolume) { + return m_representingVolume->inside(gp); + } return (surfaceRepresentation()).isOnSurface(gp, bcheck); } diff --git a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp index 579de281f..6895928d3 100644 --- a/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp +++ b/Core/include/Acts/MagneticField/InterpolatedBFieldMap.hpp @@ -98,8 +98,9 @@ public: const auto& gridCoordinates = m_transformPos(position); for (unsigned int i = 0; i < DIM_POS; ++i) { if (gridCoordinates[i] < m_lowerLeft.at(i) - || gridCoordinates[i] >= m_upperRight.at(i)) + || gridCoordinates[i] >= m_upperRight.at(i)) { return false; + } } return true; } diff --git a/Core/include/Acts/Material/Material.hpp b/Core/include/Acts/Material/Material.hpp index a829e7595..8948f2cc5 100644 --- a/Core/include/Acts/Material/Material.hpp +++ b/Core/include/Acts/Material/Material.hpp @@ -125,7 +125,9 @@ public: const std::vector<std::pair<unsigned char, unsigned char>>& efracs) { reserve(efracs.size()); - for (auto& efracIt : efracs) push_back(efracIt); + for (auto& efracIt : efracs) { + push_back(efracIt); + } std::sort(begin(), end()); } @@ -155,9 +157,13 @@ public: bool operator==(const std::vector<ElementFraction>& mc) const { - if (mc.size() != size()) return false; + if (mc.size() != size()) { + return false; + } for (size_t ef = 0; ef < mc.size(); ++ef) { - if (!(mc[ef] == (*this)[ef])) return false; + if (!(mc[ef] == (*this)[ef])) { + return false; + } } return true; } @@ -239,10 +245,11 @@ public: float X0() const { - if (m_store.size()) + if (m_store.size()) { return m_store[matX0]; - else + } else { return std::numeric_limits<float>::infinity(); + } } /// access to l0 @@ -250,46 +257,52 @@ public: float L0() const { - if (m_store.size()) + if (m_store.size()) { return m_store[matL0]; - else + } else { return std::numeric_limits<float>::infinity(); + } } /// access to A float A() const { - if (m_store.size()) + if (m_store.size()) { return m_store[matA]; - else + } else { return 0.; + } } /// access to Z float Z() const { - if (m_store.size()) + if (m_store.size()) { return m_store[matZ]; - else + } else { return 0.; + } } /// access to rho float rho() const { - if (m_store.size()) + if (m_store.size()) { return m_store[matrho]; - else + } else { return 0.; + } } /// access to z/A*tho float zOverAtimesRho() const { - if (m_store.size() > 4) return m_store[matZ_AR]; + if (m_store.size() > 4) { + return m_store[matZ_AR]; + } return 0.; } @@ -300,7 +313,9 @@ public: std::ostringstream sout; sout << std::setiosflags(std::ios::fixed) << std::setprecision(4); sout << " | "; - for (auto& mat : m_store) sout << mat << " | "; + for (auto& mat : m_store) { + sout << mat << " | "; + } return sout.str(); } diff --git a/Core/include/Acts/Material/MaterialCollector.hpp b/Core/include/Acts/Material/MaterialCollector.hpp index fb658ac93..b96cd3069 100644 --- a/Core/include/Acts/Material/MaterialCollector.hpp +++ b/Core/include/Acts/Material/MaterialCollector.hpp @@ -63,7 +63,9 @@ struct MaterialCollector operator()(propagator_state_t& state, result_type& result) const { // if we are on target, everything should have been done - if (state.navigation.targetReached) return; + if (state.navigation.targetReached) { + return; + } if (state.navigation.currentSurface) { debugLog(state, [&] { diff --git a/Core/include/Acts/Material/SurfaceMaterial.hpp b/Core/include/Acts/Material/SurfaceMaterial.hpp index 4a0c96088..49ee95477 100644 --- a/Core/include/Acts/Material/SurfaceMaterial.hpp +++ b/Core/include/Acts/Material/SurfaceMaterial.hpp @@ -96,7 +96,9 @@ inline double SurfaceMaterial::factor(NavigationDirection pDir, MaterialUpdateStage mStage) const { - if (mStage == Acts::fullUpdate) return 1.; + if (mStage == Acts::fullUpdate) { + return 1.; + } return (pDir * mStage > 0 ? m_splitFactor : 1. - m_splitFactor); } diff --git a/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp b/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp index 5dda23f1f..6c13799d1 100644 --- a/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp +++ b/Core/include/Acts/Propagator/detail/ConstrainedStep.hpp @@ -46,8 +46,9 @@ namespace detail { void update(const double& value, Type type) { - if (type != aborter || (direction * values[type] > direction * value)) + if (type != aborter || (direction * values[type] > direction * value)) { values[type] = value; + } } /// release a certain constraint value @@ -91,8 +92,9 @@ namespace detail { /// depending on the direction operator double() const { - if (direction == forward) + if (direction == forward) { return (*std::min_element(values.begin(), values.end())); + } return (*std::max_element(values.begin(), values.end())); } diff --git a/Core/include/Acts/Propagator/detail/IntersectionCorrector.hpp b/Core/include/Acts/Propagator/detail/IntersectionCorrector.hpp index f56f43239..878e99271 100644 --- a/Core/include/Acts/Propagator/detail/IntersectionCorrector.hpp +++ b/Core/include/Acts/Propagator/detail/IntersectionCorrector.hpp @@ -47,7 +47,9 @@ namespace detail { operator()(Vector3D& pos, Vector3D& dir, double& path) { // approximation with straight line - if (path * path < straightLineStep * straightLineStep) return false; + if (path * path < straightLineStep * straightLineStep) { + return false; + } // no correction at start positions if (pathLength == 0. || pos.isApprox(startPos) || dir.isApprox(startDir)) { diff --git a/Core/include/Acts/Propagator/detail/StandardAbortConditions.hpp b/Core/include/Acts/Propagator/detail/StandardAbortConditions.hpp index aeb015035..d1d4ffbd4 100644 --- a/Core/include/Acts/Propagator/detail/StandardAbortConditions.hpp +++ b/Core/include/Acts/Propagator/detail/StandardAbortConditions.hpp @@ -106,13 +106,14 @@ namespace detail { }); // reaching the target means navigaiton break state.navigation.targetReached = true; - } else + } else { targetDebugLog(state, "o", [&] { std::stringstream dstream; dstream << "Target stepSize (path limit) updated to "; dstream << state.stepping.stepSize.toString(); return dstream.str(); }); + } // path limit check return limitReached; } @@ -142,7 +143,9 @@ namespace detail { bool operator()(propagator_state_t& state) const { - if (state.navigation.targetReached) return true; + if (state.navigation.targetReached) { + return true; + } // check if the cache filled the currentSurface if (state.navigation.currentSurface @@ -221,7 +224,9 @@ namespace detail { bool operator()(propagator_state_t& state) const { - if (state.navigation.currentVolume) return false; + if (state.navigation.currentVolume) { + return false; + } state.navigation.targetReached = true; return true; } diff --git a/Core/include/Acts/Seeding/BarrelSeedFinder.hpp b/Core/include/Acts/Seeding/BarrelSeedFinder.hpp index 051f1e796..592b47832 100644 --- a/Core/include/Acts/Seeding/BarrelSeedFinder.hpp +++ b/Core/include/Acts/Seeding/BarrelSeedFinder.hpp @@ -51,7 +51,9 @@ Acts::Seeding::findHelixSeeds(const HelixSeedConfig& cfg, Vector3D d12 = p2.position() - p1.position(); double theta12 = d12.theta(); - if (cfg.maxDeltaTheta < std::abs(theta12 - theta01)) continue; + if (cfg.maxDeltaTheta < std::abs(theta12 - theta01)) { + continue; + } double kappa = detail::calcCircleCurvature(d01, d12); // initial direction correction due to curvature, use diff --git a/Core/include/Acts/Seeding/detail/cyclic_range.hpp b/Core/include/Acts/Seeding/detail/cyclic_range.hpp index 99efc8276..82cf1540e 100644 --- a/Core/include/Acts/Seeding/detail/cyclic_range.hpp +++ b/Core/include/Acts/Seeding/detail/cyclic_range.hpp @@ -107,7 +107,9 @@ namespace detail { = std::lower_bound(values.begin(), values.end(), phi0, compValPhi); auto it1 = std::upper_bound(it0, values.end(), phi1, compPhiVal); // special value for empty range - if (it0 == it1) return {values, 0, 0}; + if (it0 == it1) { + return {values, 0, 0}; + } return {values, Index(std::distance(values.begin(), it0)), Index(std::distance(it0, it1))}; @@ -116,8 +118,9 @@ namespace detail { auto it1 = std::upper_bound(values.begin(), values.end(), phi1, compPhiVal); auto it0 = std::lower_bound(it1, values.end(), phi0, compValPhi); // wrap-around can be reduced to linear part - if (it0 == values.end()) + if (it0 == values.end()) { return {values, 0, Index(std::distance(values.begin(), it1))}; + } // full wrap-around w/ elements before and after end return {values, Index(std::distance(values.begin(), it0)), diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index b348b106c..68697bd99 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -194,10 +194,14 @@ public: const Surface* minSrf; for (size_t b = 0; b < nBins; ++b) { - if (!isValidBin(b)) continue; + if (!isValidBin(b)) { + continue; + } std::vector<const Surface*>& binContent = lookup(b); // only complete if we have an empty bin - if (binContent.size() > 0) continue; + if (binContent.size() > 0) { + continue; + } Vector3D binCtr = getBinCenter(b); minPath = std::numeric_limits<double>::max(); @@ -317,7 +321,9 @@ public: std::array<size_t, DIM> nBins = m_grid.getNBins(); for (size_t i = 0; i < indices.size(); ++i) { size_t idx = indices.at(i); - if (idx <= 0 || idx >= nBins.at(i) + 1) return false; + if (idx <= 0 || idx >= nBins.at(i) + 1) { + return false; + } } return true; @@ -329,7 +335,9 @@ public: { // calculate neighbors for every bin and store in map for (size_t i = 0; i < m_grid.size(); i++) { - if (!isValidBin(i)) continue; + if (!isValidBin(i)) { + continue; + } typename Grid_t::index_t loc = m_grid.getLocalBinIndices(i); std::set<size_t> neighborIdxs = m_grid.neighborHoodIndices(loc, 1u); std::vector<const Surface*>& neighbors = m_neighborMap.at(i); diff --git a/Core/include/Acts/Surfaces/SurfaceBounds.hpp b/Core/include/Acts/Surfaces/SurfaceBounds.hpp index 99d605376..502227a73 100644 --- a/Core/include/Acts/Surfaces/SurfaceBounds.hpp +++ b/Core/include/Acts/Surfaces/SurfaceBounds.hpp @@ -105,7 +105,9 @@ public: inline bool operator==(const SurfaceBounds& lhs, const SurfaceBounds& rhs) { - if (&lhs == &rhs) return true; + if (&lhs == &rhs) { + return true; + } return (lhs.type() == rhs.type()) && (lhs.valueStore() == rhs.valueStore()); } diff --git a/Core/include/Acts/Surfaces/detail/ConeSurface.ipp b/Core/include/Acts/Surfaces/detail/ConeSurface.ipp index 3369f7962..445bcebe6 100644 --- a/Core/include/Acts/Surfaces/detail/ConeSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/ConeSurface.ipp @@ -51,7 +51,9 @@ ConeSurface::intersectionEstimate(const Vector3D& gpos, - tan2Alpha * direction.z() * point1.z()), C = point1.x() * point1.x() + point1.y() * point1.y() - tan2Alpha * point1.z() * point1.z(); - if (A == 0.) A += 1e-16; // avoid division by zero + if (A == 0.) { + A += 1e-16; // avoid division by zero + } // use Andreas' quad solver, much more stable than what I wrote detail::RealQuadraticEquation solns(A, B, C); @@ -103,14 +105,18 @@ ConeSurface::intersectionEstimate(const Vector3D& gpos, direction = initialdir; if (correct(point1, direction, path)) { correctionDone = true; - } else + } else { break; - } else + } + } else { break; + } } while (true); // transform back if needed - if (m_transform) solution = transform() * solution; + if (m_transform) { + solution = transform() * solution; + } // check validity valid = bcheck ? (valid && isOnSurface(solution, bcheck)) : valid; // set the result navigation direction diff --git a/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp b/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp index 0b0b5c7d2..7eb8ea0b2 100644 --- a/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp @@ -58,7 +58,9 @@ CylinderSurface::intersectionEstimate(const Vector3D& gpos, // and solve the qaudratic equation - todo, validity check detail::RealQuadraticEquation qe(a, b, c); // check how many solution you have - if (!qe.solutions) return false; + if (!qe.solutions) { + return false; + } // chose the solution path = (!navDir || qe.first * qe.second > 0.) ? (qe.first * qe.first < qe.second * qe.second ? qe.first : qe.second) @@ -73,7 +75,9 @@ CylinderSurface::intersectionEstimate(const Vector3D& gpos, double R = bounds().r(); bool valid = solve(R); // if configured, correct and solve again - if (correct && correct(lpos, ldir, path)) valid = solve(R); + if (correct && correct(lpos, ldir, path)) { + valid = solve(R); + } // update for inside if requested : // @todo fix this : fast inside bounds check needed valid = bcheck ? (valid && isOnSurface(solution, bcheck)) : valid; diff --git a/Core/include/Acts/Surfaces/detail/DiscSurface.ipp b/Core/include/Acts/Surfaces/detail/DiscSurface.ipp index 27fca65c0..20672456a 100644 --- a/Core/include/Acts/Surfaces/detail/DiscSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/DiscSurface.ipp @@ -136,7 +136,9 @@ DiscSurface::intersectionEstimate(const Vector3D& gpos, // copy as the corrector may change them Vector3D lposc = gpos; Vector3D ldirc = gdir; - if (correct(lposc, ldirc, path)) valid = solve(lposc, ldirc); + if (correct(lposc, ldirc, path)) { + valid = solve(lposc, ldirc); + } } // evaluate (if necessary in terms of boundaries) // @todo: speed up isOnSurface - we know that it is on surface diff --git a/Core/include/Acts/Surfaces/detail/LineSurface.ipp b/Core/include/Acts/Surfaces/detail/LineSurface.ipp index 635737026..0da2cb1ed 100644 --- a/Core/include/Acts/Surfaces/detail/LineSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/LineSurface.ipp @@ -19,8 +19,9 @@ LineSurface::localToGlobal(const Vector2D& lpos, Vector3D radiusAxisGlobal(lineDirection().cross(mom)); Vector3D locZinGlobal(0., 0., lpos[eLOC_Z]); // apply a transform if needed - if (m_transform || m_associatedDetElement) + if (m_transform || m_associatedDetElement) { locZinGlobal = transform() * locZinGlobal; + } // transform zPosition into global coordinates and // add eLOC_R * radiusAxis gpos = Vector3D(locZinGlobal + lpos[eLOC_R] * radiusAxisGlobal.normalized()); @@ -48,9 +49,13 @@ inline bool LineSurface::isOnSurface(const Vector3D& gpos, const BoundaryCheck& bcheck) const { - if (!bcheck) return true; + if (!bcheck) { + return true; + } // check whether this is a boundless surface - if (!m_bounds && !Surface::m_associatedDetElement) return true; + if (!m_bounds && !Surface::m_associatedDetElement) { + return true; + } // get the standard bounds Vector3D loc3Dframe = (transform().inverse()) * gpos; Vector2D locCand(loc3Dframe.perp(), loc3Dframe.z()); @@ -101,7 +106,9 @@ LineSurface::normal(const Vector2D& /*lpos*/) const inline const SurfaceBounds& LineSurface::bounds() const { - if (m_bounds) return (*m_bounds.get()); + if (m_bounds) { + return (*m_bounds.get()); + } return s_noBounds; } @@ -142,8 +149,9 @@ LineSurface::intersectionEstimate(const Vector3D& gpos, result = (ma + u * ea); // if you have specified a navigation direction, valid mean path > 0. valid = (navDir * u >= 0); - } else + } else { valid = false; + } } // it just needs to be a insideBounds() check valid = bcheck ? (valid && isOnSurface(result, bcheck)) : valid; diff --git a/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp b/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp index e466bd6ba..b9bc28042 100644 --- a/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp @@ -62,7 +62,9 @@ PlaneSurface::intersectionEstimate(const Vector3D& gpos, // copy as the corrector may change them Vector3D lposc = gpos; Vector3D ldirc = gdir; - if (correct(lposc, ldirc, path)) valid = solve(lposc, ldirc); + if (correct(lposc, ldirc, path)) { + valid = solve(lposc, ldirc); + } } // evaluate (if necessary in terms of boundaries) // @todo: speed up isOnSurface - we know that it is on surface diff --git a/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp b/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp index 8ce54cd56..e338b4c80 100644 --- a/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp +++ b/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp @@ -133,10 +133,11 @@ struct VolumeConfig void attachZ(const VolumeConfig& lConfig) { - if (lConfig.zMin >= zMax) + if (lConfig.zMin >= zMax) { zMax = lConfig.zMin; - else + } else { zMin = lConfig.zMax; + } } /// Overlap check radially @@ -146,7 +147,9 @@ struct VolumeConfig bool overlapsInR(const VolumeConfig& vConfig) const { - if (!present) return false; + if (!present) { + return false; + } return std::max(rMin, vConfig.rMin) <= std::min(rMax, vConfig.rMax); } @@ -157,7 +160,9 @@ struct VolumeConfig bool overlapsInZ(const VolumeConfig& vConfig) const { - if (!present) return false; + if (!present) { + return false; + } return std::max(zMin, vConfig.zMin) <= std::min(zMax, vConfig.zMax); } @@ -168,7 +173,9 @@ struct VolumeConfig bool wraps(const VolumeConfig& vConfig) const { - if ((zMax <= vConfig.zMin) || (zMin >= vConfig.zMax)) return true; + if ((zMax <= vConfig.zMin) || (zMin >= vConfig.zMax)) { + return true; + } return containsInR(vConfig); } @@ -268,12 +275,16 @@ public: wConditionScreen += "[p]"; } // adapt the external one - if (externalVolumeConfig) containerVolumeConfig.adapt(externalVolumeConfig); + if (externalVolumeConfig) { + containerVolumeConfig.adapt(externalVolumeConfig); + } // attach the volume configs - if (nVolumeConfig && cVolumeConfig) + if (nVolumeConfig && cVolumeConfig) { nVolumeConfig.midPointAttachZ(cVolumeConfig); - if (cVolumeConfig && pVolumeConfig) + } + if (cVolumeConfig && pVolumeConfig) { cVolumeConfig.midPointAttachZ(pVolumeConfig); + } // adapt r afterwards // - easy if no exisitng volume // - possible if no central volume @@ -401,10 +412,11 @@ public: fGapVolumeConfig.zMax = existingVolumeConfig.zMin; } else { // adapt lower z boundary - if (nVolumeConfig) + if (nVolumeConfig) { nVolumeConfig.zMin = existingVolumeConfig.zMin; - else if (cVolumeConfig) + } else if (cVolumeConfig) { cVolumeConfig.zMin = existingVolumeConfig.zMin; + } } // - at the positive sector if (existingVolumeConfig.zMax < referenceVolume.zMax) { @@ -414,10 +426,11 @@ public: sGapVolumeConfig.zMax = referenceVolume.zMax; } else { // adapt higher z boundary - if (pVolumeConfig) + if (pVolumeConfig) { pVolumeConfig.zMax = existingVolumeConfig.zMax; - else if (cVolumeConfig) + } else if (cVolumeConfig) { cVolumeConfig.zMax = existingVolumeConfig.zMax; + } } } } @@ -430,28 +443,34 @@ public: { // for screen output std::stringstream sl; - if (containerVolumeConfig) + if (containerVolumeConfig) { sl << "New contaienr built with configuration: " << containerVolumeConfig.toString() << '\n'; + } // go throug the new new ones first - if (nVolumeConfig) + if (nVolumeConfig) { sl << " - n: Negative Endcap, current configuration: " << nVolumeConfig.toString() << '\n'; - if (cVolumeConfig) + } + if (cVolumeConfig) { sl << " - c: Barrel, current configuration: " << cVolumeConfig.toString() << '\n'; - if (pVolumeConfig) + } + if (pVolumeConfig) { sl << " - p: Negative Endcap, current configuration: " << pVolumeConfig.toString() << '\n'; + } if (existingVolumeConfig) { sl << "Existing volume with configuration: " << existingVolumeConfig.toString() << '\n'; - if (fGapVolumeConfig) + if (fGapVolumeConfig) { sl << " - g1: First gap volume, configuration : " << fGapVolumeConfig.toString() << '\n'; - if (sGapVolumeConfig) + } + if (sGapVolumeConfig) { sl << " - g2: Second gap volume, configuration : " << sGapVolumeConfig.toString() << '\n'; + } if (wCondition != Undefined) { sl << "WrappingCondition = " << wCondition << '\n'; } diff --git a/Core/include/Acts/Tools/SurfaceArrayCreator.hpp b/Core/include/Acts/Tools/SurfaceArrayCreator.hpp index 18e806716..ad10a09d8 100644 --- a/Core/include/Acts/Tools/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Tools/SurfaceArrayCreator.hpp @@ -243,15 +243,17 @@ public: return std::abs(dPhi) < M_PI / 180.; } - if (bValue == Acts::binZ) + if (bValue == Acts::binZ) { return ( std::abs(a->binningPosition(binR).z() - b->binningPosition(binR).z()) < Acts::units::_um); + } - if (bValue == Acts::binR) + if (bValue == Acts::binR) { return (std::abs(a->binningPosition(binR).perp() - b->binningPosition(binR).perp()) < Acts::units::_um); + } return false; } diff --git a/Core/include/Acts/Utilities/BinUtility.hpp b/Core/include/Acts/Utilities/BinUtility.hpp index 9ce0eb818..15381cdee 100644 --- a/Core/include/Acts/Utilities/BinUtility.hpp +++ b/Core/include/Acts/Utilities/BinUtility.hpp @@ -147,8 +147,9 @@ public: // only this BU has transform, just keep it. //} - if (m_binningData.size() + bData.size() > 3) + if (m_binningData.size() + bData.size() > 3) { throw "BinUtility does not support dim > 3"; + } m_binningData.insert(m_binningData.end(), bData.begin(), bData.end()); return (*this); } @@ -209,7 +210,9 @@ public: size_t bin(const Vector3D& position, size_t ba = 0) const { - if (ba >= m_binningData.size()) return 0; + if (ba >= m_binningData.size()) { + return 0; + } size_t bEval = m_itransform ? m_binningData[ba].searchGlobal((*m_itransform) * position) : m_binningData[ba].searchGlobal(position); @@ -229,15 +232,20 @@ public: std::vector<size_t> neighbourRange(const Vector3D& position, size_t ba = 0) const { - if (ba >= m_binningData.size()) return {0}; + if (ba >= m_binningData.size()) { + return {0}; + } std::vector<size_t> neighbourRange; size_t cbin = bin(position, ba); size_t pbin = cbin; size_t nbin = cbin; - if (m_binningData[ba].decrement(pbin)) neighbourRange.push_back(pbin); + if (m_binningData[ba].decrement(pbin)) { + neighbourRange.push_back(pbin); + } neighbourRange.push_back(cbin); - if (m_binningData[ba].increment(nbin) && nbin != pbin) + if (m_binningData[ba].increment(nbin) && nbin != pbin) { neighbourRange.push_back(nbin); + } return neighbourRange; } @@ -255,7 +263,9 @@ public: const Vector3D& direction, size_t ba = 0) const { - if (ba >= m_binningData.size()) return 0; + if (ba >= m_binningData.size()) { + return 0; + } return m_binningData[ba].nextDirection(position, direction); } @@ -273,7 +283,9 @@ public: size_t bin(const Vector2D& lposition, size_t ba = 0) const { - if (ba >= m_binningData.size()) return 0; + if (ba >= m_binningData.size()) { + return 0; + } return m_binningData[ba].searchLocal(lposition); } /// Check if bin is inside from Vector2D - optional transform applied @@ -287,8 +299,11 @@ public: const Vector3D& bPosition = m_itransform ? Vector3D((*m_itransform) * position) : position; // loop and break - for (auto& bData : m_binningData) - if (!(bData.inside(bPosition))) return false; + for (auto& bData : m_binningData) { + if (!(bData.inside(bPosition))) { + return false; + } + } // survived all the checks return true; } @@ -302,8 +317,11 @@ public: { return true; std::vector<BinningData>::const_iterator bdIter = m_binningData.begin(); - for (; bdIter != m_binningData.end(); ++bdIter) - if (!(*bdIter).inside(lposition)) return false; + for (; bdIter != m_binningData.end(); ++bdIter) { + if (!(*bdIter).inside(lposition)) { + return false; + } + } return true; } @@ -323,7 +341,9 @@ public: size_t max(size_t ba = 0) const { - if (ba >= m_binningData.size()) return 0; + if (ba >= m_binningData.size()) { + return 0; + } return (m_binningData[ba].bins() - 1); } @@ -335,7 +355,9 @@ public: size_t bins(size_t ba) const { - if (ba >= m_binningData.size()) return 1; + if (ba >= m_binningData.size()) { + return 1; + } return (m_binningData[ba].bins()); } @@ -356,7 +378,9 @@ public: BinningValue binningValue(size_t ba = 0) const { - if (ba >= m_binningData.size()) throw "dimension out of bounds"; + if (ba >= m_binningData.size()) { + throw "dimension out of bounds"; + } return (m_binningData[ba].binvalue); } @@ -394,12 +418,14 @@ public: sl << " - bins : " << (*bdIter).bins() << std::endl; sl << " - min/max : " << (*bdIter).min << " / " << (*bdIter).max << std::endl; - if ((*bdIter).type == equidistant) + if ((*bdIter).type == equidistant) { sl << " - step : " << (*bdIter).step << std::endl; + } sl << " - boundaries : | "; std::vector<float>::const_iterator bIter = (*bdIter).boundaries().begin(); - for (; bIter != (*bdIter).boundaries().end(); ++bIter) + for (; bIter != (*bdIter).boundaries().end(); ++bIter) { sl << (*bIter) << " | "; + } sl << std::endl; } return sl; diff --git a/Core/include/Acts/Utilities/BinnedArrayXD.hpp b/Core/include/Acts/Utilities/BinnedArrayXD.hpp index 67a7627ce..03d3d0893 100644 --- a/Core/include/Acts/Utilities/BinnedArrayXD.hpp +++ b/Core/include/Acts/Utilities/BinnedArrayXD.hpp @@ -78,8 +78,9 @@ public: 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()) + == m_arrayObjects.end()) { m_arrayObjects.push_back(tap.first); + } } } } @@ -101,16 +102,19 @@ public: /// reserve the right amount of data m_arrayObjects.reserve(objects); /// loop over the object & position for ordering - for (auto& o2 : m_objectGrid) - for (auto& o1 : o2) + for (auto& o2 : m_objectGrid) { + for (auto& o1 : o2) { for (auto& o0 : o1) { if (o0) { /// fill the unique m_arrayObjects if (std::find(m_arrayObjects.begin(), m_arrayObjects.end(), o0) - == m_arrayObjects.end()) + == m_arrayObjects.end()) { m_arrayObjects.push_back(o0); + } } } + } + } } /// Copy constructor @@ -230,16 +234,19 @@ public: = m_binUtility->binningData()[0].neighbourRange(binTriple[0]); // do the loop - for (auto b2 : bin2values) - for (auto b1 : bin1values) + for (auto b2 : bin2values) { + for (auto b1 : bin1values) { for (auto b0 : bin0values) { // get the object T object = m_objectGrid[b2][b1][b0]; if (object && object != bObject && std::find(rvector.begin(), rvector.end(), object) - == rvector.end()) + == rvector.end()) { rvector.push_back(object); + } } + } + } // return the ones you found return rvector; } diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index 470d30a37..401681831 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -112,8 +112,9 @@ public: m_functionPtr = &searchEquidistantWithBoundary; // fill the boundary vector for fast access to center & boundaries m_boundaries.reserve(m_bins + 1); - for (size_t ib = 0; ib < m_bins + 1; ++ib) + for (size_t ib = 0; ib < m_bins + 1; ++ib) { m_boundaries.push_back(min + ib * step); + } // the binning data has sub structure - multiplicative or additive checkSubStructure(); } @@ -179,11 +180,12 @@ public: : nullptr; // set the pointer depending on the type // set the correct function pointer - if (type == equidistant) + if (type == equidistant) { m_functionPtr = &searchEquidistantWithBoundary; - else + } else { m_functionPtr = m_bins < 50 ? &searchInVectorWithBoundary : &binarySearchWithBoundary; + } } /// Assignment operator @@ -209,11 +211,12 @@ public: m_totalBins = bdata.m_totalBins; m_totalBoundaries = bdata.m_totalBoundaries; // set the correct function pointer - if (type == equidistant) + if (type == equidistant) { m_functionPtr = &searchEquidistantWithBoundary; - else + } else { m_functionPtr = m_bins < 50 ? &searchInVectorWithBoundary : &binarySearchWithBoundary; + } } return (*this); } @@ -256,7 +259,9 @@ public: const std::vector<float>& boundaries() const { - if (subBinningData) return m_totalBoundaries; + if (subBinningData) { + return m_totalBoundaries; + } return m_boundaries; } @@ -270,9 +275,12 @@ public: { // ordered after occurence if (binvalue == binR || binvalue == binRPhi || binvalue == binX - || binvalue == binH) + || binvalue == binH) { return lposition[0]; - if (binvalue == binPhi) return lposition[1]; + } + if (binvalue == binPhi) { + return lposition[1]; + } return lposition[1]; } @@ -285,10 +293,18 @@ public: value(const Vector3D& position) const { // ordered after occurence - if (binvalue == binR || binvalue == binH) return (position.perp()); - if (binvalue == binRPhi) return (position.perp() * position.phi()); - if (binvalue == binEta) return (position.eta()); - if (binvalue < 3) return (position[binvalue]); + if (binvalue == binR || binvalue == binH) { + return (position.perp()); + } + if (binvalue == binRPhi) { + return (position.perp() * position.phi()); + } + if (binvalue == binEta) { + return (position.eta()); + } + if (binvalue < 3) { + return (position[binvalue]); + } // phi gauging return position.phi(); } @@ -316,7 +332,9 @@ public: inside(const Vector3D& position) const { // closed one is always inside - if (option == closed) return true; + if (option == closed) { + return true; + } // all other options // @todo remove hard-coded tolerance parameters float val = value(position); @@ -332,7 +350,9 @@ public: inside(const Vector2D& lposition) const { // closed one is always inside - if (option == closed) return true; + if (option == closed) { + return true; + } // all other options // @todo remove hard-coded tolerance parameters float val = value(lposition); @@ -347,7 +367,9 @@ public: size_t searchLocal(const Vector2D& lposition) const { - if (zdim) return 0; + if (zdim) { + return 0; + } return search(value(lposition)); } @@ -359,7 +381,9 @@ public: size_t searchGlobal(const Vector3D& position) const { - if (zdim) return 0; + if (zdim) { + return 0; + } return search(value(position)); } @@ -371,7 +395,9 @@ public: size_t search(float value) const { - if (zdim) return 0; + if (zdim) { + return 0; + } assert(m_functionPtr != nullptr); return (!subBinningData) ? (*m_functionPtr)(value, *this) : searchWithSubStructure(value); @@ -412,7 +438,9 @@ public: int nextDirection(const Vector3D& position, const Vector3D& dir) const { - if (zdim) return 0; + if (zdim) { + return 0; + } float val = value(position); Vector3D probe = position + dir.normalized(); float nextval = value(probe); @@ -429,7 +457,9 @@ public: float centerValue(size_t bin) const { - if (zdim) return 0.5 * (min + max); + if (zdim) { + return 0.5 * (min + max); + } float bmin = m_boundaries[bin]; float bmax = bin < m_boundaries.size() ? m_boundaries[bin + 1] : max; return 0.5 * (bmin + bmax); @@ -449,9 +479,13 @@ public: bool dsucc = decrement(low); bool isucc = increment(high); // both worked -> triple range - if (dsucc && isucc) return {low, bin, high}; + if (dsucc && isucc) { + return {low, bin, high}; + } // one worked -> double range - if (dsucc || isucc) return {low, high}; + if (dsucc || isucc) { + return {low, high}; + } // none worked -> single bin return {bin}; } @@ -491,8 +525,9 @@ private: subBinBoundaries.begin(), subBinBoundaries.end()); ++mbvalue; - } else + } else { m_totalBoundaries.push_back(*mbvalue); + } } } else { // (B) multiplicative sub structure // every bin is just repaced by the sub binning structure @@ -505,8 +540,9 @@ private: m_totalBoundaries.push_back(min); for (size_t ib = 0; ib < m_bins; ++ib) { float offset = ib * step; - for (size_t isb = 1; isb < subBinBoundaries.size(); ++isb) + for (size_t isb = 1; isb < subBinBoundaries.size(); ++isb) { m_totalBoundaries.push_back(offset + subBinBoundaries[isb]); + } } } // sort the total boundary vector @@ -525,8 +561,12 @@ private: int bin = ((value - bData.min) / bData.step); // special treatment of the 0 bin for closed if (bData.option == closed) { - if (value < bData.min) return (bData.m_bins - 1); - if (value > bData.max) return 0; + if (value < bData.min) { + return (bData.m_bins - 1); + } + if (value > bData.max) { + return 0; + } } // if outside boundary : return boundary for open, opposite bin for closed bin = bin < 0 ? ((bData.option == open) ? 0 : (bData.m_bins - 1)) : bin; @@ -545,13 +585,17 @@ private: return (bData.option == closed) ? (bData.m_bins - 1) : 0; } // higher boundary - if (value >= bData.max) + if (value >= bData.max) { return (bData.option == closed) ? 0 : (bData.m_bins - 1); + } // search auto vIter = bData.m_boundaries.begin(); size_t bin = 0; - for (; vIter != bData.m_boundaries.end(); ++vIter, ++bin) - if ((*vIter) > value) break; + for (; vIter != bData.m_boundaries.end(); ++vIter, ++bin) { + if ((*vIter) > value) { + break; + } + } return (bin - 1); } @@ -561,21 +605,27 @@ private: binarySearchWithBoundary(float value, const BinningData& bData) { // Binary search in an array of n values to locate value - if (value <= bData.m_boundaries[0]) + if (value <= bData.m_boundaries[0]) { return (bData.option == closed) ? (bData.m_bins - 1) : 0; + } size_t nabove, nbelow, middle; // overflow nabove = bData.m_boundaries.size(); - if (value >= bData.max) return (bData.option == closed) ? 0 : nabove - 2; + if (value >= bData.max) { + return (bData.option == closed) ? 0 : nabove - 2; + } // binary search nbelow = 0; while (nabove - nbelow > 1) { middle = (nabove + nbelow) / 2; - if (value == bData.m_boundaries[middle - 1]) return middle - 1; - if (value < bData.m_boundaries[middle - 1]) + if (value == bData.m_boundaries[middle - 1]) { + return middle - 1; + } + if (value < bData.m_boundaries[middle - 1]) { nabove = middle; - else + } else { nbelow = middle; + } } return nbelow - 1; } diff --git a/Core/include/Acts/Utilities/GeometryID.hpp b/Core/include/Acts/Utilities/GeometryID.hpp index e4d574e18..858d66e3b 100644 --- a/Core/include/Acts/Utilities/GeometryID.hpp +++ b/Core/include/Acts/Utilities/GeometryID.hpp @@ -130,7 +130,9 @@ private: inline geo_id_value GeometryID::value(geo_id_value mask) const { - if (mask) return ACTS_BIT_DECODE(m_value, mask); + if (mask) { + return ACTS_BIT_DECODE(m_value, mask); + } return m_value; } diff --git a/Core/include/Acts/Utilities/GeometryObject.hpp b/Core/include/Acts/Utilities/GeometryObject.hpp index b354cb1e8..1d6c413c0 100644 --- a/Core/include/Acts/Utilities/GeometryObject.hpp +++ b/Core/include/Acts/Utilities/GeometryObject.hpp @@ -47,7 +47,9 @@ public: GeometryObject& operator=(const GeometryObject& geoID) { - if (&geoID != this) m_geoID = geoID.m_geoID; + if (&geoID != this) { + m_geoID = geoID.m_geoID; + } return *this; } diff --git a/Core/include/Acts/Utilities/Helpers.hpp b/Core/include/Acts/Utilities/Helpers.hpp index 99a8afac3..4cedac3d1 100644 --- a/Core/include/Acts/Utilities/Helpers.hpp +++ b/Core/include/Acts/Utilities/Helpers.hpp @@ -55,7 +55,9 @@ namespace Acts { inline double roundWithPrecision(double val, int precision) { - if (val < 0 && std::abs(val) * std::pow(10, precision) < 1.) return -val; + if (val < 0 && std::abs(val) * std::pow(10, precision) < 1.) { + return -val; + } return val; } @@ -70,19 +72,24 @@ toString(const ActsMatrixXd& matrix, int precision = 4, std::string offset = "") for (int i = 0; i < matrix.rows(); ++i) { double val = roundWithPrecision(matrix(i, 0), precision); sout << val; - if (i != matrix.rows() - 1) sout << ", "; + if (i != matrix.rows() - 1) { + sout << ", "; + } } sout << ")"; } else { for (int i = 0; i < matrix.rows(); ++i) { for (int j = 0; j < matrix.cols(); ++j) { - if (j == 0) sout << "("; + if (j == 0) { + sout << "("; + } double val = roundWithPrecision(matrix(i, j), precision); sout << val; - if (j == matrix.cols() - 1) + if (j == matrix.cols() - 1) { sout << ")"; - else + } else { sout << ", "; + } } if (i != matrix.rows() @@ -125,8 +132,12 @@ angle(const Acts::Vector3D& v1, const Acts::Vector3D& v2) { double dp = v1.dot(v2); dp /= v1.mag() * v2.mag(); - if (dp > 1) dp = 1; - if (dp < -1) dp = -1; + if (dp > 1) { + dp = 1; + } + if (dp < -1) { + dp = -1; + } return acos(dp); } @@ -269,12 +280,24 @@ getAngleAxisFromRotation(Acts::RotationMatrix3D& rotation, rotationAxis = Acts::Vector3D(0, 0, 1); } else { double x = 0, y = 0, z = 0; - if (xx > cosa) x = sqrt((xx - cosa) / cosa1); - if (yy > cosa) y = sqrt((yy - cosa) / cosa1); - if (zz > cosa) z = sqrt((zz - cosa) / cosa1); - if (rotation(2, 1) < rotation(1, 2)) x = -x; - if (rotation(0, 2) < rotation(2, 0)) y = -y; - if (rotation(1, 0) < rotation(0, 1)) z = -z; + if (xx > cosa) { + x = sqrt((xx - cosa) / cosa1); + } + if (yy > cosa) { + y = sqrt((yy - cosa) / cosa1); + } + if (zz > cosa) { + z = sqrt((zz - cosa) / cosa1); + } + if (rotation(2, 1) < rotation(1, 2)) { + x = -x; + } + if (rotation(0, 2) < rotation(2, 0)) { + y = -y; + } + if (rotation(1, 0) < rotation(0, 1)) { + z = -z; + } rotationAngle = (cosa < -1.) ? acos(-1.) : acos(cosa); rotationAxis = Acts::Vector3D(x, y, z); } diff --git a/Core/include/Acts/Utilities/Intersection.hpp b/Core/include/Acts/Utilities/Intersection.hpp index caf6cc5a3..1473221d8 100644 --- a/Core/include/Acts/Utilities/Intersection.hpp +++ b/Core/include/Acts/Utilities/Intersection.hpp @@ -61,9 +61,13 @@ struct Intersection bool operator<(const Intersection& si) const { - if (!valid) return false; + if (!valid) { + return false; + } // now check the pathLenght - if (si.valid) return (pathLength < si.pathLength); + if (si.valid) { + return (pathLength < si.pathLength); + } // the current path length wins return true; } @@ -74,9 +78,13 @@ struct Intersection bool operator>(const Intersection& si) const { - if (!valid) return false; + if (!valid) { + return false; + } // now check the pathLenght - if (si.valid) return (pathLength > si.pathLength); + if (si.valid) { + return (pathLength > si.pathLength); + } // the current path length wins return true; } diff --git a/Core/include/Acts/Utilities/ParameterTypes.hpp b/Core/include/Acts/Utilities/ParameterTypes.hpp index e629a1fcd..602d4fdc3 100644 --- a/Core/include/Acts/Utilities/ParameterTypes.hpp +++ b/Core/include/Acts/Utilities/ParameterTypes.hpp @@ -128,10 +128,11 @@ struct cyclic_parameter static U getValue(const U& input) { - if (min <= input && input < max) + if (min <= input && input < max) { return input; - else + } else { return input - (max - min) * std::floor((input - min) / (max - min)); + } } template <typename U> diff --git a/Core/include/Acts/Utilities/VariantData.hpp b/Core/include/Acts/Utilities/VariantData.hpp index f137464de..61f6ae89d 100644 --- a/Core/include/Acts/Utilities/VariantData.hpp +++ b/Core/include/Acts/Utilities/VariantData.hpp @@ -85,8 +85,9 @@ public: T& get(const std::string& key) { - if (!m_map.count(key)) + if (!m_map.count(key)) { throw std::out_of_range("variant_map key " + key + " not found"); + } return boost::get<T>(m_map.at(key)); } @@ -98,8 +99,9 @@ public: const T& get(const std::string& key) const { - if (!m_map.count(key)) + if (!m_map.count(key)) { throw std::out_of_range("variant_map key " + key + " not found"); + } return boost::get<T>(m_map.at(key)); } @@ -389,7 +391,9 @@ public: operator()(const variant_map& map) { m_json_str << "{"; - if (m_pretty) m_json_str << std::endl; + if (m_pretty) { + m_json_str << std::endl; + } size_t i = 0; m_depth += 1; @@ -400,13 +404,17 @@ public: if (i < map.size() - 1) { m_json_str << ", "; - if (m_pretty) m_json_str << std::endl; + if (m_pretty) { + m_json_str << std::endl; + } } ++i; } m_depth -= 1; - if (m_pretty) m_json_str << std::endl; + if (m_pretty) { + m_json_str << std::endl; + } indent(); m_json_str << "}"; } @@ -417,7 +425,9 @@ public: operator()(const variant_vector& vec) { m_json_str << "["; - if (m_pretty) m_json_str << std::endl; + if (m_pretty) { + m_json_str << std::endl; + } size_t i = 0; m_depth += 1; for (const auto& entry : vec) { @@ -425,13 +435,17 @@ public: boost::apply_visitor(*this, entry); if (i < vec.size() - 1) { m_json_str << ", "; - if (m_pretty) m_json_str << std::endl; + if (m_pretty) { + m_json_str << std::endl; + } } ++i; } m_depth -= 1; - if (m_pretty) m_json_str << std::endl; + if (m_pretty) { + m_json_str << std::endl; + } indent(); m_json_str << "]"; } diff --git a/Core/include/Acts/Utilities/detail/Axis.hpp b/Core/include/Acts/Utilities/detail/Axis.hpp index b2a1542e8..5e0fe1059 100644 --- a/Core/include/Acts/Utilities/detail/Axis.hpp +++ b/Core/include/Acts/Utilities/detail/Axis.hpp @@ -152,7 +152,9 @@ namespace detail { std::pair<size_t, size_t> sizes = {1, 1}) const { std::set<size_t> result; - if (idx <= 0 || idx >= (getNBins() + 1)) return result; + if (idx <= 0 || idx >= (getNBins() + 1)) { + return result; + } constexpr int min = 1; const int max = getNBins(); const int itmin = std::max(min, int(idx - sizes.first)); @@ -179,7 +181,9 @@ namespace detail { std::pair<size_t, size_t> sizes = {1, 1}) const { std::set<size_t> result; - if (idx <= 0 || idx >= (getNBins() + 1)) return result; + if (idx <= 0 || idx >= (getNBins() + 1)) { + return result; + } const int itmin = idx - sizes.first; const int itmax = idx + sizes.second; for (int i = itmin; i <= itmax; i++) { @@ -464,7 +468,9 @@ namespace detail { std::pair<size_t, size_t> sizes = {1, 1}) const { std::set<size_t> result; - if (idx <= 0 || idx >= (getNBins() + 1)) return result; + if (idx <= 0 || idx >= (getNBins() + 1)) { + return result; + } constexpr int min = 1; const int max = getNBins(); const int itmin = std::max(min, int(idx - sizes.first)); @@ -491,7 +497,9 @@ namespace detail { std::pair<size_t, size_t> sizes = {1, 1}) const { std::set<size_t> result; - if (idx <= 0 || idx >= (getNBins() + 1)) return result; + if (idx <= 0 || idx >= (getNBins() + 1)) { + return result; + } const int itmin = idx - sizes.first; const int itmax = idx + sizes.second; for (int i = itmin; i <= itmax; i++) { diff --git a/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp b/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp index 112b14b6a..0fa08f597 100644 --- a/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp +++ b/Core/include/Acts/Utilities/detail/RealQuadraticEquation.hpp @@ -59,9 +59,9 @@ namespace detail { : first(0.), second(0.) { double discriminant = beta * beta - 4 * alpha * gamma; - if (discriminant < 0) + if (discriminant < 0) { solutions = 0; - else { + } else { solutions = (discriminant == 0) ? 1 : 2; double q = -0.5 * (beta + (beta > 0 ? std::sqrt(discriminant) : -std::sqrt(discriminant))); diff --git a/Core/include/Acts/Utilities/detail/interpolation_impl.hpp b/Core/include/Acts/Utilities/detail/interpolation_impl.hpp index bc4d99c61..dcb647cd5 100644 --- a/Core/include/Acts/Utilities/detail/interpolation_impl.hpp +++ b/Core/include/Acts/Utilities/detail/interpolation_impl.hpp @@ -129,8 +129,9 @@ namespace detail { const double f = (pos[D] - lowerLeft[D]) / (upperRight[D] - lowerLeft[D]); std::array<T, (N >> 1)> newFields; - for (size_t i = 0; i < N / 2; ++i) + for (size_t i = 0; i < N / 2; ++i) { newFields.at(i) = (1 - f) * fields.at(2 * i) + f * fields.at(2 * i + 1); + } return interpolate_impl<T, Point1, Point2, Point3, D - 1, (N >> 1)>::run( pos, lowerLeft, upperRight, newFields); diff --git a/Core/include/Acts/Volumes/BoundarySurfaceT.hpp b/Core/include/Acts/Volumes/BoundarySurfaceT.hpp index b74350a51..32a50735a 100644 --- a/Core/include/Acts/Volumes/BoundarySurfaceT.hpp +++ b/Core/include/Acts/Volumes/BoundarySurfaceT.hpp @@ -181,10 +181,11 @@ template <class T> void BoundarySurfaceT<T>::attachVolume(VolumePtr volume, BoundaryOrientation inout) { - if (inout == insideVolume) + if (inout == insideVolume) { m_insideVolume = volume.get(); - else + } else { m_outsideVolume = volume.get(); + } } template <class T> @@ -193,10 +194,11 @@ BoundarySurfaceT<T>::attachVolumeArray( const std::shared_ptr<const VolumeArray> volumes, BoundaryOrientation inout) { - if (inout == insideVolume) + if (inout == insideVolume) { m_insideVolumeArray = volumes; - else + } else { m_outsideVolumeArray = volumes; + } } template <class T> @@ -207,12 +209,13 @@ BoundarySurfaceT<T>::attachedVolume(const Vector3D& pos, { const T* attVolume = nullptr; // dot product with normal vector to distinguish inside/outside - if ((surfaceRepresentation().normal(pos)).dot(pdir * mom) > 0.) + if ((surfaceRepresentation().normal(pos)).dot(pdir * mom) > 0.) { attVolume = m_outsideVolumeArray ? m_outsideVolumeArray->object(pos).get() : m_outsideVolume; - else + } else { attVolume = m_insideVolumeArray ? m_insideVolumeArray->object(pos).get() : m_insideVolume; + } return attVolume; } } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Volumes/CylinderVolumeBounds.hpp b/Core/include/Acts/Volumes/CylinderVolumeBounds.hpp index 40cd30810..2b7e8cc52 100644 --- a/Core/include/Acts/Volumes/CylinderVolumeBounds.hpp +++ b/Core/include/Acts/Volumes/CylinderVolumeBounds.hpp @@ -231,16 +231,21 @@ CylinderVolumeBounds::inside(const Vector3D& pos, double tol) const inline Vector3D CylinderVolumeBounds::binningOffset(BinningValue bValue) const { // the medium radius is taken for r-type binning - if (bValue == Acts::binR || bValue == Acts::binRPhi) + if (bValue == Acts::binR || bValue == Acts::binRPhi) { return Vector3D(mediumRadius(), 0., 0.); + } return VolumeBounds::binningOffset(bValue); } inline double CylinderVolumeBounds::binningBorder(BinningValue bValue) const { // the medium radius is taken for r-type binning - if (bValue == Acts::binR) return 0.5 * deltaRadius(); - if (bValue == Acts::binZ) return halflengthZ(); + if (bValue == Acts::binR) { + return 0.5 * deltaRadius(); + } + if (bValue == Acts::binZ) { + return halflengthZ(); + } return VolumeBounds::binningBorder(bValue); } diff --git a/Core/include/Acts/Volumes/Volume.hpp b/Core/include/Acts/Volumes/Volume.hpp index cf70269b8..f19595b53 100644 --- a/Core/include/Acts/Volumes/Volume.hpp +++ b/Core/include/Acts/Volumes/Volume.hpp @@ -98,7 +98,9 @@ protected: inline const Transform3D& Volume::transform() const { - if (m_transform) return (*(m_transform.get())); + if (m_transform) { + return (*(m_transform.get())); + } return Acts::s_idTransform; } diff --git a/Core/src/Detector/DetachedTrackingVolume.cpp b/Core/src/Detector/DetachedTrackingVolume.cpp index 255873bb3..b99ba8420 100644 --- a/Core/src/Detector/DetachedTrackingVolume.cpp +++ b/Core/src/Detector/DetachedTrackingVolume.cpp @@ -67,9 +67,9 @@ Acts::DetachedTrackingVolume::geometryType() const void Acts::DetachedTrackingVolume::setBaseTransform(const Acts::Transform3D* transf) { - if (transf) + if (transf) { m_baseTransform = transf; - else { + } else { delete m_baseTransform; m_baseTransform = new Acts::Transform3D(this->trackingVolume()->transform()); diff --git a/Core/src/Detector/GlueVolumesDescriptor.cpp b/Core/src/Detector/GlueVolumesDescriptor.cpp index 55c52ab46..114d7b182 100644 --- a/Core/src/Detector/GlueVolumesDescriptor.cpp +++ b/Core/src/Detector/GlueVolumesDescriptor.cpp @@ -19,7 +19,9 @@ Acts::GlueVolumesDescriptor::GlueVolumesDescriptor( : m_glueVolumes(gvs) { // fill the available faces - for (auto& gvIter : m_glueVolumes) m_glueFaces.push_back(gvIter.first); + for (auto& gvIter : m_glueVolumes) { + m_glueFaces.push_back(gvIter.first); + } } void @@ -29,7 +31,9 @@ Acts::GlueVolumesDescriptor::registerGlueVolumes( { // register the face auto searchIter = m_glueVolumes.find(bsf); - if (searchIter == m_glueVolumes.end()) m_glueFaces.push_back(bsf); + if (searchIter == m_glueVolumes.end()) { + m_glueFaces.push_back(bsf); + } // simple assignment overwrites already existing entries m_glueVolumes[bsf] = gvs; //!< @todo change to addGlueVolumes principle } @@ -39,7 +43,9 @@ Acts::GlueVolumesDescriptor::glueVolumes(Acts::BoundarySurfaceFace bsf) const { // searching for the glue volumes according auto searchIter = m_glueVolumes.find(bsf); - if (searchIter != m_glueVolumes.end()) return searchIter->second; + if (searchIter != m_glueVolumes.end()) { + return searchIter->second; + } return nullptr; } @@ -59,9 +65,10 @@ Acts::GlueVolumesDescriptor::screenOutput() const sl << " -----> Processing Face: " << int(gFace) << " - has "; sl << glueVolumesVector.size() << " TrackingVolumes marked as 'GlueVolumes' " << std::endl; - for (auto& glueVolume : glueVolumesVector) + for (auto& glueVolume : glueVolumesVector) { sl << " - TrackingVolume: " << glueVolume->volumeName() << std::endl; + } } return sl.str(); } diff --git a/Core/src/Detector/TrackingGeometry.cpp b/Core/src/Detector/TrackingGeometry.cpp index 861adfc8c..f5dd84243 100644 --- a/Core/src/Detector/TrackingGeometry.cpp +++ b/Core/src/Detector/TrackingGeometry.cpp @@ -47,7 +47,9 @@ Acts::TrackingGeometry::lowestDetachedTrackingVolumes(const Vector3D& gp) const { double tol = 0.001; const TrackingVolume* currentVolume = lowestStaticTrackingVolume(gp); - if (currentVolume) return currentVolume->detachedTrackingVolumes(gp, tol); + if (currentVolume) { + return currentVolume->detachedTrackingVolumes(gp, tol); + } return nullptr; } @@ -58,8 +60,9 @@ Acts::TrackingGeometry::lowestStaticTrackingVolume(const Vector3D& gp) const const TrackingVolume* currentVolume = nullptr; while (currentVolume != searchVolume && searchVolume) { currentVolume = searchVolume; - if ((searchVolume->confinedDetachedVolumes()).empty()) + if ((searchVolume->confinedDetachedVolumes()).empty()) { searchVolume = searchVolume->trackingVolume(gp); + } } return currentVolume; } @@ -71,10 +74,14 @@ Acts::TrackingGeometry::atVolumeBoundary(const Acts::Vector3D& gp, double) const { bool isAtBoundary = false; - if (!vol) return isAtBoundary; + if (!vol) { + return isAtBoundary; + } for (auto& bSurface : vol->boundarySurfaces()) { const Surface& surf = bSurface->surfaceRepresentation(); - if (surf.isOnSurface(gp, true)) isAtBoundary = true; + if (surf.isOnSurface(gp, true)) { + isAtBoundary = true; + } } return isAtBoundary; } @@ -90,14 +97,18 @@ Acts::TrackingGeometry::atVolumeBoundary(const Vector3D& gp, { bool isAtBoundary = false; nextVol = 0; - if (!vol) return isAtBoundary; + if (!vol) { + return isAtBoundary; + } for (auto& bSurface : vol->boundarySurfaces()) { const Surface& surf = bSurface->surfaceRepresentation(); if (surf.isOnSurface(gp, true)) { isAtBoundary = true; const TrackingVolume* attachedVol = bSurface->attachedVolume(gp, mom, dir); - if (!nextVol && attachedVol) nextVol = attachedVol; + if (!nextVol && attachedVol) { + nextVol = attachedVol; + } } } return isAtBoundary; @@ -121,7 +132,9 @@ Acts::TrackingGeometry::trackingVolume(const std::string& name) const { auto sVol = m_trackingVolumes.begin(); sVol = m_trackingVolumes.find(name); - if (sVol != m_trackingVolumes.end()) return (sVol->second); + if (sVol != m_trackingVolumes.end()) { + return (sVol->second); + } return nullptr; } diff --git a/Core/src/Detector/TrackingVolume.cpp b/Core/src/Detector/TrackingVolume.cpp index 991ca267c..572411863 100644 --- a/Core/src/Detector/TrackingVolume.cpp +++ b/Core/src/Detector/TrackingVolume.cpp @@ -98,12 +98,18 @@ const Acts::Layer* Acts::TrackingVolume::associatedLayer(const Vector3D& gp) const { // confined static layers - highest hierarchy - if (m_confinedLayers) return (m_confinedLayers->object(gp).get()); + if (m_confinedLayers) { + return (m_confinedLayers->object(gp).get()); + } // confined arbitrary - if (!m_confinedArbitraryLayers.empty()) - for (auto& layer : m_confinedArbitraryLayers) - if (layer->isOnLayer(gp)) return layer.get(); + if (!m_confinedArbitraryLayers.empty()) { + for (auto& layer : m_confinedArbitraryLayers) { + if (layer->isOnLayer(gp)) { + return layer.get(); + } + } + } // return the null pointer return nullptr; @@ -113,19 +119,30 @@ const Acts::TrackingVolume* Acts::TrackingVolume::trackingVolume(const Vector3D& gp) const { // confined static volumes - highest hierarchy - if (m_confinedVolumes) return (m_confinedVolumes->object(gp).get()); + if (m_confinedVolumes) { + return (m_confinedVolumes->object(gp).get()); + } // if no static volumes are there, detached is next hierarchy - if (!m_confinedDetachedVolumes.empty()) - for (auto& detachedVolume : m_confinedDetachedVolumes) - if (detachedVolume->trackingVolume()->inside(gp, 0.001)) - return detachedVolume->trackingVolume(); + if (!m_confinedDetachedVolumes.empty()) { + for (auto& detachedVolume : m_confinedDetachedVolumes) { + if (detachedVolume->trackingVolume()->inside(gp, 0.001)) { + { + return detachedVolume->trackingVolume(); + } + } + } + } // if no static volumes or detached volumes are there, search for dense // volumes - if (!m_confinedDenseVolumes.empty()) - for (auto& denseVolume : m_confinedDenseVolumes) - if (denseVolume->inside(gp, 0.001)) return denseVolume.get(); + if (!m_confinedDenseVolumes.empty()) { + for (auto& denseVolume : m_confinedDenseVolumes) { + if (denseVolume->inside(gp, 0.001)) { + return denseVolume.get(); + } + } + } // there is no lower sub structure return this; @@ -138,10 +155,13 @@ Acts::TrackingVolume::detachedTrackingVolumes(const Vector3D& gp, // create a new vector DetachedVolumeVector* currVols = new DetachedVolumeVector; // get the volumes were the position is inside - if (!m_confinedDetachedVolumes.empty()) - for (auto& detachedVolume : m_confinedDetachedVolumes) - if (detachedVolume->trackingVolume()->inside(gp, tol)) + if (!m_confinedDetachedVolumes.empty()) { + for (auto& detachedVolume : m_confinedDetachedVolumes) { + if (detachedVolume->trackingVolume()->inside(gp, tol)) { currVols->push_back(detachedVolume); + } + } + } // return the volumes that are inside return currVols; } @@ -150,32 +170,37 @@ 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; - m_geometryType = geotype; + if (m_geometrySignature == Unsigned) { + m_geometrySignature = geosign; + } + m_geometryType = geotype; // confined static volumes - if (m_confinedVolumes) + if (m_confinedVolumes) { for (auto& volumesIter : (m_confinedVolumes->arrayObjects())) { auto mutableVolumesIter = std::const_pointer_cast<TrackingVolume>(volumesIter); mutableVolumesIter->sign(geosign, geotype); } + } // same procedure for the detached volumes - if (!m_confinedDetachedVolumes.empty()) + if (!m_confinedDetachedVolumes.empty()) { for (auto& volumesIter : m_confinedDetachedVolumes) { auto mutableVolumesIter = std::const_pointer_cast<DetachedTrackingVolume>(volumesIter); mutableVolumesIter->sign(geosign, geotype); } + } // finally for confined dense volumes - if (!m_confinedDenseVolumes.empty()) + if (!m_confinedDenseVolumes.empty()) { for (auto& volumesIter : m_confinedDenseVolumes) { auto mutableVolumesIter = std::const_pointer_cast<TrackingVolume>(volumesIter); mutableVolumesIter->sign(geosign, geotype); } + } } const std:: @@ -302,8 +327,9 @@ Acts::TrackingVolume::registerGlueVolumeDescriptor(GlueVolumesDescriptor* gvd) Acts::GlueVolumesDescriptor& Acts::TrackingVolume::glueVolumesDescriptor() { - if (!m_glueVolumeDescriptor) + if (!m_glueVolumeDescriptor) { m_glueVolumeDescriptor = new GlueVolumesDescriptor; + } return (*m_glueVolumeDescriptor); } @@ -318,7 +344,7 @@ Acts::TrackingVolume::synchronizeLayers(double envelope) const // msgstream << MSG::VERBOSE << " ---> working on " << // m_confinedLayers->arrayObjects().size() << " (material+navigation) // layers." << endreq; - for (auto& clayIter : m_confinedLayers->arrayObjects()) + for (auto& clayIter : m_confinedLayers->arrayObjects()) { if (clayIter) { // @todo implement syncrhonize layer // if (clayIter->surfaceRepresentation().type() == Surface::Cylinder && @@ -327,8 +353,9 @@ Acts::TrackingVolume::synchronizeLayers(double envelope) const // else // clayIter->resizeLayer(volumeBounds(),envelope); } // else - // msgstream << MSG::WARNING << " ---> found 0 pointer to layer, indicates - // problem." << endreq; + // msgstream << MSG::WARNING << " ---> found 0 pointer to layer, + // indicates problem." << endreq; + } } // case b : container volume -> step down @@ -336,8 +363,9 @@ Acts::TrackingVolume::synchronizeLayers(double envelope) const // msgstream << MSG::VERBOSE << " ---> no confined layers, working on " << // m_confinedVolumes->arrayObjects().size() << " confined volumes." << // endreq; - for (auto& cVolumesIter : m_confinedVolumes->arrayObjects()) + for (auto& cVolumesIter : m_confinedVolumes->arrayObjects()) { cVolumesIter->synchronizeLayers(envelope); + } } } diff --git a/Core/src/EventData/TrackParametersBase.cpp b/Core/src/EventData/TrackParametersBase.cpp index 053934e92..0f40fb053 100644 --- a/Core/src/EventData/TrackParametersBase.cpp +++ b/Core/src/EventData/TrackParametersBase.cpp @@ -23,10 +23,11 @@ TrackParametersBase::print(std::ostream& sl) const sl << " * TrackParameters:" << std::endl; sl << parameters() << std::endl; sl << " * charge: " << charge() << std::endl; - if (covariance()) + if (covariance()) { sl << " * covariance matrix = " << *covariance() << std::endl; - else + } else { sl << " * covariance matrix = " << covariance() << std::endl; + } sl << " * corresponding global parameters:" << std::endl; sl << " * position (x, y, z ) = (" << position().x() << ", " << position().y() << ", " << position().z() << ")" << std::endl; diff --git a/Core/src/Layers/CylinderLayer.cpp b/Core/src/Layers/CylinderLayer.cpp index 9ece379d1..3fdc93baf 100644 --- a/Core/src/Layers/CylinderLayer.cpp +++ b/Core/src/Layers/CylinderLayer.cpp @@ -42,9 +42,13 @@ Acts::CylinderLayer::CylinderLayer( // associate the layer to the surface CylinderSurface::associateLayer(*this); // an approach descriptor is automatically created if there's a surface array - if (!m_approachDescriptor && m_surfaceArray) buildApproachDescriptor(); + if (!m_approachDescriptor && m_surfaceArray) { + buildApproachDescriptor(); + } // register the layer to the approach descriptor surfaces - if (m_approachDescriptor) approachDescriptor()->registerLayer(*this); + if (m_approachDescriptor) { + approachDescriptor()->registerLayer(*this); + } } std::shared_ptr<Acts::Layer> @@ -62,12 +66,13 @@ Acts::CylinderLayer::create(const variant_data& data_) LayerType laytyp; std::string laytyp_str = payload.get<std::string>("layer_type"); - if (laytyp_str == "active") + if (laytyp_str == "active") { laytyp = active; - else if (laytyp_str == "passive") + } else if (laytyp_str == "passive") { laytyp = passive; - else /*laytyp_str == "navigation"*/ + } else { /*laytyp_str == "navigation"*/ laytyp = navigation; + } double thickness = payload.get<double>("thickness"); @@ -144,8 +149,9 @@ Acts::CylinderLayer::buildApproachDescriptor() // fill in the surfaces into the vector std::vector<std::shared_ptr<const BoundarySurfaceT<AbstractVolume>>> aSurfaces; - if (bSurfaces.size() > size_t(tubeOuterCover)) + if (bSurfaces.size() > size_t(tubeOuterCover)) { aSurfaces.push_back(bSurfaces.at(tubeInnerCover)); + } aSurfaces.push_back(bSurfaces.at(tubeOuterCover)); // create an ApproachDescriptor with Boundary surfaces m_approachDescriptor = std:: @@ -206,12 +212,13 @@ Acts::CylinderLayer::toVariantData() const payload["thickness"] = thickness(); std::cout << __PRETTY_FUNCTION__ << " " << __LINE__ << std::endl; - if (layerType() == active) + if (layerType() == active) { payload["layer_type"] = "active"s; - else if (layerType() == passive) + } else if (layerType() == passive) { payload["layer_type"] = "passive"s; - else /*layerType() == navigation*/ + } else { /*layerType() == navigation*/ payload["layer_type"] = "navigation"s; + } std::cout << __PRETTY_FUNCTION__ << " " << __LINE__ << std::endl; diff --git a/Core/src/Layers/DiscLayer.cpp b/Core/src/Layers/DiscLayer.cpp index 7e072700a..7b3a6a331 100644 --- a/Core/src/Layers/DiscLayer.cpp +++ b/Core/src/Layers/DiscLayer.cpp @@ -45,9 +45,13 @@ Acts::DiscLayer::DiscLayer(std::shared_ptr<const Transform3D> transform, // associate the layer to the layer surface itself DiscSurface::associateLayer(*this); // build an approach descriptor if none provided - if (!m_approachDescriptor && m_surfaceArray) buildApproachDescriptor(); + if (!m_approachDescriptor && m_surfaceArray) { + buildApproachDescriptor(); + } // register the layer to the approach descriptor - if (m_approachDescriptor) approachDescriptor()->registerLayer(*this); + if (m_approachDescriptor) { + approachDescriptor()->registerLayer(*this); + } } std::shared_ptr<Acts::Layer> @@ -65,12 +69,13 @@ Acts::DiscLayer::create(const variant_data& data_) LayerType laytyp; std::string laytyp_str = payload.get<std::string>("layer_type"); - if (laytyp_str == "active") + if (laytyp_str == "active") { laytyp = active; - else if (laytyp_str == "passive") + } else if (laytyp_str == "passive") { laytyp = passive; - else /*laytyp_str == "navigation"*/ + } else { /*laytyp_str == "navigation"*/ laytyp = navigation; + } double thickness = payload.get<double>("thickness"); double minR = payload.get<double>("minR"); @@ -197,12 +202,13 @@ Acts::DiscLayer::toVariantData() const payload["maxR"] = cvBounds->outerRadius(); payload["thickness"] = thickness(); - if (layerType() == active) + if (layerType() == active) { payload["layer_type"] = "active"s; - else if (layerType() == passive) + } else if (layerType() == passive) { payload["layer_type"] = "passive"s; - else /*layerType() == navigation*/ + } else { /*layerType() == navigation*/ payload["layer_type"] = "navigation"s; + } if (m_surfaceArray) { payload["surfacearray"] = m_surfaceArray->toVariantData(); diff --git a/Core/src/Layers/Layer.cpp b/Core/src/Layers/Layer.cpp index 5a7f07927..1f4d19a28 100644 --- a/Core/src/Layers/Layer.cpp +++ b/Core/src/Layers/Layer.cpp @@ -42,7 +42,9 @@ Acts::Layer::Layer(std::unique_ptr<SurfaceArray> surfaceArray, m_ssApproachSurfaces = 1; // indicates existence } // indicates existence of sensitive surfaces - if (m_surfaceArray) m_ssSensitiveSurfaces = 1; + if (m_surfaceArray) { + m_ssSensitiveSurfaces = 1; + } } Acts::Layer::~Layer() @@ -69,7 +71,9 @@ Acts::Layer::closeGeometry(const GeometryID& layerID) assignGeoID(layerID); // also find out how the sub structure is defined - if (surfaceRepresentation().associatedMaterial()) m_ssRepresentingSurface = 2; + if (surfaceRepresentation().associatedMaterial()) { + m_ssRepresentingSurface = 2; + } // loop over the approach surfaces if (m_approachDescriptor) { @@ -83,7 +87,9 @@ Acts::Layer::closeGeometry(const GeometryID& layerID) auto mutableASurface = const_cast<Surface*>(aSurface); mutableASurface->assignGeoID(asurfaceID); // if any of the approach surfaces has material - if (aSurface->associatedMaterial()) m_ssApproachSurfaces = 2; + if (aSurface->associatedMaterial()) { + m_ssApproachSurfaces = 2; + } } } // check if you have sensitive surfaces @@ -98,7 +104,9 @@ Acts::Layer::closeGeometry(const GeometryID& layerID) auto mutableSSurface = const_cast<Surface*>(sSurface); mutableSSurface->assignGeoID(ssurfaceID); // if any of the sensitive surfaces has material - if (sSurface->associatedMaterial()) m_ssSensitiveSurfaces = 2; + if (sSurface->associatedMaterial()) { + m_ssSensitiveSurfaces = 2; + } } } } diff --git a/Core/src/Layers/PlaneLayer.cpp b/Core/src/Layers/PlaneLayer.cpp index f8b565504..5f31c484b 100644 --- a/Core/src/Layers/PlaneLayer.cpp +++ b/Core/src/Layers/PlaneLayer.cpp @@ -30,9 +30,13 @@ Acts::PlaneLayer::PlaneLayer(std::shared_ptr<const Transform3D> transform, // register the layer to the surface Acts::PlaneSurface::associateLayer(*this); // deal with the approach descriptor - if (!m_approachDescriptor && m_surfaceArray) buildApproachDescriptor(); + if (!m_approachDescriptor && m_surfaceArray) { + buildApproachDescriptor(); + } // register the layer to the approach descriptor - if (m_approachDescriptor) approachDescriptor()->registerLayer(*this); + if (m_approachDescriptor) { + approachDescriptor()->registerLayer(*this); + } } const Acts::PlaneSurface& diff --git a/Core/src/Layers/ProtoLayer.cpp b/Core/src/Layers/ProtoLayer.cpp index ee4df9959..db855a95a 100644 --- a/Core/src/Layers/ProtoLayer.cpp +++ b/Core/src/Layers/ProtoLayer.cpp @@ -35,7 +35,9 @@ ProtoLayer::ProtoLayer(std::vector<const Surface*> surfaces) // it for thickness double thickness = 0; const DetectorElementBase* element = sf->associatedDetectorElement(); - if (element) thickness = element->thickness(); + if (element) { + thickness = element->thickness(); + } // check the shape const PlanarBounds* pBounds @@ -157,9 +159,10 @@ ProtoLayer::ProtoLayer(std::vector<const Surface*> surfaces) maxPhi = phi + hPhi; minPhi = phi - hPhi; - } else + } else { throw std::domain_error( "Not implemented yet for the given bounds type."); + } } } } @@ -176,7 +179,9 @@ ProtoLayer::radialDistance(const Vector3D& pos1, const Vector3D& pos2) const Vector2D p1O = (O - p1); // don't do division if L is very small - if (L < 1e-7) return std::numeric_limits<double>::max(); + if (L < 1e-7) { + return std::numeric_limits<double>::max(); + } double f = p1p2.dot(p1O) / L; // clamp to [0, |p1p2|] diff --git a/Core/src/Material/BinnedSurfaceMaterial.cpp b/Core/src/Material/BinnedSurfaceMaterial.cpp index 75431ed91..e05208369 100644 --- a/Core/src/Material/BinnedSurfaceMaterial.cpp +++ b/Core/src/Material/BinnedSurfaceMaterial.cpp @@ -80,7 +80,9 @@ Acts::BinnedSurfaceMaterial::clearMaterial() { // clear the full material for (auto& matMatrixIter : m_fullMaterial) { - for (auto& matIter : matMatrixIter) delete matIter; + for (auto& matIter : matMatrixIter) { + delete matIter; + } } m_fullMaterial.clear(); } @@ -95,8 +97,9 @@ Acts::BinnedSurfaceMaterial::fillMaterial( Acts::MaterialPropertiesVector matVector; matVector.reserve(m_binUtility.max(0) + 1); // reassign - for (auto& matIter : matMatrixIter) + for (auto& matIter : matMatrixIter) { matVector.push_back(matIter ? matIter->clone() : nullptr); + } m_fullMaterial.push_back(matVector); } } @@ -126,7 +129,9 @@ Acts::BinnedSurfaceMaterial::operator*=(double scale) const Acts::MaterialProperties* Acts::BinnedSurfaceMaterial::material(const Vector2D& lp) const { - if (!m_fullMaterial.size()) return nullptr; + if (!m_fullMaterial.size()) { + return nullptr; + } // the first bin size_t ibin0 = m_binUtility.bin(lp, 0); size_t ibin1 = m_binUtility.max(1) ? m_binUtility.bin(lp, 1) : 0; @@ -136,7 +141,9 @@ Acts::BinnedSurfaceMaterial::material(const Vector2D& lp) const const Acts::MaterialProperties* Acts::BinnedSurfaceMaterial::material(const Acts::Vector3D& gp) const { - if (!m_fullMaterial.size()) return nullptr; + if (!m_fullMaterial.size()) { + return nullptr; + } // the first bin size_t ibin0 = m_binUtility.bin(gp, 0); size_t ibin1 = m_binUtility.max(1) ? m_binUtility.bin(gp, 1) : 0; @@ -156,11 +163,12 @@ Acts::BinnedSurfaceMaterial::dump(std::ostream& sl) const unsigned int imat0 = 0; // the vector iterator for (auto& matIter : matMatrixIter) { - if (matIter) + if (matIter) { sl << " Bin [" << imat1 << "][" << imat0 << "] - " << (*matIter) << std::endl; - else + } else { sl << " Bin [" << imat1 << "][" << imat0 << "] - empty " << std::endl; + } ++imat0; } ++imat1; diff --git a/Core/src/Material/SurfaceMaterialProxy.cpp b/Core/src/Material/SurfaceMaterialProxy.cpp index bc76c9a82..a5d8c3f82 100644 --- a/Core/src/Material/SurfaceMaterialProxy.cpp +++ b/Core/src/Material/SurfaceMaterialProxy.cpp @@ -27,8 +27,9 @@ Acts::SurfaceMaterialProxy::SurfaceMaterialProxy( const SurfaceMaterialProxy& smproxy) : SurfaceMaterial(), m_binUtility(nullptr) { - if (smproxy.m_binUtility) + if (smproxy.m_binUtility) { m_binUtility = std::make_unique<const BinUtility>(*smproxy.m_binUtility); + } } Acts::SurfaceMaterialProxy* @@ -47,10 +48,11 @@ std::ostream& Acts::SurfaceMaterialProxy::dump(std::ostream& sl) const { sl << "Acts::SurfaceMaterialProxy : " << std::endl; - if (m_binUtility) + if (m_binUtility) { sl << " - Number of Material bins [0,1] : " << m_binUtility->bins(0) << " / " << m_binUtility->bins(1) << std::endl; - else + } else { sl << " - Homogeneous Material" << std::endl; + } return sl; } diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index d412f6f45..4dd174786 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -88,9 +88,10 @@ const Acts::Vector3D Acts::ConeSurface::binningPosition(Acts::BinningValue bValue) const { // special binning type for R-type methods - if (bValue == Acts::binR || bValue == Acts::binRPhi) + if (bValue == Acts::binR || bValue == Acts::binRPhi) { return Vector3D( center().x() + bounds().r(center().z()), center().y(), center().z()); + } // give the center as default for all of these binning types // binX, binY, binZ, binR, binPhi, binRPhi, binH, binEta return center(); @@ -149,7 +150,9 @@ Acts::ConeSurface::localToGlobal(const Vector2D& lpos, double phi = lpos[Acts::eLOC_RPHI] / r; Vector3D loc3Dframe(r * cos(phi), r * sin(phi), lpos[Acts::eLOC_Z]); // transport it to the globalframe - if (m_transform) gpos = transform() * loc3Dframe; + if (m_transform) { + gpos = transform() * loc3Dframe; + } } bool @@ -177,7 +180,9 @@ Acts::ConeSurface::pathCorrection(const Vector3D& gpos, Vector3D normalC(cos(phi) * bounds().cosAlpha(), sin(phi) * bounds().cosAlpha(), sgn * bounds().sinAlpha()); - if (m_transform) normalC = transform() * normalC; + if (m_transform) { + normalC = transform() * normalC; + } // back in global frame double cAlpha = normalC.dot(mom.unit()); return std::abs(1. / cAlpha); @@ -192,7 +197,9 @@ Acts::ConeSurface::name() const Acts::ConeSurface* Acts::ConeSurface::clone(const Acts::Transform3D* shift) const { - if (shift) new ConeSurface(*this, *shift); + if (shift) { + new ConeSurface(*this, *shift); + } return new ConeSurface(*this); } diff --git a/Core/src/Surfaces/CylinderBounds.cpp b/Core/src/Surfaces/CylinderBounds.cpp index dc5a288c1..c98a91c4b 100644 --- a/Core/src/Surfaces/CylinderBounds.cpp +++ b/Core/src/Surfaces/CylinderBounds.cpp @@ -42,7 +42,9 @@ Acts::CylinderBounds::CylinderBounds(double radius, , m_halfZ(std::abs(halfZ)) , m_closed(false) { - if (halfPhi == M_PI) m_closed = true; + if (halfPhi == M_PI) { + m_closed = true; + } } Acts::CylinderBounds::CylinderBounds(const variant_data& data_) diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index db5c2a8a6..6fdb98986 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -160,7 +160,9 @@ Acts::CylinderSurface::localToGlobal(const Vector2D& lpos, gpos = Vector3D(r * cos(phi), r * sin(phi), lpos[Acts::eLOC_Z]); // transform it to the globalframe: CylinderSurfaces are allowed to have 0 // if pointer transform exists -> port into frame - if (Surface::m_transform) gpos = transform() * gpos; + if (Surface::m_transform) { + gpos = transform() * gpos; + } } bool @@ -172,9 +174,11 @@ Acts::CylinderSurface::globalToLocal(const Vector3D& gpos, // @todo clean up intolerance parameters // transform it to the globalframe: CylinderSurfaces are allowed to have 0 // pointer transform - double radius = 0.; - double inttol = bounds().r() * 0.0001; - if (inttol < 0.01) inttol = 0.01; + double radius = 0.; + double inttol = bounds().r() * 0.0001; + if (inttol < 0.01) { + inttol = 0.01; + } // do the transformation or not if (Surface::m_transform) { const Transform3D& surfaceTrans = transform(); @@ -199,7 +203,9 @@ Acts::CylinderSurface::name() const Acts::CylinderSurface* Acts::CylinderSurface::clone(const Acts::Transform3D* shift) const { - if (shift) return new CylinderSurface(*this, *shift); + if (shift) { + return new CylinderSurface(*this, *shift); + } return new CylinderSurface(*this); } diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index a44d9b45e..06172d005 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -197,7 +197,9 @@ Acts::DiscSurface::isOnSurface(const Vector3D& glopo, const BoundaryCheck& bcheck) const { Vector3D loc3Dframe = (transform().inverse()) * glopo; - if (std::abs(loc3Dframe.z()) > (s_onSurfaceTolerance)) return false; + if (std::abs(loc3Dframe.z()) > (s_onSurfaceTolerance)) { + return false; + } return (bcheck ? bounds().inside(Vector2D(loc3Dframe.perp(), loc3Dframe.phi()), bcheck) @@ -207,14 +209,18 @@ Acts::DiscSurface::isOnSurface(const Vector3D& glopo, Acts::DiscSurface* Acts::DiscSurface::clone(const Transform3D* shift) const { - if (shift) return new DiscSurface(*this, *shift); + if (shift) { + return new DiscSurface(*this, *shift); + } return new DiscSurface(*this); } const Acts::SurfaceBounds& Acts::DiscSurface::bounds() const { - if (m_bounds) return (*(m_bounds.get())); + if (m_bounds) { + return (*(m_bounds.get())); + } return s_noBounds; } diff --git a/Core/src/Surfaces/EllipseBounds.cpp b/Core/src/Surfaces/EllipseBounds.cpp index c9448a219..551c7ff5e 100644 --- a/Core/src/Surfaces/EllipseBounds.cpp +++ b/Core/src/Surfaces/EllipseBounds.cpp @@ -134,7 +134,9 @@ Acts::EllipseBounds::distanceToBoundary(const Vector2D& lpos) const if (m_halfPhi < M_PI) { double df = std::abs(dF) - m_halfPhi; sf = r * std::sin(df); - if (df > 0.) r *= std::cos(df); + if (df > 0.) { + r *= std::cos(df); + } } else { sf = -1.e+10; } @@ -152,8 +154,12 @@ Acts::EllipseBounds::distanceToBoundary(const Vector2D& lpos) const if (sr1 >= 0.) { return sr1; } - if (sf < sr0) sf = sr0; - if (sf < sr1) sf = sr1; + if (sf < sr0) { + sf = sr0; + } + if (sf < sr1) { + sf = sr1; + } return sf; } diff --git a/Core/src/Surfaces/PerigeeSurface.cpp b/Core/src/Surfaces/PerigeeSurface.cpp index bc158cbd0..d978d8d0c 100644 --- a/Core/src/Surfaces/PerigeeSurface.cpp +++ b/Core/src/Surfaces/PerigeeSurface.cpp @@ -78,7 +78,9 @@ Acts::PerigeeSurface::operator=(const PerigeeSurface& other) Acts::PerigeeSurface* Acts::PerigeeSurface::clone(const Transform3D* shift) const { - if (shift) return new PerigeeSurface(*this, *shift); + if (shift) { + return new PerigeeSurface(*this, *shift); + } return new PerigeeSurface(*this); } diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index 5184491a9..557868884 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -156,7 +156,9 @@ Acts::PlaneSurface::isOnSurface(const Vector3D& glopo, { /// the chance that there is no transform is almost 0, let's apply it Vector3D loc3Dframe = (transform().inverse()) * glopo; - if (std::abs(loc3Dframe.z()) > s_onSurfaceTolerance) return false; + if (std::abs(loc3Dframe.z()) > s_onSurfaceTolerance) { + return false; + } return ( bcheck ? bounds().inside(Vector2D(loc3Dframe.x(), loc3Dframe.y()), bcheck) : true); @@ -165,14 +167,18 @@ Acts::PlaneSurface::isOnSurface(const Vector3D& glopo, Acts::PlaneSurface* Acts::PlaneSurface::clone(const Transform3D* shift) const { - if (shift) return new PlaneSurface(*this, *shift); + if (shift) { + return new PlaneSurface(*this, *shift); + } return new PlaneSurface(*this); } const Acts::SurfaceBounds& Acts::PlaneSurface::bounds() const { - if (m_bounds) return (*m_bounds.get()); + if (m_bounds) { + return (*m_bounds.get()); + } return s_noBounds; } diff --git a/Core/src/Surfaces/StrawSurface.cpp b/Core/src/Surfaces/StrawSurface.cpp index c9efebd78..2b7669193 100644 --- a/Core/src/Surfaces/StrawSurface.cpp +++ b/Core/src/Surfaces/StrawSurface.cpp @@ -94,7 +94,9 @@ Acts::StrawSurface::operator=(const StrawSurface& other) Acts::StrawSurface* Acts::StrawSurface::clone(const Transform3D* shift) const { - if (shift) new StrawSurface(*this, *shift); + if (shift) { + new StrawSurface(*this, *shift); + } return new StrawSurface(*this); } diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 111140a88..89e018f71 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -79,13 +79,21 @@ bool Acts::Surface::operator==(const Surface& other) const { // (a) fast exit for pointer comparison - if (&other == this) return true; + if (&other == this) { + return true; + } // (b) fast exit for type - if (other.type() != type()) return false; + if (other.type() != type()) { + return false; + } // (c) fast exit for bounds - if (other.bounds() != bounds()) return false; + if (other.bounds() != bounds()) { + return false; + } // (d) comapre transform - if (!other.transform().isApprox(transform(), 10e-9)) return false; + if (!other.transform().isApprox(transform(), 10e-9)) { + return false; + } // we should be good return true; } @@ -100,7 +108,9 @@ Acts::Surface::isOnSurface(const Vector3D& gpos, bool g2L = globalToLocal(gpos, Acts::Vector3D::UnitX(), lpos); if (g2L) { // no boundary check, then return true - if (!bcheck) return true; + if (!bcheck) { + return true; + } // return what ever the bounds tell you return bounds().inside(lpos, bcheck); } diff --git a/Core/src/Surfaces/SurfaceArray.cpp b/Core/src/Surfaces/SurfaceArray.cpp index 2c7269ee8..61eabe12a 100644 --- a/Core/src/Surfaces/SurfaceArray.cpp +++ b/Core/src/Surfaces/SurfaceArray.cpp @@ -325,9 +325,15 @@ Acts::SurfaceArray::dump(std::ostream& sl) const detail::AxisBoundaryType bdt = axes.at(j)->getBoundaryType(); sl << " - axis " << (j + 1) << std::endl; sl << " - boundary type: "; - if (bdt == detail::AxisBoundaryType::Open) sl << "open"; - if (bdt == detail::AxisBoundaryType::Bound) sl << "bound"; - if (bdt == detail::AxisBoundaryType::Closed) sl << "closed"; + if (bdt == detail::AxisBoundaryType::Open) { + sl << "open"; + } + if (bdt == detail::AxisBoundaryType::Bound) { + sl << "bound"; + } + if (bdt == detail::AxisBoundaryType::Closed) { + sl << "closed"; + } sl << std::endl; sl << " - type: " << (axes.at(j)->isEquidistant() ? "equidistant" : "variable") @@ -336,7 +342,9 @@ Acts::SurfaceArray::dump(std::ostream& sl) const sl << " - bin edges: [ "; auto binEdges = axes.at(j)->getBinEdges(); for (size_t i = 0; i < binEdges.size(); ++i) { - if (i > 0) sl << ", "; + if (i > 0) { + sl << ", "; + } auto binEdge = binEdges.at(i); // Do not display negative zeroes sl << ((std::abs(binEdge) >= 5e-4) ? binEdge : 0.0); diff --git a/Core/src/Tools/CylinderVolumeBuilder.cpp b/Core/src/Tools/CylinderVolumeBuilder.cpp index 9f90203e1..dd8623af7 100644 --- a/Core/src/Tools/CylinderVolumeBuilder.cpp +++ b/Core/src/Tools/CylinderVolumeBuilder.cpp @@ -305,9 +305,13 @@ Acts::CylinderVolumeBuilder::trackingVolume( // check what to do with the existing if (wConfig.wCondition == Attaching || wConfig.wCondition == CentralWrapping || wConfig.wCondition == CentralInserting) { - if (nEndcap) totalContainer.push_back(nEndcap); + if (nEndcap) { + totalContainer.push_back(nEndcap); + } totalContainer.push_back(existingVolumeCp); - if (pEndcap) totalContainer.push_back(pEndcap); + if (pEndcap) { + totalContainer.push_back(pEndcap); + } } else if (wConfig.wCondition == Inserting && volume) { totalContainer.push_back(volume); totalContainer.push_back(existingVolumeCp); diff --git a/Core/src/Tools/CylinderVolumeHelper.cpp b/Core/src/Tools/CylinderVolumeHelper.cpp index 44a2de78a..b3cce1eb1 100644 --- a/Core/src/Tools/CylinderVolumeHelper.cpp +++ b/Core/src/Tools/CylinderVolumeHelper.cpp @@ -104,7 +104,9 @@ Acts::CylinderVolumeHelper::createTrackingVolume( ACTS_WARNING("[!] Problem with given dimensions - return nullptr and " "delete provided objects"); // delete if newly created bounds - if (volBounds == nullptr) delete cylinderBounds; + if (volBounds == nullptr) { + delete cylinderBounds; + } return tVolume; } // get the zMin/Max @@ -226,10 +228,12 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( if (materialLayers > 1) { double step = cylinder ? (max - min) / (materialLayers - 1) : (max - min) / (materialLayers - 1); - for (unsigned int il = 0; il < materialLayers; ++il) + for (unsigned int il = 0; il < materialLayers; ++il) { layerPositions.push_back(min + il * step); - } else + } + } else { layerPositions.push_back(0.5 * (min + max)); + } // now call the main method return createGapTrackingVolume(matprop, @@ -330,7 +334,9 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( ACTS_VERBOSE(" with bounds : " << (*firstVolume)->volumeBounds()); // put the name together volumeName += (*firstVolume)->volumeName(); - if (ivol + 1 < volumes.size()) volumeName += " | "; + if (ivol + 1 < volumes.size()) { + volumeName += " | "; + } } // close the volume name volumeName += " }"; @@ -570,9 +576,9 @@ Acts::CylinderVolumeHelper::estimateAndCheckDimension( if (zFromTransform - cylinderVolumeBounds->halflengthZ() <= layerZmin && zFromTransform + cylinderVolumeBounds->halflengthZ() >= layerZmax && cylinderVolumeBounds->innerRadius() <= layerRmin - && cylinderVolumeBounds->outerRadius() >= layerRmax) + && cylinderVolumeBounds->outerRadius() >= layerRmax) { return true; - else { + } else { ACTS_WARNING( "Provided layers are not contained by volume ! Bailing out. "); ACTS_WARNING("- zFromTransform: " << zFromTransform); diff --git a/Core/src/Tools/LayerArrayCreator.cpp b/Core/src/Tools/LayerArrayCreator.cpp index efc81fcdf..24e8979be 100644 --- a/Core/src/Tools/LayerArrayCreator.cpp +++ b/Core/src/Tools/LayerArrayCreator.cpp @@ -198,7 +198,9 @@ Acts::LayerArrayCreator::createNavigationSurface(const Layer& layer, // case R case binR: { // binning in R and cylinder surface means something different - if (layerSurface.type() == Surface::Cylinder) break; + if (layerSurface.type() == Surface::Cylinder) { + break; + } translation = Vector3D(offset, 0., 0.); } break; // do nothing for the default diff --git a/Core/src/Tools/LayerCreator.cpp b/Core/src/Tools/LayerCreator.cpp index d7bad8a93..7f3f77fa4 100644 --- a/Core/src/Tools/LayerCreator.cpp +++ b/Core/src/Tools/LayerCreator.cpp @@ -402,11 +402,15 @@ Acts::LayerCreator::checkBinning(const SurfaceArray& sArray) const for (size_t b = 0; b < size; ++b) { std::vector<const Surface*> binContent = sArray.at(b); // we don't check under/overflow bins - if (!sArray.isValidBin(b)) continue; + if (!sArray.isValidBin(b)) { + continue; + } for (const auto& srf : binContent) { accessibleSurfaces.insert(srf); } - if (binContent.size() == 0) nEmptyBins++; + if (binContent.size() == 0) { + nEmptyBins++; + } nBinsChecked++; } diff --git a/Core/src/Tools/SurfaceArrayCreator.cpp b/Core/src/Tools/SurfaceArrayCreator.cpp index fd69b3d8e..45e24731c 100644 --- a/Core/src/Tools/SurfaceArrayCreator.cpp +++ b/Core/src/Tools/SurfaceArrayCreator.cpp @@ -90,16 +90,18 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ProtoAxis pAxisPhi; ProtoAxis pAxisZ; - if (bTypePhi == equidistant) + if (bTypePhi == equidistant) { pAxisPhi = createEquidistantAxis(surfaces, binPhi, protoLayer, transform, 0); - else + } else { pAxisPhi = createVariableAxis(surfaces, binPhi, protoLayer, transform); + } - if (bTypeZ == equidistant) + if (bTypeZ == equidistant) { pAxisZ = createEquidistantAxis(surfaces, binZ, protoLayer, transform); - else + } else { pAxisZ = createVariableAxis(surfaces, binZ, protoLayer, transform); + } Transform3D itransform = transform.inverse(); auto globalToLocal = [transform](const Vector3D& pos) { @@ -209,10 +211,11 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( ProtoAxis pAxisPhi; ProtoAxis pAxisR; - if (bTypeR == equidistant) + if (bTypeR == equidistant) { pAxisR = createEquidistantAxis(surfaces, binR, protoLayer, transform); - else + } else { pAxisR = createVariableAxis(surfaces, binR, protoLayer, transform); + } // if we have more than one R ring, we need to figure out // the number of phi bins. @@ -253,11 +256,12 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( } else { // use regular determination - if (bTypePhi == equidistant) + if (bTypePhi == equidistant) { pAxisPhi = createEquidistantAxis(surfaces, binPhi, protoLayer, transform, 0); - else + } else { pAxisPhi = createVariableAxis(surfaces, binPhi, protoLayer, transform); + } } double Z = 0.5 * (protoLayer.minZ + protoLayer.maxZ); @@ -354,9 +358,10 @@ Acts::SurfaceArrayCreator::createVariableAxis( ProtoLayer protoLayer, Transform3D& transform) const { - if (!surfaces.size()) + if (!surfaces.size()) { throw std::logic_error( "No surfaces handed over for creating arbitrary bin utility!"); + } // BinningOption is open for z and r, in case of phi binning reset later // the vector with the binning Values (boundaries for each bin) @@ -494,9 +499,10 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( Transform3D& transform, size_t nBins) const { - if (!surfaces.size()) + if (!surfaces.size()) { throw std::logic_error( "No surfaces handed over for creating equidistant axis!"); + } // check the binning type first double minimum = 0.; diff --git a/Core/src/Tools/TrackingGeometryBuilder.cpp b/Core/src/Tools/TrackingGeometryBuilder.cpp index 5cee4810b..225794123 100644 --- a/Core/src/Tools/TrackingGeometryBuilder.cpp +++ b/Core/src/Tools/TrackingGeometryBuilder.cpp @@ -56,8 +56,9 @@ Acts::TrackingGeometryBuilder::trackingGeometry() const } // -------------------------------------------------------------------------------- // create the TrackingGeoemtry - if (highestVolume) + if (highestVolume) { trackingGeometry.reset(new TrackingGeometry(highestVolume)); + } // return the geometry to the service return (trackingGeometry); } diff --git a/Core/src/Tools/TrackingVolumeArrayCreator.cpp b/Core/src/Tools/TrackingVolumeArrayCreator.cpp index aeb0d8ac6..7c0c10e71 100644 --- a/Core/src/Tools/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Tools/TrackingVolumeArrayCreator.cpp @@ -47,7 +47,9 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( // get the center value according to the bin double value = tVolume->binningPositionValue(bValue); // for the first one take low and high boundary - if (!boundaries.size()) boundaries.push_back(value - binningBorder); + if (!boundaries.size()) { + boundaries.push_back(value - binningBorder); + } // always take the high boundary boundaries.push_back(value + binningBorder); // record the volume to be ordered diff --git a/Core/src/Volumes/CylinderVolumeBounds.cpp b/Core/src/Volumes/CylinderVolumeBounds.cpp index 4eafe339a..1bb6c0eea 100644 --- a/Core/src/Volumes/CylinderVolumeBounds.cpp +++ b/Core/src/Volumes/CylinderVolumeBounds.cpp @@ -72,7 +72,9 @@ Acts::CylinderVolumeBounds::~CylinderVolumeBounds() Acts::CylinderVolumeBounds& Acts::CylinderVolumeBounds::operator=(const CylinderVolumeBounds& cylbo) { - if (this != &cylbo) m_valueStore = cylbo.m_valueStore; + if (this != &cylbo) { + m_valueStore = cylbo.m_valueStore; + } return *this; } @@ -106,9 +108,10 @@ Acts::CylinderVolumeBounds::decomposeToSurfaces( rSurfaces.push_back(new CylinderSurface(transformPtr, outerCylinderBounds())); // innermost Cylinder - if (innerRadius() > s_numericalStable) + if (innerRadius() > s_numericalStable) { rSurfaces.push_back( new CylinderSurface(transformPtr, innerCylinderBounds())); + } // the cylinder is sectoral if (std::abs(halfPhiSector() - M_PI) > s_numericalStable) { diff --git a/Core/src/Volumes/DoubleTrapezoidVolumeBounds.cpp b/Core/src/Volumes/DoubleTrapezoidVolumeBounds.cpp index 520d55232..306d2f3f9 100644 --- a/Core/src/Volumes/DoubleTrapezoidVolumeBounds.cpp +++ b/Core/src/Volumes/DoubleTrapezoidVolumeBounds.cpp @@ -59,7 +59,9 @@ Acts::DoubleTrapezoidVolumeBounds& Acts::DoubleTrapezoidVolumeBounds:: operator=(const Acts::DoubleTrapezoidVolumeBounds& trabo) { - if (this != &trabo) m_valueStore = trabo.m_valueStore; + if (this != &trabo) { + m_valueStore = trabo.m_valueStore; + } return *this; } @@ -245,9 +247,15 @@ Acts::DoubleTrapezoidVolumeBounds::faceZXRectangleBoundsTop() const bool Acts::DoubleTrapezoidVolumeBounds::inside(const Vector3D& pos, double tol) const { - if (std::abs(pos.z()) > m_valueStore.at(bv_halfZ) + tol) return false; - if (pos.y() < -2 * m_valueStore.at(bv_halfY1) - tol) return false; - if (pos.y() > 2 * m_valueStore.at(bv_halfY2) - tol) return false; + if (std::abs(pos.z()) > m_valueStore.at(bv_halfZ) + tol) { + return false; + } + if (pos.y() < -2 * m_valueStore.at(bv_halfY1) - tol) { + return false; + } + if (pos.y() > 2 * m_valueStore.at(bv_halfY2) - tol) { + return false; + } DiamondBounds* faceXYBounds = faceXYDiamondBounds(); Vector2D locp(pos.x(), pos.y()); bool inside(faceXYBounds->inside(locp, BoundaryCheck(true, true, tol, tol))); diff --git a/Core/src/Volumes/TrapezoidVolumeBounds.cpp b/Core/src/Volumes/TrapezoidVolumeBounds.cpp index 4bca2f1ff..6cfe81e51 100644 --- a/Core/src/Volumes/TrapezoidVolumeBounds.cpp +++ b/Core/src/Volumes/TrapezoidVolumeBounds.cpp @@ -71,7 +71,9 @@ Acts::TrapezoidVolumeBounds::~TrapezoidVolumeBounds() Acts::TrapezoidVolumeBounds& Acts::TrapezoidVolumeBounds::operator=(const TrapezoidVolumeBounds& trabo) { - if (this != &trabo) m_valueStore = trabo.m_valueStore; + if (this != &trabo) { + m_valueStore = trabo.m_valueStore; + } return *this; } @@ -215,8 +217,12 @@ Acts::TrapezoidVolumeBounds::faceZXRectangleBoundsTop() const bool Acts::TrapezoidVolumeBounds::inside(const Vector3D& pos, double tol) const { - if (std::abs(pos.z()) > m_valueStore.at(bv_halfZ) + tol) return false; - if (std::abs(pos.y()) > m_valueStore.at(bv_halfY) + tol) return false; + if (std::abs(pos.z()) > m_valueStore.at(bv_halfZ) + tol) { + return false; + } + if (std::abs(pos.y()) > m_valueStore.at(bv_halfY) + tol) { + return false; + } TrapezoidBounds* faceXYBounds = faceXYTrapezoidBounds(); Vector2D locp(pos.x(), pos.y()); bool inside(faceXYBounds->inside(locp, BoundaryCheck(true, true, tol, tol))); diff --git a/Core/src/Volumes/Volume.cpp b/Core/src/Volumes/Volume.cpp index ee62b3a47..06f20c69d 100644 --- a/Core/src/Volumes/Volume.cpp +++ b/Core/src/Volumes/Volume.cpp @@ -29,7 +29,9 @@ Acts::Volume::Volume(std::shared_ptr<const Transform3D> htrans, , m_center(s_origin) , m_volumeBounds(volbounds) { - if (htrans) m_center = htrans->translation(); + if (htrans) { + m_center = htrans->translation(); + } } Acts::Volume::Volume(const Volume& vol, const Transform3D* shift) @@ -39,8 +41,9 @@ Acts::Volume::Volume(const Volume& vol, const Transform3D* shift) , m_volumeBounds(vol.m_volumeBounds) { // applyt he shift if it exists - if (shift) + if (shift) { m_transform = std::make_shared<const Transform3D>(transform() * (*shift)); + } // now set the center m_center = transform().translation(); } @@ -83,7 +86,9 @@ Acts::Volume::clone() const bool Acts::Volume::inside(const Acts::Vector3D& gpos, double tol) const { - if (!m_transform) return (volumeBounds()).inside(gpos, tol); + if (!m_transform) { + return (volumeBounds()).inside(gpos, tol); + } Acts::Vector3D posInVolFrame((transform().inverse()) * gpos); return (volumeBounds()).inside(posInVolFrame, tol); } diff --git a/Legacy/include/Acts/Extrapolation/ExtrapolationCell.hpp b/Legacy/include/Acts/Extrapolation/ExtrapolationCell.hpp index bc5a370dd..163d0ecb9 100644 --- a/Legacy/include/Acts/Extrapolation/ExtrapolationCell.hpp +++ b/Legacy/include/Acts/Extrapolation/ExtrapolationCell.hpp @@ -74,7 +74,9 @@ public: ExtrapolationConfig(const std::vector<ExtrapolationMode::eMode>& eModes) : value(0) { - for (auto& em : eModes) addMode(em); + for (auto& em : eModes) { + addMode(em); + } } /// Copy Constructor @@ -292,7 +294,9 @@ public: , time(0.) { // fill the position if you can - if (parameters) position = parameters->position(); + if (parameters) { + position = parameters->position(); + } } }; @@ -464,8 +468,9 @@ public: configurationMode(ExtrapolationMode::eMode em) const { if (em == ExtrapolationMode::CollectMaterial - && particleType > Acts::nonInteracting) + && particleType > Acts::nonInteracting) { return true; + } // check if the bit is set or not return extrapolationConfiguration.checkMode(em); } @@ -544,8 +549,9 @@ public: { bool reached = configurationMode(Acts::ExtrapolationMode::StopWithPathLimit) && reachedLimit(pathLength, pathLimit, tolerance); - if (reached && checkout) + if (reached && checkout) { endParameters = std::move(extrapolationSteps.back().parameters); + } return reached; } @@ -578,16 +584,17 @@ public: setRadialDirection() { // in FATRAS extrapolation mode force radial direction to be outwards (+1) - if (configurationMode(ExtrapolationMode::FATRAS)) + if (configurationMode(ExtrapolationMode::FATRAS)) { radialDirection = 1; - else { + } else { // if the endSurface is given, it is used to evaluate the radial direction // else the leadParamenters are used if (leadParameters->position().perp() > (leadParameters->position() + navigationDirection * leadParameters->momentum().unit()) - .perp()) + .perp()) { radialDirection = -1; + } } } @@ -597,13 +604,16 @@ public: checkRadialCompatibility() const { // this checks the radial compatibility - not needed for outwards moving - if (radialDirection > 0) return true; + if (radialDirection > 0) { + return true; + } // this was radially inwards moving and stays like this if (leadParameters->position().perp() > (leadParameters->position() + navigationDirection * leadParameters->momentum().unit()) - .perp()) + .perp()) { return true; + } // radial direction changed return false; } diff --git a/Legacy/include/Acts/Extrapolation/detail/ExtrapolationCell.ipp b/Legacy/include/Acts/Extrapolation/detail/ExtrapolationCell.ipp index e0588da24..81d480d6e 100644 --- a/Legacy/include/Acts/Extrapolation/detail/ExtrapolationCell.ipp +++ b/Legacy/include/Acts/Extrapolation/detail/ExtrapolationCell.ipp @@ -56,7 +56,9 @@ Acts::ExtrapolationCell<T>::stepMaterial( const MaterialProperties* mprop) { // fast exit - if (!mprop) return; + if (!mprop) { + return; + } // if this is on a new surface, // so create a new extrapolation step if (extrapolationSteps.size()) { @@ -92,7 +94,9 @@ Acts::ExtrapolationCell<T>::stepMaterial( // if there's new stepParameters then change the lead if (stepParameters) { // store the old parameters if present - if (cstep.parameters) cstep.preparameters = std::move(cstep.parameters); + if (cstep.parameters) { + cstep.preparameters = std::move(cstep.parameters); + } // bookkeeping lastLeadParameters = leadParameters; leadParameters = stepParameters.get(); diff --git a/Legacy/include/Acts/Extrapolation/detail/ExtrapolationEngine.ipp b/Legacy/include/Acts/Extrapolation/detail/ExtrapolationEngine.ipp index c91b98953..06f26094c 100644 --- a/Legacy/include/Acts/Extrapolation/detail/ExtrapolationEngine.ipp +++ b/Legacy/include/Acts/Extrapolation/detail/ExtrapolationEngine.ipp @@ -113,7 +113,9 @@ Acts::ExtrapolationEngine::initNavigation(Acts::ExtrapolationCell<T>& eCell, if (!eCell.startVolume) { // get the start volume auto ecVol = m_cfg.navigationEngine->resolvePosition(eCell, dir, true); - if (!ecVol.isSuccessOrRecovered() && !ecVol.inProgress()) return ecVol; + if (!ecVol.isSuccessOrRecovered() && !ecVol.inProgress()) { + return ecVol; + } // the volume is found and assigned as start volume eCell.startVolume = eCell.leadVolume; } else { @@ -121,7 +123,9 @@ Acts::ExtrapolationEngine::initNavigation(Acts::ExtrapolationCell<T>& eCell, eCell.leadVolume = eCell.startVolume; } // bail out of the start volume can not be resolved - if (!eCell.startVolume) return ExtrapolationCode::FailureNavigation; + if (!eCell.startVolume) { + return ExtrapolationCode::FailureNavigation; + } // screen output EX_MSG_VERBOSE( eCell.navigationStep, diff --git a/Legacy/include/Acts/Extrapolation/detail/RungeKuttaEngine.ipp b/Legacy/include/Acts/Extrapolation/detail/RungeKuttaEngine.ipp index bb2a4bdfa..2919a6e53 100644 --- a/Legacy/include/Acts/Extrapolation/detail/RungeKuttaEngine.ipp +++ b/Legacy/include/Acts/Extrapolation/detail/RungeKuttaEngine.ipp @@ -33,8 +33,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( // bail out if you can't transform into global frame if (!m_rkUtils.transformLocalToGlobal( - propState.useJacobian, parametersT, propState.pVector)) + propState.useJacobian, parametersT, propState.pVector)) { return false; + } // get the surface transform const Transform3D& sTransform = dSurface.transform(); @@ -61,8 +62,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( s[3] = -d; } // check for propagation failure - if (!propagateWithJacobian(eCell.navigationStep, propState, 1, s)) + if (!propagateWithJacobian(eCell.navigationStep, propState, 1, s)) { return false; + } } else if (sType == Surface::Straw || sType == Surface::Perigee) { // (ii) line-type surfaces double s[6] = {sTransform(0, 3), // position of the surface @@ -72,8 +74,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( sTransform(1, 2), // orientation of the surface sTransform(2, 2)}; // orientation of the surface // check for propagation failure - if (!propagateWithJacobian(eCell.navigationStep, propState, 0, s)) + if (!propagateWithJacobian(eCell.navigationStep, propState, 0, s)) { return false; + } } else if (sType == Surface::Cylinder) { // (iii) cylinder surface: // - cast to CylinderSurface for checking the cross point @@ -90,15 +93,17 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( propState.direction, 0.}; // check for propagation failure - if (!propagateWithJacobian(eCell.navigationStep, propState, 2, s)) + if (!propagateWithJacobian(eCell.navigationStep, propState, 2, s)) { return false; + } // For cylinder we do test for next cross point if (cyl->bounds().halfPhiSector() < 3.1 && newCrossPoint(*cyl, r0, propState.pVector)) { s[8] = 0.; // check for propagation failure - if (!propagateWithJacobian(eCell.navigationStep, propState, 2, s)) + if (!propagateWithJacobian(eCell.navigationStep, propState, 2, s)) { return false; + } } } else if (sType == Surface::Cone) { // (iv) cone surface @@ -115,10 +120,12 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( propState.direction, 0.}; // check for propagation failure - if (!propagateWithJacobian(eCell.navigationStep, propState, 3, s)) + if (!propagateWithJacobian(eCell.navigationStep, propState, 3, s)) { return false; - } else + } + } else { return false; // there was no surface that did fit + } EX_MSG_VERBOSE(eCell.navigationStep, "propagate", @@ -127,8 +134,10 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( eCell.nSteps = propState.niter; // check if the direction solution was ok - if (propState.direction != 0. && (propState.direction * propState.step) < 0.) + if (propState.direction != 0. + && (propState.direction * propState.step) < 0.) { return false; + } // Common transformation for all surfaces (angles and momentum) if (propState.useJacobian) { @@ -146,8 +155,10 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( propState.returnCurvilinear = true; } // use the jacobian for tranformation - bool uJ = propState.useJacobian; - if (propState.returnCurvilinear) uJ = false; + bool uJ = propState.useJacobian; + if (propState.returnCurvilinear) { + uJ = false; + } // create the return track parameters from Global to Local m_rkUtils.transformGlobalToLocal(&dSurface, @@ -165,11 +176,12 @@ Acts::RungeKuttaEngine<MagneticField>::propagateRungeKuttaT( } // Transformation to curvilinear presentation - if (propState.returnCurvilinear) + if (propState.returnCurvilinear) { m_rkUtils.transformGlobalToCurvilinear(propState.useJacobian, propState.pVector, propState.parameters, propState.jacobian); + } if (propState.useJacobian) { // create a new covariance matrix using the utils @@ -214,11 +226,12 @@ Acts::RungeKuttaEngine<MagneticField>::propagate( // let's check angain if we have a purpose final // @todo can be removed when sf is moved into ExtrapolationConfig if (!finalPropagation) { - for (auto p : purpose) + for (auto p : purpose) { if (p == ExtrapolationMode::Destination) { finalPropagation = true; break; } + } } // create the PropagationCache @@ -258,8 +271,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagate( eCell, propState, *sParameters, sf)) { // create a new covariance matrix std::unique_ptr<const ActsSymMatrixD<5>> cov; - if (propState.covariance) + if (propState.covariance) { cov.reset(new ActsSymMatrixD<5>(*propState.covariance)); + } // create the new parameters if (!propState.returnCurvilinear) { @@ -295,8 +309,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagate( // this is a new transport step, collect it // create the jacobian only when requested std::unique_ptr<const TransportJacobian> tJacobian = nullptr; - if (eCell.configurationMode(ExtrapolationMode::CollectJacobians)) + if (eCell.configurationMode(ExtrapolationMode::CollectJacobians)) { tJacobian = std::make_unique<const TransportJacobian>(propState.jacobian); + } // now fill the transportStep // record the parameters as a step eCell.stepTransport(std::move(nParameters), @@ -367,11 +382,12 @@ Acts::RungeKuttaEngine<MagneticField>::propagate( // let's check angain if we have a purpose final // @todo can be removed when sf is moved into ExtrapolationConfig if (!finalPropagation) { - for (auto p : purpose) + for (auto p : purpose) { if (p == ExtrapolationMode::Destination) { finalPropagation = true; break; } + } } // the start and the result @@ -416,8 +432,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagate( // create a new covariance matrix std::unique_ptr<const ActsSymMatrixD<5>> cov; - if (propState.covariance) + if (propState.covariance) { cov.reset(new ActsSymMatrixD<5>(*propState.covariance)); + } // create the parameter vector and stream the result in ActsVectorD<5> pars; pars << propState.parameters[0], propState.parameters[1], @@ -455,8 +472,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagate( // this is a new transport step, collect it // create the jacobian only when requested std::unique_ptr<const TransportJacobian> tJacobian = nullptr; - if (eCell.configurationMode(ExtrapolationMode::CollectJacobians)) + if (eCell.configurationMode(ExtrapolationMode::CollectJacobians)) { tJacobian = std::make_unique<const TransportJacobian>(propState.jacobian); + } // now fill the transportStep // record the parameters as a step eCell.stepTransport(std::move(pParameters), @@ -520,14 +538,17 @@ Acts::RungeKuttaEngine<MagneticField>::propagateWithJacobian( propState.maxPathLimit = false; // @todo the inverse momentum condition is hard-coded - if (propState.mcondition && std::abs(propState.pVector[6]) > 100000.) + if (propState.mcondition && std::abs(propState.pVector[6]) > 100000.) { return false; + } // Step estimation until surface - this is the initial step estimation bool Q; double S, step = stepEstimatorWithCurvature(propState, kind, Su, Q, true); - if (!Q) return false; + if (!Q) { + return false; + } bool dir = true; if (propState.mcondition && propState.direction @@ -563,12 +584,13 @@ Acts::RungeKuttaEngine<MagneticField>::propagateWithJacobian( // propagation in magnetic field - with or without field ( or gradient ) if (propState.mcondition) { - if (!propState.needgradient) + if (!propState.needgradient) { propState.step += (S = rungeKuttaStep(navigationStep, propState, S, InS)); - else + } else { propState.step += (S = rungeKuttaStepWithGradient( navigationStep, propState, S, InS)); + } } else { // or within straight line propState.step += (S = straightLineStep(navigationStep, propState, S)); } @@ -584,10 +606,11 @@ Acts::RungeKuttaEngine<MagneticField>::propagateWithJacobian( } if (!dir) { - if (propState.direction && propState.direction * propState.step < 0.) + if (propState.direction && propState.direction * propState.step < 0.) { step = -step; - else + } else { dir = true; + } } if (S * step < 0.) { @@ -598,10 +621,11 @@ Acts::RungeKuttaEngine<MagneticField>::propagateWithJacobian( // check if the step made sense double aS = std::abs(S); double aStep = std::abs(step); - if (aS > aStep) + if (aS > aStep) { S = step; - else if (!iS && InS && aS * 2. < aStep) + } else if (!iS && InS && aS * 2. < aStep) { S *= 2.; // @todo check: magic step increase + } if (!dir && std::abs(propState.step) > Wwrong) { EX_MSG_DEBUG(navigationStep, @@ -612,7 +636,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagateWithJacobian( } if (iS > 10 || (iS > 3 && std::abs(S) >= So)) { - if (!kind) break; + if (!kind) { + break; + } EX_MSG_DEBUG(navigationStep, "propagate", "<T> ", "Abort triggered."); return false; } @@ -635,7 +661,9 @@ Acts::RungeKuttaEngine<MagneticField>::propagateWithJacobian( propState.step += step; // last step to surface not needed, within tolerance - if (std::abs(step) < m_cfg.straightStep) return true; + if (std::abs(step) < m_cfg.straightStep) { + return true; + } // This is a last straight line approach A[0] += (SA[0] * step); @@ -794,7 +822,9 @@ Acts::RungeKuttaEngine<MagneticField>::rungeKuttaStep( propState.field[2] = f[2]; propState.newfield = false; - if (!Jac) return S; + if (!Jac) { + return S; + } // Jacobian calculation // @@ -1184,16 +1214,22 @@ Acts::RungeKuttaEngine<MagneticField>::newCrossPoint(const CylinderSurface& Su, double RC = x * Ax[0] + y * Ax[1] + z * Ax[2]; double RS = x * Ay[0] + y * Ay[1] + z * Ay[2]; - if ((RC * RC + RS * RS) <= (R * R)) return false; + if ((RC * RC + RS * RS) <= (R * R)) { + return false; + } - x = P[0] - T(0, 3); - y = P[1] - T(1, 3); - z = P[2] - T(2, 3); - RC = x * Ax[0] + y * Ax[1] + z * Ax[2]; - RS = x * Ay[0] + y * Ay[1] + z * Ay[2]; - double dF = std::abs(atan2(RS, RC) - Su.bounds().averagePhi()); - if (dF > pi) dF = pi2 - pi; - if (dF <= Su.bounds().halfPhiSector()) return false; + x = P[0] - T(0, 3); + y = P[1] - T(1, 3); + z = P[2] - T(2, 3); + RC = x * Ax[0] + y * Ax[1] + z * Ax[2]; + RS = x * Ay[0] + y * Ay[1] + z * Ay[2]; + double dF = std::abs(atan2(RS, RC) - Su.bounds().averagePhi()); + if (dF > pi) { + dF = pi2 - pi; + } + if (dF <= Su.bounds().halfPhiSector()) { + return false; + } return true; } @@ -1218,7 +1254,9 @@ Acts::RungeKuttaEngine<MagneticField>::straightLineStep( R[0] += (A[0] * S); R[1] += (A[1] * S); R[2] += (A[2] * S); - if (!propState.useJacobian) return S; + if (!propState.useJacobian) { + return S; + } // Derivatives of track parameters in last point for (int i = 7; i < 42; i += 7) { @@ -1297,11 +1335,15 @@ Acts::RungeKuttaEngine<MagneticField>::stepEstimatorWithCurvature( kind, Su, propState.pVector, Q, istep, propState.maxStepSize); // check to - if (!Q) return 0.; + if (!Q) { + return 0.; + } double AStep = std::abs(Step); // the step is good : so returen - if (kind || AStep < m_cfg.straightStep || !propState.mcondition) return Step; + if (kind || AStep < m_cfg.straightStep || !propState.mcondition) { + return Step; + } // Use start direction const double* SA = &(propState.pVector[42]); @@ -1326,6 +1368,8 @@ Acts::RungeKuttaEngine<MagneticField>::stepEstimatorWithCurvature( Q = true; return Step; } - if (std::abs(StepN) < AStep) return StepN; + if (std::abs(StepN) < AStep) { + return StepN; + } return Step; } diff --git a/Legacy/include/Acts/Extrapolation/detail/StaticEngine.ipp b/Legacy/include/Acts/Extrapolation/detail/StaticEngine.ipp index cb158b7f2..6ad28929a 100644 --- a/Legacy/include/Acts/Extrapolation/detail/StaticEngine.ipp +++ b/Legacy/include/Acts/Extrapolation/detail/StaticEngine.ipp @@ -157,8 +157,9 @@ Acts::StaticEngine::extrapolateT(Acts::ExtrapolationCell<T>& eCell, // - SuccessX -> return (via handleReturnT) // - FailureX -> return (via handleReturnT that might evoke a fallback) // - InProgess -> continue layer-to-layer loop - if (!eCode.inProgress()) + if (!eCode.inProgress()) { return handleReturnT<T>(eCode, eCell, sf, pDir, bcheck); + } } // ----- [3] now resolve the boundary situation, call includes information diff --git a/Legacy/include/Acts/Extrapolation/detail/StaticNavigationEngine.ipp b/Legacy/include/Acts/Extrapolation/detail/StaticNavigationEngine.ipp index 88c658832..f5d12ae27 100644 --- a/Legacy/include/Acts/Extrapolation/detail/StaticNavigationEngine.ipp +++ b/Legacy/include/Acts/Extrapolation/detail/StaticNavigationEngine.ipp @@ -116,11 +116,14 @@ Acts::StaticNavigationEngine::resolveBoundaryT( for (auto& bSurfaceTV : eCell.leadVolume->boundarySurfaces()) { // we tried this one already, no point to do it again if (bSurfacesTried.size() - && bSurfacesTried.find(bSurfaceTV.get()) != bSurfacesTried.end()) + && bSurfacesTried.find(bSurfaceTV.get()) != bSurfacesTried.end()) { continue; + } // skip if it's the last boundary surface const Surface& bSurface = bSurfaceTV->surfaceRepresentation(); - if (&bSurface == eCell.lastBoundarySurface) continue; + if (&bSurface == eCell.lastBoundarySurface) { + continue; + } // screen output EX_MSG_VERBOSE(eCell.navigationStep, "navigation", @@ -308,8 +311,9 @@ Acts::StaticNavigationEngine::handleBoundaryT( if (eCell.leadVolume == nextVolume) { // the start parameters where on the boundary already give a relaxed // return code - if (&bSurface == eCell.lastBoundarySurface) + if (&bSurface == eCell.lastBoundarySurface) { return ExtrapolationCode::Unset; + } // give some screen output as of why this happens EX_MSG_VERBOSE(eCell.navigationStep, "navigation", @@ -391,10 +395,13 @@ Acts::StaticNavigationEngine::resolvePositionT( // noLoop= True is used when we have exit from leadVolume - if (!eCell.leadVolume) + if (!eCell.leadVolume) { eCell.leadVolume = m_cfg.trackingGeometry->lowestStaticTrackingVolume( eCell.leadParameters->position()); - if (!eCell.leadVolume) return ExtrapolationCode::FailureNavigation; + } + if (!eCell.leadVolume) { + return ExtrapolationCode::FailureNavigation; + } const TrackingVolume* nextVol = 0; if (m_cfg.trackingGeometry->atVolumeBoundary( eCell.leadParameters->position(), @@ -409,8 +416,9 @@ Acts::StaticNavigationEngine::resolvePositionT( if (nextVol) { eCell.leadVolume = nextVol; return ExtrapolationCode::InProgress; - } else + } else { return ExtrapolationCode::FailureNavigation; + } } return ExtrapolationCode::InProgress; diff --git a/Legacy/include/Acts/Propagator/AtlasStepper.hpp b/Legacy/include/Acts/Propagator/AtlasStepper.hpp index 266258102..c88247f3b 100644 --- a/Legacy/include/Acts/Propagator/AtlasStepper.hpp +++ b/Legacy/include/Acts/Propagator/AtlasStepper.hpp @@ -154,7 +154,9 @@ public: update(const Parameters& pars) { // state is ready - noting to do - if (state_ready) return; + if (state_ready) { + return; + } const ActsVectorD<3> pos = pars.position(); const auto Vp = pars.parameters(); @@ -334,7 +336,9 @@ public: mom /= std::abs(state.pVector[6]); double P[45]; - for (unsigned int i = 0; i < 45; ++i) P[i] = state.pVector[i]; + for (unsigned int i = 0; i < 45; ++i) { + P[i] = state.pVector[i]; + } std::unique_ptr<const ActsSymMatrixD<NGlobalPars>> cov = nullptr; if (state.covariance) { @@ -361,8 +365,10 @@ public: double Ay[3] = {-Ax[1] * P[5], Ax[0] * P[5], An}; double S[3] = {P[3], P[4], P[5]}; - double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; - if (A != 0.) A = 1. / A; + double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; S[2] *= A; @@ -500,7 +506,9 @@ public: double A = state.pVector[3] * S[0] + state.pVector[4] * S[1] + state.pVector[5] * S[2]; - if (A != 0.) A = 1. / A; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; @@ -531,8 +539,10 @@ public: + state.pVector[5] * Ay[2]; // this is cos(beta) - double a = (1. - d) * (1. + d); - if (a != 0.) a = 1. / a; // i.e. 1./(1-d^2) + double a = (1. - d) * (1. + d); + if (a != 0.) { + a = 1. / a; // i.e. 1./(1-d^2) + } // that's the modified norm vector double X = d * Ay[0] - state.pVector[3]; // diff --git a/Legacy/include/Acts/Seeding/ATL_Seedmaker.hpp b/Legacy/include/Acts/Seeding/ATL_Seedmaker.hpp index 83b7aa286..44a9439a9 100644 --- a/Legacy/include/Acts/Seeding/ATL_Seedmaker.hpp +++ b/Legacy/include/Acts/Seeding/ATL_Seedmaker.hpp @@ -273,10 +273,11 @@ namespace Seeding { inline bool ATL_Seedmaker<SpacePoint>::isZCompatible(float& Zv) { - if (Zv < m_zminU || Zv > m_zmaxU) + if (Zv < m_zminU || Zv > m_zmaxU) { return false; - else + } else { return true; + } } /////////////////////////////////////////////////////////////////// @@ -297,7 +298,9 @@ namespace Seeding { float z = (fabs(r[2]) + m_zmax); float x = r[0] * m_dzdrmin; float y = r[1] * m_dzdrmin; - if ((z * z) < (x * x + y * y)) return 0; + if ((z * z) < (x * x + y * y)) { + return 0; + } } if (i_spforseed != l_spforseed.end()) { diff --git a/Legacy/include/Acts/Seeding/ATL_Seedmaker.ipp b/Legacy/include/Acts/Seeding/ATL_Seedmaker.ipp index 4af9240c2..9081bf73d 100644 --- a/Legacy/include/Acts/Seeding/ATL_Seedmaker.ipp +++ b/Legacy/include/Acts/Seeding/ATL_Seedmaker.ipp @@ -96,9 +96,15 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::ATL_Seedmaker() template <class SpacePoint> Acts::Seeding::ATL_Seedmaker<SpacePoint>::~ATL_Seedmaker() { - if (r_index) delete[] r_index; - if (r_map) delete[] r_map; - if (r_Sorted) delete[] r_Sorted; + if (r_index) { + delete[] r_index; + } + if (r_map) { + delete[] r_map; + } + if (r_Sorted) { + delete[] r_Sorted; + } // Delete seeds // @@ -111,16 +117,34 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::~ATL_Seedmaker() for (; i_spforseed != l_spforseed.end(); ++i_spforseed) { delete *i_spforseed; } - if (m_seedOutput) delete m_seedOutput; + if (m_seedOutput) { + delete m_seedOutput; + } - if (m_SP) delete[] m_SP; - if (m_R) delete[] m_R; - if (m_Tz) delete[] m_Tz; - if (m_Er) delete[] m_Er; - if (m_U) delete[] m_U; - if (m_V) delete[] m_V; - if (m_Zo) delete[] m_Zo; - if (m_OneSeeds) delete[] m_OneSeeds; + if (m_SP) { + delete[] m_SP; + } + if (m_R) { + delete[] m_R; + } + if (m_Tz) { + delete[] m_Tz; + } + if (m_Er) { + delete[] m_Er; + } + if (m_U) { + delete[] m_U; + } + if (m_V) { + delete[] m_V; + } + if (m_Zo) { + delete[] m_Zo; + } + if (m_OneSeeds) { + delete[] m_OneSeeds; + } } /////////////////////////////////////////////////////////////////// @@ -176,15 +200,21 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::newEvent(int iteration, for (; sp != spEnd; ++sp) { Acts::Seeding::SPForSeed<SpacePoint>* sps = newSpacePoint((*sp)); - if (!sps) continue; - int ir = int(sps->radius() * irstep); - if (ir > irmax) ir = irmax; + if (!sps) { + continue; + } + int ir = int(sps->radius() * irstep); + if (ir > irmax) { + ir = irmax; + } r_Sorted[ir].push_back(sps); // if there is exactly one SP in current bin, add bin nr in r_index (for // deletion later) // TODO overly complicated ++r_map[ir]; - if (r_map[ir] == 1) r_index[m_nr++] = ir; + if (r_map[ir] == 1) { + r_index[m_nr++] = ir; + } } fillLists(); @@ -223,7 +253,9 @@ template <class SpacePoint> void Acts::Seeding::ATL_Seedmaker<SpacePoint>::findNext() { - if (m_endlist) return; + if (m_endlist) { + return; + } i_seede = l_seeds.begin(); @@ -243,14 +275,22 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::buildFrameWork() { m_ptmin = fabs(m_ptmin); - if (m_ptmin < 100.) m_ptmin = 100.; + if (m_ptmin < 100.) { + m_ptmin = 100.; + } - if (m_diversss < m_diver) m_diversss = m_diver; - if (m_divermax < m_diversss) m_divermax = m_diversss; + if (m_diversss < m_diver) { + m_diversss = m_diver; + } + if (m_divermax < m_diversss) { + m_divermax = m_diversss; + } - if (fabs(m_etamin) < .1) m_etamin = -m_etamax; - m_dzdrmax0 = 1. / tan(2. * atan(exp(-m_etamax))); - m_dzdrmin0 = 1. / tan(2. * atan(exp(-m_etamin))); + if (fabs(m_etamin) < .1) { + m_etamin = -m_etamax; + } + m_dzdrmax0 = 1. / tan(2. * atan(exp(-m_etamax))); + m_dzdrmin0 = 1. / tan(2. * atan(exp(-m_etamin))); // scattering factor. depends on error, forward direction and distance between // SP @@ -280,16 +320,21 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::buildFrameWork() const float sFmax = float(NFmax) / pi2; const float m_sFmin = 100. / 60.; // make phi-slices for 400MeV tracks, unless ptMin is even smaller - float ptm = 400.; - if (m_ptmin < ptm) ptm = m_ptmin; + float ptm = 400.; + if (m_ptmin < ptm) { + ptm = m_ptmin; + } m_sF = ptm / 60.; - if (m_sF > sFmax) + if (m_sF > sFmax) { m_sF = sFmax; - else if (m_sF < m_sFmin) - m_sF = m_sFmin; - m_fNmax = int(pi2 * m_sF); - if (m_fNmax >= NFmax) m_fNmax = NFmax - 1; + } else if (m_sF < m_sFmin) { + m_sF = m_sFmin; + } + m_fNmax = int(pi2 * m_sF); + if (m_fNmax >= NFmax) { + m_fNmax = NFmax - 1; + } // Build radius-azimuthal-Z sorted containers // @@ -303,10 +348,14 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::buildFrameWork() // for (int f = 0; f <= m_fNmax; ++f) { - int fb = f - 1; - if (fb < 0) fb = m_fNmax; - int ft = f + 1; - if (ft > m_fNmax) ft = 0; + int fb = f - 1; + if (fb < 0) { + fb = m_fNmax; + } + int ft = f + 1; + if (ft > m_fNmax) { + ft = 0; + } // For each azimuthal region loop through all Z regions // @@ -376,17 +425,34 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::buildFrameWork() } } - if (!m_SP) m_SP = new Acts::Seeding::SPForSeed<SpacePoint>*[m_maxsizeSP]; - if (!m_R) m_R = new float[m_maxsizeSP]; - if (!m_Tz) m_Tz = new float[m_maxsizeSP]; - if (!m_Er) m_Er = new float[m_maxsizeSP]; - if (!m_U) m_U = new float[m_maxsizeSP]; - if (!m_V) m_V = new float[m_maxsizeSP]; - if (!m_Zo) m_Zo = new float[m_maxsizeSP]; - if (!m_OneSeeds) + if (!m_SP) { + m_SP = new Acts::Seeding::SPForSeed<SpacePoint>*[m_maxsizeSP]; + } + if (!m_R) { + m_R = new float[m_maxsizeSP]; + } + if (!m_Tz) { + m_Tz = new float[m_maxsizeSP]; + } + if (!m_Er) { + m_Er = new float[m_maxsizeSP]; + } + if (!m_U) { + m_U = new float[m_maxsizeSP]; + } + if (!m_V) { + m_V = new float[m_maxsizeSP]; + } + if (!m_Zo) { + m_Zo = new float[m_maxsizeSP]; + } + if (!m_OneSeeds) { m_OneSeeds = new Acts::Seeding::InternalSeed<SpacePoint>[m_maxOneSize]; + } - if (!m_seedOutput) m_seedOutput = new Acts::Seeding::Seed<SpacePoint>(); + if (!m_seedOutput) { + m_seedOutput = new Acts::Seeding::Seed<SpacePoint>(); + } i_seed = l_seeds.begin(); i_seede = l_seeds.end(); @@ -443,21 +509,28 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::fillLists() } for (int i = r_first; i != r_size; ++i) { - if (!r_map[i]) continue; + if (!r_map[i]) { + continue; + } r = r_Sorted[i].begin(); re = r_Sorted[i].end(); - if (!ir0) ir0 = i; + if (!ir0) { + ir0 = i; + } // if not 1st event if (m_iteration) { // if (!(*r)->spacepoint->clusterList().second) { - if (i < 20) ibl = true; - } else if (ibl) + if (i < 20) { + ibl = true; + } + } else if (ibl) { break; - else if (i > 175) + } else if (i > 175) { break; + } } for (; r != re; ++r) { @@ -465,7 +538,9 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::fillLists() // Azimuthal (Phi) angle sort // bin nr "f" is phi * phi-slices float F = (*r)->phi(); - if (F < 0.) F += pi2; + if (F < 0.) { + F += pi2; + } int f = int(F * m_sF); f<0 ? f = m_fNmax : f> m_fNmax ? f = 0 : f = f; @@ -497,7 +572,9 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::fillLists() // rfz_map, // if 1st entry record non-empty bin in "rfz_index" rfz_Sorted[n].push_back(*r); - if (!rfz_map[n]++) rfz_index[m_nrfz++] = n; + if (!rfz_map[n]++) { + rfz_index[m_nrfz++] = n; + } } } m_state = 0; @@ -530,7 +607,9 @@ void Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp() { // if less than 3 sp in total - if (m_nsaz < 3) return; + if (m_nsaz < 3) { + return; + } m_seeds.clear(); // indices for the z-regions array in weird order. @@ -546,18 +625,24 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp() // For each azimuthal region loop through all Z regions // first for barrel, then left EC, then right EC - int z = 0; - if (!m_endlist) z = m_zMin; + int z = 0; + if (!m_endlist) { + z = m_zMin; + } for (; z != 11; ++z) { int a = f * 11 + ZI[z]; - if (!rfz_map[a]) continue; + if (!rfz_map[a]) { + continue; + } int NB = 0, NT = 0; for (int i = 0; i != rfz_b[a]; ++i) { int an = rfz_ib[a][i]; // if bin has no entry: continue - if (!rfz_map[an]) continue; + if (!rfz_map[an]) { + continue; + } // assign begin-pointer and end-pointer of current bin to rb and rbe rb[NB] = rfz_Sorted[an].begin(); rbe[NB++] = rfz_Sorted[an].end(); @@ -566,7 +651,9 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp() int an = rfz_it[a][i]; // if bin has no entry: continue - if (!rfz_map[an]) continue; + if (!rfz_map[an]) { + continue; + } // assign begin-pointer and end-pointer of current bin to rt and rte rt[NT] = rfz_Sorted[an].begin(); rte[NT++] = rfz_Sorted[an].end(); @@ -647,25 +734,36 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp( // because it has no more sp with lower radii // OR break because processing PPP and encountered SCT SP if (dR < m_drmin - || (m_iteration && (*r)->spacepoint->clusterList().second)) + || (m_iteration && (*r)->spacepoint->clusterList().second)) { break; - if ((*r)->surface() == sur0) continue; + } + if ((*r)->surface() == sur0) { + continue; + } // forward direction of SP duplet float Tz = (Z - (*r)->z()) / dR; float aTz = fabs(Tz); // why also exclude seeds with small pseudorapidity?? - if (aTz < m_dzdrmin || aTz > m_dzdrmax) continue; + if (aTz < m_dzdrmin || aTz > m_dzdrmax) { + continue; + } // Comparison with vertices Z coordinates // continue if duplet origin not within collision region on z axis float Zo = Z - R * Tz; - if (!isZCompatible(Zo)) continue; + if (!isZCompatible(Zo)) { + continue; + } m_SP[Nb] = (*r); - if (++Nb == m_maxsizeSP) goto breakb; + if (++Nb == m_maxsizeSP) { + goto breakb; + } } } breakb: - if (!Nb || Nb == m_maxsizeSP) continue; + if (!Nb || Nb == m_maxsizeSP) { + continue; + } int Nt = Nb; // Top links production @@ -681,26 +779,38 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp( rt[i] = r; continue; } - if (dR > m_drmax) break; + if (dR > m_drmax) { + break; + } // TODO: is check if in same surface necessary? - if ((*r)->surface() == sur0) continue; + if ((*r)->surface() == sur0) { + continue; + } float Tz = ((*r)->z() - Z) / dR; float aTz = fabs(Tz); - if (aTz < m_dzdrmin || aTz > m_dzdrmax) continue; + if (aTz < m_dzdrmin || aTz > m_dzdrmax) { + continue; + } // Comparison with vertices Z coordinates // float Zo = Z - R * Tz; - if (!isZCompatible(Zo)) continue; + if (!isZCompatible(Zo)) { + continue; + } m_SP[Nt] = (*r); - if (++Nt == m_maxsizeSP) goto breakt; + if (++Nt == m_maxsizeSP) { + goto breakt; + } } } breakt: - if (!(Nt - Nb)) continue; + if (!(Nt - Nb)) { + continue; + } float covr0 = (*r0)->covr(); float covz0 = (*r0)->covz(); float ax = X / R; @@ -723,9 +833,11 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp( // 1/(r*r) = 1/dx*dx+dy*dy = 1/(distance between the two points)^2 float r2 = 1. / (x * x + y * y); // 1/r - float dr = sqrt(r2); - float tz = dz * dr; - if (i < Nb) tz = -tz; + float dr = sqrt(r2); + float tz = dz * dr; + if (i < Nb) { + tz = -tz; + } m_Tz[i] = tz; m_Zo[i] = Z - R * tz; @@ -754,25 +866,33 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::production3Sp( // CSA = curvature^2/(pT^2 * sin^2(theta)) * scatteringFactor float CSA = Tzb2 * COFK; // ICSA = (1/(pT^2 * sin^2(theta)) * scatteringFactor - float ICSA = Tzb2 * ipt2C; - float imax = imaxp; - if (m_SP[b]->spacepoint->clusterList().second) imax = imaxs; + float ICSA = Tzb2 * ipt2C; + float imax = imaxp; + if (m_SP[b]->spacepoint->clusterList().second) { + imax = imaxs; + } for (int t = Nb; t != Nt; ++t) { float dT = ((Tzb - m_Tz[t]) * (Tzb - m_Tz[t]) - m_R[t] * Rb2z - (Erb + m_Er[t])) - (m_R[t] * Rb2r) * ((Tzb + m_Tz[t]) * (Tzb + m_Tz[t])); - if (dT > ICSA) continue; + if (dT > ICSA) { + continue; + } float dU = m_U[t] - Ub; - if (dU == 0.) continue; + if (dU == 0.) { + continue; + } float A = (m_V[t] - Vb) / dU; float S2 = 1. + A * A; float B = Vb - A * Ub; float B2 = B * B; // B2/S2=1/helixradius^2 - if (B2 > ipt2K * S2 || dT * S2 > B2 * CSA) continue; + if (B2 > ipt2K * S2 || dT * S2 > B2 * CSA) { + continue; + } float Im = fabs((A - B * R) * R); @@ -834,7 +954,9 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::newOneSeed( reverse_iterator l = m_mapOneSeeds.rbegin(); - if ((*l).first <= q) return; + if ((*l).first <= q) { + return; + } Acts::Seeding::InternalSeed<SpacePoint>* s = (*l).second; s->set(p1, p2, p3, z); @@ -891,31 +1013,41 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::newOneSeedWithCurvaturesComparison( float Rma = 0.; bool in = false; - if (!pixb) + if (!pixb) { u -= 400.; - else if (pixt) + } else if (pixt) { u -= 200.; + } for (j = jn; j != ie; ++j) { - if (j == i) continue; + if (j == i) { + continue; + } if ((*j).first < Ci1) { jn = j; ++jn; continue; } - if ((*j).first > Ci2) break; - if ((*j).second->surface() == Sui) continue; + if ((*j).first > Ci2) { + break; + } + if ((*j).second->surface() == Sui) { + continue; + } // Compared seeds should have at least deltaRMin distance float Rj = (*j).second->radius(); - if (fabs(Rj - Ri) < m_drmin) continue; + if (fabs(Rj - Ri) < m_drmin) { + continue; + } if (in) { - if (Rj > Rma) + if (Rj > Rma) { Rma = Rj; - else if (Rj < Rmi) + } else if (Rj < Rmi) { Rmi = Rj; - else + } else { continue; + } // add 200 to quality if 2 compatible seeds with high deltaR of their // spT have been found // (i.e. potential track spans 5 surfaces) @@ -931,17 +1063,23 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::newOneSeedWithCurvaturesComparison( } } // if quality is below threshold, discard seed - if (u > m_umax) continue; + if (u > m_umax) { + continue; + } // if mixed seed and no compatible seed was found, discard seed if (pixb != pixt) { - if (u > 0. || (u > ub && u > u0 && u > (*i).second->quality())) continue; + if (u > 0. || (u > ub && u > u0 && u > (*i).second->quality())) { + continue; + } } // if sct seed and at least 1 comp seed was found, accept even seeds with // larger impact params + cot theta penalty // m_diversss < Impact parameters + penalty for cot(theta) difference < // m_divermax // (if m_diversss set smaller than m_divermax, else m_diversss=m_divermax) - if (!pixb && Im > m_diversss && u > Im - 500.) continue; + if (!pixb && Im > m_diversss && u > Im - 500.) { + continue; + } newOneSeed(SPb, SP0, (*i).second, Zob, u); } @@ -962,7 +1100,9 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::fillSeeds() = m_mapOneSeeds.begin(), l = m_mapOneSeeds.begin(), le = m_mapOneSeeds.end(); - if (l == le) return; + if (l == le) { + return; + } Acts::Seeding::InternalSeed<SpacePoint>* s; @@ -970,8 +1110,12 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::fillSeeds() float w = (*l).first; s = (*l).second; - if (l != lf && s->spacepoint0()->radius() < 43. && w > -200.) continue; - if (!s->setQuality(w)) continue; + if (l != lf && s->spacepoint0()->radius() < 43. && w > -200.) { + continue; + } + if (!s->setQuality(w)) { + continue; + } if (i_seede != l_seeds.end()) { s = (*i_seede++); @@ -982,12 +1126,13 @@ Acts::Seeding::ATL_Seedmaker<SpacePoint>::fillSeeds() i_seede = l_seeds.end(); } - if (s->spacepoint0()->spacepoint->clusterList().second) + if (s->spacepoint0()->spacepoint->clusterList().second) { w -= 3000.; - else if (s->spacepoint1()->spacepoint->clusterList().second) + } else if (s->spacepoint1()->spacepoint->clusterList().second) { w -= 2000.; - else if (s->spacepoint2()->spacepoint->clusterList().second) + } else if (s->spacepoint2()->spacepoint->clusterList().second) { w -= 1000.; + } m_seeds.insert(std::make_pair(w, s)); ++m_fillOneSeeds; diff --git a/Legacy/include/Acts/Seeding/InternalSeed.hpp b/Legacy/include/Acts/Seeding/InternalSeed.hpp index 12f6d798a..bf4248899 100644 --- a/Legacy/include/Acts/Seeding/InternalSeed.hpp +++ b/Legacy/include/Acts/Seeding/InternalSeed.hpp @@ -171,8 +171,9 @@ namespace Seeding { if (pixb != pixt) { if (m_q > m_s0->quality() && m_q > m_s1->quality() - && m_q > m_s2->quality()) + && m_q > m_s2->quality()) { return false; + } } m_s0->setQuality(m_q); @@ -204,8 +205,9 @@ namespace Seeding { m_s2->setQuality(q); return true; } - if (q < m_s0->quality() || q < m_s1->quality() || q < m_s2->quality()) + if (q < m_s0->quality() || q < m_s1->quality() || q < m_s2->quality()) { return true; + } return false; } diff --git a/Legacy/include/Acts/Seeding/SPForSeed.hpp b/Legacy/include/Acts/Seeding/SPForSeed.hpp index 6e4144e8c..776579973 100644 --- a/Legacy/include/Acts/Seeding/SPForSeed.hpp +++ b/Legacy/include/Acts/Seeding/SPForSeed.hpp @@ -210,15 +210,23 @@ namespace Seeding { m_q = 100000.; if (!sp->clusterList().second) { - m_covr = sp->covr * 9.; - m_covz = sp->covz * 9.; - if (m_covr < 0.06) m_covr = 0.06; - if (m_covz < 0.06) m_covz = 0.06; + m_covr = sp->covr * 9.; + m_covz = sp->covz * 9.; + if (m_covr < 0.06) { + m_covr = 0.06; + } + if (m_covz < 0.06) { + m_covz = 0.06; + } } else { - m_covr = sp->covr * 8.; - m_covz = sp->covz * 8.; - if (m_covr < 0.1) m_covr = 0.1; - if (m_covz < 0.1) m_covz = 0.1; + m_covr = sp->covr * 8.; + m_covz = sp->covz * 8.; + if (m_covr < 0.1) { + m_covr = 0.1; + } + if (m_covz < 0.1) { + m_covz = 0.1; + } } } @@ -243,15 +251,23 @@ namespace Seeding { m_r = sqrt(m_x * m_x + m_y * m_y); m_q = 100000.; if (!sp->clusterList().second) { - m_covr = sp->covr * 9. * sc[0]; - m_covz = sp->covz * 9. * sc[1]; - if (m_covr < 0.06) m_covr = 0.06; - if (m_covz < 0.06) m_covz = 0.06; + m_covr = sp->covr * 9. * sc[0]; + m_covz = sp->covz * 9. * sc[1]; + if (m_covr < 0.06) { + m_covr = 0.06; + } + if (m_covz < 0.06) { + m_covz = 0.06; + } } else { - m_covr = sp->covr * 8. * sc[2]; - m_covz = sp->covz * 8. * sc[3]; - if (m_covr < 0.1) m_covr = 0.1; - if (m_covz < 0.1) m_covz = 0.1; + m_covr = sp->covr * 8. * sc[2]; + m_covz = sp->covz * 8. * sc[3]; + if (m_covr < 0.1) { + m_covr = 0.1; + } + if (m_covz < 0.1) { + m_covz = 0.1; + } } // old code: @@ -290,7 +306,9 @@ namespace Seeding { inline void SPForSeed<SpacePoint>::setQuality(float q) { - if (q <= m_q) m_q = q; + if (q <= m_q) { + m_q = q; + } } } // end of Seeding namespace diff --git a/Legacy/src/Extrapolation/MaterialEffectsEngine.cpp b/Legacy/src/Extrapolation/MaterialEffectsEngine.cpp index 9bf42b182..90d6a89d9 100644 --- a/Legacy/src/Extrapolation/MaterialEffectsEngine.cpp +++ b/Legacy/src/Extrapolation/MaterialEffectsEngine.cpp @@ -152,7 +152,9 @@ Acts::MaterialEffectsEngine::updateTrackParameters( size_t surfaceID) const { // return if you have nothing to do - if (!mSurface.associatedMaterial()) return; + if (!mSurface.associatedMaterial()) { + return; + } // parameters are the lead parameters auto& mParameters = (*eCell.leadParameters); @@ -222,8 +224,9 @@ Acts::MaterialEffectsEngine::updateTrackParameters( double sigmaDeltaE = thickness * pathCorrection * sigmaP; double sigmaQoverP = sigmaDeltaE / std::pow(beta * p, 2); // update the covariance if needed - if (mutableUCovariance) + if (mutableUCovariance) { (*mutableUCovariance)(eQOP, eQOP) += sign * sigmaQoverP * sigmaQoverP; + } } // (B) - update the covariance if needed if (mutableUCovariance && m_cfg.mscCorrection) { diff --git a/Legacy/src/Extrapolation/RungeKuttaUtils.cpp b/Legacy/src/Extrapolation/RungeKuttaUtils.cpp index ade567cea..e62122c8f 100644 --- a/Legacy/src/Extrapolation/RungeKuttaUtils.cpp +++ b/Legacy/src/Extrapolation/RungeKuttaUtils.cpp @@ -40,7 +40,9 @@ Acts::RungeKuttaUtils::transformLocalToGlobal(bool useJac, double* P) const { const Acts::TrackParameters* pTp = &Tp; - if (!pTp) return false; + if (!pTp) { + return false; + } const ActsVectorD<NGlobalPars> Vp = Tp.parameters(); double p[5]; @@ -65,7 +67,9 @@ Acts::RungeKuttaUtils::transformLocalToGlobal(bool useJac, double* P) const { const Acts::NeutralParameters* pTp = &Tp; - if (!pTp) return false; + if (!pTp) { + return false; + } const ActsVectorD<NGlobalPars> Vp = Tp.parameters(); double p[5]; @@ -104,20 +108,23 @@ Acts::RungeKuttaUtils::transformGlobalToLocal(const Acts::Surface* su, unsigned int ty = su->type(); - if (ty == Acts::Surface::Plane) + if (ty == Acts::Surface::Plane) { transformGlobalToPlane(su, useJac, P, par, Jac); - else if (ty == Acts::Surface::Straw) + } else if (ty == Acts::Surface::Straw) { transformGlobalToLine(su, useJac, P, par, Jac); - else if (ty == Acts::Surface::Cylinder) + } else if (ty == Acts::Surface::Cylinder) { transformGlobalToCylinder(su, useJac, P, par, Jac); - else if (ty == Acts::Surface::Perigee) + } else if (ty == Acts::Surface::Perigee) { transformGlobalToLine(su, useJac, P, par, Jac); - else if (ty == Acts::Surface::Disc) + } else if (ty == Acts::Surface::Disc) { transformGlobalToDisc(su, useJac, P, par, Jac); - else + } else { transformGlobalToCone(su, useJac, P, par, Jac); + } - if (!useJac) return; + if (!useJac) { + return; + } double P3, P4, C = P[3] * P[3] + P[4] * P[4]; if (C > 1.e-20) { @@ -165,14 +172,18 @@ Acts::RungeKuttaUtils::transformGlobalToPlane(const Acts::Surface* su, par[0] = d[0] * Ax[0] + d[1] * Ax[1] + d[2] * Ax[2]; par[1] = d[0] * Ay[0] + d[1] * Ay[1] + d[2] * Ay[2]; - if (!useJac) return; + if (!useJac) { + return; + } // Condition trajectory on surface // double S[3] = {T(0, 2), T(1, 2), T(2, 2)}; - double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; - if (A != 0.) A = 1. / A; + double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; S[2] *= A; @@ -257,14 +268,18 @@ Acts::RungeKuttaUtils::transformGlobalToDisc(const Acts::Surface* su, par[0] = sqrt(R2); par[1] = atan2(RS, RC); - if (!useJac) return; + if (!useJac) { + return; + } // Condition trajectory on surface // double S[3] = {T(0, 2), T(1, 2), T(2, 2)}; - double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; - if (A != 0.) A = 1. / A; + double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; S[2] *= A; @@ -356,7 +371,9 @@ Acts::RungeKuttaUtils::transformGlobalToCylinder(const Acts::Surface* su, par[0] = atan2(RS, RC) * R; par[1] = x * Az[0] + y * Az[1] + z * Az[2]; - if (!useJac) return; + if (!useJac) { + return; + } // Condition trajectory on surface // @@ -368,8 +385,10 @@ Acts::RungeKuttaUtils::transformGlobalToCylinder(const Acts::Surface* su, y -= (B * Az[1]); double az = P[5] - Az[2] * C; z -= (B * Az[2]); - double A = (ax * x + ay * y + az * z); - if (A != 0.) A = 1. / A; + double A = (ax * x + ay * y + az * z); + if (A != 0.) { + A = 1. / A; + } x *= A; y *= A; z *= A; @@ -459,14 +478,18 @@ Acts::RungeKuttaUtils::transformGlobalToLine(const Acts::Surface* su, par[0] = x * Bx + y * By + z * Bz; par[1] = x * A[0] + y * A[1] + z * A[2]; // return here if you have no jacobian transport to do - if (!useJac) return; + if (!useJac) { + return; + } // Condition trajectory on surface // // this is the projection of the direction onto the y axis of ref frame - double d = P[3] * A[0] + P[4] * A[1] + P[5] * A[2]; - double a = (1. - d) * (1. + d); - if (a != 0.) a = 1. / a; + double d = P[3] * A[0] + P[4] * A[1] + P[5] * A[2]; + double a = (1. - d) * (1. + d); + if (a != 0.) { + a = 1. / a; + } double X = d * A[0] - P[3]; double Y = d * A[1] - P[4]; @@ -570,7 +593,9 @@ Acts::RungeKuttaUtils::transformGlobalToCone(const Acts::Surface* su, par[1] = x * Az[0] + y * Az[1] + z * Az[2]; par[0] = atan2(RS, RC) * (par[1] * tA); - if (!useJac) return; + if (!useJac) { + return; + } Jac[0] = 0.; // dL0/dL0 Jac[1] = 0.; // dL0/dL1 @@ -596,14 +621,15 @@ Acts::RungeKuttaUtils::stepEstimator(int kind, double maxStep) const { double s = maxStep; - if (kind == 1) + if (kind == 1) { s = stepEstimatorToPlane(Su, P, Q, istep); - else if (kind == 0) + } else if (kind == 0) { s = stepEstimatorToStraw(Su, P, Q, istep); - else if (kind == 2) + } else if (kind == 2) { s = stepEstimatorToCylinder(Su, P, Q, istep); - else if (kind == 3) + } else if (kind == 3) { s = stepEstimatorToCone(Su, P, Q, istep); + } return (s > maxStep ? maxStep : s); } @@ -687,22 +713,32 @@ Acts::RungeKuttaUtils::stepEstimatorToCylinder(double* S, double inside = Smin * Smax; if (S[8] != 0.) { - if (inside > 0. || S[8] > 0.) return Smin; + if (inside > 0. || S[8] > 0.) { + return Smin; + } if (S[7] >= 0.) { - if (Smin >= 0.) return Smin; + if (Smin >= 0.) { + return Smin; + } return Smax; } - if (Smin <= 0.) return Smin; + if (Smin <= 0.) { + return Smin; + } return Smax; } if (inside < 0.) { S[8] = -1.; if (S[7] >= 0.) { - if (Smin >= 0.) return Smin; + if (Smin >= 0.) { + return Smin; + } return Smax; } - if (Smin <= 0.) return Smin; + if (Smin <= 0.) { + return Smin; + } return Smax; } @@ -808,22 +844,32 @@ Acts::RungeKuttaUtils::stepEstimatorToCone(double* S, double inside = Smin * Smax; if (S[8] != 0.) { - if (inside > 0. || S[8] > 0.) return Smin; + if (inside > 0. || S[8] > 0.) { + return Smin; + } if (S[7] >= 0.) { - if (Smin >= 0.) return Smin; + if (Smin >= 0.) { + return Smin; + } return Smax; } - if (Smin <= 0.) return Smin; + if (Smin <= 0.) { + return Smin; + } return Smax; } if (inside < 0.) { S[8] = -1.; if (S[7] >= 0.) { - if (Smin >= 0.) return Smin; + if (Smin >= 0.) { + return Smin; + } return Smax; } - if (Smin <= 0.) return Smin; + if (Smin <= 0.) { + return Smin; + } return Smax; } @@ -963,7 +1009,9 @@ Acts::RungeKuttaUtils::transformPlaneToGlobal(bool useJac, P[1] = p[0] * Ax[1] + p[1] * Ay[1] + T(1, 3); // Y P[2] = p[0] * Ax[2] + p[1] * Ay[2] + T(2, 3); // Z - if (!useJac) return; + if (!useJac) { + return; + } // /dL1 | /dL2 | /dPhi | /dThe | P[7] = Ax[0]; @@ -1002,7 +1050,9 @@ Acts::RungeKuttaUtils::transformDiscToGlobal(bool useJac, P[1] = p[0] * d1 + T(1, 3); // Y P[2] = p[0] * d2 + T(2, 3); // Z - if (!useJac) return; + if (!useJac) { + return; + } // /dL1 | /dL2 | /dPhi | /dThe | P[7] = d0; @@ -1043,7 +1093,9 @@ Acts::RungeKuttaUtils::transformCylinderToGlobal(bool useJac, P[1] = R * (Cf * Ax[1] + Sf * Ay[1]) + p[1] * Az[1] + T(1, 3); // Y P[2] = R * (Cf * Ax[2] + Sf * Ay[2]) + p[1] * Az[2] + T(2, 3); // Z - if (!useJac) return; + if (!useJac) { + return; + } // /dL1 | /dL2 | /dPhi | /dThe | P[7] = Cf * Ay[0] - Sf * Ax[0]; @@ -1088,7 +1140,9 @@ Acts::RungeKuttaUtils::transformLineToGlobal(bool useJac, P[1] = p[1] * A[1] + By * p[0] + T(1, 3); // Y P[2] = p[1] * A[2] + Bz * p[0] + T(2, 3); // Z - if (!useJac) return; + if (!useJac) { + return; + } double Bx2 = -A[2] * P[25]; double Bx3 = A[1] * P[33] - A[2] * P[32]; @@ -1131,7 +1185,9 @@ Acts::RungeKuttaUtils::transformLocalToGlobal(bool useJac, const double* p, double* P) const { - if (!su) return false; + if (!su) { + return false; + } double Sf, Cf, Ce, Se; sincos(p[2], &Sf, &Cf); @@ -1212,7 +1268,9 @@ Acts::RungeKuttaUtils::transformGlobalToCurvilinear(bool useJac, par[0] = 0.; par[1] = 0.; - if (!useJac) return; + if (!useJac) { + return; + } double An = sqrt(P[3] * P[3] + P[4] * P[4]); double Ax[3]; @@ -1229,8 +1287,10 @@ Acts::RungeKuttaUtils::transformGlobalToCurvilinear(bool useJac, double Ay[3] = {-Ax[1] * P[5], Ax[0] * P[5], An}; double S[3] = {P[3], P[4], P[5]}; - double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; - if (A != 0.) A = 1. / A; + double A = P[3] * S[0] + P[4] * S[1] + P[5] * S[2]; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; S[2] *= A; @@ -1473,8 +1533,10 @@ Acts::RungeKuttaUtils::jacobianTransformCurvilinearToPlane(double* P, double* Ay = &P[16]; double* S = &P[19]; - double A = At[0] * S[0] + At[1] * S[1] + At[2] * S[2]; - if (A != 0.) A = 1. / A; + double A = At[0] * S[0] + At[1] * S[1] + At[2] * S[2]; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; S[2] *= A; @@ -1516,8 +1578,10 @@ Acts::RungeKuttaUtils::jacobianTransformCurvilinearToDisc(double* P, // Condition trajectory on surface // - double A = At[0] * S[0] + At[1] * S[1] + At[2] * S[2]; - if (A != 0.) A = 1. / A; + double A = At[0] * S[0] + At[1] * S[1] + At[2] * S[2]; + if (A != 0.) { + A = 1. / A; + } S[0] *= A; S[1] *= A; S[2] *= A; @@ -1581,12 +1645,14 @@ Acts::RungeKuttaUtils::jacobianTransformCurvilinearToCylinder(double* P, // Condition trajectory on surface // - double C = At[0] * Az[0] + At[1] * Az[1] + At[2] * Az[2]; - double ax = At[0] - Az[0] * C; - double ay = At[1] - Az[1] * C; - double az = At[2] - Az[2] * C; - double A = (ax * x + ay * y + az * z); - if (A != 0.) A = 1. / A; + double C = At[0] * Az[0] + At[1] * Az[1] + At[2] * Az[2]; + double ax = At[0] - Az[0] * C; + double ay = At[1] - Az[1] * C; + double az = At[2] - Az[2] * C; + double A = (ax * x + ay * y + az * z); + if (A != 0.) { + A = 1. / A; + } double s1 = (Au[0] * x + Au[1] * y) * A; double s2 = (Av[0] * x + Av[1] * y + Av[2] * z) * A; @@ -1639,9 +1705,11 @@ Acts::RungeKuttaUtils::jacobianTransformCurvilinearToLine(double* P, // Condition trajectory on surface // - double d = At[0] * A[0] + At[1] * A[1] + At[2] * A[2]; - double a = (1. - d) * (1. + d); - if (a != 0.) a = 1. / a; + double d = At[0] * A[0] + At[1] * A[1] + At[2] * A[2]; + double a = (1. - d) * (1. + d); + if (a != 0.) { + a = 1. / a; + } double X = d * A[0] - At[0], Y = d * A[1] - At[1], Z = d * A[2] - At[2]; double s1 = (Au[0] * X + Au[1] * Y) * a; diff --git a/Legacy/src/Utilities/MaterialInteraction.cpp b/Legacy/src/Utilities/MaterialInteraction.cpp index 6f0bac1c8..f3d69e300 100644 --- a/Legacy/src/Utilities/MaterialInteraction.cpp +++ b/Legacy/src/Utilities/MaterialInteraction.cpp @@ -117,7 +117,9 @@ std::pair<double, double> radiationEnergyLoss(double p, const Material& mat, ParticleType particle) { double sigma = 0.; - if (!(mat)) return std::pair<double, double>(0., 0.); + if (!(mat)) { + return std::pair<double, double>(0., 0.); + } // preparation of kinetic constants double m = particleMasses.mass[particle]; @@ -157,7 +159,9 @@ radiationEnergyLoss(double p, const Material& mat, ParticleType particle) double sigmaMS(double dInX0, double p, double beta) { - if (dInX0 == 0. || p == 0. || beta == 0.) return 0.; + if (dInX0 == 0. || p == 0. || beta == 0.) { + return 0.; + } // Highland formula - projected sigma_s // ATL-SOFT-PUB-2008-003 equation (15) diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp index d4a921f3e..1935bc93a 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ActsExtension.hpp @@ -258,7 +258,9 @@ ActsExtension::isLayer() const inline bool ActsExtension::hasSupportMaterial() const { - if ((m_cfg.materialBins1 > 0) || (m_cfg.materialBins2 > 0)) return true; + if ((m_cfg.materialBins1 > 0) || (m_cfg.materialBins2 > 0)) { + return true; + } return false; } diff --git a/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp b/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp index 48aad11e2..9ecc74657 100644 --- a/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp +++ b/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp @@ -78,12 +78,15 @@ convertDD4hepDetector( } // set the beam pipe beamPipeVolumeBuilder = volBuilder; - } else + } else { volumeBuilders.push_back(volBuilder); + } } } // Finally add the beam pipe - if (beamPipeVolumeBuilder) volumeBuilders.push_back(beamPipeVolumeBuilder); + if (beamPipeVolumeBuilder) { + volumeBuilders.push_back(beamPipeVolumeBuilder); + } // create cylinder volume helper auto volumeHelper = cylinderVolumeHelper_dd4hep(); // hand over the collected volume builders @@ -159,10 +162,11 @@ volumeBuilder_dd4hep(dd4hep::DetElement subDetector, ->GetMatrix() ->GetTranslation()[2] * units::_cm; - } else + } else { 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 IActsExtension* volumeExtension = nullptr; @@ -181,32 +185,35 @@ volumeBuilder_dd4hep(dd4hep::DetElement subDetector, std::string("[V] Subvolume : '") + volumeDetElement.name() + std::string("' is a disc volume -> handling as an endcap")); if (zPos < 0.) { - if (nEndCap) + if (nEndCap) { throw std::logic_error( "[V] Negative Endcap was already given for this " "hierachy! Please create a new " "DD4hep_SubDetectorAssembly for the next " "hierarchy."); + } nEndCap = true; ACTS_VERBOSE("[V] ->is negative endcap"); collectLayers_dd4hep(volumeDetElement, negativeLayers); } else { - if (pEndCap) + if (pEndCap) { throw std::logic_error( "[V] Positive Endcap was already given for this " "hierachy! Please create a new " "DD4hep_SubDetectorAssembly for the next " "hierarchy."); + } pEndCap = true; ACTS_VERBOSE("[V] ->is positive endcap"); collectLayers_dd4hep(volumeDetElement, positiveLayers); } } else if (volumeExtension->isBarrel()) { - if (barrel) + if (barrel) { throw std::logic_error("[V] Barrel was already given for this " "hierachy! Please create a new " "DD4hep_SubDetectorAssembly for the next " "hierarchy."); + } barrel = true; ACTS_VERBOSE("[V] Subvolume : " << volumeDetElement.name() @@ -221,11 +228,12 @@ volumeBuilder_dd4hep(dd4hep::DetElement subDetector, "check your detector construction.")); } } - if ((pEndCap && !nEndCap) || (!pEndCap && nEndCap)) + if ((pEndCap && !nEndCap) || (!pEndCap && nEndCap)) { throw std::logic_error("Only one Endcap is given for the current " "hierarchy! Endcaps should always occur in " "pairs. Please check your detector " "construction."); + } // configure SurfaceArrayCreator auto surfaceArrayCreator @@ -286,9 +294,10 @@ volumeBuilder_dd4hep(dd4hep::DetElement subDetector, TGeoShape* geoShape = subDetector.placement().ptr()->GetVolume()->GetShape(); TGeoTubeSeg* tube = dynamic_cast<TGeoTubeSeg*>(geoShape); - if (!tube) + if (!tube) { throw std::logic_error( "Beampipe has wrong shape - needs to be TGeoTubeSeg!"); + } // get the dimension of TGeo and convert lengths double rMin = tube->GetRmin() * units::_cm + layerEnvelopeR; double rMax = tube->GetRmax() * units::_cm - layerEnvelopeR; @@ -375,10 +384,11 @@ volumeBuilder_dd4hep(dd4hep::DetElement subDetector, TGeoShape* geoShape = subDetector.placement().ptr()->GetVolume()->GetShape(); // this should not happen - if (!geoShape) + if (!geoShape) { throw std::logic_error(std::string("Volume of DetElement: ") + subDetector.name() + std::string(" has no a shape!")); + } // get the possible material /// @todo volume material currently not used diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 25d104b7a..26d25a7b0 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -99,7 +99,9 @@ Acts::DD4hepLayerBuilder::negativeLayers() const = (transform->translation() + transform->rotation().col(2) * tube->GetDz() * units::_cm) .z(); - if (zMin > zMax) std::swap(zMin, zMax); + if (zMin > zMax) { + std::swap(zMin, zMax); + } // check if layer has surfaces if (layerSurfaces.empty()) { @@ -120,12 +122,13 @@ Acts::DD4hepLayerBuilder::negativeLayers() const pl.envZ = {std::abs(zMin - pl.minZ), std::abs(zMax - pl.maxZ)}; pl.envR = {std::abs(rMin - pl.minR), std::abs(rMax - pl.maxR)}; } - } else + } else { throw std::logic_error( std::string("Layer DetElement: ") + detElement.name() + std::string(" has neither a shape nor tolerances for envelopes " "added to itÂ¥s extension. Please check your detector " "constructor!")); + } // if the layer should carry material it will be marked by assigning a // SurfaceMaterialProxy @@ -172,7 +175,9 @@ Acts::DD4hepLayerBuilder::negativeLayers() const Vector3D outerPos = transform->translation() + transform->rotation().col(2) * layerThickness * 0.5; - if (innerPos.z() > outerPos.z()) std::swap(innerPos, outerPos); + if (innerPos.z() > outerPos.z()) { + std::swap(innerPos, outerPos); + } Acts::DiscSurface* innerBoundary = new Acts::DiscSurface(std::make_shared<const Transform3D>( @@ -190,14 +195,17 @@ Acts::DD4hepLayerBuilder::negativeLayers() const = new Acts::DiscSurface(transform, pl.minR, pl.maxR); // set material surface - if (layerPos == Acts::LayerMaterialPos::inner) + if (layerPos == Acts::LayerMaterialPos::inner) { innerBoundary->setAssociatedMaterial(materialProxy); + } - if (layerPos == Acts::LayerMaterialPos::outer) + if (layerPos == Acts::LayerMaterialPos::outer) { outerBoundary->setAssociatedMaterial(materialProxy); + } - if (layerPos == Acts::LayerMaterialPos::central) + if (layerPos == Acts::LayerMaterialPos::central) { centralSurface->setAssociatedMaterial(materialProxy); + } // collect approach surfaces aSurfaces.push_back(innerBoundary); @@ -331,12 +339,13 @@ Acts::DD4hepLayerBuilder::centralLayers() const pl.envZ = {std::abs(-dz - pl.minZ), std::abs(dz - pl.maxZ)}; pl.envR = {std::abs(rMin - pl.minR), std::abs(rMax - pl.maxR)}; } - } else + } else { throw std::logic_error( std::string("Layer DetElement: ") + detElement.name() + std::string(" has neither a shape nor tolerances for envelopes " "added to itÂ¥s extension. Please check your detector " "constructor!")); + } double halfZ = (pl.minZ - pl.maxZ) * 0.5; @@ -391,14 +400,17 @@ Acts::DD4hepLayerBuilder::centralLayers() const // check if the material should be set to the inner or outer boundary // and set it in case - if (layerPos == Acts::LayerMaterialPos::inner) + if (layerPos == Acts::LayerMaterialPos::inner) { innerBoundary->setAssociatedMaterial(materialProxy); + } - if (layerPos == Acts::LayerMaterialPos::outer) + if (layerPos == Acts::LayerMaterialPos::outer) { outerBoundary->setAssociatedMaterial(materialProxy); + } - if (layerPos == Acts::LayerMaterialPos::central) + if (layerPos == Acts::LayerMaterialPos::central) { centralSurface->setAssociatedMaterial(materialProxy); + } // collect the surfaces aSurfaces.push_back(innerBoundary); @@ -523,7 +535,9 @@ Acts::DD4hepLayerBuilder::positiveLayers() const = (transform->translation() + transform->rotation().col(2) * tube->GetDz() * units::_cm) .z(); - if (zMin > zMax) std::swap(zMin, zMax); + if (zMin > zMax) { + std::swap(zMin, zMax); + } // check if layer has surfaces if (layerSurfaces.empty()) { @@ -544,12 +558,13 @@ Acts::DD4hepLayerBuilder::positiveLayers() const pl.envZ = {std::abs(zMin - pl.minZ), std::abs(zMax - pl.maxZ)}; pl.envR = {std::abs(rMin - pl.minR), std::abs(rMax - pl.maxR)}; } - } else + } else { throw std::logic_error( std::string("Layer DetElement: ") + detElement.name() + std::string(" has neither a shape nor tolerances for envelopes " "added to itÂ¥s extension. Please check your detector " "constructor!")); + } // if the layer should carry material it will be marked by assigning a // SurfaceMaterialProxy @@ -596,7 +611,9 @@ Acts::DD4hepLayerBuilder::positiveLayers() const Vector3D outerPos = transform->translation() + transform->rotation().col(2) * layerThickness * 0.5; - if (innerPos.z() > outerPos.z()) std::swap(innerPos, outerPos); + if (innerPos.z() > outerPos.z()) { + std::swap(innerPos, outerPos); + } Acts::DiscSurface* innerBoundary = new Acts::DiscSurface(std::make_shared<const Transform3D>( @@ -614,14 +631,17 @@ Acts::DD4hepLayerBuilder::positiveLayers() const = new Acts::DiscSurface(transform, pl.minR, pl.maxR); // set material surface - if (layerPos == Acts::LayerMaterialPos::inner) + if (layerPos == Acts::LayerMaterialPos::inner) { innerBoundary->setAssociatedMaterial(materialProxy); + } - if (layerPos == Acts::LayerMaterialPos::outer) + if (layerPos == Acts::LayerMaterialPos::outer) { outerBoundary->setAssociatedMaterial(materialProxy); + } - if (layerPos == Acts::LayerMaterialPos::central) + if (layerPos == Acts::LayerMaterialPos::central) { centralSurface->setAssociatedMaterial(materialProxy); + } // collect approach surfaces aSurfaces.push_back(innerBoundary); aSurfaces.push_back(centralSurface); diff --git a/Plugins/Digitization/src/CartesianSegmentation.cpp b/Plugins/Digitization/src/CartesianSegmentation.cpp index 381a586e2..2aa7ef7d9 100644 --- a/Plugins/Digitization/src/CartesianSegmentation.cpp +++ b/Plugins/Digitization/src/CartesianSegmentation.cpp @@ -40,9 +40,10 @@ Acts::CartesianSegmentation::CartesianSegmentation( std::shared_ptr<const PlanarBounds> mBounds) : m_activeBounds(mBounds), m_binUtility(bUtility) { - if (!m_activeBounds) + if (!m_activeBounds) { m_activeBounds = std::make_shared<const RectangleBounds>( m_binUtility->max(0), m_binUtility->max(1)); + } } Acts::CartesianSegmentation::~CartesianSegmentation() @@ -217,12 +218,13 @@ Acts::CartesianSegmentation::createSegmentationSurfaces( auto binTransform = std::make_shared<const Transform3D>( getTransformFromRotTransl(yBinRotationMatrix, binSurfaceCenter)); // these are the boundaries - if (ibiny == 0 || ibiny == m_binUtility->bins(1)) + if (ibiny == 0 || ibiny == m_binUtility->bins(1)) { boundarySurfaces.push_back(std::shared_ptr<const PlaneSurface>( new PlaneSurface(binTransform, yBinBounds))); - else // these are the bin boundaries + } else { // these are the bin boundaries segmentationSurfacesY.push_back(std::shared_ptr<const PlaneSurface>( new PlaneSurface(binTransform, yBinBounds))); + } } } diff --git a/Plugins/Digitization/src/DigitizationModule.cpp b/Plugins/Digitization/src/DigitizationModule.cpp index 3e7c6215f..7c3bf5661 100644 --- a/Plugins/Digitization/src/DigitizationModule.cpp +++ b/Plugins/Digitization/src/DigitizationModule.cpp @@ -50,19 +50,25 @@ Acts::DigitizationModule::segmentationSurfaces( auto startbinX = entryCids.channel0; auto endbinX = exitCids.channel0; // swap if needed - if (startbinX > endbinX) std::swap(startbinX, endbinX); + if (startbinX > endbinX) { + std::swap(startbinX, endbinX); + } // now cash in the rest - for (; startbinX <= endbinX; ++startbinX) + for (; startbinX <= endbinX; ++startbinX) { sSurfaces.push_back(m_segmentationSurfacesX[startbinX]); + } // start bin, end bin auto startbinY = entryCids.channel1; auto endbinY = exitCids.channel1; // swap if needed - if (startbinY > endbinY) std::swap(startbinY, endbinY); + if (startbinY > endbinY) { + std::swap(startbinY, endbinY); + } // now cash in the rest - for (; startbinY <= endbinY; ++startbinY) + for (; startbinY <= endbinY; ++startbinY) { sSurfaces.push_back(m_segmentationSurfacesY[startbinY]); + } // return what you have return sSurfaces; @@ -81,22 +87,32 @@ Acts::DigitizationModule::stepSurfaces(const Vector3D& start, // go along x - first with the naive binning (i.e. w.o lorentz angle) size_t sCellX = startCell.channel0; size_t eCellX = endCell.channel0; - if (sCellX > eCellX) std::swap(sCellX, eCellX); + if (sCellX > eCellX) { + std::swap(sCellX, eCellX); + } // now take the boundaries as well - if (sCellX > 0) --sCellX; + if (sCellX > 0) { + --sCellX; + } ++eCellX; // @TODO check : safe because we can assume to have eCell+1 // the surfaces along Y are easy, just the bin surfaces size_t sCellY = startCell.channel1; size_t eCellY = endCell.channel1; - if (sCellY > eCellY) std::swap(sCellY, eCellY); + if (sCellY > eCellY) { + std::swap(sCellY, eCellY); + } // reserve - be safe stepSurfaces.reserve((eCellY - sCellY) + (eCellX - sCellX) + 2); // now fill the x surfaces - for (; sCellX <= eCellX && sCellX < m_segmentationSurfacesX.size(); ++sCellX) + for (; sCellX <= eCellX && sCellX < m_segmentationSurfacesX.size(); + ++sCellX) { stepSurfaces.push_back(m_segmentationSurfacesX[sCellX]); + } // end fill the y surfaces - for (; sCellY <= eCellY && sCellY < m_segmentationSurfacesY.size(); ++sCellY) + for (; sCellY <= eCellY && sCellY < m_segmentationSurfacesY.size(); + ++sCellY) { stepSurfaces.push_back(m_segmentationSurfacesY[sCellY]); + } // return the lot return stepSurfaces; } diff --git a/Plugins/Digitization/src/PlanarModuleStepper.cpp b/Plugins/Digitization/src/PlanarModuleStepper.cpp index 8346e10ea..181277af1 100644 --- a/Plugins/Digitization/src/PlanarModuleStepper.cpp +++ b/Plugins/Digitization/src/PlanarModuleStepper.cpp @@ -107,10 +107,11 @@ Acts::PlanarModuleStepper::cellSteps(const Acts::DigitizationModule& dmodule, << bIntersection.position.z()); } // fast break in case of readout/counter surface hit - if (attempts == 2 && boundaryIntersections.size() == attempts) + if (attempts == 2 && boundaryIntersections.size() == attempts) { break; - else if (attempts > 2 && boundaryIntersections.size() == 3) + } else if (attempts > 2 && boundaryIntersections.size() == 3) { break; + } } // post-process if we have more than 2 intersections // only first or last can be wrong after resorting @@ -120,14 +121,16 @@ Acts::PlanarModuleStepper::cellSteps(const Acts::DigitizationModule& dmodule, std::sort(boundaryIntersections.begin(), boundaryIntersections.end()); if (boundaryIntersections[0].pathLength * boundaryIntersections[1].pathLength - < 0.) + < 0.) { boundaryIntersections.pop_back(); - else + } else { boundaryIntersections.erase(boundaryIntersections.begin()); + } } // if for some reason the intersection does not work - if (!boundaryIntersections.size()) + if (!boundaryIntersections.size()) { return std::vector<Acts::DigitizationStep>(); + } // return return cellSteps(dmodule, boundaryIntersections[0].position, diff --git a/Plugins/MaterialMapping/src/MaterialMapper.cpp b/Plugins/MaterialMapping/src/MaterialMapper.cpp index 3c2608e1e..62e9f3b68 100644 --- a/Plugins/MaterialMapping/src/MaterialMapper.cpp +++ b/Plugins/MaterialMapping/src/MaterialMapper.cpp @@ -351,8 +351,9 @@ Acts::MaterialMapper::resolveMaterialSurfaces( ACTS_VERBOSE("Checking volume '" << tVolume.volumeName() << "' for material surfaces.") // check the boundary surfaces - for (auto& bSurface : tVolume.boundarySurfaces()) + for (auto& bSurface : tVolume.boundarySurfaces()) { checkAndInsert(sMap, bSurface->surfaceRepresentation()); + } // check the confined layers if (tVolume.confinedLayers()) { @@ -364,14 +365,20 @@ Acts::MaterialMapper::resolveMaterialSurfaces( // get the approach surfaces if present if (cLayer->approachDescriptor()) { for (auto& aSurface : - cLayer->approachDescriptor()->containedSurfaces()) - if (aSurface) checkAndInsert(sMap, *aSurface); + cLayer->approachDescriptor()->containedSurfaces()) { + if (aSurface) { + checkAndInsert(sMap, *aSurface); + } + } } // get the sensitive surface is present if (cLayer->surfaceArray()) { // sensitive surface loop - for (auto& sSurface : cLayer->surfaceArray()->surfaces()) - if (sSurface) checkAndInsert(sMap, *sSurface); + for (auto& sSurface : cLayer->surfaceArray()->surfaces()) { + if (sSurface) { + checkAndInsert(sMap, *sSurface); + } + } } } } diff --git a/Plugins/MaterialMapping/src/SurfaceMaterialRecord.cpp b/Plugins/MaterialMapping/src/SurfaceMaterialRecord.cpp index eb80d9d0b..bbfcbf6ce 100644 --- a/Plugins/MaterialMapping/src/SurfaceMaterialRecord.cpp +++ b/Plugins/MaterialMapping/src/SurfaceMaterialRecord.cpp @@ -25,8 +25,9 @@ Acts::SurfaceMaterialRecord::SurfaceMaterialRecord(const Surface& surface, // create the vector for the push_back RecordVector mappedVector; mappedVector.reserve(m_binUtility->bins(0)); - for (size_t ibin0 = 0; ibin0 < m_binUtility->bins(0); ++ibin0) + for (size_t ibin0 = 0; ibin0 < m_binUtility->bins(0); ++ibin0) { mappedVector.push_back(RecordBin(MaterialProperties(), 0)); + } m_mappedMaterial.push_back(mappedVector); } } diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp index c661ee26f..c3f636cfb 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp @@ -186,22 +186,29 @@ 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; + if (*first == '\0' && *second == '\0') { + return true; + } // Make sure that the characters after '*' are present // in second string. This function assumes that the first // string will not contain two consecutive '*' - if (*first == '*' && *(first + 1) != '\0' && *second == '\0') return false; + if (*first == '*' && *(first + 1) != '\0' && *second == '\0') { + return false; + } // If the first string contains '?', or current characters // of both strings match - if (*first == '?' || *first == *second) return match(first + 1, second + 1); + if (*first == '?' || *first == *second) { + return match(first + 1, second + 1); + } // If there is *, then there are two possibilities // a) We consider current character of second string // b) We ignore current character of second string. - if (*first == '*') + if (*first == '*') { return match(first + 1, second) || match(first, second + 1); + } return false; } } diff --git a/Plugins/TGeo/src/TGeoDetectorElement.cpp b/Plugins/TGeo/src/TGeoDetectorElement.cpp index 0135b8de8..525f141bc 100644 --- a/Plugins/TGeo/src/TGeoDetectorElement.cpp +++ b/Plugins/TGeo/src/TGeoDetectorElement.cpp @@ -97,12 +97,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else { if (boost::iequals(axes, "XYZ")) { // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signX = -1; - if (islower(axes.at(1))) signY = -1; - if (islower(axes.at(2))) signZ = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signX = -1; + } + if (islower(axes.at(1))) { + signY = -1; + } + if (islower(axes.at(2))) { + signZ = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -134,12 +140,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "XZY")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signX = -1; - if (islower(axes.at(1))) signZ = -1; - if (islower(axes.at(2))) signY = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signX = -1; + } + if (islower(axes.at(1))) { + signZ = -1; + } + if (islower(axes.at(2))) { + signY = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -173,12 +185,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "YZX")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signY = -1; - if (islower(axes.at(1))) signZ = -1; - if (islower(axes.at(2))) signX = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signY = -1; + } + if (islower(axes.at(1))) { + signZ = -1; + } + if (islower(axes.at(2))) { + signX = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -211,12 +229,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "YXZ")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signY = -1; - if (islower(axes.at(1))) signX = -1; - if (islower(axes.at(2))) signZ = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signY = -1; + } + if (islower(axes.at(1))) { + signX = -1; + } + if (islower(axes.at(2))) { + signZ = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -248,12 +272,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "ZYX")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signZ = -1; - if (islower(axes.at(1))) signY = -1; - if (islower(axes.at(2))) signX = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signZ = -1; + } + if (islower(axes.at(1))) { + signY = -1; + } + if (islower(axes.at(2))) { + signX = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -287,12 +317,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( // default is "ZXY" // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signZ = -1; - if (islower(axes.at(1))) signX = -1; - if (islower(axes.at(2))) signY = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signZ = -1; + } + if (islower(axes.at(1))) { + signX = -1; + } + if (islower(axes.at(2))) { + signY = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -325,7 +361,9 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } } // set the asscoiated material (non const method) - if (surface) surface->setAssociatedMaterial(material); + if (surface) { + surface->setAssociatedMaterial(material); + } // set the const member surface m_surface = surface; } @@ -394,12 +432,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else { if (boost::iequals(axes, "XYZ")) { // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signX = -1; - if (islower(axes.at(1))) signY = -1; - if (islower(axes.at(2))) signZ = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signX = -1; + } + if (islower(axes.at(1))) { + signY = -1; + } + if (islower(axes.at(2))) { + signZ = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -431,12 +475,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "XZY")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signX = -1; - if (islower(axes.at(1))) signZ = -1; - if (islower(axes.at(2))) signY = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signX = -1; + } + if (islower(axes.at(1))) { + signZ = -1; + } + if (islower(axes.at(2))) { + signY = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -470,12 +520,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "YZX")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signY = -1; - if (islower(axes.at(1))) signZ = -1; - if (islower(axes.at(2))) signX = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signY = -1; + } + if (islower(axes.at(1))) { + signZ = -1; + } + if (islower(axes.at(2))) { + signX = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -508,12 +564,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "YXZ")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signY = -1; - if (islower(axes.at(1))) signX = -1; - if (islower(axes.at(2))) signZ = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signY = -1; + } + if (islower(axes.at(1))) { + signX = -1; + } + if (islower(axes.at(2))) { + signZ = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -545,12 +607,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } else if (boost::iequals(axes, "ZYX")) { // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signZ = -1; - if (islower(axes.at(1))) signY = -1; - if (islower(axes.at(2))) signX = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signZ = -1; + } + if (islower(axes.at(1))) { + signY = -1; + } + if (islower(axes.at(2))) { + signX = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -584,12 +652,18 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( // default is "ZXY" // next possibility // get the sign of the axes - int signX = 1; - int signY = 1; - int signZ = 1; - if (islower(axes.at(0))) signZ = -1; - if (islower(axes.at(1))) signX = -1; - if (islower(axes.at(2))) signY = -1; + int signX = 1; + int signY = 1; + int signZ = 1; + if (islower(axes.at(0))) { + signZ = -1; + } + if (islower(axes.at(1))) { + signX = -1; + } + if (islower(axes.at(2))) { + signY = -1; + } // the transformation matrix colX *= signX; colY *= signY; @@ -622,7 +696,9 @@ Acts::TGeoDetectorElement::TGeoDetectorElement( } } // set the asscoiated material (non const method) - if (surface) surface->setAssociatedMaterial(material); + if (surface) { + surface->setAssociatedMaterial(material); + } // set the const member surface m_surface = surface; } diff --git a/Plugins/TGeo/src/TGeoLayerBuilder.cpp b/Plugins/TGeo/src/TGeoLayerBuilder.cpp index ed4948def..914f1de20 100644 --- a/Plugins/TGeo/src/TGeoLayerBuilder.cpp +++ b/Plugins/TGeo/src/TGeoLayerBuilder.cpp @@ -73,7 +73,9 @@ Acts::TGeoLayerBuilder::buildLayers(LayerVector& layers, int type) { // bail out if you have no gGeoManager - if (!gGeoManager) return; + if (!gGeoManager) { + return; + } // Prepare which ones to build std::vector<LayerConfig> layerConfigs; @@ -173,7 +175,7 @@ Acts::TGeoLayerBuilder::resolveSensitive( while (TObject* obj = iObj()) { // dynamic_cast to a node TGeoNode* node = dynamic_cast<TGeoNode*>(obj); - if (node) + if (node) { resolveSensitive(layerSurfaces, nullptr, node, @@ -182,9 +184,11 @@ Acts::TGeoLayerBuilder::resolveSensitive( type, correctVolume, offset + " "); + } } - } else + } else { ACTS_VERBOSE("No volume present."); + } /// if you have a node, get the volume and step down further if (tgNode) { @@ -210,7 +214,9 @@ Acts::TGeoLayerBuilder::resolveSensitive( ACTS_VERBOSE(offset << "Sensor name found in correct branch."); // set the visibility to kTrue - if (m_cfg.setVisibility) tgNode->SetVisibility(kTRUE); + if (m_cfg.setVisibility) { + tgNode->SetVisibility(kTRUE); + } // create the detector element - check on the type for the size if (!type || type * z > 0.) { // senstive volume found, collect it @@ -231,9 +237,13 @@ Acts::TGeoLayerBuilder::resolveSensitive( // is not yet the senstive one ACTS_VERBOSE(offset << "[<<] not accepted, stepping down."); // set the visibility to kFALSE - if (m_cfg.setVisibility) tgNode->SetVisibility(kFALSE); + if (m_cfg.setVisibility) { + tgNode->SetVisibility(kFALSE); + } // screen output for disk debugging - if (type) ACTS_VERBOSE(offset << " node translation in z = " << z); + if (type != 0) { + ACTS_VERBOSE(offset << " node translation in z = " << z); + } // build the matrix TGeoHMatrix nTransform = tgTransform * (*tgMatrix); std::string suffix = "_transform"; @@ -250,6 +260,7 @@ Acts::TGeoLayerBuilder::resolveSensitive( correctBranch, offset + " "); } - } else + } else { ACTS_VERBOSE("No node present."); + } } diff --git a/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp b/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp index 34226bf9c..3d3dbd651 100644 --- a/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp +++ b/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp @@ -58,11 +58,13 @@ namespace Test { for (auto lay : iVolume->confinedLayers()->arrayObjects()) { BOOST_CHECK_EQUAL(0ul, lay->geoID().value()); // check the approach surfaces - for (auto asf : lay->approachDescriptor()->containedSurfaces()) + for (auto asf : lay->approachDescriptor()->containedSurfaces()) { BOOST_CHECK_EQUAL(0ul, asf->geoID().value()); + } // check the layer surface array - for (auto ssf : lay->surfaceArray()->surfaces()) + for (auto ssf : lay->surfaceArray()->surfaces()) { BOOST_CHECK_EQUAL(0ul, ssf->geoID().value()); + } } } } @@ -87,11 +89,13 @@ namespace Test { for (auto lay : oVolume->confinedLayers()->arrayObjects()) { BOOST_CHECK_EQUAL(0ul, lay->geoID().value()); // check the approach surfaces - for (auto asf : lay->approachDescriptor()->containedSurfaces()) + for (auto asf : lay->approachDescriptor()->containedSurfaces()) { BOOST_CHECK_EQUAL(0ul, asf->geoID().value()); + } // check the layer surface array - for (auto ssf : lay->surfaceArray()->surfaces()) + for (auto ssf : lay->surfaceArray()->surfaces()) { BOOST_CHECK_EQUAL(0ul, ssf->geoID().value()); + } } } } @@ -124,11 +128,13 @@ namespace Test { for (auto lay : cVol->confinedLayers()->arrayObjects()) { BOOST_CHECK_EQUAL(0ul, lay->geoID().value()); // check the approach surfaces - for (auto asf : lay->approachDescriptor()->containedSurfaces()) + for (auto asf : lay->approachDescriptor()->containedSurfaces()) { BOOST_CHECK_EQUAL(0ul, asf->geoID().value()); + } // check the layer surface array - for (auto ssf : lay->surfaceArray()->surfaces()) + for (auto ssf : lay->surfaceArray()->surfaces()) { BOOST_CHECK_EQUAL(0ul, ssf->geoID().value()); + } } } } diff --git a/Tests/Core/Extrapolator/ExtrapolatorTests.cpp b/Tests/Core/Extrapolator/ExtrapolatorTests.cpp index 01b1e7f20..7fd136e68 100644 --- a/Tests/Core/Extrapolator/ExtrapolatorTests.cpp +++ b/Tests/Core/Extrapolator/ExtrapolatorTests.cpp @@ -340,10 +340,11 @@ namespace Test { // maximum momentum allowed double pmax = units::SI2Nat<units::MOMENTUM>( options.pathLimit * bField.getField(pos).mag() / M_PI); - if (mom.mag() < pmax) + if (mom.mag() < pmax) { BOOST_CHECK(status.pathLength < options.pathLimit); - else + } else { BOOST_CHECK_CLOSE(status.pathLength, options.pathLimit, 1e-3); + } } } // namespace Test diff --git a/Tests/Core/Extrapolator/MaterialCollectionTests.cpp b/Tests/Core/Extrapolator/MaterialCollectionTests.cpp index d9d032dbf..86c2ad527 100644 --- a/Tests/Core/Extrapolator/MaterialCollectionTests.cpp +++ b/Tests/Core/Extrapolator/MaterialCollectionTests.cpp @@ -98,7 +98,9 @@ namespace Test { { double dcharge = -1 + 2 * charge; - if (index < skip) return; + if (index < skip) { + return; + } // define start parameters double x = 0; @@ -252,11 +254,12 @@ namespace Test { const TrackParameters* sParameters = &start; std::vector<const TrackParameters*> stepParameters; for (auto& fwdSteps : fwdMaterial.collected) { - if (debugModeFwdStep) + if (debugModeFwdStep) { std::cout << ">>> Forward step : " << sParameters->referenceSurface().geoID().toString() << " --> " << fwdSteps.surface->geoID().toString() << std::endl; + } // make a forward step const auto& fwdStep @@ -282,10 +285,11 @@ namespace Test { // final destination surface const Surface& dSurface = fwdResult.endParameters->referenceSurface(); - if (debugModeFwdStep) + if (debugModeFwdStep) { std::cout << ">>> Forward step : " << sParameters->referenceSurface().geoID().toString() << " --> " << dSurface.geoID().toString() << std::endl; + } const auto& fwdStepFinal = prop.propagate(*sParameters, dSurface, fwdStepOptions); @@ -340,11 +344,12 @@ namespace Test { // move forward step by step through the surfaces sParameters = fwdResult.endParameters.template get(); for (auto& bwdSteps : bwdMaterial.collected) { - if (debugModeBwdStep) + if (debugModeBwdStep) { std::cout << ">>> Backward step : " << sParameters->referenceSurface().geoID().toString() << " --> " << bwdSteps.surface->geoID().toString() << std::endl; + } // make a forward step const auto& bwdStep = prop.propagate(*sParameters, (*bwdSteps.surface), bwdStepOptions); @@ -369,10 +374,11 @@ namespace Test { // final destination surface const Surface& dbSurface = start.referenceSurface(); - if (debugModeBwdStep) + if (debugModeBwdStep) { std::cout << ">>> Backward step : " << sParameters->referenceSurface().geoID().toString() << " --> " << dSurface.geoID().toString() << std::endl; + } const auto& bwdStepFinal = prop.propagate(*sParameters, dbSurface, bwdStepOptions); diff --git a/Tests/Core/Propagator/AtlasPropagatorBenchmark.cpp b/Tests/Core/Propagator/AtlasPropagatorBenchmark.cpp index 63f407d27..d4bd57c87 100644 --- a/Tests/Core/Propagator/AtlasPropagatorBenchmark.cpp +++ b/Tests/Core/Propagator/AtlasPropagatorBenchmark.cpp @@ -79,7 +79,9 @@ main(int argc, char* argv[]) 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1. / (10 * units::_GeV); std::unique_ptr<const ActsSymMatrixD<5>> covPtr = nullptr; - if (withCov) covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); + if (withCov) { + covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); + } CurvilinearParameters pars(std::move(covPtr), pos, mom, +1); ExtrapolationCell<TrackParameters> exCell(pars); diff --git a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp index 841efa6f8..ec61d7ca8 100644 --- a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp +++ b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp @@ -79,7 +79,9 @@ main(int argc, char* argv[]) 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1. / (10 * units::_GeV); std::unique_ptr<const ActsSymMatrixD<5>> covPtr = nullptr; - if (withCov) covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); + if (withCov) { + covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); + } CurvilinearParameters pars(std::move(covPtr), pos, mom, +1); double totalPathLength = 0; diff --git a/Tests/Core/Propagator/EigenStepperBenchmark.cpp b/Tests/Core/Propagator/EigenStepperBenchmark.cpp index 4c4ae8f68..9cce5bb11 100644 --- a/Tests/Core/Propagator/EigenStepperBenchmark.cpp +++ b/Tests/Core/Propagator/EigenStepperBenchmark.cpp @@ -79,7 +79,9 @@ main(int argc, char* argv[]) 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1. / (10 * units::_GeV); std::unique_ptr<const ActsSymMatrixD<5>> covPtr = nullptr; - if (withCov) covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); + if (withCov) { + covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); + } CurvilinearParameters pars(std::move(covPtr), pos, mom, +1); double totalPathLength = 0; diff --git a/Tests/Core/Propagator/JacobianTests.cpp b/Tests/Core/Propagator/JacobianTests.cpp index 733c12f67..882dc0548 100644 --- a/Tests/Core/Propagator/JacobianTests.cpp +++ b/Tests/Core/Propagator/JacobianTests.cpp @@ -114,11 +114,12 @@ namespace Test { { // initialize to zero ActsMatrixD<7, 5> jMatrix = ActsMatrixD<7, 5>::Zero(); - for (size_t j = 0; j < 5; ++j) + for (size_t j = 0; j < 5; ++j) { for (size_t i = 0; i < 7; ++i) { size_t ijc = 7 + j * 7 + i; jMatrix(i, j) = P[ijc]; } + } return jMatrix; } diff --git a/Tests/Core/Propagator/LoopProtectionTests.cpp b/Tests/Core/Propagator/LoopProtectionTests.cpp index 54c7a5a62..5b4645b8b 100644 --- a/Tests/Core/Propagator/LoopProtectionTests.cpp +++ b/Tests/Core/Propagator/LoopProtectionTests.cpp @@ -183,7 +183,9 @@ namespace Test { charge, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; diff --git a/Tests/Core/Propagator/RungeKuttaEngineTests.cpp b/Tests/Core/Propagator/RungeKuttaEngineTests.cpp index d4c89112f..4cea0dec2 100644 --- a/Tests/Core/Propagator/RungeKuttaEngineTests.cpp +++ b/Tests/Core/Propagator/RungeKuttaEngineTests.cpp @@ -184,8 +184,9 @@ namespace Test { // and the numbers are BOOST_CHECK_CLOSE(gpc.x(), 989.876, 0.001); BOOST_CHECK_CLOSE(gpc.y(), 141.935, 0.001); - } else + } else { BOOST_TEST_MESSAGE("Propagations failed !"); + } } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Seeding/SeedingTestsCommon.hpp b/Tests/Core/Seeding/SeedingTestsCommon.hpp index 490c15753..fc5fe7512 100644 --- a/Tests/Core/Seeding/SeedingTestsCommon.hpp +++ b/Tests/Core/Seeding/SeedingTestsCommon.hpp @@ -35,8 +35,9 @@ template <typename Identifier> void print(const std::vector<Acts::Seeding::SpacePoint<Identifier>>& points) { - for (const auto& point : points) + for (const auto& point : points) { std::cout << point.identifier() << ' ' << point << '\n'; + } } template <typename Identifier> @@ -50,5 +51,7 @@ template <typename Identifier, size_t N> void print(const std::vector<Acts::Seeding::TrackSeed<Identifier, N>>& seeds) { - for (const auto& seed : seeds) std::cout << seed << '\n'; + for (const auto& seed : seeds) { + std::cout << seed << '\n'; + } } diff --git a/Tests/Core/Tools/LayerCreatorTests.cpp b/Tests/Core/Tools/LayerCreatorTests.cpp index a782d336d..ffb342b45 100644 --- a/Tests/Core/Tools/LayerCreatorTests.cpp +++ b/Tests/Core/Tools/LayerCreatorTests.cpp @@ -108,7 +108,9 @@ namespace Test { size_t nBins = sArray->size(); bool result = true; for (size_t i = 0; i < nBins; ++i) { - if (!sArray->isValidBin(i)) continue; + if (!sArray->isValidBin(i)) { + continue; + } SrfVec binContent = sArray->at(i); BOOST_TEST_INFO("Bin: " << i); BOOST_TEST(binContent.size() == n); diff --git a/Tests/Core/Utilities/BFieldMapUtilsTests.cpp b/Tests/Core/Utilities/BFieldMapUtilsTests.cpp index 491b9af8e..3c331dbee 100644 --- a/Tests/Core/Utilities/BFieldMapUtilsTests.cpp +++ b/Tests/Core/Utilities/BFieldMapUtilsTests.cpp @@ -32,7 +32,9 @@ namespace Test { // create b field in rz std::vector<Acts::Vector2D> bField_rz; - for (int i = 0; i < 9; i++) bField_rz.push_back(Acts::Vector2D(i, i)); + for (int i = 0; i < 9; i++) { + bField_rz.push_back(Acts::Vector2D(i, i)); + } auto localToGlobalBin_rz = [](std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ) { @@ -55,7 +57,9 @@ namespace Test { // create b field in xyz std::vector<Acts::Vector3D> bField_xyz; - for (int i = 0; i < 27; i++) bField_xyz.push_back(Acts::Vector3D(i, i, i)); + for (int i = 0; i < 27; i++) { + bField_xyz.push_back(Acts::Vector3D(i, i, i)); + } auto localToGlobalBin_xyz = [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { @@ -148,7 +152,9 @@ namespace Test { std::vector<double> zPos = {0., 1., 2.}; // the bfield values in rz std::vector<Acts::Vector2D> bField_rz; - for (int i = 0; i < 9; i++) bField_rz.push_back(Acts::Vector2D(i, i)); + for (int i = 0; i < 9; i++) { + bField_rz.push_back(Acts::Vector2D(i, i)); + } // the field mapper in rz auto mapper_rz = Acts::fieldMapperRZ( [](std::array<size_t, 2> binsRZ, std::array<size_t, 2> nBinsRZ) { @@ -177,7 +183,9 @@ namespace Test { // the bfield values in xyz std::vector<Acts::Vector3D> bField_xyz; - for (int i = 0; i < 27; i++) bField_xyz.push_back(Acts::Vector3D(i, i, i)); + for (int i = 0; i < 27; i++) { + bField_xyz.push_back(Acts::Vector3D(i, i, i)); + } // the field mapper in xyz auto mapper_xyz = Acts::fieldMapperXYZ( [](std::array<size_t, 3> binsXYZ, std::array<size_t, 3> nBinsXYZ) { diff --git a/Tests/Core/Utilities/BinningDataTests.cpp b/Tests/Core/Utilities/BinningDataTests.cpp index e1e4a247a..08af30aec 100644 --- a/Tests/Core/Utilities/BinningDataTests.cpp +++ b/Tests/Core/Utilities/BinningDataTests.cpp @@ -350,9 +350,10 @@ namespace Test { float(-M_PI + 3 * phiStep), float(-M_PI + 4 * phiStep), float(-M_PI + 5 * phiStep)}; - for (size_t ib = 0; ib < phiData_eq.boundaries().size(); ++ib) + for (size_t ib = 0; ib < phiData_eq.boundaries().size(); ++ib) { BOOST_CHECK_CLOSE( phiData_eq.boundaries()[ib], phiBoundaries_eq[ib], 10e-5); + } } // test bin center values @@ -391,8 +392,9 @@ namespace Test { // 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}; - for (size_t ib = 0; ib < center.size(); ++ib) + 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.; @@ -402,8 +404,9 @@ namespace Test { float(-M_PI + 3.5 * phiStep), float(-M_PI + 4.5 * phiStep)}; - for (size_t ib = 0; ib < phiCenters_eq.size(); ++ib) + for (size_t ib = 0; ib < phiCenters_eq.size(); ++ib) { BOOST_TEST((std::abs(phiData_eq.center(ib) - phiCenters_eq[ib]) < 1e-3)); + } } // special test for phi binning @@ -423,9 +426,10 @@ namespace Test { float(-M_PI + 4 * phiStep) + deltaPhi, float(-M_PI + 5 * phiStep) + deltaPhi}; // this is the boundary test - for (size_t ib = 0; ib < phiData_mod.boundaries().size(); ++ib) + for (size_t ib = 0; ib < phiData_mod.boundaries().size(); ++ib) { BOOST_CHECK_CLOSE( phiData_mod.boundaries()[ib], phiBoundaries_mod[ib], 10e-5); + } // now test the bin jump 0/maxbin diff --git a/Tests/Core/Utilities/GridTests.cpp b/Tests/Core/Utilities/GridTests.cpp index c53dfb008..54e18a2c3 100644 --- a/Tests/Core/Utilities/GridTests.cpp +++ b/Tests/Core/Utilities/GridTests.cpp @@ -91,7 +91,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{4}}) == Point({{4.}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{0.7}}); @@ -263,7 +265,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{4, 2}}) == Point({{4., 2.}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{0.7, 1.3}}); @@ -417,7 +421,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{2, 2, 1}}) == Point({{2., 2., 1.}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{0.7, 2.3, 1.3}}); @@ -484,7 +490,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{2}}) == Point({{4.}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{0.7}}); @@ -607,7 +615,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{2, 2}}) == Point({{3., 4.}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{0.7, 1.3}}); @@ -737,7 +747,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{1, 2, 3}}) == Point({{1., 3., 3.3}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{0.7, 1.3, 3.7}}); @@ -895,7 +907,9 @@ namespace Test { BOOST_TEST(g.getUpperRightBinEdge({{4, 2}}) == Point({{1., 3.}})); // initialize grid - for (size_t bin = 0; bin < g.size(); ++bin) g.at(bin) = bin; + for (size_t bin = 0; bin < g.size(); ++bin) { + g.at(bin) = bin; + } // consistency of access const auto& point = Point({{1.3, 3.7}}); diff --git a/Tests/Integration/PropagationTestBase.hpp b/Tests/Integration/PropagationTestBase.hpp index afaa11b3b..e4573b6ca 100644 --- a/Tests/Integration/PropagationTestBase.hpp +++ b/Tests/Integration/PropagationTestBase.hpp @@ -41,7 +41,9 @@ BOOST_DATA_TEST_CASE( plimit, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; @@ -103,7 +105,9 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // just make sure we can reach it @@ -191,7 +195,9 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // to a plane with the atlas stepper @@ -277,7 +283,9 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // to a disc with the atlas stepper @@ -363,12 +371,16 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // to a line with the atlas stepper - if (debug) std::cout << "[ >>>> Testing Atlas Propagator <<<< ]" << std::endl; + if (debug) { + std::cout << "[ >>>> Testing Atlas Propagator <<<< ]" << std::endl; + } auto a_at_line = to_surface<AtlasPropagator_type, StrawSurface>(apropagator, pT, @@ -383,7 +395,9 @@ BOOST_DATA_TEST_CASE( covtpr, debug); // to a line with the eigen stepper - if (debug) std::cout << "[ >>>> Testing Eigen Propagator <<<< ]" << std::endl; + if (debug) { + std::cout << "[ >>>> Testing Eigen Propagator <<<< ]" << std::endl; + } auto e_at_line = to_surface<EigenPropagator_type, StrawSurface>(epropagator, pT, @@ -398,8 +412,9 @@ BOOST_DATA_TEST_CASE( covtpr, debug); // to a line with the runge kutta engine - if (debug) + if (debug) { std::cout << "[ >>>> Testing Legacy Propagator <<<< ]" << std::endl; + } auto w_at_line = to_surface<WrappedPropagator_type, StrawSurface>( wpropagator, pT, @@ -446,7 +461,9 @@ BOOST_DATA_TEST_CASE( plimit, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // covariance check for eigen stepper @@ -499,7 +516,9 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // covariance check for atlas stepper @@ -590,7 +609,9 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // covariance check for atlas stepper @@ -674,7 +695,9 @@ BOOST_DATA_TEST_CASE( rand3, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; diff --git a/Tests/Integration/PropagationTestHelper.hpp b/Tests/Integration/PropagationTestHelper.hpp index 5bdb2b782..ef090078d 100644 --- a/Tests/Integration/PropagationTestHelper.hpp +++ b/Tests/Integration/PropagationTestHelper.hpp @@ -122,8 +122,12 @@ namespace IntegrationTest { // calculate expected final momentum direction in phi in [-pi,pi] double exp_phi = std::fmod(phi + turns * 2 * M_PI, 2 * M_PI); - if (exp_phi < -M_PI) exp_phi += 2 * M_PI; - if (exp_phi > M_PI) exp_phi -= 2 * M_PI; + if (exp_phi < -M_PI) { + exp_phi += 2 * M_PI; + } + if (exp_phi > M_PI) { + exp_phi -= 2 * M_PI; + } // calculate expected position double exp_z = z + pz / pT * 2 * M_PI * r * std::abs(turns); diff --git a/Tests/Integration/PropagationTests.cpp b/Tests/Integration/PropagationTests.cpp index d15f1bb75..082cbde28 100644 --- a/Tests/Integration/PropagationTests.cpp +++ b/Tests/Integration/PropagationTests.cpp @@ -95,7 +95,9 @@ namespace IntegrationTest { charge, index) { - if (index < skip) return; + if (index < skip) { + return; + } double dcharge = -1 + 2 * charge; // constant field propagation atlas stepper diff --git a/Tests/Integration/covariance_validation_fixture.hpp b/Tests/Integration/covariance_validation_fixture.hpp index 031a2a574..24c63d8bb 100644 --- a/Tests/Integration/covariance_validation_fixture.hpp +++ b/Tests/Integration/covariance_validation_fixture.hpp @@ -91,10 +91,14 @@ namespace IntegrationTest { std::vector<ActsVectorD<5>> theta_derivatives; theta_derivatives.reserve(h_steps.size()); for (double h : h_steps) { - StartParameters tp = startPars; - const double current_theta = tp.template get<Acts::eTHETA>(); - if (current_theta + h > M_PI) h = M_PI - current_theta; - if (current_theta + h < 0) h = -current_theta; + StartParameters tp = startPars; + const double current_theta = tp.template get<Acts::eTHETA>(); + if (current_theta + h > M_PI) { + h = M_PI - current_theta; + } + if (current_theta + h < 0) { + h = -current_theta; + } tp.template set<Acts::eTHETA>(tp.template get<Acts::eTHETA>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options); theta_derivatives.push_back((r.endParameters->parameters() - nominal) diff --git a/Tests/Plugins/MaterialMapping/MaterialMappingTests.cpp b/Tests/Plugins/MaterialMapping/MaterialMappingTests.cpp index b9233ddbc..c5f0cb6bb 100644 --- a/Tests/Plugins/MaterialMapping/MaterialMappingTests.cpp +++ b/Tests/Plugins/MaterialMapping/MaterialMappingTests.cpp @@ -31,15 +31,17 @@ namespace Test { /// These are our detector positions, they are in r std::vector<double> assignPos = {30., 50.5, 75., 100.5, 300.5}; std::vector<Vector3D> detPositions; - for (auto& ap : assignPos) + for (auto& ap : assignPos) { detPositions.push_back(Vector3D(s2 * ap, s2 * ap, 0.)); + } /// quick check on length BOOST_CHECK_EQUAL(5ul, detPositions.size()); /// now create the assigned steps std::vector<AssignedMaterialSteps> assignedStepsVector; - for (size_t ias = 0; ias < detPositions.size(); ++ias) + for (size_t ias = 0; ias < detPositions.size(); ++ias) { assignedStepsVector.push_back( AssignedMaterialSteps(assignID[ias], detPositions[ias])); + } /// /// (b) material @@ -52,7 +54,9 @@ namespace Test { /// fill them - we ignore 61 to 90 (there's no material there) for (size_t is = 20; is < 351; ++is) { // continue if you are in the material free region of our detector - if (is > 60 && is < 91) continue; + if (is > 60 && is < 91) { + continue; + } // otherwise create materialSteps.push_back( MaterialStep(materialPerStep, Vector3D(s2 * is, s2 * is, 0.))); -- GitLab