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

#include <CTP_RDO.h>

Collaboration diagram for CTP_RDO:

Public Member Functions

 CTP_RDO ()=default
 Default constructor needed for pool converters.
 CTP_RDO (unsigned int ctpVersionNumber, const uint32_t nBCs=1, uint32_t nExtraWords=0)
 Constructor takes the number of BCs of the readout window as argument.
 CTP_RDO (unsigned int ctpVersionNumber, std::vector< uint32_t > &&data, uint32_t nExtraWords=0)
 Normal constructor taking the data words of one or several BCs as argument.
const std::vector< uint32_t > & getDataWords () const
void setTimeSec (const uint32_t sec)
void setTimeNanoSec (const uint32_t nano)
uint32_t getTimeSec () const
uint32_t getTimeNanoSec () const
uint32_t getNumberOfBunches () const
uint32_t getL1AcceptBunchPosition () const
uint32_t getNumberOfAdditionalWords () const
uint32_t getTimeSinceLastL1A () const
uint32_t getTurnCounter () const
std::vector< uint32_t > getTIPWords () const
std::vector< uint32_t > getTBPWords () const
std::vector< uint32_t > getTAPWords () const
std::vector< uint32_t > getTAVWords () const
std::vector< uint32_t > getEXTRAWords () const
const CTPdataformatVersion & getCTPVersion () const
void setCTPVersionNumber (unsigned int ctpVersion)
unsigned int getCTPVersionNumber () const
void setTIPWord (const unsigned int i, const uint32_t word)
void setTBPWord (const unsigned int i, const uint32_t word)
void setTAPWord (const unsigned int i, const uint32_t word)
void setTAVWord (const unsigned int i, const uint32_t word)
void selectBunch (const uint32_t iBC)
void selectNextBunch ()
void setNumberOfBunches (const uint32_t nBCs)
void setL1AcceptBunchPosition (const uint8_t)
void setTurnCounter (const uint32_t)
void setNumberOfAdditionalWords (const uint32_t nExtraWords)
const std::string dump () const
 dump raw object content to string
const std::string print (const bool longFormat=false) const
 print object content in a human readable format to string

Static Public Attributes

static constexpr unsigned int SIZEOF_WORDS = 32
 number of bits in one data word (32)

Private Types

enum  WordType {
  TIP , TBP , TAP , TAV ,
  EXTRA
}
typedef enum WordType WordType

Private Member Functions

void setWord (const unsigned int i, const uint32_t word)
std::vector< uint32_t > getWords (WordType type) const

Private Attributes

unsigned int m_ctpVersionNumber {0}
 number of the CTP version to be used
CTPdataformatVersion m_ctpDataFormat {0}
 CTP data format for a specified version.
std::vector< uint32_t > m_dataWords
 raw data words
uint8_t m_l1AcceptPosition {0}
 bunch position, from which the level1 accept was calculated
uint32_t m_turnCounter {0}
 turn counter
uint32_t m_numberOfBunches {0}
 number of bunches in raw data (transient)
uint32_t m_activeBunch {0}
 active bunch, for book keepting (transient)
uint32_t m_numberOfAdditionalWords {0}
 number of configurable extra words in the fragment

Detailed Description

Definition at line 20 of file CTP_RDO.h.

Member Typedef Documentation

◆ WordType

typedef enum WordType CTP_RDO::WordType
private

Definition at line 23 of file CTP_RDO.h.

Member Enumeration Documentation

◆ WordType

enum CTP_RDO::WordType
private
Enumerator
TIP 
TBP 
TAP 
TAV 
EXTRA 

Definition at line 22 of file CTP_RDO.h.

22{/*PIT, FPI,*/ TIP, TBP, TAP, TAV, EXTRA};
@ EXTRA
Definition CTP_RDO.h:22
@ TAP
Definition CTP_RDO.h:22
@ TAV
Definition CTP_RDO.h:22
@ TBP
Definition CTP_RDO.h:22
@ TIP
Definition CTP_RDO.h:22

