diff --git a/algo/base/ChainContext.h b/algo/base/ChainContext.h index 46da5b9d83760b11b6dc0594bca104b5d3d202ff..6f8ae590c9812400be0a91e6c45d5a55c7fddab5 100644 --- a/algo/base/ChainContext.h +++ b/algo/base/ChainContext.h @@ -4,12 +4,12 @@ #ifndef CBM_ALGO_BASE_CHAINCONTEXT_H #define CBM_ALGO_BASE_CHAINCONTEXT_H -#include <memory> -#include <optional> - #include "Options.h" #include "RecoParams.h" +#include <memory> +#include <optional> + namespace cbm { // cbm::Monitor must be forward declared. This prevents an issue in older ROOT versions, diff --git a/algo/base/Definitions.h b/algo/base/Definitions.h index cf2742fcfef999877149e635f67f708d70e18123..e015b2e23c75eae4fe2aec84f83166dd45789556 100644 --- a/algo/base/Definitions.h +++ b/algo/base/Definitions.h @@ -5,11 +5,10 @@ #define CBM_BASE_TYPES_H #include "MicrosliceDescriptor.hpp" // For fles::Subsystem +#include "util/EnumDict.h" #include <cstdint> -#include "util/EnumDict.h" - namespace cbm::algo { diff --git a/algo/base/DigiData.cxx b/algo/base/DigiData.cxx index 9096729769cf6fcedfc6865a2b069f037f4cf4fe..179c8ca31508e322b1bd1222b70bc417a9aafd7b 100644 --- a/algo/base/DigiData.cxx +++ b/algo/base/DigiData.cxx @@ -55,7 +55,7 @@ size_t DigiData::TotalSizeBytes() const CbmDigiData DigiData::ToStorable() const { - return CbmDigiData { + return CbmDigiData{ .fBmon = { .fDigis = ToStdVector(fBmon), @@ -124,7 +124,7 @@ DigiEvent::DigiEvent(const CbmDigiEvent& storable) CbmDigiEvent DigiEvent::ToStorable() const { - return CbmDigiEvent { + return CbmDigiEvent{ .fData = DigiData::ToStorable(), .fNumber = fNumber, .fTime = fTime, diff --git a/algo/base/DigiData.h b/algo/base/DigiData.h index 7c09c5a126b20a76c6b61cb4c400ce15fa164c87..54a34f0830710c514937831f7bf6736aa8a16684 100644 --- a/algo/base/DigiData.h +++ b/algo/base/DigiData.h @@ -14,7 +14,6 @@ #include "CbmStsDigi.h" #include "CbmTofDigi.h" #include "CbmTrdDigi.h" - #include "PODVector.h" namespace cbm::algo diff --git a/algo/base/HistogramSender.h b/algo/base/HistogramSender.h index e4c13d192f110e58e69f3ed9a36cd0d696885928..b44a1bfae4d6084179b842f50425bc01a589c036 100644 --- a/algo/base/HistogramSender.h +++ b/algo/base/HistogramSender.h @@ -19,7 +19,7 @@ namespace cbm::algo { class HistogramSender { - public: + public: HistogramSender(std::string_view address) : fHistComChan(address) , fZmqContext(1) @@ -53,7 +53,7 @@ namespace cbm::algo fZmqSocket.send(msg, flags); } - private: + private: std::string fHistComChan = "tcp://127.0.0.1:56800"; zmq::context_t fZmqContext; ///< ZMQ context FIXME: should be only one context per binary! zmq::socket_t fZmqSocket; ///< ZMQ socket to histogram server diff --git a/algo/base/MainConfig.h b/algo/base/MainConfig.h index 34a1a13a162dc9856be2379b6f7c87d107262295..18521ad3dec946cb94975b7445de1e475cbd76e1 100644 --- a/algo/base/MainConfig.h +++ b/algo/base/MainConfig.h @@ -19,7 +19,7 @@ namespace cbm::algo ** @since 10 July 2023 **/ class MainConfig { - public: // methods + public: // methods /** @brief Constructor **/ MainConfig() = default; @@ -32,7 +32,7 @@ namespace cbm::algo /** @brief Save to YAML file **/ void SaveYaml(const std::string& filename); - public: // data members + public: // data members // --- Digi trigger ECbmModuleId fTriggerDet = ECbmModuleId::kNotExist; // Trigger detector double fTriggerWin = 0.; // Trigger window size [ns] diff --git a/algo/base/Options.cxx b/algo/base/Options.cxx index 5c6ca51b0c5558801caced1fe521d272c912a126..b69c98ee2f5d9219d1c459e62168e4fd0be4264d 100644 --- a/algo/base/Options.cxx +++ b/algo/base/Options.cxx @@ -29,7 +29,7 @@ namespace std void validate(boost::any& v, const std::vector<std::string>& values, severity_level*, int) { - static const std::unordered_map<std::string, severity_level> levels { + static const std::unordered_map<std::string, severity_level> levels{ {"trace", severity_level::trace}, {"debug", severity_level::debug}, {"status", severity_level::status}, {"info", severity_level::info}, {"warning", severity_level::warning}, {"error", severity_level::error}, {"fatal", severity_level::fatal}}; @@ -98,7 +98,7 @@ Options::Options(int argc, char** argv) cmdline_options.add(required).add(generic); po::variables_map vm; - po::command_line_parser parser {argc, argv}; + po::command_line_parser parser{argc, argv}; parser.options(cmdline_options); try { auto result = parser.run(); diff --git a/algo/base/Options.h b/algo/base/Options.h index d1a83d93d6e72708207d57aa3161dc53dcba206b..9eeaeec67df67a3f82be005b8dd0f153f6b6e996 100644 --- a/algo/base/Options.h +++ b/algo/base/Options.h @@ -4,20 +4,20 @@ #ifndef CBM_ALGO_BASE_OPTIONS_H #define CBM_ALGO_BASE_OPTIONS_H -#include <set> -#include <string> -#include <vector> - #include "Definitions.h" #include "compat/Filesystem.h" #include "log.hpp" +#include <set> +#include <string> +#include <vector> + namespace cbm::algo { class Options { - public: + public: Options() = default; Options(int argc, char** argv); @@ -57,7 +57,7 @@ namespace cbm::algo } - private: // members + private: // members std::string fParamsDir; // TODO: can we make this a std::path? std::string fInputLocator; std::string fOutputFile; diff --git a/algo/base/PODVector.h b/algo/base/PODVector.h index 9d19e03baf514a1cd8728054121fd2c8222d4ca2..16f1ceed518bea5af781370502a13aa90798016b 100644 --- a/algo/base/PODVector.h +++ b/algo/base/PODVector.h @@ -4,10 +4,10 @@ #ifndef CBM_ALGO_BASE_POD_VECTOR_H #define CBM_ALGO_BASE_POD_VECTOR_H -#include <vector> - #include "util/PODAllocator.h" +#include <vector> + namespace cbm::algo { /** diff --git a/algo/base/PartitionedSpan.h b/algo/base/PartitionedSpan.h index e004f92b485f91e09092e3b9aebc439d43413005..db330510ef11f4933a5e6e6c0624900bb9ed734d 100644 --- a/algo/base/PartitionedSpan.h +++ b/algo/base/PartitionedSpan.h @@ -4,13 +4,13 @@ #ifndef CBM_ALGO_BASE_PARTITIONED_SPAN_H #define CBM_ALGO_BASE_PARTITIONED_SPAN_H +#include "Definitions.h" + #include <array> #include <gsl/span> #include <stdexcept> #include <vector> -#include "Definitions.h" - namespace cbm::algo { @@ -29,7 +29,7 @@ namespace cbm::algo template<typename T> class PartitionedSpan { - public: + public: PartitionedSpan() : fData(), fOffsets(NullOffset), fAdresses() { EnsureDimensions(); } // Intellisense and clang workaround, fails on template deduction with stl containers for some reason @@ -143,7 +143,7 @@ namespace cbm::algo gsl::span<const size_t> Offsets() const { return fOffsets; } - private: + private: // Required for default constructor, don't use std::array to avoid additional dependency static constexpr size_t NullOffset[1] = {0}; diff --git a/algo/base/PartitionedVector.h b/algo/base/PartitionedVector.h index 71d812eea81555122783f2ecb54386ee21a96b1f..0e1c83636cb7feba358eccac7d59c3ee4c0cb336 100644 --- a/algo/base/PartitionedVector.h +++ b/algo/base/PartitionedVector.h @@ -4,15 +4,15 @@ #ifndef CBM_ALGO_BASE_PARTITIONED_VECTOR_H #define CBM_ALGO_BASE_PARTITIONED_VECTOR_H +#include "Definitions.h" +#include "util/PODAllocator.h" + #include <boost/serialization/access.hpp> #include <boost/serialization/vector.hpp> #include <gsl/span> #include <vector> -#include "Definitions.h" -#include "util/PODAllocator.h" - namespace cbm::algo { template<typename T> @@ -29,7 +29,7 @@ namespace cbm::algo template<typename T, class Allocator = std::allocator<T>> class PartitionedVector { - public: + public: using Container_t = std::vector<T, Allocator>; //< Underlying container type /** @@ -162,7 +162,7 @@ namespace cbm::algo */ const std::vector<size_t>& Offsets() const { return fOffsets; } - private: + private: Container_t fData; //< Data std::vector<size_t> fOffsets; // < Offsets of the partitions in fData std::vector<u32> fAdresses; //< Hardware addresses of the partitions @@ -172,7 +172,9 @@ namespace cbm::algo if (fOffsets.size() - 1 != fAdresses.size()) { throw std::runtime_error("PartitionedVector: fOffsets.size() != fAdresses.size()"); } - if (fOffsets.front() != 0) { throw std::runtime_error("PartitionedVector: fOffsets.front() != 0"); } + if (fOffsets.front() != 0) { + throw std::runtime_error("PartitionedVector: fOffsets.front() != 0"); + } if (fOffsets.back() != fData.size()) { throw std::runtime_error("PartitionedVector: fOffsets.back() != fData.size()"); } @@ -201,7 +203,7 @@ namespace cbm::algo return gsl::span<const T>(fData.data() + fOffsets[i], UnsafeSize(i)); } - private: // serialization + private: // serialization friend class boost::serialization::access; template<class Archive> diff --git a/algo/base/RecoParams.h b/algo/base/RecoParams.h index e459950ee67125b544dfa7781eebb19488f25bda..5c88e0d23145eca2915ad99202b7c3e85be98e18 100644 --- a/algo/base/RecoParams.h +++ b/algo/base/RecoParams.h @@ -4,12 +4,12 @@ #ifndef CBM_ALGO_BASE_RECOPARAMS_H #define CBM_ALGO_BASE_RECOPARAMS_H -#include <xpu/defines.h> - #include "Definitions.h" #include "config/Property.h" #include "util/EnumDict.h" +#include <xpu/defines.h> + namespace cbm::algo { diff --git a/algo/base/SubChain.h b/algo/base/SubChain.h index 0b0c19744ddbf5984123c285381f2486f68359a6..a541e75764470f6d554a5f8e0390f8fbbb960b10 100644 --- a/algo/base/SubChain.h +++ b/algo/base/SubChain.h @@ -4,15 +4,15 @@ #ifndef CBM_ALGO_BASE_SUBCHAIN_H #define CBM_ALGO_BASE_SUBCHAIN_H -#include <gsl/pointers> - #include "ChainContext.h" +#include <gsl/pointers> + namespace cbm::algo { class SubChain { - public: + public: void SetContext(ChainContext* ctx) { fContext = ctx; } const Options& Opts() const { return gsl::make_not_null(fContext)->opts; } @@ -27,7 +27,7 @@ namespace cbm::algo return *gsl::make_not_null(fContext)->monitor; } - private: + private: ChainContext* fContext = nullptr; }; } // namespace cbm::algo diff --git a/algo/base/compat/Algorithm.h b/algo/base/compat/Algorithm.h index 46e93d8a2d54c9d1d6742f0614e1ea8e49fbc9e7..2fee8a387dcd63c4a760d2a93c130e5f384f6533 100644 --- a/algo/base/compat/Algorithm.h +++ b/algo/base/compat/Algorithm.h @@ -15,10 +15,10 @@ * If TBB is not available, we also falls back to sequential algorithms. **/ -#include <algorithm> - #include "BuildInfo.h" +#include <algorithm> + #ifdef __cpp_lib_execution #define WITH_EXECUTION #include <execution> diff --git a/algo/base/config/BaseTypes.h b/algo/base/config/BaseTypes.h index 1f2701f67c71b8eb14e40720126a0f4654ee5aec..54b1eca0131cc3d90e360e1958f614fc51deace3 100644 --- a/algo/base/config/BaseTypes.h +++ b/algo/base/config/BaseTypes.h @@ -4,12 +4,12 @@ #ifndef CBM_ALGO_BASE_CONFIG_BASETYPES_H #define CBM_ALGO_BASE_CONFIG_BASETYPES_H +#include "Definitions.h" + #include <string> #include <tuple> #include <vector> -#include "Definitions.h" - namespace cbm::algo::config { @@ -34,7 +34,9 @@ namespace cbm::algo::config template<typename T, typename = std::enable_if_t<IsFundamental<T>>> constexpr std::string_view Typename() { - if constexpr (std::is_same_v<bool, T>) { return "bool"; } + if constexpr (std::is_same_v<bool, T>) { + return "bool"; + } else if constexpr (std::is_same_v<u8, T>) { return "u8"; } diff --git a/algo/base/config/Property.h b/algo/base/config/Property.h index f0ef1ffadb1ee6d404c357d14259c7ef03ffb4a2..ac71eca1262faa4b7d5fcec1e66ee217867b36d2 100644 --- a/algo/base/config/Property.h +++ b/algo/base/config/Property.h @@ -4,28 +4,28 @@ #ifndef CBM_ALGO_BASE_CONFIG_PROPERTY_H #define CBM_ALGO_BASE_CONFIG_PROPERTY_H +#include "Definitions.h" + #include <optional> #include <string_view> #include <tuple> #include <yaml-cpp/emittermanip.h> -#include "Definitions.h" - namespace cbm::algo::config { template<typename Class, typename T> class Property { - private: + private: T Class::*fMember; std::string_view fKey; std::string_view fDescription; std::optional<YAML::EMITTER_MANIP> fFormat; std::optional<YAML::EMITTER_MANIP> fFormatEntries; - public: + public: using ClassType = Class; using ValueType = T; @@ -64,14 +64,14 @@ namespace cbm::algo::config } // namespace cbm::algo::config #define CBM_PROPERTIES(...) \ -public: \ + public: \ static constexpr auto Properties = std::make_tuple(__VA_ARGS__) /** * @brief Optional tag to specify a formatting of the class (YAML::Flow vs YAML::Block) */ #define CBM_FORMAT(tag) \ -public: \ + public: \ static constexpr std::optional<YAML::EMITTER_MANIP> FormatAs = tag #endif // CBM_ALGO_BASE_CONFIG_PROPERTY_H diff --git a/algo/base/config/Yaml.h b/algo/base/config/Yaml.h index dbb60801885e1110366278a343cd1ab9711042a2..9c829ddbbb7f69fdbf92eced37d256801633e508 100644 --- a/algo/base/config/Yaml.h +++ b/algo/base/config/Yaml.h @@ -4,18 +4,18 @@ #ifndef CBM_ALGO_BASE_CONFIG_DESERIALIZE_H #define CBM_ALGO_BASE_CONFIG_DESERIALIZE_H -#include <sstream> -#include <string_view> - -#include <fmt/format.h> -#include <yaml-cpp/yaml.h> - #include "BaseTypes.h" #include "Definitions.h" #include "Property.h" #include "compat/Filesystem.h" #include "util/EnumDict.h" +#include <sstream> +#include <string_view> + +#include <fmt/format.h> +#include <yaml-cpp/yaml.h> + namespace cbm::algo::config { @@ -25,7 +25,7 @@ namespace cbm::algo::config template<typename T, T... Values, typename Func> constexpr void ForEach(std::integer_sequence<T, Values...>, Func&& func) { - (func(std::integral_constant<T, Values> {}), ...); + (func(std::integral_constant<T, Values>{}), ...); } template<typename T, typename = void> @@ -53,10 +53,14 @@ namespace cbm::algo::config static_assert(!IsEnum<T> || detail::EnumHasDict_v<T>, "Enum must have a dictionary to be deserializable"); // TODO: error handling - if constexpr (IsFundamental<Type>) { return node.as<Type>(); } + if constexpr (IsFundamental<Type>) { + return node.as<Type>(); + } else if constexpr (IsEnum<Type>) { std::optional<T> maybet = FromString<T>(node.as<std::string>()); - if (!maybet) { throw std::runtime_error(fmt::format("Invalid enum value: {}", node.as<std::string>())); } + if (!maybet) { + throw std::runtime_error(fmt::format("Invalid enum value: {}", node.as<std::string>())); + } return *maybet; } else if constexpr (IsVector<Type>) { @@ -92,11 +96,11 @@ namespace cbm::algo::config else { Type object; constexpr auto nProperties = std::tuple_size<decltype(Type::Properties)>::value; - ForEach(std::make_integer_sequence<std::size_t, nProperties> {}, [&](auto index) { + ForEach(std::make_integer_sequence<std::size_t, nProperties>{}, [&](auto index) { auto& property = std::get<index>(Type::Properties); using ValueType = std::remove_cv_t<std::remove_reference_t<decltype(property.Get(object))>>; ValueType& value = property.Get(object); - value = Read<ValueType>(node[std::string {property.Key()}]); + value = Read<ValueType>(node[std::string{property.Key()}]); }); return object; } @@ -109,7 +113,9 @@ namespace cbm::algo::config std::stringstream docString; - if constexpr (IsFundamental<Type>) { docString << Typename<Type>(); } + if constexpr (IsFundamental<Type>) { + docString << Typename<Type>(); + } else if constexpr (IsVector<Type> || IsArray<Type>) { using ChildType = typename Type::value_type; if constexpr (IsFundamental<ChildType>) { @@ -122,7 +128,7 @@ namespace cbm::algo::config } else { constexpr auto nProperties = std::tuple_size<decltype(Type::Properties)>::value; - ForEach(std::make_integer_sequence<std::size_t, nProperties> {}, [&](auto index) { + ForEach(std::make_integer_sequence<std::size_t, nProperties>{}, [&](auto index) { using ChildType = std::remove_cv_t< std::remove_reference_t<decltype(std::get<index>(Type::Properties).Get(std::declval<Type>()))>>; auto& property = std::get<index>(Type::Properties); @@ -142,7 +148,7 @@ namespace cbm::algo::config class Dump { - public: + public: template<typename T> std::string operator()(const T& object) { @@ -153,7 +159,7 @@ namespace cbm::algo::config return ss.c_str(); } - private: + private: template<typename T> void DoDump(const T& object, YAML::Emitter& ss, std::optional<YAML::EMITTER_MANIP> formatEntries = {}) { @@ -161,7 +167,8 @@ namespace cbm::algo::config if constexpr (IsFundamental<T>) { // Take care that i8 and u8 are printed as integers not as characters - if constexpr (std::is_same_v<T, i8> || std::is_same_v<T, u8>) ss << i32(object); + if constexpr (std::is_same_v<T, i8> || std::is_same_v<T, u8>) + ss << i32(object); else ss << object; } @@ -171,7 +178,9 @@ namespace cbm::algo::config else if constexpr (IsVector<T> || IsArray<T>) { ss << YAML::BeginSeq; for (const auto& element : object) { - if (formatEntries.has_value()) { ss << formatEntries.value(); } + if (formatEntries.has_value()) { + ss << formatEntries.value(); + } DoDump(element, ss); } ss << YAML::EndSeq; @@ -179,7 +188,9 @@ namespace cbm::algo::config else if constexpr (IsMap<T>) { ss << YAML::BeginMap; for (const auto& [key, value] : object) { - if (formatEntries.has_value()) { ss << formatEntries.value(); } + if (formatEntries.has_value()) { + ss << formatEntries.value(); + } ss << YAML::Key << key; ss << YAML::Value; DoDump(value, ss); @@ -188,14 +199,18 @@ namespace cbm::algo::config } else { constexpr auto nProperties = std::tuple_size<decltype(T::Properties)>::value; - if (auto fmtTag = GetFmtTag<T>::value; fmtTag.has_value()) { ss << fmtTag.value(); } + if (auto fmtTag = GetFmtTag<T>::value; fmtTag.has_value()) { + ss << fmtTag.value(); + } ss << YAML::BeginMap; - ForEach(std::make_integer_sequence<std::size_t, nProperties> {}, [&](auto index) { + ForEach(std::make_integer_sequence<std::size_t, nProperties>{}, [&](auto index) { auto& property = std::get<index>(T::Properties); auto& value = property.Get(object); auto format = property.Format(); - ss << YAML::Key << std::string {property.Key()}; - if (format.has_value()) { ss << format.value(); } + ss << YAML::Key << std::string{property.Key()}; + if (format.has_value()) { + ss << format.value(); + } ss << YAML::Value; DoDump(value, ss, property.FormatEntries()); }); diff --git a/algo/base/gpu/Params.h b/algo/base/gpu/Params.h index 86a4a407981b463f9d2fb87592933cfa5a43d706..d14f15ec9b7d53965de4e83e1c9f74f651a5f29c 100644 --- a/algo/base/gpu/Params.h +++ b/algo/base/gpu/Params.h @@ -4,11 +4,11 @@ #ifndef CBM_ALGO_GPU_CONFIG_H #define CBM_ALGO_GPU_CONFIG_H -#include <xpu/device.h> - #include "DeviceImage.h" #include "RecoParams.h" +#include <xpu/device.h> + namespace cbm::algo { struct Params : xpu::constant<GPUReco, RecoParams> { diff --git a/algo/base/gpu/xpu_legacy.h b/algo/base/gpu/xpu_legacy.h index 3dbe92016b035519b922a74caba19590c9017e1e..ad78c090fc329cc56166676b06d62a426bf161af 100644 --- a/algo/base/gpu/xpu_legacy.h +++ b/algo/base/gpu/xpu_legacy.h @@ -15,7 +15,7 @@ namespace xpu template<typename T> class hd_buffer { - public: + public: hd_buffer() = default; hd_buffer(size_t size) : m_buffer(size, xpu::buf_io) {} @@ -24,14 +24,14 @@ namespace xpu xpu::buffer<T>& underlying() { return m_buffer; } - private: + private: xpu::buffer<T> m_buffer; }; template<typename T> class d_buffer { - public: + public: d_buffer() = default; d_buffer(size_t size) : m_buffer(size, xpu::buf_device) {} @@ -39,7 +39,7 @@ namespace xpu xpu::buffer<T>& underlying() { return m_buffer; } - private: + private: xpu::buffer<T> m_buffer; }; diff --git a/algo/base/util/EnumDict.h b/algo/base/util/EnumDict.h index 6dc3341bcdffd5ab909c13fec6e4b714e47646e2..be1a740ecf509662baa0341ce3b9ca30a492232d 100644 --- a/algo/base/util/EnumDict.h +++ b/algo/base/util/EnumDict.h @@ -38,7 +38,8 @@ namespace cbm::algo { const auto& dict = detail::EnumDict<T>; auto it = std::find_if(dict.begin(), dict.end(), [&](const auto& pair) { - if (caseSensitive) return pair.first == str; + if (caseSensitive) + return pair.first == str; else return boost::iequals(pair.first, str); }); diff --git a/algo/base/util/PODAllocator.h b/algo/base/util/PODAllocator.h index 9240927c2df279e5566d81635caceef6426fed6a..45f1ea89f30f5604f255bc36842ab99d30c800f0 100644 --- a/algo/base/util/PODAllocator.h +++ b/algo/base/util/PODAllocator.h @@ -5,6 +5,8 @@ #define CBM_ALGO_BASE_POD_ALLOCATOR_H #include <cstdlib> +#include <type_traits> +#include <utility> namespace cbm::algo { @@ -15,7 +17,7 @@ namespace cbm::algo */ template<class T> class PODAllocator { - public: + public: // Eventually we should enable this assert, but not all Digis have a trivial constructor yet. // static_assert(std::is_trivially_constructible_v<T>, "PODAllocator only works for POD types"); diff --git a/algo/base/util/TimingsFormat.cxx b/algo/base/util/TimingsFormat.cxx index a6798f45005fef5cc78f88dcfaddd156947c287a..66a8f85b25f50b4c0128caa3e06b572ad6c1ef6d 100644 --- a/algo/base/util/TimingsFormat.cxx +++ b/algo/base/util/TimingsFormat.cxx @@ -14,7 +14,7 @@ namespace cbm::algo class TimingsFormat { - public: + public: void Begin(size_t align) { fAlign = align; @@ -77,7 +77,9 @@ namespace cbm::algo for (auto it = subtimes.begin(); it != subtimes.end(); ++it) { Title(it->name()); Fmt(*it); - if (std::next(it) != subtimes.end()) { NewLine(); } + if (std::next(it) != subtimes.end()) { + NewLine(); + } } } @@ -98,7 +100,7 @@ namespace cbm::algo void NewLine() { fSS << "\n"; } - private: + private: void Measurement(std::string_view name, f64 time, f64 throughput) { Indent(); @@ -120,7 +122,9 @@ namespace cbm::algo std::string_view KernelName(xpu::kernel_timings& kt) { std::string prefix = "cbm::algo::"; - if (kt.name().compare(0, prefix.size(), prefix) == 0) { return kt.name().substr(11); } + if (kt.name().compare(0, prefix.size(), prefix) == 0) { + return kt.name().substr(11); + } else { return kt.name(); } diff --git a/algo/base/util/TimingsFormat.h b/algo/base/util/TimingsFormat.h index d01cda44806fb19e50e3d5c16870859010d48157..f38e41ec5eb14706bdfb108744a416226131dea5 100644 --- a/algo/base/util/TimingsFormat.h +++ b/algo/base/util/TimingsFormat.h @@ -4,11 +4,11 @@ #ifndef CBM_ALGO_BASE_UTIL_TIMINGSFORMAT_H #define CBM_ALGO_BASE_UTIL_TIMINGSFORMAT_H +#include "Definitions.h" + #include <string> #include <string_view> -#include "Definitions.h" - namespace xpu { class timings; diff --git a/algo/ca/core/pars/CaStation.h b/algo/ca/core/pars/CaStation.h index 15897be25157c47ac600b41b48bb27640326a905..f9984340db88f20ead65637fec84cff7ec725c12 100644 --- a/algo/ca/core/pars/CaStation.h +++ b/algo/ca/core/pars/CaStation.h @@ -24,7 +24,7 @@ namespace cbm::algo::ca int type = constants::Undef<int>; // TODO: replace with L1DetectorID int timeInfo = constants::Undef<int>; ///< flag: if time information can be used int fieldStatus = - constants::Undef<int>; ///< flag: 1 - station is INSIDE the field, 0 - station is OUTSIDE the field + constants::Undef<int>; ///< flag: 1 - station is INSIDE the field, 0 - station is OUTSIDE the field DataT fZ = constants::Undef<DataT>; ///< z position of station [cm] DataT Xmax = constants::Undef<DataT>; ///< min radius of the station [cm] DataT Ymax = constants::Undef<DataT>; ///< max radius of the station [cm] diff --git a/algo/ca/core/tracking/CaTrackExtender.cxx b/algo/ca/core/tracking/CaTrackExtender.cxx index 0491bc7bea3b75ba106df53900f5af12f85f857b..100714260d76a1b29f13a11cbe2a60139f7791b6 100644 --- a/algo/ca/core/tracking/CaTrackExtender.cxx +++ b/algo/ca/core/tracking/CaTrackExtender.cxx @@ -111,8 +111,8 @@ void TrackExtender::FitBranchFast(const ca::Branch& t, TrackParamV& Tout, const fld.Set(fldB2, fldZ2, fldB1, fldZ1, fldB0, fldZ0); for (int i = iFirstHit + step; step * i <= step * iLastHit; i += step) { - const ca::Hit& hit = frAlgo.GetInputData().GetHit(hits[i]); - int ista = hit.Station(); + const ca::Hit& hit = frAlgo.GetInputData().GetHit(hits[i]); + int ista = hit.Station(); const ca::StationV& sta = frAlgo.GetParameters().GetStation(ista); fit.Extrapolate(hit.Z(), fld); diff --git a/algo/ca/core/tracking/CaTrackFitter.cxx b/algo/ca/core/tracking/CaTrackFitter.cxx index 3ad17f11b2e0887e6f1721b152b053353f44f545..bfd70c58ea4cadea284ea90f909b4771cc41cd75 100644 --- a/algo/ca/core/tracking/CaTrackFitter.cxx +++ b/algo/ca/core/tracking/CaTrackFitter.cxx @@ -199,9 +199,9 @@ void TrackFitter::FitCaTracks() } for (int ih = nHitsTrack - 1; ih >= 0; ih--) { - const int ista = iSta[ih]; + const int ista = iSta[ih]; const ca::StationV& st = frAlgo.GetParameters().GetStation(ista); - By[ista][iVec] = st.fieldSlice.cy[0][0]; + By[ista][iVec] = st.fieldSlice.cy[0][0]; } } diff --git a/algo/data/sts/Cluster.h b/algo/data/sts/Cluster.h index 56b89092f080ac15cf9388203a53092dd3143ee5..927d787e30640529dab5d9eeabc567945648c4ab 100644 --- a/algo/data/sts/Cluster.h +++ b/algo/data/sts/Cluster.h @@ -4,10 +4,10 @@ #ifndef CBM_ALGO_DATA_STS_CLUSTER_H #define CBM_ALGO_DATA_STS_CLUSTER_H -#include <boost/serialization/access.hpp> - #include "Definitions.h" +#include <boost/serialization/access.hpp> + namespace cbm::algo::sts { @@ -19,7 +19,7 @@ namespace cbm::algo::sts u32 fTime; ///< cluster time [ns] real fTimeError; ///< Error of cluster time [ns] - private: // serialization + private: // serialization friend class boost::serialization::access; template<class Archive> diff --git a/algo/data/sts/Hit.h b/algo/data/sts/Hit.h index 961614f72a56d3b09fa8a0107d2440c0dad6fde4..ab1a733f2ca8372e1381433e61d9e94cdc8abb24 100644 --- a/algo/data/sts/Hit.h +++ b/algo/data/sts/Hit.h @@ -5,10 +5,10 @@ #ifndef CBM_ALGO_DATA_STS_HIT_H #define CBM_ALGO_DATA_STS_HIT_H -#include <boost/serialization/access.hpp> - #include "Definitions.h" +#include <boost/serialization/access.hpp> + namespace cbm::algo::sts { @@ -35,7 +35,7 @@ namespace cbm::algo::sts real Dy() const { return fDy; } real TimeError() const { return fTimeError; } - private: // serialization + private: // serialization friend class boost::serialization::access; template<class Archive> diff --git a/algo/data/sts/LandauTable.cxx b/algo/data/sts/LandauTable.cxx index fb146c002351724a0f0452d3e50d79dafb28ee84..6192a145419cc938c4ab5c30b435bf4487abf54e 100644 --- a/algo/data/sts/LandauTable.cxx +++ b/algo/data/sts/LandauTable.cxx @@ -3,10 +3,10 @@ Authors: Felix Weiglhofer [committer] */ #include "LandauTable.h" -#include <fstream> - #include "log.hpp" +#include <fstream> + using namespace cbm::algo; sts::LandauTable sts::LandauTable::FromFile(fs::path path) diff --git a/algo/data/sts/LandauTable.h b/algo/data/sts/LandauTable.h index df976a44bb8ca6e4a227848dc268c8e97bb86c1f..639e6b0044b80f5d8619f16a7502484797ff5c0c 100644 --- a/algo/data/sts/LandauTable.h +++ b/algo/data/sts/LandauTable.h @@ -4,11 +4,11 @@ #ifndef CBM_ALGO_DATA_STS_LANDAUTABLE_H #define CBM_ALGO_DATA_STS_LANDAUTABLE_H -#include <vector> - #include "Definitions.h" #include "compat/Filesystem.h" +#include <vector> + namespace cbm::algo::sts { diff --git a/algo/detectors/bmon/ReadoutConfig.cxx b/algo/detectors/bmon/ReadoutConfig.cxx index b4f5133d2de936066e3760c5c84027c4348420e3..b8a14ef97b23b6a9cf80f2edfae91049c54c717f 100644 --- a/algo/detectors/bmon/ReadoutConfig.cxx +++ b/algo/detectors/bmon/ReadoutConfig.cxx @@ -4,16 +4,15 @@ #include "ReadoutConfig.h" +#include "AlgoFairloggerCompat.h" #include "CbmTofAddress.h" +#include "gDpbMessv100.h" #include <bitset> #include <iomanip> #include <fmt/format.h> -#include "AlgoFairloggerCompat.h" -#include "gDpbMessv100.h" - using namespace std; namespace cbm::algo::bmon @@ -53,7 +52,9 @@ namespace cbm::algo::bmon std::vector<uint32_t> result; auto equipIter = fReadoutMap.find(equipmentId); if (equipIter != fReadoutMap.end()) { - if (elinkId < equipIter->second.size()) { result = equipIter->second.at(elinkId); } + if (elinkId < equipIter->second.size()) { + result = equipIter->second.at(elinkId); + } } return result; } @@ -88,7 +89,9 @@ namespace cbm::algo::bmon { // hack? perhaps can be removed const int numFullFlims = 8; - if (comp > numFullFlims) { chanInSys -= (comp - numFullFlims) * numChanPerComp / 2; } + if (comp > numFullFlims) { + chanInSys -= (comp - numFullFlims) * numChanPerComp / 2; + } } const uint32_t chanUId = fviRpcChUId[chanInSys]; diff --git a/algo/detectors/bmon/ReadoutConfig.h b/algo/detectors/bmon/ReadoutConfig.h index e8c8fb7250c2606793a02d5a7d744673a343ee56..fa2fb8ea1ab25ba92f629bd89a0d460d91c00329 100644 --- a/algo/detectors/bmon/ReadoutConfig.h +++ b/algo/detectors/bmon/ReadoutConfig.h @@ -14,7 +14,7 @@ namespace cbm::algo::bmon { class ReadoutConfig { - public: + public: /** @brief Constructor **/ ReadoutConfig(); @@ -39,7 +39,7 @@ namespace cbm::algo::bmon */ std::vector<uint32_t> Map(uint16_t equipId, uint16_t elink); - private: + private: // --- Bmon readout map // --- Map index: (equipment, elink, channel), map value: (TOF address) std::map<uint16_t, std::vector<std::vector<uint32_t>>> fReadoutMap = {}; diff --git a/algo/detectors/bmon/Unpack.cxx b/algo/detectors/bmon/Unpack.cxx index 6ccc4cc0c03554ffaab98e4d4836080fba3d6215..377c628d40fc7804f5cb1fc474c7decaccd85cf5 100644 --- a/algo/detectors/bmon/Unpack.cxx +++ b/algo/detectors/bmon/Unpack.cxx @@ -5,12 +5,11 @@ #include "Unpack.h" #include <cassert> +#include <cmath> #include <sstream> #include <utility> #include <vector> -#include <cmath> - using std::unique_ptr; using std::vector; @@ -144,7 +143,9 @@ namespace cbm::algo::bmon const uint64_t epoch = message.getGdpbEpEpochNb(); // --- Calculate epoch relative to timeslice start time; correct for epoch cycles - if (time.currentTsTime <= epoch) { time.currentEpochInTs = epoch - time.currentTsTime; } + if (time.currentTsTime <= epoch) { + time.currentEpochInTs = epoch - time.currentTsTime; + } else { time.currentEpochInTs = epoch + critof001::kulEpochCycleEp - time.currentTsTime; } diff --git a/algo/detectors/bmon/Unpack.h b/algo/detectors/bmon/Unpack.h index 06d4ec5affa4272fd5114b1dc1f8844e0a0e5a70..11e027c50de6ae14977a407eb437cebdc92ea526 100644 --- a/algo/detectors/bmon/Unpack.h +++ b/algo/detectors/bmon/Unpack.h @@ -7,7 +7,7 @@ #include "CbmBmonDigi.h" - +#include "CriGet4Mess001.h" #include "MicrosliceDescriptor.hpp" #include "Timeslice.hpp" @@ -18,8 +18,6 @@ #include <sstream> #include <vector> -#include "CriGet4Mess001.h" - namespace cbm::algo::bmon { @@ -85,16 +83,16 @@ namespace cbm::algo::bmon **/ class Unpack { - public: + public: typedef std::pair<std::vector<CbmBmonDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution @@ -111,13 +109,13 @@ namespace cbm::algo::bmon **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: // datatypes + private: // datatypes struct TimeSpec { uint64_t currentTsTime; ///< Unix time of timeslice in units of epoch length uint32_t currentEpochInTs; ///< Current epoch number relative to timeslice start epoch }; - private: // methods + private: // methods /** @brief Process a hit message ** @param message SMX message (32-bit word) ** @param digiVec Vector to append the created digi to @@ -132,7 +130,7 @@ namespace cbm::algo::bmon void ProcessEpochMessage(const critof001::Message& message, TimeSpec& time) const; - private: // members + private: // members UnpackPar fParams = {}; ///< Parameter container }; diff --git a/algo/detectors/much/ReadoutConfig.cxx b/algo/detectors/much/ReadoutConfig.cxx index 9389eff4533019c54c0cdf760f50f4d9319bd1c6..cb1473f86183e4aac9b29c65d71544eb7a2ff642 100644 --- a/algo/detectors/much/ReadoutConfig.cxx +++ b/algo/detectors/much/ReadoutConfig.cxx @@ -4,13 +4,12 @@ #include "ReadoutConfig.h" +#include "AlgoFairloggerCompat.h" #include "CbmMuchAddress.h" #include <bitset> #include <unordered_set> -#include "AlgoFairloggerCompat.h" - using namespace std; namespace cbm::algo::much @@ -49,7 +48,9 @@ namespace cbm::algo::much std::vector<uint32_t> result; auto equipIter = fReadoutMap.find(equipmentId); if (equipIter != fReadoutMap.end()) { - if (elinkId < equipIter->second.size()) { result = equipIter->second.at(elinkId); } + if (elinkId < equipIter->second.size()) { + result = equipIter->second.at(elinkId); + } } return result; } @@ -63,7 +64,9 @@ namespace cbm::algo::much if (equipIter != fMaskMap.end()) { auto elinkMap = equipIter->second; auto elinkIter = elinkMap.find(elinkId); - if (elinkIter != elinkMap.end()) { result = elinkIter->second; } + if (elinkIter != elinkMap.end()) { + result = elinkIter->second; + } } return result; } @@ -146,7 +149,9 @@ namespace cbm::algo::much // Apply channel mask if (maskedaddr.count(address)) { std::vector<bool>& chanMask = fMaskMap[equipment][elink]; - if (chanMask.empty()) { chanMask.resize(numChanPerAsic, false); } + if (chanMask.empty()) { + chanMask.resize(numChanPerAsic, false); + } chanMask[channel] = true; } } //# channel @@ -196,7 +201,8 @@ namespace cbm::algo::much // Channel flip in stsXYTER v2.1 : 0<->1, 2<->3, 3<->4 and so on... auto fiFlag = 1; //! Switch to smx2.0/smx2.1 data-> fiFlag = 0 for 2.0 and fiFlag = 1 for 2.1 if (fiFlag == 1) { - if (usChan % 2 == 0) usChan = usChan + 1; + if (usChan % 2 == 0) + usChan = usChan + 1; else usChan = usChan - 1; } diff --git a/algo/detectors/much/ReadoutConfig.h b/algo/detectors/much/ReadoutConfig.h index 56f80e5693c4d665d32d5095f42456a207fb4111..ca640f2184482cecf278be4fe4fff9eaf62bb368 100644 --- a/algo/detectors/much/ReadoutConfig.h +++ b/algo/detectors/much/ReadoutConfig.h @@ -14,7 +14,7 @@ namespace cbm::algo::much { class ReadoutConfig { - public: + public: /** @brief Constructor **/ ReadoutConfig(); @@ -46,7 +46,7 @@ namespace cbm::algo::much */ std::vector<bool> MaskMap(uint16_t equipId, uint16_t elink); - private: + private: // --- MUCH readout map // --- Map index: (equipment, elink, channel), map value: (MUCH address) std::map<uint16_t, std::vector<std::vector<uint32_t>>> fReadoutMap = {}; diff --git a/algo/detectors/much/Unpack.cxx b/algo/detectors/much/Unpack.cxx index 0c9c4f7bb5ab60340e18ee833bd90c0ce463222f..58350fecf4dbac5afddd9e27cf2eb312ab82e8a5 100644 --- a/algo/detectors/much/Unpack.cxx +++ b/algo/detectors/much/Unpack.cxx @@ -4,14 +4,13 @@ #include "Unpack.h" +#include "StsXyterMessage.h" + #include <cassert> +#include <cmath> #include <utility> #include <vector> -#include <cmath> - -#include "StsXyterMessage.h" - using std::unique_ptr; using std::vector; @@ -113,7 +112,9 @@ namespace cbm::algo::much uint16_t channel = message.GetHitChannel(); // --- Check for masked channel - if (!elinkPar.fChanMask.empty() && elinkPar.fChanMask[channel] == true) { return; } + if (!elinkPar.fChanMask.empty() && elinkPar.fChanMask[channel] == true) { + return; + } uint32_t address = (elinkPar.fAddress)[channel]; diff --git a/algo/detectors/much/Unpack.h b/algo/detectors/much/Unpack.h index 57db012db431fa32bc662301a616e482d9181560..0475a7269080c8f664b4aef402e761b0d45c9807 100644 --- a/algo/detectors/much/Unpack.h +++ b/algo/detectors/much/Unpack.h @@ -7,8 +7,8 @@ #include "CbmMuchDigi.h" - #include "MicrosliceDescriptor.hpp" +#include "StsXyterMessage.h" #include "Timeslice.hpp" #include <cassert> @@ -18,8 +18,6 @@ #include <sstream> #include <vector> -#include "StsXyterMessage.h" - namespace cbm::algo::much { @@ -81,16 +79,16 @@ namespace cbm::algo::much **/ class Unpack { - public: + public: typedef std::pair<std::vector<CbmMuchDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution @@ -107,7 +105,7 @@ namespace cbm::algo::much **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: // datatypes + private: // datatypes struct TimeSpec { uint64_t currentTsTime = 0; ///< Unix time of timeslice in units of epoch length uint64_t currentCycle = 0; ///< Current epoch cycle @@ -116,7 +114,7 @@ namespace cbm::algo::much }; - private: // methods + private: // methods /** @brief Process a hit message ** @param message SMX message (32-bit word) ** @param digiVec Vector to append the created digi to @@ -131,7 +129,7 @@ namespace cbm::algo::much void ProcessTsmsbMessage(const stsxyter::Message& message, TimeSpec& time) const; - private: // members + private: // members UnpackPar fParams = {}; ///< Parameter container /** Number of TS_MSB epochs per cycle **/ diff --git a/algo/detectors/rich/ReadoutConfig.cxx b/algo/detectors/rich/ReadoutConfig.cxx index 493e40e94637964ab127f45342d46135cd67e800..4f354a9e032308eb623692da6cc6260ee9067922 100644 --- a/algo/detectors/rich/ReadoutConfig.cxx +++ b/algo/detectors/rich/ReadoutConfig.cxx @@ -326,7 +326,9 @@ namespace cbm::algo::rich auto elinkMap = equipIter->second; auto elinkIter = elinkMap.find(address); if (elinkIter != elinkMap.end()) { - if (chan < elinkIter->second.size()) { result = elinkIter->second.at(chan); } + if (chan < elinkIter->second.size()) { + result = elinkIter->second.at(chan); + } } } return result; @@ -338,7 +340,9 @@ namespace cbm::algo::rich { std::map<uint32_t, std::vector<double>> result; auto equipIter = fReadoutMap.find(equipmentId); - if (equipIter != fReadoutMap.end()) { result = equipIter->second; } + if (equipIter != fReadoutMap.end()) { + result = equipIter->second; + } return result; } // ------------------------------------------------------------------------------------ diff --git a/algo/detectors/rich/ReadoutConfig.h b/algo/detectors/rich/ReadoutConfig.h index a18e0d469e0cba6314bb4511130a63799337f8fe..2b1e210ea8e9479738c56ff44d33d875b14def33 100644 --- a/algo/detectors/rich/ReadoutConfig.h +++ b/algo/detectors/rich/ReadoutConfig.h @@ -27,7 +27,7 @@ namespace cbm::algo::rich class ReadoutConfig { - public: + public: /** @brief Constructor **/ ReadoutConfig(); @@ -74,7 +74,7 @@ namespace cbm::algo::rich std::string PrintReadoutMap(); - private: + private: // --- RICH readout map // --- Map index: (equipment, trb address, channel), map value: (tot shift) std::map<uint16_t, std::map<uint32_t, std::vector<double>>> fReadoutMap = {}; //! diff --git a/algo/detectors/rich/Unpack.cxx b/algo/detectors/rich/Unpack.cxx index c3b5d5a10d6640eea13a60290c8c873c1458c494..684edd3704af546e40618a7c5a196d7de1ef92a0 100644 --- a/algo/detectors/rich/Unpack.cxx +++ b/algo/detectors/rich/Unpack.cxx @@ -4,10 +4,10 @@ #include "Unpack.h" -#include <cstdint> - #include "AlgoFairloggerCompat.h" +#include <cstdint> + namespace cbm::algo::rich { // ---- Algorithm execution --------------------------------------------- @@ -102,14 +102,18 @@ namespace cbm::algo::rich if (((subSubEventId >> 12) & 0xF) != 0x7) { // catch invalid ids ctx.monitor.fNumErrInvalidHubId++; } - if (totalSize == hubSize) { ctx.monitor.fNumErrInvalidHubSize++; } + if (totalSize == hubSize) { + ctx.monitor.fNumErrInvalidHubSize++; + } ProcessSubSubEvent(reader, subSubEventSize, subSubEventId, ctx); ctx.currentSubSubEvent++; } } //last event ist expected to be CTS - if (totalSize != hubSize || !isLast) { ctx.monitor.fNumErrInvalidHubSize++; } + if (totalSize != hubSize || !isLast) { + ctx.monitor.fNumErrInvalidHubSize++; + } subSubEventSize = ProcessCtsHeader(reader, subSubEventSize, subSubEventId); ProcessSubSubEvent(reader, subSubEventSize, subSubEventId, ctx); @@ -122,7 +126,9 @@ namespace cbm::algo::rich if (reader.IsNextPadding()) word = reader.NextWord(); break; } - if (lastWordsCounter >= 7) { ctx.monitor.fNumErrExcessLastWords++; } + if (lastWordsCounter >= 7) { + ctx.monitor.fNumErrExcessLastWords++; + } } } @@ -172,11 +178,15 @@ namespace cbm::algo::rich } // First word is expected to be of type "header" - if (GetTdcWordType(reader.NextWord()) != TdcWordType::Header) { ctx.monitor.fNumErrInvalidFirstMessage++; } + if (GetTdcWordType(reader.NextWord()) != TdcWordType::Header) { + ctx.monitor.fNumErrInvalidFirstMessage++; + } // Second word is expected to be of type "epoch" uint32_t word = reader.NextWord(); - if (GetTdcWordType(word) != TdcWordType::Epoch) { ctx.monitor.fNumErrInvalidSecondMessage++; } + if (GetTdcWordType(word) != TdcWordType::Epoch) { + ctx.monitor.fNumErrInvalidSecondMessage++; + } else { epoch = ProcessEpoch(word); } @@ -215,7 +225,9 @@ namespace cbm::algo::rich } // Last word is expected to be of type "trailer" - if (GetTdcWordType(reader.NextWord()) != TdcWordType::Trailer) { ctx.monitor.fNumErrInvalidLastMessage++; } + if (GetTdcWordType(reader.NextWord()) != TdcWordType::Trailer) { + ctx.monitor.fNumErrInvalidLastMessage++; + } } // ---- ProcessTimeDataWord ---- @@ -231,7 +243,9 @@ namespace cbm::algo::rich (ctx.cbmTimePacket - ctx.cbmTimeMS) * 25.0; // offset of SubTrigger to MS start in ns const double fullTimeCorr = dT - ctx.mbsCorr + subtrigOffset; - if (td.fChannel < 1 || td.fChannel >= raisingTime.size()) { ctx.monitor.fNumErrChannelOutOfBounds++; } + if (td.fChannel < 1 || td.fChannel >= raisingTime.size()) { + ctx.monitor.fNumErrChannelOutOfBounds++; + } if (td.fIsRisingEdge) { // always store the latest raising edge. It means that in case RRFF situation only middle RF will be matched. raisingTime[td.fChannel] = fullTimeCorr; @@ -285,7 +299,9 @@ namespace cbm::algo::rich if (tdcTimeDataMarker == 0x1) { // TODO: I also include tdcMarker == 0x5, some tdc time data words have this marker. Is it correct? - if (tdcMarker == 0x4 || tdcMarker == 0x5) { return TdcWordType::TimeData; } + if (tdcMarker == 0x4 || tdcMarker == 0x5) { + return TdcWordType::TimeData; + } else { return TdcWordType::Error; } diff --git a/algo/detectors/rich/Unpack.h b/algo/detectors/rich/Unpack.h index b741a56f697f93f8995fa5b505eeca4d7f1ae937..ff77dc736e39cd9a47ab7843c914175258b66cf1 100644 --- a/algo/detectors/rich/Unpack.h +++ b/algo/detectors/rich/Unpack.h @@ -6,7 +6,7 @@ #define CBM_ALGO_RICH_UNPACK_H #include "CbmRichDigi.h" - +#include "Definitions.h" #include "Timeslice.hpp" #include <cstddef> @@ -16,8 +16,6 @@ #include <sstream> #include <utility> -#include "Definitions.h" - namespace cbm::algo::rich { class MicrosliceReader; @@ -101,16 +99,16 @@ namespace cbm::algo::rich class Unpack { - public: + public: typedef std::pair<std::vector<CbmRichDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution @@ -127,7 +125,7 @@ namespace cbm::algo::rich **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: + private: struct MSContext { u64 cbmTimeMS = 0; // CbmTime of MS. Used to get time offset of subtriggers to MS start u64 cbmTimePacket = 0; @@ -149,7 +147,7 @@ namespace cbm::algo::rich UnpackMonitorData monitor; }; - private: + private: void ProcessTrbPacket(MicrosliceReader& reader, MSContext& ctx) const; void ProcessHubBlock(MicrosliceReader& reader, MSContext& ctx) const; @@ -179,7 +177,7 @@ namespace cbm::algo::rich bool CheckMaskedDiRICH(int32_t subSubEventId) const; - private: + private: UnpackPar fParams = {}; ///< Parameter container std::vector<int32_t> fMaskedDiRICHes; @@ -199,14 +197,14 @@ namespace cbm::algo::rich class MicrosliceReader { - private: + private: const uint8_t* fData = nullptr; size_t fSize = 0; size_t fOffset = 0; // offset in bytes size_t fWordCounter = 0; uint32_t fCurWord = 0; - public: + public: void SetData(const uint8_t* data, size_t size) { fData = data; diff --git a/algo/detectors/sts/Hitfinder.cxx b/algo/detectors/sts/Hitfinder.cxx index e3da2f0e654e5833362e231e363926d2d350b43e..dd85d750b65eec4df000c02a6d1d37edd95cbf62 100644 --- a/algo/detectors/sts/Hitfinder.cxx +++ b/algo/detectors/sts/Hitfinder.cxx @@ -142,7 +142,9 @@ XPU_D void sts::Hitfinder::FindClustersParallel(FindClusters::context& ctx) cons { const i32 iGThread = ctx.block_dim_x() * ctx.block_idx_x() + ctx.thread_idx_x(); const i32 nDigisTotal = digiOffsetPerModule[2 * nModules]; - if (iGThread >= nDigisTotal) { return; }; + if (iGThread >= nDigisTotal) { + return; + }; i32 iModule = 0; while (size_t(iGThread) >= digiOffsetPerModule[iModule + 1]) { @@ -177,7 +179,9 @@ XPU_D void sts::Hitfinder::FindClustersParallel(FindClusters::context& ctx) cons u32 end = nextChannelEnd; while (start < end) { u32 mid = (start + end) / 2; - if (float(digis[mid].GetTimeU32()) < firstPossibleTime) { start = mid + 1; } + if (float(digis[mid].GetTimeU32()) < firstPossibleTime) { + start = mid + 1; + } else { end = mid; } @@ -190,10 +194,14 @@ XPU_D void sts::Hitfinder::FindClustersParallel(FindClusters::context& ctx) cons // This should never happen? if (myDigi.GetChannel() >= otherDigi.GetChannel()) continue; - if (float(myDigi.GetTimeU32()) + deltaT < float(otherDigi.GetTimeU32())) { break; } + if (float(myDigi.GetTimeU32()) + deltaT < float(otherDigi.GetTimeU32())) { + break; + } // This check is not necessary? We already found the first possible digi via binary search... - if (float(myDigi.GetTimeU32()) - deltaT > float(otherDigi.GetTimeU32())) { continue; } + if (float(myDigi.GetTimeU32()) - deltaT > float(otherDigi.GetTimeU32())) { + continue; + } // How to handle noise? Digis in same channel within a small time window of the previous digi are discarded by old cluster finder @@ -280,7 +288,7 @@ XPU_D void sts::Hitfinder::CreateClusterFromConnectors1(int const iModule, CbmSt const float timeError = asic.timeResolution; - sts::Cluster cluster { + sts::Cluster cluster{ .fCharge = asic.AdcToCharge(digi.GetChargeU16()), .fSize = 1, .fPosition = float(digi.GetChannel()) + (IsBackside(iModule) ? nChannels : 0.f), @@ -311,7 +319,9 @@ XPU_D void sts::Hitfinder::CreateClusterFromConnectors2(int const iModule, CbmSt float q2 = asic.AdcToCharge(digi2.GetChargeU16()); // Periodic position for clusters round the edge - if (digi1.GetChannel() > digi2.GetChannel()) { x1 -= float(nChannels); } + if (digi1.GetChannel() > digi2.GetChannel()) { + x1 -= float(nChannels); + } // Uncertainties of the charge measurements float width1 = LandauWidth(q1); @@ -327,7 +337,9 @@ XPU_D void sts::Hitfinder::CreateClusterFromConnectors2(int const iModule, CbmSt float x = x1 + 0.5f + (q2 - q1) / 3.f / xpu::max(q1, q2); // Correct negative position for clusters around the edge - if (x < -0.5f) { x += float(nChannels); } + if (x < -0.5f) { + x += float(nChannels); + } // Uncertainty on cluster position. See software note. float ex0sq = 0.f; @@ -350,7 +362,7 @@ XPU_D void sts::Hitfinder::CreateClusterFromConnectors2(int const iModule, CbmSt if (IsBackside(iModule)) x += nChannels; - sts::Cluster cls { + sts::Cluster cls{ .fCharge = charge, .fSize = 2, .fPosition = x, @@ -424,7 +436,9 @@ XPU_D void sts::Hitfinder::CreateClusterFromConnectorsN(int iModule, CbmStsDigi* float x = 0.5f * (float(cProps.chanF + cProps.chanL) + (cProps.qL - cProps.qF) / cProps.qM); // Correct negative cluster position for clusters round the edge - if (x < -0.5f) { x += float(nChannels); } + if (x < -0.5f) { + x += float(nChannels); + } // Cluster position error float exFsq = cProps.eqFsq / cProps.qM / cProps.qM / 4.f; // error from first charge @@ -434,11 +448,15 @@ XPU_D void sts::Hitfinder::CreateClusterFromConnectorsN(int iModule, CbmStsDigi* float xError = xpu::sqrt(exFsq + exMsq + exLsq); // Correction for corrupt clusters - if (x < cProps.chanF || x > cProps.chanL) { x = cProps.xSum / qSum; } + if (x < cProps.chanF || x > cProps.chanL) { + x = cProps.xSum / qSum; + } - if (IsBackside(iModule)) { x += nChannels; } + if (IsBackside(iModule)) { + x += nChannels; + } - sts::Cluster cls { + sts::Cluster cls{ .fCharge = qSum, .fSize = int(nDigis), .fPosition = x, @@ -464,10 +482,10 @@ XPU_D void sts::Hitfinder::SortClusters(SortClusters::context& ctx) const } for (int iModule = firstModule; iModule <= lastModule; iModule++) { - size_t offset = iModule * maxClustersPerModule; - ClusterIdx* clusterIdx = &clusterIdxPerModule[offset]; - ClusterIdx* clusterIdxTmp = &clusterIdxPerModuleTmp[offset]; - int nClusters = nClustersPerModule[iModule]; + size_t offset = iModule * maxClustersPerModule; + ClusterIdx* clusterIdx = &clusterIdxPerModule[offset]; + ClusterIdx* clusterIdxTmp = &clusterIdxPerModuleTmp[offset]; + int nClusters = nClustersPerModule[iModule]; // if (nClusters == 0 && ctx.thread_idx_x() == 0) { // printf("Module %d: No clusters found, exit early\n", iModule); @@ -567,7 +585,9 @@ XPU_D void sts::Hitfinder::FindHits(FindHits::context& ctx) const int end = nClustersB; while (end - start > 1) { int mid = (start + end) / 2; - if (float(clusterIdxB[mid].fTime) < firstPossibleTime) { start = mid; } + if (float(clusterIdxB[mid].fTime) < firstPossibleTime) { + start = mid; + } else { end = mid; } @@ -631,7 +651,9 @@ XPU_D void sts::Hitfinder::IntersectClusters(int iBlock, const HitfinderCache& p float dv = exB * xpu::cos(xpu::deg_to_rad() * pars.stereoB); // // --- Should be inside active area - if (xF < 0.f || xF > pars.dX || xB < 0.f || xB > pars.dX) { return; } + if (xF < 0.f || xF > pars.dX || xB < 0.f || xB > pars.dX) { + return; + } // // --- Calculate number of line segments due to horizontal // // --- cross-connection. If x(y=0) does not fall on the bottom edge, @@ -783,7 +805,7 @@ XPU_D void sts::Hitfinder::CreateHit(int iModule, float xLocal, float yLocal, fl float etB = clsB.fTimeError; float hitTimeError = 0.5f * xpu::sqrt(etF * etF + etB * etB); - sts::Hit hit { + sts::Hit hit{ .fX = globalX, .fY = globalY, .fZ = globalZ, diff --git a/algo/detectors/sts/Hitfinder.h b/algo/detectors/sts/Hitfinder.h index d7760f32964194b709b4fc6a2d89b996999af251..f254afb0b0b71168e24b519a505a13a8aa035791 100644 --- a/algo/detectors/sts/Hitfinder.h +++ b/algo/detectors/sts/Hitfinder.h @@ -6,10 +6,6 @@ #define CBM_ALGO_STS_HITFINDER_H #include "CbmStsDigi.h" - -#include <xpu/device.h> -#include <xpu/host.h> // Required for xpu::timings on monitoring struct. Move to separate header? - #include "Definitions.h" #include "gpu/DeviceImage.h" #include "gpu/Params.h" @@ -17,6 +13,9 @@ #include "sts/Hit.h" #include "sts/HitfinderPars.h" +#include <xpu/device.h> +#include <xpu/host.h> // Required for xpu::timings on monitoring struct. Move to separate header? + namespace cbm::algo { @@ -158,12 +157,12 @@ namespace cbm::algo::sts }; class DigiConnector { - private: + private: unsigned int hasPreviousAndNext; XPU_D unsigned int UnpackNext(unsigned int val) const { return val & ~(1u << 31); } - public: + public: XPU_D bool HasPrevious() const { return (hasPreviousAndNext >> 31) & 1u; } XPU_D void SetHasPrevious(bool hasPrevious) @@ -199,7 +198,7 @@ namespace cbm::algo::sts // Hitfinder class. Holds pointers to buffers + algorithm. class Hitfinder { - public: + public: // calibration / configuration data // Only set once @@ -301,7 +300,7 @@ namespace cbm::algo::sts size_t hitsFlatCapacity; xpu::buffer<sts::Hit> hitsFlat; - public: + public: XPU_D void SortDigisInSpaceAndTime(SortDigis::context&) const; XPU_D void FindClustersSingleStep(FindClusters::context&) const; XPU_D void SortClusters(SortClusters::context&) const; @@ -312,7 +311,7 @@ namespace cbm::algo::sts XPU_D void FindClustersParallel(FindClusters::context&) const; XPU_D void CalculateClustersParallel(FindClusters::context&) const; - private: + private: XPU_D void CalculateChannelOffsets(FindClusters::context& ctx, CbmStsDigi* digis, unsigned int* channelOffsets, unsigned int nDigis) const; @@ -329,7 +328,7 @@ namespace cbm::algo::sts XPU_D void CreateClusterFromConnectorsN(int const iModule, CbmStsDigi* digis, DigiConnector* digiConnector, int const digiIndex) const; - private: + private: XPU_D unsigned int GetNDigis(int iModule) const { return digiOffsetPerModule[iModule + 1] - digiOffsetPerModule[iModule]; @@ -340,7 +339,9 @@ namespace cbm::algo::sts XPU_D bool IsActive(int* channelStatus, int channel) const { // TODO add padding to channels to remove this? - if (channel < 0 || channel >= nChannels) { return false; } + if (channel < 0 || channel >= nChannels) { + return false; + } return channelStatus[channel] > -1; } @@ -367,7 +368,7 @@ namespace cbm::algo::sts return; } - ClusterIdx idx {time, pos}; + ClusterIdx idx{time, pos}; tgtIdx[idx.fIdx] = idx; tgtData[idx.fIdx] = cls; } @@ -391,10 +392,12 @@ namespace cbm::algo::sts XPU_D void SaveMaxError(float errorValue, int iModule) const { float* maxError = &maxClusterTimeErrorByModuleSide[iModule]; - float old {}; + float old{}; do { old = *maxError; - if (old >= errorValue) { break; } + if (old >= errorValue) { + break; + } } while (!xpu::atomic_cas_block(maxError, *maxError, xpu::max(errorValue, *maxError))); } }; diff --git a/algo/detectors/sts/HitfinderChain.cxx b/algo/detectors/sts/HitfinderChain.cxx index 65ade190e78beb3fa2e497afefab8d38a5406579..14e9737386996fec412a4758f18b56ac103cfe1b 100644 --- a/algo/detectors/sts/HitfinderChain.cxx +++ b/algo/detectors/sts/HitfinderChain.cxx @@ -4,13 +4,13 @@ #include "HitfinderChain.h" -#include <log.hpp> -#include <numeric> - #include "Exceptions.h" #include "PODVector.h" #include "compat/OpenMP.h" +#include <log.hpp> +#include <numeric> + using namespace cbm::algo; void sts::HitfinderChain::SetParameters(const HitfinderChainPars& parameters) @@ -33,7 +33,9 @@ void sts::HitfinderChain::SetParameters(const HitfinderChainPars& parameters) fmt::format("STS Hitfinder Chain: Unknown allocation mode: {}", ToString(memoryPars.allocationMode))); } - if (memoryPars.IsStatic()) { AllocateDynamic(memoryPars.maxNDigisPerModule, memoryPars.maxNDigisPerTS); } + if (memoryPars.IsStatic()) { + AllocateDynamic(memoryPars.maxNDigisPerModule, memoryPars.maxNDigisPerTS); + } } void sts::HitfinderChain::Finalize() @@ -53,14 +55,15 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS size_t nModules = fPars->setup.modules.size(); size_t nModuleSides = nModules * 2; - size_t nDigisTotal = digis.size(); + size_t nDigisTotal = digis.size(); // Getting the digis on the GPU requires 3 steps // 1. Sort digis into buckets by module DigiMap digiMap = CountDigisPerModules(digis); // 2. Once we know number of digis per module, we can allocate // the dynamic buffers on the gpu, as the buffer sizes depend on that value - if (fPars->memory.IsDynamic()) AllocateDynamic(digiMap.maxNDigisPerModule, nDigisTotal); + if (fPars->memory.IsDynamic()) + AllocateDynamic(digiMap.maxNDigisPerModule, nDigisTotal); else { if (digiMap.maxNDigisPerModule > fPars->memory.maxNDigisPerModule) { throw ProcessingError("STS Hitfinder Chain: Too many digis per module for static allocation: {} > {}", @@ -130,7 +133,9 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS } L_(debug) << "STS Hitfinder Chain: Find Clusters..."; - if (!Params().sts.findClustersMultiKernels) { queue.launch<FindClusters>(xpu::n_blocks(nModuleSides)); } + if (!Params().sts.findClustersMultiKernels) { + queue.launch<FindClusters>(xpu::n_blocks(nModuleSides)); + } else { queue.launch<ChannelOffsets>(xpu::n_blocks(nModuleSides)); xpu::k_add_bytes<ChannelOffsets>(nDigisTotal * sizeof(CbmStsDigi)); @@ -141,7 +146,7 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS } if (Opts().LogLevel() == trace) { L_(trace) << "Ensuring STS channel offsets correct..."; - xpu::buffer_prop propsOffset {hfc.channelOffsetPerModule}; + xpu::buffer_prop propsOffset{hfc.channelOffsetPerModule}; std::vector<u32> channelOffsetPerModule; channelOffsetPerModule.resize(propsOffset.size()); queue.copy(hfc.channelOffsetPerModule.get(), channelOffsetPerModule.data(), propsOffset.size_bytes()); @@ -149,7 +154,7 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS EnsureChannelOffsets(channelOffsetPerModule); L_(trace) << "Ensuring STS clusters are ok..."; - xpu::buffer_prop props {hfc.clusterIdxPerModule}; + xpu::buffer_prop props{hfc.clusterIdxPerModule}; std::vector<ClusterIdx> clusterIdxPerModule; clusterIdxPerModule.resize(props.size()); @@ -237,15 +242,15 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS size_t nHitsTotal = std::accumulate(nHits.begin(), nHits.end(), 0); L_(info) << "Timeslice contains " << nHitsTotal << " STS hits and " << nClustersTotal << " STS clusters"; - new (&monitor[0]) sts::HitfinderMonitor {}; + new (&monitor[0]) sts::HitfinderMonitor{}; monitor[0].fTime = xpu::pop_timer(); // TODO use xpu::scoped_timer instead monitor[0].fNumClusterTotal = nClustersTotal; monitor[0].fNumHitsTotal = nHitsTotal; Result result; - result.hits = std::move(hits); + result.hits = std::move(hits); result.clusters = std::move(clusters); - result.monitor = monitor[0]; + result.monitor = monitor[0]; return result; } diff --git a/algo/detectors/sts/HitfinderChain.h b/algo/detectors/sts/HitfinderChain.h index 891a3d618738bc7b9dd9adb822f364e0e3140cb1..cb40433a7ad1947c3bcfaf49c2e33cc0bfc9c55f 100644 --- a/algo/detectors/sts/HitfinderChain.h +++ b/algo/detectors/sts/HitfinderChain.h @@ -6,14 +6,6 @@ #define CBM_ALGO_STS_HITFINDER_CHAIN_H #include "CbmStsDigi.h" - -#include <array> -#include <cstdint> -#include <gsl/span> -#include <map> -#include <optional> -#include <vector> - #include "PartitionedSpan.h" #include "PartitionedVector.h" #include "SubChain.h" @@ -22,6 +14,13 @@ #include "sts/HitfinderPars.h" #include "sts/LandauTable.h" +#include <array> +#include <cstdint> +#include <gsl/span> +#include <map> +#include <optional> +#include <vector> + namespace cbm::algo::sts { @@ -38,7 +37,7 @@ namespace cbm::algo::sts */ class HitfinderChain : public SubChain { - public: + public: struct Result { PartitionedSpan<sts::Hit> hits; PartitionedVector<sts::Cluster> clusters; @@ -55,7 +54,7 @@ namespace cbm::algo::sts Result operator()(gsl::span<const CbmStsDigi>, bool storeClusters = false); - private: + private: static constexpr u16 InvalidModule = 0xFFFF; struct DigiMap { diff --git a/algo/detectors/sts/ReadoutConfig.cxx b/algo/detectors/sts/ReadoutConfig.cxx index fa33f79c344aab481b78cd03be1ace84ed21ad39..906158d5b110b3acd92f35bf807ee8c8c4704f02 100644 --- a/algo/detectors/sts/ReadoutConfig.cxx +++ b/algo/detectors/sts/ReadoutConfig.cxx @@ -109,10 +109,12 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config) // --- Mapping (equimentId, elink) -> (address, ASIC) -------------------------------- sts::ReadoutConfig::Entry sts::ReadoutConfig::Map(uint16_t equipmentId, uint16_t elinkId) { - Entry result {-1, 0, false}; + Entry result{-1, 0, false}; auto equipIter = fReadoutConfig.find(equipmentId); if (equipIter != fReadoutConfig.end()) { - if (elinkId < equipIter->second.size()) { result = equipIter->second.at(elinkId); } + if (elinkId < equipIter->second.size()) { + result = equipIter->second.at(elinkId); + } } return result; } diff --git a/algo/detectors/sts/ReadoutConfig.h b/algo/detectors/sts/ReadoutConfig.h index 7328fd32b604f64acb4e1a7b834c16a5ce4cc03a..e7a3e6c7e3b75f532988e5df63d049f9f2a3e576 100644 --- a/algo/detectors/sts/ReadoutConfig.h +++ b/algo/detectors/sts/ReadoutConfig.h @@ -4,13 +4,13 @@ #ifndef CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H #define CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H +#include "Definitions.h" +#include "config/Property.h" + #include <map> #include <string> #include <vector> -#include "Definitions.h" -#include "config/Property.h" - namespace cbm::algo::sts { @@ -82,7 +82,7 @@ namespace cbm::algo::sts **/ class ReadoutConfig { - public: + public: struct Entry { i32 moduleAddress; u16 asicNumber; @@ -121,7 +121,7 @@ namespace cbm::algo::sts /** @brief Debug output of readout map **/ std::string PrintReadoutMap(); - private: + private: // --- STS readout map // --- Map index: (equipment, elink) std::map<u16, std::vector<Entry>> fReadoutConfig = {}; //! diff --git a/algo/detectors/sts/ReadoutConfigLegacy.cxx b/algo/detectors/sts/ReadoutConfigLegacy.cxx index 23eab32e2c484bca26134ea1c02dedf5d202c694..8ea1929ae15ded18460649337a0645530a4e2477 100644 --- a/algo/detectors/sts/ReadoutConfigLegacy.cxx +++ b/algo/detectors/sts/ReadoutConfigLegacy.cxx @@ -189,7 +189,9 @@ namespace cbm::algo::sts const uint32_t chanInFeb = chan + numChanPerAsic * asicInFeb; if (mask.count(chanInFeb)) { std::vector<bool>& chanMask = fMaskMap[equipment][elink]; - if (chanMask.empty()) { chanMask.resize(numChanPerAsic, false); } + if (chanMask.empty()) { + chanMask.resize(numChanPerAsic, false); + } chanMask[chan] = true; } } @@ -197,7 +199,9 @@ namespace cbm::algo::sts // Set min adc cut auto febIt = febAdcCuts.find(febId); - if (febIt != febAdcCuts.end()) { fAdcCutMap[equipment][elink] = febIt->second; } + if (febIt != febAdcCuts.end()) { + fAdcCutMap[equipment][elink] = febIt->second; + } } } fReadoutMap[equipment][elink] = std::make_pair(moduleAddress, asicInModule); @@ -216,7 +220,9 @@ namespace cbm::algo::sts std::pair<int32_t, uint16_t> result(-1, 0); auto equipIter = fReadoutMap.find(equipmentId); if (equipIter != fReadoutMap.end()) { - if (elinkId < equipIter->second.size()) { result = equipIter->second.at(elinkId); } + if (elinkId < equipIter->second.size()) { + result = equipIter->second.at(elinkId); + } } return result; } @@ -229,7 +235,9 @@ namespace cbm::algo::sts std::vector<double> result; auto modIter = fWalkMap.find(modAddress); if (modIter != fWalkMap.end()) { - if (asic < modIter->second.size()) { result = modIter->second.at(asic); } + if (asic < modIter->second.size()) { + result = modIter->second.at(asic); + } } return result; } @@ -244,7 +252,9 @@ namespace cbm::algo::sts if (equipIter != fMaskMap.end()) { auto elinkMap = equipIter->second; auto elinkIter = elinkMap.find(elinkId); - if (elinkIter != elinkMap.end()) { result = elinkIter->second; } + if (elinkIter != elinkMap.end()) { + result = elinkIter->second; + } } return result; } @@ -259,7 +269,9 @@ namespace cbm::algo::sts if (equipIter != fAdcCutMap.end()) { auto elinkMap = equipIter->second; auto elinkIter = elinkMap.find(elinkId); - if (elinkIter != elinkMap.end()) { result = elinkIter->second; } + if (elinkIter != elinkMap.end()) { + result = elinkIter->second; + } } return result; } diff --git a/algo/detectors/sts/ReadoutConfigLegacy.h b/algo/detectors/sts/ReadoutConfigLegacy.h index df7e0bb8878b3a8518f3e53b5a3a54c337f56533..99d65f179e3938cf4e22a926f664eec80ccc1507 100644 --- a/algo/detectors/sts/ReadoutConfigLegacy.h +++ b/algo/detectors/sts/ReadoutConfigLegacy.h @@ -31,7 +31,7 @@ namespace cbm::algo::sts class ReadoutConfigLegacy { - public: + public: /** @brief Constructor **/ ReadoutConfigLegacy(); @@ -95,7 +95,7 @@ namespace cbm::algo::sts std::string PrintReadoutMap(); - private: + private: // --- STS readout map // --- Map index: (equipment, elink), map value: (module address, ASIC number in module) std::map<uint16_t, std::vector<std::pair<int32_t, uint16_t>>> fReadoutMap = {}; //! diff --git a/algo/detectors/sts/Unpack.cxx b/algo/detectors/sts/Unpack.cxx index 825bdd1ee1b7aeec740fe330d7d9e5b3234fab21..7602d592a58879881441cb1da7d2884ffb1a7ee0 100644 --- a/algo/detectors/sts/Unpack.cxx +++ b/algo/detectors/sts/Unpack.cxx @@ -4,14 +4,13 @@ #include "Unpack.h" +#include "StsXyterMessage.h" + #include <cassert> +#include <cmath> #include <utility> #include <vector> -#include <cmath> - -#include "StsXyterMessage.h" - using std::unique_ptr; using std::vector; @@ -109,10 +108,14 @@ namespace cbm::algo::sts uint32_t asicNr = elinkPar.fAsicNr; // --- Check minimum adc cut - if (message.GetHitAdc() <= elinkPar.fAdcMinCut) { return; } + if (message.GetHitAdc() <= elinkPar.fAdcMinCut) { + return; + } // --- Check for masked channel - if (!elinkPar.fChanMask.empty() && elinkPar.fChanMask[message.GetHitChannel()] == true) { return; } + if (!elinkPar.fChanMask.empty() && elinkPar.fChanMask[message.GetHitChannel()] == true) { + return; + } // --- Hardware-to-software address uint32_t channel = 0; diff --git a/algo/detectors/sts/Unpack.h b/algo/detectors/sts/Unpack.h index a7578227ab8490927447d789de0a2b13cd262a8e..ec476c55618e91f44daba8333fe3593b38abcbb0 100644 --- a/algo/detectors/sts/Unpack.h +++ b/algo/detectors/sts/Unpack.h @@ -6,8 +6,9 @@ #define CBM_ALGO_UNPACKSTS_H 1 #include "CbmStsDigi.h" - +#include "Definitions.h" #include "MicrosliceDescriptor.hpp" +#include "StsXyterMessage.h" #include "Timeslice.hpp" #include <cassert> @@ -16,9 +17,6 @@ #include <memory> #include <vector> -#include "Definitions.h" -#include "StsXyterMessage.h" - namespace cbm::algo::sts { @@ -86,16 +84,16 @@ namespace cbm::algo::sts **/ class Unpack { - public: + public: typedef std::pair<std::vector<CbmStsDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution @@ -112,7 +110,7 @@ namespace cbm::algo::sts **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: // types + private: // types /** * @brief Structure to hold the current time information for the current microslice */ @@ -123,7 +121,7 @@ namespace cbm::algo::sts u64 currentEpochTime = 0; ///< Current epoch time relative to timeslice in clock cycles }; - private: // methods + private: // methods /** @brief Process a hit message ** @param message SMX message (32-bit word) ** @param digiVec Vector to append the created digi to @@ -138,7 +136,7 @@ namespace cbm::algo::sts void ProcessTsmsbMessage(const stsxyter::Message& message, TimeSpec& time) const; - private: // members + private: // members UnpackPar fParams = {}; ///< Parameter container /** Number of TS_MSB epochs per cycle **/ diff --git a/algo/detectors/sts/UnpackStsXpu.cxx b/algo/detectors/sts/UnpackStsXpu.cxx index 40fee8d82d40cacac71d060ec03a5812511d3787..8c66ec04da130fff07b4a29cc7f0c161b5448bb7 100644 --- a/algo/detectors/sts/UnpackStsXpu.cxx +++ b/algo/detectors/sts/UnpackStsXpu.cxx @@ -4,14 +4,13 @@ #include "UnpackStsXpu.h" +#include "StsXyterMessage.h" + #include <cassert> +#include <cmath> #include <utility> #include <vector> -#include <cmath> - -#include "StsXyterMessage.h" - using std::unique_ptr; using std::vector; @@ -151,25 +150,25 @@ namespace cbm::algo const uint64_t numMs = messCount.size(); // --- Store SMX messages to be unpacked (TS content) - xpu::d_buffer<stsxyter::Message> tsContent {messages.size()}; + xpu::d_buffer<stsxyter::Message> tsContent{messages.size()}; xpu::copy(tsContent.d(), messages.data(), messages.size()); // --- Store auxiliary host-device buffers - xpu::hd_buffer<uint64_t> msMessCount {numMs}; //modified by kernel, stores numDigis after execution + xpu::hd_buffer<uint64_t> msMessCount{numMs}; //modified by kernel, stores numDigis after execution xpu::copy(msMessCount.d(), messCount.data(), messCount.size()); - xpu::hd_buffer<uint64_t> msMessOffset {numMs}; //unchanged but needed on device and host + xpu::hd_buffer<uint64_t> msMessOffset{numMs}; //unchanged but needed on device and host std::copy(messOffset.begin(), messOffset.end(), msMessOffset.h()); xpu::copy(msMessOffset, xpu::host_to_device); // --- Store auxiliary device buffers - xpu::d_buffer<uint64_t> msStartTime {numMs}; - xpu::d_buffer<uint32_t> msCompIdx {numMs}; + xpu::d_buffer<uint64_t> msStartTime{numMs}; + xpu::d_buffer<uint32_t> msCompIdx{numMs}; xpu::copy(msStartTime.d(), msIdx.data(), msIdx.size()); xpu::copy(msCompIdx.d(), compIdx.data(), compIdx.size()); // --- Create output buffer with maximum possible size - xpu::hd_buffer<CbmStsDigi> digisOut {messages.size()}; + xpu::hd_buffer<CbmStsDigi> digisOut{messages.size()}; // --- Current Timeslice start time in epoch units. Note that it is always a multiple of epochs // --- and the epoch is a multiple of ns. diff --git a/algo/detectors/sts/UnpackStsXpu.h b/algo/detectors/sts/UnpackStsXpu.h index 66ab4006a0876dc07a03b8926998334fb85dc5cb..d30df029fcf0dbc799609256a8d56a778358716e 100644 --- a/algo/detectors/sts/UnpackStsXpu.h +++ b/algo/detectors/sts/UnpackStsXpu.h @@ -7,9 +7,12 @@ #include "CbmStsDigi.h" - #include "MicrosliceDescriptor.hpp" +#include "ReadoutConfigLegacy.h" +#include "StsXyterMessage.h" #include "Timeslice.hpp" +#include "gpu/DeviceImage.h" +#include "gpu/xpu_legacy.h" #include <cassert> #include <cstddef> @@ -20,11 +23,6 @@ #include <xpu/device.h> #include <xpu/host.h> -#include "ReadoutConfigLegacy.h" -#include "StsXyterMessage.h" -#include "gpu/DeviceImage.h" -#include "gpu/xpu_legacy.h" - namespace cbm::algo { @@ -87,15 +85,15 @@ namespace cbm::algo **/ class UnpackStsXpu { - public: + public: typedef std::pair<std::vector<CbmStsDigi>, UnpackStsXpuMonitorData> resultType; /** @brief Default constructor **/ - UnpackStsXpu() {}; + UnpackStsXpu(){}; /** @brief Destructor **/ - ~UnpackStsXpu() {}; + ~UnpackStsXpu(){}; /** @brief Algorithm execution @@ -114,7 +112,7 @@ namespace cbm::algo xpu::hd_buffer<UnpackStsXpuPar> fParams; - private: // methods + private: // methods friend struct UnpackK; /** @brief Process a hit message @@ -140,7 +138,7 @@ namespace cbm::algo uint64_t& currentEpochTime, uint64_t& currentCycle, const uint64_t currentTsTime); - private: // members + private: // members ///// To do: Make these available on device somehow /** Number of TS_MSB epochs per cycle **/ static constexpr uint64_t fkEpochsPerCycle = stsxyter::kuTsMsbNbTsBinsBinning; diff --git a/algo/detectors/tof/Calibrate.cxx b/algo/detectors/tof/Calibrate.cxx index 0ba00227e29573c7a172c0021a9c5b092dd52bde..d61d500ee1ec3fb645c39674663dc7c9eff7f97c 100644 --- a/algo/detectors/tof/Calibrate.cxx +++ b/algo/detectors/tof/Calibrate.cxx @@ -4,11 +4,11 @@ #include "Calibrate.h" -#include <chrono> - #include "log.hpp" #include "util/TimingsFormat.h" +#include <chrono> + using namespace std; using fles::Subsystem; @@ -105,10 +105,14 @@ namespace cbm::algo::tof // linear interpolation to next bin if (dDTot > 0) { - if (iWx < rpcPar.numClWalkBinX - 1) { dWT += dDTot * (walk[iWx + 1] - walk[iWx]); } + if (iWx < rpcPar.numClWalkBinX - 1) { + dWT += dDTot * (walk[iWx + 1] - walk[iWx]); + } } else { - if (0 < iWx) { dWT -= dDTot * (walk[iWx - 1] - walk[iWx]); } + if (0 < iWx) { + dWT -= dDTot * (walk[iWx - 1] - walk[iWx]); + } } pCalDigi.SetTime(pCalDigi.GetTime() - dWT); // calibrate Digi Time } diff --git a/algo/detectors/tof/Calibrate.h b/algo/detectors/tof/Calibrate.h index fbeb793915090ef5d25cf0b739c068ddf42452bd..03b27a34bda51b647c8e1f10fb48bbf83c09641b 100644 --- a/algo/detectors/tof/Calibrate.h +++ b/algo/detectors/tof/Calibrate.h @@ -6,7 +6,7 @@ #define TOFCALIBRATE_H 1 #include "CbmTofDigi.h" - +#include "PartitionedVector.h" #include "tof/CalibrateSetup.h" #include "tof/Clusterizer.h" @@ -17,8 +17,6 @@ #include <xpu/host.h> -#include "PartitionedVector.h" - namespace cbm::algo::tof { @@ -51,7 +49,7 @@ namespace cbm::algo::tof **/ class Calibrate { - public: + public: typedef std::pair<std::vector<CbmTofDigi>, CalibrateMonitorData> resultType; /** @brief Algorithm execution @@ -65,7 +63,7 @@ namespace cbm::algo::tof /** @brief Constructor **/ explicit Calibrate(tof::CalibrateSetup params); - private: // members + private: // members /** @brief Parameters for TOF calibrator **/ tof::CalibrateSetup fSetup; diff --git a/algo/detectors/tof/CalibrateSetup.h b/algo/detectors/tof/CalibrateSetup.h index fca2b4097b9dfc1c1a9d47d67cec8bb76713b06e..79e331b3df761b873deb76edcdcc4c538672a298 100644 --- a/algo/detectors/tof/CalibrateSetup.h +++ b/algo/detectors/tof/CalibrateSetup.h @@ -4,14 +4,14 @@ #ifndef CBM_ALGO_DETECTOR_TOF_CALIBRATE_SETUP_H #define CBM_ALGO_DETECTOR_TOF_CALIBRATE_SETUP_H +#include "Definitions.h" +#include "config/Property.h" + #include <array> #include <map> #include <string> #include <vector> -#include "Definitions.h" -#include "config/Property.h" - namespace cbm::algo::tof { /** diff --git a/algo/detectors/tof/CalibratorChain.h b/algo/detectors/tof/CalibratorChain.h index 0038eed952b89a1007ebbb1ab791600e18c944f0..cca46ababcfea1e4d3e88a056016611e17e748d2 100644 --- a/algo/detectors/tof/CalibratorChain.h +++ b/algo/detectors/tof/CalibratorChain.h @@ -3,21 +3,20 @@ Authors: Dominik Smith [committer], Felix Weiglhofer */ #pragma once +#include "Calibrate.h" +#include "CalibrateSetup.h" #include "CbmTofDigi.h" +#include "SubChain.h" #include <gsl/span> #include <memory> -#include "Calibrate.h" -#include "CalibrateSetup.h" -#include "SubChain.h" - namespace cbm::algo::tof { class CalibratorChain : public SubChain { - public: + public: using ReturnType = Calibrate::resultType; CalibratorChain() = default; @@ -30,7 +29,7 @@ namespace cbm::algo::tof */ ReturnType Run(gsl::span<CbmTofDigi> digis); - private: + private: std::unique_ptr<Calibrate> fCalibrate; }; diff --git a/algo/detectors/tof/Clusterizer.cxx b/algo/detectors/tof/Clusterizer.cxx index 312cc160e54e46e64dc48cad1667da507f44bfba..c244d4ff1e6a82c7097609c933217bb93e4c6344 100644 --- a/algo/detectors/tof/Clusterizer.cxx +++ b/algo/detectors/tof/Clusterizer.cxx @@ -90,9 +90,13 @@ namespace cbm::algo::tof while (digiIt->first->GetSide() == std::next(digiIt)->first->GetSide()) { // Not one Digi of each end! digiIt++; - if (2 > std::distance(digiIt, storDigi.end())) { break; } + if (2 > std::distance(digiIt, storDigi.end())) { + break; + } + } + if (2 > std::distance(digiIt, storDigi.end())) { + break; } - if (2 > std::distance(digiIt, storDigi.end())) { break; } // 2 Digis = both sides present cell = &fParams.fChanPar[chan].cell; @@ -104,8 +108,10 @@ namespace cbm::algo::tof const double timeDif = xDigiA->GetTime() - xDigiB->GetTime(); - pos.SetY(fParams.fSigVel * timeDif * 0.5); // A is the top side, B is the bottom side - if (xDigiA->GetSide() != 1.) { pos.SetY(-pos.Y()); } // B is the bottom side, A is the top side + pos.SetY(fParams.fSigVel * timeDif * 0.5); // A is the top side, B is the bottom side + if (xDigiA->GetSide() != 1.) { + pos.SetY(-pos.Y()); + } // B is the bottom side, A is the top side while (std::distance(digiIt, storDigi.end()) > 2 && std::abs(pos.Y()) > cell->sizeY * fParams.fPosYMaxScal) { @@ -115,12 +121,18 @@ namespace cbm::algo::tof : xDigiC->GetTime() - xDigiA->GetTime(); double posYN = fParams.fSigVel * timeDifN * 0.5; - if (xDigiC->GetSide() != 1.) { posYN *= -1.; } + if (xDigiC->GetSide() != 1.) { + posYN *= -1.; + } - if (std::abs(posYN) >= std::abs(pos.Y())) { break; } + if (std::abs(posYN) >= std::abs(pos.Y())) { + break; + } pos.SetY(posYN); - if (xDigiC->GetSide() == xDigiA->GetSide()) { xDigiA = xDigiC; } + if (xDigiC->GetSide() == xDigiA->GetSide()) { + xDigiA = xDigiC; + } else { xDigiB = xDigiC; } @@ -192,12 +204,18 @@ namespace cbm::algo::tof while (fParams.fDeadStrips & (1 << chan)) { chan++; - if (chan >= numChan) { return false; } + if (chan >= numChan) { + return false; + } + } + if (chan == numChan) { + return false; } - if (chan == numChan) { return false; } inputType& storDigi = input[chan]; - if (0 == storDigi.size()) { return false; } + if (0 == storDigi.size()) { + return false; + } const double clusterTime = cluster.hitTime / cluster.weightsSum; const TofCell& cell = fParams.fChanPar[chan].cell; @@ -215,36 +233,52 @@ namespace cbm::algo::tof //Store last position in input channels to avoid unnecessary checks. //Relies on time-order to function properly. Can only be used in first-level AddNextChan() //calls, as time-order is not guaranteed in nested calls. - if (lastChanPos) { (*lastChanPos)[chan] = i1; } + if (lastChanPos) { + (*lastChanPos)[chan] = i1; + } for (; i1 < storDigi.end() - 1; i1++) { const CbmTofDigi* xDigiA = i1->first; - if (xDigiA->GetTime() > clusterTime + fParams.fdMaxTimeDist) { break; } + if (xDigiA->GetTime() > clusterTime + fParams.fdMaxTimeDist) { + break; + } auto i2 = i1; while (++i2 < storDigi.end()) { const CbmTofDigi* xDigiB = i2->first; - if (xDigiA->GetSide() == xDigiB->GetSide()) { continue; } + if (xDigiA->GetSide() == xDigiB->GetSide()) { + continue; + } const double time = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime()); //Continue if digis are in the past of cluster time - if (time <= clusterTime - fParams.fdMaxTimeDist) { continue; } + if (time <= clusterTime - fParams.fdMaxTimeDist) { + continue; + } //Break if digis are in the future of cluster time - if (time >= clusterTime + fParams.fdMaxTimeDist) { break; } + if (time >= clusterTime + fParams.fdMaxTimeDist) { + break; + } const double timeDif = xDigiA->GetTime() - xDigiB->GetTime(); double posY = fParams.fSigVel * timeDif * 0.5; //Break if position is outside of the detector - if (std::abs(posY) > cell.sizeY * fParams.fPosYMaxScal) { break; } + if (std::abs(posY) > cell.sizeY * fParams.fPosYMaxScal) { + break; + } - if (1 != xDigiA->GetSide()) { posY *= -1.; } + if (1 != xDigiA->GetSide()) { + posY *= -1.; + } - if (std::abs(posY - cluster.hitPos.Y() / cluster.weightsSum) >= fParams.fdMaxSpaceDist) { continue; } + if (std::abs(posY - cluster.hitPos.Y() / cluster.weightsSum) >= fParams.fdMaxSpaceDist) { + continue; + } // append digi pair to current cluster const double posX = ((-(double) numChan / 2. + chan) + 0.5) * cell.sizeX; diff --git a/algo/detectors/tof/Clusterizer.h b/algo/detectors/tof/Clusterizer.h index 6a369e4f780d1ee1920925ce8124c9a5114e8ade..98942ee4a15d27e1d0ff1b63a7a701988074f9aa 100644 --- a/algo/detectors/tof/Clusterizer.h +++ b/algo/detectors/tof/Clusterizer.h @@ -16,21 +16,20 @@ class CbmTofDigi; #include "Hit.h" // C++ Classes and includes +#include <cmath> #include <memory> #include <vector> -#include <cmath> - namespace cbm::algo::tof { class Clusterizer { - public: + public: typedef std::tuple<std::vector<Hit>, std::vector<size_t>, std::vector<u32>, std::vector<int32_t>> resultType; /** ** @brief Constructor. **/ - Clusterizer(ClusterizerRpcPar params) : fParams(params) {}; + Clusterizer(ClusterizerRpcPar params) : fParams(params){}; /** ** @brief Default constructor. @@ -42,7 +41,7 @@ namespace cbm::algo::tof **/ resultType operator()(const std::vector<std::pair<CbmTofDigi, int32_t>>& digisIn); - private: + private: typedef std::vector<std::pair<const CbmTofDigi*, int32_t>> inputType; ClusterizerRpcPar fParams; ///< Parameter container diff --git a/algo/detectors/tof/ClusterizerPars.h b/algo/detectors/tof/ClusterizerPars.h index 1332f5f2c2da7c2c2ead0cb5fc0f9362e86ad372..f212df3aaa31776a25e989b32ffdd40a7df3ee75 100644 --- a/algo/detectors/tof/ClusterizerPars.h +++ b/algo/detectors/tof/ClusterizerPars.h @@ -3,11 +3,11 @@ Authors: Dominik Smith [committer], Pierre-Alain Loizeau, Felix Weiglhofer */ #pragma once -#include <vector> - #include "Math/Rotation3D.h" #include "Math/Vector3Dfwd.h" +#include <vector> + namespace cbm::algo::tof { diff --git a/algo/detectors/tof/Config.h b/algo/detectors/tof/Config.h index 0114da940abbc62ed856bfccd0310631f047d565..36ccae9b99ec4e69cfef50a2a1c644c2af21f0a5 100644 --- a/algo/detectors/tof/Config.h +++ b/algo/detectors/tof/Config.h @@ -19,7 +19,7 @@ namespace cbm::algo::tof **/ class Config { - public: + public: /// @brief Function to get tracking station index by the TOF address static int32_t GetTofTrackingStation(uint32_t address) { @@ -47,7 +47,8 @@ namespace cbm::algo::tof {2, 2, 2, 2, 0}}; if (smType < numSmTypes) { - if (sm < numSm[smType] && rpc < numRpc[smType]) return trkStation[smType][sm * numRpc[smType] + rpc]; + if (sm < numSm[smType] && rpc < numRpc[smType]) + return trkStation[smType][sm * numRpc[smType] + rpc]; else return 0; } diff --git a/algo/detectors/tof/Hit.h b/algo/detectors/tof/Hit.h index b9f2cc3a6a92cb89a4be893fa51a0a72bd80be0b..a7608fc72e94383cfc286e9fa7f005de276e2cb5 100644 --- a/algo/detectors/tof/Hit.h +++ b/algo/detectors/tof/Hit.h @@ -3,17 +3,17 @@ Authors: Dominik Smith [committer], Pierre-Alain Loizeau, Felix Weiglhofer */ #pragma once +#include "ClusterizerPars.h" +#include "Definitions.h" +#include "Math/Rotation3D.h" +#include "Math/Vector3Dfwd.h" + #include <boost/serialization/access.hpp> #include <boost/serialization/split_member.hpp> #include <cstdint> #include <vector> -#include "ClusterizerPars.h" -#include "Definitions.h" -#include "Math/Rotation3D.h" -#include "Math/Vector3Dfwd.h" - namespace boost::serialization { template<class Archive> diff --git a/algo/detectors/tof/HitFinder.h b/algo/detectors/tof/HitFinder.h index 8a8fc9bdbbf728e5e48ab5cd740e5cc85e0e4000..503be1aa3c70f76671009ec31d599a6ded7cbbc9 100644 --- a/algo/detectors/tof/HitFinder.h +++ b/algo/detectors/tof/HitFinder.h @@ -22,11 +22,10 @@ class CbmTofDigi; #include "Math/Vector3Dfwd.h" // C++ Classes and includes +#include <cmath> #include <memory> #include <vector> -#include <cmath> - namespace cbm::algo::tof { struct Cell { @@ -140,19 +139,19 @@ namespace cbm::algo::tof }; class HitFinder { - public: + public: typedef std::vector<Cluster> resultType; typedef std::pair<std::vector<std::vector<CbmTofDigi*>>, std::vector<std::vector<int32_t>>> inputType; /** ** @brief Constructor. **/ - HitFinder() {}; + HitFinder(){}; /** ** @brief Destructor. **/ - ~HitFinder() {}; + ~HitFinder(){}; /** ** @brief Build clusters out of ToF Digis and store the resulting info in a TofHit. @@ -164,7 +163,7 @@ namespace cbm::algo::tof **/ void SetParams(std::unique_ptr<HitFinderRpcPar> params) { fParams = *(std::move(params)); } - private: + private: HitFinderRpcPar fParams = {}; ///< Parameter container inputType calibrateDigis(std::vector<CbmTofDigi>& digisIn, const std::vector<int32_t>& digiIndexIn); diff --git a/algo/detectors/tof/Hitfind.cxx b/algo/detectors/tof/Hitfind.cxx index 5e98952dc4e41561033a316587f22dd87e7e135e..44ddba8d7d5630a09bb558d41acf9213aaa35307 100644 --- a/algo/detectors/tof/Hitfind.cxx +++ b/algo/detectors/tof/Hitfind.cxx @@ -4,12 +4,12 @@ #include "Hitfind.h" -#include <chrono> - #include "compat/OpenMP.h" #include "log.hpp" #include "util/TimingsFormat.h" +#include <chrono> + using namespace std; using fles::Subsystem; diff --git a/algo/detectors/tof/Hitfind.h b/algo/detectors/tof/Hitfind.h index b9b11c8a2becf5235d31b0e0013951c312743171..5cd1c669ac25d6bf4a2df303ddee479d55327368 100644 --- a/algo/detectors/tof/Hitfind.h +++ b/algo/detectors/tof/Hitfind.h @@ -6,7 +6,8 @@ #define TOFHITFIND_H 1 #include "CbmTofDigi.h" - +#include "PODVector.h" +#include "PartitionedVector.h" #include "tof/Clusterizer.h" #include "tof/HitfindSetup.h" @@ -17,9 +18,6 @@ #include <xpu/host.h> -#include "PODVector.h" -#include "PartitionedVector.h" - namespace cbm::algo::tof { @@ -53,7 +51,7 @@ namespace cbm::algo::tof **/ class Hitfind { - public: + public: typedef std::tuple<PartitionedVector<Hit>, HitfindMonitorData, PODVector<i32>> resultType; /** @brief Algorithm execution @@ -67,7 +65,7 @@ namespace cbm::algo::tof /** @brief Constructor **/ explicit Hitfind(tof::HitfindSetup); - private: // members + private: // members /** @brief TOF hitfinders (with unique RPC index for OpenMP) **/ std::vector<tof::Clusterizer> fAlgo; //[rpcUnique] diff --git a/algo/detectors/tof/HitfindSetup.h b/algo/detectors/tof/HitfindSetup.h index ec4ff329c363decbfa63f9ecf7cd868dfa2816a5..93626b2690676adc2662c1b4978151d15f6cdf8d 100644 --- a/algo/detectors/tof/HitfindSetup.h +++ b/algo/detectors/tof/HitfindSetup.h @@ -4,14 +4,14 @@ #ifndef CBM_ALGO_DETECTOR_TOF_HITFIND_SETUP_H #define CBM_ALGO_DETECTOR_TOF_HITFIND_SETUP_H +#include "Definitions.h" +#include "config/Property.h" + #include <array> #include <map> #include <string> #include <vector> -#include "Definitions.h" -#include "config/Property.h" - namespace cbm::algo::tof { diff --git a/algo/detectors/tof/HitfinderChain.h b/algo/detectors/tof/HitfinderChain.h index 20d650aafcfdea44d587ed8d9652501a10e6a139..fc88cd29f68106fae1424304f398f35d819857e2 100644 --- a/algo/detectors/tof/HitfinderChain.h +++ b/algo/detectors/tof/HitfinderChain.h @@ -4,20 +4,19 @@ #pragma once #include "CbmTofDigi.h" - -#include <gsl/span> -#include <memory> - #include "Hitfind.h" #include "HitfindSetup.h" #include "SubChain.h" +#include <gsl/span> +#include <memory> + namespace cbm::algo::tof { class HitfinderChain : public SubChain { - public: + public: using ReturnType = Hitfind::resultType; HitfinderChain() = default; @@ -30,7 +29,7 @@ namespace cbm::algo::tof */ ReturnType Run(gsl::span<CbmTofDigi> digis); - private: + private: std::unique_ptr<Hitfind> fHitfind; }; diff --git a/algo/detectors/tof/ReadoutConfig.cxx b/algo/detectors/tof/ReadoutConfig.cxx index 012aadd6543d9fc59fa2acdc198e68fbf83d0fa2..1429b00c9a05dfa8a64fe3e223db147586e7e034 100644 --- a/algo/detectors/tof/ReadoutConfig.cxx +++ b/algo/detectors/tof/ReadoutConfig.cxx @@ -4,14 +4,13 @@ #include "ReadoutConfig.h" +#include "AlgoFairloggerCompat.h" #include "CbmTofAddress.h" +#include "gDpbMessv100.h" #include <bitset> #include <iomanip> -#include "AlgoFairloggerCompat.h" -#include "gDpbMessv100.h" - using namespace std; namespace cbm::algo::tof @@ -51,7 +50,9 @@ namespace cbm::algo::tof std::vector<uint32_t> result; auto equipIter = fReadoutMap.find(equipmentId); if (equipIter != fReadoutMap.end()) { - if (elinkId < equipIter->second.size()) { result = equipIter->second.at(elinkId); } + if (elinkId < equipIter->second.size()) { + result = equipIter->second.at(elinkId); + } } return result; } @@ -93,7 +94,8 @@ namespace cbm::algo::tof int32_t ReadoutConfig::ElinkIdxToGet4Idx(uint32_t elink) { - if (gdpbv100::kuChipIdMergedEpoch == elink) return elink; + if (gdpbv100::kuChipIdMergedEpoch == elink) + return elink; else if (elink < numElinksPerComp) return elink2Asic[elink % numElinksPerCrob] + numElinksPerCrob * (elink / numElinksPerCrob); else { @@ -108,7 +110,8 @@ namespace cbm::algo::tof // ------------------------------------------------------------------------- int32_t ReadoutConfig::Get4ChanToPadiChan(uint32_t channelInFee) { - if (channelInFee < numChanPerFeb) return asic2PadI[channelInFee]; + if (channelInFee < numChanPerFeb) + return asic2PadI[channelInFee]; else { LOG(fatal) << "CbmMcbm2018TofPar::Get4ChanToPadiChan => Index out of bound, " << channelInFee << " vs " << static_cast<uint32_t>(numChanPerFeb) << ", returning crazy value!"; @@ -383,7 +386,8 @@ namespace cbm::algo::tof case 0: iRpcMap = 0; break; case 1: iRpcMap = 1; break; } - if (iFeet % 2 == 1) iModuleIdMap = 1; + if (iFeet % 2 == 1) + iModuleIdMap = 1; else iModuleIdMap = 0; diff --git a/algo/detectors/tof/ReadoutConfig.h b/algo/detectors/tof/ReadoutConfig.h index 3d9e85e9a5d8e9f6fb8dfbe0ac5522944ffeccd7..48f2575c6a3301a1edbd7ac29700cb06b0699c86 100644 --- a/algo/detectors/tof/ReadoutConfig.h +++ b/algo/detectors/tof/ReadoutConfig.h @@ -14,7 +14,7 @@ namespace cbm::algo::tof { class ReadoutConfig { - public: + public: /** @brief Constructor **/ ReadoutConfig(); @@ -39,7 +39,7 @@ namespace cbm::algo::tof */ std::vector<uint32_t> Map(uint16_t equipId, uint16_t elink); - private: + private: // --- TOF readout map // --- Map index: (equipment, elink, channel), map value: (TOF address) std::map<uint16_t, std::vector<std::vector<uint32_t>>> fReadoutMap = {}; diff --git a/algo/detectors/tof/Unpack.cxx b/algo/detectors/tof/Unpack.cxx index 0add702750f3998d5ec50e9dcada478997d8500a..4d93fef72bbcc4c37e09435f7054cba7280a247b 100644 --- a/algo/detectors/tof/Unpack.cxx +++ b/algo/detectors/tof/Unpack.cxx @@ -5,11 +5,10 @@ #include "Unpack.h" #include <cassert> +#include <cmath> #include <utility> #include <vector> -#include <cmath> - using std::unique_ptr; using std::vector; @@ -133,7 +132,9 @@ namespace cbm::algo::tof const uint64_t epoch = message.getGdpbEpEpochNb(); // --- Calculate epoch relative to timeslice start time; correct for epoch cycles - if (time.currentTsTime <= epoch) { time.currentEpochInTs = epoch - time.currentTsTime; } + if (time.currentTsTime <= epoch) { + time.currentEpochInTs = epoch - time.currentTsTime; + } else { time.currentEpochInTs = epoch + critof001::kulEpochCycleEp - time.currentTsTime; } diff --git a/algo/detectors/tof/Unpack.h b/algo/detectors/tof/Unpack.h index c39ba8d77dc33bdcd1d46d4c68134692d2040d26..2210f66d9a4b1a11aafcd072afaf8d24d5d658e8 100644 --- a/algo/detectors/tof/Unpack.h +++ b/algo/detectors/tof/Unpack.h @@ -7,7 +7,8 @@ #include "CbmTofDigi.h" - +#include "CriGet4Mess001.h" +#include "Definitions.h" #include "MicrosliceDescriptor.hpp" #include "Timeslice.hpp" @@ -18,9 +19,6 @@ #include <sstream> #include <vector> -#include "CriGet4Mess001.h" -#include "Definitions.h" - namespace cbm::algo::tof { @@ -81,14 +79,14 @@ namespace cbm::algo::tof **/ class Unpack { - public: + public: typedef std::pair<std::vector<CbmTofDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution ** @param msContent Microslice payload @@ -104,13 +102,13 @@ namespace cbm::algo::tof **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: // types + private: // types struct TimeSpec { u64 currentTsTime = 0; ///< Unix time of timeslice in units of epoch length u32 currentEpochInTs = 0; ///< Current epoch number relative to timeslice start epoch }; - private: // methods + private: // methods /** @brief Process a hit message ** @param message SMX message (32-bit word) ** @param digiVec Vector to append the created digi to @@ -124,7 +122,7 @@ namespace cbm::algo::tof **/ void ProcessEpochMessage(const critof001::Message& message, TimeSpec& time) const; - private: // members + private: // members UnpackPar fParams = {}; ///< Parameter container }; diff --git a/algo/detectors/trd/ReadoutConfig.h b/algo/detectors/trd/ReadoutConfig.h index aeceeb60e44dc3637893a427c1180a7bad0442eb..98528a7fbd34a1e7ef2cdf0c89f2a676de13cba8 100644 --- a/algo/detectors/trd/ReadoutConfig.h +++ b/algo/detectors/trd/ReadoutConfig.h @@ -5,13 +5,13 @@ #ifndef ALGO_DETECTORS_TRD_READOUTCONFIG_H #define ALGO_DETECTORS_TRD_READOUTCONFIG_H +#include "config/Property.h" + #include <map> #include <sstream> #include <utility> #include <vector> -#include "config/Property.h" - namespace cbm::algo::trd { @@ -30,7 +30,7 @@ namespace cbm::algo::trd class ReadoutConfig { - public: + public: /** @brief Constructor **/ ReadoutConfig(); @@ -77,7 +77,7 @@ namespace cbm::algo::trd void Init(const std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>& addressMap, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>>& channelMap); - private: + private: // --- TRD readout map // --- Map index: (equipment, crob, elink), map value: (ASIC address) std::map<uint16_t, std::vector<std::vector<uint16_t>>> fReadoutMap = {}; //! diff --git a/algo/detectors/trd/Unpack.cxx b/algo/detectors/trd/Unpack.cxx index 0d4bbf46a8b6437e44a7641a52da7f4aa5154e8a..40b11f7d2c320127f2230ef1e9a9b2e640b80fa8 100644 --- a/algo/detectors/trd/Unpack.cxx +++ b/algo/detectors/trd/Unpack.cxx @@ -103,7 +103,9 @@ namespace cbm::algo::trd // Ensure that we are on the correct eLink elinkId = (frame >> 24) & 0x3f; - if (elinkId != raw.GetElinkId()) { result.second.fNumElinkMis++; } + if (elinkId != raw.GetElinkId()) { + result.second.fNumElinkMis++; + } // We have 22 adc bits per RDA word lets add them to the buffer... adcbuffer <<= 22; @@ -129,7 +131,9 @@ namespace cbm::algo::trd if (getMessageType(frame) == Spadic::MsMessageType::kEOM) { // Ensure that we are on the correct eLink elinkId = (frame >> 24) & 0x3f; - if (elinkId != raw.GetElinkId()) { result.second.fNumElinkMis++; } + if (elinkId != raw.GetElinkId()) { + result.second.fNumElinkMis++; + } // Number of samples indicator = nsamples % 4 std::uint8_t nsamplesindicator = (frame >> 18) & 0x3; @@ -191,7 +195,9 @@ namespace cbm::algo::trd } case Spadic::MsMessageType::kNUL: { // last word in Microslice is 0. - if (iword != (nwords - 1) || (istream != (fStreamsPerWord - 1))) { result.second.fNumWildNul++; } + if (iword != (nwords - 1) || (istream != (fStreamsPerWord - 1))) { + result.second.fNumWildNul++; + } break; } case Spadic::MsMessageType::kUNK: { @@ -233,10 +239,18 @@ namespace cbm::algo::trd // ---- digestInfoMsg ---- void Unpack::digestMsFlags(const std::uint16_t flags, UnpackMonitorData& monitor) const { - if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::CrcValid)) { monitor.fNumCrcValidFlags++; } - if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::OverflowFlim)) { monitor.fNumOverflowFlimFlags++; } - if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::OverflowUser)) { monitor.fNumOverflowUserFlags++; } - if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::DataError)) { monitor.fNumDataErrorFlags++; } + if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::CrcValid)) { + monitor.fNumCrcValidFlags++; + } + if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::OverflowFlim)) { + monitor.fNumOverflowFlimFlags++; + } + if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::OverflowUser)) { + monitor.fNumOverflowUserFlags++; + } + if (flags & static_cast<std::uint16_t>(fles::MicrosliceFlags::DataError)) { + monitor.fNumDataErrorFlags++; + } } // ---- extractSample ---- @@ -502,7 +516,8 @@ namespace cbm::algo::trd { // The spadic 2.2 has a functionality that an average baseline can be written to the first sample. // So first we have to check if this is active. - if (fParams.fUseBaselineAvg) return samples->at(0); + if (fParams.fUseBaselineAvg) + return samples->at(0); else { float_t baseline = 0.0; auto itend = samples->begin() + fNrOfPresamples; diff --git a/algo/detectors/trd/Unpack.h b/algo/detectors/trd/Unpack.h index 756f49ca3f564cd2a94291cc4bbe9b0f145bc0ec..02bcc8c8e33d40565a66806ef205e5ce594e03cc 100644 --- a/algo/detectors/trd/Unpack.h +++ b/algo/detectors/trd/Unpack.h @@ -8,15 +8,13 @@ #include "CbmTrdDigi.h" #include "CbmTrdRawMessageSpadic.h" - #include "MicrosliceDescriptor.hpp" #include "Timeslice.hpp" +#include <cmath> #include <memory> #include <sstream> -#include <cmath> - namespace cbm::algo::trd { /** @struct UnpackElinkPar @@ -102,16 +100,16 @@ namespace cbm::algo::trd **/ class Unpack { - public: + public: typedef std::pair<std::vector<CbmTrdDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution @@ -128,7 +126,7 @@ namespace cbm::algo::trd **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: // Types + private: // Types struct MsContext { /** @brief Start time of the current µSlice relative to the Timeslice start time in Spadic CC. */ size_t fMsStartTimeRelCC = 0; @@ -140,7 +138,7 @@ namespace cbm::algo::trd std::vector<std::uint8_t> fNrTsMsbVec = {}; }; - private: // members + private: // members UnpackPar fParams = {}; ///< Parameter container /** diff --git a/algo/detectors/trd2d/ReadoutConfig.cxx b/algo/detectors/trd2d/ReadoutConfig.cxx index 7352f30eb0338b261bf4fa374ead1710b7b1c100..067f7b1fe0f859920d2a37bbf7669a65c83f5616 100644 --- a/algo/detectors/trd2d/ReadoutConfig.cxx +++ b/algo/detectors/trd2d/ReadoutConfig.cxx @@ -56,7 +56,9 @@ namespace cbm::algo::trd2d size_t result = 0; auto it = fChannelMap.find(equipmentId); if (it != fChannelMap.end()) { - if (asicId < fChannelMap[equipmentId].size()) { result = fChannelMap[equipmentId][asicId].size(); } + if (asicId < fChannelMap[equipmentId].size()) { + result = fChannelMap[equipmentId][asicId].size(); + } } return result; } @@ -107,11 +109,13 @@ namespace cbm::algo::trd2d // --- Mapping (equimentId, asicId, channel) -> (pad address, mask flag, daq offset) ----- ReadoutConfig::ChanMapping ReadoutConfig::ChanMap(uint16_t equipId, uint16_t asic, uint16_t chan) { - ChanMapping result = {-1, false, 0}; - auto it = fChannelMap.find(equipId); + ChanMapping result = {-1, false, 0}; + auto it = fChannelMap.find(equipId); if (it != fChannelMap.end()) { if (asic < fChannelMap[equipId].size()) { - if (chan < fChannelMap[equipId][asic].size()) { result = fChannelMap[equipId][asic][chan]; } + if (chan < fChannelMap[equipId][asic].size()) { + result = fChannelMap[equipId][asic][chan]; + } } } return result; @@ -123,8 +127,10 @@ namespace cbm::algo::trd2d ReadoutConfig::CompMapping ReadoutConfig::CompMap(uint16_t equipId) { CompMapping result = {}; - auto equipIter = fReadoutMap.find(equipId); - if (equipIter != fReadoutMap.end()) { result = equipIter->second; } + auto equipIter = fReadoutMap.find(equipId); + if (equipIter != fReadoutMap.end()) { + result = equipIter->second; + } return result; } // ------------------------------------------------------------------------------------ diff --git a/algo/detectors/trd2d/ReadoutConfig.h b/algo/detectors/trd2d/ReadoutConfig.h index 3d42facdc8fc8147a319ea9b7e3586a96e961555..f8e6f3060edd884b08493658ab613cff38d84f2d 100644 --- a/algo/detectors/trd2d/ReadoutConfig.h +++ b/algo/detectors/trd2d/ReadoutConfig.h @@ -5,14 +5,14 @@ #ifndef ALGO_DETECTORS_TRD2D_READOUTCONFIG_H #define ALGO_DETECTORS_TRD2D_READOUTCONFIG_H +#include "Unpack.h" +#include "config/Property.h" + #include <map> #include <sstream> #include <utility> #include <vector> -#include "Unpack.h" -#include "config/Property.h" - namespace cbm::algo::trd2d { @@ -31,7 +31,7 @@ namespace cbm::algo::trd2d class ReadoutConfig { - public: + public: struct CompMapping { uint16_t moduleId; uint8_t crobId; @@ -108,7 +108,7 @@ namespace cbm::algo::trd2d void InitChannelMap( const std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, uint64_t>>>>& channelMap); - private: + private: // --- TRD2D readout map // --- Map index: (equipment), map value: (module id, crob id) std::map<uint16_t, CompMapping> fReadoutMap = {}; //! diff --git a/algo/detectors/trd2d/Unpack.cxx b/algo/detectors/trd2d/Unpack.cxx index 7056e914b710f140ab221871c7549697c92f7f06..c7d2c736512dee5a6895570c29f60cdc9e531aae 100644 --- a/algo/detectors/trd2d/Unpack.cxx +++ b/algo/detectors/trd2d/Unpack.cxx @@ -4,12 +4,12 @@ #include "Unpack.h" +#include "AlgoFairloggerCompat.h" + #include <algorithm> #include <cassert> #include <vector> -#include "AlgoFairloggerCompat.h" - using std::unique_ptr; namespace cbm::algo::trd2d @@ -62,7 +62,9 @@ namespace cbm::algo::trd2d if (isaux) { if (ch_id == 0) { // clear buffer - if (vMess.size()) { pushDigis(vMess, time, ctx); } + if (vMess.size()) { + pushDigis(vMess, time, ctx); + } vMess.clear(); lFaspOld = 0xff; @@ -71,7 +73,9 @@ namespace cbm::algo::trd2d continue; } if (lFaspOld != fasp_id) { - if (vMess.size()) { pushDigis(vMess, time, ctx); } + if (vMess.size()) { + pushDigis(vMess, time, ctx); + } vMess.clear(); lFaspOld = fasp_id; } diff --git a/algo/detectors/trd2d/Unpack.h b/algo/detectors/trd2d/Unpack.h index 408b659700197445953af07d846a8682a855f44d..fb17e290ea5662c52dd036dd838f0bab0e91ce86 100644 --- a/algo/detectors/trd2d/Unpack.h +++ b/algo/detectors/trd2d/Unpack.h @@ -8,16 +8,14 @@ #include "CbmTrdDigi.h" #include "CbmTrdRawMessageSpadic.h" - #include "MicrosliceDescriptor.hpp" #include "Timeslice.hpp" #include <array> +#include <cmath> #include <memory> #include <sstream> -#include <cmath> - #define NFASPMOD 180 #define NCROBMOD 5 #define NFASPCROB NFASPMOD / NCROBMOD @@ -111,16 +109,16 @@ namespace cbm::algo::trd2d **/ class Unpack { - public: + public: typedef std::pair<std::vector<CbmTrdDigi>, UnpackMonitorData> resultType; /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Algorithm execution @@ -137,7 +135,7 @@ namespace cbm::algo::trd2d **/ void SetParams(std::unique_ptr<UnpackPar> params) { fParams = *(std::move(params)); } - private: // Types + private: // Types struct MsContext { UnpackMonitorData fMonitor; ///< Container for monitoring data @@ -145,7 +143,7 @@ namespace cbm::algo::trd2d {}}; ///> Buffered digi for each pad in CROB component }; - private: // members + private: // members UnpackPar fParams = {}; ///< Parameter container bool pushDigis(std::vector<FaspMessage> messages, const uint64_t time, MsContext& ctx) const; diff --git a/algo/evbuild/Config.h b/algo/evbuild/Config.h index d2b722f95652151fc01ce036a30975426a73ca41..181cccaf6577c3afb2424617616ae3a6124c10a5 100644 --- a/algo/evbuild/Config.h +++ b/algo/evbuild/Config.h @@ -6,12 +6,12 @@ #ifndef ALGO_EVBUILD_CONFIG_H #define ALGO_EVBUILD_CONFIG_H 1 -#include <yaml-cpp/yaml.h> - #include "DigiEventSelectorConfig.h" #include "DigiTriggerConfig.h" #include "EventBuilderConfig.h" +#include <yaml-cpp/yaml.h> + namespace cbm::algo::evbuild { @@ -21,14 +21,14 @@ namespace cbm::algo::evbuild ** @since 10 July 2023 **/ class Config { - public: // methods + public: // methods /** @brief Constructor from YAML **/ Config(YAML::Node node); /** @brief Save to YAML file **/ YAML::Node ToYaml() const; - public: // data members + public: // data members DigiTriggerConfig fTrigger; ///< Digi trigger configuration EventBuilderConfig fBuilder; ///< Event builder configuration DigiEventSelectorConfig fSelector; ///< Event selector configuration diff --git a/algo/evbuild/EventBuilder.h b/algo/evbuild/EventBuilder.h index aaa6599b04460cc53099063fadd3ff8cdea0a33e..f2c79ac7e5ad967f9874a07423b3eabe80d98740 100644 --- a/algo/evbuild/EventBuilder.h +++ b/algo/evbuild/EventBuilder.h @@ -6,6 +6,9 @@ #define CBM_ALGO_EVENTBUILDER_H 1 #include "CbmDefs.h" +#include "DigiData.h" +#include "DigiEventSelector.h" +#include "EventBuilderConfig.h" #include <algorithm> #include <gsl/span> @@ -16,10 +19,6 @@ #include <xpu/host.h> -#include "DigiData.h" -#include "DigiEventSelector.h" -#include "EventBuilderConfig.h" - namespace cbm::algo::evbuild { @@ -71,7 +70,7 @@ namespace cbm::algo::evbuild **/ class EventBuilder { - public: + public: typedef std::pair<std::vector<DigiEvent>, EventBuilderMonitorData> resultType; /** @brief Constructor **/ @@ -79,7 +78,7 @@ namespace cbm::algo::evbuild /** @brief Destructor **/ - virtual ~EventBuilder() {}; + virtual ~EventBuilder(){}; /** @brief Execution @@ -96,7 +95,7 @@ namespace cbm::algo::evbuild std::string ToString() const; - private: // methods + private: // methods /** @brief Build a single event from a trigger time ** @param ts Digi source (timeslice) ** @param monitor Monitoring data @@ -135,7 +134,7 @@ namespace cbm::algo::evbuild } - private: // data members + private: // data members EventBuilderConfig fConfig; ///< Configuration / parameters }; diff --git a/algo/evbuild/EventBuilderConfig.h b/algo/evbuild/EventBuilderConfig.h index a828be62bf169d240db49d056d6a77153652df25..23c84a71c8eab621010d8548bc4ee24896d45814 100644 --- a/algo/evbuild/EventBuilderConfig.h +++ b/algo/evbuild/EventBuilderConfig.h @@ -24,7 +24,7 @@ namespace cbm::algo::evbuild **/ class EventBuilderConfig { - public: + public: /** @brief Constructor from YAML **/ EventBuilderConfig(YAML::Node config); @@ -32,7 +32,7 @@ namespace cbm::algo::evbuild YAML::Node ToYaml() const; - public: + public: std::map<ECbmModuleId, std::pair<double, double>> fWindows; ///< Key: detector; value: [tmin, tmax] }; diff --git a/algo/evbuild/EventbuildChain.cxx b/algo/evbuild/EventbuildChain.cxx index 117cb3bbab94421aecd7b3aec7ad190882761bcd..2843a9843699a7ac7e8d299063f96d67bae830cb 100644 --- a/algo/evbuild/EventbuildChain.cxx +++ b/algo/evbuild/EventbuildChain.cxx @@ -5,14 +5,13 @@ #include "EventbuildChain.h" #include "CbmDigiTimeslice.h" - -#include <sstream> -#include <string> - #include "DigiData.h" #include "Histo1D.h" #include "evbuild/Config.h" +#include <sstream> +#include <string> + using namespace cbm::algo; using namespace cbm::algo::evbuild; @@ -52,7 +51,7 @@ EventbuildChain::EventbuildChain(const Config& config, std::shared_ptr<Histogram } /// => (empty) Histograms serialization and emission to close multi-part message - fSender->PrepareAndSendMsg(std::vector<Histo1D> {}, zmq::send_flags::none); + fSender->PrepareAndSendMsg(std::vector<Histo1D>{}, zmq::send_flags::none); } } // ---------------------------------------------------------------------------- diff --git a/algo/evbuild/EventbuildChain.h b/algo/evbuild/EventbuildChain.h index e70ae37f369ff69e6ce9ef4624ce06b7d3b6b7a2..15bac22c6995bba3e6d58246482001e1a20f1b5f 100644 --- a/algo/evbuild/EventbuildChain.h +++ b/algo/evbuild/EventbuildChain.h @@ -6,16 +6,14 @@ #define CBM_ALGO_EVBUILD_EVBUILDCHAIN_H 1 #include "CbmDefs.h" - -#include "TimeClusterTrigger.h" - -#include <memory> - #include "DigiEventQa.h" #include "DigiEventSelector.h" #include "EventBuilder.h" #include "HistogramSender.h" #include "SubChain.h" +#include "TimeClusterTrigger.h" + +#include <memory> namespace cbm::algo { @@ -44,7 +42,7 @@ namespace cbm::algo::evbuild **/ class EventbuildChain : public SubChain { - public: + public: using ResultType = std::pair<std::vector<DigiEvent>, EventbuildChainMonitorData>; /** @brief Constructor **/ @@ -59,7 +57,7 @@ namespace cbm::algo::evbuild /** @brief Status info to logger **/ void Status() const; - private: // members + private: // members ECbmModuleId fTriggerDet = ECbmModuleId::kNotExist; ///< Trigger detector TimeClusterTrigger fTrigger; ///< Trigger algorithm EventBuilder fBuilder; ///< Event builder algorithm @@ -67,7 +65,7 @@ namespace cbm::algo::evbuild DigiEventQa fQa; ///< Event QA algorithm std::shared_ptr<HistogramSender> fSender; ///< Histogram sender - private: // methods + private: // methods /** @brief Extract digi times from CbmDigiTimeslice ** @param system Detector system (enum ECbmModuleId) ** @return Vector of digi times for the specified system diff --git a/algo/evselector/DigiEventSelector.cxx b/algo/evselector/DigiEventSelector.cxx index a4b63a49c86a4513b6eb32a47ccaf1b0cda9b7e5..96aa65f0834ebf2adfc8b48d1bca2e5697e08676 100644 --- a/algo/evselector/DigiEventSelector.cxx +++ b/algo/evselector/DigiEventSelector.cxx @@ -4,8 +4,8 @@ #include "DigiEventSelector.h" +#include "AlgoFairloggerCompat.h" #include "CbmStsDigi.h" - #include "tof/Config.h" #include <gsl/span> @@ -13,8 +13,6 @@ #include <unordered_map> #include <unordered_set> -#include "AlgoFairloggerCompat.h" - namespace cbm::algo::evbuild { @@ -65,7 +63,8 @@ namespace cbm::algo::evbuild for (auto& digi : digis) { const int32_t addr = digi.GetAddress(); auto module = modules.find(addr); - if (module == modules.end()) modules[addr] = digi.GetChannel() / chanPerSide; // = 0,1 for sides + if (module == modules.end()) + modules[addr] = digi.GetChannel() / chanPerSide; // = 0,1 for sides else { if (digi.GetChannel() / chanPerSide != module->second) { // other sensor side found, chance for cluster const uint32_t stationAddr = CbmStsAddress::GetElementId(addr, EStsElementLevel::kStsUnit); @@ -77,7 +76,8 @@ namespace cbm::algo::evbuild } } - if (stations.size() < minNum) return false; + if (stations.size() < minNum) + return false; else return true; } @@ -103,7 +103,8 @@ namespace cbm::algo::evbuild const int32_t stripAddr = CbmTofAddress::GetStripFullId(digiAddr); auto strip = strips.find(stripAddr); - if (strip == strips.end()) strips[stripAddr] = digi.GetSide(); + if (strip == strips.end()) + strips[stripAddr] = digi.GetSide(); else { if (digi.GetSide() != strip->second) { // Found other end => full strip, insert into counter set const int32_t rpcAddr = CbmTofAddress::GetRpcFullId(digiAddr); @@ -119,7 +120,8 @@ namespace cbm::algo::evbuild } } - if (stations.size() < minNum) return false; + if (stations.size() < minNum) + return false; else return true; } diff --git a/algo/evselector/DigiEventSelector.h b/algo/evselector/DigiEventSelector.h index 567330754b23434a37ed03862afb2011c95730f1..d017cac7fa79d4954e23f144acb32b694d405cd5 100644 --- a/algo/evselector/DigiEventSelector.h +++ b/algo/evselector/DigiEventSelector.h @@ -5,13 +5,13 @@ #ifndef CBM_ALGO_DIGIEVENTSELECTOR_H #define CBM_ALGO_DIGIEVENTSELECTOR_H 1 +#include "DigiData.h" +#include "DigiEventSelectorConfig.h" + #include <cstdint> #include <gsl/span> #include <map> -#include "DigiData.h" -#include "DigiEventSelectorConfig.h" - namespace cbm::algo::evbuild { @@ -38,9 +38,9 @@ namespace cbm::algo::evbuild **/ class DigiEventSelector { - public: + public: /** @brief Constructor with configuration **/ - DigiEventSelector(DigiEventSelectorConfig config) : fConfig(config) {}; + DigiEventSelector(DigiEventSelectorConfig config) : fConfig(config){}; /** @brief Test one event for the selection criteria ** @param event DigiEvent @@ -53,7 +53,7 @@ namespace cbm::algo::evbuild std::string ToString() const; - private: // methods + private: // methods /** @brief Test for the number of STS stations ** @param digis Vector of STS digis ** @param minNum Requested minimum of active STS stations @@ -69,7 +69,7 @@ namespace cbm::algo::evbuild bool CheckTofLayers(gsl::span<const CbmTofDigi> digis, size_t minNum) const; - private: // members + private: // members DigiEventSelectorConfig fConfig; ///< Configuration / parameters }; diff --git a/algo/evselector/DigiEventSelectorConfig.cxx b/algo/evselector/DigiEventSelectorConfig.cxx index 3b09a84bb2e7f76f90564eb991e0fd2c415928a9..647f7c0dfbb3acca86c180639167d2134eed1560 100644 --- a/algo/evselector/DigiEventSelectorConfig.cxx +++ b/algo/evselector/DigiEventSelectorConfig.cxx @@ -18,7 +18,8 @@ namespace cbm::algo::evbuild for (YAML::const_iterator it = numDigis.begin(); it != numDigis.end(); it++) { auto det = ToCbmModuleIdCaseInsensitive(it->first.as<std::string>()); auto value = it->second.as<size_t>(); - if (value > 0) fMinNumDigis[det] = value; + if (value > 0) + fMinNumDigis[det] = value; else L_(warning) << "DigiEventSelectorConfig: Ignoring minimum 0 for digis in " << ::ToString(det); } @@ -27,7 +28,8 @@ namespace cbm::algo::evbuild for (YAML::const_iterator it = numLayers.begin(); it != numLayers.end(); it++) { auto det = ToCbmModuleIdCaseInsensitive(it->first.as<std::string>()); auto value = it->second.as<size_t>(); - if (value > 0) fMinNumLayers[det] = value; + if (value > 0) + fMinNumLayers[det] = value; else L_(warning) << "DigiEventSelectorConfig: Ignoring minimum 0 for layers in " << ::ToString(det); } diff --git a/algo/evselector/DigiEventSelectorConfig.h b/algo/evselector/DigiEventSelectorConfig.h index 1076f3d69ad01bf8f8661b3d5568dc5e80600c07..43276c739ddc21ceaf1bbd4767ad9ef0baf1e136 100644 --- a/algo/evselector/DigiEventSelectorConfig.h +++ b/algo/evselector/DigiEventSelectorConfig.h @@ -35,7 +35,7 @@ namespace cbm::algo::evbuild friend class DigiEventSelector; - public: + public: /** @brief Constructor from YAML **/ DigiEventSelectorConfig(YAML::Node config); @@ -46,7 +46,7 @@ namespace cbm::algo::evbuild YAML::Node ToYaml() const; - private: + private: std::map<ECbmModuleId, size_t> fMinNumDigis; ///< Key: detector, value: minimal number of digis std::map<ECbmModuleId, size_t> fMinNumLayers; ///< Key: detector, value: Minimal number of layers }; diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 41965fe098920e419419b16cc9ecc5daccf357bb..5ac8ae0479f62fffdfd5dcf1a4e7459ac303bd2c 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -4,12 +4,6 @@ #include "Reco.h" #include "CbmDigiEvent.h" - -#include <Monitor.hpp> -#include <System.hpp> - -#include <xpu/host.h> - #include "Exceptions.h" #include "compat/OpenMP.h" #include "config/Yaml.h" @@ -18,6 +12,11 @@ #include "util/TimingsFormat.h" #include "util/TsUtils.h" +#include <Monitor.hpp> +#include <System.hpp> + +#include <xpu/host.h> + using namespace cbm::algo; Reco::Reco() {} @@ -57,7 +56,7 @@ void Reco::Init(const Options& opts) // fContext.sender = fSender; } - xpu::device_prop props {xpu::device::active()}; + xpu::device_prop props{xpu::device::active()}; L_(info) << "Running CBM Reco on Device '" << props.name() << "' (Using " << openmp::GetMaxThreads() << " OpenMP threads)"; @@ -172,7 +171,7 @@ RecoResults Reco::Run(const fles::Timeslice& ts) // --- Tracking if (Opts().HasStep(Step::Tracking)) { - TrackingChain::Input_t input { + TrackingChain::Input_t input{ .stsHits = stsHits, .tofHits = tofHits, }; @@ -372,7 +371,9 @@ void Reco::QueueEvbuildMetrics(const evbuild::EventbuildChainMonitorData& mon) void Reco::QueueTrackingMetrics(const ca::TrackingMonitorData& monitor) { - if (!HasMonitor()) { return; } + if (!HasMonitor()) { + return; + } GetMonitor().QueueMetric("cbmreco", {{"hostname", fles::system::current_hostname()}, {"child", Opts().ChildId()}}, {{"caRecoTimeTotal", monitor.GetTimer(ca::ETimer::FindTracks).GetTotal()}, @@ -386,7 +387,9 @@ void Reco::QueueTrackingMetrics(const ca::TrackingMonitorData& monitor) void Reco::QueueProcessingMetrics(const ProcessingMonitor& mon) { - if (!HasMonitor()) { return; } + if (!HasMonitor()) { + return; + } GetMonitor().QueueMetric("cbmreco", {{"hostname", fles::system::current_hostname()}, {"child", Opts().ChildId()}}, { diff --git a/algo/global/Reco.h b/algo/global/Reco.h index e34c9d883610966c37c8f1b9cbfc6efc76338ee4..905dfa33a899959cc63cb4e053407445cc297d59 100644 --- a/algo/global/Reco.h +++ b/algo/global/Reco.h @@ -4,11 +4,6 @@ #ifndef CBM_ALGO_GLOBAL_RECO_H #define CBM_ALGO_GLOBAL_RECO_H -#include "tof/CalibratorChain.h" -#include "tof/HitfinderChain.h" - -#include <xpu/host.h> - #include "EventbuildChain.h" #include "HistogramSender.h" #include "SubChain.h" @@ -16,6 +11,10 @@ #include "ca/TrackingChain.h" #include "global/RecoResults.h" #include "sts/HitfinderChain.h" +#include "tof/CalibratorChain.h" +#include "tof/HitfinderChain.h" + +#include <xpu/host.h> namespace fles { @@ -31,7 +30,7 @@ namespace cbm::algo }; class Reco : SubChain { - public: + public: Reco(); ~Reco(); @@ -45,7 +44,7 @@ namespace cbm::algo void Finalize(); void PrintTimings(xpu::timings&); - private: + private: bool fInitialized = false; ChainContext fContext; xpu::timings fTimesliceTimesAcc; diff --git a/algo/global/RecoResultsInputArchive.h b/algo/global/RecoResultsInputArchive.h index f47841ea69ded25beefd164f443f2d0de04468f0..4291d47f573b5e57135b45aeeb3cdbada8424863 100644 --- a/algo/global/RecoResultsInputArchive.h +++ b/algo/global/RecoResultsInputArchive.h @@ -4,10 +4,10 @@ #ifndef CBM_ALGO_GLOBAL_RECORESULTSINPUTARCHIVE_H #define CBM_ALGO_GLOBAL_RECORESULTSINPUTARCHIVE_H -#include <InputArchive.hpp> - #include "StorableRecoResults.h" +#include <InputArchive.hpp> + namespace cbm::algo { diff --git a/algo/global/RecoResultsOutputArchive.h b/algo/global/RecoResultsOutputArchive.h index a664407b433a0473610bbc69ee752128ab31ff71..2b574b51a8535ec3f868c3df2daf6fd217b2d539 100644 --- a/algo/global/RecoResultsOutputArchive.h +++ b/algo/global/RecoResultsOutputArchive.h @@ -4,10 +4,10 @@ #ifndef CBM_ALGO_GLOBAL_RECO_RESULTS_OUTPUT_ARCHIVE_H #define CBM_ALGO_GLOBAL_RECO_RESULTS_OUTPUT_ARCHIVE_H -#include <OutputArchive.hpp> - #include "StorableRecoResults.h" +#include <OutputArchive.hpp> + namespace cbm::algo { diff --git a/algo/global/StorableRecoResults.h b/algo/global/StorableRecoResults.h index 8a11c4522b0666fb7a60bdcbee1857ec23e08a7b..818a981caa9c6446ee5c10353a3cadb2c5b51a32 100644 --- a/algo/global/StorableRecoResults.h +++ b/algo/global/StorableRecoResults.h @@ -5,7 +5,11 @@ #define CBM_ALGO_GLOBAL_STORABLE_RECO_RESULTS_H #include "CbmDigiEvent.h" - +#include "PartitionedVector.h" +#include "ca/core/data/CaTrack.h" +#include "ca/core/utils/CaVector.h" +#include "sts/Cluster.h" +#include "sts/Hit.h" #include "tof/Hit.h" #include <boost/serialization/access.hpp> @@ -14,18 +18,12 @@ #include <cstdint> -#include "PartitionedVector.h" -#include "ca/core/data/CaTrack.h" -#include "ca/core/utils/CaVector.h" -#include "sts/Cluster.h" -#include "sts/Hit.h" - namespace cbm::algo { class StorableRecoResults { - public: + public: using TrackHitIndexContainer_t = ca::Vector<std::vector<std::pair<uint32_t, uint32_t>>>; /** @@ -69,7 +67,7 @@ namespace cbm::algo TrackHitIndexContainer_t& TrackTofHitIndices() { return fTrackTofHitIndices; } const TrackHitIndexContainer_t& TrackTofHitIndices() const { return fTrackTofHitIndices; } - private: + private: uint64_t fTsIndex = UINT64_MAX; uint64_t fTsStartTime = UINT64_MAX; diff --git a/algo/qa/DigiEventQa.h b/algo/qa/DigiEventQa.h index 9e09ee8f5d753adaef995ac6b27c3985fc1d80ca..7df6945795d6d98204202256a60994c6a46a9c44 100644 --- a/algo/qa/DigiEventQa.h +++ b/algo/qa/DigiEventQa.h @@ -6,15 +6,14 @@ #define ALGO_QA_DIGIEVENTQA_H 1 #include "CbmDefs.h" +#include "DigiData.h" +#include "Histo1D.h" +#include "evbuild/EventBuilderConfig.h" #include <gsl/span> #include <map> #include <vector> -#include "DigiData.h" -#include "Histo1D.h" -#include "evbuild/EventBuilderConfig.h" - namespace cbm::algo::evbuild { @@ -80,7 +79,7 @@ namespace cbm::algo::evbuild } std::vector<std::pair<std::string, std::string>> GetHistosConfigs() const { - std::vector<std::pair<std::string, std::string>> cfg {}; + std::vector<std::pair<std::string, std::string>> cfg{}; for (const auto& entry : fData) { cfg.push_back(std::pair<std::string, std::string>(GetDigiTimeHistoName(entry.first), "DigiEvtQa")); } @@ -94,7 +93,7 @@ namespace cbm::algo::evbuild /// => See core/base/utils/fles/CbmFlesCanvasTools for the full code, especially GenerateCanvasConfigString // --- Canvas of all Time in event per system - std::pair<std::string, std::string> cfgDigiTimeAll {"digiEvtTimeQaCanv", "digiEvtTimeQaCanv;"}; + std::pair<std::string, std::string> cfgDigiTimeAll{"digiEvtTimeQaCanv", "digiEvtTimeQaCanv;"}; cfgDigiTimeAll.second += "Digi time in Events per subsystem;"; cfgDigiTimeAll.second += std::to_string(fData.size() / 2 + fData.size() % 2) + ";2;"; for (const auto& entry : fData) { @@ -103,7 +102,7 @@ namespace cbm::algo::evbuild if (fData.size() % 2) { // Empty pad if odd number of systems cfgDigiTimeAll.second += std::string("1,1,0,1,0,;"); } - return std::vector<std::pair<std::string, std::string>> {cfgDigiTimeAll}; + return std::vector<std::pair<std::string, std::string>>{cfgDigiTimeAll}; } }; @@ -114,9 +113,9 @@ namespace cbm::algo::evbuild ** @since 16 June 2023 **/ class DigiEventQa { - public: + public: /** @brief Constructor **/ - DigiEventQa(const DigiEventQaConfig& config) : fConfig(config) {}; + DigiEventQa(const DigiEventQaConfig& config) : fConfig(config){}; /** @brief Destructor **/ virtual ~DigiEventQa() = default; @@ -134,7 +133,7 @@ namespace cbm::algo::evbuild const DigiEventQaConfig& GetConfig() const { return fConfig; } - private: // methods + private: // methods /** @brief Fill histogram with digi time within event ** @param digis Vector with digi objects ** @param eventTime Time of event @@ -157,7 +156,7 @@ namespace cbm::algo::evbuild void QaDigiTimeInEvent(const DigiEvent& event, ECbmModuleId system, Histo1D& histo) const; - private: // members + private: // members DigiEventQaConfig fConfig; }; diff --git a/algo/qa/Histo1D.cxx b/algo/qa/Histo1D.cxx index e25b98cd880ac774f5df3eab05e891ba5e29be51..80a9d7027ab0fe0b6868fefe85997243322531eb 100644 --- a/algo/qa/Histo1D.cxx +++ b/algo/qa/Histo1D.cxx @@ -5,14 +5,13 @@ #include "Histo1D.h" #include <cassert> +#include <cmath> #include <cstdint> #include <sstream> #include <stdexcept> #include <string> #include <vector> -#include <cmath> - namespace cbm::algo { @@ -35,7 +34,8 @@ namespace cbm::algo // ----- Add entry void Histo1D::Add(double value, double weight) { - if (value < fMinValue) fUnderflow += weight; + if (value < fMinValue) + fUnderflow += weight; else if (!(value < fMaxValue)) fOverflow += weight; else { @@ -58,7 +58,8 @@ namespace cbm::algo // ----- Content access double Histo1D::Content(uint32_t bin) const { - if (fNumBins < bin) return 0.; + if (fNumBins < bin) + return 0.; else return fContent[bin]; } diff --git a/algo/qa/Histo1D.h b/algo/qa/Histo1D.h index 069ffb6ca4559e28f83fde4c9637bb7d5921b1f9..d9bc5128d7874bd6fc26eafc499c4967270e912b 100644 --- a/algo/qa/Histo1D.h +++ b/algo/qa/Histo1D.h @@ -23,7 +23,7 @@ namespace cbm::algo ** Lightweight one-dimensional histogram class **/ class Histo1D { - public: + public: /** @brief Standard constructor ** @param numBins Number of bins ** @param minValue Lower edge of histogram range @@ -110,7 +110,7 @@ namespace cbm::algo std::string ToString() const; - private: + private: /** Properties (no need for const if no accessors, avoid really complicated boost serialization) **/ std::string fName; std::string fTitle; @@ -140,7 +140,7 @@ namespace cbm::algo } /** @brief Default constructor: needed for boost serialization of vector of Histo1D, need copy ctor call after! **/ - Histo1D() : fName(""), fTitle(""), fNumBins(0), fMinValue(0), fMaxValue(0) {}; + Histo1D() : fName(""), fTitle(""), fNumBins(0), fMinValue(0), fMaxValue(0){}; }; diff --git a/algo/test/_GTestDigiEventSelector.cxx b/algo/test/_GTestDigiEventSelector.cxx index fe8bc21df6b3582616d637a1078079f1682a58af..32a8ae5a5435b1b44723e438b26eb289474eb8c9 100644 --- a/algo/test/_GTestDigiEventSelector.cxx +++ b/algo/test/_GTestDigiEventSelector.cxx @@ -2,17 +2,16 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ +#include "DigiEventSelector.h" +#include "DigiEventSelectorConfig.h" +#include "gtest/gtest-spi.h" +#include "gtest/gtest.h" #include "tof/Config.h" #include <unordered_set> #include <yaml-cpp/yaml.h> -#include "DigiEventSelector.h" -#include "DigiEventSelectorConfig.h" -#include "gtest/gtest-spi.h" -#include "gtest/gtest.h" - using namespace cbm::algo; TEST(_GTestDigiEventSelector, CheckDigiEventSelectorAlgorithmSimple) diff --git a/algo/test/_GTestEventBuilder.cxx b/algo/test/_GTestEventBuilder.cxx index 7fb32451f535d635446d08a094154be146d805be..1f6a36d9b981d70f83e88c082db416e42a7337a4 100644 --- a/algo/test/_GTestEventBuilder.cxx +++ b/algo/test/_GTestEventBuilder.cxx @@ -2,12 +2,12 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ -#include <yaml-cpp/yaml.h> - #include "EventBuilder.h" #include "gtest/gtest-spi.h" #include "gtest/gtest.h" +#include <yaml-cpp/yaml.h> + using namespace cbm::algo; TEST(_GTestEventBuilder, CheckEventBuilderAlgorithmSimple) @@ -16,14 +16,14 @@ TEST(_GTestEventBuilder, CheckEventBuilderAlgorithmSimple) //Initialize event builder YAML::Node configNode; - configNode[ToString(ECbmModuleId::kMuch)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kSts)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kTof)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kTrd)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kRich)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kPsd)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kFsd)] = std::pair<double, double> {-45., 45.}; - configNode[ToString(ECbmModuleId::kBmon)] = std::pair<double, double> {-45., 45.}; + configNode[ToString(ECbmModuleId::kMuch)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kSts)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kTof)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kTrd)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kRich)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kPsd)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kFsd)] = std::pair<double, double>{-45., 45.}; + configNode[ToString(ECbmModuleId::kBmon)] = std::pair<double, double>{-45., 45.}; cbm::algo::evbuild::EventBuilderConfig config(configNode); cbm::algo::evbuild::EventBuilder evbuild(config); diff --git a/algo/test/_GTestPartitionedSpan.cxx b/algo/test/_GTestPartitionedSpan.cxx index 4a730e27672644fb2b52a96e742713930325ef5f..ccc3823250d773de15a4be28b68c6db5cae2797c 100644 --- a/algo/test/_GTestPartitionedSpan.cxx +++ b/algo/test/_GTestPartitionedSpan.cxx @@ -1,11 +1,11 @@ /* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ -#include <gtest/gtest.h> - #include "PartitionedSpan.h" #include "PartitionedVector.h" +#include <gtest/gtest.h> + using namespace cbm::algo; template<typename T> @@ -18,7 +18,7 @@ void EXPECT_CONTAINER_EQ(gsl::span<T> a, std::vector<i32> b) } class PartitionedSpanTest : public ::testing::Test { -protected: + protected: std::vector<i32> fData; std::vector<size_t> fSizes; std::vector<size_t> fOffsets; diff --git a/algo/test/_GTestPartitionedVector.cxx b/algo/test/_GTestPartitionedVector.cxx index 0d9be0cf31c99f8001a1c3c4eabb0819224c6ec3..49ab5b17609f616092e1501fa36ac30fe47ea71a 100644 --- a/algo/test/_GTestPartitionedVector.cxx +++ b/algo/test/_GTestPartitionedVector.cxx @@ -18,7 +18,7 @@ void EXPECT_CONTAINER_EQ(gsl::span<const T> a, std::vector<T> b) } class PartitionedVectorTest : public ::testing::Test { -protected: + protected: std::vector<i32> fData; std::vector<size_t> fSizes; std::vector<size_t> fSizesInvalid; diff --git a/algo/test/_GTestTimeClusterTrigger.cxx b/algo/test/_GTestTimeClusterTrigger.cxx index 5cced089c530b7c57d5666fbe24a51a5c9d5492a..dc23e61b25749b825e9d1f06706f231bae9821bc 100644 --- a/algo/test/_GTestTimeClusterTrigger.cxx +++ b/algo/test/_GTestTimeClusterTrigger.cxx @@ -3,7 +3,6 @@ Authors: Dominik Smith [committer] */ #include "TimeClusterTrigger.h" - #include "gtest/gtest-spi.h" #include "gtest/gtest.h" diff --git a/algo/test/_GTestYamlConfig.cxx b/algo/test/_GTestYamlConfig.cxx index c0c35d327468720ea7fb825eed9fb7abc7677b27..c7869b60f9bd56cff7ee0c6d0b2c2b44c7d582f0 100644 --- a/algo/test/_GTestYamlConfig.cxx +++ b/algo/test/_GTestYamlConfig.cxx @@ -39,7 +39,7 @@ TEST(Config, CanSerializeStdMap) map[3] = 4; map[5] = 6; - YAML::Node node = YAML::Load(config::Dump {}(map)); + YAML::Node node = YAML::Load(config::Dump{}(map)); EXPECT_EQ(node.size(), 3); EXPECT_EQ(node[1].as<i32>(), 2); @@ -48,11 +48,11 @@ TEST(Config, CanSerializeStdMap) } class Foo { -private: + private: i32 fBar = 42; i32 fBaz = 43; -public: + public: i32 GetBar() const { return fBar; } i32 GetBaz() const { return fBaz; } diff --git a/algo/trigger/DigiTriggerConfig.h b/algo/trigger/DigiTriggerConfig.h index a52008e7256b69f12d26b5f921d555ed9818cb4a..ce321b1165b49e9ac5bb45aea021723a06071c03 100644 --- a/algo/trigger/DigiTriggerConfig.h +++ b/algo/trigger/DigiTriggerConfig.h @@ -22,7 +22,7 @@ namespace cbm::algo::evbuild **/ class DigiTriggerConfig { - public: + public: /** @brief Constructor with parameters ** @param detector Detector to be used for triggering ** @param window Time interval to look for clusters in [ns] @@ -59,7 +59,7 @@ namespace cbm::algo::evbuild double Window() const { return fWindow; } - private: + private: ECbmModuleId fDetector; ///< Trigger detector double fWindow; ///< Trigger window size [ns] size_t fThreshold; ///< Minimum number if digis in trigger window diff --git a/algo/trigger/TimeClusterTrigger.h b/algo/trigger/TimeClusterTrigger.h index eb4f72b055a6b1f88eaba09a37ff66f3b41cf9ea..66ea1494102b152f7699ae8ff2075c54e675ae45 100644 --- a/algo/trigger/TimeClusterTrigger.h +++ b/algo/trigger/TimeClusterTrigger.h @@ -5,14 +5,14 @@ #ifndef CBM_ALGO_TIMECLUSTERTRIGGER_H #define CBM_ALGO_TIMECLUSTERTRIGGER_H 1 +#include "DigiTriggerConfig.h" + #include <cstddef> #include <cstdint> #include <vector> #include <xpu/host.h> -#include "DigiTriggerConfig.h" - namespace cbm::algo::evbuild { @@ -41,7 +41,7 @@ namespace cbm::algo::evbuild **/ class TimeClusterTrigger { - public: + public: typedef std::pair<std::vector<double>, TimeClusterTriggerMonitorData> resultType; /** @brief Constructor **/ @@ -60,7 +60,7 @@ namespace cbm::algo::evbuild std::string ToString() const; - private: + private: DigiTriggerConfig fConfig; }; diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx index 9c9114b929b5a5f761fa8a0c6a6354b516acd958..660fde3d82ea8f6d568c763e6781518d40f48d64 100644 --- a/algo/unpack/Unpack.cxx +++ b/algo/unpack/Unpack.cxx @@ -5,15 +5,15 @@ #include "Unpack.h" -#include <chrono> - -#include <xpu/host.h> - #include "compat/Algorithm.h" #include "compat/OpenMP.h" #include "log.hpp" #include "util/TsUtils.h" +#include <chrono> + +#include <xpu/host.h> + using namespace std; using fles::Subsystem; diff --git a/algo/unpack/Unpack.h b/algo/unpack/Unpack.h index d5f37e602ae47c12a7b2c617e2a1c2766b08e00c..eb9f06cf1918953b50d81c15bdde9099a168e975 100644 --- a/algo/unpack/Unpack.h +++ b/algo/unpack/Unpack.h @@ -6,6 +6,17 @@ #ifndef UNPACK_H #define UNPACK_H 1 +#include "DigiData.h" +#include "PODVector.h" +#include "bmon/ReadoutConfig.h" +#include "bmon/Unpack.h" +#include "much/ReadoutConfig.h" +#include "much/Unpack.h" +#include "rich/ReadoutConfig.h" +#include "rich/Unpack.h" +#include "sts/Digi.h" +#include "sts/ReadoutConfigLegacy.h" +#include "sts/Unpack.h" #include "tof/ReadoutConfig.h" #include "tof/Unpack.h" #include "trd/ReadoutConfig.h" @@ -20,18 +31,6 @@ #include <xpu/host.h> -#include "DigiData.h" -#include "PODVector.h" -#include "bmon/ReadoutConfig.h" -#include "bmon/Unpack.h" -#include "much/ReadoutConfig.h" -#include "much/Unpack.h" -#include "rich/ReadoutConfig.h" -#include "rich/Unpack.h" -#include "sts/Digi.h" -#include "sts/ReadoutConfigLegacy.h" -#include "sts/Unpack.h" - namespace cbm::algo { @@ -49,8 +48,8 @@ namespace cbm::algo std::vector<trd2d::UnpackMonitorData> fTrd2d; ///< Monitoring data for TRD2D std::vector<rich::UnpackMonitorData> fRich; ///< Monitoring data for RICH xpu::timings fTime; - size_t fNumMs = 0; - size_t fNumBytes = 0; + size_t fNumMs = 0; + size_t fNumBytes = 0; size_t fNumBytesInSts = 0; size_t fNumBytesInMuch = 0; size_t fNumBytesInTof = 0; @@ -58,8 +57,8 @@ namespace cbm::algo size_t fNumBytesInTrd = 0; size_t fNumBytesInTrd2d = 0; size_t fNumBytesInRich = 0; - size_t fNumDigis = 0; - size_t fNumCompUsed = 0; + size_t fNumDigis = 0; + size_t fNumCompUsed = 0; size_t fNumErrInvalidEqId = 0; size_t fNumErrInvalidSysVer = 0; std::string print() const @@ -80,7 +79,7 @@ namespace cbm::algo **/ class Unpack { - public: + public: typedef std::pair<DigiData, UnpackMonitorData> resultType; using Subsystem = fles::Subsystem; @@ -91,31 +90,31 @@ namespace cbm::algo resultType operator()(const fles::Timeslice* timeslice); /** @brief Default constructor **/ - Unpack() {}; + Unpack(){}; /** @brief Destructor **/ - ~Unpack() {}; + ~Unpack(){}; /** @brief Parameters for STS unpackers **/ - sts::ReadoutConfigLegacy fStsConfig {}; + sts::ReadoutConfigLegacy fStsConfig{}; /** @brief Parameters for MUCH unpackers **/ - much::ReadoutConfig fMuchConfig {}; + much::ReadoutConfig fMuchConfig{}; /** @brief Parameters for TOF unpackers **/ - tof::ReadoutConfig fTofConfig {}; + tof::ReadoutConfig fTofConfig{}; /** @brief Parameters for Bmon unpackers **/ - bmon::ReadoutConfig fBmonConfig {}; + bmon::ReadoutConfig fBmonConfig{}; /** @brief Parameters for TRD unpackers **/ - trd::ReadoutConfig fTrdConfig {}; + trd::ReadoutConfig fTrdConfig{}; /** @brief Parameters for TRD2D unpackers **/ - trd2d::ReadoutConfig fTrd2dConfig {}; + trd2d::ReadoutConfig fTrd2dConfig{}; /** @brief Parameters for RICH unpackers **/ - rich::ReadoutConfig fRichConfig {}; + rich::ReadoutConfig fRichConfig{}; /** @@ -142,7 +141,7 @@ namespace cbm::algo return std::find(fSubsystems.begin(), fSubsystems.end(), subsystem) != fSubsystems.end(); } - private: // methods + private: // methods /** @brief Microslice loop **/ template<class Digi, class UnpackAlgo, class MonitorData> size_t MsLoop(const fles::Timeslice* timeslice, std::map<uint16_t, UnpackAlgo>& algoMap, const uint64_t comp, @@ -166,9 +165,9 @@ namespace cbm::algo void DoSort(PODVector<Digi>& digis); - private: // members - bool fApplyWalkCorrection = true; ///< Apply walk correction - std::vector<Subsystem> fSubsystems = {}; ///< Detector identifiers to unpack + private: // members + bool fApplyWalkCorrection = true; ///< Apply walk correction + std::vector<Subsystem> fSubsystems = {}; ///< Detector identifiers to unpack /** @brief STS unpackers **/ std::map<uint16_t, sts::Unpack> fAlgoSts = {}; @@ -196,7 +195,7 @@ namespace cbm::algo {Subsystem::STS, -970}, {Subsystem::MUCH, -980}, {Subsystem::RICH, 100}, {Subsystem::TOF, 40}, {Subsystem::BMON, 0}, {Subsystem::TRD, 1300}, {Subsystem::TRD2D, -510}}; - private: // methods + private: // methods template<typename UnpackAlgo> std::vector<uint16_t> GetEqIds(const std::map<uint16_t, UnpackAlgo>& algoMap) { diff --git a/algo/unpack/UnpackChain.h b/algo/unpack/UnpackChain.h index 6944f99ce65e6b799f51897fbd25f3407d0e2543..fbab36a67fbfde10c74b28baaed1a67b005a0d85 100644 --- a/algo/unpack/UnpackChain.h +++ b/algo/unpack/UnpackChain.h @@ -12,12 +12,12 @@ namespace cbm::algo class UnpackChain : public SubChain { - public: + public: void Init(); Unpack::resultType Run(const fles::Timeslice&); - private: + private: Unpack fUnpack; };