Skip to content

EventLoaderEUDAQ2: time sorting

This MR adds optional timesorting to the EventLoaderEUDAQ2.

It can be configured as follows:

  • do_timesorting: false --> everything as before, true --> fill buffer with buffer_depth and return earliest StandardEvent
  • buffer_depth: depth of buffer in which StandardEvents are timesorted. If 0, no timesorting will be done but everything works as before.

First attempt:

As a first attempt, it's implemented as a std::vector<"Standard Event"> which is filled until its size is buffer_depth and then timesorted using std::sort. This was a very compact and easy-to-read implementation, however it might not be the most efficient one - as discussed in length on Thursday last week.

Current solution:

Now a much faster implementation is making use of std::priority_queue into which new elements are inserted directly into the right spot and only the first element can be popped.

This solves the issue with saw with the Timepix3, e.g. in run 866, where a small mix-up in the chronological order, i.e. 1 late event screws up the event building because until we get to that late event, no hits will be filled into any Corryvreckan event and after that event all the earlier events will be rejected because their position is BEFORE.

Experimental try which didn't work:

The solution using a std:priority_queue was also tested for the buffer holding sub-events and sorting them anti-alphabetically. We tested that with a toy model and also in real life corry, and it seems like std::priority_queue is mixing up the order of elements if the comparison criterion is equal which std::sort doesn't do.

Edited by Jens Kroeger

Merge request reports