11#include "TRACE/trace.h"
12#define TRACE_NAME "TCMakerHorizontalMuonAlgorithm"
19using Logging::TLVL_DEBUG_ALL;
20using Logging::TLVL_DEBUG_HIGH;
21using Logging::TLVL_DEBUG_MEDIUM;
25 std::vector<TriggerCandidate>& output_tc)
28 std::vector<TriggerActivity::TriggerActivityData> ta_list = {
static_cast<TriggerActivity::TriggerActivityData
>(
46 TLOG_DEBUG(TLVL_DEBUG_HIGH) <<
"[TCM:HM] Window not yet complete, adding the activity to the window.";
52 <<
"[TCM:HM] TAWindow is at required length but specified threshold not met, shifting window along.";
67 <<
" len(tc.inputs) " << tc.
inputs.size();
69 for (
const auto& ta : tc.
inputs) {
70 TLOG_DEBUG(TLVL_DEBUG_ALL) <<
"[TCM:HM] [TA] ta.time_start=" << ta.time_start <<
" ta.time_end=" << ta.time_end
71 <<
" ta.adc_integral=" << ta.adc_integral;
74 output_tc.push_back(tc);
107 if (config.is_object()) {
108 if (config.contains(
"trigger_on_adc"))
110 if (config.contains(
"trigger_on_n_channels"))
112 if (config.contains(
"adc_threshold"))
114 if (config.contains(
"n_channels_threshold"))
116 if (config.contains(
"window_length"))
120 TLOG_DEBUG(TLVL_VERY_IMPORTANT) <<
"[TCM:HM] Triggering on ADC count and number of channels is not supported.";
124 TLOG_DEBUG(TLVL_VERY_IMPORTANT) <<
"[TCM:HM] Not triggering! All trigger flags are false!";
176 std::ofstream outfile;
177 outfile.open(
"window_record_tcm.csv", std::ios_base::app);
180 outfile << window.time_start <<
",";
181 outfile << window.inputs.back().time_start <<
",";
182 outfile << window.inputs.back().time_start - window.time_start <<
",";
183 outfile << window.adc_integral <<
",";
184 outfile << window.n_channels_hit() <<
",";
185 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()
bool m_trigger_on_n_channels
std::vector< TAWindow > m_window_record
TriggerCandidate construct_tc() const
uint16_t m_n_channels_threshold
void add_window_to_record(TAWindow window)
uint64_t m_activity_count
bool check_adjacency() const
timestamp_t m_window_length
void configure(const nlohmann::json &config)
void process(const TriggerActivity &, std::vector< TriggerCandidate > &)
TA processing function that creates & fills TCs.
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
virtual void configure(const nlohmann::json &config)
#define TLOG_DEBUG(lvl,...)
std::vector< TriggerPrimitive > inputs
std::vector< dunedaq::trgdataformats::TriggerActivityData > inputs