ATLAS Offline Software
Loading...
Searching...
No Matches
RXReadOutStructure Class Reference

#include <RXReadOutStructure.h>

Inheritance diagram for RXReadOutStructure:
Collaboration diagram for RXReadOutStructure:

Public Types

enum  DataVersion { Atlas , Simulation0 , Simulation1 }

Public Member Functions

 RXReadOutStructure (DataVersion vers=Atlas)
 RXReadOutStructure (ubit16 inputData, DataVersion vers=Atlas)
 ~RXReadOutStructure ()=default
void setInit ()
ubit16 makeHeader (ubit16 *inputData)
ubit16 makeSubHeader ()
ubit16 makeBody (ubit16 *inputData)
ubit16 makeFooter (ubit16 errorCode)
ubit16 makeFooter (ubit16 *errorCode)
ubit16 RXid ()
ubit16 status ()
ubit16 errorCode ()
ubit16 decodeFragment (ubit16 inputWord, char &field)
bool isHeader ()
bool isBody ()
bool isFooter ()
ubit16 getWord () const
char field () const

Protected Member Functions

ubit16 set16Bits (const ubit16 n, const ubit16 *pos, const ubit16 *val) const
template<size_t n>
ubit16 set16Bits (const std::array< ubit16, n > &pos, const std::array< ubit16, n > &val) const
ubit16 get16Bits (const ubit16 input, const ubit16 position, const ubit16 length) const

Protected Attributes

ubit16 m_word {0xffff}
char m_field {0}

Static Protected Attributes

static constexpr ubit16 s_last2bitsON {0xc000}
static constexpr ubit16 s_last4bitsON {0xf000}
static constexpr ubit16 s_first8bitsON {0}

Private Attributes

ubit16 m_secid
ubit16 m_status
ubit16 m_errorCode
DataVersion m_dataVersion

Static Private Attributes

static const ubit16 s_headerNum = 3
static const ubit16 s_headerPos [s_headerNum] = {12, 8, 0}
static const ubit16 s_headerLen [s_headerNum] = {4, 4, 8}
static const ubit16 s_headerVal = 0x0009
static const ubit16 s_footerNum = 2
static const ubit16 s_footerPos [s_footerNum] = {12, 0}
static const ubit16 s_footerLen [s_footerNum] = {4, 12}
static const ubit16 s_footerVal = 0x000b

Detailed Description

Definition at line 14 of file RXReadOutStructure.h.

Member Enumeration Documentation

◆ DataVersion

Enumerator
Atlas 
Simulation0 
Simulation1 

Definition at line 16 of file RXReadOutStructure.h.

Constructor & Destructor Documentation

◆ RXReadOutStructure() [1/2]

RXReadOutStructure::RXReadOutStructure ( RXReadOutStructure::DataVersion vers = Atlas)

Definition at line 24 of file RXReadOutStructure.cxx.

24 : m_dataVersion(vers) {
25 //
26 // Constructor used by the simulation program
27 //
28 setInit();
29} // end-of-RXReadOutStructure::RXReadOutStructure()

◆ RXReadOutStructure() [2/2]

RXReadOutStructure::RXReadOutStructure ( ubit16 inputData,
RXReadOutStructure::DataVersion vers = Atlas )

Definition at line 31 of file RXReadOutStructure.cxx.

31 : m_dataVersion(vers) {
32 //
33 // Constructor used by the simulation program
34 //
35
36 decodeFragment(inputData, m_field);
37} // end-of-RXReadOutStructure::RXReadOutStructure()
char m_field
Definition RPCReadOut.h:28
ubit16 decodeFragment(ubit16 inputWord, char &field)

◆ ~RXReadOutStructure()

RXReadOutStructure::~RXReadOutStructure ( )
default

Member Function Documentation

◆ decodeFragment()

unsigned short int RXReadOutStructure::decodeFragment ( ubit16 inputWord,
char & field )

Definition at line 78 of file RXReadOutStructure.cxx.

