ATLAS Offline Software
Functions
CTPResultUtils Namespace Reference

Utility functions for xAOD::CTPResult objects that rely on tdaq-common. More...

Functions

void initialize (xAOD::CTPResult &ctpRes, const uint32_t ctpVersionNumber, std::vector< uint32_t > &data, const uint32_t nExtraWords=0)
 Initialize the object using xAOD::Header, xAOD::Trailer, and the payload data. More...
 
void dumpData (xAOD::CTPResult &ctpRes)
 Print object content to default message stream. More...
 
void dumpData (xAOD::CTPResult &ctpRes, MsgStream &log)
 Print object content to given message stream. More...
 

Detailed Description

Utility functions for xAOD::CTPResult objects that rely on tdaq-common.

Declared here as tdaq-common is used in TrigT1Interfaces and not xAODTrigger. Prevents using XAOD_ANALYSIS macro in xAOD class.

Function Documentation

◆ dumpData() [1/2]

void CTPResultUtils::dumpData ( xAOD::CTPResult ctpRes)

Print object content to default message stream.

Definition at line 93 of file CTPResultUtils.cxx.

93  {
94  SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
95  if ( !msgSvc ) {
96  return;
97  }
98  MsgStream log(msgSvc, "xAOD::CTPResult");
99  dumpData(ctpRes, log);
100  }

◆ dumpData() [2/2]

void CTPResultUtils::dumpData ( xAOD::CTPResult ctpRes,
MsgStream &  log 
)

Print object content to given message stream.

Parameters
logMessage stream.

Definition at line 103 of file CTPResultUtils.cxx.

