From d09ec6079962c809ce201d66b2a0ffdcd0164521 Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Thu, 14 Nov 2024 17:28:41 +0100 Subject: [PATCH] Ca: remove legacy FAST_CODE define --- algo/ca/core/data/CaDataManager.cxx | 2 +- algo/ca/core/data/CaGrid.cxx | 2 +- algo/ca/core/tracking/CaTrackFinderWindow.h | 2 -- .../ca/core/tracking/CaTripletConstructor.cxx | 2 +- algo/ca/core/utils/CaVector.h | 25 +++---------------- 5 files changed, 6 insertions(+), 27 deletions(-) diff --git a/algo/ca/core/data/CaDataManager.cxx b/algo/ca/core/data/CaDataManager.cxx index b2485442f2..7d237151d6 100644 --- a/algo/ca/core/data/CaDataManager.cxx +++ b/algo/ca/core/data/CaDataManager.cxx @@ -95,7 +95,7 @@ void DataManager::InitData() // TODO: SZh 14.08.2023: Move the max allowed number of streams to the constants.h if (fInputData.fvStreamStartIndices.size() > 3000) { LOG(warning) << "ca::DataManager: unexpected order of input data: too many data streams!!! "; - fInputData.fvStreamStartIndices.reduce(3000); + fInputData.fvStreamStartIndices.shrink(3000); } int nStreams = fInputData.fvStreamStartIndices.size(); fInputData.fvStreamStopIndices.reset(nStreams); diff --git a/algo/ca/core/data/CaGrid.cxx b/algo/ca/core/data/CaGrid.cxx index f37345f611..f1e615cfb9 100644 --- a/algo/ca/core/data/CaGrid.cxx +++ b/algo/ca/core/data/CaGrid.cxx @@ -122,5 +122,5 @@ void Grid::RemoveUsedHits(const Vector<ca::Hit>& hits, const Vector<unsigned cha } fFirstBinEntryIndex[fN] = nEntries; fNofBinEntries[fN] = 0; - fEntries.reduce(nEntries); + fEntries.shrink(nEntries); } diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.h b/algo/ca/core/tracking/CaTrackFinderWindow.h index eb7296cf63..c08ea5570a 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.h +++ b/algo/ca/core/tracking/CaTrackFinderWindow.h @@ -149,10 +149,8 @@ namespace cbm::algo::ca [[gnu::always_inline]] inline unsigned int TrackFinderWindow::PackTripletId(unsigned int iStation, unsigned int iTriplet) { -#ifndef FAST_CODE assert(iStation < constants::size::MaxNstations); assert(iTriplet < constants::size::MaxNtriplets); -#endif constexpr unsigned int kMoveStation = constants::size::TripletBits; return (iStation << kMoveStation) + iTriplet; } diff --git a/algo/ca/core/tracking/CaTripletConstructor.cxx b/algo/ca/core/tracking/CaTripletConstructor.cxx index a0c0aae26a..bcf80ffa2a 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.cxx +++ b/algo/ca/core/tracking/CaTripletConstructor.cxx @@ -279,7 +279,7 @@ void TripletConstructor::FindDoublets(kf::TrackKalmanFilter<fvec>& fit) *it2 = indM; it2++; } // it - hitsM.reduce(std::distance(hitsM.begin(), it2)); + hitsM.shrink(std::distance(hitsM.begin(), it2)); } diff --git a/algo/ca/core/utils/CaVector.h b/algo/ca/core/utils/CaVector.h index 76953d2d5f..467fda792a 100644 --- a/algo/ca/core/utils/CaVector.h +++ b/algo/ca/core/utils/CaVector.h @@ -11,9 +11,8 @@ #ifndef CA_CORE_CaVector_h #define CA_CORE_CaVector_h 1 -#ifndef FAST_CODE #include "AlgoFairloggerCompat.h" -#endif + #include <boost/serialization/access.hpp> #include <boost/serialization/base_object.hpp> #include <boost/serialization/string.hpp> @@ -133,7 +132,6 @@ namespace cbm::algo::ca template<typename... Tinput> void enlarge(std::size_t count, Tinput... value) { -#ifndef FAST_CODE if (count < Tbase::size()) { LOG(fatal) << "ca::Vector \"" << fName << "\"::enlarge(" << count << "): the new size is smaller than the current one " << Tbase::size() << ", something goes wrong."; @@ -144,21 +142,18 @@ namespace cbm::algo::ca << Tbase::capacity() << " is reached, the vector of size " << Tbase::size() << " will be copied to the new place."; } -#endif Tbase::resize(count, value...); } /// \brief Reduces the vector to a given size /// \param count Size of the new vector - void reduce(std::size_t count) + void shrink(std::size_t count) { -#ifndef FAST_CODE if (count > Tbase::size()) { - LOG(fatal) << "ca::Vector \"" << fName << "\"::reduce(" << count + LOG(fatal) << "ca::Vector \"" << fName << "\"::shrink(" << count << "): the new size is bigger than the current one " << Tbase::size() << ", something goes wrong."; assert(count < Tbase::size()); } -#endif Tbase::resize(count); } @@ -166,13 +161,11 @@ namespace cbm::algo::ca /// \param count New size of the vector void reserve(std::size_t count) { -#ifndef FAST_CODE if (!Tbase::empty()) { LOG(fatal) << "ca::Vector \"" << fName << "\"::reserve(" << count << "): the vector is not empty; " << " it will be copied to the new place."; assert(Tbase::empty()); } -#endif Tbase::reserve(count); } @@ -182,12 +175,10 @@ namespace cbm::algo::ca template<typename Tinput> void push_back(Tinput value) { -#ifndef FAST_CODE if (Tbase::size() >= Tbase::capacity()) { LOG(warning) << "ca::Vector \"" << fName << "\"::push_back(): allocated capacity of " << Tbase::capacity() << " is reached, re-allocate and copy."; } -#endif Tbase::push_back(value); } @@ -204,12 +195,10 @@ namespace cbm::algo::ca template<typename... Tinput> void emplace_back(Tinput&&... value) { -#ifndef FAST_CODE if (Tbase::size() >= Tbase::capacity()) { LOG(warning) << "ca::Vector \"" << fName << "\"::emplace_back(): allocated capacity of " << Tbase::capacity() << " is reached, re-allocate and copy."; } -#endif Tbase::emplace_back(value...); } @@ -217,13 +206,11 @@ namespace cbm::algo::ca /// \param pos Index of the element T& operator[](std::size_t pos) { -#ifndef FAST_CODE if (pos >= Tbase::size()) { LOG(fatal) << "ca::Vector \"" << fName << "\": trying to access element " << pos << " outside of the vector of the size of " << Tbase::size(); assert(pos < Tbase::size()); } -#endif return Tbase::operator[](pos); } @@ -231,37 +218,31 @@ namespace cbm::algo::ca /// \param pos Index of the element const T& operator[](std::size_t pos) const { -#ifndef FAST_CODE if (pos >= Tbase::size()) { LOG(fatal) << "ca::Vector \"" << fName << "\": trying to access element " << pos << " outside of the vector of the size of " << Tbase::size(); assert(pos < Tbase::size()); } -#endif return Tbase::operator[](pos); } /// \brief Mutable access to the last element of the vector T& back() { -#ifndef FAST_CODE if (Tbase::size() == 0) { LOG(fatal) << "ca::Vector \"" << fName << "\": trying to access element of an empty vector"; assert(Tbase::size() > 0); } -#endif return Tbase::back(); } /// \brief Constant access to the last element of the vector const T& back() const { -#ifndef FAST_CODE if (Tbase::size() == 0) { LOG(fatal) << "ca::Vector \"" << fName << "\": trying to access element of an empty vector"; assert(Tbase::size() > 0); } -#endif return Tbase::back(); } -- GitLab