Commit 28969e46 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

EventLoaderEUDAQ2: correctly place adjustment of event times (now actually...

EventLoaderEUDAQ2: correctly place adjustment of event times (now actually does what the readme claims)
parent 9d4d7dbc
Pipeline #1090943 passed with stages
in 13 minutes and 31 seconds
......@@ -254,6 +254,17 @@ Event::Position EventLoaderEUDAQ2::is_within_event(std::shared_ptr<Clipboard> cl
m_adjust_event_times.end(),
[evt](const std::vector<std::string>& x) { return x.front() == evt->GetDescription(); });
if(it != m_adjust_event_times.end()) {
event_start += corryvreckan::from_string<double>(it->at(1));
event_end += corryvreckan::from_string<double>(it->at(2));
LOG(DEBUG) << "Adjusting " << it->at(0) << " event_start by "
<< Units::display(corryvreckan::from_string<double>(it->at(1)), {"us", "ns"}) << ", event_end by "
<< Units::display(corryvreckan::from_string<double>(it->at(2)), {"us", "ns"});
LOG(DEBUG) << "Adjusted event: " << Units::display(event_start, {"us", "ns"}) << " - "
<< Units::display(event_end, {"us", "ns"}) << ", length "
<< Units::display(event_end - event_start, {"us", "ns"});
}
// Skip if later start is requested:
if(event_start < m_skip_time) {
LOG(DEBUG) << "Event start before requested skip time: " << Units::display(event_start, {"us", "ns"}) << " < "
......@@ -261,24 +272,11 @@ Event::Position EventLoaderEUDAQ2::is_within_event(std::shared_ptr<Clipboard> cl
return Event::Position::BEFORE;
}
double shift_start = 0;
double shift_end = 0;
// Check iff an event is defined or we we need to create it:
if(!clipboard->isEventDefined()) {
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 != 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;
event_end += shift_end;
LOG(DEBUG) << "Adjusting " << it->at(0) << ": event_start by " << Units::display(shift_start, {"us", "ns"})
<< ", event_end by " << Units::display(shift_end, {"us", "ns"});
}
LOG(DEBUG) << "Shifted Corryvreckan event: " << Units::display(event_start, {"us", "ns"}) << " - "
<< Units::display(event_end, {"us", "ns"}) << ", length "
<< Units::display(event_end - event_start, {"us", "ns"});
clipboard->putEvent(std::make_shared<Event>(event_start, event_end));
} else {
LOG(DEBUG) << "Corryvreckan event found on clipboard.";
......@@ -296,9 +294,8 @@ Event::Position EventLoaderEUDAQ2::is_within_event(std::shared_ptr<Clipboard> cl
// check if event has valid trigger ID (flag = 0x10):
if(evt->IsFlagTrigger()) {
// Store potential trigger numbers, assign to center of event:
clipboard->getEvent()->addTrigger(evt->GetTriggerN(), event_start - shift_start);
LOG(DEBUG) << "Stored trigger ID " << evt->GetTriggerN() << " at "
<< Units::display(event_start - shift_start, {"us", "ns"});
clipboard->getEvent()->addTrigger(evt->GetTriggerN(), event_start);
LOG(DEBUG) << "Stored trigger ID " << evt->GetTriggerN() << " at " << Units::display(event_start, {"us", "ns"});
}
}
......
......@@ -74,7 +74,7 @@ Also, more complex constructs such as arrays or matrices read by the Corryvrecka
* `get_time_residuals`: Boolean to change if time residual plots should be created. Default value is `false`.
* `get_tag_vectors`: Boolean to enable creation of EUDAQ2 event tag histograms. Default value is `false`.
* `ignore_bore`: Boolean to completely ignore the Begin-of-Run event from EUDAQ2. Default value is `true`.
* `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.
* `adjust_event_times`: Matrix that allows the user to shift the event start/end of all different types of EUDAQ events before comparison to any other Corryvreckan data. 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.
* `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
......@@ -105,6 +105,6 @@ file_name = /path/to/data/examplerun_clicpix2.raw
[EventLoaderEUDAQ2]
type = "MIMOSA26"
file_name = /path/to/data/examplerun_telescope.raw
adjust_event_times = ["TluRawDataEvent", -115us, +230us], ["other", 0ns, 0ns]
adjust_event_times = ["TluRawDataEvent", -115us, +230us]
buffer_depth = 1000
```
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