21 return StatusCode::SUCCESS;
29 std::vector<float> edge_scores;
33 std::vector<float> gEdgeFeatures =
getEdgeFeatures(edges, gNodeFeatures);
35 std::vector<Ort::Value> gInputTensor;
40 std::vector<float> gOutputData;
41 std::vector<Ort::Value> gOutputTensor;
46 for(
auto& v : edge_scores) {
47 v = 1.f / (1.f + std::exp(-v));
50 for (
size_t i = 0; i < edges.size(); i++) {
51 edges[i]->setEdgeScore(edge_scores[i]);
54 return StatusCode::SUCCESS;
59 std::vector<float> gNodeFeatures;
62 const float phi_binSize =
M_PI / 16.0;
64 float regionMin = phi_binSize * phiBin;
65 float referenceMin = 2.0 *
M_PI / 16.0;
66 float deltaPhi = referenceMin - regionMin;
70 bool flipEta = (etaSide == 0);
72 for(
const auto& hit : hits) {
73 std::map<std::string, float> features;
74 features[
"r"] = hit->getR();
75 features[
"phi"] = std::remainder(hit->getPhi() +
deltaPhi, 2*
M_PI);
76 features[
"z"] = flipEta ? -hit->getZ() : hit->getZ();
77 features[
"eta"] = flipEta ? -hit->getEta() : hit->getEta();
80 gNodeFeatures.push_back(
85 features[
"cluster_r_1"] = hit->getCluster1R();
86 features[
"cluster_phi_1"] = std::remainder(hit->getCluster1Phi() +
deltaPhi, 2*
M_PI);
87 features[
"cluster_z_1"] = flipEta ? -hit->getCluster1Z() : hit->getCluster1Z();
88 features[
"cluster_eta_1"] = flipEta ? -hit->getCluster1Eta() : hit->getCluster1Eta();
89 features[
"cluster_r_2"] = hit->getCluster2R();
90 features[
"cluster_phi_2"] = std::remainder(hit->getCluster2Phi() +
deltaPhi, 2*
M_PI);
91 features[
"cluster_z_2"] = flipEta ? -hit->getCluster2Z() : hit->getCluster2Z();
92 features[
"cluster_eta_2"] = flipEta ? -hit->getCluster2Eta() : hit->getCluster2Eta();
95 gNodeFeatures.push_back(
101 return gNodeFeatures;
106 std::vector<int64_t> rowIndices;
107 std::vector<int64_t> colIndices;
108 std::vector<int64_t> edgesList(edges.size() * 2);
110 for(
const auto& edge : edges) {
111 rowIndices.push_back(edge->getEdgeIndex1());
112 colIndices.push_back(edge->getEdgeIndex2());
115 std::copy(rowIndices.begin(), rowIndices.end(), edgesList.begin());
116 std::copy(colIndices.begin(), colIndices.end(), edgesList.begin() + edges.size());
123 std::vector<float> gEdgeFeatures;
125 for (
auto& edge : edges) {
128 gEdgeFeatures.push_back(edge->getEdgeDR());
129 gEdgeFeatures.push_back(edge->getEdgeDPhi());
130 gEdgeFeatures.push_back(edge->getEdgeDZ());
131 gEdgeFeatures.push_back(edge->getEdgeDEta());
132 gEdgeFeatures.push_back(edge->getEdgePhiSlope());
133 gEdgeFeatures.push_back(edge->getEdgeRPhiSlope());
136 return gEdgeFeatures;
143 std::map<std::string, float> hit1_features;
144 std::map<std::string, float> hit2_features;
161 float deta = hit2_features[
"eta"] - hit1_features[
"eta"];
162 float dz = hit2_features[
"z"] - hit1_features[
"z"];
163 float dr = hit2_features[
"r"] - hit1_features[
"r"];
165 float phislope = dr == 0. ? 0. : dphi / dr;
166 float rphislope = 0.5 * (hit2_features[
"r"] + hit1_features[
"r"]) * phislope;
169 edge->setEdgeDPhi(dphi);
171 edge->setEdgeDEta(deta);
172 edge->setEdgePhiSlope(phislope);
173 edge->setEdgeRPhiSlope(rphislope);
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_CHECK
Evaluate an expression and check for errors.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[