diff --git a/algo/ca/core/CMakeLists.txt b/algo/ca/core/CMakeLists.txt index b80a507590a8d3c227bc68c092e5d0983779a2f0..48e07a2e8eb2adeb040deb2a718aa34f8d48eb37 100644 --- a/algo/ca/core/CMakeLists.txt +++ b/algo/ca/core/CMakeLists.txt @@ -11,7 +11,6 @@ set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/data/CaDataManager.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaInputData.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaTrack.cxx - ${CMAKE_CURRENT_SOURCE_DIR}/data/CaTrackParam.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaGrid.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaHit.cxx ${CMAKE_CURRENT_SOURCE_DIR}/data/CaTriplet.cxx @@ -38,7 +37,6 @@ set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tracking/CaTrackFit.cxx ${CMAKE_CURRENT_SOURCE_DIR}/tracking/CaTrackFitter.cxx ${CMAKE_CURRENT_SOURCE_DIR}/tracking/CaTripletConstructor.cxx - ${CMAKE_CURRENT_SOURCE_DIR}/utils/CaUtils.cxx ) SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS "-O3") @@ -84,7 +82,6 @@ install( data/CaGridEntry.h data/CaHit.h data/CaInputData.h - data/CaTrackParam.h data/CaTrack.h data/CaMeasurementU.h data/CaMeasurementXy.h @@ -117,7 +114,6 @@ install( utils/CaSimd.h utils/CaTimer.h utils/CaVector.h - utils/CaUtils.h utils/CaDefines.h tracking/CaCloneMerger.h tracking/CaFramework.h diff --git a/algo/ca/core/data/CaGridArea.h b/algo/ca/core/data/CaGridArea.h index aa7bd50c92c4ec8d620f7d617b81a74dd8bf8900..5fb1460fe77a0e9875f97e87fcbf1755f3987724 100644 --- a/algo/ca/core/data/CaGridArea.h +++ b/algo/ca/core/data/CaGridArea.h @@ -9,7 +9,6 @@ #include "CaGrid.h" #include "CaHit.h" #include "CaSimd.h" -#include "CaUtils.h" namespace cbm::algo::ca { @@ -81,8 +80,8 @@ namespace cbm::algo::ca bool xIndexOutOfRange = (fCurentEntry >= fEntriesXend); // current entry is not in the area // jump to the next y row if fCurentEntry is outside of the X area - while (utils::IsUnlikely(xIndexOutOfRange)) { - if (utils::IsUnlikely(fAreaCurrentBinY >= fAreaLastBinY)) { + while (kfutils::IsUnlikely(xIndexOutOfRange)) { + if (kfutils::IsUnlikely(fAreaCurrentBinY >= fAreaLastBinY)) { return false; } fAreaCurrentBinY++; // get new y-line diff --git a/algo/ca/core/data/CaMeasurementTime.h b/algo/ca/core/data/CaMeasurementTime.h index 5f72d7f04ac9eacaa72793c83fcada915e22b539..7998a72c5bebf3597b7e50c96636b4310621954b 100644 --- a/algo/ca/core/data/CaMeasurementTime.h +++ b/algo/ca/core/data/CaMeasurementTime.h @@ -10,7 +10,6 @@ #include "CaConstants.h" #include "CaSimd.h" -#include "CaUtils.h" #include <boost/serialization/access.hpp> @@ -18,7 +17,6 @@ namespace cbm::algo::ca { - /// \brief The class describes a time measurement /// /// The measurement has a finite resolution, i.e. the measurement is not a value, but a distribution @@ -63,12 +61,12 @@ namespace cbm::algo::ca std::string ToString(int indentLevel = 0) const; /// Checks, if all fields are finite - bool IsFinite() const { return (utils::IsFinite(T()) && utils::IsFinite(Dt2()) && utils::IsFinite(NdfT())); } + bool IsFinite() const { return (kfutils::IsFinite(T()) && kfutils::IsFinite(Dt2()) && kfutils::IsFinite(NdfT())); } /// Checks, if some fields are undefined bool IsUndefined() const { - return (utils::IsUndefined(T()) || utils::IsUndefined(Dt2()) || utils::IsUndefined(NdfT())); + return (kfutils::IsUndefined(T()) || kfutils::IsUndefined(Dt2()) || kfutils::IsUndefined(NdfT())); } /// Serialization function diff --git a/algo/ca/core/data/CaMeasurementU.h b/algo/ca/core/data/CaMeasurementU.h index b145b326b684f30f65639f96cacabfaad4d32c29..d6abc158292c18f6921790c1a70d062e0656449f 100644 --- a/algo/ca/core/data/CaMeasurementU.h +++ b/algo/ca/core/data/CaMeasurementU.h @@ -10,7 +10,7 @@ #include "CaConstants.h" #include "CaSimd.h" -#include "CaUtils.h" +#include "KfDefs.h" #include <boost/serialization/access.hpp> @@ -83,15 +83,15 @@ namespace cbm::algo::ca /// Checks, if all fields are finite bool IsFinite() const { - return (utils::IsFinite(CosPhi()) && utils::IsFinite(SinPhi()) && utils::IsFinite(U()) && utils::IsFinite(Du2()) - && utils::IsFinite(Ndf())); + return (kfutils::IsFinite(CosPhi()) && kfutils::IsFinite(SinPhi()) && kfutils::IsFinite(U()) + && kfutils::IsFinite(Du2()) && kfutils::IsFinite(Ndf())); } /// Checks, if some fields are undefined bool IsUndefined() const { - return (utils::IsUndefined(CosPhi()) || utils::IsUndefined(SinPhi()) || utils::IsUndefined(U()) - || utils::IsUndefined(Du2()) || utils::IsUndefined(Ndf())); + return (kfutils::IsUndefined(CosPhi()) || kfutils::IsUndefined(SinPhi()) || kfutils::IsUndefined(U()) + || kfutils::IsUndefined(Du2()) || kfutils::IsUndefined(Ndf())); } /// Serialization function @@ -110,15 +110,15 @@ namespace cbm::algo::ca ///------------------------------ /// Data members - DataT fCosPhi = constants::Undef<DataT>; ///< cos(phi) - DataT fSinPhi = constants::Undef<DataT>; ///< sin(phi) - DataT fU = constants::Undef<DataT>; ///< measurement, u = x * cos(phi) + y * sin(phi) - DataT fDu2 = constants::Undef<DataT>; ///< rms^2 of the measurement + DataT fCosPhi = kfdefs::Undef<DataT>; ///< cos(phi) + DataT fSinPhi = kfdefs::Undef<DataT>; ///< sin(phi) + DataT fU = kfdefs::Undef<DataT>; ///< measurement, u = x * cos(phi) + y * sin(phi) + DataT fDu2 = kfdefs::Undef<DataT>; ///< rms^2 of the measurement /// \brief number of degrees of freedom (used for chi2 calculation) /// if ndf == 1, the measurement is used in the chi2 calculation /// if ndf == 0, the measurement is not used in the chi2 calculation - DataT fNdf = constants::Undef<DataT>; + DataT fNdf = kfdefs::Undef<DataT>; } _fvecalignment; } // namespace cbm::algo::ca diff --git a/algo/ca/core/data/CaMeasurementXy.h b/algo/ca/core/data/CaMeasurementXy.h index e13e26ef7ef88ad083a62c5cd32d2d1c7ecd10a8..f194bfa8961fb72b8a48329877f98c1942bfe30e 100644 --- a/algo/ca/core/data/CaMeasurementXy.h +++ b/algo/ca/core/data/CaMeasurementXy.h @@ -10,7 +10,6 @@ #include "CaConstants.h" #include "CaSimd.h" -#include "CaUtils.h" #include <boost/serialization/access.hpp> @@ -18,7 +17,6 @@ namespace cbm::algo::ca { - /// \brief The class describes a 2D - measurement (x, y) in XY coordinate system /// /// The measurement has a finite resolution, i.e. the measurement is not a point, but a distribution @@ -28,7 +26,6 @@ namespace cbm::algo::ca /// template<typename DataT> class MeasurementXy { - public: friend class boost::serialization::access; @@ -134,16 +131,16 @@ namespace cbm::algo::ca /// Checks, if all fields are finite bool IsFinite() const { - return (utils::IsFinite(X()) && utils::IsFinite(Y()) && utils::IsFinite(Dx2()) && utils::IsFinite(Dy2()) - && utils::IsFinite(Dxy()) && utils::IsFinite(NdfX()) && utils::IsFinite(NdfY())); + return (kfutils::IsFinite(X()) && kfutils::IsFinite(Y()) && kfutils::IsFinite(Dx2()) && kfutils::IsFinite(Dy2()) + && kfutils::IsFinite(Dxy()) && kfutils::IsFinite(NdfX()) && kfutils::IsFinite(NdfY())); } /// Checks, if some fields are undefined bool IsUndefined() const { - return (utils::IsUndefined(X()) || utils::IsUndefined(Y()) || utils::IsUndefined(Dx2()) - || utils::IsUndefined(Dy2()) || utils::IsUndefined(Dxy()) || utils::IsUndefined(NdfX()) - || utils::IsUndefined(NdfY())); + return (kfutils::IsUndefined(X()) || kfutils::IsUndefined(Y()) || kfutils::IsUndefined(Dx2()) + || kfutils::IsUndefined(Dy2()) || kfutils::IsUndefined(Dxy()) || kfutils::IsUndefined(NdfX()) + || kfutils::IsUndefined(NdfY())); } /// Serialization function @@ -203,7 +200,7 @@ namespace cbm::algo::ca inline void MeasurementXy<TdataA>::CopyBase(const int ia, const MeasurementXy<TdataB>& Tb, const int ib) { auto copy = [&](TdataA& a, const TdataB& b) { - utils::VecCopy<TdataA, TdataB, TDoAllA, TDoAllB>::CopyEntries(a, ia, b, ib); + kfutils::VecCopy<TdataA, TdataB, TDoAllA, TDoAllB>::CopyEntries(a, ia, b, ib); }; copy(fX, Tb.X()); diff --git a/algo/ca/core/data/CaTrack.h b/algo/ca/core/data/CaTrack.h index 6c623a9533e5a5ccd14d1651c0ba4d4182a11c86..3692849ee616ddd0ecb1c76704f740cd6052bb62 100644 --- a/algo/ca/core/data/CaTrack.h +++ b/algo/ca/core/data/CaTrack.h @@ -12,12 +12,14 @@ #include "CaConstants.h" #include "CaSimd.h" -#include "CaTrackParam.h" +#include "KfTrackParam.h" #include <boost/serialization/access.hpp> namespace cbm::algo::ca { + using cbm::algo::kf::TrackParamS; + /// \class cbm::algo::ca::Track /// \brief Class representing an output track in the CA tracking algorithm /// @@ -40,7 +42,7 @@ namespace cbm::algo::ca } public: - int fNofHits{constants::Undef<int>}; ///< Number of hits in track + int fNofHits{kfdefs::Undef<int>}; ///< Number of hits in track TrackParamS fParFirst; ///< Track parameters on the first station TrackParamS fParLast; ///< Track parameters on the last station diff --git a/algo/ca/core/pars/CaField.cxx b/algo/ca/core/pars/CaField.cxx index fc9dfe59e1433b80f423e364dc9683fd720adb2b..426555698ddb24bf41da76b468a50b8b47dc5316 100644 --- a/algo/ca/core/pars/CaField.cxx +++ b/algo/ca/core/pars/CaField.cxx @@ -4,8 +4,7 @@ #include "CaField.h" -#include "CaTrackParam.h" -#include "CaUtils.h" +#include "KfSimdUtils.h" #include <iomanip> #include <iostream> @@ -22,7 +21,7 @@ template<typename DataT> std::function<std::tuple<double, double, double>(double x, double y, double z)> FieldRegion<DataT>::fgOdiginalField([](double, double, double) { assert(false && "ca::FieldRegion: The original field is not set, use cbm::ca::tools::SetCbmField()"); - return std::tuple(constants::Undef<double>, constants::Undef<double>, constants::Undef<double>); + return std::tuple(kfdefs::Undef<double>, kfdefs::Undef<double>, kfdefs::Undef<double>); }); @@ -32,9 +31,9 @@ template<typename DataT> void FieldValue<DataT>::CheckConsistency() const { /* Check SIMD data vectors for consistent initialization */ - utils::CheckSimdVectorEquality(x, "FieldValue::x"); - utils::CheckSimdVectorEquality(y, "FieldValue::y"); - utils::CheckSimdVectorEquality(z, "FieldValue::z"); + kfutils::CheckSimdVectorEquality(x, "FieldValue::x"); + kfutils::CheckSimdVectorEquality(y, "FieldValue::y"); + kfutils::CheckSimdVectorEquality(z, "FieldValue::z"); // TODO: Any other checks? (S.Zharko) } @@ -47,9 +46,11 @@ std::string FieldValue<DataT>::ToString(int indentLevel) const std::stringstream aStream{}; constexpr char indentChar = '\t'; std::string indent(indentLevel, indentChar); - aStream << indent << "Bx [kG]: " << std::setw(12) << std::setfill(' ') << utils::simd::Cast<DataT, float>(x) << '\n'; - aStream << indent << "By [kG]: " << std::setw(12) << std::setfill(' ') << utils::simd::Cast<DataT, float>(y) << '\n'; - aStream << indent << "Bz [kG]: " << std::setw(12) << std::setfill(' ') << utils::simd::Cast<DataT, float>(z); + aStream << indent << "Bx [kG]: " << std::setw(12) << std::setfill(' ') << kfutils::simd::Cast<DataT, float>(x) + << '\n'; + aStream << indent << "By [kG]: " << std::setw(12) << std::setfill(' ') << kfutils::simd::Cast<DataT, float>(y) + << '\n'; + aStream << indent << "Bz [kG]: " << std::setw(12) << std::setfill(' ') << kfutils::simd::Cast<DataT, float>(z); return aStream.str(); } @@ -84,11 +85,11 @@ void FieldSlice<DataT>::CheckConsistency() const { /* Check SIMD data vectors for consistent initialization */ for (int i = 0; i < constants::size::MaxNFieldApproxCoefficients; ++i) { - utils::CheckSimdVectorEquality(cx[i], "FieldSlice: cx"); - utils::CheckSimdVectorEquality(cy[i], "FieldSlice: cy"); - utils::CheckSimdVectorEquality(cz[i], "FieldSlice: cz"); + kfutils::CheckSimdVectorEquality(cx[i], "FieldSlice: cx"); + kfutils::CheckSimdVectorEquality(cy[i], "FieldSlice: cy"); + kfutils::CheckSimdVectorEquality(cz[i], "FieldSlice: cz"); } - utils::CheckSimdVectorEquality(z, "FieldSlice: z"); + kfutils::CheckSimdVectorEquality(z, "FieldSlice: z"); } //---------------------------------------------------------------------------------------------------------------------- @@ -154,9 +155,9 @@ std::string FieldSlice<DataT>::ToString(int indentLevel) const for (int i = 0; i < constants::size::MaxNFieldApproxCoefficients; ++i) { aStream << '\n' << indent; aStream << std::setw(3) << std::setfill(' ') << i << ' '; - aStream << std::setw(12) << std::setfill(' ') << utils::simd::Cast<DataT, float>(cx[i], 0) << ' '; - aStream << std::setw(12) << std::setfill(' ') << utils::simd::Cast<DataT, float>(cy[i], 0) << ' '; - aStream << std::setw(12) << std::setfill(' ') << utils::simd::Cast<DataT, float>(cz[i], 0); + aStream << std::setw(12) << std::setfill(' ') << kfutils::simd::Cast<DataT, float>(cx[i], 0) << ' '; + aStream << std::setw(12) << std::setfill(' ') << kfutils::simd::Cast<DataT, float>(cy[i], 0) << ' '; + aStream << std::setw(12) << std::setfill(' ') << kfutils::simd::Cast<DataT, float>(cz[i], 0); } return aStream.str(); } @@ -195,16 +196,16 @@ template<typename DataT> void FieldRegion<DataT>::CheckConsistency() const { /* Check SIMD data vectors for consistent initialization */ - utils::CheckSimdVectorEquality(cx0, "FieldRegion::cx0"); - utils::CheckSimdVectorEquality(cx1, "FieldRegion::cx1"); - utils::CheckSimdVectorEquality(cx2, "FieldRegion::cx2"); - utils::CheckSimdVectorEquality(cy0, "FieldRegion::cy0"); - utils::CheckSimdVectorEquality(cy1, "FieldRegion::cy1"); - utils::CheckSimdVectorEquality(cy2, "FieldRegion::cy2"); - utils::CheckSimdVectorEquality(cz0, "FieldRegion::cz0"); - utils::CheckSimdVectorEquality(cz1, "FieldRegion::cz1"); - utils::CheckSimdVectorEquality(cz2, "FieldRegion::cz2"); - utils::CheckSimdVectorEquality(z0, "FieldRegion::z0"); + kfutils::CheckSimdVectorEquality(cx0, "FieldRegion::cx0"); + kfutils::CheckSimdVectorEquality(cx1, "FieldRegion::cx1"); + kfutils::CheckSimdVectorEquality(cx2, "FieldRegion::cx2"); + kfutils::CheckSimdVectorEquality(cy0, "FieldRegion::cy0"); + kfutils::CheckSimdVectorEquality(cy1, "FieldRegion::cy1"); + kfutils::CheckSimdVectorEquality(cy2, "FieldRegion::cy2"); + kfutils::CheckSimdVectorEquality(cz0, "FieldRegion::cz0"); + kfutils::CheckSimdVectorEquality(cz1, "FieldRegion::cz1"); + kfutils::CheckSimdVectorEquality(cz2, "FieldRegion::cz2"); + kfutils::CheckSimdVectorEquality(z0, "FieldRegion::z0"); // TODO: Any other checks? (S.Zharko) } @@ -216,10 +217,10 @@ FieldValue<DataT> FieldRegion<DataT>::Get(const DataT& x, const DataT& y, const { FieldValue<DataT> B; if (fgForceUseOfOriginalField || fUseOriginalField) { - for (size_t i = 0; i < utils::simd::Size<DataT>(); i++) { + for (size_t i = 0; i < kfutils::simd::Size<DataT>(); i++) { auto [bx, by, bz] = - fgOdiginalField(utils::simd::Cast<DataT, double>(x, i), utils::simd::Cast<DataT, double>(y, i), - utils::simd::Cast<DataT, double>(z, i)); + fgOdiginalField(kfutils::simd::Cast<DataT, double>(x, i), kfutils::simd::Cast<DataT, double>(y, i), + kfutils::simd::Cast<DataT, double>(z, i)); B.SetSimdEntry(bx, by, bz, i); } } @@ -245,7 +246,7 @@ void FieldRegion<DataT>::Set(const FieldValue<DataT>& b0, const DataT b0z, const z0 = b0z; DataT dz1 = b1z - b0z; DataT dz2 = b2z - b0z; - DataT det = utils::simd::One<DataT>() / (dz1 * dz2 * (b2z - b1z)); + DataT det = kfutils::simd::One<DataT>() / (dz1 * dz2 * (b2z - b1z)); DataT w21 = -dz2 * det; DataT w22 = dz1 * det; @@ -279,7 +280,7 @@ void FieldRegion<DataT>::Set(const FieldValue<DataT>& b0, const DataT b0z, const fIsZeroField = (b0.IsZeroField() && b1.IsZeroField()); z0 = b0z; - DataT dzi = utils::simd::One<DataT>() / (b1z - b0z); + DataT dzi = kfutils::simd::One<DataT>() / (b1z - b0z); cx0 = b0.x; cy0 = b0.y; cz0 = b0.z; diff --git a/algo/ca/core/pars/CaField.h b/algo/ca/core/pars/CaField.h index 57290fe35fa4bbb213fadb10a85f6bfc18de702f..e511b6d2635c4b6069da5ed49c76d3216006c1fe 100644 --- a/algo/ca/core/pars/CaField.h +++ b/algo/ca/core/pars/CaField.h @@ -7,7 +7,7 @@ #include "CaConstants.h" #include "CaSimd.h" -#include "CaTrackParam.h" +#include "KfTrackParam.h" #include <boost/serialization/access.hpp> @@ -16,6 +16,7 @@ namespace cbm::algo::ca { + using cbm::algo::kf::TrackParamBase; template<typename DataT> class FieldValue { @@ -30,9 +31,9 @@ namespace cbm::algo::ca /// \brief Copy constructor with type conversion template<typename DataIn> FieldValue(const FieldValue<DataIn>& other) - : x(utils::simd::Cast<DataIn, DataT>(other.x)) - , y(utils::simd::Cast<DataIn, DataT>(other.y)) - , z(utils::simd::Cast<DataIn, DataT>(other.z)) + : x(kfutils::simd::Cast<DataIn, DataT>(other.x)) + , y(kfutils::simd::Cast<DataIn, DataT>(other.y)) + , z(kfutils::simd::Cast<DataIn, DataT>(other.z)) { } @@ -79,9 +80,9 @@ namespace cbm::algo::ca /// \param i The index at which the SIMD entries are set (ignored if DataT is not a SIMD type) [[gnu::always_inline]] inline void SetSimdEntry(double bx, double by, double bz, size_t i) { - utils::simd::SetEntry(x, bx, i); //B.x[i] = bx; - utils::simd::SetEntry(y, by, i); //B.y[i] = by; - utils::simd::SetEntry(z, bz, i); //B.z[i] = bz; + kfutils::simd::SetEntry(x, bx, i); //B.x[i] = bx; + kfutils::simd::SetEntry(y, by, i); //B.y[i] = by; + kfutils::simd::SetEntry(z, bz, i); //B.z[i] = bz; } /// Serialization function @@ -133,12 +134,12 @@ namespace cbm::algo::ca /// \brief Copy constructor with type conversion template<typename DataIn> - FieldSlice(const FieldSlice<DataIn>& other) : z(utils::simd::Cast<DataIn, DataT>(other.z)) + FieldSlice(const FieldSlice<DataIn>& other) : z(kfutils::simd::Cast<DataIn, DataT>(other.z)) { for (size_t i = 0; i < kMaxNFieldApproxCoefficients; i++) { - cx[i] = utils::simd::Cast<DataIn, DataT>(other.cx[i]); - cy[i] = utils::simd::Cast<DataIn, DataT>(other.cy[i]); - cz[i] = utils::simd::Cast<DataIn, DataT>(other.cz[i]); + cx[i] = kfutils::simd::Cast<DataIn, DataT>(other.cx[i]); + cy[i] = kfutils::simd::Cast<DataIn, DataT>(other.cy[i]); + cz[i] = kfutils::simd::Cast<DataIn, DataT>(other.cz[i]); } } @@ -194,16 +195,16 @@ namespace cbm::algo::ca /// \brief Copy constructor with type conversion template<typename DataIn> FieldRegion(const FieldRegion<DataIn>& other) - : cx0(utils::simd::Cast<DataIn, DataT>(other.cx0)) - , cx1(utils::simd::Cast<DataIn, DataT>(other.cx1)) - , cx2(utils::simd::Cast<DataIn, DataT>(other.cx2)) - , cy0(utils::simd::Cast<DataIn, DataT>(other.cy0)) - , cy1(utils::simd::Cast<DataIn, DataT>(other.cy1)) - , cy2(utils::simd::Cast<DataIn, DataT>(other.cy2)) - , cz0(utils::simd::Cast<DataIn, DataT>(other.cz0)) - , cz1(utils::simd::Cast<DataIn, DataT>(other.cz1)) - , cz2(utils::simd::Cast<DataIn, DataT>(other.cz2)) - , z0(utils::simd::Cast<DataIn, DataT>(other.z0)) + : cx0(kfutils::simd::Cast<DataIn, DataT>(other.cx0)) + , cx1(kfutils::simd::Cast<DataIn, DataT>(other.cx1)) + , cx2(kfutils::simd::Cast<DataIn, DataT>(other.cx2)) + , cy0(kfutils::simd::Cast<DataIn, DataT>(other.cy0)) + , cy1(kfutils::simd::Cast<DataIn, DataT>(other.cy1)) + , cy2(kfutils::simd::Cast<DataIn, DataT>(other.cy2)) + , cz0(kfutils::simd::Cast<DataIn, DataT>(other.cz0)) + , cz1(kfutils::simd::Cast<DataIn, DataT>(other.cz1)) + , cz2(kfutils::simd::Cast<DataIn, DataT>(other.cz2)) + , z0(kfutils::simd::Cast<DataIn, DataT>(other.z0)) , fUseOriginalField(other.fUseOriginalField) { } @@ -345,7 +346,7 @@ namespace cbm::algo::ca inline void FieldRegion<TdataA>::CopyBase(const int ia, const FieldRegion<TdataB>& Tb, const int ib) { auto copy = [&](TdataA& a, const TdataB& b) { - utils::VecCopy<TdataA, TdataB, TDoAllA, TDoAllB>::CopyEntries(a, ia, b, ib); + kfutils::VecCopy<TdataA, TdataB, TDoAllA, TDoAllB>::CopyEntries(a, ia, b, ib); }; copy(cx0, Tb.cx0); diff --git a/algo/ca/core/pars/CaInitManager.h b/algo/ca/core/pars/CaInitManager.h index 37004ef1f09bd4629751e4a74fffa53b667d8293..5a9407db6781abfff919b69a8fd83b9df2f90645 100644 --- a/algo/ca/core/pars/CaInitManager.h +++ b/algo/ca/core/pars/CaInitManager.h @@ -16,7 +16,6 @@ #include "CaParameters.h" #include "CaSimd.h" #include "CaStationInitializer.h" -#include "CaUtils.h" #include "KfParameters.h" #include "KfSetup.h" @@ -36,7 +35,16 @@ namespace cbm::algo::ca /// /// Concrete realization of this enumeration must be determined in the concrete setup class (i.e. CbmL1) enum class EDetectorID; +} // namespace cbm::algo::ca + +/// \brief Hash function definition for EDetectorID +template<> +struct std::hash<cbm::algo::ca::EDetectorID> { + int operator()(cbm::algo::ca::EDetectorID t) const { return static_cast<int>(t); } +}; +namespace cbm::algo::ca +{ /// \brief Underlying integer type for the DetectorID using DetectorID_t = std::underlying_type_t<EDetectorID>; @@ -68,7 +76,7 @@ namespace cbm::algo::ca kEnd ///< 12) [technical] number of entries in the enumeration }; - using DetectorIDIntMap_t = std::unordered_map<EDetectorID, int, utils::EnumClassHash>; + using DetectorIDIntMap_t = std::unordered_map<EDetectorID, int>; using DetectorIDSet_t = std::set<EDetectorID>; using FieldFunction_t = std::function<void(const double (&xyz)[3], double (&B)[3])>; using InitController_t = ObjectInitController<static_cast<int>(EInitKey::kEnd), EInitKey>; diff --git a/algo/ca/core/pars/CaIteration.cxx b/algo/ca/core/pars/CaIteration.cxx index 1ce9b0c2b116ccf520a3b2914d8c9581987ca812..0709ddef0e7f3510391e77389b599e559772c947 100644 --- a/algo/ca/core/pars/CaIteration.cxx +++ b/algo/ca/core/pars/CaIteration.cxx @@ -10,14 +10,13 @@ #include "CaIteration.h" #include "CaConstants.h" -#include "CaUtils.h" #include <limits> #include <sstream> +#include <string_view> using cbm::algo::ca::Iteration; using cbm::algo::ca::Vector; -using cbm::algo::ca::utils::CheckValueLimits; // --------------------------------------------------------------------------------------------------------------------- // @@ -30,23 +29,33 @@ bool Iteration::Check() const using constants::size::MaxNstations; constexpr float kMaxFloat = std::numeric_limits<float>::max(); bool res = true; + + auto CheckValueLimits = [&](std::string_view name, auto value, auto min, auto max) -> bool { + if (value > max || value < min) { + LOG(info) << "cbm::algo::ca::Iteration: parameter " << name << " = " << value << " runs out of range " << min + << ", " << max; + return false; + } + return true; + }; + // TODO: SZh 06.10.2022: These values should be tuned. At the moment the std::numeric_limits<T>::max value is used for // debug purposes. In future, these values will be strengthened. - res = CheckValueLimits<float>("track_chi2_cut", fTrackChi2Cut, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("triplet_chi2_cut", fTripletChi2Cut, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("triplet_final_chi2_cut", fTripletFinalChi2Cut, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("doublet_chi2_cut", fDoubletChi2Cut, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("pick_gather", fPickGather, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("triplet_link_chi2", fTripletLinkChi2, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("max_qp", fMaxQp, 0.001f, kMaxFloat) && res; - res = CheckValueLimits<float>("max_slope_pv", fMaxSlopePV, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("max_slope", fMaxSlope, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("max_dz", fMaxDZ, 0.f, kMaxFloat) && res; - res = CheckValueLimits<int>("min_n_hits", fMinNhits, 3, MaxNstations) && res; - res = CheckValueLimits<int>("min_n_hits_sta_0", fMinNhitsStation0, 3, MaxNstations) && res; - res = CheckValueLimits<int>("first_station_index", fFirstStationIndex, 0, MaxNstations) && res; - res = CheckValueLimits<float>("target_pos_sigma_x", fTargetPosSigmaX, 0.f, kMaxFloat) && res; - res = CheckValueLimits<float>("target_pos_sigma_y", fTargetPosSigmaY, 0.f, kMaxFloat) && res; + res = CheckValueLimits("track_chi2_cut", fTrackChi2Cut, 0.f, kMaxFloat) && res; + res = CheckValueLimits("triplet_chi2_cut", fTripletChi2Cut, 0.f, kMaxFloat) && res; + res = CheckValueLimits("triplet_final_chi2_cut", fTripletFinalChi2Cut, 0.f, kMaxFloat) && res; + res = CheckValueLimits("doublet_chi2_cut", fDoubletChi2Cut, 0.f, kMaxFloat) && res; + res = CheckValueLimits("pick_gather", fPickGather, 0.f, kMaxFloat) && res; + res = CheckValueLimits("triplet_link_chi2", fTripletLinkChi2, 0.f, kMaxFloat) && res; + res = CheckValueLimits("max_qp", fMaxQp, 0.001f, kMaxFloat) && res; + res = CheckValueLimits("max_slope_pv", fMaxSlopePV, 0.f, kMaxFloat) && res; + res = CheckValueLimits("max_slope", fMaxSlope, 0.f, kMaxFloat) && res; + res = CheckValueLimits("max_dz", fMaxDZ, 0.f, kMaxFloat) && res; + res = CheckValueLimits("min_n_hits", fMinNhits, 3, MaxNstations) && res; + res = CheckValueLimits("min_n_hits_sta_0", fMinNhitsStation0, 3, MaxNstations) && res; + res = CheckValueLimits("first_station_index", fFirstStationIndex, 0, MaxNstations) && res; + res = CheckValueLimits("target_pos_sigma_x", fTargetPosSigmaX, 0.f, kMaxFloat) && res; + res = CheckValueLimits("target_pos_sigma_y", fTargetPosSigmaY, 0.f, kMaxFloat) && res; return res; } diff --git a/algo/ca/core/pars/CaMaterialMap.h b/algo/ca/core/pars/CaMaterialMap.h index 9b95e7b31900dd7eb9bb28609fd36575b9a2730d..24f8afedbb1775cb7f00fe462c9d57804cbc3e19 100644 --- a/algo/ca/core/pars/CaMaterialMap.h +++ b/algo/ca/core/pars/CaMaterialMap.h @@ -5,7 +5,6 @@ #pragma once // include this header only once per compilation unit #include "CaSimd.h" -#include "CaUtils.h" #include <boost/serialization/vector.hpp> @@ -76,8 +75,8 @@ namespace cbm::algo::ca /// \brief Checks, if the fields are NaN bool IsNaN() const { - return utils::IsUndefined(fNbins) || utils::IsUndefined(fXYmax) || utils::IsUndefined(fFactor) - || utils::IsUndefined(fZref) || utils::IsUndefined(fZmin) || utils::IsUndefined(fZmax); + return kfutils::IsUndefined(fNbins) || kfutils::IsUndefined(fXYmax) || kfutils::IsUndefined(fFactor) + || kfutils::IsUndefined(fZref) || kfutils::IsUndefined(fZmin) || kfutils::IsUndefined(fZmax); } /// \brief Verifies class invariant consistency @@ -107,12 +106,12 @@ namespace cbm::algo::ca std::string ToString() const; private: - int fNbins = constants::Undef<int>; ///< Number of rows (== N columns) in the material budget table - float fXYmax = constants::Undef<float>; ///< Size of the station in x and y dimensions [cm] - float fFactor = constants::Undef<float>; ///< Util. var. for the conversion of point coordinates to row/column id - float fZref = constants::Undef<float>; ///< Reference Z of the collected material [cm] - float fZmin = constants::Undef<float>; ///< Minimal Z of the collected material [cm] - float fZmax = constants::Undef<float>; ///< Minimal Z of the collected material [cm] + int fNbins = kfdefs::Undef<int>; ///< Number of rows (== N columns) in the material budget table + float fXYmax = kfdefs::Undef<float>; ///< Size of the station in x and y dimensions [cm] + float fFactor = kfdefs::Undef<float>; ///< Util. var. for the conversion of point coordinates to row/column id + float fZref = kfdefs::Undef<float>; ///< Reference Z of the collected material [cm] + float fZmin = kfdefs::Undef<float>; ///< Minimal Z of the collected material [cm] + float fZmax = kfdefs::Undef<float>; ///< Minimal Z of the collected material [cm] std::vector<float> fTable{}; ///< Material budget table /// \brief Serialization function diff --git a/algo/ca/core/pars/CaParameters.cxx b/algo/ca/core/pars/CaParameters.cxx index 43db55d2ae635805f51061c5edaeead5735d334b..7b09d411bedde6ecf2112b430df5306f26c12342 100644 --- a/algo/ca/core/pars/CaParameters.cxx +++ b/algo/ca/core/pars/CaParameters.cxx @@ -17,7 +17,7 @@ using cbm::algo::ca::EDetectorID; using cbm::algo::ca::Iteration; using cbm::algo::ca::MaterialMap; using cbm::algo::ca::Parameters; -using cbm::algo::ca::utils::CheckSimdVectorEquality; +using cbm::algo::ca::kfutils::CheckSimdVectorEquality; // --------------------------------------------------------------------------------------------------------------------- // @@ -99,9 +99,9 @@ void Parameters<DataT>::CheckConsistency() const * Check target position SIMD vector */ - utils::CheckSimdVectorEquality(fTargetPos[0], "L1Parameters: target position x"); - utils::CheckSimdVectorEquality(fTargetPos[1], "L1Parameters: target position y"); - utils::CheckSimdVectorEquality(fTargetPos[2], "L1Parameters: target position z"); + kfutils::CheckSimdVectorEquality(fTargetPos[0], "L1Parameters: target position x"); + kfutils::CheckSimdVectorEquality(fTargetPos[1], "L1Parameters: target position y"); + kfutils::CheckSimdVectorEquality(fTargetPos[2], "L1Parameters: target position z"); /* * Check vertex field region and value objects at primary vertex @@ -122,11 +122,11 @@ void Parameters<DataT>::CheckConsistency() const for (int iSt = 0; iSt < fNstationsActiveTotal; ++iSt) { fStations[iSt].CheckConsistency(); - if (utils::simd::Cast<DataT, float>(fStations[iSt].fZ, 0) < utils::simd::Cast<DataT, float>(fTargetPos[2], 0)) { + if (kfutils::simd::Cast<DataT, float>(fStations[iSt].fZ, 0) < kfutils::simd::Cast<DataT, float>(fTargetPos[2], 0)) { std::stringstream msg; msg << "L1Parameters: station with global ID = " << iSt << " is placed before target " - << "(z_st = " << utils::simd::Cast<DataT, float>(fStations[iSt].fZ, 0) - << " [cm] < z_targ = " << utils::simd::Cast<DataT, float>(fTargetPos[2], 0) << " [cm])"; + << "(z_st = " << kfutils::simd::Cast<DataT, float>(fStations[iSt].fZ, 0) + << " [cm] < z_targ = " << kfutils::simd::Cast<DataT, float>(fTargetPos[2], 0) << " [cm])"; throw std::logic_error(msg.str()); } } @@ -261,16 +261,16 @@ std::string Parameters<DataT>::ToString(int verbosity, int indentLevel) const msg << indent << indentCh << indentCh << "Position:\n"; for (int dim = 0; dim < 3 /*nDimensions*/; ++dim) { msg << indent << indentCh << indentCh << indentCh << char(120 + dim) << " = " - << utils::simd::Cast<DataT, float>(fTargetPos[dim], 0) << " cm\n"; + << kfutils::simd::Cast<DataT, float>(fTargetPos[dim], 0) << " cm\n"; } msg << indent << indentCh << clrs::CLb << "FIELD:\n" << clrs::CL; msg << indent << indentCh << indentCh << "Target field:\n"; msg << indent << indentCh << indentCh << indentCh - << "Bx = " << utils::simd::Cast<DataT, float>(fVertexFieldValue.x, 0) << " Kg\n"; + << "Bx = " << kfutils::simd::Cast<DataT, float>(fVertexFieldValue.x, 0) << " Kg\n"; msg << indent << indentCh << indentCh << indentCh - << "By = " << utils::simd::Cast<DataT, float>(fVertexFieldValue.y, 0) << " Kg\n"; + << "By = " << kfutils::simd::Cast<DataT, float>(fVertexFieldValue.y, 0) << " Kg\n"; msg << indent << indentCh << indentCh << indentCh - << "Bz = " << utils::simd::Cast<DataT, float>(fVertexFieldValue.z, 0) << " Kg\n"; + << "Bz = " << kfutils::simd::Cast<DataT, float>(fVertexFieldValue.z, 0) << " Kg\n"; msg << indent << indentCh << clrs::CLb << "NUMBER OF STATIONS:\n" << clrs::CL; diff --git a/algo/ca/core/pars/CaParameters.h b/algo/ca/core/pars/CaParameters.h index 30a0496d7c9dc290b67ea4e13128aa025c6c3c23..e1be64e76404fd7e7cdb4258b958c1137f45634e 100644 --- a/algo/ca/core/pars/CaParameters.h +++ b/algo/ca/core/pars/CaParameters.h @@ -100,9 +100,9 @@ namespace cbm::algo::ca , fDevIsSuppressOverlapHitsViaMc(other.DevIsSuppressOverlapHitsViaMc()) , fDevIsParSearchWUsed(other.DevIsParSearchWUsed()) { - fTargetPos[0] = utils::simd::Cast<DataIn, DataT>(other.GetTargetPositionX()); - fTargetPos[1] = utils::simd::Cast<DataIn, DataT>(other.GetTargetPositionY()); - fTargetPos[2] = utils::simd::Cast<DataIn, DataT>(other.GetTargetPositionZ()); + fTargetPos[0] = kfutils::simd::Cast<DataIn, DataT>(other.GetTargetPositionX()); + fTargetPos[1] = kfutils::simd::Cast<DataIn, DataT>(other.GetTargetPositionY()); + fTargetPos[2] = kfutils::simd::Cast<DataIn, DataT>(other.GetTargetPositionZ()); for (size_t i = 0; i < constants::size::MaxNstations; i++) { fStations[i] = other.GetStation(i); } diff --git a/algo/ca/core/pars/CaStation.cxx b/algo/ca/core/pars/CaStation.cxx index 9092cc24b425d2e78143de7971b3b93b14bb3dd5..ce69e8ea14a5215d28d31070382303764d928d36 100644 --- a/algo/ca/core/pars/CaStation.cxx +++ b/algo/ca/core/pars/CaStation.cxx @@ -5,7 +5,6 @@ #include "CaStation.h" #include "AlgoFairloggerCompat.h" -#include "CaUtils.h" #include <iomanip> #include <sstream> @@ -40,10 +39,10 @@ void Station<DataT>::CheckConsistency() const } /// SIMD vector checks: all the words in a SIMD vector must be equal - - utils::CheckSimdVectorEquality<DataT>(fZ, "CaStation::fZ"); - utils::CheckSimdVectorEquality<DataT>(Xmax, "CaStation::Xmax"); - utils::CheckSimdVectorEquality<DataT>(Ymax, "CaStation::Ymax"); + // TODO: SZh 06.06.2024: Do we still need these checks? + kfutils::CheckSimdVectorEquality<DataT>(fZ, "CaStation::fZ"); + kfutils::CheckSimdVectorEquality<DataT>(Xmax, "CaStation::Xmax"); + kfutils::CheckSimdVectorEquality<DataT>(Ymax, "CaStation::Ymax"); /// Inner and outer radia checks: diff --git a/algo/ca/core/pars/CaStation.h b/algo/ca/core/pars/CaStation.h index a12684de92bb7a2fcb047c45588e628891a52a6d..ed3274250adec77d8b87b7f575f85f08e73b55ef 100644 --- a/algo/ca/core/pars/CaStation.h +++ b/algo/ca/core/pars/CaStation.h @@ -80,35 +80,35 @@ namespace cbm::algo::ca template<typename DataOut = DataT> DataOut GetZ() const { - return utils::simd::Cast<DataT, DataOut>(fZ); + return kfutils::simd::Cast<DataT, DataOut>(fZ); } /// \brief Gets limit of the station size in x-axis direction template<typename DataOut = DataT> DataOut GetXmax() const { - return utils::simd::Cast<DataT, DataOut>(Xmax); + return kfutils::simd::Cast<DataT, DataOut>(Xmax); } /// \brief Gets limit of the station size in x-axis direction template<typename DataOut = DataT> DataOut GetXmin() const { - return utils::simd::Cast<DataT, DataOut>(-Xmax); + return kfutils::simd::Cast<DataT, DataOut>(-Xmax); } /// \brief Gets limit of the station size in y-axis direction template<typename DataOut = DataT> DataOut GetYmax() const { - return utils::simd::Cast<DataT, DataOut>(Ymax); + return kfutils::simd::Cast<DataT, DataOut>(Ymax); } /// \brief Gets limit of the station size in y-axis direction template<typename DataOut = DataT> DataOut GetYmin() const { - return utils::simd::Cast<DataT, DataOut>(-Ymax); + return kfutils::simd::Cast<DataT, DataOut>(-Ymax); } /// \brief String representation of class contents diff --git a/algo/ca/core/tracking/CaFramework.h b/algo/ca/core/tracking/CaFramework.h index d9f10319dd327114854a9a1c56fee8ef8e9f2ca2..df31f66ea987079949cd10ead844f48003beb53f 100644 --- a/algo/ca/core/tracking/CaFramework.h +++ b/algo/ca/core/tracking/CaFramework.h @@ -20,7 +20,6 @@ #include "CaTimesliceHeader.h" #include "CaTrack.h" #include "CaTrackFinder.h" -#include "CaTrackParam.h" #include "CaTrackingMonitor.h" #include "CaTriplet.h" #include "CaVector.h" diff --git a/algo/ca/core/tracking/CaTrackExtender.cxx b/algo/ca/core/tracking/CaTrackExtender.cxx index 07b0df3fe93f95857076d6142a8fb277bed21a20..a92a5b0193576043ea313ce7420c71b3cab16e4c 100644 --- a/algo/ca/core/tracking/CaTrackExtender.cxx +++ b/algo/ca/core/tracking/CaTrackExtender.cxx @@ -12,12 +12,13 @@ #include "CaInputData.h" #include "CaTrack.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" #include "CaVector.h" +#include "KfTrackParam.h" #include <iostream> using cbm::algo::ca::Vector; // TMP!! +using cbm::algo::kf::TrackParamV; using namespace cbm::algo::ca; diff --git a/algo/ca/core/tracking/CaTrackExtender.h b/algo/ca/core/tracking/CaTrackExtender.h index 8936a86b9e212fd9747521a41a17fef1b85915cb..5368e844390f470110204d0a19f2cdceaa5a4773 100644 --- a/algo/ca/core/tracking/CaTrackExtender.h +++ b/algo/ca/core/tracking/CaTrackExtender.h @@ -13,12 +13,14 @@ #include "CaHit.h" #include "CaParameters.h" #include "CaSimd.h" -#include "CaTrackParam.h" #include "CaVector.h" #include "CaWindowData.h" +#include "KfTrackParam.h" namespace cbm::algo::ca { + using cbm::algo::kf::TrackParamV; + class Track; class Framework; class InputData; diff --git a/algo/ca/core/tracking/CaTrackFinder.h b/algo/ca/core/tracking/CaTrackFinder.h index ce3c3a942c98833f7bab26b4bc824fb1460895e3..ab707c25bb01fdc099ab753f11ba4a35ee429c43 100644 --- a/algo/ca/core/tracking/CaTrackFinder.h +++ b/algo/ca/core/tracking/CaTrackFinder.h @@ -6,16 +6,15 @@ #pragma once // include this header only once per compilation unit -#include "CaBranch.h" -#include "CaHit.h" #include "CaSimd.h" #include "CaTimesliceHeader.h" #include "CaTrackExtender.h" #include "CaTrackFinderWindow.h" #include "CaTrackFitter.h" -#include "CaTrackParam.h" #include "CaVector.h" +#include "KfTrackParam.h" +#include <vector> namespace cbm::algo::ca { diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.cxx b/algo/ca/core/tracking/CaTrackFinderWindow.cxx index 5f0d81e7d9671b59c3ce21d0c17f088ac72c0afe..6acaa5091c51db548a95d1a9733bfd06f889dd51 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.cxx +++ b/algo/ca/core/tracking/CaTrackFinderWindow.cxx @@ -27,7 +27,6 @@ #include "CaGrid.h" #include "CaGridEntry.h" #include "CaTrack.h" -#include "CaTrackParam.h" #include "CaTripletConstructor.h" #include <algorithm> diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.h b/algo/ca/core/tracking/CaTrackFinderWindow.h index e072fb8677f7963519dfd06fabfd39ce6ec68f1b..fcd2e4d2bd74a720ea0417739d446ebef42fd9ad 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.h +++ b/algo/ca/core/tracking/CaTrackFinderWindow.h @@ -16,7 +16,6 @@ #include "CaSimd.h" #include "CaTrackExtender.h" #include "CaTrackFitter.h" -#include "CaTrackParam.h" #include "CaTrackingMonitor.h" #include "CaVector.h" #include "CaWindowData.h" diff --git a/algo/ca/core/tracking/CaTrackFit.h b/algo/ca/core/tracking/CaTrackFit.h index 8105e31b2ea6e2e2c3076332e57f371ed57e5777..619eabf470fedacc8a1e18069db47c214db2224d 100644 --- a/algo/ca/core/tracking/CaTrackFit.h +++ b/algo/ca/core/tracking/CaTrackFit.h @@ -15,11 +15,12 @@ #include "CaMeasurementU.h" #include "CaMeasurementXy.h" #include "CaSimd.h" -#include "CaTrackParam.h" +#include "KfTrackParam.h" namespace cbm::algo::ca { - + using cbm::algo::kf::TrackParamBase; + using cbm::algo::kf::TrackParamV; namespace { @@ -161,8 +162,8 @@ namespace cbm::algo::ca /// extrapolate track as a line, return the extrapolated X, Y and the Jacobians void GetExtrapolatedXYline(fvec z, const ca::FieldRegion<fvec>& F, fvec& extrX, fvec& extrY, - std::array<fvec, ca::TrackParamV::kNtrackParam>& Jx, - std::array<fvec, ca::TrackParamV::kNtrackParam>& Jy) const; + std::array<fvec, TrackParamV::kNtrackParam>& Jx, + std::array<fvec, TrackParamV::kNtrackParam>& Jy) const; /// filter the track with the XY measurement placed at different Z /// \param m - measurement @@ -171,8 +172,8 @@ namespace cbm::algo::ca /// \param Jx - Jacobian of the extrapolated X /// \param Jy - Jacobian of the extrapolated Y void FilterExtrapolatedXY(const ca::MeasurementXy<fvec>& m, fvec extrX, fvec extrY, - const std::array<fvec, ca::TrackParamV::kNtrackParam>& Jx, - const std::array<fvec, ca::TrackParamV::kNtrackParam>& Jy); + const std::array<fvec, TrackParamV::kNtrackParam>& Jx, + const std::array<fvec, TrackParamV::kNtrackParam>& Jy); /// extrapolate the track to the given Z using linearization at the straight line, /// \param z_out - Z coordinate to extrapolate to diff --git a/algo/ca/core/tracking/CaTrackFitter.cxx b/algo/ca/core/tracking/CaTrackFitter.cxx index 29ca0e61dd293c77fea4d36300146c3e64a34f2f..63f401fae12ccd1707007eb780aa3db0bda5266d 100644 --- a/algo/ca/core/tracking/CaTrackFitter.cxx +++ b/algo/ca/core/tracking/CaTrackFitter.cxx @@ -6,13 +6,14 @@ #include "CaFramework.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" +#include "KfTrackParam.h" #include <iostream> #include <vector> using std::vector; using Track = cbm::algo::ca::Track; +using cbm::algo::kf::TrackParamV; using namespace cbm::algo::ca; using namespace cbm::algo; diff --git a/algo/ca/core/tracking/CaTrackFitter.h b/algo/ca/core/tracking/CaTrackFitter.h index 01bfd1e6e90438fe9f099a896ba4819304818f78..ea42265db4e0fbaa694c9d0463deae02fc96540b 100644 --- a/algo/ca/core/tracking/CaTrackFitter.h +++ b/algo/ca/core/tracking/CaTrackFitter.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2023-2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Sergei Zharko [committer], Maksym Zyzak */ @@ -13,9 +13,9 @@ #include "CaInputData.h" #include "CaParameters.h" #include "CaSimd.h" -#include "CaTrackParam.h" #include "CaVector.h" #include "CaWindowData.h" +#include "KfTrackParam.h" namespace cbm::algo::ca diff --git a/algo/ca/core/tracking/CaTripletConstructor.cxx b/algo/ca/core/tracking/CaTripletConstructor.cxx index b77b5c8af40cae8410e6c1c905c291bbfbd12583..08a39ca921813511a84ec1e2f776a3188ba1a964 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.cxx +++ b/algo/ca/core/tracking/CaTripletConstructor.cxx @@ -13,11 +13,12 @@ // #include "CaToolsDebugger.h" #include "AlgoFairloggerCompat.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" +#include "KfTrackParam.h" // using cbm::ca::tools::Debugger; using namespace cbm::algo::ca; +using cbm::algo::kf::TrackParamV; TripletConstructor::TripletConstructor(const ca::Parameters<fvec>& pars, const ca::InputData& input, WindowData& wData, const fscal mass, const ca::TrackingMode& mode) diff --git a/algo/ca/core/tracking/CaTripletConstructor.h b/algo/ca/core/tracking/CaTripletConstructor.h index a6d160681b13dffcadcd7ca87f40fffb22907d74..f5b51a14ba665f87b1ac4fc030bd59b2ef97a059 100644 --- a/algo/ca/core/tracking/CaTripletConstructor.h +++ b/algo/ca/core/tracking/CaTripletConstructor.h @@ -13,14 +13,14 @@ #include "CaGridEntry.h" #include "CaStation.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" #include "CaTriplet.h" #include "CaVector.h" #include "CaWindowData.h" +#include "KfTrackParam.h" namespace cbm::algo::ca { - + using cbm::algo::kf::TrackParamV; namespace { using namespace cbm::algo; // to keep ca:: prefices in the code diff --git a/algo/ca/core/utils/CaSimd.h b/algo/ca/core/utils/CaSimd.h index 99ac74afe1b9a93fc770cc9a19f434dd67bdabb6..2cca35b687ba36d03aee4c5390588e7fb45c6d3b 100644 --- a/algo/ca/core/utils/CaSimd.h +++ b/algo/ca/core/utils/CaSimd.h @@ -5,6 +5,7 @@ #pragma once // include this header only once per compilation unit #include "KfSimd.h" +#include "KfSimdUtils.h" namespace cbm::algo::ca { @@ -12,4 +13,8 @@ namespace cbm::algo::ca using fvec = kf::fvec; using fscal = kf::fscal; using fmask = kf::fmask; + + // Utils namespace + namespace kfutils = cbm::algo::kf::utils; + namespace kfdefs = cbm::algo::kf::defs; } // namespace cbm::algo::ca diff --git a/algo/kf/core/CMakeLists.txt b/algo/kf/core/CMakeLists.txt index 18c994e8febecbed659da8ecc40ed1f07da14084..e34fb10bac91bf9a45b5d149a070a88a2d513514 100644 --- a/algo/kf/core/CMakeLists.txt +++ b/algo/kf/core/CMakeLists.txt @@ -7,9 +7,11 @@ set(INCLUDE_DIRECTORIES set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/KfFramework.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/data/KfTrackParam.cxx ${CMAKE_CURRENT_SOURCE_DIR}/pars/KfMaterialMap.cxx ${CMAKE_CURRENT_SOURCE_DIR}/pars/KfParameters.cxx ${CMAKE_CURRENT_SOURCE_DIR}/pars/KfSetup.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/utils/KfSimdUtils.cxx ) SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS "-O3") @@ -53,11 +55,13 @@ install( FILES KfFramework.h KfDefs.h + data/KfTrackParam.h pars/KfMaterialMap.h pars/KfParameters.h pars/KfSetup.h utils/KfVector.h utils/KfSimd.h + utils/KfSimdUtils.h DESTINATION include/ ) diff --git a/algo/kf/core/KfDefs.h b/algo/kf/core/KfDefs.h index 3fafcc560ef3c766b43ca5a6531b6fc47ba0e8b1..2282b08afe145e763fff37015b5480606e7aa54a 100644 --- a/algo/kf/core/KfDefs.h +++ b/algo/kf/core/KfDefs.h @@ -9,6 +9,8 @@ #pragma once +#include "KfSimd.h" + #include <limits> namespace cbm::algo::kf::defs @@ -70,8 +72,7 @@ namespace cbm::algo::kf::defs template<> inline constexpr double Undef<double> = std::numeric_limits<double>::signaling_NaN(); - // TODO: provide SIMD - //template<> - //inline constexpr fscal Undef<fvec> = std::numeric_limits<fscal>::signaling_NaN(); + template<> + inline constexpr fscal Undef<fvec> = std::numeric_limits<fscal>::signaling_NaN(); } // namespace cbm::algo::kf::defs diff --git a/algo/ca/core/data/CaTrackParam.cxx b/algo/kf/core/data/KfTrackParam.cxx similarity index 99% rename from algo/ca/core/data/CaTrackParam.cxx rename to algo/kf/core/data/KfTrackParam.cxx index d41bf80f26256bd655fbd5f4c3b4b2f49b76a657..5ced8429766a917b7c89f9bbe1b47dad9e6bf9c8 100644 --- a/algo/ca/core/data/CaTrackParam.cxx +++ b/algo/kf/core/data/KfTrackParam.cxx @@ -2,15 +2,14 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Igor Kulakov [committer], Maksym Zyzak */ -#include "CaTrackParam.h" +#include "KfTrackParam.h" #include "AlgoFairloggerCompat.h" -#include "CaUtils.h" #include <iomanip> #include <iostream> -namespace cbm::algo::ca +namespace cbm::algo::kf { template<typename DataT> std::string TrackParamBase<DataT>::ToString(int i) const @@ -338,4 +337,4 @@ namespace cbm::algo::ca template class TrackParamBase<float>; template class TrackParamBase<double>; -} // namespace cbm::algo::ca +} // namespace cbm::algo::kf diff --git a/algo/ca/core/data/CaTrackParam.h b/algo/kf/core/data/KfTrackParam.h similarity index 98% rename from algo/ca/core/data/CaTrackParam.h rename to algo/kf/core/data/KfTrackParam.h index 1e3f859fbd204419bbfb1fd5855ec5a9061aa78b..949a49da9d5b30f496abecd2a8b43076f6ea8f00 100644 --- a/algo/ca/core/data/CaTrackParam.h +++ b/algo/kf/core/data/KfTrackParam.h @@ -11,17 +11,17 @@ #ifndef CA_CORE_CaTrackParam_h #define CA_CORE_CaTrackParam_h 1 -#include "CaConstants.h" -#include "CaSimd.h" -#include "CaUtils.h" +#include "KfDefs.h" +#include "KfSimd.h" +#include "KfSimdUtils.h" #include <boost/serialization/access.hpp> #include <string> -namespace cbm::algo::ca +namespace cbm::algo::kf { - /// \class cbm::algo::ca:: TrackParamBase + /// \class cbm::algo::kf::TrackParamBase /// \brief Class represents track parameters in the CA tracking algorithm /// /// This is a template that can be instantiated for different floating point types. @@ -750,11 +750,12 @@ namespace cbm::algo::ca inline void TrackParamBase<DataT>::InitVelocityRange(fscal minP) { // initialise the velocity range with respect to the minimal momentum minP {GeV/c} - namespace phys = constants::phys; - fscal maxVi = sqrt(1. + (phys::ProtonMassD / minP) * (phys::ProtonMassD / minP)) * phys::SpeedOfLightInvD; - fscal minVi = phys::SpeedOfLightInvD; - fscal vmean = minVi + 0.4 * (maxVi - minVi); - fscal dvi = (maxVi - vmean) / 3.; + using defs::ProtonMass; + using defs::SpeedOfLightInv; + fscal maxVi = sqrt(1. + (ProtonMass<double> / minP) * (ProtonMass<double> / minP)) * SpeedOfLightInv<double>; + fscal minVi = SpeedOfLightInv<fscal>; + fscal vmean = minVi + 0.4 * (maxVi - minVi); + fscal dvi = (maxVi - vmean) / 3.; SetVi(vmean); SetC66(dvi * dvi); } @@ -762,3 +763,4 @@ namespace cbm::algo::ca } // namespace cbm::algo::ca #endif // CA_CORE_CaTrackParam_h + diff --git a/algo/ca/core/utils/CaUtils.cxx b/algo/kf/core/utils/KfSimdUtils.cxx similarity index 97% rename from algo/ca/core/utils/CaUtils.cxx rename to algo/kf/core/utils/KfSimdUtils.cxx index 65844ebcbb0304a6651f6baf74f66fe371190186..3a94f5ffc539b25fedac1bbf857813df91a89095 100644 --- a/algo/ca/core/utils/CaUtils.cxx +++ b/algo/kf/core/utils/KfSimdUtils.cxx @@ -2,11 +2,11 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Sergey Gorbunov, Sergei Zharko [committer] */ -#include "CaUtils.h" +#include "KfSimdUtils.h" /// Namespace contains compile-time constants definition for the CA tracking algorithm /// -namespace cbm::algo::ca::utils +namespace cbm::algo::kf::utils { /// \brief Stingstream output operation for simd data template<typename DataT> @@ -39,10 +39,10 @@ namespace cbm::algo::ca::utils throw std::logic_error(msg.str()); } } -} // namespace cbm::algo::ca::utils +} // namespace cbm::algo::kf::utils - -namespace cbm::algo::ca::utils::math +// TODO: SZh 06.06.2024: Move to another source (e.g. KfMath.cxx) +namespace cbm::algo::kf::utils::math { void CholeskyFactorization(const double a[], const int n, int nn, double u[], int* nullty, int* ifault) @@ -366,4 +366,4 @@ namespace cbm::algo::ca::utils::math } // SymInv -} // namespace cbm::algo::ca::utils::math +} // namespace cbm::algo::kf::utils::math diff --git a/algo/ca/core/utils/CaUtils.h b/algo/kf/core/utils/KfSimdUtils.h similarity index 91% rename from algo/ca/core/utils/CaUtils.h rename to algo/kf/core/utils/KfSimdUtils.h index 1ebc42286bb4c91d8c70171e64ec961c340d66f6..45de4a8af2fc20ea7efaaa4b21068c9243209601 100644 --- a/algo/ca/core/utils/CaUtils.h +++ b/algo/kf/core/utils/KfSimdUtils.h @@ -9,16 +9,14 @@ #pragma once // include this header only once per compilation unit - -#include "AlgoFairloggerCompat.h" -#include "CaConstants.h" -#include "CaSimd.h" +#include "KfDefs.h" +#include "KfSimd.h" #include <sstream> /// Namespace contains compile-time constants definition for the CA tracking algorithm /// -namespace cbm::algo::ca::utils +namespace cbm::algo::kf::utils { inline fvec iif(const fmask& m, const fvec& t, const fvec& f) { return Vc::iif(m, t, f); } @@ -63,7 +61,7 @@ namespace cbm::algo::ca::utils return isnan(val).isNotEmpty(); } else { - return val == cbm::algo::ca::constants::Undef<T>; + return val == cbm::algo::kf::defs::Undef<T>; } } @@ -85,7 +83,7 @@ namespace cbm::algo::ca::utils return isfinite(val).isFull(); } else { - return val != cbm::algo::ca::constants::Undef<T>; + return val != cbm::algo::kf::defs::Undef<T>; } } @@ -158,23 +156,6 @@ namespace cbm::algo::ca::utils } }; - - /// \brief Checks, if a particular value lies within selected limits - /// \param name Name of parameters - /// \param value Value of parameter - /// \param lLimit Lower limit of parameter - /// \param uLimit Upper limit of parameter - template<typename T> - inline bool CheckValueLimits(const std::string& name, T value, T lLimit, T uLimit) - { - if (value < lLimit || value > uLimit) { - LOG(error) << "parameter\033[1;32m" << name << "\033[0m (" << value << ") runs out of range: [" << lLimit << ',' - << uLimit << ']'; - return false; - } - return true; - } - /// \struct EnumClassHash /// \brief Hash for unordered_map with enum class keys struct EnumClassHash { @@ -184,12 +165,12 @@ namespace cbm::algo::ca::utils return static_cast<int>(t); } }; -} // namespace cbm::algo::ca::utils +} // namespace cbm::algo::kf::utils /// Namespace contains compile-time constants definition for SIMD operations /// in the CA tracking algorithm /// -namespace cbm::algo::ca::utils::simd +namespace cbm::algo::kf::utils::simd { /// \brief Converts a value of type DataT to type DataOut /// \details This function is a generic template that provides a flexible way for fvec/float/double conversions @@ -319,17 +300,19 @@ namespace cbm::algo::ca::utils::simd { out[i] = in; } -} // namespace cbm::algo::ca::utils::simd +} // namespace cbm::algo::kf::utils::simd +// TODO: SZh 06.06.2024: +// There is nothing to do with SIMD in the funcitons below. Thus, we should move them into KfMath.h /// Namespace contains compile-time constants definition for SIMD operations /// in the CA tracking algorithm /// -namespace cbm::algo::ca::utils::math +namespace cbm::algo::kf::utils::math { void CholeskyFactorization(const double a[], const int n, int nn, double u[], int* nullty, int* ifault); void SymInv(const double a[], const int n, double c[], double w[], int* nullty, int* ifault); -} // namespace cbm::algo::ca::utils::math +} // namespace cbm::algo::kf::utils::math diff --git a/reco/KF/CbmKfFitTracksTask.cxx b/reco/KF/CbmKfFitTracksTask.cxx index 2f43763fa8ef09894573c04ebc8b4e0fff7fc040..75229257502dbe5d8e885d33f37a43059e27a228 100644 --- a/reco/KF/CbmKfFitTracksTask.cxx +++ b/reco/KF/CbmKfFitTracksTask.cxx @@ -108,14 +108,14 @@ void CbmKfFitTracksTask::Exec(Option_t* /*opt*/) fFitter.FitTrack(t); { const auto& parV = t.fNodes[t.fFirstHitNode].fTrack; - cbm::algo::ca::TrackParamD parD; + cbm::algo::kf::TrackParamD parD; parD.Set(parV, 0); FairTrackParam trackFirst = cbm::L1Util::ConvertTrackParam(parD); stsTrack->SetParamFirst(&trackFirst); } { const auto& parV = t.fNodes[t.fLastHitNode].fTrack; - cbm::algo::ca::TrackParamD parD; + cbm::algo::kf::TrackParamD parD; parD.Set(parV, 0); FairTrackParam trackLast = cbm::L1Util::ConvertTrackParam(parD); stsTrack->SetParamLast(&trackLast); @@ -142,14 +142,14 @@ void CbmKfFitTracksTask::Exec(Option_t* /*opt*/) fFitter.FitTrack(t); { const auto& parV = t.fNodes[t.fFirstHitNode].fTrack; - cbm::algo::ca::TrackParamD parD; + cbm::algo::kf::TrackParamD parD; parD.Set(parV, 0); FairTrackParam trackFirst = cbm::L1Util::ConvertTrackParam(parD); globalTrack->SetParamFirst(&trackFirst); } { const auto& parV = t.fNodes[t.fLastHitNode].fTrack; - cbm::algo::ca::TrackParamD parD; + cbm::algo::kf::TrackParamD parD; parD.Set(parV, 0); FairTrackParam trackLast = cbm::L1Util::ConvertTrackParam(parD); globalTrack->SetParamLast(&trackLast); diff --git a/reco/KF/CbmKfTrackFitter.cxx b/reco/KF/CbmKfTrackFitter.cxx index 83eb7960c25501448cd432c31d74165db8c26612..382ed9ccdadea3dbf898b34153788a1e658025fc 100644 --- a/reco/KF/CbmKfTrackFitter.cxx +++ b/reco/KF/CbmKfTrackFitter.cxx @@ -9,7 +9,6 @@ #include "CaSimd.h" #include "CaStation.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" #include "CbmGlobalTrack.h" #include "CbmL1.h" #include "CbmL1Util.h" @@ -31,6 +30,7 @@ #include "CbmTrdTrackingInterface.h" #include "FairRootManager.h" #include "KFParticleDatabase.h" +#include "KfTrackParam.h" #include "TClonesArray.h" #include "TDatabasePDG.h" @@ -419,7 +419,7 @@ bool CbmKfTrackFitter::CreateGlobalTrack(CbmKfTrackFitter::Track& kfTrack, const t.MakeConsistent(); - ca::TrackParamD tmp = cbm::L1Util::ConvertTrackParam(*globalTrack.GetParamFirst()); + kf::TrackParamD tmp = cbm::L1Util::ConvertTrackParam(*globalTrack.GetParamFirst()); t.fNodes[t.fFirstHitNode].fTrack.Set(tmp); t.fNodes[t.fFirstHitNode].fIsFitted = 1; @@ -587,12 +587,12 @@ bool CbmKfTrackFitter::FitTrack(CbmKfTrackFitter::Track& t) } -bool CbmKfTrackFitter::Smooth(ca::TrackParamV& t1, const ca::TrackParamV& t2) +bool CbmKfTrackFitter::Smooth(kf::TrackParamV& t1, const kf::TrackParamV& t2) { // TODO: move to the CaTrackFit class - constexpr int nPar = ca::TrackParamV::kNtrackParam; - constexpr int nCov = ca::TrackParamV::kNcovParam; + constexpr int nPar = kf::TrackParamV::kNtrackParam; + constexpr int nCov = kf::TrackParamV::kNcovParam; double r[nPar] = {t1.X()[0], t1.Y()[0], t1.Tx()[0], t1.Ty()[0], t1.Qp()[0], t1.Time()[0], t1.Vi()[0]}; double m[nPar] = {t2.X()[0], t2.Y()[0], t2.Tx()[0], t2.Ty()[0], t2.Qp()[0], t2.Time()[0], t2.Vi()[0]}; @@ -604,7 +604,7 @@ bool CbmKfTrackFitter::Smooth(ca::TrackParamV& t1, const ca::TrackParamV& t2) int nullty = 0; int ifault = 0; - cbm::algo::ca::utils::math::SymInv(S, nPar, S1, Tmp, &nullty, &ifault); + cbm::algo::kf::utils::math::SymInv(S, nPar, S1, Tmp, &nullty, &ifault); if ((0 != ifault) || (0 != nullty)) { return false; diff --git a/reco/KF/CbmKfTrackFitter.h b/reco/KF/CbmKfTrackFitter.h index 7d1a6aafe0ab5415b49d61b66b3048e4f9f94037..aa12abeed73a1b17f488ea2e8ab9e8f34dfb9c67 100644 --- a/reco/KF/CbmKfTrackFitter.h +++ b/reco/KF/CbmKfTrackFitter.h @@ -10,8 +10,8 @@ #include "CaMeasurementXy.h" #include "CaSimd.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" #include "CbmDefs.h" +#include "KfTrackParam.h" #include <vector> @@ -51,7 +51,7 @@ class CbmKfTrackFitter { double fZ{0.}; ///< Z coordinate - ca::TrackParamV fTrack{}; ///< fitted track + kf::TrackParamV fTrack{}; ///< fitted track /// == Material information (if present) // TODO: change to the material layer index when the material layer is implemented @@ -128,7 +128,7 @@ class CbmKfTrackFitter { void FilterFirstMeasurement(const FitNode& n); void AddMaterialEffects(const Track& t, FitNode& n, bool upstreamDirection); // combine two tracks - bool Smooth(ca::TrackParamV& t1, const ca::TrackParamV& t2); + bool Smooth(kf::TrackParamV& t1, const kf::TrackParamV& t2); private: // input data arrays diff --git a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx index 1bbbb3f3d27374b41b137a246efb8a3dbacfcbdc..99343d32b1d120837f3d8ae1c8789a8270ccd097 100644 --- a/reco/KF/ParticleFitter/CbmL1PFFitter.cxx +++ b/reco/KF/ParticleFitter/CbmL1PFFitter.cxx @@ -33,13 +33,14 @@ #include "CaStation.h" #include "CaToolsField.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" #include "CbmKFVertex.h" #include "FairRootManager.h" #include "KFParticleDatabase.h" +#include "KfTrackParam.h" #include "TDatabasePDG.h" using namespace cbm::algo::ca; +using cbm::algo::kf::TrackParamD; //typedef ca::TrackFit1 ca::TrackFit; diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 2d6c6d1d57d80b0a1cb4d4fdf952e0a629363fd4..f7a7627acf87b5ec53a6c16c0c576ff622117fd2 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -27,7 +27,6 @@ #include "CaInitManager.h" #include "CaMaterialMonitor.h" #include "CaMonitor.h" -#include "CaTrackParam.h" #include "CaVector.h" #include "CbmCaMCModule.h" #include "CbmCaTimeSliceReader.h" @@ -39,6 +38,7 @@ #include "FairDetector.h" #include "FairRootManager.h" #include "FairTask.h" +#include "KfTrackParam.h" #include "TClonesArray.h" #include "TH1.h" @@ -363,7 +363,7 @@ class CbmL1 : public FairTask { /// \note Should be called only after CbmL1::Performance() void TrackFitPerformance(); - void FillFitHistos(cbm::algo::ca::TrackParamV& tr, const cbm::ca::tools::MCPoint& mc, bool isTimeFitted, TH1F* h[]); + void FillFitHistos(cbm::algo::kf::TrackParamV& tr, const cbm::ca::tools::MCPoint& mc, bool isTimeFitted, TH1F* h[]); /// Fills performance histograms void HistoPerformance(); diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 66be5f0a40d0c4df394115e6b1e1e7dc42c2dc58..00957dc9b692b8076914c59c0fdf3abb5db6c190 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -22,7 +22,6 @@ #include "CaFramework.h" #include "CaToolsDebugger.h" #include "CaTrackFit.h" -#include "CaTrackParam.h" #include "CbmL1.h" #include "CbmL1Constants.h" #include "CbmL1Counters.h" @@ -42,6 +41,7 @@ #include "FairField.h" #include "FairRunAna.h" #include "FairTrackParam.h" // for vertex pulls +#include "KfTrackParam.h" #include "TFile.h" #include "TH1.h" #include "TH2.h" @@ -59,6 +59,7 @@ using namespace cbm::algo::ca; +using cbm::algo::kf::TrackParamV; using cbm::ca::tools::Debugger; using std::map; using std::vector; diff --git a/reco/L1/CbmL1Track.h b/reco/L1/CbmL1Track.h index a89093b129a2e0cac2adb3b48ed210ef035ad0c2..0dc596ab464f02b63ae4edd992bc0cec98f8fe70 100644 --- a/reco/L1/CbmL1Track.h +++ b/reco/L1/CbmL1Track.h @@ -18,14 +18,15 @@ *==================================================================== */ +// TODO: SZh 06.06.2024: Rework this class (inherit the new CbmTrack class with additional functionality) #ifndef CbmL1Track_H #define CbmL1Track_H -#include "CaTrackParam.h" #include "CaVector.h" #include "CbmL1Constants.h" #include "CbmL1MCTrack.h" +#include "KfTrackParam.h" #include "TMath.h" #include <iterator> @@ -38,9 +39,10 @@ namespace namespace ca = cbm::algo::ca; } + class CbmL1MCTrack; -class CbmL1Track : public cbm::algo::ca::TrackParamD { +class CbmL1Track : public cbm::algo::kf::TrackParamD { public: CbmL1Track() = default; @@ -99,8 +101,8 @@ class CbmL1Track : public cbm::algo::ca::TrackParamD { /// @param header If true, header will be printed std::string ToString(int verbose = 10, bool header = false) const; - cbm::algo::ca::TrackParamD Tpv; ///< Track parameters at primary vertex - cbm::algo::ca::TrackParamD TLast; ///< Track parameters in the end of the track + cbm::algo::kf::TrackParamD Tpv; ///< Track parameters at primary vertex + cbm::algo::kf::TrackParamD TLast; ///< Track parameters in the end of the track std::vector<int> Hits; ///< Indexes of hits of this track int nStations{0}; ///< Number of stations with hits of this track diff --git a/reco/L1/CbmL1Util.cxx b/reco/L1/CbmL1Util.cxx index cb89a9b347550b4a5bde41228c1adbbe72e05080..b1fe7b81e137f9ed7eefd54c393fdbd499af1c8a 100644 --- a/reco/L1/CbmL1Util.cxx +++ b/reco/L1/CbmL1Util.cxx @@ -8,9 +8,9 @@ namespace cbm::L1Util { - cbm::algo::ca::TrackParamD ConvertTrackParam(const FairTrackParam& par) + cbm::algo::kf::TrackParamD ConvertTrackParam(const FairTrackParam& par) { - cbm::algo::ca::TrackParamD t; + cbm::algo::kf::TrackParamD t; t.X() = par.GetX(); t.Y() = par.GetY(); t.Tx() = par.GetTx(); @@ -39,7 +39,7 @@ namespace cbm::L1Util return t; } - FairTrackParam ConvertTrackParam(const cbm::algo::ca::TrackParamD& t) + FairTrackParam ConvertTrackParam(const cbm::algo::kf::TrackParamD& t) { FairTrackParam par; par.SetX(t.GetX()); diff --git a/reco/L1/CbmL1Util.h b/reco/L1/CbmL1Util.h index 4e8568dc9237bd63b599ee7ec29780fbe724aced..b0ae43cf87810c2138618453ed772eb586951a04 100644 --- a/reco/L1/CbmL1Util.h +++ b/reco/L1/CbmL1Util.h @@ -5,7 +5,6 @@ #ifndef CbmL1Util_H #define CbmL1Util_H 1 -#include "CaTrackParam.h" #include "CbmDefs.h" #include "CbmL1DetectorID.h" #include "CbmMuchTrackingInterface.h" @@ -13,6 +12,7 @@ #include "CbmStsTrackingInterface.h" #include "CbmTofTrackingInterface.h" #include "CbmTrdTrackingInterface.h" +#include "KfTrackParam.h" #include "Rtypes.h" class FairTrackParam; @@ -24,10 +24,10 @@ namespace cbm::L1Util { /// copy fair track param to Ca track param - cbm::algo::ca::TrackParamD ConvertTrackParam(const FairTrackParam& par); + cbm::algo::kf::TrackParamD ConvertTrackParam(const FairTrackParam& par); /// copy Ca track param to fair track param - FairTrackParam ConvertTrackParam(const cbm::algo::ca::TrackParamD& t); + FairTrackParam ConvertTrackParam(const cbm::algo::kf::TrackParamD& t); /// convert Ca detector Id to Cbm detector Id inline ECbmModuleId ConvertDetSystemId(const cbm::algo::ca::EDetectorID caDetId) diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h index a7e63f75c05d6115ba5b84cbfa3c8b9806152ad8..28fd09425929955adab09eca0611a2864ffcb481 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.h @@ -14,8 +14,8 @@ const int NStations = 0; #endif // BUILD_HISTO_FOR_EACH_STANTION -#include "CaTrackParam.h" #include "CbmL1.h" +#include "KfTrackParam.h" #include "TCanvas.h" #include "TF1.h" #include "TStyle.h" @@ -33,7 +33,7 @@ struct TL1TrackParameters { TL1TrackParameters(){}; - TL1TrackParameters(cbm::algo::ca::TrackParamV& T, int i) + TL1TrackParameters(cbm::algo::kf::TrackParamV& T, int i) : x(T.GetX()[i]) , y(T.GetY()[i]) , tx(T.GetTx()[i]) @@ -98,7 +98,7 @@ class L1AlgoPulls { void Init(); // void AddVec(TrackParamV& T, ca::HitIndex_t ih); - void AddOne(cbm::algo::ca::TrackParamV& T, int i, ca::HitIndex_t ih); + void AddOne(cbm::algo::kf::TrackParamV& T, int i, ca::HitIndex_t ih); std::string ToString() const; // fast method to see pulls :) void Build(bool draw = 1); diff --git a/reco/L1/qa/CbmCaTrackFitQa.cxx b/reco/L1/qa/CbmCaTrackFitQa.cxx index 11649c1bd13a96f6ad2056f4b8d91214c9a88083..d50786a97e6580b469d95d034a1b89618b593f4c 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.cxx +++ b/reco/L1/qa/CbmCaTrackFitQa.cxx @@ -25,6 +25,7 @@ #include <algorithm> using namespace cbm::algo::ca; +using cbm::algo::kf::TrackParamD; // ******************************************************* // ** Implementation of cbm::ca::TrackFitQa functions ** diff --git a/reco/L1/qa/CbmCaTrackFitQa.h b/reco/L1/qa/CbmCaTrackFitQa.h index 2e8eee53e94933d7f2c3812e0be6dd7820f642a3..4978b98d892fd8ade8ce0f4088a9074409d0f0de 100644 --- a/reco/L1/qa/CbmCaTrackFitQa.h +++ b/reco/L1/qa/CbmCaTrackFitQa.h @@ -13,9 +13,9 @@ #include "CaConstants.h" #include "CaEnumArray.h" #include "CaField.h" -#include "CaTrackParam.h" #include "CbmL1DetectorID.h" #include "CbmQaIO.h" +#include "KfTrackParam.h" #include <array> @@ -98,7 +98,7 @@ namespace cbm::ca /// @note To be called in the loop over reconstructed tracks full sample /// @param iTrkReco Index of reconstructed track /// @param weight Weight - void Fill(const cbm::algo::ca::TrackParamV& trPar, const tools::MCPoint& mcPoint, bool bTimeMeasured, + void Fill(const cbm::algo::kf::TrackParamV& trPar, const tools::MCPoint& mcPoint, bool bTimeMeasured, double weight = 1); /// @brief Sets particle mass, used for fitting a track diff --git a/reco/detectors/rich/finder/CbmL1RichENNRingFinderParallel.cxx b/reco/detectors/rich/finder/CbmL1RichENNRingFinderParallel.cxx index 1a0d3dac3f48cc54671a93cf028cc1c3c23708ec..83446dbf3246fa980d3c5054e4e5e04adc254758 100644 --- a/reco/detectors/rich/finder/CbmL1RichENNRingFinderParallel.cxx +++ b/reco/detectors/rich/finder/CbmL1RichENNRingFinderParallel.cxx @@ -26,19 +26,16 @@ #include "CbmEvent.h" #include "CbmRichHit.h" #include "CbmRichRing.h" - +#include "KfSimdUtils.h" #include "TClonesArray.h" #include "TStopwatch.h" +#include "assert.h" #include <algorithm> +#include <cmath> #include <iostream> #include <vector> -#include <cmath> - -#include "CaUtils.h" -#include "assert.h" - using std::cout; using std::endl; using std::fabs; @@ -47,6 +44,7 @@ using std::sqrt; using std::vector; namespace ca = cbm::algo::ca; +namespace kf = cbm::algo::kf; CbmL1RichENNRingFinderParallel::CbmL1RichENNRingFinderParallel(Int_t /*verbose*/) : fRecoTime(0), fNEvents(0) { @@ -345,7 +343,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, cbm::algo::c sHit.lr2 = sHit.S0 + sHit.S1; // if(( sHit.lr2 > AreaSize2 ) || ( j == i )) continue; // no difference in speed if (sHit.lr2[i_4] > AreaSize2) continue; - if (ca::utils::IsUnlikely(j == i_main)) continue; + if (kf::utils::IsUnlikely(j == i_main)) continue; if (sHit.quality[i_4] >= SearchHitMaxQuality) { // CHECKME do we really need PickUpArea PickUpArea[static_cast<int>(PickUpAreaSize[i_4]++)].CopyHit(HitsV[j_V], j_4, i_4); @@ -508,7 +506,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, cbm::algo::c #ifdef PRINT_TIMING GetTimer("Ring finding: Store ring").Start(0); #endif // PRINT_TIMING - if (ca::utils::IsUnlikely(validRing.isEmpty())) continue; + if (kf::utils::IsUnlikely(validRing.isEmpty())) continue; /////////// #if 0 // TODO 1 @@ -590,7 +588,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, cbm::algo::c for (size_t i_4 = 0; (i_4 < fvec::size()); i_4++) { // if( NRingHits < MinRingHits || R2 > R2Max || R2 < R2Min ) continue; - if (/*ca::utils::IsUnlikely*/ (!validRing[i_4])) continue; + if (/*kf::utils::IsUnlikely*/ (!validRing[i_4])) continue; ENNRing voidRing; Rings.push_back(voidRing); @@ -610,7 +608,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, cbm::algo::c const float dx = sHit.x[i_4] - ring.x; const float dy = sHit.y[i_4] - ring.y; const float d = fabs(sqrt(dx * dx + dy * dy) - R[i_4]); - if (ca::utils::IsUnlikely(d <= HitSize)) { + if (kf::utils::IsUnlikely(d <= HitSize)) { ring.chi2 += d * d; ring.localIHits.push_back(int(sHit.localIndex[i_4])); ring.NHits++; @@ -622,14 +620,14 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, cbm::algo::c const float dx = puHit.x[i_4] - ring.x; const float dy = puHit.y[i_4] - ring.y; const float d = fabs(sqrt(dx * dx + dy * dy) - ring.r); - if (ca::utils::IsUnlikely(d <= HitSize)) { + if (kf::utils::IsUnlikely(d <= HitSize)) { ring.chi2 += d * d; ring.localIHits.push_back(static_cast<THitIndex>(puHit.localIndex[i_4])); ring.NHits++; if (d <= ShadowSize) Shadow.push_back(static_cast<THitIndex>(puHit.localIndex[i_4])); } } - if (ca::utils::IsUnlikely(ring.NHits < MinRingHits)) { + if (kf::utils::IsUnlikely(ring.NHits < MinRingHits)) { Rings.pop_back(); continue; } diff --git a/reco/littrack/parallel/CMakeLists.txt b/reco/littrack/parallel/CMakeLists.txt index 0ea8149dc1407d43579400e9d726bd768fd21d43..bb33d371fb7cadac48c037b1594c4c453ba68899 100644 --- a/reco/littrack/parallel/CMakeLists.txt +++ b/reco/littrack/parallel/CMakeLists.txt @@ -2,8 +2,6 @@ set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} - ${CBMROOT_SOURCE_DIR}/algo/kf/core/utils # For SIMD (TODO: Should be re-worked) - ${CBMROOT_SOURCE_DIR}/algo/ca/core/utils # For SIMD (TODO: Should be re-worked) ) @@ -29,7 +27,7 @@ set(SRCS ${LITTRACKPARALLEL_SRCS}) # Since there was a problem with defining Vc::Vc as a dependecy a dependency # to KFParticle was set which includes the Vc dependency # This has to be fixed and done properly -set(PUBLIC_DEPENDENCIES Vc::Vc) +set(PUBLIC_DEPENDENCIES Vc::Vc KfCore) set(LIBRARY_NAME Littrackparallel) generate_cbm_library() diff --git a/reco/littrack/parallel/LitTypes.h b/reco/littrack/parallel/LitTypes.h index b9dee3e6b69812a2939c60932159e70a9f0c5529..5324c59f1e15f71a1cc48c536e5825e4b6628999 100644 --- a/reco/littrack/parallel/LitTypes.h +++ b/reco/littrack/parallel/LitTypes.h @@ -12,9 +12,9 @@ #ifndef LITTYPES_H_ #define LITTYPES_H_ -#include "CaSimd.h" +#include "KfSimd.h" -using cbm::algo::ca::fscal; -using cbm::algo::ca::fvec; +using cbm::algo::kf::fscal; +using cbm::algo::kf::fvec; #endif /* LITTYPES_H_ */