From 0269c7219a88e85f1421db3ced4c885caa614804 Mon Sep 17 00:00:00 2001 From: Juan Carlos Aranda Huecas Date: Mon, 5 Aug 2024 08:37:40 +0200 Subject: [PATCH] ParticleID fixed and it compiles now --- include/ral/ParticleID.h | 22 +++++----------------- src/ParticleID.cc | 26 ++++++++------------------ 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/include/ral/ParticleID.h b/include/ral/ParticleID.h index 1a74d4c..13c6b64 100644 --- a/include/ral/ParticleID.h +++ b/include/ral/ParticleID.h @@ -2,7 +2,7 @@ #define PARTICLEID_ANALYZERS_H #include "ROOT/RVec.hxx" -#include "edm4hep/ParticleID.h" +#include "edm4hep/ParticleIDData.h" /** * Main namespace of the library @@ -24,7 +24,7 @@ namespace ParticleID { * */ ROOT::VecOps::RVec -get_type(ROOT::VecOps::RVec particles); +get_type(ROOT::VecOps::RVec particles); /** * Get PDG member from ParticleIDs @@ -36,7 +36,7 @@ get_type(ROOT::VecOps::RVec particles); * */ ROOT::VecOps::RVec -get_PDG(ROOT::VecOps::RVec particles); +get_PDG(ROOT::VecOps::RVec particles); /** * Get algorithmType member from ParticleIDs @@ -48,7 +48,7 @@ get_PDG(ROOT::VecOps::RVec particles); * */ ROOT::VecOps::RVec -get_algorithmType(ROOT::VecOps::RVec particles); +get_algorithmType(ROOT::VecOps::RVec particles); /** * Get likelihood member from ParticleIDs @@ -60,19 +60,7 @@ get_algorithmType(ROOT::VecOps::RVec particles); * */ ROOT::VecOps::RVec -get_likelihood(ROOT::VecOps::RVec particles); - -/** - * Get parameters member from ParticleIDs - * - * Analyzer that can be use to obtain the parameters member in the class - * ParticleID from edm4hep - * - * @param particles List of particle id in an event - * - */ -ROOT::VecOps::RVec> -get_parameters(ROOT::VecOps::RVec particles); +get_likelihood(ROOT::VecOps::RVec particles); } // namespace ParticleID } // namespace k4::ral diff --git a/src/ParticleID.cc b/src/ParticleID.cc index f2e0a69..65eb2f3 100644 --- a/src/ParticleID.cc +++ b/src/ParticleID.cc @@ -5,54 +5,44 @@ namespace k4::ral { namespace ParticleID { ROOT::VecOps::RVec -get_type(ROOT::VecOps::RVec particles) { +get_type(ROOT::VecOps::RVec particles) { ROOT::VecOps::RVec result; result.reserve(particles.size()); - for (edm4hep::ParticleID p : particles) { + for (edm4hep::ParticleIDData p : particles) { result.emplace_back(p.type); } return result; } ROOT::VecOps::RVec -get_PDG(ROOT::VecOps::RVec particles) { +get_PDG(ROOT::VecOps::RVec particles) { ROOT::VecOps::RVec result; result.reserve(particles.size()); - for (edm4hep::ParticleID p : particles) { + for (edm4hep::ParticleIDData p : particles) { result.emplace_back(p.PDG); } return result; } ROOT::VecOps::RVec -get_algorithmType(ROOT::VecOps::RVec particles) { +get_algorithmType(ROOT::VecOps::RVec particles) { ROOT::VecOps::RVec result; result.reserve(particles.size()); - for (edm4hep::ParticleID p : particles) { + for (edm4hep::ParticleIDData p : particles) { result.emplace_back(p.algorithmType); } return result; } ROOT::VecOps::RVec -get_likelihood(ROOT::VecOps::RVec particles) { +get_likelihood(ROOT::VecOps::RVec particles) { ROOT::VecOps::RVec result; result.reserve(particles.size()); - for (edm4hep::ParticleID p : particles) { + for (edm4hep::ParticleIDData p : particles) { result.emplace_back(p.likelihood); } return result; } -ROOT::VecOps::RVec> -get_parameters(ROOT::VecOps::RVec particles) { - ROOT::VecOps::RVec> result; - result.reserve(particles.size()); - for (edm4hep::ParticleID p : particles) { - result.emplace_back(p.parameters); - } - return result; -} - } // namespace ParticleID } // namespace k4::ral