11#include "TRACE/trace.h"
12#define TRACE_NAME "TCMakerPlaneCoincidenceAlgorithm"
18using Logging::TLVL_DEBUG_HIGH;
19using Logging::TLVL_DEBUG_MEDIUM;
20using Logging::TLVL_DEBUG_LOW;
21using Logging::TLVL_DEBUG_INFO;
22using Logging::TLVL_VERY_IMPORTANT;
26 std::vector<TriggerCandidate>& output_tc)
29 std::vector<TriggerActivity::TriggerActivityData> ta_list = {
static_cast<TriggerActivity::TriggerActivityData
>(
43 TLOG_DEBUG(TLVL_DEBUG_LOW) <<
"[TCM:PC] Constructing TC.";
46 output_tc.push_back(tc);
67 TLOG_DEBUG(TLVL_DEBUG_MEDIUM) <<
"[TCM:PC] ADC integral in window is greater than specified threshold.";
70 output_tc.push_back(tc);
71 TLOG_DEBUG(TLVL_DEBUG_HIGH) <<
"[TCM:PC] Resetting window with activity.";
83 TLOG_DEBUG(TLVL_DEBUG_INFO) <<
"[TCM:PC] Should not see this!";
87 TLOG_DEBUG(TLVL_DEBUG_HIGH) <<
"[TCM:PC] TAWindow is at required length but specified threshold not met, shifting window along.";
100 if (config.is_object()) {
101 if (config.contains(
"trigger_on_adc"))
103 if (config.contains(
"trigger_on_n_channels"))
105 if (config.contains(
"adc_threshold"))
107 if (config.contains(
"n_channels_threshold"))
109 if (config.contains(
"window_length"))
113 TLOG_DEBUG(TLVL_VERY_IMPORTANT) <<
"[TCM:PC] Using trigger_on_n_channels is not supported.";
117 TLOG_DEBUG(TLVL_DEBUG_LOW) <<
"[TCM:PC] Both trigger flags are false. Passing TAs through 1:1.";
165 std::ofstream outfile;
166 outfile.open(
"window_record_tcm.csv", std::ios_base::app);
169 outfile << window.time_start <<
",";
170 outfile << window.inputs.back().time_start <<
",";
171 outfile << window.inputs.back().time_start - window.time_start <<
",";
172 outfile << window.adc_integral <<
",";
173 outfile << window.n_channels_hit() <<
",";
174 outfile << window.inputs.size() << std::endl;
#define REGISTER_TRIGGER_CANDIDATE_MAKER(tcm_name, tcm_class)
void clear()
Clear all inputs.
void add(const TriggerActivity &input_ta)
Add the input TA's contribution to the total ADC, increase the hit count of all of the channels which...
std::vector< TriggerActivity > inputs
void reset(TriggerActivity const &input_ta)
Reset window content on the input.
uint16_t n_channels_hit()
void move(TriggerActivity const &input_ta, timestamp_t const &window_length)
Find all of the TAs in the window that need to be removed if the input_ta is to be added and the size...
TAWindow m_current_window
void dump_window_record()
std::vector< TAWindow > m_window_record
TriggerCandidate construct_tc() const
uint64_t m_activity_count
timestamp_t m_window_length
void configure(const nlohmann::json &config)
bool check_adjacency() const
void add_window_to_record(TAWindow window)
bool m_trigger_on_n_channels
void process(const TriggerActivity &, std::vector< TriggerCandidate > &)
TA processing function that creates & fills TCs.
uint16_t m_n_channels_threshold
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
virtual void configure(const nlohmann::json &config)
#define TLOG_DEBUG(lvl,...)
std::vector< dunedaq::trgdataformats::TriggerActivityData > inputs