Commit aa12af89 authored by Tomas Vanat's avatar Tomas Vanat
Browse files

fixed eventloader for ATLASPix: will not fail if T0 is the first event in the data file

parent dfd6ef56
......@@ -39,6 +39,8 @@ void EventLoaderATLASpix::initialise() {
uint32_t datain;
m_detectorBusy = false;
// File structure is RunX/ATLASpix/data.dat
// Assume that the ATLASpix is the DUT (if running this algorithm
......@@ -84,9 +86,11 @@ void EventLoaderATLASpix::initialise() {
LOG(STATUS) << "Found T0 event at position " << m_file.tellg() << ". Skipping all data before this event.";
oldpos = m_file.tellg();
unsigned long ts3 = datain & 0x00FFFFFF;
std::streampos tmppos = static_cast<int>(oldpos) - 8;
m_file.seekg(tmppos);
while(static_cast<int>(m_file.tellg()) > 0) {
old_fpga_ts = (static_cast<unsigned long long>(ts3));
int checkpos = static_cast<int>(oldpos) - 8;
while(checkpos > 0) {
std::streampos tmppos = checkpos;
m_file.seekg(tmppos);
m_file.read(reinterpret_cast<char*>(&datain), 4);
unsigned int message_type = (datain >> 24);
// TS2
......
......@@ -73,6 +73,7 @@ namespace corryvreckan {
std::string m_calibrationFile;
double m_startTime;
bool m_toaMode;
bool m_detectorBusy;
bool m_legacyFormat;
double m_clockCycle;
// int m_clkdivendM;
......
Markdown is supported
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