ATLAS Offline Software
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Muon::RpcFlatCableTranslator Class Reference

#include <RpcFlatCableTranslator.h>

Collaboration diagram for Muon::RpcFlatCableTranslator:

Public Types

using Storage_t = std::array< uint8_t, readStrips >
 Internal storage array. More...
 

Public Member Functions

 RpcFlatCableTranslator (const uint8_t cardId)
 Standard constructor taking the card ID as input. More...
 
uint8_t id () const
 Identifier of the card layout. More...
 
std::optional< uint8_t > tdcChannel (uint8_t strip, MsgStream &log) const
 Returns the connected tdc channel connected to a strip. More...
 
std::optional< uint8_t > stripChannel (uint8_t tdcChannel, MsgStream &log) const
 Returns the strip channel connected to a strip. More...
 
bool mapChannels (uint8_t strip, uint8_t tdc, MsgStream &log)
 Connect the strip with a tdc channel. More...
 
const Storage_tstripMap () const
 Returns underlying strip mapping storage. More...
 
const Storage_ttdcMap () const
 Returns the underlying tdc mapping storage. More...
 
uint8_t connectedChannels () const
 Number of connected channels. More...
 

Static Public Attributes

static constexpr uint8_t readStrips = 32
 Number of channels covered by one chip. More...
 
static constexpr uint8_t notSet = 250
 Default value indicating that the channel is not set. More...
 
static constexpr uint8_t firstStrip = 1
 Convention of the lowest strip number. More...
 
static constexpr uint8_t firstTdc = 0
 Convention of the lowest tdc number. More...
 

Private Attributes

Storage_t m_stripToTdc {make_array<uint8_t, readStrips>(notSet)}
 
Storage_t m_tdcToStrip {make_array<uint8_t, readStrips>(notSet)}
 
uint8_t m_id {0}
 
uint8_t m_nCh {0}
 Number of channels that are connected to the cable. More...
 

Detailed Description

Definition at line 18 of file RpcFlatCableTranslator.h.

Member Typedef Documentation

◆ Storage_t

Internal storage array.

Definition at line 29 of file RpcFlatCableTranslator.h.

Constructor & Destructor Documentation

◆ RpcFlatCableTranslator()

Muon::RpcFlatCableTranslator::RpcFlatCableTranslator ( const uint8_t  cardId)

Standard constructor taking the card ID as input.

Definition at line 29 of file RpcFlatCableTranslator.cxx.

29  :
30  m_id{cardId} {}

Member Function Documentation

◆ connectedChannels()

uint8_t Muon::RpcFlatCableTranslator::connectedChannels ( ) const

Number of connected channels.

Definition at line 32 of file RpcFlatCableTranslator.cxx.

32 { return m_nCh; }

◆ id()

uint8_t Muon::RpcFlatCableTranslator::id ( ) const

Identifier of the card layout.

Definition at line 37 of file RpcFlatCableTranslator.cxx.

37 { return m_id; }

◆ mapChannels()

bool Muon::RpcFlatCableTranslator::mapChannels ( uint8_t  strip,
uint8_t  tdc,
MsgStream &  log 
)

Connect the strip with a tdc channel.

If the channel has been connected before, false is returned.

Parameters
stripStrip number on the chamber end
tdcTdc channel on the chip end
logLogger used for debugging

Definition at line 69 of file RpcFlatCableTranslator.cxx.

69  {
70  const uint8_t mapStrip = strip - firstStrip;
71  const uint8_t mapTdc = tdc - firstTdc;
72  if (mapStrip >= readStrips || m_stripToTdc[mapStrip] != notSet){
73  log<<MSG::ERROR<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": The strip "<<static_cast<unsigned>(strip)
74  <<" is already mapped to "<<static_cast<unsigned>(m_stripToTdc[mapStrip] + firstTdc)<<std::endl<<(*this)<<endmsg;
75  return false;
76  }
77  if (mapTdc >= readStrips || m_tdcToStrip[mapTdc] != notSet){
78  log<<MSG::ERROR<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": The strip "<<static_cast<unsigned>(strip)
79  <<" is already mapped to "<<static_cast<unsigned>(m_tdcToStrip[mapTdc] + firstStrip)<<std::endl<<(*this)<<endmsg;
80  return false;
81  }
82  m_stripToTdc[mapStrip] = mapTdc;
83  m_tdcToStrip[mapTdc] = mapStrip;
84  ++m_nCh;
85  if (log.level() <= MSG::VERBOSE) {
86  log<<MSG::VERBOSE<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": Map strip "<<static_cast<unsigned>(strip)
87  <<" to tdc "<<static_cast<unsigned>(tdc)<<endmsg;
88  }
89  return true;
90  }

◆ stripChannel()

std::optional< uint8_t > Muon::RpcFlatCableTranslator::stripChannel ( uint8_t  tdcChannel,
MsgStream &  log 
) const

Returns the strip channel connected to a strip.

If the tdc is not connected, a nullopt is returned

Parameters
stripStrip number. It should range from the first strip until the last covered strip
logLogger used for debugging

Definition at line 53 of file RpcFlatCableTranslator.cxx.

53  {
54  const uint8_t mapTdc = (tdcChannel - firstTdc);
55  if (mapTdc >= readStrips && log.level() <= MSG::WARNING) {
56  log<<MSG::WARNING<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": The parsed tdc "
57  <<static_cast<unsigned>(tdcChannel)<<" is out of range"<<endmsg;
58  return std::nullopt;
59  }
60  if (m_tdcToStrip[mapTdc] == notSet) {
61  if (log.level() <= MSG::VERBOSE){
62  log<<MSG::VERBOSE<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": The parsed tdc "
63  <<static_cast<unsigned>(tdcChannel)<<" is not connected."<<endmsg;
64  }
65  return std::nullopt;
66  }
67  return m_tdcToStrip[mapTdc] + firstStrip;
68  }

