11#include "TRACE/trace.h"
12#define TRACE_NAME "TAMakerProtoDUNEBSMWindowAlgorithm"
18using Logging::TLVL_DEBUG_ALL;
19using Logging::TLVL_DEBUG_HIGH;
20using Logging::TLVL_DEBUG_LOW;
21using Logging::TLVL_IMPORTANT;
32 unsigned int detelement =
channelMap->get_element_id_from_offline_channel(input_tp.
channel);
33 unsigned int plane =
channelMap->get_plane_from_offline_channel(input_tp.
channel);
59 TLOG_DEBUG(TLVL_DEBUG_HIGH) <<
"[TAM:BSMW] Window not yet complete, adding the input_tp to the window.";
73 TLOG_DEBUG(TLVL_DEBUG_LOW) <<
"[TAM:BSMW] ADC integral in window is greater than specified threshold.";
75 TLOG_DEBUG(TLVL_DEBUG_HIGH) <<
"[TAM:BSMW] Resetting window with input_tp.";
80 TLOG_DEBUG(TLVL_DEBUG_ALL) <<
"[TAM:BSMW] Window is at required length but adc threshold not met, shifting window along.";
95 if (config.is_object()){
96 if (config.contains(
"channel_map_name"))
m_channel_map_name = config[
"channel_map_name"];
97 if (config.contains(
"num_time_bins"))
m_num_timebins = config[
"num_time_bins"];
98 if (config.contains(
"adc_threshold"))
m_adc_threshold = config[
"adc_threshold"];
99 if (config.contains(
"ratio_threshold")) {
103 if (config.contains(
"window_length")) {
107 if (config.contains(
"bdt_threshold")) {
108 uint64_t int_bdt_threshold = config[
"bdt_threshold"];
109 if (int_bdt_threshold <= 100)
m_bdt_threshold =
static_cast<float>(int_bdt_threshold * 0.01);
110 else if (int_bdt_threshold <= 1000)
m_bdt_threshold =
static_cast<float>(int_bdt_threshold * 0.001);
111 else if (int_bdt_threshold <= 10000)
m_bdt_threshold =
static_cast<float>(int_bdt_threshold * 0.0001);
116 TLOG_DEBUG(TLVL_IMPORTANT) <<
"[TAM:BSMW] The DEFAULT values of window_length and adc_threshold are being used.";
141 for (
size_t i = 0; i < num_feature; ++i) {
155 TLOG_DEBUG(TLVL_DEBUG_LOW) <<
"[TAM:BSMW] I am constructing a trigger activity!";
190 std::vector<float> result(
nbatch, 0.0f);
#define REGISTER_TRIGGER_ACTIVITY_MAKER(tam_name, tam_class)
std::vector< TriggerPrimitive > tp_list
void add(TriggerPrimitive const &input_tp)
void reset(TriggerPrimitive const &input_tp)
void move(TriggerPrimitive const &input_tp, timestamp_t const &window_length)
void fill_entry_window(std::vector< Entry > &entry_input, std::vector< float > &input)
void bin_window(std::vector< float > &input, timestamp_t time_bin_width, channel_t chan_bin_width, int num_time_bins, int num_chan_bins, channel_t first_channel, std::unique_ptr< PDVDEffectiveChannelMap > const &effective_channel_mapper, bool use_pdvd_map)
uint64_t m_primitive_count
ProtoDUNEBSMWindow m_current_window
~TAMakerProtoDUNEBSMWindowAlgorithm() override
channel_t m_chan_bin_length
std::vector< float > flat_batched_inputs
std::vector< Entry > flat_batched_Entries
timestamp_t m_last_pred_time
timestamp_t m_window_length
std::string m_channel_map_name
void configure(const nlohmann::json &config)
channel_t m_first_channel
TriggerActivity construct_ta() const
bool compute_treelite_classification()
std::unique_ptr< PDVDEffectiveChannelMap > m_pdvd_eff_channel_mapper
void process(const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_ta)
TP processing function that creates & fills TAs.
DetectorPlaneMap m_det_plane_map
std::shared_ptr< dunedaq::detchannelmaps::TPCChannelMap > channelMap
std::unique_ptr< CompiledModelInterface > m_compiled_model_interface
#define TLOG_DEBUG(lvl,...)
dunedaq::trgdataformats::timestamp_t timestamp_t
dunedaq::trgdataformats::channel_t channel_t
PlaneInfo get_plane_info(std::string channel_map_name, int detelement, int plane)
std::vector< TriggerPrimitive > inputs