From e6219910eddd4629583c41d42d0d66d9f09493ae Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Wed, 28 Aug 2024 16:14:50 +0200 Subject: [PATCH] CbmKf library introduction --- algo/kf/core/geo/KfSetup.h | 7 +-- reco/CMakeLists.txt | 1 + reco/kf/CMakeLists.txt | 73 +++++++++++++++++++++++++++++++ reco/kf/CbmKfSetupInitializer.cxx | 16 +++++++ reco/kf/CbmKfSetupInitializer.h | 64 +++++++++++++++++++++++++++ reco/kf/README.md | 20 +++++++++ 6 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 reco/kf/CMakeLists.txt create mode 100644 reco/kf/CbmKfSetupInitializer.cxx create mode 100644 reco/kf/CbmKfSetupInitializer.h create mode 100644 reco/kf/README.md diff --git a/algo/kf/core/geo/KfSetup.h b/algo/kf/core/geo/KfSetup.h index 2efe22422a..fc26c6ac48 100644 --- a/algo/kf/core/geo/KfSetup.h +++ b/algo/kf/core/geo/KfSetup.h @@ -229,9 +229,10 @@ namespace cbm::algo::kf Target<double> fTarget; ///< Field to keep target properties }; - // - // Template method definition - // + + // ******************************** + // ** Template method definition ** + // ******************************** // ------------------------------------------------------------------------------------------------------------------- // diff --git a/reco/CMakeLists.txt b/reco/CMakeLists.txt index a15721ac5d..20e15f4e33 100644 --- a/reco/CMakeLists.txt +++ b/reco/CMakeLists.txt @@ -11,6 +11,7 @@ add_subdirectory(calibration) add_subdirectory(detectors) add_subdirectory(eventbuilder) add_subdirectory(global) +add_subdirectory(kf) add_subdirectory(KF) add_subdirectory(L1) add_subdirectory(littrack) diff --git a/reco/kf/CMakeLists.txt b/reco/kf/CMakeLists.txt new file mode 100644 index 0000000000..9a0ce4fe85 --- /dev/null +++ b/reco/kf/CMakeLists.txt @@ -0,0 +1,73 @@ +set(INCLUDE_DIRECTORIES + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set(SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/CbmKfSetupInitializer.cxx +) + +SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS "-O3") + + +If(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + ADD_DEFINITIONS(-Wall -Wextra -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root. +Else() + ADD_DEFINITIONS(-Wall -Wextra -Wsign-promo -Wno-pmf-conversions -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wstrict-null-sentinel -Wno-non-template-friend -Wno-parentheses -Wmissing-field-initializers) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root. +EndIf() + +add_library(CbmKf SHARED ${SRCS}) + +#list(APPEND HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/utils/KfSimd.h) + +target_include_directories(CbmKf + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} +) + +#target_compile_definitions(KfCore PUBLIC NO_ROOT) + +target_link_libraries(CbmKf + PUBLIC CbmMuchBase + CbmMvdBase + CbmStsBase + CbmTofBase + CbmTrdBase + CbmBase + #CbmQaBase + #FairRoot::Base + FairLogger::FairLogger + FairRoot::Base + ROOT::Core + ROOT::Gpad + ROOT::Graf + ROOT::Physics + fmt::fmt + PRIVATE CbmRecoSts + CbmSimSteer + CbmRecoBase + KFParticle + external::yaml-cpp + FairRoot::GeoBase + FairRoot::ParBase + ROOT::EG + ROOT::Geom + ROOT::Graf3d + ROOT::MathCore + ROOT::Matrix + ROOT::Minuit + ROOT::RIO + ) + +install(TARGETS CbmKf DESTINATION lib) +#install(DIRECTORY kf TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +#install(DIRECTORY kf/utils TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +#install(DIRECTORY kf/data TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +#install(DIRECTORY kf/geo TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +#install(DIRECTORY kf/algo TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +#install(DIRECTORY kf/pars TYPE INCLUDE FILES_MATCHING PATTERN "*.h") + +install( + FILES + CbmKfSetupInitializer.h + DESTINATION + include/ +) diff --git a/reco/kf/CbmKfSetupInitializer.cxx b/reco/kf/CbmKfSetupInitializer.cxx new file mode 100644 index 0000000000..ceac2c8c7d --- /dev/null +++ b/reco/kf/CbmKfSetupInitializer.cxx @@ -0,0 +1,16 @@ +/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergei Zharko [committer] */ + +/// @file CbmKfSetupInitializer.h +/// @brief CBM-specific kf::Setup initializer (source) +/// @since 28.08.2024 +/// @author Sergei Zharko <s.zharko@gsi.de> + +#include "CbmKfSetupInitializer.h" + +using cbm::kf::SetupInitializer; + +// --------------------------------------------------------------------------------------------------------------------- +// +void SetupInitializer::Init() {} diff --git a/reco/kf/CbmKfSetupInitializer.h b/reco/kf/CbmKfSetupInitializer.h new file mode 100644 index 0000000000..6b5489fbbf --- /dev/null +++ b/reco/kf/CbmKfSetupInitializer.h @@ -0,0 +1,64 @@ +/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergei Zharko [committer] */ + +/// @file CbmKfSetupInitializer.h +/// @brief CBM-specific kf::Setup initializer (header) +/// @since 28.08.2024 +/// @author Sergei Zharko <s.zharko@gsi.de> + +#pragma once + +#include "KfSetup.h" + +namespace cbm::kf +{ + /// \class SetupInitializer + /// \brief Encapsulation of the kf::Setup initialization routines for CBM + class SetupInitializer { + public: + /// \brief Default constructor + SetupInitializer() = default; + + /// \brief Copy constructor + SetupInitializer(const SetupInitializer&) = delete; + + /// \brief Move constructor + SetupInitializer(SetupInitializer&&) = delete; + + /// \brief Destructor + ~SetupInitializer() = default; + + /// \brief Copy assignment operator + SetupInitializer& operator=(const SetupInitializer&) = delete; + + /// \brief Move assignment operator + SetupInitializer& operator=(SetupInitializer&&) = delete; + + /// \brief Initializes the instance + /// \throws std::logic_error If initialization fails + void Init(); + + /// \brief Creates a kf::Setup instance + /// \tparam Underlying floating-point data-type for the created setup + template<typename T> + cbm::algo::kf::Setup<T> MakeSetup() const; + + private: + cbm::algo::kf::SetupInitializer fBaseInitializer; ///< Instance of the KF-core initializer + }; + + + // ********************************* + // ** Template methods definition ** + // ********************************* + + // ------------------------------------------------------------------------------------------------------------------- + // + template<typename T> + cbm::algo::kf::Setup<T> cbm::kf::SetupInitializer::MakeSetup() const + { + using cbm::algo::kf::Setup; + return Setup<T>(); + } +} // namespace cbm::kf diff --git a/reco/kf/README.md b/reco/kf/README.md new file mode 100644 index 0000000000..e42c1a723e --- /dev/null +++ b/reco/kf/README.md @@ -0,0 +1,20 @@ +# CbmRoot-Specific Representation of the KF framework + +## Introduction + +The CbmKf Library contains a set of different Kalman-Filter based fitting utilities, which are specific for the CBM experiment. + +**The existing KF-libary will be later replaced with this new one.** Components of the CbmKf library will be placed in the `cbm::kf` + namespace (**NOTE:** components of the KfCore are kept in a different namespace **`cbm::algo::kf`**). + + +## Library main classes + +### **`cbm::kf::SetupFactory`** + +The purpose of the class is to provide a common initialization routine for the kf::Setup instances for different data reconstruction +units of the CBM experiment. + + + + -- GitLab