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

#include <SectorLogicReadOut.h>

Inheritance diagram for SectorLogicReadOut:
Collaboration diagram for SectorLogicReadOut:

Classes

struct  SLROData

Public Member Functions

 SectorLogicReadOut ()
 SectorLogicReadOut (const SectorLogicReadOut &SLROOrig)
 ~SectorLogicReadOut ()
void initialize ()
void reset ()
void overwriteHeader (ubit16 thisRecord)
void overwriteFooter (ubit16 thisRecord)
void writeRecord (ubit16 newHit, bool last)
ubit16 numberOfFragmentWords ()
ubit16 numberOfBodyWords ()
ubit16 numberOfHitWords ()
ubit16 numberOfCounterWords ()
void topSLBody ()
void topSLBodyCounters ()
ubit16 readSLHitCurrent ()
ubit16 readSLCounterCurrent ()
RODword getCounter32 (ubit16 index)
float padTriggerRate (ubit16 padAddress)
ubit16 cmadd (ubit16 indexLink, ubit16 indexGate)
ubit16 ptid (ubit16 indexLink, ubit16 indexGate)
ubit16 opl (ubit16 indexLink, ubit16 indexGate)
ubit16 ovphi (ubit16 indexLink, ubit16 indexGate)
ubit16 oveta (ubit16 indexLink, ubit16 indexGate)
ubit16 res (ubit16 indexLink, ubit16 indexGate)
ubit16 bcid (ubit16 indexLink, ubit16 indexGate)
void display (std::ostream &stream)
bool checkFragment ()
ObjectType tag () const
const std::string & name () const
virtual void Print (std::ostream &, bool) const

Private Member Functions

void deleteSLBody ()
void doHit ()
void doCounter32 ()
void makeNewHit (ubit16 newHit)

Private Attributes

SLRODatam_BodyLast {nullptr}
SLRODatam_BodyCurr {nullptr}
ubit16 m_hit [s_nLinks][s_nGates]
std::array< ubit16, s_numberOfDataCountersm_counter16 {0}
std::array< RODword, s_numberOfDecodedCountersm_counter32 {0}
bool m_counter32ok {false}
bool m_hitok {false}
ubit16 m_Header {0}
ubit16 m_Footer {0}
SLRODatam_Body {nullptr}
SLRODatam_BodyCounter {nullptr}
ubit16 m_numberOfWordsInFrag {0}
ubit16 m_numberOfWordsInBody {0}
ubit16 m_numberOfWordsInCounters {s_numberOfDataCounters}
ubit16 m_numberOfWordsInSLHits {0}
ObjectType m_tag
std::string m_name

Static Private Attributes

static constexpr ubit16 s_nGates = 7
static constexpr ubit16 s_nLinks = 8
static const ubit16 s_numberOfDataCounters = 21
static const ubit16 s_numberOfDecodedCounters = 7

Friends

std::ostream & operator<< (std::ostream &stream, SectorLogicReadOut *p)
std::ostream & operator<< (std::ostream &stream, SectorLogicReadOut &p)

Detailed Description

Definition at line 17 of file SectorLogicReadOut.h.

Constructor & Destructor Documentation

◆ SectorLogicReadOut() [1/2]

SectorLogicReadOut::SectorLogicReadOut ( )

Definition at line 18 of file SectorLogicReadOut.cxx.

18: BaseObject(Hardware, "SectorLogicReadOut") { initialize(); } // end-of-SectorLogicReadOut
@ Hardware
Definition BaseObject.h:11
BaseObject(ObjectType, const std::string &)
Definition BaseObject.cxx:7

◆ SectorLogicReadOut() [2/2]

SectorLogicReadOut::SectorLogicReadOut ( const SectorLogicReadOut & SLROOrig)

Definition at line 20 of file SectorLogicReadOut.cxx.

