-
Sergei Zharko authoredSergei Zharko authored
TrackingDefs.h 3.48 KiB
/* Copyright (C) 2023-2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Sergei Zharko [committer] */
/// \file TrackingDefs.h
/// \date 22.10.2023
/// \brief Definitions for tracking in the online reconstruction
/// \author S.Zharko <s.zharko@gsi.de>
#pragma once
#include "CaEnumArray.h"
#include "MicrosliceDescriptor.hpp" // For fles::Subsystem
#include <tuple>
namespace cbm::algo
{
namespace mvd
{
class Hit;
}
namespace sts
{
struct Hit;
}
namespace much
{
class Hit;
}
namespace trd
{
class Hit;
}
namespace tof
{
struct Hit;
}
namespace ca
{
/// \enum cbm::algo::ca::EDetectorID
/// \brief Enumeration for the detector subsystems used in CBM online tracking
/// \note It is important, that the subsystems are specified in the actual order.
/// \note The enumeration must not contain jumps in the ordering and the first entry must be equal 0
enum class EDetectorID
{
Mvd = 0,
Sts,
Much,
Trd,
Tof,
kEND ///< End of enumeration
};
template<fles::Subsystem subsys>
constexpr EDetectorID FromFlesSubsystem()
{
if constexpr (subsys == fles::Subsystem::STS) {
return EDetectorID::Sts;
}
else if constexpr (subsys == fles::Subsystem::MVD) {
return EDetectorID::Mvd;
}
else if constexpr (subsys == fles::Subsystem::MUCH) {
return EDetectorID::Much;
}
else if constexpr (subsys == fles::Subsystem::TRD) {
return EDetectorID::Trd;
}
if constexpr (subsys == fles::Subsystem::TOF) {
return EDetectorID::Tof;
}
else {
return EDetectorID::kEND;
}
}
template<EDetectorID detID>
constexpr fles::Subsystem ToFlesSubsystem()
{
if constexpr (detID == EDetectorID::Mvd) {
return fles::Subsystem::MVD;
}
else if constexpr (detID == EDetectorID::Sts) {
return fles::Subsystem::STS;
}
else if constexpr (detID == EDetectorID::Much) {
return fles::Subsystem::MUCH;
}
else if constexpr (detID == EDetectorID::Trd) {
return fles::Subsystem::TRD;
}
else if constexpr (detID == EDetectorID::Tof) {
return fles::Subsystem::TOF;
}
else if constexpr (detID == EDetectorID::kEND) {
return fles::Subsystem::FLES; // Default ()
}
}
/// \brief Alias to array, indexed by the EDetectorID enum
/// \note To be used only in CBM-specific code
template<typename T>
using DetIdArray_t = EnumArray<EDetectorID, T>;
/// \struct DetIdTypeArr_t
/// \brief Array of types, indexed by EDetectorID
template<class... Types>
struct DetIdTypeArr_t {
template<EDetectorID DetID>
using at = std::tuple_element_t<static_cast<std::size_t>(DetID), std::tuple<Types...>>;
static constexpr std::size_t size = sizeof...(Types);
};
/// \brief Hit vector types
using MvdHit = ::cbm::algo::mvd::Hit;
using StsHit = ::cbm::algo::sts::Hit;
using MuchHit = ::cbm::algo::much::Hit;
using TrdHit = ::cbm::algo::trd::Hit;
using TofHit = ::cbm::algo::tof::Hit;
using HitTypes_t = DetIdTypeArr_t<MvdHit, StsHit, MuchHit, TrdHit, TofHit>;
/// \brief Detector subsystem names
constexpr DetIdArray_t<const char*> kDetName = {{"MVD", "STS", "MUCH", "TRD", "TOF"}};
} // namespace ca
} // namespace cbm::algo