Commit 25b4d8bb authored by Mauro Dinardo's avatar Mauro Dinardo
Browse files

Added debugging features

parent 3458db7e
......@@ -518,7 +518,7 @@ void SystemController::DecodeData(const BeBoard* pBoard, const std::vector<uint3
fEventList.clear();
if(RD53FWInterface::decodedEvents.size() == 0) RD53FWInterface::DecodeEventsMultiThreads(pData, RD53FWInterface::decodedEvents);
RD53FWInterface::Event::addBoardInfo2Events(pBoard, RD53FWInterface::decodedEvents);
for(auto i = 0u; i < RD53FWInterface::decodedEvents.size(); i++) fEventList.push_back(&RD53FWInterface::decodedEvents[i]);
for(auto& evt: RD53FWInterface::decodedEvents) fEventList.push_back(&evt);
}
else if(pType == BoardType::D19C)
{
......
......@@ -66,7 +66,8 @@ void interruptHandler(int handler)
void readBinaryData(const std::string& binaryFile, SystemController& mySysCntr, std::vector<RD53FWInterface::Event>& decodedEvents)
{
unsigned int errors = 0;
const unsigned int wordDataSize = 32;
unsigned int errors = 0;
std::vector<uint32_t> data;
LOG(INFO) << BOLDMAGENTA << "@@@ Decoding binary data file @@@" << RESET;
......@@ -82,9 +83,12 @@ void readBinaryData(const std::string& binaryFile, SystemController& mySysCntr,
{
LOG(ERROR) << BOLDBLUE << "\t--> Corrupted event n. " << BOLDYELLOW << i << RESET;
errors++;
RD53FWInterface::PrintEvents({decodedEvents[i]});
}
LOG(INFO) << GREEN << "Percentage of corrupted events: " << BOLDYELLOW << std::setprecision(3) << BOLDYELLOW << 1. * errors / decodedEvents.size() * 100. << "%" << std::setprecision(-1) << RESET;
int avgEventSize = data.size() / decodedEvents.size();
LOG(INFO) << GREEN << "Average event size is " << BOLDYELLOW << avgEventSize * wordDataSize << RESET << GREEN << " bits over " << BOLDYELLOW << decodedEvents.size() << RESET << GREEN << " events" << RESET;
mySysCntr.closeFileHandler();
}
......@@ -528,15 +532,16 @@ int main(int argc, char** argv)
std::string fileName("Run" + RD53Shared::fromInt2Str(runNumber) + "_Physics");
Physics ph;
ph.Inherit(&mySysCntr);
ph.localConfigure(fileName, -1);
if(binaryFile == "")
{
ph.localConfigure(fileName, -1);
ph.Start(runNumber);
usleep(ARBITRARYDELAY);
ph.Stop();
}
else
{
ph.localConfigure(fileName, runNumber);
ph.analyze(true);
ph.draw();
}
......
......@@ -46,7 +46,8 @@ using namespace Ph2_HwInterface;
void readBinaryData(const std::string& binaryFile, SystemController& mySysCntr, std::vector<RD53FWInterface::Event>& decodedEvents)
{
unsigned int errors = 0;
const unsigned int wordDataSize = 32;
unsigned int errors = 0;
std::vector<uint32_t> data;
LOG(INFO) << BOLDMAGENTA << "@@@ Decoding binary data file @@@" << RESET;
......@@ -62,9 +63,12 @@ void readBinaryData(const std::string& binaryFile, SystemController& mySysCntr,
{
LOG(ERROR) << BOLDBLUE << "\t--> Corrupted event n. " << BOLDYELLOW << i << RESET;
errors++;
RD53FWInterface::PrintEvents({decodedEvents[i]});
}
LOG(INFO) << GREEN << "Percentage of corrupted events: " << BOLDYELLOW << std::setprecision(3) << BOLDYELLOW << 1. * errors / decodedEvents.size() * 100. << "%" << std::setprecision(-1) << RESET;
int avgEventSize = data.size() / decodedEvents.size();
LOG(INFO) << GREEN << "Average event size is " << BOLDYELLOW << avgEventSize * wordDataSize << RESET << GREEN << " bits over " << BOLDYELLOW << decodedEvents.size() << RESET << GREEN << " events" << RESET;
mySysCntr.closeFileHandler();
}
......@@ -122,15 +126,16 @@ int main(int argc, char** argv)
// ###############
Physics ph;
ph.Inherit(&mySysCntr);
ph.localConfigure(fileName, -1);
if(doReadBinary == false)
{
ph.localConfigure(fileName, -1);
ph.Start(runNumber);
usleep(ARBITRARYDELAY);
ph.Stop();
}
else
{
ph.localConfigure(fileName, runNumber);
ph.analyze(true);
ph.draw();
}
......
......@@ -196,17 +196,13 @@ void Physics::analyze(bool doReadBinary)
else
{
dataSize = 1;
std::vector<uint32_t> data;
SystemController::DecodeData(cBoard, data, dataSize, cBoard->getBoardType());
SystemController::DecodeData(cBoard, {}, 0, cBoard->getBoardType());
}
if(dataSize != 0)
{
Physics::fillDataContainer(cBoard);
Physics::sendBoardData(cBoard);
double avgEventSize = static_cast<double>(dataSize) / RD53FWInterface::decodedEvents.size();
LOG(INFO) << BOLDMAGENTA << ">>> Average event size: " << BOLDYELLOW << std::setprecision(0) << avgEventSize * 32 << std::setprecision(-1) << BOLDMAGENTA << " bits over " << BOLDYELLOW
<< RD53FWInterface::decodedEvents.size() << BOLDMAGENTA << " events <<<" << RESET;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment