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

#include <HyPERTtbarDiLeptonParser.h>

Inheritance diagram for EventReco::HyPERTtbarDiLeptonParser:
Collaboration diagram for EventReco::HyPERTtbarDiLeptonParser:

Public Member Functions

 HyPERTtbarDiLeptonParser ()=default
 ~HyPERTtbarDiLeptonParser ()=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
void clear () override
 This method clears the parser object.
virtual void printOutputsForValidation () const override
float getClassificationScore () override

Public Attributes

std::vector< int64_t > m_edge_out_shape {}
std::vector< int64_t > m_hyperedge_out_shape {}
std::vector< int64_t > m_classification_out_shape
std::vector< std::vector< float > > m_edge_out {}
std::vector< std::vector< float > > m_hyperedge_out {}
std::vector< std::vector< float > > m_classification_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 = {}
std::vector< std::vector< int64_t > > m_reco_ids_out = {}
float m_classification_score = -1.0f

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 = "batch_hyperedge"
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 HyPERTtbarDiLeptonParser.h.

Constructor & Destructor Documentation

◆ HyPERTtbarDiLeptonParser()

EventReco::HyPERTtbarDiLeptonParser::HyPERTtbarDiLeptonParser ( )
default

◆ ~HyPERTtbarDiLeptonParser()

EventReco::HyPERTtbarDiLeptonParser::~HyPERTtbarDiLeptonParser ( )
default

Member Function Documentation

◆ buildONNXInputs()

void EventReco::HyPERTtbarDiLeptonParser::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 HyPERTtbarDiLeptonParser.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::HyPERTtbarDiLeptonParser::clear ( )
overridevirtual

This method clears the parser object.

Implements EventReco::HyPERParser.

Definition at line 155 of file HyPERTtbarDiLeptonParser.cxx.

155 {
156 m_edge_out_shape.clear();
157 m_hyperedge_out_shape.clear();
158 m_edge_out.clear();
159 m_hyperedge_out.clear();
160 m_reco_indices_out.clear();
161 m_reco_scores_out.clear();
162 m_reco_labels_out.clear();
163 m_reco_ids_out.clear();
164 m_classification_out.clear();
166
167 m_l_edge_index_.clear();
168 m_l_edge_index_shape.clear();
169 m_l_edge_attr_s_.clear();
170 m_l_edge_attr_s_shape.clear();
171 m_l_x_s_.clear();
172 m_l_x_s_shape.clear();
173 m_l_batch_.clear();
174 m_l_batch_shape.clear();
175 m_l_edge_index_h_.clear();
179 m_l_u_s_.clear();
180 m_l_u_s_shape.clear();
181}
std::vector< std::vector< int64_t > > m_reco_ids_out
std::vector< std::vector< int64_t > > m_reco_indices_out
std::vector< std::vector< float > > m_classification_out
std::vector< std::vector< float > > m_hyperedge_out
std::vector< std::vector< float > > m_edge_out

◆ getClassificationScore()

float EventReco::HyPERTtbarDiLeptonParser::getClassificationScore ( )
inlineoverridevirtual

Implements EventReco::HyPERParser.

Definition at line 40 of file HyPERTtbarDiLeptonParser.h.

40{ return m_classification_score; }

◆ getIds()

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

Implements EventReco::HyPERParser.

Definition at line 33 of file HyPERTtbarDiLeptonParser.h.

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

◆ getIndices()

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

Implements EventReco::HyPERParser.

Definition at line 29 of file HyPERTtbarDiLeptonParser.h.

◆ getLabels()

std::vector< std::string > EventReco::HyPERTtbarDiLeptonParser::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 HyPERTtbarDiLeptonParser.h.

27{ return m_reco_labels_out; }

◆ getONNXOutputs()

void EventReco::HyPERTtbarDiLeptonParser::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 HyPERTtbarDiLeptonParser.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 float* classification_out = hyperModel.getOutputs<float>(outputNames[2]);
111
117}
std::vector< std::vector< T > > convertONNXOutput(T *onnxOutput, const std::vector< int64_t > &shape)
Definition HyPERUtils.h:85

◆ getScores()

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

Implements EventReco::HyPERParser.

Definition at line 28 of file HyPERTtbarDiLeptonParser.h.

28{ return m_reco_scores_out; }

◆ printOutputsForValidation()

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

