Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • le.koch/cbmroot
  • patrick.pfistner_AT_kit.edu/cbmroot
  • lena.rossel_AT_stud.uni-frankfurt.de/cbmroot
  • i.deppner/cbmroot
  • fweig/cbmroot
  • karpushkin_AT_inr.ru/cbmroot
  • v.akishina/cbmroot
  • rishat.sultanov_AT_cern.ch/cbmroot
  • l_fabe01_AT_uni-muenster.de/cbmroot
  • pwg-c2f/cbmroot
  • j.decuveland/cbmroot
  • a.toia/cbmroot
  • i.vassiliev/cbmroot
  • n.herrmann/cbmroot
  • o.lubynets/cbmroot
  • se.gorbunov/cbmroot
  • cornelius.riesen_AT_physik.uni-giessen.de/cbmroot
  • zhangqn17_AT_mails.tsinghua.edu.cn/cbmroot
  • bartosz.sobol/cbmroot
  • ajit.kumar/cbmroot
  • computing/cbmroot
  • a.agarwal_AT_vecc.gov.in/cbmroot
  • osingh/cbmroot
  • wielanek_AT_if.pw.edu.pl/cbmroot
  • malgorzata.karabowicz.stud_AT_pw.edu.pl/cbmroot
  • m.shiroya/cbmroot
  • s.roy/cbmroot
  • p.-a.loizeau/cbmroot
  • a.weber/cbmroot
  • ma.beyer/cbmroot
  • d.klein/cbmroot
  • d.smith/cbmroot
  • mvdsoft/cbmroot
  • d.spicker/cbmroot
  • y.h.leung/cbmroot
  • aksharma/cbmroot
  • m.deveaux/cbmroot
  • mkunold/cbmroot
  • h.darwish/cbmroot
  • pk.sharma_AT_vecc.gov.in/cbmroot
  • f_fido01_AT_uni-muenster.de/cbmroot
  • g.kozlov/cbmroot
  • d.emschermann/cbmroot
  • evgeny.lavrik/cbmroot
  • v.friese/cbmroot
  • f.uhlig/cbmroot
  • ebechtel_AT_ikf.uni-frankfurt.de/cbmroot
  • a.senger/cbmroot
  • praisig/cbmroot
  • s.lebedev/cbmroot
  • redelbach_AT_compeng.uni-frankfurt.de/cbmroot
  • p.subramani/cbmroot
  • a_meye37_AT_uni-muenster.de/cbmroot
  • om/cbmroot
  • o.golosov/cbmroot
  • l.chlad/cbmroot
  • a.bercuci/cbmroot
  • d.ramirez/cbmroot
  • v.singhal/cbmroot
  • h.schiller/cbmroot
  • apuntke/cbmroot
  • f.zorn/cbmroot
  • rubio_AT_physi.uni-heidelberg.de/cbmroot
  • p.chudoba/cbmroot
  • apuntke/mcbmroot
  • r.karabowicz/cbmroot
