diff --git a/Core/include/Acts/Detector/ProtoBinning.hpp b/Core/include/Acts/Detector/ProtoBinning.hpp index 8d5d4db8374c..8be3ee40aa81 100644 --- a/Core/include/Acts/Detector/ProtoBinning.hpp +++ b/Core/include/Acts/Detector/ProtoBinning.hpp @@ -168,7 +168,7 @@ struct BinningDescription { binUtility += BinUtility(b.bins(), b.edges.front(), b.edges.back(), bOption, b.binValue); } else { - std::vector edges; + std::vector edges; std::for_each(b.edges.begin(), b.edges.end(), [&](ActsScalar edge) { edges.push_back(edge); }); binUtility += BinUtility(edges, bOption, b.binValue); diff --git a/Core/include/Acts/Utilities/BinUtility.hpp b/Core/include/Acts/Utilities/BinUtility.hpp index 59a736dae684..641422d2764b 100644 --- a/Core/include/Acts/Utilities/BinUtility.hpp +++ b/Core/include/Acts/Utilities/BinUtility.hpp @@ -71,8 +71,8 @@ class BinUtility { /// @param opt is the binning option : open, closed /// @param value is the binninb value : binX, binY, binZ, etc. /// @param tForm is the (optional) transform - BinUtility(std::size_t bins, float min, float max, BinningOption opt = open, - BinningValue value = BinningValue::binX, + BinUtility(std::size_t bins, ActsScalar min, ActsScalar max, + BinningOption opt = open, BinningValue value = BinningValue::binX, const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { m_binningData.reserve(3); @@ -85,7 +85,7 @@ class BinUtility { /// @param opt is the binning option : open, closed /// @param value is the binninb value : binX, binY, binZ, etc. /// @param tForm is the (optional) transform - BinUtility(std::vector& bValues, BinningOption opt = open, + BinUtility(std::vector& bValues, BinningOption opt = open, BinningValue value = BinningValue::binPhi, const Transform3& tForm = Transform3::Identity()) : m_binningData(), m_transform(tForm), m_itransform(tForm.inverse()) { diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index 9b674109853b..b31c49a077a6 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -44,9 +44,9 @@ class BinningData { BinningType type{}; ///< binning type: equidistant, arbitrary BinningOption option{}; ///< binning option: open, closed BinningValue binvalue{}; ///< binning value: binX, binY, binZ, binR ... - float min{}; ///< minimum value - float max{}; ///< maximum value - float step{}; ///< binning step + ActsScalar min{}; ///< minimum value + ActsScalar max{}; ///< maximum value + ActsScalar step{}; ///< binning step bool zdim{}; ///< zero dimensional binning : direct access /// sub structure: describe some sub binning @@ -59,7 +59,7 @@ class BinningData { /// @param bValue is the binning value: binX, binY, etc. /// @param bMin is the minimum value /// @param bMax is the maximum value - BinningData(BinningValue bValue, float bMin, float bMax) + BinningData(BinningValue bValue, ActsScalar bMin, ActsScalar bMax) : type(equidistant), option(open), binvalue(bValue), @@ -71,7 +71,7 @@ class BinningData { m_bins(1), m_boundaries({{min, max}}), m_totalBins(1), - m_totalBoundaries(std::vector()), + m_totalBoundaries(std::vector()), m_functionPtr(&searchEquidistantWithBoundary) {} /// Constructor for equidistant binning @@ -86,7 +86,7 @@ class BinningData { /// @param sBinData is (optional) sub structure /// @param sBinAdditive is the prescription for the sub structure BinningData(BinningOption bOption, BinningValue bValue, std::size_t bBins, - float bMin, float bMax, + ActsScalar bMin, ActsScalar bMax, std::unique_ptr sBinData = nullptr, bool sBinAdditive = false) : type(equidistant), @@ -99,9 +99,9 @@ class BinningData { subBinningData(std::move(sBinData)), subBinningAdditive(sBinAdditive), m_bins(bBins), - m_boundaries(std::vector()), + m_boundaries(std::vector()), m_totalBins(bBins), - m_totalBoundaries(std::vector()) { + m_totalBoundaries(std::vector()) { // set to equidistant search m_functionPtr = &searchEquidistantWithBoundary; // fill the boundary vector for fast access to center & boundaries @@ -120,7 +120,7 @@ class BinningData { /// @param bBoundaries are the bin boundaries /// @param sBinData is (optional) sub structure BinningData(BinningOption bOption, BinningValue bValue, - const std::vector& bBoundaries, + const std::vector& bBoundaries, std::unique_ptr sBinData = nullptr) : type(arbitrary), option(bOption), @@ -227,7 +227,7 @@ class BinningData { /// Return the boundaries - including sub boundaries /// @return vector of floats indicating the boundary values - const std::vector& boundaries() const { + const std::vector& boundaries() const { if (subBinningData) { return m_totalBoundaries; } @@ -239,7 +239,7 @@ class BinningData { /// @param lposition assumes the correct local position expression /// /// @return float value according to the binning setup - float value(const Vector2& lposition) const { + Vector2::Scalar value(const Vector2& lposition) const { // ordered after occurrence if (binvalue == BinningValue::binR || binvalue == BinningValue::binRPhi || binvalue == BinningValue::binX || binvalue == BinningValue::binH) { @@ -254,7 +254,7 @@ class BinningData { /// @param position is the global position /// /// @return float value according to the binning setup - float value(const Vector3& position) const { + Vector3::Scalar value(const Vector3& position) const { using VectorHelpers::eta; using VectorHelpers::perp; using VectorHelpers::phi; @@ -269,7 +269,7 @@ class BinningData { return (eta(position)); } if (toUnderlying(binvalue) < 3) { - return static_cast(position[toUnderlying(binvalue)]); + return static_cast(position[toUnderlying(binvalue)]); } // phi gauging return phi(position); @@ -280,10 +280,10 @@ class BinningData { /// @param bin is the bin for which the center value is requested /// /// @return float value according to the bin center - float center(std::size_t bin) const { - const std::vector& bvals = boundaries(); + ActsScalar center(std::size_t bin) const { + const std::vector& bvals = boundaries(); // take the center between bin boundaries - float value = + ActsScalar value = bin < (bvals.size() - 1) ? 0.5 * (bvals[bin] + bvals[bin + 1]) : 0.; return value; } @@ -293,10 +293,11 @@ class BinningData { /// @param bin is the bin for which the width is requested /// /// @return float value of width - float width(std::size_t bin) const { - const std::vector& bvals = boundaries(); + ActsScalar width(std::size_t bin) const { + const std::vector& bvals = boundaries(); // take the center between bin boundaries - float value = bin < (bvals.size() - 1) ? bvals[bin + 1] - bvals[bin] : 0.; + ActsScalar value = + bin < (bvals.size() - 1) ? bvals[bin + 1] - bvals[bin] : 0.; return value; } @@ -312,7 +313,7 @@ class BinningData { } // all other options // @todo remove hard-coded tolerance parameters - float val = value(position); + ActsScalar val = value(position); return (val > min - 0.001 && val < max + 0.001); } @@ -328,7 +329,7 @@ class BinningData { } // all other options // @todo remove hard-coded tolerance parameters - float val = value(lposition); + ActsScalar val = value(lposition); return (val > min - 0.001 && val < max + 0.001); } @@ -361,7 +362,7 @@ class BinningData { /// @param value is the searchvalue as float /// /// @return bin according tot this - std::size_t search(float value) const { + std::size_t search(ActsScalar value) const { if (zdim) { return 0; } @@ -376,7 +377,7 @@ class BinningData { /// @param value is the searchvalue as float /// /// @return bin according tot this - std::size_t searchWithSubStructure(float value) const { + std::size_t searchWithSubStructure(ActsScalar value) const { // find the masterbin with the correct function pointer std::size_t masterbin = (*m_functionPtr)(value, *this); // additive sub binning - @@ -385,7 +386,7 @@ class BinningData { return masterbin + subBinningData->search(value); } // gauge the value to the subBinData - float gvalue = + ActsScalar gvalue = value - masterbin * (subBinningData->max - subBinningData->min); // now go / additive or multiplicative std::size_t subbin = subBinningData->search(gvalue); @@ -404,9 +405,9 @@ class BinningData { if (zdim) { return 0; } - float val = value(position); + ActsScalar val = value(position); Vector3 probe = position + dir.normalized(); - float nextval = value(probe); + ActsScalar nextval = value(probe); return (nextval > val) ? 1 : -1; } @@ -417,22 +418,24 @@ class BinningData { /// it is set to max /// /// @return the center value of the bin is given - float centerValue(std::size_t bin) const { + ActsScalar centerValue(std::size_t bin) const { if (zdim) { return 0.5 * (min + max); } - float bmin = m_boundaries[bin]; - float bmax = bin < m_boundaries.size() ? m_boundaries[bin + 1] : max; + ActsScalar bmin = m_boundaries[bin]; + ActsScalar bmax = bin < m_boundaries.size() ? m_boundaries[bin + 1] : max; return 0.5 * (bmin + bmax); } private: - std::size_t m_bins{}; ///< number of bins - std::vector m_boundaries; ///< vector of holding the bin boundaries - std::size_t m_totalBins{}; ///< including potential substructure - std::vector m_totalBoundaries; ///< including potential substructure - - std::size_t (*m_functionPtr)(float, + std::size_t m_bins{}; ///< number of bins + std::vector + m_boundaries; ///< vector of holding the bin boundaries + std::size_t m_totalBins{}; ///< including potential substructure + std::vector + m_totalBoundaries; ///< including potential substructure + + std::size_t (*m_functionPtr)(ActsScalar, const BinningData&){}; /// function pointer /// helper method to set the sub structure @@ -447,11 +450,11 @@ class BinningData { // the tricky one - exchange one bin by many others m_totalBoundaries.reserve(m_totalBins + 1); // get the sub bin boundaries - const std::vector& subBinBoundaries = + const std::vector& subBinBoundaries = subBinningData->boundaries(); - float sBinMin = subBinBoundaries[0]; + ActsScalar sBinMin = subBinBoundaries[0]; // get the min value of the sub bin boundaries - std::vector::const_iterator mbvalue = m_boundaries.begin(); + std::vector::const_iterator mbvalue = m_boundaries.begin(); for (; mbvalue != m_boundaries.end(); ++mbvalue) { // should define numerically stable if (std::abs((*mbvalue) - sBinMin) < 10e-10) { @@ -469,12 +472,12 @@ class BinningData { m_totalBins = m_bins * subBinningData->bins(); m_totalBoundaries.reserve(m_totalBins + 1); // get the sub bin boundaries if there are any - const std::vector& subBinBoundaries = + const std::vector& subBinBoundaries = subBinningData->boundaries(); // create the boundary vector m_totalBoundaries.push_back(min); for (std::size_t ib = 0; ib < m_bins; ++ib) { - float offset = ib * step; + ActsScalar offset = ib * step; for (std::size_t isb = 1; isb < subBinBoundaries.size(); ++isb) { m_totalBoundaries.push_back(offset + subBinBoundaries[isb]); } @@ -487,7 +490,7 @@ class BinningData { // Equidistant search // - fastest method - static std::size_t searchEquidistantWithBoundary(float value, + static std::size_t searchEquidistantWithBoundary(ActsScalar value, const BinningData& bData) { // vanilla @@ -510,7 +513,7 @@ class BinningData { } // Search in arbitrary boundary - static std::size_t searchInVectorWithBoundary(float value, + static std::size_t searchInVectorWithBoundary(ActsScalar value, const BinningData& bData) { // lower boundary if (value <= bData.m_boundaries[0]) { diff --git a/Core/src/Detector/ProtoDetector.cpp b/Core/src/Detector/ProtoDetector.cpp index 20db1689882a..f949718e2eb3 100644 --- a/Core/src/Detector/ProtoDetector.cpp +++ b/Core/src/Detector/ProtoDetector.cpp @@ -79,7 +79,7 @@ void Acts::ProtoVolume::harmonize(bool legacy) { auto& fVolume = cts.constituentVolumes.front(); auto& lVolume = cts.constituentVolumes.back(); - std::vector borders = {}; + std::vector borders = {}; // The volumes should be harmonized in all other constraining values for (auto obValue : allBinningValues()) { @@ -115,7 +115,7 @@ void Acts::ProtoVolume::harmonize(bool legacy) { } else if (layersPresent && !legacy) { // Count the gaps std::size_t gaps = 0; - std::vector boundaries = {}; + std::vector boundaries = {}; // New container vector std::vector updatedConstituents; ActsScalar containerMin = extent.min(binValue); @@ -124,14 +124,14 @@ void Acts::ProtoVolume::harmonize(bool legacy) { gap.name = name + "-gap-" + std::to_string(gaps++); gap.extent.set(binValue, containerMin, fVolume.extent.min(binValue)); updatedConstituents.push_back(gap); - borders.push_back(static_cast(containerMin)); + borders.push_back(containerMin); } // Fill the gaps for (unsigned int iv = 1; iv < cts.constituentVolumes.size(); ++iv) { auto& lv = cts.constituentVolumes[iv - 1u]; // This volume is one to save updatedConstituents.push_back(lv); - borders.push_back(static_cast(lv.extent.min(binValue))); + borders.push_back(static_cast(lv.extent.min(binValue))); // check if a gap to the next is needed ActsScalar low = lv.extent.max(binValue); auto& hv = cts.constituentVolumes[iv]; @@ -141,12 +141,12 @@ void Acts::ProtoVolume::harmonize(bool legacy) { gap.name = name + "-gap-" + std::to_string(gaps++); gap.extent.set(binValue, low, high); updatedConstituents.push_back(gap); - borders.push_back(static_cast(low)); + borders.push_back(low); } } ActsScalar constituentsMax = lVolume.extent.max(binValue); updatedConstituents.push_back(lVolume); - borders.push_back(static_cast(constituentsMax)); + borders.push_back(constituentsMax); // Check the container min/max setting ActsScalar containerMax = extent.max(binValue); if (constituentsMax < containerMax) { @@ -154,7 +154,7 @@ void Acts::ProtoVolume::harmonize(bool legacy) { gap.name = name + "-gap-" + std::to_string(gaps++); gap.extent.set(binValue, constituentsMax, containerMax); updatedConstituents.push_back(gap); - borders.push_back(static_cast(containerMax)); + borders.push_back(containerMax); } cts.constituentVolumes = updatedConstituents; } else if (legacy && layersPresent) { diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 02b600b37ef6..6f4ede0e2487 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -243,7 +243,7 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( } // Set bin boundaries along binning - std::vector binBoundaries; + std::vector binBoundaries; binBoundaries.push_back(volumes[0]->center().x() - m_cfg.volumeCfg[0].length.x() * 0.5); for (std::size_t i = 0; i < volumes.size(); i++) { diff --git a/Core/src/Geometry/LayerArrayCreator.cpp b/Core/src/Geometry/LayerArrayCreator.cpp index baca1a8c13d9..f9604cacb466 100644 --- a/Core/src/Geometry/LayerArrayCreator.cpp +++ b/Core/src/Geometry/LayerArrayCreator.cpp @@ -69,7 +69,7 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( // arbitrary binning case arbitrary: { - std::vector boundaries; + std::vector boundaries; // initial step boundaries.push_back(min); double layerValue = 0.; diff --git a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp index 15ca130289ab..8fbe6a989b1d 100644 --- a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp @@ -33,7 +33,7 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( // prepare what we need : // (1) arbitrary binning for volumes is fast enough - std::vector boundaries; + std::vector boundaries; boundaries.reserve(tVolumes.size() + 1); // (2) the vector needed for the BinnedArray std::vector tVolumesOrdered; diff --git a/Plugins/Json/src/UtilitiesJsonConverter.cpp b/Plugins/Json/src/UtilitiesJsonConverter.cpp index d43f87243cda..8ec2d6504c80 100644 --- a/Plugins/Json/src/UtilitiesJsonConverter.cpp +++ b/Plugins/Json/src/UtilitiesJsonConverter.cpp @@ -73,7 +73,7 @@ void Acts::from_json(const nlohmann::json& j, BinningData& bd) { bd = BinningData(bOption, bValue, bins, min, max, std::move(subBinning), subBinningAdditive); } else { - std::vector boundaries = j["boundaries"]; + std::vector boundaries = j["boundaries"]; bd = BinningData(bOption, bValue, boundaries, std::move(subBinning)); } } diff --git a/Tests/Benchmarks/BinUtilityBenchmark.cpp b/Tests/Benchmarks/BinUtilityBenchmark.cpp index 6c9abdf5e4df..e8b5a8209151 100644 --- a/Tests/Benchmarks/BinUtilityBenchmark.cpp +++ b/Tests/Benchmarks/BinUtilityBenchmark.cpp @@ -45,21 +45,21 @@ int main(int argc, char* argv[]) { ACTS_LOCAL_LOGGER(getDefaultLogger("BinUtility", Acts::Logging::Level(lvl))); - std::vector fewBins; + std::vector fewBins; fewBins.reserve(6); for (unsigned int ib = 0; ib < 6; ++ib) { fewBins.push_back(ib * 6. / 5.); } Acts::BinUtility small(fewBins, Acts::open, Acts::BinningValue::binX); - std::vector mediumBins; + std::vector mediumBins; mediumBins.reserve(21); for (unsigned int ib = 0; ib < 21; ++ib) { mediumBins.push_back(ib * 6. / 20.); } Acts::BinUtility medium(mediumBins, Acts::open, Acts::BinningValue::binX); - std::vector manyBins; + std::vector manyBins; manyBins.reserve(101); for (unsigned int ib = 0; ib < 101; ++ib) { manyBins.push_back(ib * 6. / 100.); diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp index c0165d381641..37e290792826 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp @@ -176,7 +176,7 @@ struct CubicTrackingGeometry { tapVec.push_back(std::make_pair(trackVolume1, Vector3(-1.5_m, 0., 0.))); tapVec.push_back(std::make_pair(trackVolume2, Vector3(1.5_m, 0., 0.))); - std::vector binBoundaries = {-3._m, 0., 3._m}; + std::vector binBoundaries = {-3._m, 0., 3._m}; BinningData binData(BinningOption::open, BinningValue::binX, binBoundaries); std::unique_ptr bu(new BinUtility(binData)); diff --git a/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp b/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp index 05c4c5946a8c..8119959a3ae1 100644 --- a/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp +++ b/Tests/UnitTests/Core/Detector/ProtoBinningTests.cpp @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(ProtoBinningVariable) { BOOST_AUTO_TEST_CASE(BinningDescriptionFromAndToBinUtility) { // A valid binning Acts::BinUtility bUtility(5u, 0., 10., Acts::open, Acts::BinningValue::binR); - std::vector edges = {-M_PI, 0.1, M_PI}; + std::vector edges = {-M_PI, 0.1, M_PI}; bUtility += Acts::BinUtility(edges, Acts::closed, Acts::BinningValue::binPhi); auto bDescription = BinningDescription::fromBinUtility(bUtility); diff --git a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp index 83b2cfc796ba..5b0e3e3d737b 100644 --- a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(BinUtility_equidistant_binning) { // OPEN - equidistant binning tests BOOST_AUTO_TEST_CASE(BinUtility_arbitrary_binning) { - std::vector bvalues = {-5., 0., 1., 1.1, 8.}; + std::vector bvalues = {-5., 0., 1., 1.1, 8.}; BinUtility xUtil(bvalues, Acts::open, Acts::BinningValue::binX); // Underflow diff --git a/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp b/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp index a7effbe42006..18cc9b3fded0 100644 --- a/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinningDataTests.cpp @@ -58,13 +58,13 @@ BinningData etaData_eq(open, BinningValue::binEta, 5, -2.5, 2.5); BinningData xData_eq_copy(open, BinningValue::binX, 10, 0., 10.); // the binnings - arbitrary -std::vector values = {0., 1., 2., 3., 4., 10.}; +std::vector values = {0., 1., 2., 3., 4., 10.}; // bin boundaries // | 0 | 1 | 2 | 3 | 4 | 10 | BinningData xData_arb(open, BinningValue::binX, values); BinningData yData_arb(open, BinningValue::binY, values); // | -M_PI | -2 | -1 | 1 | 2 | M_PI | -std::vector phiValues = {-M_PI, -2., -1., 1., 2., M_PI}; +std::vector phiValues = {-M_PI, -2., -1., 1., 2., M_PI}; BinningData phiData_arb(closed, BinningValue::binPhi, phiValues); // the binnings - arbitrary when switching to binary search - for boundary @@ -76,7 +76,7 @@ double delta = 0.5; double phiDelta = 0.1064; // the binning - substructure -std::vector sstr = {0., 1., 1.5, 2., 3.}; +std::vector sstr = {0., 1., 1.5, 2., 3.}; // multiplicative auto xData_sstr_mult = std::make_unique(open, BinningValue::binX, sstr); @@ -85,7 +85,7 @@ BinningData xData_mult(open, BinningValue::binX, 3, 0., 9., std::move(xData_sstr_mult)); /// additive // | 0 | 1 | 1.5 | 2 | 3 | 4 | 5 | -std::vector main_sstr = {0., 3., 4., 5.}; +std::vector main_sstr = {0., 3., 4., 5.}; auto xData_sstr_add = std::make_unique(open, BinningValue::binX, sstr); BinningData xData_add(open, BinningValue::binX, main_sstr, @@ -99,8 +99,8 @@ BinningData xData_add(open, BinningValue::binX, main_sstr, BOOST_AUTO_TEST_CASE(BinningData_BinningValue) { // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 - std::vector values_binary; - std::vector phiValues_binary; + std::vector values_binary; + std::vector phiValues_binary; for (std::size_t i = 0; i <= nBins_binary; i++) { values_binary.push_back(valueMin + i * delta); phiValues_binary.push_back(phiMin + i * phiDelta); @@ -161,8 +161,8 @@ BOOST_AUTO_TEST_CASE(BinningData_BinningValue) { BOOST_AUTO_TEST_CASE(BinningData_bins) { // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 - std::vector values_binary; - std::vector phiValues_binary; + std::vector values_binary; + std::vector phiValues_binary; for (std::size_t i = 0; i <= nBins_binary; i++) { values_binary.push_back(valueMin + i * delta); phiValues_binary.push_back(phiMin + i * phiDelta); @@ -229,8 +229,8 @@ BOOST_AUTO_TEST_CASE(BinningData_bins) { BOOST_AUTO_TEST_CASE(BinningData_inside_outside) { // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 - std::vector values_binary; - std::vector phiValues_binary; + std::vector values_binary; + std::vector phiValues_binary; for (std::size_t i = 0; i <= nBins_binary; i++) { values_binary.push_back(valueMin + i * delta); phiValues_binary.push_back(phiMin + i * phiDelta); @@ -273,8 +273,8 @@ BOOST_AUTO_TEST_CASE(BinningData_inside_outside) { BOOST_AUTO_TEST_CASE(BinningData_open_close) { // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 - std::vector values_binary; - std::vector phiValues_binary; + std::vector values_binary; + std::vector phiValues_binary; for (std::size_t i = 0; i <= nBins_binary; i++) { values_binary.push_back(valueMin + i * delta); phiValues_binary.push_back(phiMin + i * phiDelta); @@ -305,19 +305,20 @@ BOOST_AUTO_TEST_CASE(BinningData_open_close) { // test boundaries BOOST_AUTO_TEST_CASE(BinningData_boundaries) { // open values - std::vector boundaries = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}; + std::vector boundaries = {0., 1., 2., 3., 4., 5., + 6., 7., 8., 9., 10.}; BOOST_CHECK_EQUAL_COLLECTIONS(xData_eq.boundaries().begin(), xData_eq.boundaries().end(), boundaries.begin(), boundaries.end()); - float phiStep = M_PI * 2. / 5.; - std::vector phiBoundaries_eq = { + ActsScalar phiStep = M_PI * 2. / 5.; + std::vector phiBoundaries_eq = { -M_PI, - static_cast(-M_PI + 1 * phiStep), - static_cast(-M_PI + 2 * phiStep), - static_cast(-M_PI + 3 * phiStep), - static_cast(-M_PI + 4 * phiStep), - static_cast(-M_PI + 5 * phiStep)}; + static_cast(-M_PI + 1 * phiStep), + static_cast(-M_PI + 2 * phiStep), + static_cast(-M_PI + 3 * phiStep), + static_cast(-M_PI + 4 * phiStep), + static_cast(-M_PI + 5 * phiStep)}; CHECK_CLOSE_REL(phiData_eq.boundaries(), phiBoundaries_eq, 1e-5); } @@ -326,8 +327,8 @@ BOOST_AUTO_TEST_CASE(BinningData_boundaries) { BOOST_AUTO_TEST_CASE(BinningData_bincenter) { // the binnings - arbitrary when switching to binary search - for boundary // sizes >= 50 - std::vector values_binary; - std::vector phiValues_binary; + std::vector values_binary; + std::vector phiValues_binary; for (std::size_t i = 0; i <= nBins_binary; i++) { values_binary.push_back(valueMin + i * delta); phiValues_binary.push_back(phiMin + i * phiDelta); @@ -355,20 +356,20 @@ BOOST_AUTO_TEST_CASE(BinningData_bincenter) { BOOST_CHECK_EQUAL(xData_arb_binary.center(0), 0.5 * delta); // open values - std::vector center = {0.5, 1.5, 2.5, 3.5, 4.5, - 5.5, 6.5, 7.5, 8.5, 9.5}; + std::vector center = {0.5, 1.5, 2.5, 3.5, 4.5, + 5.5, 6.5, 7.5, 8.5, 9.5}; for (std::size_t ib = 0; ib < center.size(); ++ib) { BOOST_CHECK_EQUAL(xData_eq.center(ib), center[ib]); } // running into rounding errors here - float phiStep = M_PI * 2. / 5.; - std::vector phiCenters_eq = { - static_cast(-M_PI + 0.5 * phiStep), - static_cast(-M_PI + 1.5 * phiStep), - static_cast(-M_PI + 2.5 * phiStep), - static_cast(-M_PI + 3.5 * phiStep), - static_cast(-M_PI + 4.5 * phiStep)}; + ActsScalar phiStep = M_PI * 2. / 5.; + std::vector phiCenters_eq = { + static_cast(-M_PI + 0.5 * phiStep), + static_cast(-M_PI + 1.5 * phiStep), + static_cast(-M_PI + 2.5 * phiStep), + static_cast(-M_PI + 3.5 * phiStep), + static_cast(-M_PI + 4.5 * phiStep)}; for (std::size_t ib = 0; ib < phiCenters_eq.size(); ++ib) { CHECK_CLOSE_ABS(phiData_eq.center(ib), phiCenters_eq[ib], 1e-3); @@ -379,39 +380,39 @@ BOOST_AUTO_TEST_CASE(BinningData_bincenter) { BOOST_AUTO_TEST_CASE(BinningData_phi_modules) { // n phi modules with phi boundary at -M_Pi/+M_PI are checked above // one module expands over -M_Pi/+M_PI - float deltaPhi = 0.1; + ActsScalar deltaPhi = 0.1; BinningData phiData_mod(closed, BinningValue::binPhi, 5, -M_PI + deltaPhi, M_PI + deltaPhi); - float phiStep = M_PI * 2. / 5.; - std::vector phiBoundaries_mod = { - static_cast(-M_PI + deltaPhi), - static_cast(-M_PI + 1 * phiStep) + deltaPhi, - static_cast(-M_PI + 2 * phiStep) + deltaPhi, - static_cast(-M_PI + 3 * phiStep) + deltaPhi, - static_cast(-M_PI + 4 * phiStep) + deltaPhi, - static_cast(-M_PI + 5 * phiStep) + deltaPhi}; + ActsScalar phiStep = M_PI * 2. / 5.; + std::vector phiBoundaries_mod = { + static_cast(-M_PI + deltaPhi), + static_cast(-M_PI + 1 * phiStep) + deltaPhi, + static_cast(-M_PI + 2 * phiStep) + deltaPhi, + static_cast(-M_PI + 3 * phiStep) + deltaPhi, + static_cast(-M_PI + 4 * phiStep) + deltaPhi, + static_cast(-M_PI + 5 * phiStep) + deltaPhi}; // this is the boundary test CHECK_CLOSE_REL(phiData_mod.boundaries(), phiBoundaries_mod, 1e-5); // now test the bin jump 0/maxbin - float firstAngle = (-M_PI + 1.5 * deltaPhi); + ActsScalar firstAngle = (-M_PI + 1.5 * deltaPhi); Vector3 firstBin(cos(firstAngle), sin(firstAngle), 0.); BOOST_CHECK_EQUAL(phiData_mod.search(firstAngle), std::size_t{0}); BOOST_CHECK_EQUAL(phiData_mod.searchGlobal(firstBin), std::size_t{0}); - float firstAngleNeg = (-M_PI + 0.5 * deltaPhi); + ActsScalar firstAngleNeg = (-M_PI + 0.5 * deltaPhi); Vector3 lastBinNeg(cos(firstAngleNeg), sin(firstAngleNeg), 0.); BOOST_CHECK_EQUAL(phiData_mod.search(firstAngleNeg), std::size_t{4}); BOOST_CHECK_EQUAL(phiData_mod.searchGlobal(lastBinNeg), std::size_t{4}); - float lastAnglePos = (M_PI + 0.5 * deltaPhi); + ActsScalar lastAnglePos = (M_PI + 0.5 * deltaPhi); Vector3 lastBinPos(cos(lastAnglePos), sin(lastAnglePos), 0.); BOOST_CHECK_EQUAL(phiData_mod.search(lastAnglePos), std::size_t{4}); BOOST_CHECK_EQUAL(phiData_mod.searchGlobal(lastBinPos), std::size_t{4}); // now test the (remaining) phi scaling - float underscaledAngle = -M_PI - 0.5 * deltaPhi; + ActsScalar underscaledAngle = -M_PI - 0.5 * deltaPhi; Vector3 underscaledPos(cos(underscaledAngle), sin(underscaledAngle), 0.); BOOST_CHECK_EQUAL(phiData_mod.search(underscaledAngle), std::size_t{4}); BOOST_CHECK_EQUAL(phiData_mod.searchGlobal(underscaledPos), std::size_t{4}); diff --git a/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp b/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp index 8a5b1c9c5336..ea5c3f958992 100644 --- a/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp +++ b/Tests/UnitTests/Plugins/Json/UtilitiesJsonConverterTests.cpp @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(BinUtilityRoundTripTests) { BOOST_CHECK(isEqual(reference, test, 0.0001)); // Increase to three dimensions - std::vector boundaries = {-4., -1.5, 0., 10.}; + std::vector boundaries = {-4., -1.5, 0., 10.}; reference += BinUtility(boundaries, open, BinningValue::binZ); nlohmann::json jthreeDimOut; to_json(jthreeDimOut, reference); diff --git a/cmake/ActsCompilerOptions.cmake b/cmake/ActsCompilerOptions.cmake index ea1b505c3d5c..6e47e79db519 100644 --- a/cmake/ActsCompilerOptions.cmake +++ b/cmake/ActsCompilerOptions.cmake @@ -4,7 +4,7 @@ if (NOT CMAKE_BUILD_TYPE) message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") endif() -set(cxx_flags "-Wall -Wextra -Wpedantic -Wshadow -Wno-unused-local-typedefs") +set(cxx_flags "-Wall -Wextra -Wpedantic -Wshadow -Wno-unused-local-typedefs -fconcepts-diagnostics-depth=10") # This adds some useful conversion checks like float-to-bool, float-to-int, etc. # However, at the moment this is only added to clang builds, since GCC's -Wfloat-conversion