DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
triggeralgs
include
triggeralgs
ProtoDUNEBSMWindow
TAMakerProtoDUNEBSMWindowAlgorithm.hpp
Go to the documentation of this file.
1
8
9
#ifndef TRIGGERALGS_PROTODUNEBSMWINDOW_TRIGGERACTIVITYMAKERBSMWINDOW_HPP_
10
#define TRIGGERALGS_PROTODUNEBSMWINDOW_TRIGGERACTIVITYMAKERBSMWINDOW_HPP_
11
12
#include "
detchannelmaps/TPCChannelMap.hpp
"
13
#include "
triggeralgs/TriggerActivityFactory.hpp
"
14
#include "
triggeralgs/Types.hpp
"
15
#include "
triggeralgs/ProtoDUNEBSMWindow/ProtoDUNEBSMWindow.hpp
"
16
#include "
triggeralgs/ProtoDUNEBSMWindow/CompiledModelInterface.hpp
"
17
#include "
triggeralgs/ProtoDUNEBSMWindow/DetectorPlaneMap.hpp
"
18
#include "
triggeralgs/ProtoDUNEBSMWindow/PDVDEffectiveChannelMap.hpp
"
19
20
#include <vector>
21
#include <algorithm>
22
23
namespace
triggeralgs
{
24
class
TAMakerProtoDUNEBSMWindowAlgorithm
:
public
TriggerActivityMaker
25
{
26
27
public
:
28
void
process
(
const
TriggerPrimitive
& input_tp, std::vector<TriggerActivity>& output_ta);
29
void
configure
(
const
nlohmann::json &config);
30
31
~TAMakerProtoDUNEBSMWindowAlgorithm
()
override
=
default
;
32
33
private
:
34
// Function to handle XGBoost classification
35
// Returns true for signal and false for cosmic
36
bool
compute_treelite_classification
();
37
38
TriggerActivity
construct_ta
()
const
;
39
40
// The current time window of TPs
41
ProtoDUNEBSMWindow
m_current_window
;
42
43
timestamp_t
m_last_pred_time
= 0;
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;
64
const
timestamp_t
m_window_length
= 20000;
65
// End constant parameters
66
67
// Define time binning
68
timestamp_t
m_bin_length
= 2000;
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
79
DetectorPlaneMap
m_det_plane_map
;
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
89
channel_t
m_first_channel
;
90
// Number of channels on the plane (will be no. effective channels for PD-VD)
91
channel_t
m_n_channels_on_plane
;
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_
CompiledModelInterface.hpp
DetectorPlaneMap.hpp
PDVDEffectiveChannelMap.hpp
ProtoDUNEBSMWindow.hpp
TPCChannelMap.hpp
TriggerActivityFactory.hpp
triggeralgs::ProtoDUNEBSMWindow
Definition
ProtoDUNEBSMWindow.hpp:20
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:25
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_primitive_count
uint64_t m_primitive_count
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:44
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_collection_plane
bool m_collection_plane
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:87
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_current_window
ProtoDUNEBSMWindow m_current_window
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:41
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_adc_threshold_induction
uint32_t m_adc_threshold_induction
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:55
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_adc_threshold_collection
const uint32_t m_adc_threshold_collection
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:63
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::flat_batched_inputs
std::vector< float > flat_batched_inputs
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:50
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_bin_length
timestamp_t m_bin_length
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:68
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::flat_batched_Entries
std::vector< Entry > flat_batched_Entries
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:52
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_last_pred_time
timestamp_t m_last_pred_time
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:43
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_pdvd_map
bool m_pdvd_map
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:85
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::nbatch
const int nbatch
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:48
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_bdt_threshold
float m_bdt_threshold
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:56
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_channel_map_name
std::string m_channel_map_name
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:57
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::~TAMakerProtoDUNEBSMWindowAlgorithm
~TAMakerProtoDUNEBSMWindowAlgorithm() override=default
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_n_channels_on_plane
channel_t m_n_channels_on_plane
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:91
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::configure
void configure(const nlohmann::json &config)
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.cpp:112
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_num_timebins
const int m_num_timebins
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:70
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_first_channel
channel_t m_first_channel
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:89
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::construct_ta
TriggerActivity construct_ta() const
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.cpp:154
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::compute_treelite_classification
bool compute_treelite_classification()
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.cpp:178
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_pdvd_eff_channel_mapper
std::unique_ptr< PDVDEffectiveChannelMap > m_pdvd_eff_channel_mapper
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:83
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_num_chanbins
const int m_num_chanbins
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:72
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::process
void process(const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_ta)
TP processing function that creates & fills TAs.
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.cpp:24
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_det_plane_map
DetectorPlaneMap m_det_plane_map
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:79
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::channelMap
std::shared_ptr< dunedaq::detchannelmaps::TPCChannelMap > channelMap
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:75
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_window_length
const timestamp_t m_window_length
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:64
triggeralgs::TAMakerProtoDUNEBSMWindowAlgorithm::m_compiled_model_interface
std::unique_ptr< CompiledModelInterface > m_compiled_model_interface
Definition
TAMakerProtoDUNEBSMWindowAlgorithm.hpp:94
triggeralgs::TriggerActivityMaker
Definition
TriggerActivityMaker.hpp:29
triggeralgs
Definition
AbstractFactory.hpp:18
triggeralgs::timestamp_t
dunedaq::trgdataformats::timestamp_t timestamp_t
Definition
Types.hpp:16
triggeralgs::TriggerPrimitive
dunedaq::trgdataformats::TriggerPrimitive TriggerPrimitive
Definition
TriggerPrimitive.hpp:22
triggeralgs::channel_t
dunedaq::trgdataformats::channel_t channel_t
Definition
Types.hpp:20
triggeralgs::DetectorPlaneMap
Definition
DetectorPlaneMap.hpp:18
triggeralgs::TriggerActivity
Definition
TriggerActivity.hpp:20
Types.hpp
Generated on
for DUNE-DAQ by
1.17.0