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
Showing
with 1417 additions and 0 deletions
/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#pragma once
#include <tuple>
#include <type_traits>
/**
* @file AlgoTraits.h
* @brief Type traits for online algorithms
*/
namespace cbm::algo::algo_traits
{
namespace detail
{
template<typename...>
struct ResultOf {
};
template<typename R, typename Algo, typename... Args>
struct ResultOf<R (Algo::*)(Args...) const> {
using type = R;
};
template<typename R, typename Algo, typename... Args>
struct ResultOf<R (Algo::*)(Args...)> {
using type = R;
};
template<typename Algo>
struct ResultOf<Algo> : ResultOf<decltype(&Algo::operator())> {
};
} // namespace detail
/**
* @brief Type alias for the return type produced by an algorithm when invoked via callable-operator
*/
template<typename Algo>
using ResultOf_t = typename detail::ResultOf<Algo>::type;
// Currently assume algorithms return std::tuple<R, M, A>
// where R is the output, M is the monitoring data and A is auxiliary data
/**
* @brief Type alias for the output type produced by an algorithm
*/
template<typename Algo>
using Output_t = typename std::tuple_element<0, ResultOf_t<Algo>>::type;
/**
* @brief Type alias for the monitoring type produced by an algorithm
*/
template<typename Algo>
using Monitor_t = typename std::tuple_element<1, ResultOf_t<Algo>>::type;
/**
* @brief Type alias for the auxiliary data type produced by an algorithm
*/
template<typename Algo>
using Aux_t = typename std::tuple_element<2, ResultOf_t<Algo>>::type;
} // namespace cbm::algo::algo_traits
/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Sergei Zharko [committer] */
/// \file AuxDigiData.h
/// \date 10.06.2024
/// \brief Collection of auxiliary data from unpackers (header)
/// \author Sergei Zharko <s.zharko@gsi.de>
#pragma once
#include "CommonUnpacker.h"
#include "bmon/UnpackMS.h"
#include "much/UnpackMS.h"
#include "rich/UnpackMS.h"
#include "sts/UnpackMS.h"
#include "tof/UnpackMS.h"
#include "trd/UnpackMS.h"
#include "trd2d/UnpackMS.h"
#include <vector>
namespace cbm::algo
{
/// \struct AuxDigiData
/// \brief Collection of auxiliary digi objects from different module unpackers
struct AuxDigiData {
UnpackAux<bmon::UnpackAuxData> fBmon;
UnpackAux<much::UnpackAuxData> fMuch;
UnpackAux<rich::UnpackAuxData> fRich;
UnpackAux<sts::UnpackAuxData> fSts;
UnpackAux<tof::UnpackAuxData> fTof;
UnpackAux<trd::UnpackAuxData> fTrd;
UnpackAux<trd2d::UnpackAuxData> fTrd2d;
};
} // namespace cbm::algo
/* 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>
#define MAKE_GCC_VERSION(major, minor, patch) ((major) *10000 + (minor) *100 + (patch))
#define GCC_VERSION MAKE_GCC_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#if __has_include(<execution>) && !defined(__CLING__)
#include <execution> // for feature test macro __cpp_lib_parallel_algorithm
#endif
#if defined(HAVE_TBB) && defined(__cpp_lib_parallel_algorithm)
#define HAVE_PARALLEL_STL_LIBTBB
#endif
// PoolSTL triggers an internal error in GCC 10, so only enable it for GCC 11 and later
#if GCC_VERSION >= MAKE_GCC_VERSION(11, 0, 0)
#define HAVE_PARALLEL_STL_POOLSTL
#endif
#if __has_include(<omp.h>)
#define HAVE_OMP
#endif
// Ensure we have the boost compression header AND flesnet is compiled with compression enabled
#if __has_include(<boost/iostreams/filter/zstd.hpp>) && defined(BOOST_IOS_HAS_ZSTD)
#define HAVE_ZSTD
#endif
namespace cbm::algo::BuildInfo
{
extern const std::string GIT_HASH;
extern const std::string BUILD_TYPE;
extern const bool GPU_DEBUG;
inline constexpr bool WITH_TBB =
#ifdef HAVE_TBB
true;
#else
false;
#endif
inline constexpr bool WITH_PARALLEL_STL =
#ifdef HAVE_PARALLEL_STL_LIBTBB
true;
#else
false;
#endif
inline constexpr bool WITH_OMP =
#ifdef HAVE_OMP
true;
#else
false;
#endif
inline constexpr bool WITH_ZSTD =
#ifdef HAVE_ZSTD
true;
#else
false;
#endif
} // 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] */
#include "ChainContext.h"
#include <Monitor.hpp>
using namespace cbm::algo;
ChainContext::ChainContext() {}
ChainContext::~ChainContext() {}
/* 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"
#include "RecoParams.h"
#include <memory>
#include <optional>
namespace cbm
{
// cbm::Monitor must be forward declared. This prevents an issue in older ROOT versions,
// where cling would crash upon parsing the header file (in some stl header)
class Monitor;
} // namespace cbm
namespace cbm::algo
{
struct ChainContext {
// default constructor / destructor
// But have to be defined in the .cxx file, because of forward declaration of cbm::Monitor
ChainContext();
~ChainContext();
Options opts;
RecoParams recoParams;
std::unique_ptr<cbm::Monitor> monitor; //! Monitor
};
} // 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_BASE_TYPES_H
#define CBM_BASE_TYPES_H
#include "CbmEnumDict.h"
#include "MicrosliceDescriptor.hpp" // For fles::Subsystem
#include <cstdint>
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
enum class Step
{
Unpack,
DigiTrigger,
LocalReco,
Tracking,
};
enum class RecoData
{
DigiTimeslice, //< Raw output from unpackers
DigiEvent, //< Digis after event building
Cluster,
Hit,
Track,
};
// FIXME: Remove the Setup enumeration, replace it with a config.
enum class Setup
{
mCBM2022,
mCBM2024_03,
mCBM2024_05,
mCBM2025_02,
};
enum class QaStep
{
BeamBmon,
UnpackBmon,
UnpackSts,
UnpackMvd,
UnpackRich,
UnpackTrd1d,
UnpackTrd2d,
UnpackMuch,
UnpackTof,
UnpackFsd,
EventBuilding,
RecoBmon,
RecoSts,
RecoMvd,
RecoRich,
RecoTrd1d,
RecoTrd2d,
RecoMuch,
RecoTof,
RecoFsd,
Tracking,
V0Finder,
V0Trigger,
};
} // namespace cbm::algo
CBM_ENUM_DICT(fles::Subsystem,
// CBM detectors
{"STS", fles::Subsystem::STS},
{"MVD", fles::Subsystem::MVD},
{"RICH", fles::Subsystem::RICH},
{"TRD", fles::Subsystem::TRD},
{"TRD2D", fles::Subsystem::TRD2D},
{"MUCH", fles::Subsystem::MUCH},
{"TOF", fles::Subsystem::TOF},
// Other detectors (experimental)
{"ECAL", fles::Subsystem::ECAL},
{"PSD", fles::Subsystem::PSD},
{"BMON", fles::Subsystem::BMON},
{"TRB3", fles::Subsystem::TRB3},
{"Hodoscope", fles::Subsystem::Hodoscope},
{"Cherenkov", fles::Subsystem::Cherenkov},
{"LeadGlass", fles::Subsystem::LeadGlass},
// FLES (pattern generators)
{"FLES", fles::Subsystem::FLES},
);
CBM_ENUM_DICT(cbm::algo::Step,
{"Unpack", cbm::algo::Step::Unpack},
{"DigiTrigger", cbm::algo::Step::DigiTrigger},
{"LocalReco", cbm::algo::Step::LocalReco},
{"Tracking", cbm::algo::Step::Tracking}
);
CBM_ENUM_DICT(cbm::algo::RecoData,
{"DigiTimeslice", cbm::algo::RecoData::DigiTimeslice},
{"DigiEvent", cbm::algo::RecoData::DigiEvent},
{"Cluster", cbm::algo::RecoData::Cluster},
{"Hit", cbm::algo::RecoData::Hit},
{"Track", cbm::algo::RecoData::Track}
);
CBM_ENUM_DICT(cbm::algo::Setup,
{"mCBM2022", cbm::algo::Setup::mCBM2022},
{"mCBM2024_03", cbm::algo::Setup::mCBM2024_03},
{"mCBM2024_05", cbm::algo::Setup::mCBM2024_05},
{"mCBM2025_02", cbm::algo::Setup::mCBM2025_02}
);
CBM_ENUM_DICT(cbm::algo::QaStep,
{"BeamBmon", cbm::algo::QaStep::BeamBmon},
{"UnpackBmon", cbm::algo::QaStep::UnpackBmon},
{"UnpackSts", cbm::algo::QaStep::UnpackSts},
{"UnpackMvd", cbm::algo::QaStep::UnpackMvd},
{"UnpackRich", cbm::algo::QaStep::UnpackRich},
{"UnpackTrd1d", cbm::algo::QaStep::UnpackTrd1d},
{"UnpackTrd2d", cbm::algo::QaStep::UnpackTrd2d},
{"UnpackMuch", cbm::algo::QaStep::UnpackMuch},
{"UnpackTof", cbm::algo::QaStep::UnpackTof},
{"UnpackFsd", cbm::algo::QaStep::UnpackFsd},
{"EventBuilding", cbm::algo::QaStep::EventBuilding},
{"RecoBmon", cbm::algo::QaStep::RecoBmon},
{"RecoSts", cbm::algo::QaStep::RecoSts},
{"RecoMvd", cbm::algo::QaStep::RecoMvd},
{"RecoRich", cbm::algo::QaStep::RecoRich},
{"RecoTrd1d", cbm::algo::QaStep::RecoTrd1d},
{"RecoTrd2d", cbm::algo::QaStep::RecoTrd2d},
{"RecoMuch", cbm::algo::QaStep::RecoMuch},
{"RecoTof", cbm::algo::QaStep::RecoTof},
{"RecoFsd", cbm::algo::QaStep::RecoFsd},
{"Tracking", cbm::algo::QaStep::Tracking},
{"V0Finder", cbm::algo::QaStep::V0Finder},
{"V0Trigger", cbm::algo::QaStep::V0Trigger}
);
#endif
/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#include "DigiData.h"
using namespace cbm::algo;
// Ctor / Dtor defined in .cxx file so we can use forward declarations for digi types in the header
DigiData::DigiData() {}
DigiData::~DigiData() {}
DigiData::DigiData(const CbmDigiData& storable)
: fSts(ToPODVector(storable.fSts.fDigis))
, fMuch(ToPODVector(storable.fMuch.fDigis))
, fTof(ToPODVector(storable.fTof.fDigis))
, fBmon(ToPODVector(storable.fBmon.fDigis))
, fTrd(ToPODVector(storable.fTrd.fDigis))
, fTrd2d(ToPODVector(storable.fTrd2d.fDigis))
, fRich(ToPODVector(storable.fRich.fDigis))
, fPsd(ToPODVector(storable.fPsd.fDigis))
, fFsd(ToPODVector(storable.fFsd.fDigis))
{
}
size_t DigiData::Size(ECbmModuleId system) const
{
switch (system) {
case ECbmModuleId::kSts: return fSts.size();
case ECbmModuleId::kMuch: return fMuch.size();
case ECbmModuleId::kTof: return fTof.size();
case ECbmModuleId::kBmon: return fBmon.size();
case ECbmModuleId::kTrd: return fTrd.size();
case ECbmModuleId::kTrd2d: return fTrd2d.size();
case ECbmModuleId::kRich: return fRich.size();
case ECbmModuleId::kPsd: return fPsd.size();
case ECbmModuleId::kFsd: return fFsd.size();
default: throw std::runtime_error("DigiData: Invalid system Id " + ::ToString(system));
}
}
size_t DigiData::TotalSize() const
{
return fSts.size() + fMuch.size() + fTof.size() + fBmon.size() + fTrd.size() + fTrd2d.size() + fRich.size()
+ fPsd.size() + fFsd.size();
}
size_t DigiData::TotalSizeBytes() const
{
return sizeof(CbmStsDigi) * fSts.size() + sizeof(CbmMuchDigi) * fMuch.size() + sizeof(CbmTofDigi) * fTof.size()
+ sizeof(CbmBmonDigi) * fBmon.size() + sizeof(CbmTrdDigi) * fTrd.size() + sizeof(CbmTrdDigi) * fTrd2d.size()
+ sizeof(CbmRichDigi) * fRich.size() + sizeof(CbmPsdDigi) * fPsd.size() + sizeof(CbmFsdDigi) * fFsd.size();
}
CbmDigiData DigiData::ToStorable() const
{
return CbmDigiData{
.fBmon =
{
.fDigis = ToStdVector(fBmon),
},
.fSts =
{
.fDigis = ToStdVector(fSts),
},
.fMuch =
{
.fDigis = ToStdVector(fMuch),
},
.fRich =
{
.fDigis = ToStdVector(fRich),
},
.fTrd =
{
.fDigis = ToStdVector(fTrd),
},
.fTrd2d =
{
.fDigis = ToStdVector(fTrd2d),
},
.fTof =
{
.fDigis = ToStdVector(fTof),
},
.fPsd =
{
.fDigis = ToStdVector(fPsd),
},
.fFsd =
{
.fDigis = ToStdVector(fFsd),
},
};
}
std::vector<DigiEvent> DigiEvent::FromCbmDigiEvents(const std::vector<CbmDigiEvent>& events)
{
std::vector<DigiEvent> result;
result.reserve(events.size());
for (const auto& event : events) {
result.emplace_back(event);
}
return result;
}
std::vector<CbmDigiEvent> DigiEvent::ToCbmDigiEvents(const std::vector<DigiEvent>& events)
{
std::vector<CbmDigiEvent> result;
result.reserve(events.size());
for (const auto& event : events) {
result.emplace_back(event.ToStorable());
}
return result;
}
DigiEvent::DigiEvent(const CbmDigiEvent& storable)
: DigiData(storable.fData)
, fNumber(storable.fNumber)
, fTime(storable.fTime)
, fSelectionTriggers(storable.fSelectionTriggers)
{
}
CbmDigiEvent DigiEvent::ToStorable() const
{
return CbmDigiEvent{
.fData = DigiData::ToStorable(),
.fNumber = fNumber,
.fTime = fTime,
.fSelectionTriggers = fSelectionTriggers,
};
}
/* 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_DIGI_DATA_H
#define CBM_ALGO_BASE_DIGI_DATA_H
#include "CbmBmonDigi.h"
#include "CbmDigiData.h"
#include "CbmDigiEvent.h"
#include "CbmEventTriggers.h"
#include "CbmFsdDigi.h"
#include "CbmMuchDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
#include "CbmStsDigi.h"
#include "CbmTofDigi.h"
#include "CbmTrdDigi.h"
#include "PODVector.h"
namespace cbm::algo
{
/**
* @brief Collection of digis from all detector systems
*
* Very similar to CbmDigiData. CbmDigiData is meant for file storage,
* while this is used for the actual processing. Seperate classes
* allow for more flexibility and easier optimization.
*
* @see CbmDigiData
* @note Uses PODVector for storage, so memory is not initialized by default.
*/
struct DigiData {
PODVector<CbmStsDigi> fSts; ///< Unpacked STS digis
PODVector<CbmMuchDigi> fMuch; ///< Unpacked MUCH digis
PODVector<CbmTofDigi> fTof; ///< Unpacked TOF digis
PODVector<CbmBmonDigi> fBmon; ///< Unpacked Bmon digis
PODVector<CbmTrdDigi> fTrd; ///< Unpacked TRD digis
PODVector<CbmTrdDigi> fTrd2d; ///< Unpacked TRD2D digis
PODVector<CbmRichDigi> fRich; ///< Unpacked RICH digis
PODVector<CbmPsdDigi> fPsd; ///< Unpacked PSD digis
PODVector<CbmFsdDigi> fFsd; ///< Unpacked FSD digis
DigiData();
~DigiData();
explicit DigiData(const CbmDigiData& storable);
/**
* @brief Get the number of digis for a given subsystem
*
* @param system Subsystem to get the number of digis for
* @todo Should use fles::Subsystem instead ECbmModuleId
*/
size_t Size(ECbmModuleId system) const;
/**
* @brief Get the total number of digis across all subsystems.
*/
size_t TotalSize() const;
/**
* @brief Get the total number of bytes used by all digis.
*/
size_t TotalSizeBytes() const;
/**
* @brief Convert to CbmDigiData for file storage
*
* @note This is a very expensive operation, as it copies all data.
*/
CbmDigiData ToStorable() const;
};
/**
* @brief Event data with event number and trigger time
*
* @see CbmDigitEvent
* @note Uses PODVector for storage, so memory is not initialized by default.
*/
struct DigiEvent : public DigiData {
// FIXME: Event number not set yet!
uint64_t fNumber = -1; ///< Event identifier
double fTime = 0; ///< Event trigger time [ns]
CbmEventTriggers fSelectionTriggers;
static std::vector<DigiEvent> FromCbmDigiEvents(const std::vector<CbmDigiEvent>& events);
static std::vector<CbmDigiEvent> ToCbmDigiEvents(const std::vector<DigiEvent>& events);
DigiEvent() = default;
explicit DigiEvent(const CbmDigiEvent& storable);
/**
* @brief Convert to CbmDigiEvent for file storage
*
* @note This is a very expensive operation, as it copies all data.
*/
CbmDigiEvent ToStorable() const;
};
} // namespace cbm::algo
#endif // CBM_ALGO_BASE_DIGI_DATA_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_EXCEPTIONS_H
#define CBM_ALGO_BASE_EXCEPTIONS_H
#include <exception>
#include <string_view>
#include <fmt/format.h>
namespace cbm::algo
{
namespace detail
{
/**
* @brief Base class for exceptions.
*
* @note Should not be thrown directly. Use one of the derived classes instead.
*/
struct Exception : std::runtime_error {
template<typename... Args>
Exception(std::string_view fmt, Args&&... args)
: std::runtime_error(fmt::format(fmt, std::forward<Args>(args)...))
{
}
};
} // namespace detail
/**
* @brief Indicates an unrecoverable error. Should tear down the process.
*/
struct FatalError : detail::Exception {
using Exception::Exception;
};
/**
* Indicates an error during timeslice processing. Timeslice will be discarded.
* Processing can continue with new timeslice.
*/
struct ProcessingError : detail::Exception {
using Exception::Exception;
};
} // 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_HISTOGRAM_SENDER_H
#define CBM_ALGO_BASE_HISTOGRAM_SENDER_H
#include <boost/archive/binary_oarchive.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#ifdef BOOST_IOS_HAS_ZSTD
#include <boost/iostreams/filter/zstd.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#endif
#include <boost/iostreams/stream.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/vector.hpp>
#include <string>
#include <string_view>
#include <zmq.hpp>
namespace cbm::algo
{
class HistogramSender {
public:
HistogramSender(std::string_view address, int32_t hwm = 1, bool compression = false)
: fHistComChan(address)
, fHistHighWaterMark(hwm)
, fbCompression(compression)
, fZmqContext(1)
, fZmqSocket(fZmqContext, zmq::socket_type::push)
{
fZmqSocket.set(zmq::sockopt::sndhwm, fHistHighWaterMark); // High-Water Mark, max nb updates kept in out buffer
fZmqSocket.connect(fHistComChan); // This side "connects" to socket => Other side should have "bind"!!!!
}
/** @brief Serialize object and send it to the histogram server
** @param obj: object to be serialized in the message, e.g. config pairs of strings or QaData
** @param flags: or'ed values from zmq::send_flags, typ. zmq::send_flags::sndmore to indicate multi-parts message
**/
template<typename Object>
void PrepareAndSendMsg(const Object& obj, zmq::send_flags flags)
{
/// Needed ressources (serializd string, boost inserter, boost stream, boost binary output archive)
namespace b_io = boost::iostreams;
namespace b_ar = boost::archive;
std::string serial_str;
b_io::back_insert_device<std::string> inserter(serial_str);
b_io::stream<b_io::back_insert_device<std::string>> bstream(inserter);
serial_str.clear();
if (fbCompression) {
#ifdef BOOST_IOS_HAS_ZSTD
std::unique_ptr<b_io::filtering_ostream> out_ = std::make_unique<b_io::filtering_ostream>();
out_->push(b_io::zstd_compressor(b_io::zstd::best_speed));
out_->push(bstream);
std::unique_ptr<b_ar::binary_oarchive> oarchive_ =
std::make_unique<b_ar::binary_oarchive>(*out_, b_ar::no_header);
*oarchive_ << obj;
#else
throw std::runtime_error("Unsupported ZSTD compression (boost) for histograms emissions channel");
#endif
}
else {
b_ar::binary_oarchive oa(bstream);
oa << obj;
}
bstream.flush();
zmq::message_t msg(serial_str.size());
std::copy_n(static_cast<const char*>(serial_str.data()), msg.size(), static_cast<char*>(msg.data()));
/// FIXME: read return value to catch EAGAIN indicating a failed emission, use it outside to skip histo reset
fZmqSocket.send(msg, flags | zmq::send_flags::dontwait);
}
private:
std::string fHistComChan = "tcp://127.0.0.1:56800";
int32_t fHistHighWaterMark = 1;
bool fbCompression = false;
zmq::context_t fZmqContext; ///< ZMQ context FIXME: should be only one context per binary!
zmq::socket_t fZmqSocket; ///< ZMQ socket to histogram server
};
} // namespace cbm::algo
#endif
This diff is collapsed.
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese [committer] */
#ifndef ALGO_BASE_MAINCONFIG_H_
#define ALGO_BASE_MAINCONFIG_H_
#include "CbmDefs.h"
#include <map>
namespace cbm::algo
{
/** @class MainConfig
** @brief Configuration of online data processing
** @author Volker Friese <v.friese@gsi.de>
** @since 10 July 2023
**/
class MainConfig {
public: // methods
/** @brief Constructor **/
MainConfig() = default;
/** @brief Constructor **/
~MainConfig() = default;
/** @brief Load from YAML file **/
void LoadYaml(const std::string& filename);
/** @brief Save to YAML file **/
void SaveYaml(const std::string& filename);
public: // data members
// --- Digi trigger
ECbmModuleId fTriggerDet = ECbmModuleId::kNotExist; // Trigger detector
double fTriggerWin = 0.; // Trigger window size [ns]
size_t fTriggerThreshold = 0; // Minimum number if digis in trigger window
double fTriggerDeadTime = 0.; // Minimal time between two trigger [ns]
// --- Event builder: (detector -> (tMin, tMax))
std::map<ECbmModuleId, std::pair<double, double>> fEvtbuildWindows = {};
// --- Event selector
size_t fSelectMinStationsSts = 0;
size_t fSelectMinStationsTof = 0;
size_t fSelectMinDigisBmon = 0;
// --- Branch persistence in output file
bool fStoreTimeslice = false;
bool fStoreTrigger = false;
bool fStoreEvents = false;
// --- QA publishing
int32_t fHttpServerRefreshRate = 100;
};
} /* namespace cbm::algo */
#endif /* ALGO_BASE_MAINCONFIG_H_ */
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
SPDX-License-Identifier: GPL-3.0-only
Authors: Felix Weiglhofer [committer] */
#include "RecoParams.h"
CBM_YAML_INSTANTIATE(cbm::algo::RecoParams);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.