26std::vector<HepMC3::GenParticlePtr>
children(HepMC3::GenVertexPtr O) {
27 if (O)
return O->particles_out();
28 return std::vector<HepMC3::GenParticlePtr>();
31std::vector<HepMC3::ConstGenParticlePtr>
children(HepMC3::ConstGenVertexPtr O) {
32 if (O)
return O->particles_out();
33 return std::vector<HepMC3::ConstGenParticlePtr>();
36std::vector<HepMC3::GenVertexPtr>
children(HepMC3::GenParticlePtr O) {
37 std::vector<HepMC3::GenVertexPtr> result;
38 if (O->end_vertex()) result.push_back(O->end_vertex());
42std::vector<HepMC3::ConstGenVertexPtr>
children(HepMC3::ConstGenParticlePtr O) {
43 std::vector<HepMC3::ConstGenVertexPtr> result;
44 if (O->end_vertex()) result.push_back(O->end_vertex());
48std::vector<HepMC3::GenParticlePtr>
grandchildren(HepMC3::GenParticlePtr O) {
49 if (O)
if (O->end_vertex())
return O->end_vertex()->particles_out();
50 return std::vector<HepMC3::GenParticlePtr> ();
53std::vector<HepMC3::ConstGenParticlePtr>
grandchildren(HepMC3::ConstGenParticlePtr O) {
54 if (O)
if (O->end_vertex())
return O->end_vertex()->particles_out();
55 return std::vector<HepMC3::ConstGenParticlePtr> ();
58std::vector<HepMC3::GenVertexPtr>
grandchildren(HepMC3::GenVertexPtr O) {
59 std::vector<HepMC3::GenVertexPtr> result;
60 if (O)
for (
auto o: O->particles_out())
if (o->end_vertex()) result.push_back(o->end_vertex());
64std::vector<HepMC3::ConstGenVertexPtr>
grandchildren(HepMC3::ConstGenVertexPtr O) {
65 std::vector<HepMC3::ConstGenVertexPtr> result;
66 if (O)
for (
auto o:O->particles_out())
if (o->end_vertex()) result.push_back(o->end_vertex());
70std::vector<HepMC3::GenParticlePtr>
parents(HepMC3::GenVertexPtr O) {
71 if (O)
return O->particles_in();
72 return std::vector<GenParticlePtr>();
75std::vector<HepMC3::ConstGenParticlePtr>
parents(HepMC3::ConstGenVertexPtr O) {
76 if (O)
return O->particles_in();
77 return std::vector<HepMC3::ConstGenParticlePtr>();
80std::vector<HepMC3::GenVertexPtr>
parents(HepMC3::GenParticlePtr O) {
81 std::vector<HepMC3::GenVertexPtr> result;
82 if (O->production_vertex()) result.push_back(O->production_vertex());
86std::vector<HepMC3::ConstGenVertexPtr>
parents(HepMC3::ConstGenParticlePtr O) {
87 std::vector<HepMC3::ConstGenVertexPtr> result;
88 if (O->production_vertex()) result.push_back(O->production_vertex());
92std::vector<HepMC3::GenParticlePtr>
grandparents(HepMC3::GenParticlePtr O) {
93 if (O)
if (O->production_vertex())
return O->production_vertex()->particles_in();
94 return std::vector<HepMC3::GenParticlePtr> ();
97std::vector<HepMC3::ConstGenParticlePtr>
grandparents(HepMC3::ConstGenParticlePtr O) {
98 if (O)
if (O->production_vertex())
return O->production_vertex()->particles_in();
99 return std::vector<HepMC3::ConstGenParticlePtr> ();
102std::vector<HepMC3::GenVertexPtr>
grandparents(HepMC3::GenVertexPtr O) {
103 std::vector<HepMC3::GenVertexPtr> result;
104 if (O)
for (
auto o: O->particles_in())
if (o->production_vertex()) result.push_back(o->production_vertex());
108std::vector<HepMC3::ConstGenVertexPtr>
grandparents(HepMC3::ConstGenVertexPtr O) {
109 std::vector<HepMC3::ConstGenVertexPtr> result;
110 if (O)
for (
auto o:O->particles_in())
if (o->end_vertex()) result.push_back(o->production_vertex());
121 for (; gc < result.size(); gc++)
124 temp.insert(temp.end(), temp0.begin(), temp0.end());
126 for (
auto p2: temp)
if (std::find(result.begin(), result.end(), p2) == result.end()) result.push_back(p2);
127 if (gc >= result.size())
break;
134 std::vector<R> localchildren =
children(obj);
135 std::vector<R> result = localchildren;
136 for (
auto c: localchildren)
139 for (
auto d: desc)
if (std::find(result.begin(), result.end(), d) == result.end()) result.push_back(d);
151 for (; gc < result.size(); gc++)
154 temp.insert(temp.end(), temp0.begin(), temp0.end());
156 for (
auto p2: temp)
if (std::find(result.begin(), result.end(), p2) == result.end()) result.push_back(p2);
157 if (gc >= result.size())
break;
164 std::vector<R> localparents =
parents(obj);
165 std::vector<R> result = localparents;
166 for (
auto c: localparents)
169 for (
auto d: desc)
if (std::find(result.begin(), result.end(), d) == result.end()) result.push_back(d);
175 return descendants_of_other_type<HepMC3::ConstGenVertexPtr, HepMC3::ConstGenParticlePtr>(obj);
178 return descendants_of_other_type<HepMC3::GenVertexPtr, HepMC3::GenParticlePtr>(obj);
182 return descendants_of_other_type<HepMC3::ConstGenParticlePtr, HepMC3::ConstGenVertexPtr>(obj);
185 return descendants_of_other_type<HepMC3::GenParticlePtr, HepMC3::GenVertexPtr>(obj);
189 return ancestors_of_other_type<HepMC3::ConstGenVertexPtr, HepMC3::ConstGenParticlePtr>(obj);
192 return ancestors_of_other_type<HepMC3::GenVertexPtr, HepMC3::GenParticlePtr>(obj);
196 return ancestors_of_other_type<HepMC3::ConstGenParticlePtr, HepMC3::ConstGenVertexPtr>(obj);
199 return ancestors_of_other_type<HepMC3::GenParticlePtr, HepMC3::GenVertexPtr>(obj);
Defines helper classes to extract relatives of an input GenParticle or GenVertex.
static HEPMC3search_Relatives_EXPORT_API thread_local const Ancestors ANCESTORS
Ancestors.
static HEPMC3search_Relatives_EXPORT_API const Parents PARENTS
Parents.
static HEPMC3search_Relatives_EXPORT_API const Children CHILDREN
Children.
static HEPMC3search_Relatives_EXPORT_API thread_local const Descendants DESCENDANTS
Descendants.
std::vector< HepMC3::GenParticlePtr > grandparents(HepMC3::GenParticlePtr O)
Returns grandparents of particle, i.e. incoming particles of production vertex.
std::vector< HepMC3::GenParticlePtr > parents(HepMC3::GenVertexPtr O)
Returns parents of vertex, i.e. incoming particles.
std::vector< HepMC3::GenParticlePtr > grandchildren(HepMC3::GenParticlePtr O)
Returns grandchildren of particle, i.e. the outgoing particles of the end vertex.
std::vector< O > ancestors_of_same_type(O obj)
Returns ancestors of the same type, i.e. vertices for vertex and particles for particle.
std::vector< HepMC3::GenParticlePtr > parent_particles(HepMC3::GenVertexPtr O)
Return parent particles.
std::vector< HepMC3::ConstGenParticlePtr > ancestor_particles(HepMC3::ConstGenVertexPtr obj)
Return ancestor particles.
std::vector< HepMC3::GenParticlePtr > grandparent_particles(HepMC3::GenParticlePtr O)
Return grandparent particles.
std::vector< R > ancestors_of_other_type(O obj)
Returns ancestors of the other type, i.e. vertices for particle and particles for vertex.
std::vector< HepMC3::ConstGenVertexPtr > descendant_vertices(HepMC3::ConstGenParticlePtr obj)
Return descendant vertices.
std::vector< HepMC3::ConstGenVertexPtr > ancestor_vertices(HepMC3::ConstGenParticlePtr obj)
Return ancestor vertices.
RelativesInterface< Recursive< _children > > Descendants
Descendants is an alias to Recursion applied to the _children and wrapped in the Relatives interface.
RelativesInterface< Recursive< _parents > > Ancestors
Ancestors is an alias to Recursion applied to the _parents and wrapped in the Relatives interface.
std::vector< HepMC3::ConstGenParticlePtr > descendant_particles(HepMC3::ConstGenVertexPtr obj)
Return descendant particles.
std::vector< HepMC3::GenParticlePtr > children_particles(HepMC3::GenVertexPtr O)
Return children particles.
std::vector< HepMC3::GenVertexPtr > grandchildren_vertices(HepMC3::GenVertexPtr O)
Return grandchildren vertices.
std::vector< HepMC3::GenParticlePtr > grandchildren_particles(HepMC3::GenParticlePtr O)
Return grandchildren particles.
std::vector< R > descendants_of_other_type(O obj)
Returns descendands of the other type, i.e. vertices for particle and particles for vertex.
std::vector< HepMC3::GenVertexPtr > parent_vertices(HepMC3::GenParticlePtr O)
Return parent vertices.
std::vector< HepMC3::GenVertexPtr > children_vertices(HepMC3::GenParticlePtr O)
Return children vertices.
std::vector< HepMC3::GenParticlePtr > children(HepMC3::GenVertexPtr O)
Returns children of vertex, i.e. outgoing particles.
std::vector< O > descendants_of_same_type(O obj)
Returns descendands of the same type, i.e. vertices for vertex and particles for particle.
RelativesInterface< _parents > Parents
alias of _parents wrapped in the Relatives interface
RelativesInterface< _children > Children
alias of _children wrapped in the Relatives interface
std::vector< HepMC3::GenVertexPtr > grandparent_vertices(HepMC3::GenVertexPtr O)
Return grandparent vertices.