103  {
104 
105  log << MSG::DEBUG << "*BEGIN* xAOD::CTPResult" << endmsg;
106 
107  // Check number of bunches
108  if(ctpRes.numberOfBunches() == 0) {
109  log << MSG::DEBUG << "xAOD::CTPResult empty" << endmsg;
110  log << MSG::DEBUG << "*END* xAOD::CTPResult" << endmsg;
111  return;
112  }
113 
114  // Check number of bunches size
115  if(ctpRes.numberOfBunches() != ctpRes.tipWords().size()) {
116  log << MSG::ERROR <<"Mismatch: " << ctpRes.numberOfBunches() << " bunches, but the size of tipWords is " << ctpRes.tipWords().size() << endmsg;
117  }
118 
119  log << MSG::DEBUG << "CTP version number: " << ctpRes.ctpVersionNumber() << endmsg;
120  log << MSG::DEBUG << "Number of bunches: " << ctpRes.numberOfBunches() << endmsg;
121  log << MSG::DEBUG << "L1A position: " << ctpRes.l1AcceptBunchPosition() << endmsg;
122 
123  // Print header info
124  log << MSG::DEBUG << "Header information: " << endmsg;
125  log << MSG::DEBUG << " Header marker : " << MSG::hex << ctpRes.headerMarker() << MSG::dec << endmsg;
126  log << MSG::DEBUG << " Header size : " << ctpRes.headerSize() << endmsg;
127  log << MSG::DEBUG << " Header format version : " << ctpRes.headerFormatVersion() << endmsg;
128  log << MSG::DEBUG << " Source ID : 0x" << MSG::hex << ctpRes.sourceID() << MSG::dec << endmsg;
129  log << MSG::DEBUG << " Run number : " << ctpRes.runNumber() << endmsg;
130  log << MSG::DEBUG << " Ext. LVL1 ID : " << ctpRes.L1ID() << endmsg;
131  log << MSG::DEBUG << " BCID : " << ctpRes.BCID() << endmsg;
132  log << MSG::DEBUG << " Trigger type : " << ctpRes.triggerType() << endmsg;
133  log << MSG::DEBUG << " Det. event type : " << ctpRes.eventType() << endmsg;
134 
135  // Print payload info
136  log << MSG::DEBUG << "Payload information: " << endmsg;
137  log << MSG::DEBUG << " Time " << ctpRes.timeSec() << "s "
138  << std::setw(10) << std::setiosflags(std::ios_base::right) << std::setfill(' ')
139  << ctpRes.timeNanoSec() << std::resetiosflags(std::ios_base::right)
140  << "ns" << endmsg;
141 
142  // Print per-bunch information
143  for(unsigned int i = 0; i<ctpRes.numberOfBunches(); ++i) {
144 
145  auto bunch = ctpRes.getBC(i);
146  log << MSG::DEBUG << " BC dump for bunch " << i << endmsg;
147 
148  // TIP words
149  for(unsigned int j = 0; j<ctpRes.tipWords()[i].size(); ++j) {
150  log << MSG::DEBUG << " TIP word number " << j << ": " << ctpRes.tipWords()[i][j] << endmsg;
151  }
152  if (ctpRes.tipWords()[i].size() == 0) {
153  log << MSG::DEBUG << " No TIP words!" << endmsg;
154  }
155 
156  // TBP words
157  for(unsigned int j = 0; j<ctpRes.tbpWords()[i].size(); ++j) {
158  log << MSG::DEBUG << " TBP word number " << j << ": " << ctpRes.tbpWords()[i][j] << endmsg;
159  }
160  if (ctpRes.tbpWords()[i].size() == 0) {
161  log << MSG::DEBUG << " No TBP words!" << endmsg;
162  }
163 
164  // TAP words
165  for(unsigned int j = 0; j<ctpRes.tapWords()[i].size(); ++j) {
166  log << MSG::DEBUG << " TAP word number " << j << ": " << ctpRes.tapWords()[i][j] << endmsg;
167  }
168  if (ctpRes.tapWords()[i].size() == 0) {
169  log << MSG::DEBUG << " No TAP words!" << endmsg;
170  }
171 
172  // TAV words
173  for(unsigned int j = 0; j<ctpRes.tavWords()[i].size(); ++j) {
174  log << MSG::DEBUG << " TAV word number " << j << ": " << ctpRes.tavWords()[i][j] << endmsg;
175  }
176  if (ctpRes.tavWords()[i].size() == 0) {
177  log << MSG::DEBUG << " No TAV words!" << endmsg;
178  }
179  }
180 
181  // Additional words
182  for(unsigned int i = 0; i<ctpRes.additionalWords().size(); ++i) {
183  log << MSG::DEBUG << " Additional word number " << i << ": " << ctpRes.additionalWords()[i] << endmsg;
184  }
185  if (ctpRes.additionalWords().size() == 0) {
186  log << MSG::DEBUG << " No additional words!" << endmsg;
187  }
188 
189  // Print trailer info
190  log << MSG::DEBUG << "Trailer information: " << endmsg;
191  log << MSG::DEBUG << " Error status : " << ctpRes.errorStatus() << endmsg;
192  log << MSG::DEBUG << " Status info : " << ctpRes.infoStatus() << endmsg;
193  log << MSG::DEBUG << " Number of status words : " << ctpRes.numStatusWords() << endmsg;
194  log << MSG::DEBUG << " Number of data words : " << ctpRes.numDataWords() << endmsg;
195  log << MSG::DEBUG << " Status information position : " << ctpRes.statusPosition() << endmsg;
196  log << MSG::DEBUG << "*END* xAOD::CTPResult" << endmsg;
197  }

◆ initialize()

void CTPResultUtils::initialize ( xAOD::CTPResult ctpRes,
const uint32_t  ctpVersionNumber,
std::vector< uint32_t > &  data,
const uint32_t  nExtraWords = 0 
)

Initialize the object using xAOD::Header, xAOD::Trailer, and the payload data.

Optionally, extra words can be included.

Parameters
ctpResReference to the CTPResult object to initialize.
ctpVersionNumberVersion number of the CTPdataformat.
dataVector of words representing the payload data (excluding timestamp words).
nExtraWordsNumber of additional words (default is 0).

Definition at line 23 of file CTPResultUtils.cxx.

