Line data Source code
1 : /**
2 : * @file TCMakerProtoDUNEBSMWindowAlgorithm.cpp
3 : *
4 : * This is part of the DUNE DAQ Application Framework, copyright 2021.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "triggeralgs/ProtoDUNEBSMWindow/TCMakerProtoDUNEBSMWindowAlgorithm.hpp"
10 :
11 : #include "TRACE/trace.h"
12 : #define TRACE_NAME "TCMakerProtoDUNEBSMWindowAlgorithm"
13 :
14 : #include <vector>
15 :
16 : using namespace triggeralgs;
17 :
18 : using Logging::TLVL_DEBUG_LOW;
19 :
20 0 : void TCMakerProtoDUNEBSMWindowAlgorithm::process(const TriggerActivity& activity, std::vector<TriggerCandidate>& cand)
21 : //TCMakerProtoDUNEBSMWindowAlgorithm::operator()(const TriggerActivity& activity, std::vector<TriggerCandidate>& cand)
22 : {
23 :
24 : // For now, if there is any single activity from any one detector element, emit
25 : // a trigger candidate.
26 0 : m_activity_count++;
27 0 : std::vector<TriggerActivity::TriggerActivityData> ta_list = {static_cast<TriggerActivity::TriggerActivityData>(activity)};
28 :
29 0 : TLOG_DEBUG(TLVL_DEBUG_LOW) << "[TCM:ADCSW] Emitting an "
30 0 : << dunedaq::trgdataformats::get_trigger_candidate_type_names()[m_tc_type]
31 0 : << " TriggerCandidate with AEAnomalyWindow algorithm" << (m_activity_count-1);
32 :
33 0 : TriggerCandidate tc;
34 0 : tc.time_start = activity.time_start;
35 0 : tc.time_end = activity.time_end;
36 0 : tc.time_candidate = activity.time_activity;
37 0 : tc.detid = activity.detid;
38 0 : tc.type = m_tc_type;
39 : //tc.algorithm = TriggerCandidate::Algorithm::kAEAnomalyWindow;
40 0 : tc.algorithm = TriggerCandidate::Algorithm::kUnknown;
41 :
42 0 : tc.inputs = ta_list;
43 :
44 0 : cand.push_back(tc);
45 :
46 0 : }
47 :
48 : void
49 0 : TCMakerProtoDUNEBSMWindowAlgorithm::configure(const nlohmann::json &config)
50 : {
51 0 : TriggerCandidateMaker::configure(config);
52 : /*
53 : // Don't configure if no configuration object
54 : if (!config.is_object())
55 : return;
56 :
57 : // Set the TC name
58 : if (config.contains("tc_type_name")){
59 : m_tc_type = static_cast<triggeralgs::TriggerCandidate::Type>(
60 : dunedaq::trgdataformats::string_to_fragment_type_value(config["tc_type_name"]));
61 :
62 : // Set unknown to the default kAEAnomalyWindow
63 : if (m_tc_type == triggeralgs::TriggerCandidate::Type::kUnknown) {
64 : //m_tc_type = TriggerCandidate::Type::kAEAnomalyWindow;
65 : m_tc_type = TriggerCandidate::Type::kUnknown;
66 : }
67 :
68 : TLOG() << "[TCM:ADCSW]: setting output TC type to "
69 : << dunedaq::trgdataformats::get_trigger_candidate_type_names()[m_tc_type];
70 : }
71 : */
72 0 : }
73 :
74 12 : REGISTER_TRIGGER_CANDIDATE_MAKER(TRACE_NAME, TCMakerProtoDUNEBSMWindowAlgorithm)
|