Implements EventReco::HyPERParser.

Definition at line 119 of file HyPERTtbarDiLeptonParser.cxx.

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

◆ reconstructOutputs()

void EventReco::HyPERTtbarDiLeptonParser::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 147 of file HyPERTtbarDiLeptonParser.cxx.

148 {
152}
void RecoTtbarDiLepton(const HyPERGraph &hyperGraph, const scores &edge_scores, const scores &hyperedge_scores, const scores &classification_score, indices &reco_indices, std::vector< float > &reco_scores, std::vector< std::string > &reco_labels, std::vector< std::vector< int64_t > > &reco_ids, float &reco_classification_score)
Reconstruct the ttbar single lepton topology.

Member Data Documentation

◆ m_classification_out

std::vector<std::vector<float> > EventReco::HyPERTtbarDiLeptonParser::m_classification_out {}

Definition at line 50 of file HyPERTtbarDiLeptonParser.h.

50{};

◆ m_classification_out_shape

std::vector<int64_t> EventReco::HyPERTtbarDiLeptonParser::m_classification_out_shape
Initial value:
{
1, 1}

Definition at line 46 of file HyPERTtbarDiLeptonParser.h.

46 {
47 1, 1}; // This is just a single number.

◆ m_classification_score

float EventReco::HyPERTtbarDiLeptonParser::m_classification_score = -1.0f

Definition at line 56 of file HyPERTtbarDiLeptonParser.h.

◆ m_edge_out

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

Definition at line 48 of file HyPERTtbarDiLeptonParser.h.

48{};

◆ m_edge_out_shape

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

Definition at line 44 of file HyPERTtbarDiLeptonParser.h.

44{};

◆ m_hyperedge_out

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

Definition at line 49 of file HyPERTtbarDiLeptonParser.h.

49{};

◆ m_hyperedge_out_shape

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

Definition at line 45 of file HyPERTtbarDiLeptonParser.h.

45{};

◆ m_l_batch_

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

Definition at line 69 of file HyPERTtbarDiLeptonParser.h.

69{};

◆ m_l_batch_name

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

Definition at line 71 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_batch_shape

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

Definition at line 70 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_attr_s_

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

Definition at line 63 of file HyPERTtbarDiLeptonParser.h.

63{};

◆ m_l_edge_attr_s_name

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

Definition at line 65 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_attr_s_shape

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

Definition at line 64 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_index_

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

Definition at line 60 of file HyPERTtbarDiLeptonParser.h.

60{{}, {}};

◆ m_l_edge_index_h_

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

Definition at line 72 of file HyPERTtbarDiLeptonParser.h.

72{};

◆ m_l_edge_index_h_batch_

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

Definition at line 75 of file HyPERTtbarDiLeptonParser.h.

75{};

◆ m_l_edge_index_h_batch_name

const std::string EventReco::HyPERTtbarDiLeptonParser::m_l_edge_index_h_batch_name = "batch_hyperedge"
private

Definition at line 77 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_index_h_batch_shape

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

Definition at line 76 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_index_h_name

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

Definition at line 74 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_index_h_shape

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

Definition at line 73 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_index_name

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

Definition at line 62 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_edge_index_shape

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

Definition at line 61 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_u_s_

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

Definition at line 78 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_u_s_name

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

Definition at line 80 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_u_s_shape

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

Definition at line 79 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_x_s_

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

Definition at line 66 of file HyPERTtbarDiLeptonParser.h.

66{};

◆ m_l_x_s_name

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

Definition at line 68 of file HyPERTtbarDiLeptonParser.h.

◆ m_l_x_s_shape

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

Definition at line 67 of file HyPERTtbarDiLeptonParser.h.

◆ m_reco_ids_out

std::vector<std::vector<int64_t> > EventReco::HyPERTtbarDiLeptonParser::m_reco_ids_out = {}

Definition at line 55 of file HyPERTtbarDiLeptonParser.h.

55{};

◆ m_reco_indices_out

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

Definition at line 52 of file HyPERTtbarDiLeptonParser.h.

52{};

◆ m_reco_labels_out

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

Definition at line 54 of file HyPERTtbarDiLeptonParser.h.

54{};

◆ m_reco_scores_out

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

Definition at line 53 of file HyPERTtbarDiLeptonParser.h.

53{};

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