From 4d1de63a8b51f3a37fbdc4e80691c6c8b86f897e Mon Sep 17 00:00:00 2001 From: Sean Murray Date: Sun, 13 Mar 2022 22:57:31 +0100 Subject: [PATCH] TRD modify verbose output to debug grid --- .../include/TRDReconstruction/CruRawReader.h | 5 ++++ .../TRD/reconstruction/src/CruRawReader.cxx | 26 +++++++++---------- .../TRD/reconstruction/src/DataReaderTask.cxx | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Detectors/TRD/reconstruction/include/TRDReconstruction/CruRawReader.h b/Detectors/TRD/reconstruction/include/TRDReconstruction/CruRawReader.h index 16f6a64b4ee62..db5b1e38a8853 100644 --- a/Detectors/TRD/reconstruction/include/TRDReconstruction/CruRawReader.h +++ b/Detectors/TRD/reconstruction/include/TRDReconstruction/CruRawReader.h @@ -90,6 +90,11 @@ class CruRawReader void setDataBuffer(const char* val) { mDataBuffer = val; + if (mVerbose) { + if (val == nullptr) { + LOG(error) << "Data buffer is being assigned to a null ptr"; + } + } }; void setDataBufferSize(long val) { diff --git a/Detectors/TRD/reconstruction/src/CruRawReader.cxx b/Detectors/TRD/reconstruction/src/CruRawReader.cxx index 2bbdfdc9996fb..1c946f6bb4555 100644 --- a/Detectors/TRD/reconstruction/src/CruRawReader.cxx +++ b/Detectors/TRD/reconstruction/src/CruRawReader.cxx @@ -49,7 +49,7 @@ bool CruRawReader::skipRDH() if (o2::raw::RDHUtils::getMemorySize(mOpenRDH) == o2::raw::RDHUtils::getHeaderSize(mOpenRDH)) { //empty rdh so we want to avoid parsing it for cru data. if (mVerbose) { - LOG(info) << " skipping rdh (empty) with packetcounter of: " << std::hex << o2::raw::RDHUtils::getPacketCounter(mOpenRDH); + LOG(info) << " skipping rdh (empty) packetcount of: " << std::hex << o2::raw::RDHUtils::getPacketCounter(mOpenRDH); } return true; } else { @@ -116,7 +116,7 @@ void CruRawReader::OutputHalfCruRawData() bool CruRawReader::processHBFs(int datasizealreadyread, bool verbose) { - if (mVerbose) { + if (mHeaderVerbose) { LOG(info) << "PROCESS HBF starting at " << std::hex << (void*)mDataPointer; } mDataRDH = reinterpret_cast(mDataPointer); @@ -130,18 +130,18 @@ bool CruRawReader::processHBFs(int datasizealreadyread, bool verbose) int loopcount = 0; // loop until RDH stop header while (!o2::raw::RDHUtils::getStop(rdh)) { // carry on till the end of the event. - //o2::raw::RDHUtils::printRDH(rdh); - if (mVerbose) { + if (mHeaderVerbose) { LOG(info) << "--- RDH open/continue detected loopcount :" << loopcount; LOG(info) << " rdh first word 0x" << std::hex << (uint32_t)*mDataPointer; - for (int i = 0; i < 64; ++i) { - LOG(info) << std::hex << " 0x" << *(mDataPointer + i); - } - LOG(info) << "---------------------- parsing that rdh"; + o2::raw::RDHUtils::printRDH(rdh); } preceedingrdh = rdh; auto headerSize = o2::raw::RDHUtils::getHeaderSize(rdh); auto memorySize = o2::raw::RDHUtils::getMemorySize(rdh); + if (memorySize == 0) { + LOG(warn) << "rdh memory size is zero"; + break; // get out of here if the rdh says it has nothing. + } auto offsetToNext = o2::raw::RDHUtils::getOffsetToNext(rdh); auto rdhpayload = memorySize - headerSize; mFEEID.word = o2::raw::RDHUtils::getFEEID(rdh); //TODO change this and just carry around the curreht RDH @@ -162,10 +162,10 @@ bool CruRawReader::processHBFs(int datasizealreadyread, bool verbose) // we can still copy into this buffer. } else { if (mMaxWarnPrinted > 0) { - LOG(warn) << "next rdh exceeds the bounds of the cru payload buffer"; + LOG(warn) << "rdh bounds fail offsetToNext:" << offsetToNext << " rdh 0x" << (char*)rdh << " bufsize:" << mDataBufferSize << " payload start: 0x" << (void*)&mHBFPayload[0]; checkNoWarn(); if (mVerbose) { - LOG(info) << "rdh position is out of bounds of the buffer"; + LOG(info) << "rdh bounds fail offsetToNext:" << offsetToNext << " rdh 0x" << (char*)rdh << " bufsize:" << mDataBufferSize << " payload start: 0x" << (void*)&mHBFPayload[0]; o2::raw::RDHUtils::printRDH(rdh); } } @@ -433,11 +433,11 @@ int CruRawReader::processHalfCRU(int cruhbfstartoffset) LOG(warn) << " Endpoint mismatch : CRU Half chamber header endpoint = " << mCurrentHalfCRUHeader.EndPoint << " rdh end point = " << mCRUEndpoint; checkNoWarn(); } - //disaster dump the rest of this hbf - return 42; if (mVerbose) { LOG(info) << "******* LINK # " << currentlinkindex; } + //disaster dump the rest of this hbf + return 42; } // verify cru header vs rdh header @@ -615,7 +615,7 @@ int CruRawReader::processHalfCRU(int cruhbfstartoffset) } } mTotalDigitsFound += mDigitsParser.getDigitsFound(); - if (mVerbose) { + if (mDataVerbose) { LOG(info) << "mDigitWordsRead : " << mDigitWordsRead << " mem copy with offset of : " << cruhbfstartoffset << " parsing digits with linkstart: " << linkstart << " ending at : " << linkend << " linkhbf start pos:" << hbfoffsetatstartoflink; } mHBFoffset32 += mDigitWordsRead + mDigitWordsRejected; // all 3 in 32bit units diff --git a/Detectors/TRD/reconstruction/src/DataReaderTask.cxx b/Detectors/TRD/reconstruction/src/DataReaderTask.cxx index 6685ed2f1b87f..b6da49c23cab5 100644 --- a/Detectors/TRD/reconstruction/src/DataReaderTask.cxx +++ b/Detectors/TRD/reconstruction/src/DataReaderTask.cxx @@ -268,7 +268,7 @@ void DataReaderTask::run(ProcessingContext& pc) tfCount = dh->tfCounter; auto payloadIn = ref.payload; auto payloadInSize = DataRefUtils::getPayloadSize(ref); - if (mVerbose) { + if (mHeaderVerbose) { LOGP(info, "Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : ", dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, payloadInSize); }