diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index b08d0a4afe680ba8b8ef108727469c5c9871de09..bbb0e86c29cf3228afcfe45548c32b52a69bfc9d 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -206,7 +206,6 @@ install(FILES CbmL1Counters.h L1Algo/L1ObjectInitController.h L1Algo/L1Constants.h L1Algo/L1Utils.h - L1Algo/L1NaN.h L1Algo/L1SimdSerializer.h L1Algo/L1TrackPar.h L1Algo/L1Track.h diff --git a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx index 9f211669b3f1edea969a944c682a1b84c92b7c82..09002f5a78a5d361c3abe3a088f4ae32869993b6 100644 --- a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx @@ -516,8 +516,12 @@ inline void L1Algo::findTripletsStep0( // input const L1Station& stam = fParameters.GetStation(iStaM); const L1Station& star = fParameters.GetStation(iStaR); - L1HitIndex_t hitsl_2[fvec::size()] {L1NaN::SetNaN<L1HitIndex_t>()}; - L1HitIndex_t hitsm_2_tmp[fvec::size()] {L1NaN::SetNaN<L1HitIndex_t>()}; + std::array<L1HitIndex_t, fvec::size()> hitsl_2 = {}; + std::array<L1HitIndex_t, fvec::size()> hitsm_2_tmp = {}; + + std::fill(hitsl_2.begin(), hitsl_2.end(), undef::kU32); + std::fill(hitsm_2_tmp.begin(), hitsm_2_tmp.end(), undef::kU32); + L1TrackPar L1TrackPar_0; // SG!! to avoid nans in unfilled part //TODO: SG: investigate, it changes the results !! diff --git a/reco/L1/L1Algo/L1Constants.h b/reco/L1/L1Algo/L1Constants.h index 4917146e0b47ff7fcc5d11c618f8be9d26e29d19..af74194f3ac45e096165032093932abd9ef9cb56 100644 --- a/reco/L1/L1Algo/L1Constants.h +++ b/reco/L1/L1Algo/L1Constants.h @@ -12,7 +12,10 @@ #ifndef L1Constants_h #define L1Constants_h 1 -#include "L1NaN.h" +#include "CaSimd.h" +using cbm::algo::ca::fmask; +using cbm::algo::ca::fscal; // TODO: remove "using" from headers +using cbm::algo::ca::fvec; // TODO: remove "using" from headers /// Namespace contains compile-time constants definition for the L1 tracking algorithm namespace L1Constants diff --git a/reco/L1/L1Algo/L1Material.h b/reco/L1/L1Algo/L1Material.h index 1727d3c363d3ef73de54541b53e7bc941501e40f..3dcf4924a6334d7b7e86bbb8a70a800e62a71689 100644 --- a/reco/L1/L1Algo/L1Material.h +++ b/reco/L1/L1Algo/L1Material.h @@ -13,7 +13,6 @@ #include <vector> #include "L1Def.h" -#include "L1NaN.h" #include "L1SimdSerializer.h" #include "L1Undef.h" @@ -54,13 +53,13 @@ public: float GetRadThickScal(float x, float y) const; /// Gets material thickness in units of X0 in (x,y) point of the station - /// fvec type can be float, that is why "Vec" and "Scal" specifications + /// cbm::algo::ca::fvec type can be float, that is why "Vec" and "Scal" specifications /// \param x X coordinate of the point [cm] (SIMDized vector) /// \param y Y coordinate of the point [cm] (SIMDized veotor) - fvec GetRadThickVec(fvec x, fvec y) const; + cbm::algo::ca::fvec GetRadThickVec(cbm::algo::ca::fvec x, cbm::algo::ca::fvec y) const; /// Checks, if the fields are NaN - bool IsNaN() const { return L1NaN::IsNaN(fNbins) || L1NaN::IsNaN(fRmax) || L1NaN::IsNaN(fFactor); } + bool IsNaN() const { return undef::IsUndefined(fNbins) || undef::IsUndefined(fRmax) || undef::IsUndefined(fFactor); } /// Verifies class invariant consistency void CheckConsistency() const; diff --git a/reco/L1/L1Algo/L1NaN.h b/reco/L1/L1Algo/L1NaN.h deleted file mode 100644 index 129cd32ca05884708537cac7cb38eefab1ea9a77..0000000000000000000000000000000000000000 --- a/reco/L1/L1Algo/L1NaN.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergei Zharko [committer] */ - -/*************************************************************************************************** - * @file L1NaN.h - * @brief Definition of setters and checkers for NaN values - * @since 21.06.2022 - * @author S.Zharko <s.zharko@gsi.de> - ***************************************************************************************************/ - -#ifndef L1NaN_h -#define L1NaN_h 1 - -#include <limits> -#include <type_traits> - -#include <cmath> - -#include "CaSimd.h" -#include "L1Def.h" - -using cbm::algo::ca::fmask; -using cbm::algo::ca::fscal; // TODO: remove "using" from headers -using cbm::algo::ca::fvec; // TODO: remove "using" from headers - -/// Namespace L1NaN defines functions to set variables to NaN and check wether they are NaN or not -/// -namespace L1NaN -{ - /// Returns NaN value for a floating point variable - template<typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> - constexpr auto SetNaN() - { - return std::numeric_limits<T>::signaling_NaN(); - } - - /// Returns MaN value for an intergral variable - template<typename T, - typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type* = nullptr> - constexpr auto SetNaN() - { - return T(-1); // -1 for signed integers and MAX_INT for unsigned integers - } - - /// Returns MaN value for fvec variable - template<typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr> - constexpr auto SetNaN() - { - return fvec(SetNaN<fscal>()); - } - - /// Checks, if the floating point variable is NaN - template<typename T, typename std::enable_if<std::is_floating_point<T>::value, T>::type* = nullptr> - bool IsNaN(T value) - { - return std::isnan(value); - } - - /// Checks, if the integral variable is NaN - template<typename T, - typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type* = nullptr> - bool IsNaN(T value) - { - return T(-1) == value; - } - - /// Checks, if the fvec variable is NaN - template<typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr> - bool IsNaN(T value) - { - return isnan(value).isNotEmpty(); // NOTE: Here we consider fvec a NaN if at least one of its words is NaN - } -}; // namespace L1NaN - -#endif // L1NaN_h diff --git a/reco/L1/L1Algo/L1SimdSerializer.h b/reco/L1/L1Algo/L1SimdSerializer.h index a78dbf9c72a270c9924309e2f9617e5b0ee7e6c2..79505b8125c82cdb2dc305b433ae486c6194c592 100644 --- a/reco/L1/L1Algo/L1SimdSerializer.h +++ b/reco/L1/L1Algo/L1SimdSerializer.h @@ -22,23 +22,23 @@ namespace boost namespace serialization { template<class Archive> - void save(Archive& ar, const fvec& vect, unsigned int) + void save(Archive& ar, const cbm::algo::ca::fvec& vect, unsigned int) { ar << vect[0]; } template<class Archive> - void load(Archive& ar, fvec& vect, unsigned int) + void load(Archive& ar, cbm::algo::ca::fvec& vect, unsigned int) { - fscal buffer; + cbm::algo::ca::fscal buffer; ar >> buffer; - for (size_t i = 0; i < fvec::size(); ++i) { + for (size_t i = 0; i < cbm::algo::ca::fvec::size(); ++i) { vect[i] = buffer; } } template<class Archive> - void serialize(Archive& ar, fvec& vect, const unsigned int version) + void serialize(Archive& ar, cbm::algo::ca::fvec& vect, const unsigned int version) { split_free(ar, vect, version); } diff --git a/reco/L1/L1Algo/L1UMeasurementInfo.cxx b/reco/L1/L1Algo/L1UMeasurementInfo.cxx index a8e45ad248f0bf402d6467422ca487d49a934885..3fc58dd95a672d4bd6962af52fd04a2d681ec4d0 100644 --- a/reco/L1/L1Algo/L1UMeasurementInfo.cxx +++ b/reco/L1/L1Algo/L1UMeasurementInfo.cxx @@ -7,6 +7,8 @@ #include <iomanip> #include <sstream> +using namespace cbm::algo::ca; + //---------------------------------------------------------------------------------------------------------------------- // std::string L1UMeasurementInfo::ToString(int indentLevel) const diff --git a/reco/L1/L1Algo/L1UMeasurementInfo.h b/reco/L1/L1Algo/L1UMeasurementInfo.h index 51e05f7040ec1dbdef434e9321fcececa4c98091..bb1b77546927cd9f80e49ca779c0fc2eaa8f13da 100644 --- a/reco/L1/L1Algo/L1UMeasurementInfo.h +++ b/reco/L1/L1Algo/L1UMeasurementInfo.h @@ -8,7 +8,6 @@ #include <string> #include "L1Def.h" -#include "L1NaN.h" #include "L1SimdSerializer.h" #include "L1Undef.h" #include "L1Utils.h" @@ -16,8 +15,8 @@ class L1UMeasurementInfo { public: - fvec cos_phi = undef::kFvc; - fvec sin_phi = undef::kFvc; + cbm::algo::ca::fvec cos_phi = undef::kFvc; + cbm::algo::ca::fvec sin_phi = undef::kFvc; /// String representation of class contents /// \param indentLevel number of indent characters in the output diff --git a/reco/L1/L1Algo/L1XYMeasurementInfo.h b/reco/L1/L1Algo/L1XYMeasurementInfo.h index aa48af6501128dbfb15611d2920e571e5b26bfab..41a82401be095ad70a69786a1663071956daf443 100644 --- a/reco/L1/L1Algo/L1XYMeasurementInfo.h +++ b/reco/L1/L1Algo/L1XYMeasurementInfo.h @@ -8,15 +8,14 @@ #include <string> #include "L1Def.h" -#include "L1NaN.h" #include "L1SimdSerializer.h" #include "L1Undef.h" class L1XYMeasurementInfo { public: - fvec C00 = undef::kFvc; - fvec C10 = undef::kFvc; - fvec C11 = undef::kFvc; + cbm::algo::ca::fvec C00 = undef::kFvc; + cbm::algo::ca::fvec C10 = undef::kFvc; + cbm::algo::ca::fvec C11 = undef::kFvc; /// Consistency checker void CheckConsistency() const; @@ -26,7 +25,7 @@ public: std::string ToString(int indentLevel = 0) const; /// Checks, if the fields are NaN - bool IsNaN() const { return L1NaN::IsNaN(C00) || L1NaN::IsNaN(C10) || L1NaN::IsNaN(C11); } + bool IsNaN() const { return undef::IsUndefined(C00) || undef::IsUndefined(C10) || undef::IsUndefined(C11); } /// Serialization function friend class boost::serialization::access;