23  {
24 
25  // CTP version number
26  CTPdataformatVersion ctpDataFormat(ctpVersionNumber);
27  ctpRes.setCtpVersionNumber(ctpVersionNumber);
28 
29  // Number of bunches
30  if (!data.size()) {
31  ctpRes.setNumberOfBunches(0u);
32  } else {
33  uint32_t numberOfWords = static_cast<uint32_t>(data.size()) - ctpDataFormat.getNumberTimeWords() - nExtraWords;
34  ctpRes.setNumberOfBunches(numberOfWords / ctpDataFormat.getDAQwordsPerBunch());
35  }
36 
37  ctpRes.setTimeSec(data[ctpDataFormat.getTimeSecondsPos()]);
38  ctpRes.setTimeNanoSec(data[ctpDataFormat.getTimeNanosecondsPos()]);
39 
40  // Create vectors of vectors for the trigger words for all bunches
41  std::vector<std::vector<uint32_t>> tip(ctpRes.numberOfBunches());
42  std::vector<std::vector<uint32_t>> tbp(ctpRes.numberOfBunches());
43  std::vector<std::vector<uint32_t>> tap(ctpRes.numberOfBunches());
44  std::vector<std::vector<uint32_t>> tav(ctpRes.numberOfBunches());
45 
46  // Fill vectors
47  for( uint32_t bunch=0u; bunch != ctpRes.numberOfBunches(); ++bunch){
48 
49  // TIP words
50  for(unsigned int tipIdx = 0; tipIdx < ctpDataFormat.getTIPwords(); ++tipIdx) {
51  unsigned int index = ctpDataFormat.getTIPpos() + tipIdx + (bunch * ctpDataFormat.getDAQwordsPerBunch());
52  if( index < data.size() ) {
53  tip[bunch].push_back(data[index]);
54  }
55  }
56 
57  // TBP words
58  for(unsigned int tbpIdx = 0; tbpIdx < ctpDataFormat.getTBPwords(); ++tbpIdx) {
59  unsigned int index = ctpDataFormat.getTBPpos() + tbpIdx + (bunch * ctpDataFormat.getDAQwordsPerBunch());
60  if( index < data.size() ) {
61  tbp[bunch].push_back(data[index]);
62  }
63  }
64 
65  // TAP words
66  for(unsigned int tapIdx = 0; tapIdx < ctpDataFormat.getTAPwords(); ++tapIdx) {
67  unsigned int index = ctpDataFormat.getTAPpos() + tapIdx + (bunch * ctpDataFormat.getDAQwordsPerBunch());
68  if( index < data.size() ) {
69  tap[bunch].push_back(data[index]);
70  }
71  }
72 
73  // TAV words
74  for(unsigned int tavIdx = 0; tavIdx < ctpDataFormat.getTAVwords(); ++tavIdx) {
75  unsigned int index = ctpDataFormat.getTAVpos() + tavIdx + (bunch * ctpDataFormat.getDAQwordsPerBunch());
76  if( index < data.size() ) {
77  tav[bunch].push_back(data[index]);
78  }
79  }
80  }
81  ctpRes.setTIPWords(tip);
82  ctpRes.setTBPWords(tbp);
83  ctpRes.setTAPWords(tap);
84  ctpRes.setTAVWords(tav);
85 
86  // Additional words
87  std::vector<uint32_t> vec;
88  vec.assign(data.begin() + (data.size()-nExtraWords), data.end());
89  ctpRes.setAdditionalWords(vec);
90  }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
xAOD::CTPResult_v1::errorStatus
uint32_t errorStatus() const
Retrieve the error status word.
xAOD::CTPResult_v1::sourceID
uint32_t sourceID() const
Retrieve the sub-detector source ID.
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::CTPResult_v1::L1ID
uint32_t L1ID() const
Retrieve the extended LVL1 ID.
index
Definition: index.py:1
xAOD::CTPResult_v1::statusPosition
uint32_t statusPosition() const
Retrieve the position of status information in the ROD.
xAOD::CTPResult_v1::setTimeNanoSec
void setTimeNanoSec(const uint32_t nano)
Set the time in nanoseconds.
xAOD::CTPResult_v1::setAdditionalWords
void setAdditionalWords(const std::vector< uint32_t > &words)
Set the additional data words.
xAOD::CTPResult_v1::ctpVersionNumber
uint32_t ctpVersionNumber() const
Get the CTP version number.
xAOD::CTPResult_v1::eventType
uint32_t eventType() const
Retrieve the LVL1 event type.
xAOD::CTPResult_v1::setTimeSec
void setTimeSec(const uint32_t sec)
Set the time in seconds.
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
xAOD::tap
setBGCode tap
Definition: TrigDecision_v1.cxx:43
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
xAOD::CTPResult_v1::headerFormatVersion
uint32_t headerFormatVersion() const
Retrieve the format version of the header.
xAOD::CTPResult_v1::setTIPWords
void setTIPWords(const std::vector< std::vector< uint32_t > > &words)
Set the TIP words for all bunch crossings.
xAOD::CTPResult_v1::setTAPWords
void setTAPWords(const std::vector< std::vector< uint32_t > > &words)
Set the TAP words for all bunch crossings.
xAOD::CTPResult_v1::setTBPWords
void setTBPWords(const std::vector< std::vector< uint32_t > > &words)
Set the TBP words for all bunch crossings.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
xAOD::CTPResult_v1::BCID
uint32_t BCID() const
Retrieve the bunch crossing ID.
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
xAOD::CTPResult_v1::l1AcceptBunchPosition
uint32_t l1AcceptBunchPosition() const
Get the L1 accept bunch position.
xAOD::CTPResult_v1::tapWords
const std::vector< std::vector< uint32_t > > & tapWords() const
Get the TAP words for all bunch crossings.
xAOD::CTPResult_v1::numStatusWords
uint32_t numStatusWords() const
Retrieve the number of status words in the trailer.
xAOD::CTPResult_v1::numDataWords
uint32_t numDataWords() const
Retrieve the number of data words.
xAOD::CTPResult_v1::runNumber
uint32_t runNumber() const
Retrieve the run number.
xAOD::CTPResult_v1::tipWords
const std::vector< std::vector< uint32_t > > & tipWords() const
Get the TIP words for all bunch crossings.
xAOD::CTPResult_v1::tavWords
const std::vector< std::vector< uint32_t > > & tavWords() const
Get the TAV words for all bunch crossings.
xAOD::CTPResult_v1::tbpWords
const std::vector< std::vector< uint32_t > > & tbpWords() const
Get the TBP words for all bunch crossings.
xAOD::CTPResult_v1::headerSize
uint32_t headerSize() const
Retrieve the number of words in the header.
xAOD::CTPResult_v1::numberOfBunches
uint32_t numberOfBunches() const
Get the number of bunch crossings.
xAOD::CTPResult_v1::setTAVWords
void setTAVWords(const std::vector< std::vector< uint32_t > > &words)
Set the TAV words for all bunch crossings.
xAOD::CTPResult_v1::triggerType
uint32_t triggerType() const
Retrieve the LVL1 trigger type.
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xAOD::CTPResult_v1::headerMarker
uint32_t headerMarker() const
Retrieve the header marker word.
CTPResultUtils::dumpData
void dumpData(xAOD::CTPResult &ctpRes, MsgStream &log)
Print object content to given message stream.
Definition: CTPResultUtils.cxx:103
xAOD::CTPResult_v1::infoStatus
uint32_t infoStatus() const
Retrieve the info status word.
xAOD::CTPResult_v1::getBC
const CTPResult_v1::CTPBunchCrossing getBC(const int bunch=-1) const
Get the CTPBunchCrossing object for a specific bunch in the readout window.
Definition: CTPResult_v1.cxx:94
xAOD::CTPResult_v1::additionalWords
const std::vector< uint32_t > & additionalWords() const
Get the additional data words.
xAOD::CTPResult_v1::timeNanoSec
uint32_t timeNanoSec() const
Get the time in nanoseconds.
xAOD::CTPResult_v1::setCtpVersionNumber
void setCtpVersionNumber(const uint32_t ctpNumber)
Set the CTP version number.
xAOD::CTPResult_v1::timeSec
uint32_t timeSec() const
Get the time in seconds.
xAOD::CTPResult_v1::setNumberOfBunches
void setNumberOfBunches(const uint32_t nBCs)
Set the number of bunch crossings.
Definition: CTPResult_v1.cxx:110