66 results
Show changes
Commits on Source (13)
Showing
with 730 additions and 2 deletions
......@@ -9,7 +9,9 @@ set(DEVICE_SRCS
set(SRCS
${DEVICE_SRCS}
base/Options.cxx
evbuild/EventBuilder.cxx
global/Reco.cxx
trigger/TimeClusterTrigger.cxx
evselector/DigiEventSelector.cxx
detectors/sts/StsHitfinderChain.cxx
......@@ -26,12 +28,30 @@ set(SRCS
detectors/trd/UnpackTrd.cxx
)
set(BUILD_INFO_CXX ${CMAKE_CURRENT_BINARY_DIR}/base/BuildInfo.cxx)
set(SRCS ${SRCS} ${BUILD_INFO_CXX})
add_custom_target(generateBuildInfo
COMMAND ${CMAKE_COMMAND}
-DBUILD_TYPE=${CMAKE_BUILD_TYPE}
-DXPU_DEBUG=${XPU_DEBUG}
-DINFILE=${CMAKE_CURRENT_SOURCE_DIR}/base/BuildInfo.cxx.in
-DOUTFILE=${BUILD_INFO_CXX}
-P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateBuildInfo.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/base/BuildInfo.cxx.in
${CMAKE_SOURCE_DIR}/cmake/modules/GenerateBuildInfo.cmake
BYPRODUCTS ${BUILD_INFO_CXX}
COMMENT "Generating build info"
)
add_library(Algo SHARED ${SRCS})
target_include_directories(Algo
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/base
${CMAKE_CURRENT_SOURCE_DIR}/evbuild
${CMAKE_CURRENT_SOURCE_DIR}/global
${CMAKE_CURRENT_SOURCE_DIR}/trigger
${CMAKE_CURRENT_SOURCE_DIR}/evselector
${CMAKE_CURRENT_SOURCE_DIR}/detectors/sts
......@@ -45,9 +65,10 @@ target_link_libraries(Algo
PUBLIC OnlineData
ROOT::GenVector
GSL
Boost::program_options
xpu
INTERFACE FairLogger::FairLogger
external::fles_ipc
xpu
)
target_compile_definitions(Algo PUBLIC NO_ROOT)
xpu_attach(Algo ${DEVICE_SRCS})
......
/* Copyright (C) 2022 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer]*/
#include "BuildInfo.h"
// GENERATED BY CMAKE.
// DON'T CHANGE BY HAND. MODIFY .in-File INSTEAD.
namespace cbm::algo::BuildInfo {
const std::string GIT_HASH = "@GIT_HASH@";
const std::string BUILD_TYPE = "@BUILD_TYPE@";
const bool GPU_DEBUG = @GPU_DEBUG@;
} // namespace cbm::algo::BuildInfo
/* Copyright (C) 2022 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer]*/
#ifndef CBM_ALGO_BUILD_INFO_H
#define CBM_ALGO_BUILD_INFO_H
#include <string>
namespace cbm::algo::BuildInfo
{
extern const std::string GIT_HASH;
extern const std::string BUILD_TYPE;
extern const bool GPU_DEBUG;
} // namespace cbm::algo::BuildInfo
#endif // CBM_ALGO_BUILD_INFO_H
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_CHAINCONTEXT_H
#define CBM_ALGO_BASE_CHAINCONTEXT_H
#include "Options.h"
namespace cbm::algo
{
struct ChainContext {
Options opts;
};
} // namespace cbm::algo
#endif
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#include "Options.h"
#include <boost/program_options.hpp>
#include <iostream>
using namespace cbm::algo;
Options::Options(int argc, char** argv)
{
namespace po = boost::program_options;
po::options_description required("Required options");
// clang-format off
required.add_options()
("param-dir,p", po::value<std::string>(&fParamsDir)->value_name("<folder>")->required(),
"read program options from this folder")
("input-locator,i", po::value<std::string>(&fInputLocator)->value_name("<locator>")->required(),
"URI specifying input timeslice source")
;
// clang-format on
po::options_description generic("Other options");
// clang-format off
generic.add_options()
("device,d", po::value<std::string>(&fDevice)->default_value("cpu")->value_name("<device>"),
"select device (cpu, cuda0, cuda1, hip0, ...)")
("log-level,l", po::value<std::string>(&fLogLevel)->default_value("info")->value_name("<level>"),
"set log level (debug, info, warning, error, fatal)")
("num-ts,n", po::value<int>(&fNumTimeslices)->default_value(-1)->value_name("<num>"),
"Stop after <num> timeslices (-1 = all)")
("skip-ts,s", po::value<int>(&fSkipTimeslices)->default_value(0)->value_name("<num>"),
"Skip first <num> timeslices")
("times,t", po::bool_switch(&fCollectKernelTimes)->default_value(false),
"print kernel times")("help,h", "produce help message")
;
// clang-format on
po::options_description cmdline_options;
cmdline_options.add(required).add(generic);
po::variables_map vm;
po::command_line_parser parser {argc, argv};
parser.options(cmdline_options);
po::store(parser.run(), vm);
if (vm.count("help")) {
std::cerr << cmdline_options << std::endl;
std::exit(0);
}
try {
po::notify(vm);
}
catch (const po::required_option& e) {
std::cerr << "Error: " << e.what() << std::endl;
std::cerr << cmdline_options << std::endl;
std::exit(1);
}
}
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_OPTIONS_H
#define CBM_ALGO_BASE_OPTIONS_H
#include <filesystem>
#include <string>
namespace cbm::algo
{
class Options {
public:
Options() = default;
Options(int argc, char** argv);
std::filesystem::path ParamsDir() const { return fParamsDir; }
const std::string& InputLocator() const { return fInputLocator; }
const std::string& LogLevel() const { return fLogLevel; }
const std::string& Device() const { return fDevice; }
bool CollectKernelTimes() const { return fCollectKernelTimes; }
int NumTimeslices() const { return fNumTimeslices; }
int SkipTimeslices() const { return fSkipTimeslices; }
private:
std::string fParamsDir; // TODO: can we make this a std::path?
std::string fInputLocator;
std::string fLogLevel;
std::string fDevice;
bool fCollectKernelTimes = false;
int fNumTimeslices = -1;
int fSkipTimeslices = 0;
};
} // namespace cbm::algo
#endif
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_PRELUDE_H
#define CBM_ALGO_BASE_PRELUDE_H
#include <cstdint>
#include <gsl/span>
namespace cbm::algo
{
// typealias for Rust-like fixed size integer types
using i8 = std::int8_t;
using u8 = std::uint8_t;
using i16 = std::int16_t;
using u16 = std::uint16_t;
using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using f32 = float;
using f64 = double;
#ifdef CBM_ALGO_REAL64
using real = f64;
#else
using real = f32;
#endif
#if !XPU_IS_CUDA && !XPU_IS_HIP // FIXME why doesn't this work with CUDA?
template<typename T>
using span = gsl::span<T>;
template<typename T>
using cspan = gsl::span<const T>;
#endif
} // namespace cbm::algo
#endif // CBM_ALGO_BASE_PRELUDE_H
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_RECOPARAMS_H
#define CBM_ALGO_BASE_RECOPARAMS_H
#include <xpu/defines.h>
#include "Prelude.h"
#include "config/Property.h"
namespace cbm::algo
{
/**
* @brief RecoParams contains all parameters to configure reconstruction
*/
struct RecoParams {
enum SortMode : u8
{
SortBlockSort = 0,
SortCUBSegmentedSort = 1,
};
enum UnpackMode : u8
{
CPU,
XPU,
};
struct STS {
SortMode digiSortMode;
SortMode clusterSortMode;
UnpackMode unpackMode;
u8 findClustersMultiKernels;
f32 timeCutDigiAbs;
f32 timeCutDigiSig;
f32 timeCutClusterAbs;
f32 timeCutClusterSig;
struct MemoryLimits {
u64 maxDigisPerTS;
u64 maxDigisPerMS;
u64 maxDigisPerModule;
f64 clustersPerDigiTS;
f64 clustersPerDigiModule;
f64 hitsPerClusterTS;
f64 hitsPerClusterModule;
XPU_D u64 maxClustersPerTS() const { return maxDigisPerTS * clustersPerDigiTS; }
XPU_D u64 maxClustersPerModule() const { return maxDigisPerModule * clustersPerDigiModule; }
XPU_D u64 maxHitsPerClusterTS() const { return maxClustersPerTS() * hitsPerClusterTS; }
XPU_D u64 maxHitsPerClusterModule() const { return maxClustersPerModule() * hitsPerClusterModule; }
static constexpr auto Properties = std::make_tuple(
config::Property(&MemoryLimits::maxDigisPerTS, "maxDigisPerTS", "Maximal number of digis per time slice"),
config::Property(&MemoryLimits::maxDigisPerMS, "maxDigisPerMS", "Maximal number of digis per micro slice"),
config::Property(&MemoryLimits::maxDigisPerModule, "maxDigisPerModule", "Maximal number of digis per module"),
config::Property(&MemoryLimits::clustersPerDigiTS, "clustersPerDigiTS",
"Number of clusters per digi in a time slice"),
config::Property(&MemoryLimits::clustersPerDigiModule, "clustersPerDigiModule",
"Number of clusters per digi in a module"),
config::Property(&MemoryLimits::hitsPerClusterTS, "hitsPerClusterTS",
"Number of hits per cluster in a time slice"),
config::Property(&MemoryLimits::hitsPerClusterModule, "hitsPerClusterModule",
"Number of hits per cluster in a module"));
} memoryLimits;
static constexpr auto Properties = std::make_tuple(
config::Property(&STS::digiSortMode, "digiSortMode",
"Digi sort mode (0 = block sort, 1 = cub segmented sort))"),
config::Property(&STS::clusterSortMode, "clusterSortMode", "Cluster sort mode"),
config::Property(&STS::unpackMode, "unpackMode", "Unpack mode (0 = legacy, 1 = XPU)"),
config::Property(&STS::findClustersMultiKernels, "findClustersMultiKernels",
"Split cluster finding into multiple kernels"),
config::Property(&STS::timeCutDigiAbs, "timeCutDigiAbs",
"Time delta for neighboring digis to be considered for the same cluster. [ns]"),
config::Property(
&STS::timeCutDigiSig, "timeCutDigiSig",
"Used if timeCutDigiAbs is negative. Time delta must be < 'value * sqrt2 * timeResolution'. [ns]"),
config::Property(&STS::timeCutClusterAbs, "timeCutClusterAbs",
"Maximal time difference between two clusters in a hit [ns]."
" Setting to a positive value will override timeCutClustersSig."),
config::Property(
&STS::timeCutClusterSig, "timeCutClusterSig",
"Time cut for clusters."
" Two clusters are considered it their time difference is below 'value * sqrt(terr1**2 + terr2*+2)'"),
config::Property(&STS::memoryLimits, "memoryLimits", "Memory limits for STS reco"));
};
STS sts;
static constexpr auto Properties = std::make_tuple(config::Property(&RecoParams::sts, "sts", "STS reco settings"));
};
}; // namespace cbm::algo
#endif // CBM_ALGO_BASE_RECOPARAMS_H
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_SUBCHAIN_H
#define CBM_ALGO_BASE_SUBCHAIN_H
#include <gsl/pointers>
#include "ChainContext.h"
namespace cbm::algo
{
class SubChain {
public:
void SetContext(ChainContext* ctx) { fContext = ctx; }
const Options& Opts() const { return gsl::make_not_null(fContext)->opts; }
private:
ChainContext* fContext = nullptr;
};
} // namespace cbm::algo
#endif
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_CONFIG_BASETYPES_H
#define CBM_ALGO_BASE_CONFIG_BASETYPES_H
#include <string>
#include <tuple>
#include <vector>
#include "Prelude.h"
namespace cbm::algo::config
{
using BaseTypes = std::tuple<bool, u8, i8, u16, i16, u32, i32, u64, i64, f32, f64, std::string>;
template<typename T, typename Tuple>
struct has_type;
template<typename T, typename... Us>
struct has_type<T, std::tuple<Us...>> : std::disjunction<std::is_same<T, Us>...> {
};
template<typename T>
constexpr bool IsBaseType = has_type<T, BaseTypes>::value;
template<typename T>
constexpr bool IsEnum = std::is_enum_v<T>;
template<typename T, typename = std::enable_if_t<IsBaseType<T>>>
constexpr std::string_view BaseTypeToStr()
{
if constexpr (std::is_same_v<bool, T>) { return "bool"; }
else if constexpr (std::is_same_v<u8, T>) {
return "u8";
}
else if constexpr (std::is_same_v<i8, T>) {
return "i8";
}
else if constexpr (std::is_same_v<u16, T>) {
return "u16";
}
else if constexpr (std::is_same_v<i16, T>) {
return "i16";
}
else if constexpr (std::is_same_v<u32, T>) {
return "u32";
}
else if constexpr (std::is_same_v<i32, T>) {
return "i32";
}
else if constexpr (std::is_same_v<float, T>) {
return "float";
}
else if constexpr (std::is_same_v<std::string, T>) {
return "string";
}
else {
return "unknown";
}
}
template<typename>
struct is_std_vector : std::false_type {
};
template<typename T, typename A>
struct is_std_vector<std::vector<T, A>> : std::true_type {
};
template<typename T>
constexpr bool IsVector = is_std_vector<T>::value;
template<typename>
struct is_std_array : std::false_type {
};
template<typename T, std::size_t N>
struct is_std_array<std::array<T, N>> : std::true_type {
};
template<typename T>
constexpr bool IsArray = is_std_array<T>::value;
} // namespace cbm::algo::config
#endif // CBM_ALGO_BASE_CONFIG_BASETYPES_H
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_CONFIG_PROPERTY_H
#define CBM_ALGO_BASE_CONFIG_PROPERTY_H
#include <optional>
#include <string_view>
#include <tuple>
#include <yaml-cpp/emittermanip.h>
#include "Prelude.h"
namespace cbm::algo::config
{
template<typename Class, typename T>
class Property {
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:
using ClassType = Class;
using ValueType = T;
Property() = delete;
constexpr Property(T Class::*member, std::string_view key, std::string_view description = "",
std::optional<YAML::EMITTER_MANIP> fmt = {}, std::optional<YAML::EMITTER_MANIP> fmtEntries = {})
: fMember(member)
, fKey(key)
, fDescription(description)
, fFormat(fmt)
, fFormatEntries(fmtEntries)
{
}
Property(const Property&) = delete;
Property& operator=(const Property&) = delete;
Property(Property&&) = default;
Property& operator=(Property&&) = default;
std::string_view Key() const { return fKey; }
std::string_view Description() const { return fDescription; }
std::optional<YAML::EMITTER_MANIP> Format() const { return fFormat; }
std::optional<YAML::EMITTER_MANIP> FormatEntries() const { return fFormatEntries; }
T& Get(Class& object) const { return object.*fMember; }
const T& Get(const Class& object) const { return object.*fMember; }
void Set(Class& object, const T& value) const { object.*fMember = value; }
};
template<typename Class, typename T>
Property(T Class::*member, std::string_view key, std::string_view description) -> Property<Class, T>;
} // namespace cbm::algo::config
#endif // CBM_ALGO_BASE_CONFIG_PROPERTY_H
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_BASE_CONFIG_DESERIALIZE_H
#define CBM_ALGO_BASE_CONFIG_DESERIALIZE_H
#include <fairlogger/Logger.h>
#include <sstream>
#include <string_view>
#include <yaml-cpp/yaml.h>
#include "BaseTypes.h"
#include "Prelude.h"
#include "Property.h"
namespace CORE_INTERFACE_NS::config
{
template<typename T, T... Values, typename Func>
constexpr void ForEach(std::integer_sequence<T, Values...>, Func&& func)
{
(func(std::integral_constant<T, Values> {}), ...);
}
template<typename T>
T Read(const YAML::Node& node)
{
using Type = std::remove_cv_t<std::remove_reference_t<T>>;
// TODO: error handling
if constexpr (IsBaseType<Type>) { return node.as<Type>(); }
else if constexpr (IsEnum<Type>) {
return static_cast<Type>(node.as<std::underlying_type_t<Type>>());
}
else if constexpr (IsVector<Type>) {
Type vector;
for (const auto& element : node) {
vector.push_back(Read<typename Type::value_type>(element));
}
return vector;
}
else if constexpr (IsArray<Type>) {
Type array {};
auto vector = Read<std::vector<typename Type::value_type>>(node);
if (vector.size() != array.size()) {
throw std::runtime_error(fmt::format("Array size mismatch: expected {}, got {}", array.size(), vector.size()));
}
std::copy(vector.begin(), vector.end(), array.begin());
return array;
}
else {
Type object;
constexpr auto nProperties = std::tuple_size<decltype(Type::Properties)>::value;
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()}]);
});
return object;
}
}
template<typename T>
std::string MakeDocString(int indent = 0)
{
using Type = std::remove_cv_t<std::remove_reference_t<T>>;
std::stringstream docString;
if constexpr (IsBaseType<Type>) { docString << BaseTypeToStr<Type>(); }
else if constexpr (IsVector<Type> || IsArray<Type>) {
using ChildType = typename Type::value_type;
if constexpr (IsBaseType<ChildType>) {
docString << std::string(indent, ' ') << "list of " << BaseTypeToStr<ChildType>() << std::endl;
}
else {
docString << std::string(indent, ' ') << "list of" << std::endl;
docString << MakeDocString<ChildType>(indent + 2);
}
}
else {
constexpr auto nProperties = std::tuple_size<decltype(Type::Properties)>::value;
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);
if constexpr (IsBaseType<ChildType>) {
docString << std::string(indent, ' ') << property.Key() << ": " << property.Description() << " ["
<< BaseTypeToStr<ChildType>() << "]" << std::endl;
}
else {
docString << std::string(indent, ' ') << property.Key() << ": " << property.Description() << std::endl;
docString << MakeDocString<ChildType>(indent + 2);
}
});
}
return docString.str();
}
class Dump {
public:
template<typename T>
std::string operator()(const T& object)
{
YAML::Emitter ss;
ss << YAML::BeginDoc;
DoDump(object, ss);
ss << YAML::EndDoc;
return ss.c_str();
}
private:
template<typename T>
void DoDump(const T& object, YAML::Emitter& ss, std::optional<YAML::EMITTER_MANIP> formatEntries = {})
{
if constexpr (IsBaseType<T>) { ss << object; }
else if constexpr (IsVector<T> || IsArray<T>) {
ss << YAML::BeginSeq;
for (const auto& element : object) {
if (formatEntries.has_value()) { ss << formatEntries.value(); }
DoDump(element, ss);
}
ss << YAML::EndSeq;
}
else {
constexpr auto nProperties = std::tuple_size<decltype(T::Properties)>::value;
ss << YAML::BeginMap;
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::Value;
DoDump(value, ss, property.FormatEntries());
});
ss << YAML::EndMap;
}
}
};
} // namespace CORE_INTERFACE_NS::config
#endif
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#include "Reco.h"
using namespace cbm::algo;
Reco::Reco() {}
Reco::~Reco() {}
void Reco::Init(const Options&) {}
void Reco::Run() {}
void Reco::Finalize() {}
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#ifndef CBM_ALGO_GLOBAL_RECO_H
#define CBM_ALGO_GLOBAL_RECO_H
#include "SubChain.h"
namespace fles
{
class Timeslice;
} // namespace fles
namespace cbm::algo
{
class Options;
class Reco : SubChain {
public:
Reco();
~Reco();
Reco(const Reco&) = delete;
Reco& operator=(const Reco&) = delete;
Reco(Reco&&) = delete;
Reco& operator=(Reco&&) = delete;
void Init(const Options&);
void Run();
void Finalize();
private:
bool fInitialized = false;
ChainContext fContext;
};
} // namespace cbm::algo
#endif
---
sts:
# 0: block_sort, 1: cub
digiSortMode: 0
clusterSortMode: 0
# 0: cpu, 1: xpu
unpackMode: 0
findClustersMultiKernels: 1
timeCutDigiAbs: -1
timeCutDigiSig: 3
timeCutClusterAbs: -1
timeCutClusterSig: 4
memoryLimits:
maxDigisPerTS: 80000000
# TODO: Find sensible value!
maxDigisPerMS: 100000
# TODO: Find sensible value
maxDigisPerModule: 4000000
clustersPerDigiTS: 1.0
clustersPerDigiModule: 1.0
hitsPerClusterTS: 1.0
hitsPerClusterModule: 1.0
...
......@@ -81,6 +81,7 @@ void CbmConverterManager::FillDataHeader()
std::cout << "ReadDataHeader" << std::endl;
data_header->SetSystem(system_);
data_header->SetBeamMomentum(beam_mom_);
data_header->SetTimeSliceLength(ts_length_);
auto& psd_mod_pos = data_header->AddDetector();
const int psd_node_id = 6;
......
......@@ -35,6 +35,7 @@ public:
void SetSystem(const std::string& system) { system_ = system; }
void SetBeamMomentum(float beam_mom) { beam_mom_ = beam_mom; }
void SetTimeSliceLength(float ts_length) { ts_length_ = ts_length; }
void SetOutputName(std::string file, std::string tree = "rTree")
{
......@@ -56,6 +57,7 @@ private:
std::string system_;
float beam_mom_ {0.};
float ts_length_ {0.};
std::vector<CbmConverterTask*> tasks_ {};
......
......@@ -28,6 +28,7 @@ void CbmRecEventHeaderConverter::Init()
cbm_prim_vertex_ = (CbmVertex*) ioman->GetObject("PrimaryVertex.");
cbm_sts_tracks_ = (TClonesArray*) ioman->GetObject("StsTrack");
cbm_psd_hits_ = (TClonesArray*) ioman->GetObject("PsdHit");
fTimeSlice = static_cast<CbmTimeSlice*>(ioman->GetObject("TimeSlice."));
// ***** RecEventHeader *******
AnalysisTree::BranchConfig RecEventHeaderBranch("RecEventHeader", AnalysisTree::DetType::kEventHeader);
......@@ -39,6 +40,7 @@ void CbmRecEventHeaderConverter::Init()
RecEventHeaderBranch.AddField<float>("end_time", "End time of the event, ns");
RecEventHeaderBranch.AddField<float>("match_weight", "");
RecEventHeaderBranch.AddField<float>("T0", "Reconstructed T0, ns");
RecEventHeaderBranch.AddField<float>("tStartTS", "TS start time, ns");
ivtx_chi2_ = RecEventHeaderBranch.GetFieldId("vtx_chi2");
iEpsd_ = RecEventHeaderBranch.GetFieldId("Epsd");
......@@ -48,6 +50,7 @@ void CbmRecEventHeaderConverter::Init()
iend_time_ = RecEventHeaderBranch.GetFieldId("end_time");
imatch_weight_ = RecEventHeaderBranch.GetFieldId("match_weight");
iT0_ = RecEventHeaderBranch.GetFieldId("T0");
iTStartTS_ = RecEventHeaderBranch.GetFieldId("tStartTS");
auto* man = AnalysisTree::TaskManager::GetInstance();
man->AddBranch(rec_event_header_, RecEventHeaderBranch);
......@@ -68,12 +71,15 @@ void CbmRecEventHeaderConverter::ProcessData(CbmEvent* event)
rec_event_header_->SetField(GetPsdEnergy(event), iEpsd_);
int evt_id;
float match_weight, start_time, end_time, T0;
float match_weight, start_time, end_time, T0, tStartTS;
if (event) {
evt_id = event->GetUniqueID();
start_time = event->GetStartTime();
end_time = event->GetEndTime();
T0 = event->GetTzero();
tStartTS = fTimeSlice->GetStartTime();
if (event->GetMatch()) match_weight = float(event->GetMatch()->GetMatchedLink().GetWeight());
else
match_weight = 0.;
......@@ -83,12 +89,14 @@ void CbmRecEventHeaderConverter::ProcessData(CbmEvent* event)
start_time = cbm_header_->GetT();
end_time = cbm_header_->GetT();
T0 = -999999.;
tStartTS = -1.;
match_weight = 1.;
}
rec_event_header_->SetField(evt_id, ievt_id_);
rec_event_header_->SetField(start_time, istart_time_);
rec_event_header_->SetField(end_time, iend_time_);
rec_event_header_->SetField(T0, iT0_);
rec_event_header_->SetField(tStartTS, iTStartTS_);
rec_event_header_->SetField(match_weight, imatch_weight_);
}
......
......@@ -8,6 +8,7 @@
#include "CbmConverterTask.h"
#include "CbmDefs.h"
#include "CbmEvent.h"
#include "CbmTimeSlice.h"
#include "AnalysisTree/EventHeader.hpp"
......@@ -33,6 +34,7 @@ private:
TClonesArray* cbm_sts_tracks_ {nullptr}; ///< non-owning pointer
FairMCEventHeader* cbm_header_ {nullptr}; ///< non-owning pointer
CbmVertex* cbm_prim_vertex_ {nullptr}; ///< non-owning pointer
CbmTimeSlice* fTimeSlice {nullptr};
int ivtx_chi2_ {AnalysisTree::UndefValueInt};
int iEpsd_ {AnalysisTree::UndefValueInt};
......@@ -42,6 +44,7 @@ private:
int iend_time_ {AnalysisTree::UndefValueInt};
int imatch_weight_ {AnalysisTree::UndefValueInt};
int iT0_ {AnalysisTree::UndefValueInt};
int iTStartTS_ {AnalysisTree::UndefValueInt};
ClassDef(CbmRecEventHeaderConverter, 1)
};
......