Commit 3458db7e authored by Mauro Dinardo's avatar Mauro Dinardo
Browse files

Minor modifications

parent ef47869f
......@@ -182,7 +182,7 @@ void FileParser::parseBeBoard(pugi::xml_node pBeBordNode, BeBoardFWMap& pBeBoard
if(std::string(cBeBoardRegNode.name()) == "Register")
{
std::string cNameString;
uint32_t cValue;
double cValue;
this->parseRegister(cBeBoardRegNode, cNameString, cValue, cBeBoard, os);
}
}
......@@ -303,7 +303,7 @@ void FileParser::parseOpticalGroupContainer(pugi::xml_node pOpticalGroupNode, Be
}
}
void FileParser::parseRegister(pugi::xml_node pRegisterNode, std::string& pAttributeString, uint32_t& pValue, BeBoard* pBoard, std::ostream& os)
void FileParser::parseRegister(pugi::xml_node pRegisterNode, std::string& pAttributeString, double& pValue, BeBoard* pBoard, std::ostream& os)
{
if(std::string(pRegisterNode.name()) == "Register")
{
......@@ -324,7 +324,7 @@ void FileParser::parseRegister(pugi::xml_node pRegisterNode, std::string& pAttri
if(!pAttributeString.empty()) pAttributeString += ".";
pAttributeString += pRegisterNode.attribute("name").value();
pValue = convertAnyInt(pRegisterNode.first_child().value());
pValue = convertAnyDouble(pRegisterNode.first_child().value());
os << GREEN << "|\t|\t|"
<< "----" << pAttributeString << ": " << BOLDYELLOW << pValue << RESET << std::endl;
pBoard->setReg(pAttributeString, pValue);
......
......@@ -76,7 +76,7 @@ class FileParser
void parseSettingsxml(const std::string& pFilename, SettingsMap& pSettingsMap, std::ostream& os, bool pIsFile);
void parseBeBoard(pugi::xml_node pBeBordNode, BeBoardFWMap& pBeBoardFWMap, DetectorContainer* pDetectorContainer, std::ostream& os);
void parseRegister(pugi::xml_node pRegisterNode, std::string& pAttributeString, uint32_t& pValue, Ph2_HwDescription::BeBoard* pBoard, std::ostream& os);
void parseRegister(pugi::xml_node pRegisterNode, std::string& pAttributeString, double& pValue, Ph2_HwDescription::BeBoard* pBoard, std::ostream& os);
void parseSLink(pugi::xml_node pSLinkNode, Ph2_HwDescription::BeBoard* pBoard, std::ostream& os);
void parseOpticalGroupContainer(pugi::xml_node pOpticalGroupNode, Ph2_HwDescription::BeBoard* pBoard, std::ostream& os);
void parseHybridContainer(pugi::xml_node pHybridNode, Ph2_HwDescription::OpticalGroup* pOpticalGroup, std::ostream& os, Ph2_HwDescription::BeBoard* pBoard);
......
......@@ -42,6 +42,7 @@
#define SETBATCH 0 // Set batch mode when running supervisor
#define FILERUNNUMBER "./RunNumber.txt"
#define BASEDIR "PH2ACF_BASE_DIR"
#define ARBITRARYDELAY 120e6 // [us]
INITIALIZE_EASYLOGGINGPP
......@@ -260,9 +261,9 @@ int main(int argc, char** argv)
{
LOG(INFO) << BOLDBLUE << "Supervisor sending stop" << RESET;
usleep(2e6);
usleep(ARBITRARYDELAY);
theMiddlewareInterface.stop();
usleep(2e6);
usleep(ARBITRARYDELAY);
theDQMInterface.stopProcessingData();
stateMachineStatus = STOPPED;
......@@ -531,7 +532,7 @@ int main(int argc, char** argv)
if(binaryFile == "")
{
ph.Start(runNumber);
usleep(2e6);
usleep(ARBITRARYDELAY);
ph.Stop();
}
else
......
......@@ -33,6 +33,11 @@
#include "../tools/RD53eudaqProducer.h"
#endif
// ##################
// # Default values #
// ##################
#define ARBITRARYDELAY 2e6 // [us]
INITIALIZE_EASYLOGGINGPP
using namespace Ph2_System;
......@@ -44,7 +49,9 @@ void readBinaryData(const std::string& binaryFile, SystemController& mySysCntr,
unsigned int errors = 0;
std::vector<uint32_t> data;
LOG(INFO) << BOLDMAGENTA << "@@@ Decoding binary data file @@@" << RESET;
mySysCntr.addFileHandler(binaryFile, 'r');
LOG(INFO) << BOLDBLUE << "\t--> Data are being readout from binary file" << RESET;
mySysCntr.readFile(data, 0);
RD53FWInterface::DecodeEventsMultiThreads(data, decodedEvents);
......@@ -61,54 +68,6 @@ void readBinaryData(const std::string& binaryFile, SystemController& mySysCntr,
mySysCntr.closeFileHandler();
}
void decodeEvents(SystemController& mySysCntr, const std::vector<RD53FWInterface::Event>& decodedEvents)
{
const int nTRIGxEvent = mySysCntr.findValueInSettings("nTRIGxEvent");
for(auto i = 0u; i < decodedEvents.size(); i++)
{
auto& evt = decodedEvents[i];
uint64_t triggerNumber = evt.l1a_counter / nTRIGxEvent;
LOG(INFO) << BOLDGREEN << "===========================" << RESET;
LOG(INFO) << BOLDGREEN << "Trigger number = " << triggerNumber << RESET;
LOG(INFO) << BOLDGREEN << "EVENT = " << i << RESET;
LOG(INFO) << BOLDGREEN << "block_size = " << evt.block_size << RESET;
LOG(INFO) << BOLDGREEN << "tlu_trigger_id = " << evt.tlu_trigger_id << RESET;
LOG(INFO) << BOLDGREEN << "data_format_ver = " << evt.data_format_ver << RESET;
LOG(INFO) << BOLDGREEN << "tdc = " << evt.tdc << RESET;
LOG(INFO) << BOLDGREEN << "l1a_counter = " << evt.l1a_counter << RESET;
LOG(INFO) << BOLDGREEN << "bx_counter = " << evt.bx_counter << RESET;
for(auto j = 0u; j < evt.chip_events.size(); j++)
{
LOG(INFO) << CYAN << "------- Chip Header -------" << RESET;
LOG(INFO) << CYAN << "error_code = " << evt.chip_frames[j].error_code << RESET;
LOG(INFO) << CYAN << "hybrid_id = " << evt.chip_frames[j].hybrid_id << RESET;
LOG(INFO) << CYAN << "chip_lane = " << evt.chip_frames[j].chip_lane << RESET;
LOG(INFO) << CYAN << "l1a_data_size = " << evt.chip_frames[j].l1a_data_size << RESET;
LOG(INFO) << CYAN << "chip_type = " << evt.chip_frames[j].chip_type << RESET;
LOG(INFO) << CYAN << "frame_delay = " << evt.chip_frames[j].frame_delay << RESET;
LOG(INFO) << CYAN << "trigger_id = " << evt.chip_events[j].trigger_id << RESET;
LOG(INFO) << CYAN << "trigger_tag = " << evt.chip_events[j].trigger_tag << RESET;
LOG(INFO) << CYAN << "bc_id = " << evt.chip_events[j].bc_id << RESET;
LOG(INFO) << BOLDYELLOW << "--- Hit Data (" << evt.chip_events[j].hit_data.size() << " hits) ---" << RESET;
for(const auto& hit: evt.chip_events[j].hit_data)
{
uint16_t row = hit.row;
uint16_t col = hit.col;
uint8_t tot = hit.tot;
LOG(INFO) << BOLDYELLOW << "Column: " << std::setw(3) << col << std::setw(-1) << ", Row: " << std::setw(3) << row << std::setw(-1) << ", ToT: " << std::setw(3) << +tot << std::setw(-1)
<< RESET;
}
}
}
}
int main(int argc, char** argv)
{
const std::string configFile = "CMSIT.xml";
......@@ -138,7 +97,7 @@ int main(int argc, char** argv)
// # Read binary file and decode events #
// ######################################
readBinaryData(binaryFile, mySysCntr, RD53FWInterface::decodedEvents);
decodeEvents(mySysCntr, RD53FWInterface::decodedEvents);
RD53FWInterface::PrintEvents(RD53FWInterface::decodedEvents);
}
else
{
......@@ -167,7 +126,7 @@ int main(int argc, char** argv)
if(doReadBinary == false)
{
ph.Start(runNumber);
usleep(2e6);
usleep(ARBITRARYDELAY);
ph.Stop();
}
else
......
......@@ -204,6 +204,9 @@ void Physics::analyze(bool doReadBinary)
{
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