Constructor & Destructor Documentation

◆ CTP_RDO() [1/3]

CTP_RDO::CTP_RDO ( )
default

Default constructor needed for pool converters.

◆ CTP_RDO() [2/3]

CTP_RDO::CTP_RDO ( unsigned int ctpVersionNumber,
const uint32_t nBCs = 1,
uint32_t nExtraWords = 0 )

Constructor takes the number of BCs of the readout window as argument.

Definition at line 19 of file CTP_RDO.cxx.

20 : m_ctpVersionNumber(ctpVersionNumber),
21 m_ctpDataFormat(ctpVersionNumber),
22 m_numberOfBunches(nBCs),
23 m_numberOfAdditionalWords(nExtraWords)
24{
25
26 // create correct length, zero filled data member
27 m_dataWords.resize(m_ctpDataFormat.getNumberTimeWords()+(nBCs*m_ctpDataFormat.getDAQwordsPerBunch() )+nExtraWords);
28}
uint32_t m_numberOfAdditionalWords
number of configurable extra words in the fragment
Definition CTP_RDO.h:100
uint32_t m_numberOfBunches
number of bunches in raw data (transient)
Definition CTP_RDO.h:98
unsigned int m_ctpVersionNumber
number of the CTP version to be used
Definition CTP_RDO.h:93
CTPdataformatVersion m_ctpDataFormat
CTP data format for a specified version.
Definition CTP_RDO.h:94
std::vector< uint32_t > m_dataWords
raw data words
Definition CTP_RDO.h:95

◆ CTP_RDO() [3/3]

CTP_RDO::CTP_RDO ( unsigned int ctpVersionNumber,
std::vector< uint32_t > && data,
uint32_t nExtraWords = 0 )

Normal constructor taking the data words of one or several BCs as argument.

Definition at line 30 of file CTP_RDO.cxx.

31 : m_ctpVersionNumber(ctpVersionNumber),
32 m_ctpDataFormat(ctpVersionNumber),
33 m_dataWords(std::move(data))
34{
35
36 m_numberOfAdditionalWords=nExtraWords;
37 if(!m_dataWords.size()) {
39 } else {
40 uint32_t dataWords = static_cast<uint32_t>(m_dataWords.size()) - m_ctpDataFormat.getNumberTimeWords() - nExtraWords;
41 m_numberOfBunches = dataWords / m_ctpDataFormat.getDAQwordsPerBunch();
42 }
43}
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
setEventNumber uint32_t

Member Function Documentation

◆ dump()

const std::string CTP_RDO::dump ( ) const

dump raw object content to string

Definition at line 292 of file CTP_RDO.cxx.

293{
294 std::ostringstream s;
295
297
298 return s.str();
299}
const std::vector< uint32_t > & getDataWords() const
Definition CTP_RDO.h:36
uint32_t getL1AcceptBunchPosition() const
Definition CTP_RDO.cxx:93
const std::string convertToHex(const uint32_t word)
helper function to dump a number in hex format

◆ getCTPVersion()

const CTPdataformatVersion & CTP_RDO::getCTPVersion ( ) const

Definition at line 47 of file CTP_RDO.cxx.

47 {
48 if(m_ctpVersionNumber==0) {
49 MsgStream log(Athena::getMessageSvc(), "CTP_RDO");
50 log << MSG::WARNING << "CTPVersion has not been set, no information about data format available, please fix your code" << endmsg;
51 }
52 return m_ctpDataFormat;
53}
#define endmsg
IMessageSvc * getMessageSvc(bool quiet=false)

◆ getCTPVersionNumber()

unsigned int CTP_RDO::getCTPVersionNumber ( ) const
inline

Definition at line 61 of file CTP_RDO.h.

61{ return m_ctpVersionNumber; }

◆ getDataWords()

const std::vector< uint32_t > & CTP_RDO::getDataWords ( ) const
inline

Definition at line 36 of file CTP_RDO.h.

36 {
37 return m_dataWords;
38 }

◆ getEXTRAWords()

std::vector< uint32_t > CTP_RDO::getEXTRAWords ( ) const

Definition at line 220 of file CTP_RDO.cxx.

221{
222 return getWords(EXTRA);
223}
std::vector< uint32_t > getWords(WordType type) const
Definition CTP_RDO.cxx:237

◆ getL1AcceptBunchPosition()

uint32_t CTP_RDO::getL1AcceptBunchPosition ( ) const

Definition at line 93 of file CTP_RDO.cxx.

94{
95 return m_l1AcceptPosition;
96}
uint8_t m_l1AcceptPosition
bunch position, from which the level1 accept was calculated
Definition CTP_RDO.h:96

◆ getNumberOfAdditionalWords()

uint32_t CTP_RDO::getNumberOfAdditionalWords ( ) const

Definition at line 112 of file CTP_RDO.cxx.

113{
115}

◆ getNumberOfBunches()

uint32_t CTP_RDO::getNumberOfBunches ( ) const

Definition at line 88 of file CTP_RDO.cxx.

89{
90 return m_numberOfBunches;
91}

◆ getTAPWords()

std::vector< uint32_t > CTP_RDO::getTAPWords ( ) const

Definition at line 210 of file CTP_RDO.cxx.

211{
212 return getWords(TAP);
213}

◆ getTAVWords()

std::vector< uint32_t > CTP_RDO::getTAVWords ( ) const

Definition at line 215 of file CTP_RDO.cxx.

216{
217 return getWords(TAV);
218}

◆ getTBPWords()

std::vector< uint32_t > CTP_RDO::getTBPWords ( ) const

Definition at line 205 of file CTP_RDO.cxx.

206{
207 return getWords(TBP);
208}

◆ getTimeNanoSec()

uint32_t CTP_RDO::getTimeNanoSec ( ) const

Definition at line 82 of file CTP_RDO.cxx.

83{
84 if(m_dataWords.size() <= getCTPVersion().getTimeNanosecondsPos()) return 0;
85 return (m_dataWords.at(getCTPVersion().getTimeNanosecondsPos() ) >> getCTPVersion().getTimeNanosecondsOffset() ) * getCTPVersion().getTimeNanosecondsTicks();
86}
const CTPdataformatVersion & getCTPVersion() const
Definition CTP_RDO.cxx:47

◆ getTimeSec()

uint32_t CTP_RDO::getTimeSec ( ) const

Definition at line 76 of file CTP_RDO.cxx.

77{
78 if(m_dataWords.size() <= getCTPVersion().getTimeSecondsPos()) return 0;
79 return m_dataWords.at(getCTPVersion().getTimeSecondsPos() );
80}

◆ getTimeSinceLastL1A()

uint32_t CTP_RDO::getTimeSinceLastL1A ( ) const

Definition at line 98 of file CTP_RDO.cxx.

99{
100 if(getEXTRAWords().size())
101 return getEXTRAWords().at(0);
102 return -999;
103}
size_t size() const
Number of registered mappings.
std::vector< uint32_t > getEXTRAWords() const
Definition CTP_RDO.cxx:220

◆ getTIPWords()

std::vector< uint32_t > CTP_RDO::getTIPWords ( ) const

Definition at line 200 of file CTP_RDO.cxx.

201{
202 return getWords(TIP);
203}

◆ getTurnCounter()

uint32_t CTP_RDO::getTurnCounter ( ) const

Definition at line 105 of file CTP_RDO.cxx.

106{
107 return m_turnCounter;
108}
uint32_t m_turnCounter
turn counter
Definition CTP_RDO.h:97

◆ getWords()

std::vector< uint32_t > CTP_RDO::getWords ( WordType type) const
private

Definition at line 237 of file CTP_RDO.cxx.

238{
239 unsigned int nWords = 0;
240 unsigned int offset = 0;
241 std::vector<uint32_t> vec;
242 vec.clear();
243
244 switch (type) {
245 //case PIT:
246// nWords = getCTPVersion().getPITwords();
247// offset = getCTPVersion().getPITpos();
248// break;
249// case FPI:
250// nWords = getCTPVersion().getFPIwords();
251// offset = getCTPVersion().getFPIpos();
252// break;
253 case TIP:
254 nWords = getCTPVersion().getTIPwords();
255 offset = getCTPVersion().getTIPpos();
256 break;
257 case TBP:
258 nWords = getCTPVersion().getTBPwords();
259 offset = getCTPVersion().getTBPpos();
260 break;
261 case TAP:
262 nWords = getCTPVersion().getTAPwords();
263 offset = getCTPVersion().getTAPpos();
264 break;
265 case TAV:
266 nWords = getCTPVersion().getTAVwords();
267 offset = getCTPVersion().getTAVpos();
268 break;
269 case EXTRA:
270 vec.assign(m_dataWords.begin() + (m_dataWords.size()-m_numberOfAdditionalWords), m_dataWords.end());
271 return vec;
272 break;
273
274 default:
275 // error
276 break;
277 }
278
279 for(unsigned int bunch = 0 ; bunch < m_numberOfBunches ; ++bunch) {
280 for(unsigned int tbp = 0; tbp < nWords; ++tbp) {
281 // take offset of TBPwords into account
282 unsigned int index = offset + tbp;
283 // go to the correct bunch
284 index += (bunch * getCTPVersion().getDAQwordsPerBunch());
285 if( index < m_dataWords.size() ) vec.push_back(m_dataWords[index]);
286 }
287 }
288 // this is now a list of consecutive data words for all bunches
289 return vec;
290}
std::vector< size_t > vec
str index
Definition DeMoScan.py:362

◆ print()

const std::string CTP_RDO::print ( const bool longFormat = false) const

print object content in a human readable format to string

Definition at line 301 of file CTP_RDO.cxx.

302{
303 std::ostringstream s;
304
305 // lvl1 accept position
306 s << "\n L1APos:" << std::setw(3) << getL1AcceptBunchPosition();
307 if (longFormat) s << std::endl;
308 s << "\n Turn counter:" << std::setw(3) << getTurnCounter();
309 if (longFormat) s << std::endl;
310
311 // time is only stored once for the whole fragment
312 for (size_t i(0); (i < getCTPVersion().getNumberTimeWords() ) && (i < m_dataWords.size()); ++i) {
313 if (i == 0 || longFormat) s << "\n Time";
314 if (longFormat) s << std::setw(1) << i;
315 s << " " << std::setw(8) << m_dataWords[i];
316 if (longFormat) s << std::endl;
317 }
318
319 // return if data content is too short
320 if (m_dataWords.size() < 2) return s.str();
321
322
323 // loop over the rest of the data fragment
324 for (unsigned int k(0); k < (m_dataWords.size()-2)/getCTPVersion().getDAQwordsPerBunch(); ++k) {
325
326 // print single fragment
327
328 // TIP
329 for (size_t i(0), p(k*getCTPVersion().getDAQwordsPerBunch() + getCTPVersion().getTIPpos());
330 (i < getCTPVersion().getTIPwords()) && (p < m_dataWords.size());
331 ++i, ++p) {
332 if (i == 0 || longFormat) s << "\n TIP";
333 if (longFormat) s << std::setw(1) << i;
335 if (longFormat) s << std::endl;
336 }
337
338
339 // TBP
340 for (size_t i(0), p(k*getCTPVersion().getDAQwordsPerBunch() + getCTPVersion().getTBPpos());
341 (i < getCTPVersion().getTBPwords()) && (p < m_dataWords.size());
342 ++i, ++p) {
343 if (i == 0 || longFormat) s << "\n TBP";
344 if (longFormat) s << std::setw(1) << i;
346 if (longFormat) s << std::endl;
347 }
348
349 // TAP
350 for (size_t i(0), p(k*getCTPVersion().getDAQwordsPerBunch() + getCTPVersion().getTAPpos());
351 (i < getCTPVersion().getTAPwords()) && (p < m_dataWords.size());
352 ++i, ++p) {
353 if (i == 0 || longFormat) s << "\n TAP";
354 if (longFormat) s << std::setw(1) << i;
356 if (longFormat) s << std::endl;
357 }
358
359 // TAV
360 for (size_t i(0), p(k*getCTPVersion().getDAQwordsPerBunch() + getCTPVersion().getTAVpos() );
361 (i < getCTPVersion().getTAVwords()) && (p < m_dataWords.size());
362 ++i, ++p) {
363 if (i == 0 || longFormat) s << "\n TAV";
364 if (longFormat) s << std::setw(1) << i;
366 if (longFormat) s << std::endl;
367 }
368
369 }
370
371 //EXTRA WORDS
372 for (size_t i(m_dataWords.size()-m_numberOfAdditionalWords); i < m_dataWords.size(); ++i) {
373 if (i == m_dataWords.size()-m_numberOfAdditionalWords || longFormat ) s << "\n EXTRA";
374 if (longFormat) s << std::setw(1) << i;
376 if (longFormat) s << std::endl;
377 }
378
379 return s.str();
380}
uint32_t getTurnCounter() const
Definition CTP_RDO.cxx:105

