|
|
#include <L1GTEvmDigiToRaw.h>
|
void | packFDL (const edm::EventSetup &, unsigned char *, L1GtFdlWord &) |
| pack FDL blocks for various bunch crosses More...
|
|
void | packGTFE (const edm::EventSetup &, unsigned char *, L1GtfeExtWord &, cms_uint16_t activeBoardsGtValue) |
|
void | packHeader (unsigned char *, edm::Event &) |
| block packers ----------— More...
|
|
void | packTCS (const edm::EventSetup &evSetup, unsigned char *ptrGt, L1TcsWord &tcsBlock) |
| pack the TCS block More...
|
|
void | packTrailer (unsigned char *, unsigned char *, int) |
| pack trailer word More...
|
|
void | produce (edm::Event &, const edm::EventSetup &) override |
| loop over events More...
|
|
Description: generate raw data from digis.
Implementation: <TODO: enter implementation details>
- Author
- : Vasile Mihai Ghete - HEPHY Vienna
Definition at line 45 of file L1GTEvmDigiToRaw.h.
◆ L1GTEvmDigiToRaw()
◆ packFDL()
pack FDL blocks for various bunch crosses
Definition at line 520 of file L1GTEvmDigiToRaw.cc.
522 LogDebug(
"L1GTEvmDigiToRaw") <<
"\nPacking FDL \n" << std::endl;
528 int nrWord64 = fdlBlock.
getSize() / uLength;
529 std::vector<cms_uint64_t> tmpWord64;
530 tmpWord64.resize(nrWord64);
532 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
533 tmpWord64[iWord] = 0x0000000000000000ULL;
537 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
563 cms_uint64_t* pw = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(ptrGt));
565 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
566 *pw++ = tmpWord64[iWord];
569 LogTrace(
"L1GTEvmDigiToRaw") << std::setw(4) << iWord <<
" " << std::hex << std::setfill(
'0') << std::setw(16)
570 << tmpWord64[iWord] <<
std::dec << std::setfill(
' ') << std::endl;
References TauDecayModes::dec, L1GtFdlWord::getSize(), LogDebug, LogTrace, m_isDebugEnabled, m_verbosity, L1GtFdlWord::setBoardIdWord64(), L1GtFdlWord::setBxInEventWord64(), L1GtFdlWord::setBxNrWord64(), L1GtFdlWord::setEventNrWord64(), L1GtFdlWord::setFinalORWord64(), L1GtFdlWord::setGtDecisionWordAWord64(), L1GtFdlWord::setGtDecisionWordBWord64(), L1GtFdlWord::setGtDecisionWordExtendedWord64(), L1GtFdlWord::setGtPrescaleFactorIndexAlgoWord64(), L1GtFdlWord::setGtPrescaleFactorIndexTechWord64(), L1GtFdlWord::setGtTechnicalTriggerWordWord64(), L1GtFdlWord::setLocalBxNrWord64(), L1GtFdlWord::setLumiSegmentNrWord64(), L1GtFdlWord::setNoAlgoWord64(), L1GtFdlWord::setOrbitNrWord64(), L1GtFdlWord::setPhysicsDeclaredWord64(), and L1GlobalTriggerReadoutSetup::UnitLength.
Referenced by produce().
◆ packGTFE()
pack the GTFE block gives the number of bunch crosses in the event, as well as the active boards records for inactive boards are not written in the GT EVM record
Definition at line 421 of file L1GTEvmDigiToRaw.cc.
426 LogDebug(
"L1GTEvmDigiToRaw") <<
"\nPacking GTFE \n" << std::endl;
432 int nrWord64 = gtfeBlock.
getSize() / uLength;
433 std::vector<cms_uint64_t> tmpWord64;
434 tmpWord64.resize(nrWord64);
436 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
437 tmpWord64[iWord] = 0x0000000000000000ULL;
441 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
458 cms_uint64_t* pw = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(ptrGt));
460 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
461 *pw++ = tmpWord64[iWord];
464 LogTrace(
"L1GTEvmDigiToRaw") << std::setw(4) << iWord <<
" " << std::hex << std::setfill(
'0') << std::setw(16)
465 << tmpWord64[iWord] <<
std::dec << std::setfill(
' ') << std::endl;
References TauDecayModes::dec, L1GtfeExtWord::getSize(), LogDebug, LogTrace, m_bstLengthBytes, m_isDebugEnabled, m_verbosity, L1GtfeWord::setActiveBoardsWord64(), L1GtfeWord::setAltNrBxBoardWord64(), L1GtfeWord::setBoardIdWord64(), L1GtfeExtWord::setBstWord64(), L1GtfeWord::setBxNrWord64(), L1GtfeWord::setRecordLength1Word64(), L1GtfeWord::setRecordLengthWord64(), L1GtfeWord::setSetupVersionWord64(), L1GtfeWord::setTotalTriggerNrWord64(), and L1GlobalTriggerReadoutSetup::UnitLength.
Referenced by produce().
◆ packHeader()
void L1GTEvmDigiToRaw::packHeader |
( |
unsigned char * |
ptrGt, |
|
|
edm::Event & |
iEvent |
|
) |
| |
|
private |
block packers ----------—
pack header
Definition at line 380 of file L1GTEvmDigiToRaw.cc.
384 int triggerTypeVal = 0;
387 int lvl1IdVal =
iEvent.id().event();
390 int bxCross =
iEvent.bunchCrossing();
392 if ((bxCross & 0xFFF) == bxCross) {
393 bxCrossHw = static_cast<cms_uint16_t>(bxCross);
397 LogDebug(
"L1GTEvmDigiToRaw") <<
"\nBunch cross number [hex] = " << std::hex << bxCross
398 <<
"\n larger than 12 bits. Set to 0! \n"
402 int bxIdVal = bxCrossHw;
413 bool moreHeadersVal =
false;
417 gtFEDHeader.set(ptrGt, triggerTypeVal, lvl1IdVal, bxIdVal, sourceIdVal, versionVal, moreHeadersVal);
References TauDecayModes::dec, iEvent, LogDebug, m_evmGtFedId, m_isDebugEnabled, m_verbosity, and FEDHeader::set().
Referenced by produce().
◆ packTCS()
pack the TCS block
Definition at line 471 of file L1GTEvmDigiToRaw.cc.
473 LogDebug(
"L1GTEvmDigiToRaw") <<
"\nPacking TCS \n" << std::endl;
479 int nrWord64 = tcsBlock.
getSize() / uLength;
480 std::vector<cms_uint64_t> tmpWord64;
481 tmpWord64.resize(nrWord64);
483 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
484 tmpWord64[iWord] = 0x0000000000000000ULL;
488 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
507 cms_uint64_t* pw = reinterpret_cast<cms_uint64_t*>(const_cast<unsigned char*>(ptrGt));
509 for (
int iWord = 0; iWord < nrWord64; ++iWord) {
510 *pw++ = tmpWord64[iWord];
513 LogTrace(
"L1GTEvmDigiToRaw") << std::setw(4) << iWord <<
" " << std::hex << std::setfill(
'0') << std::setw(16)
514 << tmpWord64[iWord] <<
std::dec << std::setfill(
' ') << std::endl;
References TauDecayModes::dec, L1TcsWord::getSize(), LogDebug, LogTrace, m_isDebugEnabled, m_verbosity, L1TcsWord::setAssignedPartitionsWord64(), L1TcsWord::setBoardIdWord64(), L1TcsWord::setBxNrWord64(), L1TcsWord::setDaqNrWord64(), L1TcsWord::setEventNrWord64(), L1TcsWord::setLuminositySegmentNrWord64(), L1TcsWord::setOrbitNrWord64(), L1TcsWord::setPartRunNrWord64(), L1TcsWord::setPartTrigNrWord64(), L1TcsWord::setStatusWord64(), L1TcsWord::setTriggerTypeWord64(), and L1GlobalTriggerReadoutSetup::UnitLength.
Referenced by produce().
◆ packTrailer()
void L1GTEvmDigiToRaw::packTrailer |
( |
unsigned char * |
ptrGt, |
|
|
unsigned char * |
ptrGtBegin, |
|
|
int |
dataSize |
|
) |
| |
|
private |
pack trailer word
Definition at line 576 of file L1GTEvmDigiToRaw.cc.
580 int lengthVal = dataSize / 8;
586 int evtStatusVal = 0;
594 bool moreTrailersVal =
false;
597 gtFEDTrailer.set(ptrGt, lengthVal, crcVal, evtStatusVal, ttsBitsVal, moreTrailersVal);
References evf::compute_crc(), and FEDTrailer::set().
Referenced by produce().
◆ produce()
loop over events
Definition at line 79 of file L1GTEvmDigiToRaw.cc.
91 const std::vector<L1GtBoard> boardMaps = l1GtBM->
gtBoardMaps();
92 int boardMapsSize = boardMaps.size();
94 typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
99 std::vector<L1GtBoard> gtRecordMap;
100 gtRecordMap.reserve(boardMapsSize);
102 for (
int iPos = 0; iPos < boardMapsSize; ++iPos) {
103 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
104 if (itBoard->gtPositionEvmRecord() == iPos) {
105 gtRecordMap.push_back(*itBoard);
115 if (!gtReadoutRecord.
isValid()) {
116 edm::LogWarning(
"L1GTEvmDigiToRaw") <<
"\nWarning: L1GlobalTriggerEvmReadoutRecord with input tag "
118 <<
"\nrequested in configuration, but not found in the event."
119 <<
"\nQuit packing this event" << std::endl;
128 std::ostringstream myCoutStream;
129 gtReadoutRecord->
print(myCoutStream);
130 LogTrace(
"L1GTEvmDigiToRaw") <<
"\n The following L1 GT EVM readout record will be packed.\n"
131 <<
" Some boards could be disabled before packing,"
132 <<
" see detailed board packing.\n"
133 << myCoutStream.str() <<
"\n"
159 LogDebug(
"L1GTEvmDigiToRaw") <<
"\nActive boards before masking(hex format): " << std::hex
160 << std::setw(
sizeof(activeBoardsGtInitial) * 2) << std::setfill(
'0')
161 << activeBoardsGtInitial <<
std::dec << std::setfill(
' ')
162 <<
"\nActive boards after masking(hex format): " << std::hex
163 << std::setw(
sizeof(activeBoardsGt) * 2) << std::setfill(
'0') << activeBoardsGt
164 <<
std::dec << std::setfill(
' ') <<
" \n"
170 unsigned int gtDataSize = 0;
172 unsigned int headerSize = 8;
173 gtDataSize += headerSize;
175 for (CItBoardMaps itBoard = boardMaps.begin(); itBoard != boardMaps.end(); ++itBoard) {
176 if (itBoard->gtBoardType() ==
GTFE) {
177 gtDataSize += gtfeBlock.
getSize();
181 int iActiveBit = itBoard->gtBitEvmActiveBoards();
182 bool activeBoardToPack =
false;
184 int altNrBxBoardVal = -1;
186 if (iActiveBit >= 0) {
187 activeBoardToPack = activeBoardsGt & (1 << iActiveBit);
189 altNrBxBoardVal = (altNrBxBoardInitial & (1 << iActiveBit)) >> iActiveBit;
191 if (altNrBxBoardVal == 1) {
193 }
else if (altNrBxBoardVal == 0) {
198 <<
"\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal <<
" for board " << std::hex
199 << (itBoard->gtBoardId()) <<
std::dec <<
"\n iActiveBit = " << iActiveBit
200 <<
"\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial <<
std::dec
201 <<
"\n activeBoardsGt = 0x" << std::hex << activeBoardsGt <<
std::dec
202 <<
"\n activeBoardToPack = " << activeBoardToPack <<
"\n Set altNrBxBoardVal tentatively to "
203 << recordLength0 <<
"\n Job may crash or produce wrong results!\n\n"
214 if (activeBoardToPack) {
215 switch (itBoard->gtBoardType()) {
229 gtDataSize += tcsBlock.
getSize();
247 unsigned int trailerSize = 8;
248 gtDataSize += trailerSize;
252 gtRawData.
resize(gtDataSize);
256 unsigned char* ptrGt = gtRawData.
data();
257 unsigned char* ptrGtBegin = gtRawData.
data();
260 LogDebug(
"L1GTEvmDigiToRaw") <<
"\n Size of raw data: " << gtRawData.
size() <<
"\n" << std::endl;
271 for (CItBoardMaps itBoard = gtRecordMap.begin(); itBoard != gtRecordMap.end(); ++itBoard) {
272 if (itBoard->gtBoardType() ==
GTFE) {
273 packGTFE(evSetup, ptrGt, gtfeBlock, activeBoardsGt);
276 std::ostringstream myCoutStream;
277 gtfeBlock.
print(myCoutStream);
278 LogTrace(
"L1GTEvmDigiToRaw") << myCoutStream.str() <<
"\n" << std::endl;
288 int iActiveBit = itBoard->gtBitEvmActiveBoards();
289 bool activeBoardToPack =
false;
291 int altNrBxBoardVal = -1;
293 if (iActiveBit >= 0) {
294 activeBoardToPack = activeBoardsGt & (1 << iActiveBit);
296 altNrBxBoardVal = (altNrBxBoardInitial & (1 << iActiveBit)) >> iActiveBit;
298 if (altNrBxBoardVal == 1) {
300 }
else if (altNrBxBoardVal == 0) {
305 <<
"\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal <<
" for board " << std::hex
306 << (itBoard->gtBoardId()) <<
std::dec <<
"\n iActiveBit = " << iActiveBit
307 <<
"\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial <<
std::dec
308 <<
"\n activeBoardsGt = 0x" << std::hex << activeBoardsGt <<
std::dec
309 <<
"\n activeBoardToPack = " << activeBoardToPack <<
"\n Set altNrBxBoardVal tentatively to "
310 << recordLength0 <<
"\n Job may crash or produce wrong results!\n\n"
325 if (activeBoardToPack) {
327 LogDebug(
"L1GTEvmDigiToRaw") <<
"\nBoard " << std::hex <<
"0x" << (itBoard->gtBoardId()) <<
std::dec
328 <<
"\n Number of bunch crosses in the record: " <<
m_totalBxInEvent <<
" = "
334 switch (itBoard->gtBoardType()) {
337 packTCS(evSetup, ptrGt, tcsBlock);
340 std::ostringstream myCoutStream;
341 tcsBlock.
print(myCoutStream);
342 LogTrace(
"L1GTEvmDigiToRaw") << myCoutStream.str() <<
"\n" << std::endl;
351 packFDL(evSetup, ptrGt, fdlBlock);
354 std::ostringstream myCoutStream;
355 fdlBlock.
print(myCoutStream);
356 LogTrace(
"L1GTEvmDigiToRaw") << myCoutStream.str() <<
"\n" << std::endl;
References L1GtfeWord::activeBoards(), L1GtfeWord::altNrBxBoard(), L1GtfeExtWord::bstLengthBytes(), FEDRawData::data(), TauDecayModes::dec, FDL, edm::EventSetup::getHandle(), L1GtfeExtWord::getSize(), L1TcsWord::getSize(), L1GtFdlWord::getSize(), L1GtBoardMaps::gtBoardMaps(), L1GlobalTriggerEvmReadoutRecord::gtFdlWord(), GTFE, L1GlobalTriggerEvmReadoutRecord::gtfeWord(), iEvent, edm::HandleBase::isValid(), LogDebug, LogTrace, m_activeBoardsMaskGt, m_bstLengthBytes, m_evmGtFedId, m_evmGtInputTag, m_evmGtInputToken, m_isDebugEnabled, m_l1GtBMToken, m_maxBxInEvent, m_minBxInEvent, m_totalBxInEvent, m_verbosity, eostools::move(), packFDL(), packGTFE(), packHeader(), packTCS(), packTrailer(), L1GlobalTriggerEvmReadoutRecord::print(), L1GtfeExtWord::print(), L1TcsWord::print(), L1GtFdlWord::print(), L1GtfeWord::recordLength(), L1GtfeWord::recordLength1(), FEDRawData::resize(), FEDRawData::size(), TCS, L1GlobalTriggerEvmReadoutRecord::tcsWord(), and TIM.
◆ m_activeBoardsMaskGt
◆ m_bstLengthBytes
int L1GTEvmDigiToRaw::m_bstLengthBytes |
|
private |
◆ m_evmGtFedId
int L1GTEvmDigiToRaw::m_evmGtFedId |
|
private |
◆ m_evmGtInputTag
◆ m_evmGtInputToken
◆ m_isDebugEnabled
const bool L1GTEvmDigiToRaw::m_isDebugEnabled |
|
private |
◆ m_l1GtBMToken
◆ m_maxBxInEvent
int L1GTEvmDigiToRaw::m_maxBxInEvent |
|
private |
max Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block assume symmetrical number of BX around L1Accept
Definition at line 97 of file L1GTEvmDigiToRaw.h.
Referenced by produce().
◆ m_minBxInEvent
int L1GTEvmDigiToRaw::m_minBxInEvent |
|
private |
min Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block assume symmetrical number of BX around L1Accept
Definition at line 93 of file L1GTEvmDigiToRaw.h.
Referenced by produce().
◆ m_totalBxInEvent
int L1GTEvmDigiToRaw::m_totalBxInEvent |
|
private |
◆ m_verbosity
const int L1GTEvmDigiToRaw::m_verbosity |
|
private |
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
void setNoAlgoWord64(cms_uint64_t &word64, const int iWord)
static const int UnitLength
one unit in the word is UnitLength bits
void setStatusWord64(cms_uint64_t &word64, int iWord)
void setLuminositySegmentNrWord64(cms_uint64_t &word64, int iWord)
const bool m_isDebugEnabled
void setEventNrWord64(cms_uint64_t &word64, int iWord)
void print(std::ostream &myCout) const
pretty print the content of a L1TcsWord
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
void setGtDecisionWordBWord64(cms_uint64_t &word64, const int iWord)
const int m_verbosity
verbosity level
void setBstWord64(cms_uint64_t &word64, int iB, const int iWord)
T getUntrackedParameter(std::string const &, T const &) const
int m_totalBxInEvent
total Bx's in the event, obtained from GTFE block
void setOrbitNrWord64(cms_uint64_t &word64, int iWord)
void setOrbitNrWord64(cms_uint64_t &word64, const int iWord)
Log< level::Warning, false > LogWarning
void setBoardIdWord64(cms_uint64_t &word64, const int iWord)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void setLumiSegmentNrWord64(cms_uint64_t &word64, const int iWord)
void setTriggerTypeWord64(cms_uint64_t &word64, int iWord)
void setRecordLengthWord64(cms_uint64_t &word64, int iWord)
void setAltNrBxBoardWord64(cms_uint64_t &word64, int iWord)
const cms_uint16_t recordLength() const
get/set record length for alternative 0
void setPartTrigNrWord64(cms_uint64_t &word64, int iWord)
void setRecordLength1Word64(cms_uint64_t &word64, int iWord)
void setGtPrescaleFactorIndexTechWord64(cms_uint64_t &word64, const int iWord)
void setGtTechnicalTriggerWordWord64(cms_uint64_t &word64, const int iWord)
void packTrailer(unsigned char *, unsigned char *, int)
pack trailer word
void setSetupVersionWord64(cms_uint64_t &word64, int iWord)
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
void setPhysicsDeclaredWord64(cms_uint64_t &word64, const int iWord)
const L1GtFdlWord gtFdlWord(int bxInEvent) const
get / set FDL word (record) in the GT readout record
const unsigned int getSize() const
get the size of the TCS block in GT EVM record (in multiple of 8 bits)
void setAssignedPartitionsWord64(cms_uint64_t &word64, int iWord)
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
void setBxInEventWord64(cms_uint64_t &word64, const int iWord)
void setTotalTriggerNrWord64(cms_uint64_t &word64, int iWord)
void setEventNrWord64(cms_uint64_t &word64, const int iWord)
void packHeader(unsigned char *, edm::Event &)
block packers ----------—
void setDaqNrWord64(cms_uint64_t &word64, int iWord)
void setBxNrWord64(cms_uint64_t &word64, const int iWord)
void print(std::ostream &myCout) const override
pretty print the content of a L1GtfeExtWord
const edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_evmGtInputToken
input tag for GT EVM record
void setActiveBoardsWord64(cms_uint64_t &word64, int iWord)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const edm::InputTag m_evmGtInputTag
unsigned long long cms_uint64_t
unsigned short cms_uint16_t
const edm::ESGetToken< L1GtBoardMaps, L1GtBoardMapsRcd > m_l1GtBMToken
EventSetup Token for L1GtBoardMaps.
int m_bstLengthBytes
length of BST record (in bytes)
size_t size() const
Lenght of the data buffer in bytes.
void setGtDecisionWordExtendedWord64(cms_uint64_t &word64, const int iWord)
void packGTFE(const edm::EventSetup &, unsigned char *, L1GtfeExtWord &, cms_uint16_t activeBoardsGtValue)
void setLocalBxNrWord64(cms_uint64_t &word64, const int iWord)
void setGtDecisionWordAWord64(cms_uint64_t &word64, const int iWord)
const unsigned int bstLengthBytes() const
get the size of the BST block
const cms_uint16_t recordLength1() const
get/set record length for alternative 1
const L1TcsWord tcsWord() const
get / set TCS word (record) in the GT readout record
const unsigned int getSize() const
get the size of the GTFE block in GT EVM record (in multiple of 8 bits)
void setBxNrWord64(cms_uint64_t &word64, int iWord)
const unsigned int getSize() const
get the size of the FDL block in GT DAQ record (in multiple of 8 bits)
void resize(size_t newsize)
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
void setBxNrWord64(cms_uint64_t &word64, int iWord)
T getParameter(std::string const &) const
const std::vector< L1GtBoard > & gtBoardMaps() const
get / set / print the L1 GT board map
void setPartRunNrWord64(cms_uint64_t &word64, int iWord)
void packFDL(const edm::EventSetup &, unsigned char *, L1GtFdlWord &)
pack FDL blocks for various bunch crosses
const cms_uint16_t altNrBxBoard() const
get/set alternative for number of BX per board
void setFinalORWord64(cms_uint64_t &word64, const int iWord)
void setGtPrescaleFactorIndexAlgoWord64(cms_uint64_t &word64, const int iWord)
cms_uint16_t m_activeBoardsMaskGt
mask for active boards
void packTCS(const edm::EventSetup &evSetup, unsigned char *ptrGt, L1TcsWord &tcsBlock)
pack the TCS block
void print(std::ostream &myCout) const
pretty print the content of a L1GlobalTriggerEvmReadoutRecord