20 : BaseObject(Hardware, "SectorLogicReadOut") {
21 //
22 // copy constructor
23 //
24 m_Header = SLROOrig.m_Header;
25 m_Footer = SLROOrig.m_Footer;
31 m_hitok = SLROOrig.m_hitok;
32 for (ubit16 i = 0; i < s_numberOfDataCounters; i++) { m_counter16[i] = SLROOrig.m_counter16[i]; }
33 for (ubit16 i = 0; i < s_numberOfDecodedCounters; i++) { m_counter32[i] = SLROOrig.m_counter32[i]; }
34 for (int i = 0; i < s_nLinks; ++i) {
35 for (int j = 0; j < s_nGates; ++j) { m_hit[i][j] = SLROOrig.m_hit[i][j]; }
36 }
37 //
38 // Copy Dynamic structure
39 //
40 SLROData *q = 0;
41 SLROData *r = 0;
42 SLROData *p = SLROOrig.m_Body;
43 ubit16 cnter = 0;
44 while (p) {
45 q = new SLROData;
46 q->hit = p->hit;
47 q->next = 0;
48 if (!cnter) {
49 m_Body = q;
50 // if(cnter==(nGates*nLinks)) m_BodyCounter = q;
51 } else
52 r->next = q;
53 cnter++;
54 r = q;
55 p = p->next;
56 } // end-of-while
57 m_BodyLast = r;
58} // end-of-SectorLogicReadOut
unsigned short int ubit16
std::array< RODword, s_numberOfDecodedCounters > m_counter32
static const ubit16 s_numberOfDataCounters
std::array< ubit16, s_numberOfDataCounters > m_counter16
static constexpr ubit16 s_nLinks
ubit16 m_hit[s_nLinks][s_nGates]
static const ubit16 s_numberOfDecodedCounters
static constexpr ubit16 s_nGates
int r
Definition globals.cxx:22

◆ ~SectorLogicReadOut()

SectorLogicReadOut::~SectorLogicReadOut ( )

Definition at line 60 of file SectorLogicReadOut.cxx.

60 {
61 //
62 // delete the SLROData dynamic structure used to describe Body part
63 // of the event fragment.
64 //
66}

Member Function Documentation

◆ bcid()

ubit16 SectorLogicReadOut::bcid ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 256 of file SectorLogicReadOut.cxx.

256 {
257 if (!m_hitok) doHit();
258 if (indexLink < s_nLinks && indexGate < s_nGates) {
259 return (m_hit[indexLink][indexGate] >> 9) & 0x7;
260 } else {
261 throw std::out_of_range("SectorLogicReadout::bcid: indexLink or indexGate out of range");
262 }
263} // end-of-SectorLogicReadOut::bcid(ubit16 indexLink, ubit16 indexGate)

◆ checkFragment()

bool SectorLogicReadOut::checkFragment ( )

Definition at line 285 of file SectorLogicReadOut.cxx.

285 {
287} // end-of-void SectorLogicReadOut::checkFragment()

◆ cmadd()

ubit16 SectorLogicReadOut::cmadd ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 202 of file SectorLogicReadOut.cxx.

202 {
203 if (!m_hitok) doHit();
204 if (indexLink < s_nLinks && indexGate < s_nGates) {
205 return (m_hit[indexLink][indexGate]) & 0x3;
206 } else {
207 throw std::out_of_range("SectorLogicReadout::cmid: indexLink or indexGate out of range");
208 }
209} // end-of-SectorLogicReadOut::cmid(ubit16 indexLink, ubit16 indexGate)

◆ deleteSLBody()

void SectorLogicReadOut::deleteSLBody ( )
private

Definition at line 68 of file SectorLogicReadOut.cxx.

68 {
69 SLROData *p{nullptr}, *q{nullptr};
70 p = m_Body;
71 while (p) {
72 q = p;
73 p = p->next;
74 delete q;
75 } // end-of-while
76 m_Body = 0;
77 m_BodyLast = 0;
78 m_BodyCurr = 0;
79 m_BodyCounter = 0;
81} // end-of-deleteSLBody

◆ display()

void SectorLogicReadOut::display ( std::ostream & stream)

Definition at line 265 of file SectorLogicReadOut.cxx.