◆ selectBunch()

void CTP_RDO::selectBunch ( const uint32_t iBC)

Definition at line 117 of file CTP_RDO.cxx.

118{
119 if (iBC < m_numberOfBunches) {
120 m_activeBunch = iBC;
121 } else {
122 m_activeBunch = 0u;
123 }
124}
uint32_t m_activeBunch
active bunch, for book keepting (transient)
Definition CTP_RDO.h:99

◆ selectNextBunch()

void CTP_RDO::selectNextBunch ( )

Definition at line 126 of file CTP_RDO.cxx.

127{
130}

◆ setCTPVersionNumber()

void CTP_RDO::setCTPVersionNumber ( unsigned int ctpVersion)

Definition at line 57 of file CTP_RDO.cxx.

57 {
58 m_ctpVersionNumber = ctpVersion;
59}

◆ setL1AcceptBunchPosition()

void CTP_RDO::setL1AcceptBunchPosition ( const uint8_t pos)

Definition at line 140 of file CTP_RDO.cxx.

◆ setNumberOfAdditionalWords()

void CTP_RDO::setNumberOfAdditionalWords ( const uint32_t nExtraWords)

Definition at line 152 of file CTP_RDO.cxx.

153{
154 if(nExtraWords > m_numberOfAdditionalWords) {
155 m_dataWords.resize(m_dataWords.size()+nExtraWords-m_numberOfAdditionalWords);//Add the difference
156 }
157 m_numberOfAdditionalWords = nExtraWords;
158}

◆ setNumberOfBunches()

void CTP_RDO::setNumberOfBunches ( const uint32_t nBCs)

Definition at line 132 of file CTP_RDO.cxx.

133{
134 if (nBCs > m_numberOfBunches) {
135 m_numberOfBunches = nBCs;
136 m_dataWords.resize(getCTPVersion().getNumberTimeWords()+(nBCs*getCTPVersion().getDAQwordsPerBunch() )+m_numberOfAdditionalWords);
137 }
138}

◆ setTAPWord()

void CTP_RDO::setTAPWord ( const unsigned int i,
const uint32_t word )

Definition at line 180 of file CTP_RDO.cxx.

181{
182 setWord(i + (m_activeBunch*getCTPVersion().getDAQwordsPerBunch() ) + getCTPVersion().getTAPpos(), word);
183}
void setWord(const unsigned int i, const uint32_t word)
Definition CTP_RDO.cxx:225

◆ setTAVWord()

void CTP_RDO::setTAVWord ( const unsigned int i,
const uint32_t word )

Definition at line 185 of file CTP_RDO.cxx.

186{
187 setWord(i + (m_activeBunch*getCTPVersion().getDAQwordsPerBunch()) + getCTPVersion().getTAVpos(), word);
188}

◆ setTBPWord()

