diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 2937b40285365f5a0598c1955e114c3edebaf217..ae6e6c4ceb8dff695ddc51a839373c77413d8688 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -47,6 +47,7 @@ set(SRCS global/Reco.cxx qa/DigiEventQa.cxx qa/Histo1D.cxx + ca/TrackingChain.cxx ) set(BUILD_INFO_CXX ${CMAKE_CURRENT_BINARY_DIR}/base/BuildInfo.cxx) @@ -132,7 +133,7 @@ install(DIRECTORY detectors/sts TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY detectors/tof TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY detectors/trd TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY detectors/trd2d TYPE INCLUDE FILES_MATCHING PATTERN "*.h") -#install(DIRECTORY ca/data TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +install(DIRECTORY ca TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install( @@ -146,6 +147,7 @@ install( global/RecoResultsInputArchive.h global/RecoResultsOutputArchive.h global/StorableRecoResults.h + ca/TrackingChain.h DESTINATION include/ ) diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f1b1bf1e736956efcc7f9353ac7b40686a42b64c --- /dev/null +++ b/algo/ca/TrackingChain.cxx @@ -0,0 +1,51 @@ +/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergei Zharko [committer] */ + +/// \file TrackingChain.cxx +/// \date 14.09.2023 +/// \brief A chain class to execute CA tracking algorithm in online reconstruction (implementation) +/// \author S.Zharko <s.zharko@gsi.de> + +#include "TrackingChain.h" + +#include <boost/filesystem.hpp> + +#include "CaConstants.h" +#include "CaInitManager.h" +#include "CaParameters.h" + +using cbm::algo::TrackingChain; +using cbm::algo::ca::InitManager; +using cbm::algo::ca::Parameters; +using cbm::algo::ca::Track; +using cbm::algo::ca::constants::clrs::CL; // clear text +using cbm::algo::ca::constants::clrs::GNb; // grin bald text + +// --------------------------------------------------------------------------------------------------------------------- +// +void TrackingChain::Init() +{ + // ------ Reading parameters from binary + std::string paramFileBase = "mcbm_beam_2022_05_23_nickel.ca.par"; // TODO: Get the setup name from Opts() + auto paramFile = Opts().ParamsDir(); + paramFile /= paramFileBase; + L_(info) << "Tracking Chain: reading CA parameters file " << GNb << paramFile.string() << CL << '\n'; + auto manager = InitManager {}; + manager.ReadParametersObject(paramFile.string()); + auto parameters = manager.TakeParameters(); + + L_(info) << "Tracking Chain: parameters object: \n" << parameters.ToString(1) << '\n'; +} + +// --------------------------------------------------------------------------------------------------------------------- +// +std::vector<Track> TrackingChain::Run(/*vectors of hits*/) +{ + std::vector<Track> vRecoTracks; + return vRecoTracks; +} + +// --------------------------------------------------------------------------------------------------------------------- +// +void TrackingChain::Finalize() {} diff --git a/algo/ca/TrackingChain.h b/algo/ca/TrackingChain.h new file mode 100644 index 0000000000000000000000000000000000000000..4983487652b32654b9157e4b68d84b2f481040fd --- /dev/null +++ b/algo/ca/TrackingChain.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergei Zharko [committer] */ + +/// \file TrackingChain.h +/// \date 13.09.2023 +/// \brief A chain class to execute CA tracking algorithm in online reconstruction (header) +/// \author S.Zharko <s.zharko@gsi.de> + +#ifndef CBM_ALGO_CA_TRACKING_CHAIN +#define CBM_ALGO_CA_TRACKING_CHAIN 1 + +#include <vector> + +#include "CaTrack.h" +#include "SubChain.h" + +namespace cbm::algo::ca +{ + /// \enum cbm::algo::ca::EDetectorID + /// \brief Enumeration for the detector subsystems used in CBM online tracking + /// \note It is important, that the subsystems are specified in the actual order. + /// \note The enumeration must not contain jumps in the ordering and the first entry must be equal 0 + enum class EDetectorID + { + Mvd = 0, + Sts, + Much, + Trd, + Tof, + kEND ///< End of enumeration + }; +} // namespace cbm::algo::ca + +namespace cbm::algo +{ + /// \class cbm::algo::TrackingChain + /// \brief A chain for tracking algorithm + /// + /// The class executes a tracking algorithm in the online data reconstruction chain. + class TrackingChain : public SubChain { + public: + /// @brief Provides action in the initialization of the run + void Init(); + + /// @brief Provides action for a given time-slice + /// @return A vector of cbm::algo::ca::Track + std::vector<ca::Track> Run(/*vecotrs of hits*/); + + /// @brief Provides action in the end of the run + void Finalize(); + }; +} // namespace cbm::algo + +#endif // CBM_ALGO_CA_TRACKING_CHAIN diff --git a/algo/ca/core/pars/CaConstants.h b/algo/ca/core/pars/CaConstants.h index f9d30e7be1ed3dbf0451fbb928fc5420c6c7ffa5..2c1b7f8650089b7c83814bb34ba2a899f3e74144 100644 --- a/algo/ca/core/pars/CaConstants.h +++ b/algo/ca/core/pars/CaConstants.h @@ -218,6 +218,33 @@ namespace cbm::algo::ca::constants constexpr char WTbr[] = "\e[1;7;38m"; ///< bold-reverse white } // namespace clrs + // clang-format: off + constexpr char Logo[] = "\n\n\n\n" + " [][][] [][][] [][][][][] [][] [] " + " \n" + " [] [] [] [] [] [] [] [] [] " + " \n" + " [] [] [] [] [] " + " \n" + " [] [] [] [] [][][][] [][][] [][][] [] [][] [][] " + "[][][][] [][][][]\n" + " [] [] [] [] [] [] [] [] [] [] [] [] [] [] " + " [] [] [] [] \n" + " [] [] [] [] [] [][][] [] [] [] [] " + " [] [] [] [] \n" + " [] [] [] [] [] [] [] [] [] [] [] [] [] " + " [] [] [] [] \n" + " [][][] [][] [][] [][] [][] [][][][] [][][] [][] [][] [][] " + "[][] [][] [][] [] \n" + " " + " [] \n" + " By CBM Collaboration " + " [] [] \n" + " " + " [][][]\n\n\n"; + // clang-format: on + + } // namespace cbm::algo::ca::constants #endif // CaConstants_h diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 59415a31c1b3f82bf713637de273f548afa3b7aa..14ce8b2a719a85ccbeea8bd7532e23148e7ae9dc 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -47,6 +47,7 @@ void Reco::Init(const Options& opts) SetContext(&fContext); fUnpack.SetContext(&fContext); fStsHitFinder.SetContext(&fContext); + fTracking.SetContext(&fContext); xpu::device_prop props {xpu::device::active()}; L_(info) << "Running CBM Reco on Device '" << props.name() << "' (Using " << openmp::GetMaxThreads() @@ -77,6 +78,9 @@ void Reco::Init(const Options& opts) hitFinderConfig.landauTable = sts::LandauTable::FromFile(opts.ParamsDir() / "LandauWidthTable.txt"); fStsHitFinder.SetParameters(hitFinderConfig); + // Tracking + fTracking.Init(); + fInitialized = true; L_(debug) << "CBM Reco finished initialization"; @@ -128,17 +132,22 @@ RecoResults Reco::Run(const fles::Timeslice& ts) QueueUnpackerMetrics(ts, unpackMonitor, unpackResult.first); QueueStsRecoMetrics(stsHitfinderMonitor); + PrintTimings(ts_times); RecoResults results; results.events = std::move(events); + // --- Tracking + std::vector<ca::Track> tracks = fTracking.Run(); + return results; } void Reco::Finalize() { fStsHitFinder.Finalize(); + fTracking.Finalize(); // Pop timer that was started in Init() xpu::timings t = xpu::pop_timer(); diff --git a/algo/global/Reco.h b/algo/global/Reco.h index 5cb1e71169ed3956c9a165aeb5fa227285f26e10..b12fcb51d5f3fd41ce2e71b2d1976ee952863ece 100644 --- a/algo/global/Reco.h +++ b/algo/global/Reco.h @@ -9,6 +9,7 @@ #include "EventbuildChain.h" #include "SubChain.h" #include "UnpackChain.h" +#include "ca/TrackingChain.h" #include "sts/HitfinderChain.h" namespace fles @@ -52,6 +53,9 @@ namespace cbm::algo std::unique_ptr<evbuild::EventbuildChain> fEventBuild; + // Tracking + TrackingChain fTracking; + void Validate(const Options& opts); void QueueUnpackerMetrics(const fles::Timeslice&, const UnpackMonitorData&, const DigiData&); diff --git a/algo/params/mcbm_beam_2022_05_23_nickel.ca.par b/algo/params/mcbm_beam_2022_05_23_nickel.ca.par new file mode 100644 index 0000000000000000000000000000000000000000..231cc2304d0d7e9484c09cf90c02278457bba21a Binary files /dev/null and b/algo/params/mcbm_beam_2022_05_23_nickel.ca.par differ