Commit c3bfae3e authored by CLICdp user's avatar CLICdp user
Browse files

first addition of buffers for sorting data


Former-commit-id: 9d4d9795768993fc89fdda717a31fc1be6396e84
parent 0fcece18
......@@ -258,17 +258,19 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
if(header2 == 0x4){
// The data is shifted 16 bits to the right, then 12 to the left in order to match the timestamp format (net 4 right)
m_syncTime[detectorID] = (m_syncTime[detectorID] & 0xFFFFF00000000000) + ((pixdata & 0x0000FFFFFFFF0000) >> 4);
// if(detectorID == "W0019_F07") tcout<<"Updating heartbeat part 1. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<endl;
}
// 0x5 is the most significant part of the timestamp
if(header2 == 0x5){
// The data is shifted 16 bits to the right, then 44 to the left in order to match the timestamp format (net 28 left)
m_syncTime[detectorID] = (m_syncTime[detectorID] & 0x00000FFFFFFFFFFF) + ((pixdata & 0x00000000FFFF0000) << 28);
// if(detectorID == "W0019_F07") tcout<<"Updating heartbeat part 2. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<endl;
// if( m_syncTime[detectorID] < 0x0000010000000000 && !m_clearedHeader[detectorID]) m_clearedHeader[detectorID] = true;
if(!m_clearedHeader[detectorID] && (double)m_syncTime[detectorID]/(4096. * 40000000.) < 6.) m_clearedHeader[detectorID] = true;
if(!m_clearedHeader[detectorID] && (double)m_syncTime[detectorID]/(4096. * 40000000.) < 2.5) m_clearedHeader[detectorID] = true;
}
// if(detectorID == "W0019_F07") tcout<<"Updating heartbeat. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<endl;
//tcout<<"Updating heartbeat. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<" for detector "<<detectorID<<endl;
// tcout<<"Updating heartbeat. Now syncTime = "<<(double)m_syncTime[detectorID]/(4096. * 40000000.)<<" for detector "<<detectorID<<endl;
}
if(!m_clearedHeader[detectorID]) continue;
......@@ -294,9 +296,9 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// Ignore packets if they arrive before the current event window
if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
continue;
}
// if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
// continue;
// }
// Stop looking at data if the signal is after the current event window (and rewind the file
......@@ -407,9 +409,9 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// If events are loaded based on time intervals, take all hits where the time is within this window
// Ignore pixels if they arrive before the current event window
if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
continue;
}
// if( parameters->eventLength != 0. && ((double)time/(4096. * 40000000.)) < (parameters->currentTime) ){
// continue;
// }
// Stop looking at data if the pixel is after the current event window (and rewind the file
// reader so that we start with this pixel next event)
......@@ -423,6 +425,7 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
// Otherwise create a new pixel object
Pixel* pixel = new Pixel(detectorID,row,col,(int)tot,time);
devicedata->push_back(pixel);
// bufferedData[detectorID]->push_back(pixel);
npixels++;
m_prevTime = time;
......@@ -436,6 +439,9 @@ bool Timepix3EventLoader::loadData(string detectorID, Pixels* devicedata, SpidrS
}
// Now we have data buffered into the temporary storage. We will sort this by time, and then load
// the data from one event onto it.
debug = false;
// If no data was loaded, return false
......
......@@ -36,6 +36,9 @@ public:
double m_timingCut;
long long int m_prevTime;
bool m_shutterOpen;
map<string, Pixels*> bufferedData;
map<string, SpidrSignals*> bufferedSignals;
};
......
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