Line data Source code
1 : /**
2 : * @file TCMakerPrescaleAlgorithm.cpp
3 : *
4 : * This is part of the DUNE DAQ Application Framework, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "triggeralgs/Prescale/TCMakerPrescaleAlgorithm.hpp"
10 :
11 : #include "TRACE/trace.h"
12 : #define TRACE_NAME "TCMakerPrescaleAlgorithm"
13 :
14 : #include <vector>
15 :
16 : using namespace triggeralgs;
17 :
18 : void
19 0 : TCMakerPrescaleAlgorithm::process(const TriggerActivity& activity, std::vector<TriggerCandidate>& cand)
20 : {
21 0 : std::vector<TriggerActivity::TriggerActivityData> ta_list;
22 0 : ta_list.push_back(static_cast<TriggerActivity::TriggerActivityData>(activity));
23 :
24 0 : TriggerCandidate tc;
25 0 : tc.time_start = activity.time_start;
26 0 : tc.time_end = activity.time_end;
27 0 : tc.time_candidate = activity.time_start;
28 0 : tc.detid = activity.detid;
29 0 : tc.type = m_tc_type_out;
30 0 : tc.algorithm = TriggerCandidate::Algorithm::kPrescale;
31 :
32 0 : tc.inputs = ta_list;
33 :
34 0 : using namespace std::chrono;
35 :
36 : // Update OpMon Variable(s)
37 0 : uint64_t system_time = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
38 0 : uint64_t data_time = activity.time_start*16e-6; // Convert 62.5 MHz ticks to ms
39 0 : m_data_vs_system_time.store(data_time - system_time); // Store the difference for OpMon
40 :
41 0 : cand.push_back(tc);
42 0 : }
43 :
44 : void
45 0 : TCMakerPrescaleAlgorithm::configure(const nlohmann::json &config)
46 : {
47 0 : TriggerCandidateMaker::configure(config);
48 0 : }
49 :
50 12 : REGISTER_TRIGGER_CANDIDATE_MAKER(TRACE_NAME, TCMakerPrescaleAlgorithm)
|