265 {
266 stream << " **** Sector Logic ReadOut Fragment ****" << std::endl;
267 stream << " SectorLogic: number of Hits :" << m_numberOfWordsInSLHits << std::endl;
268 stream << " SectorLogic: number of Counters:" << m_numberOfWordsInCounters << std::endl;
269 stream << " SectorLogic: Header " << std::hex << m_Header << std::dec << std::endl;
270 for (ubit16 i = 0; i < m_numberOfWordsInSLHits; i++) {
271 stream << " SectorLogic: hit " << (i + 1) << " ==> " << std::hex << readSLHitCurrent() << std::dec << std::endl;
272 }
273 stream << " SectorLogic: Footer " << std::hex << m_Footer << std::dec << std::endl;
274 for (ubit16 i = 0; i < m_numberOfWordsInCounters; i++) {
275 stream << " SectorLogic: counter " << (i + 1) << " ==> " << std::hex << readSLCounterCurrent() << std::dec << std::endl;
276 }
277 for (int i = 0; i < s_numberOfDecodedCounters; i++) {
278 stream << " SectorLogic: Counter32 " << (i + 1) << " ==> "
279 << " = " << std::hex << getCounter32(i) << std::dec << std::endl;
280 }
281 stream << " SectorLogic: Pad 0 trigger rate: " << padTriggerRate(0) << " kHz" << std::endl;
282 stream << " SectorLogic: Pad 1 trigger rate: " << padTriggerRate(1) << " kHz" << std::endl;
283} // end-of-void SectorLogicReadOut::display
float padTriggerRate(ubit16 padAddress)
RODword getCounter32(ubit16 index)

◆ doCounter32()

void SectorLogicReadOut::doCounter32 ( )
private

Definition at line 158 of file SectorLogicReadOut.cxx.

158 {
160 for (ubit16 i = 0; i < m_numberOfWordsInCounters; i++) { m_counter16[i] = readSLCounterCurrent() & 0x1fff; }
161 //
162 ubit16 j = 0;
163 for (ubit16 i = 0; i < s_numberOfDecodedCounters; i++) {
164 m_counter32[i] = (m_counter16[j] | (m_counter16[j + 1] << 13) | (m_counter16[j + 2] << 26));
165 j += 3;
166 }
167} // end-of-SectorLogicReadOut::doCounter32()

◆ doHit()

void SectorLogicReadOut::doHit ( )
private

Definition at line 195 of file SectorLogicReadOut.cxx.

195 {
196 topSLBody();
197 for (ubit16 j = 0; j < s_nGates; j++) {
198 for (ubit16 i = 0; i < s_nLinks; i++) { m_hit[i][j] = readSLHitCurrent(); } // end-of-for(ubit16 i
199 } // end-of-for(ubit16 j
200} // end-of-SectorLogicReadOut::doHit()

◆ getCounter32()

RODword SectorLogicReadOut::getCounter32 ( ubit16 index)

Definition at line 169 of file SectorLogicReadOut.cxx.

169 {
170 if (!m_counter32ok) {
171 doCounter32();
172 m_counter32ok = true;
173 }
174 if (index < s_numberOfDecodedCounters) {
175 return m_counter32[index];
176 } else {
177 throw std::out_of_range("SectorLogicReadout::getCounter32: index=" + std::to_string(index) + " is larger than " +
178 std::to_string(s_numberOfDecodedCounters));
179 }
180}
str index
Definition DeMoScan.py:362

◆ initialize()

void SectorLogicReadOut::initialize ( )

Definition at line 83 of file SectorLogicReadOut.cxx.

83 {
84 // initialize check flags
85 //
87 for (int i = 0; i < s_nLinks; ++i) {
88 for (int j = 0; j < s_nGates; ++j) { m_hit[i][j] = 0; }
89 }
90
91} // end-of-initialize

◆ makeNewHit()

void SectorLogicReadOut::makeNewHit ( ubit16 newHit)
private

Definition at line 113 of file SectorLogicReadOut.cxx.

113 {
114 SLROData *p;
115 p = new SLROData;
116 p->hit = newHit;
117 p->next = 0;
118 if (!m_Body) {
119 m_Body = p;
120 } else {
121 m_BodyLast->next = p;
122 } // end-of-if
123 m_BodyLast = p;
127} // end-of-SectorLogicReadOut::makeNewHit

