ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::nsw::MMARTPacket Class Reference

#include <MMARTPacket.h>

Collaboration diagram for Muon::nsw::MMARTPacket:

Public Member Functions

 MMARTPacket (std::vector< uint32_t > &payload)
virtual ~MMARTPacket ()=default
uint32_t art_BCID () const
uint32_t art_pipeID () const
uint32_t art_fiberID () const
uint64_t art_VMMmap () const
const std::vector< uint32_t > & art_ARTs () const
const std::vector< std::pair< uint8_t, uint16_t > > & channels () const

Private Member Functions

uint8_t getLayer () const
std::vector< std::tuple< uint8_t, uint8_t, uint8_t > > VMMmapToHits ()
int getBoardPosition (int board)
int getVMMChannelPosition (int boardPosition, int vmm, int ch)

Private Attributes

uint32_t m_art_BCID
uint32_t m_art_pipeID
uint32_t m_art_fiberID
uint64_t m_art_VMMmap
std::vector< uint32_t > m_art_ARTs
std::vector< std::pair< uint8_t, uint16_t > > m_channels

Detailed Description

Definition at line 16 of file MMARTPacket.h.

Constructor & Destructor Documentation

◆ MMARTPacket()

Muon::nsw::MMARTPacket::MMARTPacket ( std::vector< uint32_t > & payload)

Definition at line 15 of file MMARTPacket.cxx.

15 {
16
17 std::size_t readPointer{0};
18 std::span<const std::uint32_t> data{payload.data(), 3};
19
20 if (payload.size()!=3) {
21 throw std::runtime_error( Muon::nsw::format( "ART Packet size not as expected: expected exactly 3 uint32_t, got {}", payload.size() ));
22 }
23
24 //decoding
29 //remember ART 7 is first in the bit stream, ART 0 is last!
30 for (uint8_t i = 0; i < 8; i++){
32 }
33 std::reverse(m_art_ARTs.begin(), m_art_ARTs.end()); //so that ART0 is element0 and no confusion is made
34
35 //populating layer,channel pair
36 std::vector<std::tuple<uint8_t,uint8_t,uint8_t>> artHitInfo = VMMmapToHits();
37
38 for (uint8_t i = 0; i < artHitInfo.size(); i++){
39 m_channels.push_back( std::pair<uint8_t,uint16_t>(getLayer(), getVMMChannelPosition( getBoardPosition(std::get<0>(artHitInfo[i])) , std::get<1>(artHitInfo[i]) , std::get<2>(artHitInfo[i]))) );
40 }
41
42}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::vector< std::pair< uint8_t, uint16_t > > m_channels
Definition MMARTPacket.h:37
std::vector< std::tuple< uint8_t, uint8_t, uint8_t > > VMMmapToHits()
uint8_t getLayer() const
Definition MMARTPacket.h:39
std::vector< uint32_t > m_art_ARTs
Definition MMARTPacket.h:35
int getBoardPosition(int board)
int getVMMChannelPosition(int boardPosition, int vmm, int ch)
constexpr int size_art_fiberID
constexpr int size_art_pipeID
constexpr int size_art_VMMmap
constexpr int size_art_ARTs
constexpr int size_art_BCID
std::string format(const std::string &str, const T &arg)
constexpr Target decode_and_advance(const std::span< const Source > words, std::size_t &start, const std::size_t size)
Decode bits from data of words and advance the read pointer.
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.

◆ ~MMARTPacket()

virtual Muon::nsw::MMARTPacket::~MMARTPacket ( )
virtualdefault

Member Function Documentation

◆ art_ARTs()

const std::vector< uint32_t > & Muon::nsw::MMARTPacket::art_ARTs ( ) const
inline

Definition at line 26 of file MMARTPacket.h.

26{return m_art_ARTs;};

◆ art_BCID()

uint32_t Muon::nsw::MMARTPacket::art_BCID ( ) const
inline

Definition at line 22 of file MMARTPacket.h.

22{return m_art_BCID;};

◆ art_fiberID()

uint32_t Muon::nsw::MMARTPacket::art_fiberID ( ) const
inline

Definition at line 24 of file MMARTPacket.h.

24{return m_art_fiberID;};

◆ art_pipeID()

uint32_t Muon::nsw::MMARTPacket::art_pipeID ( ) const
inline

Definition at line 23 of file MMARTPacket.h.

23{return m_art_pipeID;};

◆ art_VMMmap()

uint64_t Muon::nsw::MMARTPacket::art_VMMmap ( ) const
inline

Definition at line 25 of file MMARTPacket.h.

25{return m_art_VMMmap;};

◆ channels()

const std::vector< std::pair< uint8_t, uint16_t > > & Muon::nsw::MMARTPacket::channels ( ) const
inline

Definition at line 27 of file MMARTPacket.h.

