Commit 33907333 authored by Simon Spannagel's avatar Simon Spannagel
Browse files
parents 032d1d16 4347913b
Pipeline #584186 passed with stages
in 5 minutes and 21 seconds
......@@ -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
......@@ -102,8 +106,7 @@ void EventLoaderATLASpix::initialise() {
<< ts3 << ". Some timestamps at the begining might be corrupted.";
}
}
tmppos = static_cast<int>(tmppos) - 4;
m_file.seekg(tmppos);
checkpos = static_cast<int>(tmppos) - 4;
}
m_file.seekg(oldpos);
break;
......@@ -300,9 +303,15 @@ Pixels* EventLoaderATLASpix::read_caribou_data(double start_time, double end_tim
<< Units::display(start_time, {"s", "us", "ns"}) << ")";
continue;
}
// this window still contains data in the event window, do not stop processing
window_end = false;
if(m_detectorBusy && (busy_readout_ts < readout_ts)) {
LOG(WARNING) << "ATLASPix went BUSY between "
<< Units::display((m_clockCycle * static_cast<double>(busy_readout_ts)), {"s", "us", "ns"})
<< " and "
<< Units::display((m_clockCycle * static_cast<double>(readout_ts)), {"s", "us", "ns"}) << ".";
m_detectorBusy = false;
}
data_pixel_++;
// If this pixel is masked, do not save it
if(m_detector->masked(col, row)) {
......@@ -431,7 +440,8 @@ Pixels* EventLoaderATLASpix::read_caribou_data(double start_time, double end_tim
// BUSY was asserted due to FIFO_FULL + 24 LSBs of FPGA timestamp when it happened
case 0b00000010:
m_identifiers["BUSY_ASSERT"]++;
busy_readout_ts = readout_ts;
m_detectorBusy = true;
// LOG(DEBUG) << "BUSY_ASSERTED\t" << ((datain)&0xFFFFFF);
break;
......
......@@ -56,6 +56,7 @@ namespace corryvreckan {
std::streampos oldpos;
unsigned long long old_readout_ts;
unsigned long long old_fpga_ts;
unsigned long long busy_readout_ts;
// int ts1Range;
int ts2Range;
......@@ -73,6 +74,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