◆ name()

const std::string & BaseObject::name ( ) const
inlineinherited

Definition at line 23 of file BaseObject.h.

23{ return m_name; }
std::string m_name
Definition BaseObject.h:16

◆ numberOfBodyWords()

ubit16 SectorLogicReadOut::numberOfBodyWords ( )
inline

Definition at line 28 of file SectorLogicReadOut.h.

28{ return m_numberOfWordsInBody; };

◆ numberOfCounterWords()

ubit16 SectorLogicReadOut::numberOfCounterWords ( )
inline

Definition at line 30 of file SectorLogicReadOut.h.

◆ numberOfFragmentWords()

ubit16 SectorLogicReadOut::numberOfFragmentWords ( )
inline

Definition at line 27 of file SectorLogicReadOut.h.

27{ return m_numberOfWordsInFrag; };

◆ numberOfHitWords()

ubit16 SectorLogicReadOut::numberOfHitWords ( )
inline

Definition at line 29 of file SectorLogicReadOut.h.

29{ return m_numberOfWordsInSLHits; };

◆ opl()

ubit16 SectorLogicReadOut::opl ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 220 of file SectorLogicReadOut.cxx.

220 {
221 if (!m_hitok) doHit();
222 if (indexLink < s_nLinks && indexGate < s_nGates) {
223 return (m_hit[indexLink][indexGate] >> 5) & 0x1;
224 } else {
225 throw std::out_of_range("SectorLogicReadout::opl: indexLink or indexGate out of range");
226 }
227} // end-of-SectorLogicReadOut::opl(ubit16 indexLink, ubit16 indexGate)

◆ overwriteFooter()

void SectorLogicReadOut::overwriteFooter ( ubit16 thisRecord)
inline

Definition at line 25 of file SectorLogicReadOut.h.

25{ m_Footer = thisRecord; };

◆ overwriteHeader()

void SectorLogicReadOut::overwriteHeader ( ubit16 thisRecord)
inline

Definition at line 24 of file SectorLogicReadOut.h.

24{ m_Header = thisRecord; };

◆ oveta()

ubit16 SectorLogicReadOut::oveta ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 238 of file SectorLogicReadOut.cxx.

238 {
239 if (!m_hitok) doHit();
240 if (indexLink < s_nLinks && indexGate < s_nGates) {
241 return (m_hit[indexLink][indexGate] >> 7) & 0x1;
242 } else {
243 throw std::out_of_range("SectorLogicReadout::oveta: indexLink or indexGate out of range");
244 }
245} // end-of-SectorLogicReadOut::oveta(ubit16 indexLink, ubit16 indexGate)

◆ ovphi()

ubit16 SectorLogicReadOut::ovphi ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 229 of file SectorLogicReadOut.cxx.

229 {
230 if (!m_hitok) doHit();
231 if (indexLink < s_nLinks && indexGate < s_nGates) {
232 return (m_hit[indexLink][indexGate] >> 6) & 0x1;
233 } else {
234 throw std::out_of_range("SectorLogicReadout::ovphi: indexLink or indexGate out of range");
235 }
236} // end-of-SectorLogicReadOut::ovphi(ubit16 indexLink, ubit16 indexGate)

◆ padTriggerRate()

float SectorLogicReadOut::padTriggerRate ( ubit16 padAddress)

Definition at line 182 of file SectorLogicReadOut.cxx.

182 {
184 //
185 // units are kHz
186 //
187 static const float convertToTriggerRate = 160314.74 / 4.0; // units are kHz
188 if (padAddress < ((s_numberOfDecodedCounters - 3) / 2)) {
189 return convertToTriggerRate * (float(m_counter32[padAddress * 2 + 1]) / float(m_counter32[padAddress * 2 + 0]));
190 } else {
191 throw std::out_of_range("SectorLogicReadout::padTrigger: input padAddress=" + std::to_string(padAddress) + " is not possible");
192 }
193}

◆ Print()

