Metronome.cpp 1007 Bytes
Newer Older
Simon Spannagel's avatar
Simon Spannagel committed
1
2
3
4
5
6
7
8
#include "Metronome.h"

using namespace corryvreckan;
using namespace std;

Metronome::Metronome(Configuration config, std::vector<Detector*> detectors)
    : Module(std::move(config), std::move(detectors)) {

9
    m_eventLength = m_config.get<double>("eventLength", static_cast<double>(Units::convert(10, "us")));
Simon Spannagel's avatar
Simon Spannagel committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
}

void Metronome::initialise() {

    // Set initial values for the start and stop time of the first event:
    m_eventStart = 0.0;
    m_eventEnd = m_eventLength;
}

StatusCode Metronome::run(Clipboard* clipboard) {

    // Set up the clipboard persistent storage for the current event:
    clipboard->put_persistent("eventStart", m_eventStart);
    clipboard->put_persistent("eventEnd", m_eventEnd);
    clipboard->put_persistent("eventLength", m_eventLength);

    // Increment the current event's start and end times by the configured event length
    m_eventStart = m_eventEnd;
    m_eventEnd += m_eventLength;

    // Return value telling analysis to keep running
    return Success;
}