Commit 8e8b13ef authored by Jens Kroeger's avatar Jens Kroeger
Browse files

EventLoaderEUDAQ2: removed parameter 'do_timesorting', timesorting can now be...

EventLoaderEUDAQ2: removed parameter 'do_timesorting', timesorting can now be disabled by setting 'buffer_depth = 0', also updated README
parent 67081fe3
......@@ -17,10 +17,8 @@ EventLoaderEUDAQ2::EventLoaderEUDAQ2(Configuration config, std::shared_ptr<Detec
m_filename = m_config.getPath("file_name", true);
m_skip_time = m_config.get("skip_time", 0.);
adjust_event_times = m_config.getMatrix<std::string>("adjust_event_times", {});
m_do_timesorting = m_config.get<bool>("do_timesorting", false);
m_buffer_depth = m_config.get<int>("buffer_depth", 10);
m_adjust_event_times = m_config.getMatrix<std::string>("adjust_event_times", {});
m_buffer_depth = m_config.get<int>("buffer_depth", 0);
// Forward all settings to EUDAQ
// WARNING: the EUDAQ Configuration class is not very flexible and e.g. booleans have to be passed as 1 and 0.
......@@ -118,7 +116,7 @@ void EventLoaderEUDAQ2::initialise() {
}
// Check if all elements of adjust_event_times have a valid size of 3, if not throw error.
for(auto& shift_times : adjust_event_times) {
for(auto& shift_times : m_adjust_event_times) {
if(shift_times.size() != 3) {
throw InvalidValueError(
m_config,
......@@ -225,8 +223,8 @@ EventLoaderEUDAQ2::EventPosition EventLoaderEUDAQ2::is_within_event(std::shared_
<< ", event_end = " << Units::display(event_end, "us");
// If adjustment of event start/end is required:
const auto it = std::find_if(adjust_event_times.begin(),
adjust_event_times.end(),
const auto it = std::find_if(m_adjust_event_times.begin(),
m_adjust_event_times.end(),
[evt](const std::vector<std::string>& x) { return x.front() == evt->GetDescription(); });
// Skip if later start is requested:
......@@ -243,7 +241,7 @@ EventLoaderEUDAQ2::EventPosition EventLoaderEUDAQ2::is_within_event(std::shared_
LOG(DEBUG) << "Defining Corryvreckan event: " << Units::display(event_start, {"us", "ns"}) << " - "
<< Units::display(event_end, {"us", "ns"}) << ", length "
<< Units::display(event_end - event_start, {"us", "ns"});
if(it != adjust_event_times.end()) {
if(it != m_adjust_event_times.end()) {
shift_start = corryvreckan::from_string<double>(it->at(1));
shift_end = corryvreckan::from_string<double>(it->at(2));
event_start += shift_start;
......@@ -350,7 +348,7 @@ StatusCode EventLoaderEUDAQ2::run(std::shared_ptr<Clipboard> clipboard) {
// Retrieve next event from file/buffer:
if(!event_) {
try {
if(!m_do_timesorting) {
if(m_buffer_depth == 0) {
// simply get next decoded EUDAQ StandardEvent from buffer
event_ = get_next_std_event();
} else {
......
......@@ -86,10 +86,7 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector;
std::string m_filename{};
double m_skip_time{};
Matrix<std::string> adjust_event_times;
// parameters for time sorting:
bool m_do_timesorting;
Matrix<std::string> m_adjust_event_times;
int m_buffer_depth;
// EUDAQ file reader instance to retrieve data from
......
......@@ -56,7 +56,7 @@ Also, more complex constructs such as arrays or matrices read by the Corryvrecka
* `skip_time`: Time that can be skipped at the start of a run. Default is `0ms`.
* `adjust_event_times`: Matrix that allows the user to shift the event start/end of all different types of EUDAQ events. The first entry of each row specifies the data type, the second is the offset which is added to the event start and the third entry is the offset added to the event end. A usage example is shown below. Default is `0ms, 0ms`, `"other"` is just a placeholder.
* `do_timesorting`: Boolean to enable timesorting of EUDAQ2 StandardEvents. This algorithm only works for StandardEvents with well-defined timestamps. Default is `false`.
* `buffer_depth`: Depth of buffer in which StandardEvents are timesorted. Default depth is 10.
* `buffer_depth`: Depth of buffer in which EUDAQ2 `StandardEvents` are timesorted. This algorithm only works for `StandardEvents` with well-defined timestamps. Setting it to `0` disables timesorting. Default is `0`.
### Plots produced
* 2D hitmap
......@@ -87,4 +87,5 @@ file_name = /path/to/data/examplerun_clicpix2.raw
type = "MIMOSA26"
file_name = /path/to/data/examplerun_telescope.raw
adjust_event_times = ["TluRawDataEvent", -115us, +230us], ["other", 0ns, 0ns]
buffer_depth = 1000
```
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