ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
eflowRec
src
PFEnergyPredictorTool.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef EFLOWREC_PFENERFYPREDICTORTOOL_H
6
#define EFLOWREC_PFENERFYPREDICTORTOOL_H
7
8
#include "
AthenaBaseComps/AthAlgTool.h
"
9
#include "GaudiKernel/ServiceHandle.h"
10
#include "
AthOnnxInterfaces/IOnnxRuntimeSvc.h
"
11
#include <fstream>
// std::fstream
12
13
static
const
InterfaceID
IID_PFEnergyPredictorTool
(
"PFEnergyPredictorTool"
, 1, 0);
14
class
eflowRecTrack
;
15
16
class
PFEnergyPredictorTool
:
public
AthAlgTool
17
{
18
public
:
19
PFEnergyPredictorTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent);
20
virtual
StatusCode
initialize
()
override
;
21
virtual
StatusCode
finalize
()
override
;
22
23
float
runOnnxInference
(std::vector<float> &tensor)
const
;
24
static
const
InterfaceID&
interfaceID
();
25
26
float
nnEnergyPrediction
(
const
eflowRecTrack
*ptr)
const
;
27
void
NormalizeTensor
(std::vector<float> &tensor,
size_t
limit)
const
;
28
29
private
:
30
//mark as thread safe because we need to call the run function of Session, which is not const
31
//the onnx documentation states that this is thread safe
32
std::unique_ptr<Ort::Session> m_session
ATLAS_THREAD_SAFE
;
33
34
std::vector<const char *>
m_input_node_names
;
35
36
std::vector<const char *>
m_output_node_names
;
37
38
std::vector<int64_t>
m_input_node_dims
;
39
ServiceHandle<AthOnnx::IOnnxRuntimeSvc>
m_svc
{
this
,
"ONNXRuntimeSvc"
,
"AthOnnx::OnnxRuntimeSvc"
,
"CaloMuonScoreTool ONNXRuntimeSvc"
};
40
Gaudi::Property<std::string>
m_model_filepath
{
this
,
"ModelPath"
,
"////"
};
41
43
Gaudi::Property<float>
m_cellE_mean
{
this
,
"cellE_mean"
,-2.2852574689444385};
44
Gaudi::Property<float>
m_cellE_std
{
this
,
"cellE_std"
,2.0100506557174946};
45
Gaudi::Property<float>
m_cellPhi_std
{
this
,
"cellPhi_std"
,0.6916977411859621};
46
47
};
48
49
inline
const
InterfaceID&
PFEnergyPredictorTool::interfaceID
() {
return
IID_PFEnergyPredictorTool
; }
50
51
52
#endif
53
AthAlgTool.h
IOnnxRuntimeSvc.h
IID_PFEnergyPredictorTool
static const InterfaceID IID_PFEnergyPredictorTool("PFEnergyPredictorTool", 1, 0)
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
PFEnergyPredictorTool::ATLAS_THREAD_SAFE
std::unique_ptr< Ort::Session > m_session ATLAS_THREAD_SAFE
Definition
PFEnergyPredictorTool.h:32
PFEnergyPredictorTool::NormalizeTensor
void NormalizeTensor(std::vector< float > &tensor, size_t limit) const
Definition
PFEnergyPredictorTool.cxx:299
PFEnergyPredictorTool::runOnnxInference
float runOnnxInference(std::vector< float > &tensor) const
Definition
PFEnergyPredictorTool.cxx:93
PFEnergyPredictorTool::m_input_node_names
std::vector< const char * > m_input_node_names
Definition
PFEnergyPredictorTool.h:34
PFEnergyPredictorTool::m_cellE_std
Gaudi::Property< float > m_cellE_std
Definition
PFEnergyPredictorTool.h:44
PFEnergyPredictorTool::m_model_filepath
Gaudi::Property< std::string > m_model_filepath
Definition
PFEnergyPredictorTool.h:40
PFEnergyPredictorTool::finalize
virtual StatusCode finalize() override
Definition
PFEnergyPredictorTool.cxx:321
PFEnergyPredictorTool::m_output_node_names
std::vector< const char * > m_output_node_names
Definition
PFEnergyPredictorTool.h:36
PFEnergyPredictorTool::PFEnergyPredictorTool
PFEnergyPredictorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
PFEnergyPredictorTool.cxx:12
PFEnergyPredictorTool::nnEnergyPrediction
float nnEnergyPrediction(const eflowRecTrack *ptr) const
Definition
PFEnergyPredictorTool.cxx:132
PFEnergyPredictorTool::initialize
virtual StatusCode initialize() override
Definition
PFEnergyPredictorTool.cxx:18
PFEnergyPredictorTool::m_cellPhi_std
Gaudi::Property< float > m_cellPhi_std
Definition
PFEnergyPredictorTool.h:45
PFEnergyPredictorTool::m_cellE_mean
Gaudi::Property< float > m_cellE_mean
Normalization constants for the inputs to the onnx model.
Definition
PFEnergyPredictorTool.h:43
PFEnergyPredictorTool::interfaceID
static const InterfaceID & interfaceID()
Definition
PFEnergyPredictorTool.h:49
PFEnergyPredictorTool::m_input_node_dims
std::vector< int64_t > m_input_node_dims
Definition
PFEnergyPredictorTool.h:38
PFEnergyPredictorTool::m_svc
ServiceHandle< AthOnnx::IOnnxRuntimeSvc > m_svc
Definition
PFEnergyPredictorTool.h:39
ServiceHandle
Definition
ClusterMakerTool.h:36
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition
eflowRecTrack.h:49
type
Generated on
for ATLAS Offline Software by
1.17.0