78 {
79 MatrixReadOutStructure MRS;
80 // Removed last because it is not used
81 // bool last=false;
82 ubit16 errorCode = 0;
83 setInit();
84 m_word = inputWord;
85 //
86 errorCode = 0;
87 if (isHeader()) {
88 m_field = 'H';
90 m_secid = get16Bits(inputWord, s_headerPos[1], s_headerLen[1]) >> 3;
91 m_status = get16Bits(inputWord, s_headerPos[2], s_headerLen[2]);
92 } else if (m_dataVersion == Simulation0) {
93 m_status = get16Bits(inputWord, s_headerPos[1], s_headerLen[1]);
94 m_secid = get16Bits(inputWord, s_headerPos[2], s_headerLen[2]);
95 } else {
96 // Unknown format, so leave data invalid.
97 m_field = 'U';
98 }
99 } else if (isFooter()) {
100 m_field = 'F';
101 m_errorCode = get16Bits(inputWord, s_footerPos[1], s_footerLen[1]);
102 } else {
103 m_field = 'B';
104 if ((m_word & 0xf000) == (MRS.getFooterVal() << MRS.getFooterPos())) {
105 /* last=true; */
106 } else {
107 /* last=false; */
108 } // end-of-if((m_word
109 }
110 field = m_field;
111 return errorCode; // temporary: force return to 0
112} // end-of-decodeFragment
unsigned short int ubit16
char field() const
Definition RPCReadOut.h:19
ubit16 get16Bits(const ubit16 input, const ubit16 position, const ubit16 length) const
Definition RPCReadOut.h:47
ubit16 m_word
Definition RPCReadOut.h:27
static const ubit16 s_footerLen[s_footerNum]
static const ubit16 s_footerPos[s_footerNum]
static const ubit16 s_headerLen[s_headerNum]
static const ubit16 s_headerPos[s_headerNum]

◆ errorCode()

ubit16 RXReadOutStructure::errorCode ( )
inline

Definition at line 35 of file RXReadOutStructure.h.

35{ return m_errorCode; };

◆ field()

char RPCReadOut::field ( ) const
inlineinherited

Definition at line 19 of file RPCReadOut.h.

19{ return m_field; };

◆ get16Bits()

ubit16 RPCReadOut::get16Bits ( const ubit16 input,
const ubit16 position,
const ubit16 length ) const
inlineprotectedinherited

Definition at line 47 of file RPCReadOut.h.

47 {
48 ubit16 output = 0;
49 ubit16 CMfield = 0;
50 for (ubit16 i = 0; i < length; i++) { CMfield = CMfield | 1 << (position + i); }
51 output = (input & CMfield) >> position;
52 return output;
53 } // end-of-MatrixReadOutStructure::get16Bits
double length(const pvec &v)
output
Definition merge.py:16

◆ getWord()

ubit16 RPCReadOut::getWord ( ) const
inlineinherited

Definition at line 18 of file RPCReadOut.h.

18{ return m_word; };

◆ isBody()

bool RXReadOutStructure::isBody ( )
inline

Definition at line 39 of file RXReadOutStructure.h.

39{ return false; };

◆ isFooter()

bool RXReadOutStructure::isFooter ( )

Definition at line 71 of file RXReadOutStructure.cxx.

71 {
72 bool status = false;
73 ubit16 theFooter[s_footerNum] = {s_footerVal};
74 if ((m_word & s_last4bitsON) == set16Bits(1, s_footerPos, theFooter)) status = true;
75 return status;
76}
static constexpr ubit16 s_last4bitsON
Definition RPCReadOut.h:56
ubit16 set16Bits(const ubit16 n, const ubit16 *pos, const ubit16 *val) const
Definition RPCReadOut.h:30
static const ubit16 s_footerNum
static const ubit16 s_footerVal

◆ isHeader()

bool RXReadOutStructure::isHeader ( )

Definition at line 64 of file RXReadOutStructure.cxx.

64 {
65 bool status = false;
66 ubit16 theHeader[s_headerNum] = {s_headerVal};
67 if ((m_word & s_last4bitsON) == set16Bits(1, s_headerPos, theHeader)) status = true;
68 return status;
69}
static const ubit16 s_headerNum
static const ubit16 s_headerVal

◆ makeBody()

ubit16 RXReadOutStructure::makeBody ( ubit16 * inputData)
inline

Definition at line 26 of file RXReadOutStructure.h.

26{ return *inputData; };

◆ makeFooter() [1/2]

unsigned short int RXReadOutStructure::makeFooter ( ubit16 * errorCode)

Definition at line 62 of file RXReadOutStructure.cxx.

62{ return (*errorCode) & 0x0; } // end-of-RXReadOutStructure::makeFooter

◆ makeFooter() [2/2]

unsigned short int RXReadOutStructure::makeFooter ( ubit16 errorCode)

Definition at line 55 of file RXReadOutStructure.cxx.

55 {
57 const ubit16 theFooter[s_footerNum] = {s_footerVal, m_errorCode};
59 return m_word;
60} // end-of-RXReadOutStructure::makeFooter

◆ makeHeader()

unsigned short int RXReadOutStructure::makeHeader ( ubit16 * inputData)

Definition at line 47 of file RXReadOutStructure.cxx.

47 {
48 const ubit16 theHeader[s_headerNum] = {s_headerVal, *(inputData + 1), *(inputData + 2)};
49 m_secid = *(inputData + 1);
50 m_status = *(inputData + 2);
52 return m_word;
53} // end-of-RXReadOutStructure::makeHeader

