ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
25  m_art_BCID = Muon::nsw::decode_and_advance<uint64_t>(data, readPointer, Muon::nsw::MMART::size_art_BCID);
26  m_art_pipeID = Muon::nsw::decode_and_advance<uint64_t>(data, readPointer, Muon::nsw::MMART::size_art_pipeID);
27  m_art_fiberID = Muon::nsw::decode_and_advance<uint64_t>(data, readPointer, Muon::nsw::MMART::size_art_fiberID);
28  m_art_VMMmap = Muon::nsw::decode_and_advance<uint64_t>(data, readPointer, Muon::nsw::MMART::size_art_VMMmap);
29  //remember ART 7 is first in the bit stream, ART 0 is last!
30  for (uint8_t i = 0; i < 8; i++){
31  m_art_ARTs.push_back( Muon::nsw::decode_and_advance<uint64_t>(data, readPointer, Muon::nsw::MMART::size_art_ARTs) );
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 }

◆ ~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 }

◆ 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:
Muon::nsw::MMARTPacket::m_art_ARTs
std::vector< uint32_t > m_art_ARTs
Definition: MMARTPacket.h:35
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Muon::nsw::MMARTPacket::m_art_VMMmap
uint64_t m_art_VMMmap
Definition: MMARTPacket.h:33
Muon::nsw::MMARTPacket::getBoardPosition
int getBoardPosition(int board)
Definition: MMARTPacket.cxx:67
Muon::nsw::MMARTPacket::getVMMChannelPosition
int getVMMChannelPosition(int boardPosition, int vmm, int ch)
Definition: MMARTPacket.cxx:106
Muon::nsw::MMART::size_art_ARTs
constexpr int size_art_ARTs
Definition: NSWMMTPDecodeBitmaps.h:92
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
Muon::nsw::MMARTPacket::m_art_fiberID
uint32_t m_art_fiberID
Definition: MMARTPacket.h:32
Muon::nsw::MMARTPacket::m_channels
std::vector< std::pair< uint8_t, uint16_t > > m_channels
Definition: MMARTPacket.h:37
Muon::nsw::MMART::size_art_pipeID
constexpr int size_art_pipeID
Definition: NSWMMTPDecodeBitmaps.h:89
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::nsw::MMART::size_art_fiberID
constexpr int size_art_fiberID
Definition: NSWMMTPDecodeBitmaps.h:90
Muon::nsw::format
std::string format(const std::string &str, const T &arg)
Definition: NSWDecodeHelper.h:43
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
Muon::nsw::MMART::size_art_BCID
constexpr int size_art_BCID
Definition: NSWMMTPDecodeBitmaps.h:88
Muon::nsw::MMARTPacket::m_art_pipeID
uint32_t m_art_pipeID
Definition: MMARTPacket.h:31
Muon::nsw::MMART::size_art_VMMmap
constexpr int size_art_VMMmap
Definition: NSWMMTPDecodeBitmaps.h:91
Muon::nsw::MMARTPacket::m_art_BCID
uint32_t m_art_BCID
Definition: MMARTPacket.h:30
Muon::nsw::MMARTPacket::getLayer
uint8_t getLayer() const
Definition: MMARTPacket.h:39
Muon::nsw::MMARTPacket::VMMmapToHits
std::vector< std::tuple< uint8_t, uint8_t, uint8_t > > VMMmapToHits()
Definition: MMARTPacket.cxx:45