#include <TruthNavigationDecorator.h>
|
SG::ReadHandleKeyArray< xAOD::TruthParticleContainer > | m_inputKeys {this, "InputCollections", {}, "Input truth particle collection keys"} |
| Parameter: input particle collections. More...
|
|
SG::ReadHandleKey< xAOD::TruthEventContainer > | m_truthEventKey {this, "TruthEventKey", "TruthEvents", "SG key for the TruthEvent container"} |
|
SG::WriteDecorHandleKeyArray< xAOD::TruthParticleContainer, std::vector< ElementLink< xAOD::TruthParticleContainer > > > | m_parentLinksDecorKeys {this, "DoNotSet_parentDecorKeys", {}, "WriteHandleKeyArray - set internally but must be property"} |
| Decor keys. More...
|
|
SG::WriteDecorHandleKeyArray< xAOD::TruthParticleContainer, std::vector< ElementLink< xAOD::TruthParticleContainer > > > | m_childLinksDecorKeys {this, "DoNotSet_childDecorKeys", {}, "WriteHandleKeyArray - set internally but must be property"} |
|
Definition at line 27 of file TruthNavigationDecorator.h.
◆ TruthNavigationDecorator()
DerivationFramework::TruthNavigationDecorator::TruthNavigationDecorator |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~TruthNavigationDecorator()
DerivationFramework::TruthNavigationDecorator::~TruthNavigationDecorator |
( |
| ) |
|
◆ addBranches()
StatusCode DerivationFramework::TruthNavigationDecorator::addBranches |
( |
| ) |
const |
|
virtual |
Definition at line 51 of file TruthNavigationDecorator.cxx.
54 const EventContext& ctx = Gaudi::Hive::currentContext();
58 if (!truthEvents.isValid()) {
60 return StatusCode::FAILURE;
64 std::vector<SG::ReadHandle<xAOD::TruthParticleContainer> > inputParticles;
71 std::map<int,ElementLink<xAOD::TruthParticleContainer> > linkMap;
72 for (
auto& coll : inputParticles){
73 for (
size_t p=0;
p<coll.ptr()->
size();++
p){
74 if (!coll.ptr()->at(
p))
continue;
75 if (linkMap.find(
HepMC::uniqueID(coll.ptr()->at(
p))) != linkMap.end())
continue;
87 std::map< int , std::vector<ElementLink<xAOD::TruthParticleContainer> > > parentMap;
88 std::map< int , std::vector<ElementLink<xAOD::TruthParticleContainer> > > childMap;
91 std::vector<int> seen_particles(20);
94 for (
size_t p=0;
p<
event->nTruthParticles();++
p){
95 if (!
event->truthParticle(
p))
continue;
98 std::vector<ElementLink<xAOD::TruthParticleContainer> >
parents;
99 std::vector<ElementLink<xAOD::TruthParticleContainer> >
children;
101 seen_particles.clear();
103 seen_particles.clear();
113 unsigned int pCntr{0};
114 for (
auto coll : inputParticles){
115 if (parent_decorator.at(pCntr).isAvailable()) {
119 for (
size_t p=0;
p<coll.ptr()->
size();++
p){
120 if (!coll.ptr()->at(
p))
continue;
121 parent_decorator.at(pCntr)(*coll.ptr()->at(
p)) = parentMap[
HepMC::uniqueID(coll->at(
p)) ];
122 child_decorator.at(pCntr)(*coll.ptr()->at(
p)) = childMap[
HepMC::uniqueID(coll->at(
p)) ];
127 return StatusCode::SUCCESS;
◆ find_children()
Helper function for finding all the children of a particle.
Definition at line 152 of file TruthNavigationDecorator.cxx.
162 for (
size_t child=0;child<
part->nChildren();++child){
163 if (!
part->child(child))
continue;
◆ find_parents()
◆ initialize()
StatusCode DerivationFramework::TruthNavigationDecorator::initialize |
( |
| ) |
|
◆ m_childLinksDecorKeys
◆ m_inputKeys
◆ m_parentLinksDecorKeys
◆ m_truthEventKey
The documentation for this class was generated from the following files:
void find_children(const xAOD::TruthParticle *part, std::vector< ElementLink< xAOD::TruthParticleContainer > > &parents, std::map< int, ElementLink< xAOD::TruthParticleContainer > > &linkMap, std::vector< int > &seen_particles) const
Helper function for finding all the children of a particle.
void find_parents(const xAOD::TruthParticle *part, std::vector< ElementLink< xAOD::TruthParticleContainer > > &parents, std::map< int, ElementLink< xAOD::TruthParticleContainer > > &linkMap, std::vector< int > &seen_particles) const
Helper function for finding all the parents of a particle.