18#include <fmt/format.h> 
   25  if (deIndexOpt == std::nullopt) {
 
   26    throw std::runtime_error(fmt::format(
"invalid deId {}", deId));
 
   28  auto deIndex = deIndexOpt.value();
 
   31    throw std::runtime_error(fmt::format(
"invalid dePadIndex {} for deId {}",
 
   39  static auto det2elec = raw::createDet2ElecMapper<raw::ElectronicMapperGenerated>();
 
   41  auto elec = det2elec(dsDetId);
 
   42  if (elec == std::nullopt) {
 
   43    throw std::runtime_error(fmt::format(
"could not get solar,elink for {}",
 
   46  uint16_t solarId = elec->solarId();
 
   47  auto solarIndex = raw::solarId2Index<raw::ElectronicMapperGenerated>(solarId);
 
   48  if (solarIndex == std::nullopt) {
 
   49    throw std::runtime_error(fmt::format(
"could not get index from solarId {}",
 
   52  uint8_t elinkIndex = elec->elinkId();
 
   53  set(deIndex, dePadIndex, dsIndex, solarIndex.value(), elinkIndex, channel);
 
 
   58  auto solarIndexOpt = raw::solarId2Index<raw::ElectronicMapperGenerated>(solarId);
 
   59  if (solarIndexOpt == std::nullopt) {
 
   60    throw std::runtime_error(fmt::format(
"invalid solarId {}", solarId));
 
   62  static auto elec2det = raw::createElec2DetMapper<raw::ElectronicMapperGenerated>();
 
   66  auto dsDetIdOpt = elec2det(dsElecId);
 
   67  if (dsDetIdOpt == std::nullopt) {
 
   68    throw std::runtime_error(fmt::format(
"invalid solarid {} elinkid {}",
 
   71  auto deId = dsDetIdOpt->deId();
 
   73  if (deIndexOpt == std::nullopt) {
 
   74    throw std::runtime_error(fmt::format(
"invalid deId {}", deId));
 
   77  auto dsId = dsDetIdOpt->dsId();
 
   80    throw std::runtime_error(fmt::format(
"invalid dePadIndex {} for deId {}",
 
   84  auto solarIndex = solarIndexOpt.value();
 
   85  set(deIndexOpt.value(), dePadIndex, dsIndex, solarIndex, elinkId, channel);
 
 
   97void ChannelCode::set(uint8_t deIndex,
 
  104  mValue = (
static_cast<uint64_t
>(deIndex & 0xFF) << 52) +
 
  105           (
static_cast<uint64_t
>(dePadIndex & 0x7FFF) << 37) +
 
  106           (
static_cast<uint64_t
>(dsIndex & 0x7FFF) << 22) +
 
  107           (
static_cast<uint64_t
>(solarIndex & 0x3FF) << 12) +
 
  108           (
static_cast<uint64_t
>(elinkIndex & 0x3F) << 6) +
 
  109           (
static_cast<uint64_t
>(channel & 0x3F));
 
  114  return static_cast<uint8_t
>((mValue >> 52) & 0xFF);
 
 
  119  return static_cast<uint16_t
>((mValue >> 37) & 0x7FFF);
 
 
  124  return static_cast<uint16_t
>((mValue >> 22) & 0x7FFF);
 
 
  129  return static_cast<uint16_t
>((mValue >> 12) & 0x3FF);
 
 
  134  return static_cast<uint8_t
>((mValue >> 6) & 0x3F);
 
 
  139  return static_cast<uint8_t
>(mValue & 0x3F);
 
 
  152  return dsDetId.
dsId();
 
 
  158  return raw::solarIndex2Id<raw::ElectronicMapperGenerated>(solarIndex).value();
 
 
  163  return fmt::format(
"deid {:4d} dsid {:4d} ch {:2d} depadindex {:5d} solarid {:4d} elink {:2d}",
 
 
o2::mch::mapping::CathodeSegmentation seg
uint16_t getDsIndex() const
uint8_t getDeIndex() const
uint16_t getSolarId() const
uint16_t getSolarIndex() const
uint8_t getElinkId() const
uint8_t getChannel() const
uint16_t getDePadIndex() const
int padDualSampaChannel(int catPadIndex) const
int padDualSampaId(int catPadIndex) const
int findPadByFEE(int dualSampaId, int dualSampaChannel) const
bool isValid(int catPadIndex) const
Not every integer is a valid catPadIndex. This method will tell if catPadIndex is a valid one.
A DsDetId is just a pair (detection element id, dual sampa id)
std::array< int, 156 > deIdsForAllMCH
std::optional< int > deId2DeIndex(int deId)
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)
std::optional< uint8_t > indexFromElinkId(uint8_t elinkId)
Extracts the index from the elinkId.
std::optional< uint8_t > groupFromElinkId(uint8_t elinkId)
Extracts the group from the elinkId.
std::string asString(const SampaCluster &sc)
std::string asString(const o2::mch::TrackMCH &t)
DsIndex getDsIndex(const o2::mch::raw::DsDetId &dsDetId)
o2::mch::raw::DsDetId getDsDetId(DsIndex dsIndex)
std::vector< o2::mch::ChannelCode > cc