void CTP_RDO::setTBPWord ( const unsigned int i,
const uint32_t word )

Definition at line 175 of file CTP_RDO.cxx.

176{
177 setWord(i + (m_activeBunch*getCTPVersion().getDAQwordsPerBunch() ) + getCTPVersion().getTBPpos(), word);
178}

◆ setTimeNanoSec()

void CTP_RDO::setTimeNanoSec ( const uint32_t nano)

Definition at line 68 of file CTP_RDO.cxx.

69{
70 if(getCTPVersion().getTimeNanosecondsPos() < m_dataWords.size()) {
71 m_dataWords[getCTPVersion().getTimeNanosecondsPos()] =
72 (nano/getCTPVersion().getTimeNanosecondsTicks()) << getCTPVersion().getTimeNanosecondsOffset();
73 }
74}

◆ setTimeSec()

void CTP_RDO::setTimeSec ( const uint32_t sec)

Definition at line 61 of file CTP_RDO.cxx.

62{
63 if(getCTPVersion().getTimeSecondsPos() < m_dataWords.size()) {
64 m_dataWords[getCTPVersion().getTimeSecondsPos()] = sec;
65 }
66}

◆ setTIPWord()

void CTP_RDO::setTIPWord ( const unsigned int i,
const uint32_t word )

Definition at line 170 of file CTP_RDO.cxx.

171{
172 setWord(i + (m_activeBunch*getCTPVersion().getDAQwordsPerBunch()) + getCTPVersion().getTIPpos(), word);
173}

◆ setTurnCounter()

void CTP_RDO::setTurnCounter ( const uint32_t tc)

Definition at line 147 of file CTP_RDO.cxx.

148{
150}
static Double_t tc

◆ setWord()

void CTP_RDO::setWord ( const unsigned int i,
const uint32_t word )
private

Definition at line 225 of file CTP_RDO.cxx.

226{
227 if (i < m_dataWords.size()) {
228 m_dataWords[i] = word;
229 } else {
230 MsgStream log(Athena::getMessageSvc(), "CTP_RDO");
231 log << MSG::WARNING << "ignoring word " << word << " for position " << i << endmsg;
232 }
233
234 return;
235}

Member Data Documentation

◆ m_activeBunch

uint32_t CTP_RDO::m_activeBunch {0}
private

active bunch, for book keepting (transient)

Definition at line 99 of file CTP_RDO.h.

99{0};

◆ m_ctpDataFormat

CTPdataformatVersion CTP_RDO::m_ctpDataFormat {0}
private

CTP data format for a specified version.

Definition at line 94 of file CTP_RDO.h.

94{0} ;

◆ m_ctpVersionNumber

unsigned int CTP_RDO::m_ctpVersionNumber {0}
private

number of the CTP version to be used

Definition at line 93 of file CTP_RDO.h.

93{0};

◆ m_dataWords

std::vector<uint32_t> CTP_RDO::m_dataWords
private

raw data words

Definition at line 95 of file CTP_RDO.h.

◆ m_l1AcceptPosition

uint8_t CTP_RDO::m_l1AcceptPosition {0}
private

bunch position, from which the level1 accept was calculated

Definition at line 96 of file CTP_RDO.h.

96{0};

◆ m_numberOfAdditionalWords

uint32_t CTP_RDO::m_numberOfAdditionalWords {0}
private

number of configurable extra words in the fragment

Definition at line 100 of file CTP_RDO.h.

100{0};

◆ m_numberOfBunches

uint32_t CTP_RDO::m_numberOfBunches {0}
private

number of bunches in raw data (transient)

Definition at line 98 of file CTP_RDO.h.

98{0};

◆ m_turnCounter

uint32_t CTP_RDO::m_turnCounter {0}
private

turn counter

Definition at line 97 of file CTP_RDO.h.

97{0};

◆ SIZEOF_WORDS

unsigned int CTP_RDO::SIZEOF_WORDS = 32
staticconstexpr

number of bits in one data word (32)

Definition at line 87 of file CTP_RDO.h.


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