-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new print method and basic analyzers for ParticleID
- Loading branch information
1 parent
bab9854
commit d3e7135
Showing
5 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#ifndef PARTICLEID_ANALYZERS_H | ||
#define PARTICLEID_ANALYZERS_H | ||
|
||
#include "ROOT/RVec.hxx" | ||
#include "edm4hep/ParticleID.h" | ||
|
||
/** | ||
* Main namespace of the library | ||
*/ | ||
namespace k4::ral { | ||
|
||
/** | ||
* Englobe analyzers that acts on the ParticleID class | ||
*/ | ||
namespace ParticleID { | ||
|
||
/** | ||
* Get type member from ParticleIDs | ||
* | ||
* Analyzer that can be use to obtain the type member in the class | ||
* ParticleID from edm4hep | ||
* | ||
* @param particles List of particle id in an event | ||
* | ||
*/ | ||
ROOT::VecOps::RVec<int> | ||
get_type(ROOT::VecOps::RVec<edm4hep::ParticleID> particles); | ||
|
||
/** | ||
* Get PDG member from ParticleIDs | ||
* | ||
* Analyzer that can be use to obtain the PDG member in the class | ||
* ParticleID from edm4hep | ||
* | ||
* @param particles List of particle id in an event | ||
* | ||
*/ | ||
ROOT::VecOps::RVec<int> | ||
get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleID> particles); | ||
|
||
/** | ||
* Get algorithmType member from ParticleIDs | ||
* | ||
* Analyzer that can be use to obtain the algorithmType member in the class | ||
* ParticleID from edm4hep | ||
* | ||
* @param particles List of particle id in an event | ||
* | ||
*/ | ||
ROOT::VecOps::RVec<int> | ||
get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleID> particles); | ||
|
||
/** | ||
* Get likelihood member from ParticleIDs | ||
* | ||
* Analyzer that can be use to obtain the likelihood member in the class | ||
* ParticleID from edm4hep | ||
* | ||
* @param particles List of particle id in an event | ||
* | ||
*/ | ||
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); | ||
|
||
} // namespace ParticleID | ||
} // namespace k4::ral | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "ral/ParticleID.h" | ||
|
||
namespace k4::ral { | ||
|
||
namespace ParticleID { | ||
|
||
ROOT::VecOps::RVec<int> | ||
get_type(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) { | ||
ROOT::VecOps::RVec<int> result; | ||
result.reserve(particles.size()); | ||
for (edm4hep::ParticleID p : particles) { | ||
result.emplace_back(p.type); | ||
} | ||
return result; | ||
} | ||
|
||
ROOT::VecOps::RVec<int> | ||
get_PDG(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) { | ||
ROOT::VecOps::RVec<int> result; | ||
result.reserve(particles.size()); | ||
for (edm4hep::ParticleID p : particles) { | ||
result.emplace_back(p.PDG); | ||
} | ||
return result; | ||
} | ||
|
||
ROOT::VecOps::RVec<int> | ||
get_algorithmType(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) { | ||
ROOT::VecOps::RVec<int> result; | ||
result.reserve(particles.size()); | ||
for (edm4hep::ParticleID p : particles) { | ||
result.emplace_back(p.algorithmType); | ||
} | ||
return result; | ||
} | ||
|
||
ROOT::VecOps::RVec<float> | ||
get_likelihood(ROOT::VecOps::RVec<edm4hep::ParticleID> particles) { | ||
ROOT::VecOps::RVec<float> result; | ||
result.reserve(particles.size()); | ||
for (edm4hep::ParticleID 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters