5#ifndef LUNDJETONNXALG_H
6#define LUNDJETONNXALG_H
15#include <onnxruntime_cxx_api.h>
26 using AthReentrantAlgorithm::AthReentrantAlgorithm;
28 virtual StatusCode
execute(
const EventContext& ctx)
const override;
33 this,
"InputJetContainer",
"AntiKt10UFO",
34 "Name of input jet container"
38 "Prefix used by LundVariablesTool decorations"
41 this,
"kTSelection", -1000.f,
42 "kT cut to apply (same meaning as kT_Cut in python loader)"
46 this,
"ScoreDecoration",
"LundNetScore",
47 "Name of the decoration (without container prefix). Final decoration will be <container>.<prefix><ScoreDecoration>"
54 "Batch size expected by the ONNX model (from training/export)"
57 this,
"ValidDecor",
"",
"Valid LundNet inference"
61 this,
"ScoreDecorKey",
"",
"Score decoration key"
64 Gaudi::Property<float>
m_mean_z{
this,
"MeanZ", 2.0568479032747313f,
"mean z (for normalization)" };
65 Gaudi::Property<float>
m_std_z{
this,
"StdZ", 1.4450598054504056f,
"std z (for normalization)" };
66 Gaudi::Property<float>
m_mean_dr{
this,
"MeanDR", 3.8597358364389427f,
"mean dr (for normalization)" };
67 Gaudi::Property<float>
m_std_dr{
this,
"StdDR", 2.2748462855901073f,
"std dr (for normalization)" };
68 Gaudi::Property<float>
m_mean_kt{
this,
"MeanKT", -2.379904791478249f,
"mean kt (for normalization)" };
69 Gaudi::Property<float>
m_std_kt{
this,
"StdKT", 2.940813577366582f,
"std kt (for normalization)" };
70 Gaudi::Property<float>
m_mean_ntrk{
this,
"MeanNtrk", 57.588158609500134f,
"mean Ntrk" };
71 Gaudi::Property<float>
m_std_ntrk{
this,
"StdNtrk", 23.900100132781983f,
"std Ntrk" };
77 "Path to the ONNX model"
79 std::unique_ptr<Ort::Env>
m_env;
85 std::vector<float>& out_x_float,
86 std::vector<int64_t>& out_edge_index_int64,
87 std::vector<int64_t>& out_batch_int64,
88 std::vector<int64_t>& out_counts_int64,
89 std::vector<float>& out_Ntrk_float)
const;
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< float > m_mean_ntrk
Gaudi::Property< std::string > m_modelPath
Gaudi::Property< float > m_mean_dr
Gaudi::Property< std::string > m_inputJetContainer
Gaudi::Property< float > m_std_ntrk
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< float > m_std_kt
Gaudi::Property< std::string > m_scoreName
Gaudi::Property< float > m_mean_z
Gaudi::Property< float > m_std_z
Gaudi::Property< float > m_std_dr
std::unique_ptr< Ort::Env > m_env
Gaudi::Property< float > m_kTSelection
SG::WriteDecorHandleKey< xAOD::JetContainer > m_validDecorKey
bool buildOnnxInputs(const xAOD::Jet &jet, std::vector< float > &out_x_float, std::vector< int64_t > &out_edge_index_int64, std::vector< int64_t > &out_batch_int64, std::vector< int64_t > &out_counts_int64, std::vector< float > &out_Ntrk_float) const
Helper to build ONNX inputs (batch_size=1)
std::unique_ptr< Ort::Session > m_session
Gaudi::Property< int > m_expectedBatchSize
Gaudi::Property< float > m_mean_kt
SG::WriteDecorHandleKey< xAOD::JetContainer > m_scoreDecorKey
std::string m_resolvedModelPath
Gaudi::Property< std::string > m_prefix
virtual StatusCode initialize() override
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Jet_v1 Jet
Definition of the current "jet version".