◆ makeSubHeader()

ubit16 RXReadOutStructure::makeSubHeader ( )
inline

Definition at line 24 of file RXReadOutStructure.h.

24{ return 0; };

◆ RXid()

ubit16 RXReadOutStructure::RXid ( )
inline

Definition at line 33 of file RXReadOutStructure.h.

33{ return m_secid; };

◆ set16Bits() [1/2]

template<size_t n>
ubit16 RPCReadOut::set16Bits ( const std::array< ubit16, n > & pos,
const std::array< ubit16, n > & val ) const
inlineprotectedinherited

Definition at line 40 of file RPCReadOut.h.

40 {
41 ubit16 output = 0;
42 for (size_t i = 0; i < n; ++i) { output |= (val[i] << pos[i]); }
43 return output;
44 }

◆ set16Bits() [2/2]

ubit16 RPCReadOut::set16Bits ( const ubit16 n,
const ubit16 * pos,
const ubit16 * val ) const
inlineprotectedinherited

Definition at line 30 of file RPCReadOut.h.

30 {
31 ubit16 output = 0;
32 ubit16 p = 0, v = 0;
33 for (ubit16 i = 0; i < n; i++) {
34 v = *(val + i);
35 p = *(pos + i);
36 output = output | (v << p);
37 } // end-of-for
38 return output;
39 } // end-of-MatrixReadOutStructure::set16Bits

◆ setInit()

void RXReadOutStructure::setInit ( )

Definition at line 39 of file RXReadOutStructure.cxx.

39 {
40 m_field = 'U';
41 m_word = 0xffff;
42 m_secid = 0xffff;
43 m_status = 0xffff;
44 m_errorCode = 0xffff;
45} // end-of-RXReadOutStructure::setInit()

◆ status()

ubit16 RXReadOutStructure::status ( )
inline

Definition at line 34 of file RXReadOutStructure.h.

34{ return m_status; };

Member Data Documentation

◆ m_dataVersion

DataVersion RXReadOutStructure::m_dataVersion
private

Definition at line 47 of file RXReadOutStructure.h.

◆ m_errorCode

ubit16 RXReadOutStructure::m_errorCode
private

Definition at line 46 of file RXReadOutStructure.h.

◆ m_field

char RPCReadOut::m_field {0}
protectedinherited

Definition at line 28 of file RPCReadOut.h.

28{0};

◆ m_secid

ubit16 RXReadOutStructure::m_secid
private

Definition at line 44 of file RXReadOutStructure.h.

◆ m_status

ubit16 RXReadOutStructure::m_status
private

Definition at line 45 of file RXReadOutStructure.h.

◆ m_word

ubit16 RPCReadOut::m_word {0xffff}
protectedinherited

Definition at line 27 of file RPCReadOut.h.

27{0xffff};

◆ s_first8bitsON

ubit16 RPCReadOut::s_first8bitsON {0}
staticconstexprprotectedinherited

Definition at line 57 of file RPCReadOut.h.

57{0};

◆ s_footerLen

const ubit16 RXReadOutStructure::s_footerLen = {4, 12}
staticprivate

Definition at line 21 of file RXReadOutStructure.h.

◆ s_footerNum

const ubit16 RXReadOutStructure::s_footerNum = 2
staticprivate

Definition at line 55 of file RXReadOutStructure.h.

◆ s_footerPos

const ubit16 RXReadOutStructure::s_footerPos = {12, 0}
staticprivate

Definition at line 20 of file RXReadOutStructure.h.

◆ s_footerVal

const ubit16 RXReadOutStructure::s_footerVal = 0x000b
staticprivate

Definition at line 58 of file RXReadOutStructure.h.

◆ s_headerLen

const ubit16 RXReadOutStructure::s_headerLen = {4, 4, 8}
staticprivate

Definition at line 17 of file RXReadOutStructure.h.

◆ s_headerNum

const ubit16 RXReadOutStructure::s_headerNum = 3
staticprivate

Definition at line 51 of file RXReadOutStructure.h.

◆ s_headerPos

const ubit16 RXReadOutStructure::s_headerPos = {12, 8, 0}
staticprivate

Definition at line 16 of file RXReadOutStructure.h.

◆ s_headerVal

const ubit16 RXReadOutStructure::s_headerVal = 0x0009
staticprivate

Definition at line 54 of file RXReadOutStructure.h.

◆ s_last2bitsON

ubit16 RPCReadOut::s_last2bitsON {0xc000}
staticconstexprprotectedinherited

Definition at line 55 of file RPCReadOut.h.

55{0xc000};

◆ s_last4bitsON

ubit16 RPCReadOut::s_last4bitsON {0xf000}
staticconstexprprotectedinherited

Definition at line 56 of file RPCReadOut.h.

56{0xf000};

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