8#ifndef TRIGGER_TRIGCLUSTERNNPRODUCER_H
9#define TRIGGER_TRIGCLUSTERNNPRODUCER_H
17#include "Framework/Configure/Parameters.h"
19#include "Tools/ONNXRuntime.h"
20#include "Trigger/Event/TrigCaloCluster.h"
21#include "Trigger/Event/TrigEnergySum.h"
57 static void fillInputs(
const TrigCaloClusterCollection& clusters,
58 const TrigEnergySumCollection& ecal_sums,
59 const TrigEnergySumCollection& hcal_sums,
60 std::vector<float>& inputs);
62 static constexpr std::size_t MAX_CLUSTERS = 3;
63 static constexpr std::size_t N_FEATURES = 9;
64 static constexpr std::size_t N_CLASSES = 9;
67 static constexpr std::size_t
FEAT_X = 0;
68 static constexpr std::size_t FEAT_Y = 1;
69 static constexpr std::size_t FEAT_Z = 2;
70 static constexpr std::size_t FEAT_E = 3;
71 static constexpr std::size_t FEAT_DEPTH = 4;
72 static constexpr std::size_t FEAT_N_TP = 5;
73 static constexpr std::size_t FEAT_N_CLUSTERS = 6;
74 static constexpr std::size_t FEAT_ECAL_SUM_E = 7;
75 static constexpr std::size_t FEAT_HCAL_SUM_ADC = 8;
76 static_assert(FEAT_HCAL_SUM_ADC + 1 == N_FEATURES);
82 std::string cluster_coll_name_;
83 std::string ecal_sum_coll_name_;
84 std::string hcal_sum_coll_name_;
87 std::string score_coll_name_;
91 std::unique_ptr<ldmx::ort::ONNXRuntime> rt_;
94 double processing_time_{0.};
95 double inference_time_{0.};
Base classes for all user event processing components to extend.
Implements an event buffer system for storing event data.
Class which represents the process under execution.
Base class for a module which produces a data product.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.
Class encapsulating parameters for configuring a processor.
Scores each event with the ECal trigger MLP and stores the output.
void onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
static void fillInputs(const TrigCaloClusterCollection &clusters, const TrigEnergySumCollection &ecal_sums, const TrigEnergySumCollection &hcal_sums, std::vector< float > &inputs)
Fill flattened (MAX_CLUSTERS, N_FEATURES) model input, (index = slot * N_FEATURES + feature).
void configure(framework::config::Parameters &ps) override
Callback for the EventProcessor to configure itself from the given set of parameters.
void produce(framework::Event &event) override
Process the event and put new data products into it.
static constexpr std::size_t BKG_CLASS
class index of the single-electron background in the model output
static constexpr std::size_t FEAT_X
feature index within one cluster slot of the model input
ldmx::ort::FloatArrays data_
model input buffer, reused every event
std::string input_pass_
pass name shared by all three input collections