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.
 ~CTP_RDO ()
 empty default destructor
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:103
uint32_t m_numberOfBunches
number of bunches in raw data (transient)
Definition CTP_RDO.h:101
unsigned int m_ctpVersionNumber
number of the CTP version to be used
Definition CTP_RDO.h:96
CTPdataformatVersion m_ctpDataFormat
CTP data format for a specified version.
Definition CTP_RDO.h:97
std::vector< uint32_t > m_dataWords
raw data words
Definition CTP_RDO.h:98

◆ 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}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
setEventNumber uint32_t

◆ ~CTP_RDO()

CTP_RDO::~CTP_RDO ( )

empty default destructor

Definition at line 45 of file CTP_RDO.cxx.

45{}

Member Function Documentation

◆ dump()

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

dump raw object content to string

Definition at line 293 of file CTP_RDO.cxx.

294{
295 std::ostringstream s;
296
298
299 return s.str();
300}
const std::vector< uint32_t > & getDataWords() const
Definition CTP_RDO.h:39
uint32_t getL1AcceptBunchPosition() const
Definition CTP_RDO.cxx:94
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 48 of file CTP_RDO.cxx.

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

◆ getCTPVersionNumber()

unsigned int CTP_RDO::getCTPVersionNumber ( ) const
inline

Definition at line 64 of file CTP_RDO.h.

64{ return m_ctpVersionNumber; }

◆ getDataWords()

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

Definition at line 39 of file CTP_RDO.h.

39 {
40 return m_dataWords;
41 }

◆ getEXTRAWords()

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

Definition at line 221 of file CTP_RDO.cxx.

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

◆ getL1AcceptBunchPosition()

uint32_t CTP_RDO::getL1AcceptBunchPosition ( ) const

Definition at line 94 of file CTP_RDO.cxx.

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

◆ getNumberOfAdditionalWords()

uint32_t CTP_RDO::getNumberOfAdditionalWords ( ) const

Definition at line 113 of file CTP_RDO.cxx.

114{
116}

◆ getNumberOfBunches()

uint32_t CTP_RDO::getNumberOfBunches ( ) const

Definition at line 89 of file CTP_RDO.cxx.

90{
91 return m_numberOfBunches;
92}

◆ getTAPWords()

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

Definition at line 211 of file CTP_RDO.cxx.

212{
213 return getWords(TAP);
214}

◆ getTAVWords()

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

Definition at line 216 of file CTP_RDO.cxx.

217{
218 return getWords(TAV);
219}

◆ getTBPWords()

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

Definition at line 206 of file CTP_RDO.cxx.

207{
208 return getWords(TBP);
209}

◆ getTimeNanoSec()

uint32_t CTP_RDO::getTimeNanoSec ( ) const

Definition at line 83 of file CTP_RDO.cxx.

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

◆ getTimeSec()

uint32_t CTP_RDO::getTimeSec ( ) const

Definition at line 77 of file CTP_RDO.cxx.

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

◆ getTimeSinceLastL1A()

uint32_t CTP_RDO::getTimeSinceLastL1A ( ) const

Definition at line 99 of file CTP_RDO.cxx.

100{
101 if(getEXTRAWords().size())
102 return getEXTRAWords().at(0);
103 return -999;
104}
std::vector< uint32_t > getEXTRAWords() const
Definition CTP_RDO.cxx:221

◆ getTIPWords()

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

Definition at line 201 of file CTP_RDO.cxx.

202{
203 return getWords(TIP);
204}

◆ getTurnCounter()

uint32_t CTP_RDO::getTurnCounter ( ) const

Definition at line 106 of file CTP_RDO.cxx.

107{
108 return m_turnCounter;
109}
uint32_t m_turnCounter
turn counter
Definition CTP_RDO.h:100

◆ getWords()

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

Definition at line 238 of file CTP_RDO.cxx.

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

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

◆ selectBunch()

void CTP_RDO::selectBunch ( const uint32_t iBC)

Definition at line 118 of file CTP_RDO.cxx.

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

◆ selectNextBunch()

void CTP_RDO::selectNextBunch ( )

Definition at line 127 of file CTP_RDO.cxx.

128{
131}

◆ setCTPVersionNumber()

void CTP_RDO::setCTPVersionNumber ( unsigned int ctpVersion)

Definition at line 58 of file CTP_RDO.cxx.

58 {
59 m_ctpVersionNumber = ctpVersion;
60}

◆ setL1AcceptBunchPosition()

void CTP_RDO::setL1AcceptBunchPosition ( const uint8_t pos)

Definition at line 141 of file CTP_RDO.cxx.

◆ setNumberOfAdditionalWords()

void CTP_RDO::setNumberOfAdditionalWords ( const uint32_t nExtraWords)

Definition at line 153 of file CTP_RDO.cxx.

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

◆ setNumberOfBunches()

void CTP_RDO::setNumberOfBunches ( const uint32_t nBCs)

Definition at line 133 of file CTP_RDO.cxx.

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

◆ setTAPWord()

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

Definition at line 181 of file CTP_RDO.cxx.

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

◆ setTAVWord()

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

Definition at line 186 of file CTP_RDO.cxx.

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

◆ setTBPWord()

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

Definition at line 176 of file CTP_RDO.cxx.

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

◆ setTimeNanoSec()

void CTP_RDO::setTimeNanoSec ( const uint32_t nano)

Definition at line 69 of file CTP_RDO.cxx.

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

◆ setTimeSec()

void CTP_RDO::setTimeSec ( const uint32_t sec)

Definition at line 62 of file CTP_RDO.cxx.

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

◆ setTIPWord()

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

Definition at line 171 of file CTP_RDO.cxx.

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

◆ setTurnCounter()

void CTP_RDO::setTurnCounter ( const uint32_t tc)

Definition at line 148 of file CTP_RDO.cxx.

149{
151}
static Double_t tc

◆ setWord()

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

Definition at line 226 of file CTP_RDO.cxx.

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

Member Data Documentation

◆ m_activeBunch

uint32_t CTP_RDO::m_activeBunch {0}
private

active bunch, for book keepting (transient)

Definition at line 102 of file CTP_RDO.h.

102{0};

◆ m_ctpDataFormat

CTPdataformatVersion CTP_RDO::m_ctpDataFormat {0}
private

CTP data format for a specified version.

Definition at line 97 of file CTP_RDO.h.

97{0} ;

◆ m_ctpVersionNumber

unsigned int CTP_RDO::m_ctpVersionNumber {0}
private

number of the CTP version to be used

Definition at line 96 of file CTP_RDO.h.

96{0};

◆ m_dataWords

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

raw data words

Definition at line 98 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 99 of file CTP_RDO.h.

99{0};

◆ m_numberOfAdditionalWords

uint32_t CTP_RDO::m_numberOfAdditionalWords {0}
private

number of configurable extra words in the fragment

Definition at line 103 of file CTP_RDO.h.

103{0};

◆ m_numberOfBunches

uint32_t CTP_RDO::m_numberOfBunches {0}
private

number of bunches in raw data (transient)

Definition at line 101 of file CTP_RDO.h.

101{0};

◆ m_turnCounter

uint32_t CTP_RDO::m_turnCounter {0}
private

turn counter

Definition at line 100 of file CTP_RDO.h.

100{0};

◆ SIZEOF_WORDS

unsigned int CTP_RDO::SIZEOF_WORDS = 32
staticconstexpr

number of bits in one data word (32)

Definition at line 90 of file CTP_RDO.h.


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