◆ ptid()

ubit16 SectorLogicReadOut::ptid ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 211 of file SectorLogicReadOut.cxx.

211 {
212 if (!m_hitok) doHit();
213 if (indexLink < s_nLinks && indexGate < s_nGates) {
214 return (m_hit[indexLink][indexGate] >> 2) & 0x7;
215 } else {
216 throw std::out_of_range("SectorLogicReadout::ptid: indexLink or indexGate out of range");
217 }
218} // end-of-SectorLogicReadOut::ptid(ubit16 indexLink, ubit16 indexGate)

◆ readSLCounterCurrent()

ubit16 SectorLogicReadOut::readSLCounterCurrent ( )

Definition at line 139 of file SectorLogicReadOut.cxx.

139 {
140 if (!m_BodyCounter) {
141 SLROData *temp = m_Body;
142 for (ubit16 i = 0; i < numberOfHitWords(); i++) {
143 if (temp->next) temp = temp->next;
144 }
145 if (temp) m_BodyCounter = temp;
147 }
148 //
149 if (m_BodyCurr) {
150 ubit16 hit = m_BodyCurr->hit;
151 m_BodyCurr = m_BodyCurr->next;
152 return hit;
153 } else {
154 return 0xcafe;
155 }
156} // end-of-SectorLogicReadOut::readSLCounterCurrent

◆ readSLHitCurrent()

ubit16 SectorLogicReadOut::readSLHitCurrent ( )

Definition at line 129 of file SectorLogicReadOut.cxx.

129 {
130 if (m_BodyCurr) {
131 ubit16 hit = m_BodyCurr->hit;
132 m_BodyCurr = m_BodyCurr->next;
133 return hit;
134 } else {
135 return 0xefac;
136 }
137} // end-of-SectorLogicReadOut::readSLHitCurrent

◆ res()

ubit16 SectorLogicReadOut::res ( ubit16 indexLink,
ubit16 indexGate )

Definition at line 247 of file SectorLogicReadOut.cxx.

247 {
248 if (!m_hitok) doHit();
249 if (indexLink < s_nLinks && indexGate < s_nGates) {
250 return (m_hit[indexLink][indexGate] >> 8) & 0x1;
251 } else {
252 throw std::out_of_range("SectorLogicReadout::res : indexLink or indexGate out of range");
253 }
254} // end-of-SectorLogicReadOut::res(ubit16 indexLink, ubit16 indexGate)

◆ reset()

void SectorLogicReadOut::reset ( )

Definition at line 93 of file SectorLogicReadOut.cxx.

93 {
94 //
95 // reset the data structure to host a new fragment;
96 // first delete the dinamyc structure...
98 // then initialize the data members.
99 initialize();
100} // end-of-SectorLogicReadOut::reset()

◆ tag()

ObjectType BaseObject::tag ( ) const
inlineinherited

Definition at line 22 of file BaseObject.h.

22{ return m_tag; }
ObjectType m_tag
Definition BaseObject.h:15

◆ topSLBody()

void SectorLogicReadOut::topSLBody ( )
inline

Definition at line 31 of file SectorLogicReadOut.h.

31{ m_BodyCurr = m_Body; };

◆ topSLBodyCounters()

void SectorLogicReadOut::topSLBodyCounters ( )
inline

Definition at line 32 of file SectorLogicReadOut.h.

◆ writeRecord()

void SectorLogicReadOut::writeRecord ( ubit16 newHit,
bool last )

Definition at line 102 of file SectorLogicReadOut.cxx.

102 {
103 if (m_numberOfWordsInFrag == 0) {
104 m_Header = thisRecord;
105 } else if (m_numberOfWordsInFrag && !last) {
106 makeNewHit(thisRecord);
107 } else {
108 m_Footer = thisRecord;
109 }
111} // end-of-void SectorLogicReadOut
void makeNewHit(ubit16 newHit)

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & stream,
SectorLogicReadOut & p )
friend

Definition at line 55 of file SectorLogicReadOut.h.

55 {
56 p.display(stream);
57 return stream;
58 }

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & stream,
SectorLogicReadOut * p )
friend

