Newer
Older
/* 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"
Sergei Zharko
committed
#include "CbmDefs.h"
#include "MicrosliceDescriptor.hpp" // For fles::Subsystem
namespace cbm::algo
{
namespace mvd
{
class Hit;
}
namespace sts
{
}
namespace much
{
class Hit;
}
namespace trd
{
class Hit;
}
namespace tof
{
}
namespace ca
{
template<fles::Subsystem subsys>
constexpr EDetectorID FromFlesSubsystem()
{
if constexpr (subsys == fles::Subsystem::STS) {
Sergei Zharko
committed
return EDetectorID::kSts;
}
else if constexpr (subsys == fles::Subsystem::MVD) {
Sergei Zharko
committed
return EDetectorID::kMvd;
}
else if constexpr (subsys == fles::Subsystem::MUCH) {
Sergei Zharko
committed
return EDetectorID::kMuch;
}
else if constexpr (subsys == fles::Subsystem::TRD) {
Sergei Zharko
committed
return EDetectorID::kTrd;
}
if constexpr (subsys == fles::Subsystem::TOF) {
Sergei Zharko
committed
return EDetectorID::kTof;
Sergei Zharko
committed
return EDetectorID::END;
}
}
template<EDetectorID detID>
constexpr fles::Subsystem ToFlesSubsystem()
{
Sergei Zharko
committed
if constexpr (detID == EDetectorID::kMvd) {
return fles::Subsystem::MVD;
}
Sergei Zharko
committed
else if constexpr (detID == EDetectorID::kSts) {
return fles::Subsystem::STS;
}
Sergei Zharko
committed
else if constexpr (detID == EDetectorID::kMuch) {
return fles::Subsystem::MUCH;
}
Sergei Zharko
committed
else if constexpr (detID == EDetectorID::kTrd) {
return fles::Subsystem::TRD;
}
Sergei Zharko
committed
else if constexpr (detID == EDetectorID::kTof) {
return fles::Subsystem::TOF;
}
Sergei Zharko
committed
else if constexpr (detID == EDetectorID::END) {
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