/* Copyright (C) 2023 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 <tuple>

#include "CaEnumArray.h"

namespace cbm::algo
{
  namespace mvd
  {
    class Hit;
  }
  namespace sts
  {
    class Hit;
  }
  namespace much
  {
    class Hit;
  }
  namespace trd
  {
    class Hit;
  }
  namespace tof
  {
    class 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
    };

    /// \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