Skip to content

Commit

Permalink
ParticleID fixed and it compiles now
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanki0396 committed Aug 5, 2024
1 parent d3e7135 commit 0269c72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 35 deletions.
22 changes: 5 additions & 17 deletions include/ral/ParticleID.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,7 +24,7 @@ namespace ParticleID {
*
*/
ROOT::VecOps::RVec<int>
get_type(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
get_type(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles);

/**
* Get PDG member from ParticleIDs
Expand All @@ -36,7 +36,7 @@ get_type(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
*
*/
ROOT::VecOps::RVec<int>
get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles);

/**
* Get algorithmType member from ParticleIDs
Expand All @@ -48,7 +48,7 @@ get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
*
*/
ROOT::VecOps::RVec<int>
get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles);

/**
* Get likelihood member from ParticleIDs
Expand All @@ -60,19 +60,7 @@ get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
*
*/
ROOT::VecOps::RVec<float>
get_likelihood(ROOT::VecOps::RVec<edm4hep::ParticleID> 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<ROOT::VecOps::RVec<float>>
get_parameters(ROOT::VecOps::RVec<edm4hep::ParticleID> particles);
get_likelihood(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles);

} // namespace ParticleID
} // namespace k4::ral
Expand Down
26 changes: 8 additions & 18 deletions src/ParticleID.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,44 @@ namespace k4::ral {
namespace ParticleID {

ROOT::VecOps::RVec<int>
get_type(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) {
get_type(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles) {
ROOT::VecOps::RVec<int> 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<int>
get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) {
get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles) {
ROOT::VecOps::RVec<int> 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<int>
get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) {
get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles) {
ROOT::VecOps::RVec<int> 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<float>
get_likelihood(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) {
get_likelihood(ROOT::VecOps::RVec<edm4hep::ParticleIDData> particles) {
ROOT::VecOps::RVec<float> 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<ROOT::VecOps::RVec<float>>
get_parameters(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) {
ROOT::VecOps::RVec<ROOT::VecOps::RVec<float>> result;
result.reserve(particles.size());
for (edm4hep::ParticleID p : particles) {
result.emplace_back(p.parameters);
}
return result;
}

} // namespace ParticleID
} // namespace k4::ral

0 comments on commit 0269c72

Please sign in to comment.