DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TAMakerProtoDUNEBSMWindowAlgorithm.hpp
Go to the documentation of this file.
1
8
9#ifndef TRIGGERALGS_PROTODUNEBSMWINDOW_TRIGGERACTIVITYMAKERBSMWINDOW_HPP_
10#define TRIGGERALGS_PROTODUNEBSMWINDOW_TRIGGERACTIVITYMAKERBSMWINDOW_HPP_
11
14#include "triggeralgs/Types.hpp"
19
20#include <vector>
21#include <algorithm>
22
23namespace triggeralgs {
25{
26
27public:
28 void process(const TriggerPrimitive& input_tp, std::vector<TriggerActivity>& output_ta);
29 void configure(const nlohmann::json &config);
30
32
33private:
34 // Function to handle XGBoost classification
35 // Returns true for signal and false for cosmic
37
39
40 // The current time window of TPs
42
44 uint64_t m_primitive_count = 0;
45
46 // Possible to do batch predictions with XGBoost
47 // For now just keep at 1
48 const int nbatch = 1;
49 // XGBoost takes a row-major flat array
50 std::vector<float> flat_batched_inputs;
51 // row-major input for Entry objects used for compiled model
52 std::vector<Entry> flat_batched_Entries;
53
54 // Configurable parameters.
55 uint32_t m_adc_threshold_induction = 12000000;
56 float m_bdt_threshold = 0.999;
57 std::string m_channel_map_name = "PD2VDTPCChannelMap";
58 // End of configurable parameters
59
60 // Constant parameters defined by XGBoost model training
61 // Currently both PD-HD and PD-VD XGBoost models have been trained
62 // on data filtered to have an ADC sum > 200k ADC
63 const uint32_t m_adc_threshold_collection = 200000;
65 // End constant parameters
66
67 // Define time binning
69 // Number of bins fixed by model training
70 const int m_num_timebins = 10;
71 // Number of bins fixed by model training
72 const int m_num_chanbins = 10;
73
74 // Geometry information for binning
75 std::shared_ptr<dunedaq::detchannelmaps::TPCChannelMap> channelMap;
76 // First channel in each plane and number of channels
77 // in a plane not in channel map by default, so add
78 // a struct to access these values
80 // In PD-VD want to work with effective offline channel
81 // rather than the true offline channel. Have an object that helps
82 // to do this. It prevents gaps in channel vs time images
83 std::unique_ptr<PDVDEffectiveChannelMap> m_pdvd_eff_channel_mapper = nullptr;
84 // If in NP02 and using a PD-VD channel map, set this to true
85 bool m_pdvd_map = true;
86 // Only use the XGBoost model if we are looking at collection plane TPs
87 bool m_collection_plane = false;
88 // first and last channel on the plane
90 // Number of channels on the plane (will be no. effective channels for PD-VD)
92
93 // Compiled treelite model interface
94 std::unique_ptr<CompiledModelInterface> m_compiled_model_interface;
95
96};
97} // namespace triggeralgs
98
99#endif // TRIGGERALGS_PROTODUNEBSMWINDOW_TRIGGERACTIVITYMAKERBSMWINDOW_HPP_
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.
std::shared_ptr< dunedaq::detchannelmaps::TPCChannelMap > channelMap
std::unique_ptr< CompiledModelInterface > m_compiled_model_interface
dunedaq::trgdataformats::timestamp_t timestamp_t
Definition Types.hpp:16
dunedaq::trgdataformats::TriggerPrimitive TriggerPrimitive
dunedaq::trgdataformats::channel_t channel_t
Definition Types.hpp:20