ATLAS Offline Software
Loading...
Searching...
No Matches
EventReco::HyPERTtbarAllHadronicParser Class Reference

#include <HyPERTtbarAllHadronicParser.h>

Inheritance diagram for EventReco::HyPERTtbarAllHadronicParser:
Collaboration diagram for EventReco::HyPERTtbarAllHadronicParser:

Public Member Functions

 HyPERTtbarAllHadronicParser ()=default
 ~HyPERTtbarAllHadronicParser ()=default
void buildONNXInputs (const HyPERGraph &hyperGraph, HyPERModel &hyperModel) override
 This method takes the information from the graph object and builds the inputs for the onnxruntime object.
void getONNXOutputs (HyPERModel &hyperModel) override
 This method takes the information from the onnxruntime object and builds the outputs on the parser object.
void reconstructOutputs (const HyPERGraph &hyperGraph) override
 This method implements the reconstruction of the outputs from the parser object into physcally meaningful quantities.
std::vector< std::string > getLabels () override
 The following methods return the reconstruction labels, scores and related indices from the parser object.
std::vector< float > getScores () override
std::vector< std::vector< int > > getIndices () override
std::vector< std::vector< int > > getIds () override
float getClassificationScore () override
void clear () override
 This method clears the parser object.
virtual void printOutputsForValidation () const override

Public Attributes

std::vector< int64_t > m_edge_out_shape {}
std::vector< int64_t > m_hyperedge_out_shape {}
std::vector< std::vector< float > > m_edge_out {}
std::vector< std::vector< float > > m_hyperedge_out {}
std::vector< std::vector< int64_t > > m_reco_indices_out = {}
std::vector< float > m_reco_scores_out = {}
std::vector< std::string > m_reco_labels_out = {}

Private Attributes

std::vector< int64_t > m_l_edge_index_ = {{}, {}}
std::vector< int64_t > m_l_edge_index_shape
const std::string m_l_edge_index_name = "edge_index"
std::vector< float > m_l_edge_attr_s_ = {}
std::vector< int64_t > m_l_edge_attr_s_shape
const std::string m_l_edge_attr_s_name = "edge_attr_s"
std::vector< float > m_l_x_s_ = {}
std::vector< int64_t > m_l_x_s_shape
const std::string m_l_x_s_name = "x_s"
std::vector< int64_t > m_l_batch_ = {}
std::vector< int64_t > m_l_batch_shape
const std::string m_l_batch_name = "batch"
std::vector< int64_t > m_l_edge_index_h_ = {}
std::vector< int64_t > m_l_edge_index_h_shape
const std::string m_l_edge_index_h_name = "edge_index_h"
std::vector< int64_t > m_l_edge_index_h_batch_ = {}
std::vector< int64_t > m_l_edge_index_h_batch_shape
const std::string m_l_edge_index_h_batch_name = "edge_index_h_batch"
std::vector< float > m_l_u_s_
std::vector< int64_t > m_l_u_s_shape
const std::string m_l_u_s_name = "u_s"

Detailed Description

Definition at line 15 of file HyPERTtbarAllHadronicParser.h.

Constructor & Destructor Documentation

◆ HyPERTtbarAllHadronicParser()

EventReco::HyPERTtbarAllHadronicParser::HyPERTtbarAllHadronicParser ( )
default

◆ ~HyPERTtbarAllHadronicParser()

EventReco::HyPERTtbarAllHadronicParser::~HyPERTtbarAllHadronicParser ( )
default

Member Function Documentation

◆ buildONNXInputs()

void EventReco::HyPERTtbarAllHadronicParser::buildONNXInputs ( const HyPERGraph & hyperGraph,
HyPERModel & hyperModel )
overridevirtual

This method takes the information from the graph object and builds the inputs for the onnxruntime object.

Implements EventReco::HyPERParser.

Definition at line 13 of file HyPERTtbarAllHadronicParser.cxx.

14 {
15
16 // Build edge input tensors
17 std::vector<std::vector<int64_t>> l_edge_index_ = {{}, {}};
18 std::vector<std::vector<float>> l_edge_attr_s_ = {};
19 for (std::size_t i = 0; i < static_cast<std::size_t>(hyperGraph.nEdges());
20 i++) {
21 l_edge_index_[0].push_back(
22 static_cast<int64_t>(hyperGraph.getEdgeIndicesVector()[i].first));
23 l_edge_index_[1].push_back(
24 static_cast<int64_t>(hyperGraph.getEdgeIndicesVector()[i].second));
25 l_edge_attr_s_.push_back(hyperGraph.getEdgeFeats(i));
26 }
27
28 m_edge_out_shape = std::vector<int64_t>{
29 static_cast<int64_t>(l_edge_index_[0].size()),
30 static_cast<int64_t>(
31 1)}; // Currently only support binary classification for edges
32 // Edege attributes tensor
35 hyperModel.setInputs<float>(m_l_edge_attr_s_name, m_l_edge_attr_s_,
37 // Edge indices tensor
40 hyperModel.setInputs<int64_t>(m_l_edge_index_name, m_l_edge_index_,
42
43 // Build node input tensor
44 std::vector<std::vector<float>> l_x_s_ = {};
45 std::vector<int64_t> l_batch_ = {};
46 for (std::size_t i = 0; i < static_cast<std::size_t>(hyperGraph.nNodes());
47 i++) {
48 l_x_s_.push_back(hyperGraph.getNodeFeats(i));
49 l_batch_.push_back(static_cast<int64_t>(0));
50 }
51
52 // Node features tensor
54 hyperModel.setInputs<float>(m_l_x_s_name, m_l_x_s_, m_l_x_s_shape);
55 // Batch tensor
56 m_l_batch_shape = std::vector<int64_t>{static_cast<int64_t>(l_batch_.size())};
57 m_l_batch_ = l_batch_;
58 hyperModel.setInputs<int64_t>(m_l_batch_name, m_l_batch_, m_l_batch_shape);
59
60 // Build global input tensor
61 std::vector<std::vector<float>> l_u_s_ = {hyperGraph.getGlobalFeats()};
63 hyperModel.setInputs<float>(m_l_u_s_name, m_l_u_s_, m_l_u_s_shape);
64
65 // Build hyperedge input tensor
66 std::vector<std::vector<int64_t>> l_edge_index_h_ = {};
67 std::vector<int64_t> l_edge_index_h_batch_ = {};
68 bool h_batch_filled = false;
69 for (std::size_t i = 0;
70 i < static_cast<std::size_t>(hyperGraph.hyperEdgeOrder()); i++) {
71 std::vector<int64_t> e_m = {};
72 for (std::size_t j = 0;
73 j < static_cast<std::size_t>(hyperGraph.nHyperEdges()); j++) {
74 if (!h_batch_filled) {
75 l_edge_index_h_batch_.push_back(static_cast<int64_t>(0));
76 }
77 e_m.push_back(hyperGraph.getHyperEdgeIndices(j)[i]);
78 }
79 l_edge_index_h_.push_back(e_m);
80 h_batch_filled = true;
81 }
82
83 m_hyperedge_out_shape = std::vector<int64_t>{
84 static_cast<int64_t>(l_edge_index_h_[0].size()),
85 static_cast<int64_t>(
86 1)}; // Currently only support binary classification for hyperedges
87 // Hyperedge indices tensor
90 hyperModel.setInputs<int64_t>(m_l_edge_index_h_name, m_l_edge_index_h_,
92 // Hyperedge batch tensor
94 std::vector<int64_t>{static_cast<int64_t>(l_edge_index_h_batch_.size())};
95 m_l_edge_index_h_batch_ = l_edge_index_h_batch_;
96 hyperModel.setInputs<int64_t>(m_l_edge_index_h_batch_name,
99}
void flatTensorAndSetShape(const std::vector< std::vector< T > > &input, std::vector< T > &flatTensor, std::vector< int64_t > &shape)
Definition HyPERUtils.h:101
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ clear()

void EventReco::HyPERTtbarAllHadronicParser::clear ( )
overridevirtual

This method clears the parser object.

Implements EventReco::HyPERParser.

Definition at line 149 of file HyPERTtbarAllHadronicParser.cxx.

149 {
150 m_edge_out_shape.clear();
151 m_hyperedge_out_shape.clear();
152 m_edge_out.clear();
153 m_hyperedge_out.clear();
154 m_reco_indices_out.clear();
155 m_reco_scores_out.clear();
156 m_reco_labels_out.clear();
157
158 m_l_edge_index_.clear();
159 m_l_edge_index_shape.clear();
160 m_l_edge_attr_s_.clear();
161 m_l_edge_attr_s_shape.clear();
162 m_l_x_s_.clear();
163 m_l_x_s_shape.clear();
164 m_l_batch_.clear();
165 m_l_batch_shape.clear();
166 m_l_edge_index_h_.clear();
170 m_l_u_s_.clear();
171 m_l_u_s_shape.clear();
172}
std::vector< std::vector< int64_t > > m_reco_indices_out
std::vector< std::vector< float > > m_hyperedge_out
std::vector< std::vector< float > > m_edge_out

◆ getClassificationScore()

float EventReco::HyPERTtbarAllHadronicParser::getClassificationScore ( )
inlineoverridevirtual

Implements EventReco::HyPERParser.

Definition at line 36 of file HyPERTtbarAllHadronicParser.h.

36 {
37 throw std::runtime_error(
38 "HyPERTtbarAllHadronicModel:: There is no classification score for "
39 "the ttbar all-hadronic topology.");
40 }

◆ getIds()

std::vector< std::vector< int > > EventReco::HyPERTtbarAllHadronicParser::getIds ( )
inlineoverridevirtual

Implements EventReco::HyPERParser.

Definition at line 32 of file HyPERTtbarAllHadronicParser.h.

32 {
33 return {{1, 1, 1}, {1, 1, 1}};
34 }

◆ getIndices()

std::vector< std::vector< int > > EventReco::HyPERTtbarAllHadronicParser::getIndices ( )
inlineoverridevirtual

Implements EventReco::HyPERParser.

Definition at line 29 of file HyPERTtbarAllHadronicParser.h.

29 {
31 }
std::vector< std::vector< T > > vector2DTypeConverter(const std::vector< std::vector< V > > &input)
Definition HyPERUtils.h:70

◆ getLabels()

std::vector< std::string > EventReco::HyPERTtbarAllHadronicParser::getLabels ( )
inlineoverridevirtual

The following methods return the reconstruction labels, scores and related indices from the parser object.

This should be used after the reconstructOutputs method.

Implements EventReco::HyPERParser.

Definition at line 27 of file HyPERTtbarAllHadronicParser.h.

27{ return m_reco_labels_out; }

◆ getONNXOutputs()

void EventReco::HyPERTtbarAllHadronicParser::getONNXOutputs ( HyPERModel & hyperModel)
overridevirtual

This method takes the information from the onnxruntime object and builds the outputs on the parser object.

Implements EventReco::HyPERParser.

Definition at line 102 of file HyPERTtbarAllHadronicParser.cxx.

102 {
103
104 // Get model-specific output names
105 std::vector<std::string> outputNames = hyperModel.getOutputNames();
106
107 // Get model outputs
108 float* hyperedge_out = hyperModel.getOutputs<float>(outputNames[0]);
109 float* edge_out = hyperModel.getOutputs<float>(outputNames[1]);
110
114}
std::vector< std::vector< T > > convertONNXOutput(T *onnxOutput, const std::vector< int64_t > &shape)
Definition HyPERUtils.h:85

◆ getScores()

std::vector< float > EventReco::HyPERTtbarAllHadronicParser::getScores ( )
inlineoverridevirtual

Implements EventReco::HyPERParser.

Definition at line 28 of file HyPERTtbarAllHadronicParser.h.

28{ return m_reco_scores_out; }

◆ printOutputsForValidation()

void EventReco::HyPERTtbarAllHadronicParser::printOutputsForValidation ( ) const
overridevirtual

Implements EventReco::HyPERParser.

Definition at line 116 of file HyPERTtbarAllHadronicParser.cxx.

116 {
117 using namespace asg::msgUserCode;
118 setMsgLevel(MSG::INFO);
119 ANA_MSG_INFO("HYPEREDGE OUT:");
120 std::string row = "[";
121 for (const auto& i : m_hyperedge_out) {
122 for (const auto j : i) {
123 row += std::to_string(j) + ", ";
124 }
125 }
126 row += "],";
127 ANA_MSG_INFO(row);
128
129 ANA_MSG_INFO("EDGE OUT:");
130 row = "[";
131 for (const auto& i : m_edge_out) {
132 for (const auto j : i) {
133 row += std::to_string(j) + ", ";
134 }
135 }
136 row += "],";
137 ANA_MSG_INFO(row);
138}
#define ANA_MSG_INFO(xmsg,...)
Macro printing info messages.
row
Appending html table to final .html summary file.

◆ reconstructOutputs()

void EventReco::HyPERTtbarAllHadronicParser::reconstructOutputs ( const HyPERGraph & hyperGraph)
overridevirtual

This method implements the reconstruction of the outputs from the parser object into physcally meaningful quantities.

Implements EventReco::HyPERParser.

Definition at line 141 of file HyPERTtbarAllHadronicParser.cxx.

142 {
146}
void RecoTtbarAllHadronic(const HyPERGraph &hyperGraph, const scores &edge_scores, const scores &hyperedge_scores, indices &reco_indices, std::vector< float > &reco_scores, std::vector< std::string > &reco_labels)
Reconstruct the ttbar all hadronic topology.

Member Data Documentation

◆ m_edge_out

std::vector<std::vector<float> > EventReco::HyPERTtbarAllHadronicParser::m_edge_out {}

Definition at line 49 of file HyPERTtbarAllHadronicParser.h.

49{};

◆ m_edge_out_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_edge_out_shape {}

Definition at line 47 of file HyPERTtbarAllHadronicParser.h.

47{};

◆ m_hyperedge_out

std::vector<std::vector<float> > EventReco::HyPERTtbarAllHadronicParser::m_hyperedge_out {}

Definition at line 50 of file HyPERTtbarAllHadronicParser.h.

50{};

◆ m_hyperedge_out_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_hyperedge_out_shape {}

Definition at line 48 of file HyPERTtbarAllHadronicParser.h.

48{};

◆ m_l_batch_

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_batch_ = {}
private

Definition at line 67 of file HyPERTtbarAllHadronicParser.h.

67{};

◆ m_l_batch_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_batch_name = "batch"
private

Definition at line 69 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_batch_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_batch_shape
private

Definition at line 68 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_attr_s_

std::vector<float> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_attr_s_ = {}
private

Definition at line 61 of file HyPERTtbarAllHadronicParser.h.

61{};

◆ m_l_edge_attr_s_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_edge_attr_s_name = "edge_attr_s"
private

Definition at line 63 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_attr_s_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_attr_s_shape
private

Definition at line 62 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_index_

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_ = {{}, {}}
private

Definition at line 58 of file HyPERTtbarAllHadronicParser.h.

58{{}, {}};

◆ m_l_edge_index_h_

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_h_ = {}
private

Definition at line 70 of file HyPERTtbarAllHadronicParser.h.

70{};

◆ m_l_edge_index_h_batch_

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_h_batch_ = {}
private

Definition at line 73 of file HyPERTtbarAllHadronicParser.h.

73{};

◆ m_l_edge_index_h_batch_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_h_batch_name = "edge_index_h_batch"
private

Definition at line 75 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_index_h_batch_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_h_batch_shape
private

Definition at line 74 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_index_h_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_h_name = "edge_index_h"
private

Definition at line 72 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_index_h_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_h_shape
private

Definition at line 71 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_index_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_name = "edge_index"
private

Definition at line 60 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_edge_index_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_edge_index_shape
private

Definition at line 59 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_u_s_

std::vector<float> EventReco::HyPERTtbarAllHadronicParser::m_l_u_s_
private

Definition at line 76 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_u_s_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_u_s_name = "u_s"
private

Definition at line 78 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_u_s_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_u_s_shape
private

Definition at line 77 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_x_s_

std::vector<float> EventReco::HyPERTtbarAllHadronicParser::m_l_x_s_ = {}
private

Definition at line 64 of file HyPERTtbarAllHadronicParser.h.

64{};

◆ m_l_x_s_name

const std::string EventReco::HyPERTtbarAllHadronicParser::m_l_x_s_name = "x_s"
private

Definition at line 66 of file HyPERTtbarAllHadronicParser.h.

◆ m_l_x_s_shape

std::vector<int64_t> EventReco::HyPERTtbarAllHadronicParser::m_l_x_s_shape
private

Definition at line 65 of file HyPERTtbarAllHadronicParser.h.

◆ m_reco_indices_out

std::vector<std::vector<int64_t> > EventReco::HyPERTtbarAllHadronicParser::m_reco_indices_out = {}

Definition at line 52 of file HyPERTtbarAllHadronicParser.h.

52{};

◆ m_reco_labels_out

std::vector<std::string> EventReco::HyPERTtbarAllHadronicParser::m_reco_labels_out = {}

Definition at line 54 of file HyPERTtbarAllHadronicParser.h.

54{};

◆ m_reco_scores_out

std::vector<float> EventReco::HyPERTtbarAllHadronicParser::m_reco_scores_out = {}

Definition at line 53 of file HyPERTtbarAllHadronicParser.h.

53{};

The documentation for this class was generated from the following files: