ATLAS Offline Software
SectorLogicRXReadOut.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <cstring>
8 #include <fstream>
9 #include <iomanip>
10 #include <iostream>
11 
13 
14 using namespace std;
15 
16 //----------------------------------------------------------------------------//
17 SectorLogicRXReadOut::SectorLogicRXReadOut() : BaseObject(Hardware, "SectorLogicRXReadOut") { initialize(); } // end-of-SectorLogicRXReadOut
18 
19 //----------------------------------------------------------------------------//
21  //
22  // delete the SLRXROData dynamic structure used to describe Body part
23  // of the event fragment.
24  //
25  deleteSLBody();
26 }
27 //----------------------------------------------------------------------------//
29  SLRXROData *p, *q;
30  p = m_BodyFirst;
31  while (p) {
32  q = p;
33  p = p->next;
34  delete q;
35  } // end-of-while
36  p = 0;
37  q = 0;
38  m_BodyFirst = 0;
39  m_BodyLast = 0;
40  m_BodyCurr = 0;
42 } // end-of-deleteSLBody
43 
44 //----------------------------------------------------------------------------//
46  //
47  // initialize data members
48  //
49  m_Header = 0;
50  m_SubHeader = 0;
51  m_Footer = 0;
52  //
53  // initialize pointers
54  //
55  m_BodyFirst = 0;
56  m_BodyLast = 0;
57  m_BodyCurr = 0;
58  //
59  // initialize check flags
60  //
63 } // end-of-initialize
64 //----------------------------------------------------------------------------//
65 
67  //
68  // reset the data structure to host a new fragment;
69  // first delete the dinamyc structure...
70  deleteSLBody();
71  // then initialize the data members.
72  initialize();
73 } // end-of-SectorLogicRXReadOut::reset()
74 
75 //----------------------------------------------------------------------------//
76 void SectorLogicRXReadOut::writeRecord(ubit16 thisRecord, bool last) {
77  if (m_numberOfWordsInFrag == 0) {
78  m_Header = thisRecord;
79  } else if (m_numberOfWordsInFrag == 1) {
80  m_SubHeader = thisRecord;
81  } else if (m_numberOfWordsInFrag && !last) {
82  makeNewHit(thisRecord);
83  } else {
84  m_Footer = thisRecord;
85  }
87 } // end-of-void SectorLogicRXReadOut
88 
89 //----------------------------------------------------------------------------//
91  SLRXROData *p;
92  p = new SLRXROData;
93  p->hit = newHit;
94  p->next = 0;
95  if (!m_BodyFirst) {
96  m_BodyFirst = p;
97  } else {
98  m_BodyLast->next = p;
99  } // end-of-if
100  m_BodyLast = p;
101 
104 
105 } // end-of-SectorLogicRXReadOut::makeNewHit
106 //----------------------------------------------------------------------------//
108  if (m_BodyCurr) {
109  ubit16 hit = m_BodyCurr->hit;
111  return hit;
112  } else {
113  return 0xefac;
114  }
115 } // end-of-SectorLogicRXReadOut::readSLHitCurrent
116 
117 //----------------------------------------------------------------------------//
119  stream << " **** Sector Logic ReadOut Fragment ****" << std::endl;
120  stream << " SectorLogic: Header " << std::hex << m_Header << std::dec << std::endl;
121  stream << " SectorLogic: SubHeader " << std::hex << m_SubHeader << std::dec << std::endl;
122  for (ubit16 i = 0; i < m_numberOfInputWords; i++) {
123  stream << " SectorLogic: hit " << (i + 1) << " ==> " << std::hex << readSLHitCurrent() << std::dec << std::endl;
124  }
125  stream << " SectorLogic: Footer " << std::hex << m_Footer << std::dec << std::endl;
126 } // end-of-void SectorLogicRXReadOut::display
SectorLogicRXReadOut::m_SubHeader
uint16_t m_SubHeader
Definition: SectorLogicRXReadOut.h:58
SectorLogicRXReadOut::m_BodyCurr
SLRXROData * m_BodyCurr
Definition: SectorLogicRXReadOut.h:66
SectorLogicRXReadOut::display
void display(std::ostream &stream)
Definition: SectorLogicRXReadOut.cxx:118
SectorLogicRXReadOut::m_BodyFirst
SLRXROData * m_BodyFirst
Definition: SectorLogicRXReadOut.h:60
SectorLogicRXReadOut::reset
void reset()
Definition: SectorLogicRXReadOut.cxx:66
SectorLogicRXReadOut::SLRXROData::hit
uint16_t hit
Definition: SectorLogicRXReadOut.h:53
SectorLogicRXReadOut::makeNewHit
void makeNewHit(ubit16 newHit)
Definition: SectorLogicRXReadOut.cxx:90
SectorLogicRXReadOut::SLRXROData::next
SLRXROData * next
Definition: SectorLogicRXReadOut.h:54
SectorLogicRXReadOut::initialize
void initialize()
Definition: SectorLogicRXReadOut.cxx:45
BaseObject.h
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
SectorLogicRXReadOut::SectorLogicRXReadOut
SectorLogicRXReadOut()
Definition: SectorLogicRXReadOut.cxx:17
SectorLogicRXReadOut::writeRecord
void writeRecord(ubit16 thisRecord, bool last)
Definition: SectorLogicRXReadOut.cxx:76
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
SectorLogicRXReadOut::m_numberOfWordsInFrag
uint16_t m_numberOfWordsInFrag
Definition: SectorLogicRXReadOut.h:61
lumiFormat.i
int i
Definition: lumiFormat.py:85
SectorLogicRXReadOut::m_numberOfInputWords
uint16_t m_numberOfInputWords
Definition: SectorLogicRXReadOut.h:62
SectorLogicRXReadOut::m_BodyLast
SLRXROData * m_BodyLast
Definition: SectorLogicRXReadOut.h:65
SectorLogicRXReadOut::deleteSLBody
void deleteSLBody()
Definition: SectorLogicRXReadOut.cxx:28
SectorLogicRXReadOut::m_Header
uint16_t m_Header
Definition: SectorLogicRXReadOut.h:57
SectorLogicRXReadOut::m_Footer
uint16_t m_Footer
Definition: SectorLogicRXReadOut.h:59
SectorLogicRXReadOut::topSLBody
void topSLBody()
Definition: SectorLogicRXReadOut.h:29
Hardware
@ Hardware
Definition: BaseObject.h:11
BaseObject
Definition: BaseObject.h:13
SectorLogicRXReadOut.h
SectorLogicRXReadOut::readSLHitCurrent
uint16_t readSLHitCurrent()
Definition: SectorLogicRXReadOut.cxx:107
extractSporadic.q
list q
Definition: extractSporadic.py:98
ubit16
unsigned short int ubit16
Definition: RpcByteStreamEncoder.h:20
SectorLogicRXReadOut::SLRXROData
Definition: SectorLogicRXReadOut.h:52
SectorLogicRXReadOut::~SectorLogicRXReadOut
~SectorLogicRXReadOut()
Definition: SectorLogicRXReadOut.cxx:20