27{return m_channels;}

◆ getBoardPosition()

int Muon::nsw::MMARTPacket::getBoardPosition ( int board)
private

Definition at line 67 of file MMARTPacket.cxx.

67 {
68 int rightLeft = (int)(m_art_fiberID/2.) % 2;
69 int layer = getLayer();
70
71 int flipBoardOrder = 0;
72 int flipFiberOrder = 0;
73
74 if (rightLeft==0){
75 if ( layer==1 || layer==2 || layer==5 || layer==6 ) {flipFiberOrder = 1;}
76 else {flipBoardOrder = 1;}
77 } else {
78 if ( layer==1 || layer==2 || layer==5 || layer==6 ) {flipBoardOrder = 1;}
79 else {flipFiberOrder = 1;}
80 }
81 if (flipBoardOrder) board = 3-board;
82
83 int pcb = 0;
84 if (!flipFiberOrder){
85 if (m_art_fiberID % 2 == 0) {pcb = board;}
86 else {pcb = board+4;}
87 } else {
88 if (m_art_fiberID % 2 == 1) {pcb = board;}
89 else {pcb = board+4;}
90 }
91 pcb+=1;
92
93 int boardPosition = -1;
94 if (layer%2==1){
95 if (rightLeft==1) {boardPosition = (pcb-1) * 2;}
96 else {boardPosition = (pcb-1) * 2 + 1;}
97 } else {
98 if (rightLeft==0) {boardPosition = (pcb-1) * 2;}
99 else {boardPosition = (pcb-1) * 2 + 1;}
100 }
101
102 return boardPosition;
103
104}
@ layer
Definition HitInfo.h:79

◆ getLayer()

uint8_t Muon::nsw::MMARTPacket::getLayer ( ) const
inlineprivate

Definition at line 39 of file MMARTPacket.h.

39{return (int)(m_art_fiberID/4.)+1 + (m_art_pipeID*2);};

◆ getVMMChannelPosition()

int Muon::nsw::MMARTPacket::getVMMChannelPosition ( int boardPosition,
int vmm,
int ch )
private

Definition at line 106 of file MMARTPacket.cxx.

106 {
107 int vmmPosition;
108 if (boardPosition%2==0){vmmPosition = 7-vmm;}
109 else {vmmPosition = vmm;}
110
111 vmmPosition += boardPosition*8;
112 int chPosition = 64*vmmPosition;
113
114 if (boardPosition%2==0){chPosition += (63 - ch);}
115 else {chPosition += ch;}
116
117 return chPosition;
118
119}

◆ VMMmapToHits()

std::vector< std::tuple< uint8_t, uint8_t, uint8_t > > Muon::nsw::MMARTPacket::VMMmapToHits ( )
private

Definition at line 45 of file MMARTPacket.cxx.

45 {
46 std::vector<std::tuple<uint8_t,uint8_t>> hitmapBoardVMM;
47 std::vector<std::tuple<uint8_t,uint8_t,uint8_t>> artHitInfo;
48
49 for (uint8_t i = 0; i<32; i++){
50 if ((m_art_VMMmap >> i) & 0b1) {
51 hitmapBoardVMM.push_back( std::make_tuple( (int)(i/8), i%8 ) ); //board, vmm
52 }
53 }
54
55 if (hitmapBoardVMM.size()>8) {
56 throw std::runtime_error("ART Packet cannot contain more than 8 ART hits!");
57 }
58
59 for (uint8_t i = 0; i<hitmapBoardVMM.size(); i++){
60 artHitInfo.push_back( std::make_tuple( std::get<0>(hitmapBoardVMM[i]), std::get<1>(hitmapBoardVMM[i]), m_art_ARTs[i] ) );
61 }
62
63 return artHitInfo;
64}

Member Data Documentation

◆ m_art_ARTs

std::vector<uint32_t> Muon::nsw::MMARTPacket::m_art_ARTs
private

Definition at line 35 of file MMARTPacket.h.

◆ m_art_BCID

uint32_t Muon::nsw::MMARTPacket::m_art_BCID
private

Definition at line 30 of file MMARTPacket.h.

◆ m_art_fiberID

uint32_t Muon::nsw::MMARTPacket::m_art_fiberID
private

Definition at line 32 of file MMARTPacket.h.

◆ m_art_pipeID

uint32_t Muon::nsw::MMARTPacket::m_art_pipeID
private

Definition at line 31 of file MMARTPacket.h.

◆ m_art_VMMmap

uint64_t Muon::nsw::MMARTPacket::m_art_VMMmap
private

Definition at line 33 of file MMARTPacket.h.

◆ m_channels

std::vector< std::pair<uint8_t,uint16_t> > Muon::nsw::MMARTPacket::m_channels
private

Definition at line 37 of file MMARTPacket.h.


The documentation for this class was generated from the following files: