Commit f0d183e1 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'hotfix_edm26' into 'master'

Adding option to EventDefinitionM26 to directly add the trigger ts information to the event

See merge request !445
parents c54fdfbd da5a9546
Pipeline #2840433 passed with stages
in 21 minutes and 24 seconds
......@@ -19,8 +19,9 @@ EventDefinitionM26::EventDefinitionM26(Configuration& config, std::vector<std::s
config_.setDefault<int>("time_shift", 0);
config_.setDefault<int>("shift_triggers", 0);
config_.setDefault<std::string>("eudaq_loglevel", "ERROR");
config_.setDefault<double>("skip_time", 0.);
config_.setDefault<bool>("add_trigger", false);
config_.setDefault<std::string>("eudaq_loglevel", "ERROR");
detector_time_ = config_.get<std::string>("detector_event_time");
// Convert to lower case before string comparison to avoid errors by the user:
......@@ -31,8 +32,7 @@ EventDefinitionM26::EventDefinitionM26(Configuration& config, std::vector<std::s
timeshift_ = config_.get<double>("time_shift");
shift_triggers_ = config_.get<int>("shift_triggers");
skip_time_ = config_.get<double>("skip_time");
config_.setDefault<std::string>("eudaq_loglevel", "ERROR");
add_trigger_ = config_.get<bool>("add_trigger");
// Set EUDAQ log level to desired value:
LOG(INFO) << "Setting EUDAQ2 log level to \"" << config_.get<std::string>("eudaq_loglevel") << "\"";
......@@ -191,13 +191,24 @@ StatusCode EventDefinitionM26::run(const std::shared_ptr<Clipboard>& clipboard)
if(time_trig - time_prev_ > 0) {
// M26 frames need to have a distance of at least one frame length!
if(time_trig - time_prev_ < 115000) {
if((time_trig - time_prev_ < 115000) && (!add_trigger_)) {
LOG(ERROR) << "M26 triggers too close together to fit M26 frame, dt = " +
Units::display(time_trig - time_prev_, "us")
<< std::endl
<< "Check if a shift of trigger IDs is required.";
// If we stretch the event over three frames and add a trigger, we need a larger distance
if((time_trig - time_prev_ < 345600) && add_trigger_) {
<< "Skipping event that would overlap previous event, since bool add_triggers_ is set to true";
if(add_trigger_) {
time_before_ = Units::get(115.2, "us");
time_after_ = Units::get(230.4, "us");
timebetweenMimosaEvents_->Fill(static_cast<double>(Units::convert(time_trig - time_prev_, "us")));
timeBeforeTrigger_->Fill(static_cast<double>(Units::convert(-1.0 * time_before_, "us")));
timeAfterTrigger_->Fill(static_cast<double>(Units::convert(time_after_, "us")));
......@@ -216,7 +227,11 @@ StatusCode EventDefinitionM26::run(const std::shared_ptr<Clipboard>& clipboard)
<< Units::display(time_after_, "us") << ", " << Units::display(time_after_ + time_before_, "us");
LOG(DEBUG) << "evtStart/evtEnd/duration = " << Units::display(evtStart, "us") << ", "
<< Units::display(evtEnd, "us") << ", " << Units::display(evtEnd - evtStart, "us");
clipboard->putEvent(std::make_shared<Event>(evtStart, evtEnd));
if(add_trigger_) {
clipboard->getEvent()->addTrigger(triggerTLU_, static_cast<double>(time_trig));
LOG(DEBUG) << "Defining Corryvreckan event: " << Units::display(evtStart, {"us", "ns"}) << " - "
<< Units::display(evtEnd, {"us", "ns"}) << ", length "
<< Units::display(evtEnd - evtStart, {"us", "ns"});
......@@ -50,6 +50,8 @@ namespace corryvreckan {
std::vector<uint32_t> triggerIDs_{};
bool add_trigger_{};
long double timeshift_{};
int shift_triggers_{};
double skip_time_{};
# EventDefinitionM26
**Maintainer**: Lennart Huth (, Jens Kroeger (
**Module Type**: *GLOBAL*
**Status**: Functional
**Maintainer**: Lennart Huth (, Jens Kroeger (
**Module Type**: *GLOBAL*
**Status**: Advanced
### Description
This global module allows to fully utilize the PIVOT pixel behaviour of the
EUDET type telescopes based on the NI MIMOSA26 readout. The event begin and
EUDET type telescopes based on the NI MIMOSA26 readout. The MIMOSA DAQ stores two full rolling shutter frames.
The first frame corresponds to the frame where the trigger has been received. To store also particle hits at a position in front of the shutter, also the next frame is stored.
Note that the default NI-converter only returns pixels after the pivot in the first frame and in front of the pivot in the second frame.
The event begin and
end are defined based on the pivot pixel provided in the MIMOSA data
stream. Currently, the module assumes that the full two data frames are read
out, which is not the case in the standard converter.
However, the converter only returns all pixels after the pivot pixel of the
first frame and those before the pivot pixel of the second frame.
For a triggerID that has a TLU event from 425.000us to 425.025us (default
25 ns events), the trigger timestamp is defined as the middle of the event:
t_trig = (425us+425.025us)/2
and the pivot pixel-row is p the event will be defined as:
begin = t_{trig} - (p * (115.2 / 576)) \mu s \\
end = begin + 230 \mu s
Event definition example:
If a triggerID has a TLU event from 425.000us to 425.025us (default
25 ns events) and the pivot pixel-row is 512 the event will be defined as:
It should be noted that in about 1 permille of the cases, zero triggers per event are
observed, which should in principle not be possible.
......@@ -24,10 +32,6 @@ This causes that in about 1 permille of the cases, the "time before" and
"time after" a trigger spanning the event is not set correctly when the
pivot pixel is close to its roll-over.
begin = 125.012.5us - (512 * (115.2 / 576)) us
end = begin + 230us
### Parameters
* `detector_event_time`: Specify the detector type used to define the event timestamp.
......@@ -37,7 +41,7 @@ end = begin + 230us
* `shift_triggers`: Shift the trigger ID of the `detector_event_time`. This allows to correct trigger ID offsets between different devices such as the TLU and MIMOSA26. Note that if using the module `EventLoaderEUDAQ2` the same value for `shift_triggers` needs to be passed in both cases. Defaults to `0`.
* `skip_time`: Time that can be skipped at the start of a run. All events with earlier timestamps are discarded. Default is `0ms`.
* `eudaq_loglevel`: Verbosity level of the EUDAQ logger instance of the converter module. Possible options are, in decreasing severity, `USER`, `ERROR`, `WARN`, `INFO`, `EXTRA` and `DEBUG`. The default level is `ERROR`. Please note that the EUDAQ verbosity can only be changed globally, i.e. when using instances of `EventLoaderEUDAQ2` below this module, the last occurrence will determine the (global) value of this parameter.
* `add_trigger`: Option to directly add the trigger of the TLU to the event. If this option is selected, the event length is defined to be 3*115.2us - with 115.2us before the trigger timestamp and 230.4us after it. Note that no `EventLoaderEUDAQ2` for the TLU is required if this option is activated. Defaults to `false`
In addition, parameters can be forwarded to the EUDAQ2 event converters.
Please refer to the README of the `EventLoaderEUDAQ2` for more details.
......@@ -53,5 +57,6 @@ detector_event_time = TLU
file_timestamp = tlu_data.raw
file_duration = mimosa_data.raw
time_shift = 0
shift_triggers = -1
shift_triggers = 1
add_trigger = false
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