82 auto producedRPCDigis = std::make_unique<RPCDigiCollection>();
83 auto producedRawDataCounts = std::make_unique<RPCRawDataCounts>();
84 std::unique_ptr<RPCRawSynchro::ProdItem> producedRawSynchoCounts;
86 producedRawSynchoCounts = std::make_unique<RPCRawSynchro::ProdItem>();
103 bool moreHeaders =
true;
104 while (moreHeaders) {
107 if (!fedHeader.check()) {
108 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::HeaderCheckFail));
110 LogTrace(
"") <<
" ** PROBLEM **, header.check() failed, break";
113 if (fedHeader.sourceID() !=
fedId) {
114 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::InconsitentFedId));
116 LogTrace(
"") <<
" ** PROBLEM **, fedHeader.sourceID() != fedId"
117 <<
"fedId = " <<
fedId <<
" sourceID=" << fedHeader.sourceID();
119 triggerBX = fedHeader.bxID();
120 moreHeaders = fedHeader.moreHeaders();
123 str <<
" header: " << *
reinterpret_cast<const bitset<64>*
>(
header) << endl;
124 str <<
" header triggerType: " << fedHeader.triggerType() << endl;
125 str <<
" header lvl1ID: " << fedHeader.lvl1ID() << endl;
126 str <<
" header bxID: " << fedHeader.bxID() << endl;
127 str <<
" header sourceID: " << fedHeader.sourceID() << endl;
128 str <<
" header version: " << fedHeader.version() << endl;
136 const Word64* trailer = reinterpret_cast<const Word64*>(
rawData.data()) + (nWords - 1);
138 bool moreTrailers =
true;
139 while (moreTrailers) {
141 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
142 if (!fedTrailer.check()) {
143 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::TrailerCheckFail));
145 LogTrace(
"") <<
" ** PROBLEM **, trailer.check() failed, break";
148 if (fedTrailer.fragmentLength() != nWords) {
149 producedRawDataCounts->addReadoutError(
fedId,
ReadoutError(ReadoutError::InconsistentDataSize));
151 LogTrace(
"") <<
" ** PROBLEM **, fedTrailer.fragmentLength()!= nWords, break";
154 moreTrailers = fedTrailer.moreTrailers();
157 str <<
" trailer: " << *
reinterpret_cast<const bitset<64>*
>(trailer) << endl;
158 str <<
" trailer lenght: " << fedTrailer.fragmentLength() << endl;
159 str <<
" trailer crc: " << fedTrailer.crc() << endl;
160 str <<
" trailer evtStatus: " << fedTrailer.evtStatus() << endl;
161 str <<
" trailer ttsBits: " << fedTrailer.ttsBits() << endl;
172 str <<
" data: " << *
reinterpret_cast<const bitset<64>*
>(
word) << endl;
180 for (
int iRecord = 1; iRecord <= 4; iRecord++) {
181 const DataRecord::Data* pRecord = reinterpret_cast<const DataRecord::Data*>(
word + 1) - iRecord;
185 std::ostringstream
str;
186 str <<
"record: " <<
record.print() <<
" hex: " << hex << *pRecord <<
dec;
188 if (
event.complete()) {
189 str <<
" --> dccId: " <<
fedId <<
" rmb: " <<
event.recordSLD().rmb()
190 <<
" lnk: " <<
event.recordSLD().tbLinkInputNumber() <<
" lb: " <<
event.recordCD().lbInLink()
191 <<
" part: " <<
event.recordCD().partitionNumber() <<
" data: " <<
event.recordCD().partitionData()
192 <<
" eod: " <<
event.recordCD().eod();
196 producedRawDataCounts->addDccRecord(
fedId,
record);
198 if (
event.complete())
200 event, producedRPCDigis.get(), producedRawDataCounts.get(), producedRawSynchoCounts.get());
207 LogTrace(
"") <<
" RPCUnpackingModule - There was unpacking PROBLEM in this event" << endl;