Definition at line 51 of file SectorLogicReadOut.h.

51 {
52 p->display(stream);
53 return stream;
54 }

Member Data Documentation

◆ m_Body

SLROData* SectorLogicReadOut::m_Body {nullptr}
private

Definition at line 90 of file SectorLogicReadOut.h.

90{nullptr};

◆ m_BodyCounter

SLROData* SectorLogicReadOut::m_BodyCounter {nullptr}
private

Definition at line 91 of file SectorLogicReadOut.h.

91{nullptr}; // pointer to the SL Counters

◆ m_BodyCurr

SLROData* SectorLogicReadOut::m_BodyCurr {nullptr}
private

Definition at line 74 of file SectorLogicReadOut.h.

74{nullptr}; // pointer to the current hit scanned

◆ m_BodyLast

SLROData* SectorLogicReadOut::m_BodyLast {nullptr}
private

Definition at line 73 of file SectorLogicReadOut.h.

73{nullptr}; // pointer to the last hit recorded

◆ m_counter16

std::array<ubit16, s_numberOfDataCounters> SectorLogicReadOut::m_counter16 {0}
private

Definition at line 83 of file SectorLogicReadOut.h.

83{0};

◆ m_counter32

std::array<RODword, s_numberOfDecodedCounters> SectorLogicReadOut::m_counter32 {0}
private

Definition at line 84 of file SectorLogicReadOut.h.

84{0};

◆ m_counter32ok

bool SectorLogicReadOut::m_counter32ok {false}
private

Definition at line 86 of file SectorLogicReadOut.h.

86{false};

◆ m_Footer

ubit16 SectorLogicReadOut::m_Footer {0}
private

Definition at line 89 of file SectorLogicReadOut.h.

89{0};

◆ m_Header

ubit16 SectorLogicReadOut::m_Header {0}
private

Definition at line 88 of file SectorLogicReadOut.h.

88{0};

◆ m_hit

ubit16 SectorLogicReadOut::m_hit[s_nLinks][s_nGates]
private

Definition at line 79 of file SectorLogicReadOut.h.

◆ m_hitok

bool SectorLogicReadOut::m_hitok {false}
private

Definition at line 87 of file SectorLogicReadOut.h.

87{false};

◆ m_name

std::string BaseObject::m_name
privateinherited

Definition at line 16 of file BaseObject.h.

◆ m_numberOfWordsInBody

ubit16 SectorLogicReadOut::m_numberOfWordsInBody {0}
private

Definition at line 93 of file SectorLogicReadOut.h.

93{0};

◆ m_numberOfWordsInCounters

ubit16 SectorLogicReadOut::m_numberOfWordsInCounters {s_numberOfDataCounters}
private

Definition at line 94 of file SectorLogicReadOut.h.

◆ m_numberOfWordsInFrag

ubit16 SectorLogicReadOut::m_numberOfWordsInFrag {0}
private

Definition at line 92 of file SectorLogicReadOut.h.

92{0};

◆ m_numberOfWordsInSLHits

ubit16 SectorLogicReadOut::m_numberOfWordsInSLHits {0}
private

Definition at line 95 of file SectorLogicReadOut.h.

95{0};

◆ m_tag

ObjectType BaseObject::m_tag
privateinherited

Definition at line 15 of file BaseObject.h.

◆ s_nGates

ubit16 SectorLogicReadOut::s_nGates = 7
staticconstexprprivate

Definition at line 76 of file SectorLogicReadOut.h.

◆ s_nLinks

ubit16 SectorLogicReadOut::s_nLinks = 8
staticconstexprprivate

Definition at line 77 of file SectorLogicReadOut.h.

◆ s_numberOfDataCounters

const ubit16 SectorLogicReadOut::s_numberOfDataCounters = 21
staticprivate

Definition at line 81 of file SectorLogicReadOut.h.

◆ s_numberOfDecodedCounters

const ubit16 SectorLogicReadOut::s_numberOfDecodedCounters = 7
staticprivate

Definition at line 82 of file SectorLogicReadOut.h.


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