diff --git a/algo/ca/core/pars/CaDefs.h b/algo/ca/core/pars/CaDefs.h index 43507f8cfaf94e169419f52b6e809f93786090a0..99e4c1cdd8a8531bb115fd68db497483d74eb8e6 100644 --- a/algo/ca/core/pars/CaDefs.h +++ b/algo/ca/core/pars/CaDefs.h @@ -17,8 +17,6 @@ namespace cbm::algo::ca { - using KfFramework_t = cbm::algo::kf::Framework<fvec>; - using cbm::algo::kf::TrackParamBase; using cbm::algo::kf::TrackParamV; } // namespace cbm::algo::ca diff --git a/algo/ca/core/pars/CaInitManager.cxx b/algo/ca/core/pars/CaInitManager.cxx index 03058f25ec211457fe2152c454cfb7f364cb24d9..067c91d0c8e826f505d91f2fbabb42b7db6cea9e 100644 --- a/algo/ca/core/pars/CaInitManager.cxx +++ b/algo/ca/core/pars/CaInitManager.cxx @@ -508,14 +508,6 @@ void InitManager::SetTargetPosition(double x, double y, double z) // Parameters<fvec>&& InitManager::TakeParameters() { return std::move(fParameters); } -// ---------------------------------------------------------------------------------------------------------------------- -// -KfParameters_t&& InitManager::TakeKfParameters() { return std::move(fKfParameters); } - -// ---------------------------------------------------------------------------------------------------------------------- -// -KfSetup_t&& InitManager::TakeKfSetup() { return std::move(fKfSetup); } - // ---------------------------------------------------------------------------------------------------------------------- // void InitManager::WriteParametersObject(const std::string& fileName) const diff --git a/algo/ca/core/pars/CaInitManager.h b/algo/ca/core/pars/CaInitManager.h index 202ded2fbc59d884e95acfb4063391c1f4354530..0e555c33742ccd94307b80169f8fa7622a2a1af5 100644 --- a/algo/ca/core/pars/CaInitManager.h +++ b/algo/ca/core/pars/CaInitManager.h @@ -16,8 +16,6 @@ #include "CaParameters.h" #include "CaSimd.h" #include "CaStationInitializer.h" -#include "KfParameters.h" -#include "KfSetup.h" #include <array> #include <bitset> @@ -259,18 +257,12 @@ namespace cbm::algo::ca /// \brief Sets default fitter mass /// \param mass Particle mass [GeV/c2] - void SetDefaultMass(double mass) { fKfParameters.SetDefaultMass(mass); } + void SetDefaultMass(double mass) { fParameters.fDefaultMass = mass; } /// \brief Takes parameters object from the init-manager instance /// \return A parameter object Parameters<fvec>&& TakeParameters(); - /// \brief Takes KF parameters object - KfParameters_t&& TakeKfParameters(); - - /// \brief Takes KF setup object - KfSetup_t&& TakeKfSetup(); - /// \brief Writes parameters object from boost-serialized binary file /// \param fileName Name of input file void WriteParametersObject(const std::string& fileName) const; @@ -334,8 +326,6 @@ namespace cbm::algo::ca int fCAIterationsNumberCrosscheck{-1}; ///< Number of iterations to be passed (must be used for cross-checks) Parameters<fvec> fParameters{}; ///< CA parameters object - KfParameters_t fKfParameters{}; ///< Kf-parameters object - KfSetup_t fKfSetup{}; ///< Kf setup object // TODO: With a separate KF-framework instance we need to figure it out, how to store and read the corresponding // parameters (essential for the online reconstruction!!!) diff --git a/algo/ca/core/tracking/CaFramework.cxx b/algo/ca/core/tracking/CaFramework.cxx index dba8546f4da58c865adaf77681d05bb1c464a8e4..1366844f5ec0da1ee78d3434cac338716b12bc95 100644 --- a/algo/ca/core/tracking/CaFramework.cxx +++ b/algo/ca/core/tracking/CaFramework.cxx @@ -18,14 +18,12 @@ using namespace cbm::algo::ca; namespace { - using namespace cbm::algo; // to keep ca:: prefices in the code + using namespace cbm::algo; // to keep ca:: prefixes in the code } using cbm::algo::ca::ECounter; // monitor counter key type using cbm::algo::ca::EDetectorID; using cbm::algo::ca::ETimer; // monitor timer key type -using cbm::algo::ca::KfFramework_t; -using cbm::algo::ca::KfParameters_t; using cbm::algo::ca::Track; using constants::phys::ProtonMassD; using constants::phys::SpeedOfLightInv; @@ -66,15 +64,6 @@ void Framework::ReceiveParameters(Parameters<fvec>&& parameters) ca::FieldRegion<fvec>::ForceUseOfOriginalField(fParameters.DevIsUseOfOriginalField()); } -// --------------------------------------------------------------------------------------------------------------------- -// - -void Framework::ReceiveKfSettings(KfParameters_t&& pars, KfSetup_t&& setup) -{ - fKf.Pars() = std::move(pars); - fKf.Setup() = std::move(setup); -} - // --------------------------------------------------------------------------------------------------------------------- // int Framework::GetMcTrackIdForCaHit(int /*iHit*/) diff --git a/algo/ca/core/tracking/CaFramework.h b/algo/ca/core/tracking/CaFramework.h index 677f0a74692fd71c4255f236b463c22328b4d96d..7d88a504496e5f0cb7ba90bd0e38dc9347dd7e5f 100644 --- a/algo/ca/core/tracking/CaFramework.h +++ b/algo/ca/core/tracking/CaFramework.h @@ -95,11 +95,6 @@ namespace cbm::algo::ca /// Receives tracking parameters void ReceiveParameters(Parameters<fvec>&& parameters); - /// \brief Receives KF-framework parameters and setup - /// \param pars KF parameters object - /// \param setup KF setup object - void ReceiveKfSettings(KfParameters_t&& pars, KfSetup_t&& setup); - /// Gets pointer to input data object for external access const InputData& GetInputData() const { return fInputData; } @@ -174,15 +169,7 @@ namespace cbm::algo::ca /// \brief Gets number of threads int GetNofThreads() const { return fNofThreads; } - /// \brief Accesses KF framework instance - KfFramework_t& Kf() { return fKf; } - - /// \brief Accesses KF framework instance (immutable) - const KfFramework_t& Kf() const { return fKf; } - private: - KfFramework_t fKf; ///< KF framework instance - int fNstationsBeforePipe{0}; ///< number of stations before pipe (MVD stations in CBM) fscal fDefaultMass{constants::phys::MuonMass}; ///< mass of the propagated particle [GeV/c2] TimesliceHeader fTsHeader; ///< current timeslice header diff --git a/algo/kf/core/CMakeLists.txt b/algo/kf/core/CMakeLists.txt index 40e4d5bb05dccfebffe0c2d343823180ef086edf..9247f6cf8c976e8da792e8ba2f333e5cb081e242 100644 --- a/algo/kf/core/CMakeLists.txt +++ b/algo/kf/core/CMakeLists.txt @@ -17,7 +17,6 @@ set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/geo/KfFieldSlice.cxx ${CMAKE_CURRENT_SOURCE_DIR}/geo/KfFieldRegion.cxx ${CMAKE_CURRENT_SOURCE_DIR}/geo/KfSetup.cxx - ${CMAKE_CURRENT_SOURCE_DIR}/pars/KfParameters.cxx ${CMAKE_CURRENT_SOURCE_DIR}/utils/KfUtils.cxx ) @@ -75,12 +74,13 @@ install( geo/KfSetup.h geo/KfTarget.h geo/KfField.h - pars/KfParameters.h + pars/KfParticlePDG.h utils/KfVector.h utils/KfSimd.h utils/KfSimdVc.h utils/KfSimdPseudo.h utils/KfUtils.h + utils/KfMath.h DESTINATION include/ ) diff --git a/algo/kf/core/KfFramework.h b/algo/kf/core/KfFramework.h index 2d1c39f1bbae165de9a7b71b061f9cc09838bac2..2e6c647a89a47aede2dcb8177fe24536f2ed170f 100644 --- a/algo/kf/core/KfFramework.h +++ b/algo/kf/core/KfFramework.h @@ -10,7 +10,6 @@ #pragma once #include "KfDefs.h" -#include "KfParameters.h" #include "KfSetup.h" namespace cbm::algo::kf @@ -39,12 +38,6 @@ namespace cbm::algo::kf /// \brief Move assignment operator Framework& operator=(Framework&&) = delete; - /// \brief Parameters access - kf::Parameters<T>& Pars() { return fPars; } - - /// \brief Parameters access - const kf::Parameters<T>& Pars() const { return fPars; } - /// \brief Setup access (mutable) kf::Setup<T>& Setup() { return fSetup; } @@ -52,8 +45,6 @@ namespace cbm::algo::kf const kf::Setup<T>& Setup() const { return fSetup; } private: - kf::Parameters<T> fPars; ///< KF parameters - kf::Setup<T> fSetup; ///< KF setup - bool fbInitialized = false; ///< Initialization status + kf::Setup<T> fSetup; ///< KF setup }; } // namespace cbm::algo::kf diff --git a/algo/kf/core/pars/KfParameters.cxx b/algo/kf/core/pars/KfParameters.cxx deleted file mode 100644 index 6f82792172baff9852b6d0bda3bc2372e117ca38..0000000000000000000000000000000000000000 --- a/algo/kf/core/pars/KfParameters.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergei Zharko [committer] */ - -/// @file KfParameters.cxx -/// @brief Parameters representation for the Kalman-filter framework (source) -/// @since 28.03.2024 -/// @author Sergei Zharko <s.zharko@gsi.de> - -#include "KfParameters.h" - -#include <sstream> - -using cbm::algo::kf::Parameters; - - -// --------------------------------------------------------------------------------------------------------------------- -// -template<typename T> -std::string Parameters<T>::ToString(int verbosity, int indentLevel) const -{ - std::stringstream msg; - - if (verbosity > 0) { - constexpr char indentCh = '\t'; - std::string indent(indentLevel, indentCh); - msg << indent << " ----- KF Parameters list ----- \n"; - msg << indent << "RUNTIME CONSTANTS:\n"; - msg << indent << indentCh << "Default particle mass: " << fDefaultMass << " [GeV/c2] \n"; - } - - return msg.str(); -} - - -namespace cbm::algo::kf -{ - template class Parameters<float>; - template class Parameters<double>; - template class Parameters<fvec>; -} // namespace cbm::algo::kf diff --git a/algo/kf/core/pars/KfParameters.h b/algo/kf/core/pars/KfParameters.h deleted file mode 100644 index b8815e0cb4380cdc784dd6aaeb8e4b6a6f2e31c5..0000000000000000000000000000000000000000 --- a/algo/kf/core/pars/KfParameters.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Sergei Zharko [committer] */ - -/// @file KfParameters.cxx -/// @brief Parameter set for the Kalman-filter framework (header) -/// @since 28.03.2024 -/// @author Sergei Zharko <s.zharko@gsi.de> - -#pragma once - -#include "KfDefs.h" -#include "KfUtils.h" - -#include <boost/serialization/access.hpp> - -#include <string> - -#include <yaml-cpp/yaml.h> - -namespace cbm::algo::kf -{ - /// \class Parameters - /// \brief Parameter set of the Kalman-filter framework - /// \tparam T Underlying floating-point type - template<typename T> - class Parameters { - template<typename I> - friend class Parameters; - - public: - using Real_t = T; - - /// \brief Default constructor - Parameters() = default; - - /// \brief Copy constructor - /// \tparam I Underlying floating-point type of the source - template<typename I> - Parameters(const Parameters<I>& other) : fDefaultMass(utils::simd::Cast<I, T>(other.fDefaultMass)) - { - } - - /// \brief Destructor - ~Parameters() = default; - - /// \brief Copy assignment operator - /// \tparam I Underlying floating-point type of the source - template<typename I> - Parameters& operator=(const Parameters<I>& other) - { - if constexpr (std::is_same_v<I, T>) { - if (this == &other) { - return *this; - } - } - fDefaultMass = utils::simd::Cast<I, T>(other.fDefaultMass); - } - - /// \brief Gets default mass - const T GetDefaultMass() const { return fDefaultMass; } - - /// \brief Sets default mass - void SetDefaultMass(T mass) { fDefaultMass = mass; } - - /// \brief String representation of the contents - /// \param verbosity A verbose level for output - /// \param indentLevel Indent level of the string output - std::string ToString(int verbosity = 0, int indentLevel = 0) const; - - private: - /// \brief Serialization method - friend class boost::serialization::access; - template<class Archive> - void serialize(Archive& ar, const unsigned int /*version*/) - { - ar& fDefaultMass; - } - - T fDefaultMass = defs::PionMass<T>; ///< Default particle mass [GeV/c2] - }; - -} // namespace cbm::algo::kf diff --git a/algo/kf/core/pars/KfParticlePDG.h b/algo/kf/core/pars/KfParticlePDG.h new file mode 100644 index 0000000000000000000000000000000000000000..ec6dd01791c72a1dff356232c039a07fa4ac8466 --- /dev/null +++ b/algo/kf/core/pars/KfParticlePDG.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergei Zharko [committer] */ + +/// @file KfParticlePDG.h +/// @brief Track particle representation in the KF-core +/// @since 27.08.2024 +/// @author Sergei Zharko <s.zharko@gsi.de> + +#pragma once + +#include "KfDefs.h" + +namespace cbm::algo::kf +{ + /// \class ParticlePDG + /// \brief Properties of a tracked particle + class alignas(VcMemAlign) ParticlePDG { + /// \brief Constructor from parameters + /// \param pid PID code (note: abs value is only accounted) + /// \param mass Particle mass [GeV/c2] + /// \param bremsstr If bremsstrahlung should be accounted (i.e. if particle an electron) + constexpr ParticlePDG(int pid, double mass, bool bremsstr) : fMass(mass), fPid(pid), fbBremsstrahlung(bremsstr) {} + + /// \brief Default constructor + ParticlePDG() = delete; + + /// \brief Gets particle mass [GeV/c2] + constexpr double GetMass() const { return fMass; } + + /// \brief Gets squared particle mass [(GeV/c2)2] + constexpr double GetMassSq() const { return fMass * fMass; } + + /// \brief Gets particle PID (NOTE: absolute value is used) + constexpr int GetPid() const { return fPid; } + + /// \brief Gets bremsstrahlung flag + constexpr bool IfBremsstrahlung() const { return fbBremsstrahlung; } + + private: + double fMass{}; ///< Particle mass [GeV/c2] + int fPid{}; ///< Particle encoding according to PDG + bool fbBremsstrahlung{false}; ///< Is Bremsstrahlung should be taken into account in E-loss estimation + }; + + // Predefined particle definitions + namespace particle + { + constexpr auto Electron = ParticlePDG(11, defs::ElectronMass<double>, true); + constexpr auto Muon = ParticlePDG(13, defs::MuonMass<double>, false); + constexpr auto Pion = ParticlePDG(211, defs::PionMass<double>, false); + constexpr auto Kaon = ParticlePDG(321, defs::KaonMass<double>, false); + constexpr auto Proton = ParticlePDG(2212, defs::ProtonMass<double>, false); + } // namespace particle + +} // namespace cbm::algo::kf diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 0158fd1f3c7ab8aff91c125fab299b8c5505970d..203dd07412599892a7f7a4afd1f02c360013a029 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -544,7 +544,6 @@ try { auto parameters = fInitManager.TakeParameters(); fpParameters = std::make_shared<ca::Parameters<ca::fvec>>(parameters); fpAlgo->ReceiveParameters(std::move(parameters)); - fpAlgo->ReceiveKfSettings(fInitManager.TakeKfParameters(), fInitManager.TakeKfSetup()); } fpAlgo->Init(fTrackingMode);