Line data Source code
1 : /**
2 : * @file TCMakerSupernovaAlgorithm.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/Supernova/TCMakerSupernovaAlgorithm.hpp"
10 :
11 : #include "TRACE/trace.h"
12 : #define TRACE_NAME "TCMakerSupernovaAlgorithm"
13 :
14 : using namespace triggeralgs;
15 :
16 : void
17 0 : TCMakerSupernovaAlgorithm::process(const TriggerActivity& activity, std::vector<TriggerCandidate>& cand)
18 : {
19 0 : timestamp_t time = activity.time_start;
20 0 : FlushOldActivity(time); // get rid of old activities in the buffer
21 0 : if (activity.inputs.size() > m_hit_threshold)
22 0 : m_activity.push_back(static_cast<TriggerActivity::TriggerActivityData>(activity));
23 :
24 : // Yay! we have a trigger!
25 0 : if (m_activity.size() > m_threshold) {
26 :
27 0 : detid_t detid = dunedaq::trgdataformats::WHOLE_DETECTOR;
28 :
29 0 : TriggerCandidate tc;
30 0 : tc.time_start = time - 500'000'000; // time_start (10 seconds before the start of the activity)
31 0 : tc.time_end = activity.time_end; // time_end; but that should probably be _at least_ this number
32 0 : tc.time_candidate = time;
33 0 : tc.detid = detid;
34 0 : tc.type = m_tc_type_out; // type ( flag that says what type of trigger might be (e.g. SN/Muon/Beam) )
35 0 : tc.algorithm = TriggerCandidate::Algorithm::kSupernova; // algorithm ( flag that says which algorithm created the trigger (e.g. SN/HE/Solar) )
36 0 : tc.inputs = m_activity;
37 :
38 0 : m_activity.clear();
39 : // Give the trigger word back
40 0 : cand.push_back(tc);
41 0 : }
42 0 : }
43 :
44 12 : REGISTER_TRIGGER_CANDIDATE_MAKER(TRACE_NAME, TCMakerSupernovaAlgorithm)
|