◆ stripMap()

const RpcFlatCableTranslator::Storage_t & Muon::RpcFlatCableTranslator::stripMap ( ) const

Returns underlying strip mapping storage.

Definition at line 34 of file RpcFlatCableTranslator.cxx.

34 { return m_stripToTdc; }

◆ tdcChannel()

std::optional< uint8_t > Muon::RpcFlatCableTranslator::tdcChannel ( uint8_t  strip,
MsgStream &  log 
) const

Returns the connected tdc channel connected to a strip.

If the strip is not connected to a tdc, a nullopt is returned.

Parameters
stripStrip number. It should range from the first strip until the last covered strip
logLogger used for debugging

Definition at line 38 of file RpcFlatCableTranslator.cxx.

38  {
39  const uint8_t mapStrip = (strip - firstStrip) % readStrips;
40  if (m_stripToTdc[mapStrip] == notSet) {
41  if (log.level() <= MSG::VERBOSE) {
42  log<<MSG::VERBOSE<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": The channel "
43  <<static_cast<unsigned>(strip)<<" is unmapped."<<endmsg;
44  }
45  return std::nullopt;
46  }
47  if (log.level() <= MSG::VERBOSE) {
48  log<<MSG::VERBOSE<<"RpcFlatCableTranslator::"<<__func__<<"() - "<<__LINE__<<": Map channel "
49  <<static_cast<unsigned>(strip)<<" to tdc "<<static_cast<unsigned>(m_stripToTdc[mapStrip] + firstTdc)<<endmsg;
50  }
51  return std::make_optional<uint8_t>(m_stripToTdc[mapStrip] + firstTdc);
52  }

◆ tdcMap()

const RpcFlatCableTranslator::Storage_t & Muon::RpcFlatCableTranslator::tdcMap ( ) const

Returns the underlying tdc mapping storage.

Definition at line 35 of file RpcFlatCableTranslator.cxx.

35 { return m_tdcToStrip; }

Member Data Documentation

◆ firstStrip

constexpr uint8_t Muon::RpcFlatCableTranslator::firstStrip = 1
staticconstexpr

Convention of the lowest strip number.

Definition at line 25 of file RpcFlatCableTranslator.h.

◆ firstTdc

constexpr uint8_t Muon::RpcFlatCableTranslator::firstTdc = 0
staticconstexpr

Convention of the lowest tdc number.

Definition at line 27 of file RpcFlatCableTranslator.h.

◆ m_id

uint8_t Muon::RpcFlatCableTranslator::m_id {0}
private

Definition at line 59 of file RpcFlatCableTranslator.h.

◆ m_nCh

uint8_t Muon::RpcFlatCableTranslator::m_nCh {0}
private

Number of channels that are connected to the cable.

Definition at line 61 of file RpcFlatCableTranslator.h.

◆ m_stripToTdc

Storage_t Muon::RpcFlatCableTranslator::m_stripToTdc {make_array<uint8_t, readStrips>(notSet)}
private

Definition at line 57 of file RpcFlatCableTranslator.h.

◆ m_tdcToStrip

Storage_t Muon::RpcFlatCableTranslator::m_tdcToStrip {make_array<uint8_t, readStrips>(notSet)}
private

Definition at line 58 of file RpcFlatCableTranslator.h.

◆ notSet

constexpr uint8_t Muon::RpcFlatCableTranslator::notSet = 250
staticconstexpr

Default value indicating that the channel is not set.

Definition at line 23 of file RpcFlatCableTranslator.h.

◆ readStrips

constexpr uint8_t Muon::RpcFlatCableTranslator::readStrips = 32
staticconstexpr

Number of channels covered by one chip.

Definition at line 21 of file RpcFlatCableTranslator.h.


The documentation for this class was generated from the following files:
Muon::RpcFlatCableTranslator::readStrips
static constexpr uint8_t readStrips
Number of channels covered by one chip.
Definition: RpcFlatCableTranslator.h:21
Muon::RpcFlatCableTranslator::m_stripToTdc
Storage_t m_stripToTdc
Definition: RpcFlatCableTranslator.h:57
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Muon::RpcFlatCableTranslator::notSet
static constexpr uint8_t notSet
Default value indicating that the channel is not set.
Definition: RpcFlatCableTranslator.h:23
keylayer_zslicemap.strip
strip
Definition: keylayer_zslicemap.py:151
Muon::RpcFlatCableTranslator::firstTdc
static constexpr uint8_t firstTdc
Convention of the lowest tdc number.
Definition: RpcFlatCableTranslator.h:27
Muon::RpcFlatCableTranslator::tdcChannel
std::optional< uint8_t > tdcChannel(uint8_t strip, MsgStream &log) const
Returns the connected tdc channel connected to a strip.
Definition: RpcFlatCableTranslator.cxx:38
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Muon::RpcFlatCableTranslator::m_id
uint8_t m_id
Definition: RpcFlatCableTranslator.h:59
Muon::RpcFlatCableTranslator::m_tdcToStrip
Storage_t m_tdcToStrip
Definition: RpcFlatCableTranslator.h:58
Muon::RpcFlatCableTranslator::firstStrip
static constexpr uint8_t firstStrip
Convention of the lowest strip number.
Definition: RpcFlatCableTranslator.h:25
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Muon::RpcFlatCableTranslator::m_nCh
uint8_t m_nCh
Number of channels that are connected to the cable.
Definition: RpcFlatCableTranslator.h:61