10 #ifndef HEPMC3_RELATIVES_H 11 #define HEPMC3_RELATIVES_H 56 virtual std::vector<GenParticlePtr>
operator()(GenParticlePtr input)
const = 0;
58 virtual std::vector<ConstGenParticlePtr>
operator()(ConstGenParticlePtr input)
const = 0;
60 virtual std::vector<GenParticlePtr>
operator()(GenVertexPtr input)
const = 0;
62 virtual std::vector<ConstGenParticlePtr>
operator()(ConstGenVertexPtr input)
const = 0;
77 template<
typename Relative_type>
84 GenParticles_type<GenParticlePtr>
operator()(GenParticlePtr input)
const override {
return _internal(input);}
86 GenParticles_type<ConstGenParticlePtr>
operator()(ConstGenParticlePtr input)
const override {
return _internal(input);}
88 GenParticles_type<GenVertexPtr>
operator()(GenVertexPtr input)
const override {
return _internal(input);}
90 GenParticles_type<ConstGenVertexPtr>
operator()(ConstGenVertexPtr input)
const override {
return _internal(input);}
93 Relative_type _internal;
96 template<
typename Relation_type>
100 template<
typename GenObject_type>
101 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const {
111 template<
typename GenObject_type,
typename dummy>
112 GenParticles_type<GenObject_type>
_recursive(GenObject_type input)
const;
115 GenParticles_type<GenVertexPtr>
_recursive(GenVertexPtr input)
const {
116 GenParticles_type <GenVertexPtr> results;
117 if ( !input )
return results;
119 if (v->id() == input->id())
return results;
125 results.emplace_back(p);
126 GenParticles_type <GenVertexPtr> tmp =
_recursive(p);
127 results.insert(results.end(),
128 std::make_move_iterator(tmp.begin()),
129 std::make_move_iterator(tmp.end()));
136 GenParticles_type<ConstGenVertexPtr>
_recursive(ConstGenVertexPtr input)
const {
137 GenParticles_type <ConstGenVertexPtr> results;
138 if ( !input )
return results;
140 if (v->id() == input->id())
return results;
146 results.emplace_back(p);
147 GenParticles_type <ConstGenVertexPtr> tmp =
_recursive(p);
148 results.insert(results.end(),
149 std::make_move_iterator(tmp.begin()),
150 std::make_move_iterator(tmp.end()));
157 GenParticles_type<GenParticlePtr>
_recursive(GenParticlePtr input)
const {
161 GenParticles_type<ConstGenParticlePtr>
_recursive(ConstGenParticlePtr input)
const {
172 virtual int id()
const = 0;
175 template<
typename ID_type>
198 template<
typename GenObject_type,
typename dummy>
199 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const;
202 template<typename GenObject_type, typename std::enable_if<std::is_same<GenVertex, typename std::remove_const<typename GenObject_type::element_type>::type>::value,
int*>::type =
nullptr>
203 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const {
return input->particles_in();}
206 template<typename GenObject_type, typename std::enable_if<std::is_same<GenParticle, typename std::remove_const<typename GenObject_type::element_type>::type>::value,
int*>::type =
nullptr>
207 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const {
return (*
this)(
vertex(input));}
210 template<
typename GenObject_type>
211 GenVertex_type<GenObject_type>
vertex(GenObject_type input)
const {
return input->production_vertex();}
221 template<
typename GenObject_type,
typename dummy>
222 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const;
225 template<typename GenObject_type, typename std::enable_if<std::is_same<GenVertex, typename std::remove_const<typename GenObject_type::element_type>::type>::value,
int*>::type =
nullptr>
226 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const {
return input->particles_out();}
229 template<typename GenObject_type, typename std::enable_if<std::is_same<GenParticle, typename std::remove_const<typename GenObject_type::element_type>::type>::value,
int*>::type =
nullptr>
230 GenParticles_type<GenObject_type>
operator()(GenObject_type input)
const {
return (*
this)(
vertex(input));}
233 template<
typename GenObject_type>
234 GenVertex_type<GenObject_type>
vertex(GenObject_type input)
const {
return input->end_vertex();}
243 std::vector<HepMC3::ConstGenParticlePtr>
children_particles(HepMC3::ConstGenVertexPtr O);
245 std::vector<HepMC3::ConstGenVertexPtr>
children_vertices(HepMC3::ConstGenParticlePtr O);
250 std::vector<HepMC3::GenParticlePtr>
parent_particles(HepMC3::GenVertexPtr O);
251 std::vector<HepMC3::ConstGenParticlePtr>
parent_particles(HepMC3::ConstGenVertexPtr O);
252 std::vector<HepMC3::GenVertexPtr>
parent_vertices(HepMC3::GenParticlePtr O);
253 std::vector<HepMC3::ConstGenVertexPtr>
parent_vertices(HepMC3::ConstGenParticlePtr O);
262 std::vector<HepMC3::ConstGenVertexPtr>
descendant_vertices(HepMC3::ConstGenParticlePtr obj);
266 std::vector<HepMC3::ConstGenParticlePtr>
ancestor_particles(HepMC3::ConstGenVertexPtr obj);
268 std::vector<HepMC3::ConstGenParticlePtr>
ancestor_particles(HepMC3::ConstGenParticlePtr obj);
270 std::vector<HepMC3::ConstGenVertexPtr>
ancestor_vertices(HepMC3::ConstGenParticlePtr obj);
272 std::vector<HepMC3::ConstGenVertexPtr>
ancestor_vertices(HepMC3::ConstGenVertexPtr obj);
std::vector< HepMC3::GenVertexPtr > grandchildren_vertices(HepMC3::GenVertexPtr O)
Return grandchildren vertices.
Provides operator to find the child particles of a Vertex or Particle.
std::vector< HepMC3::GenVertexPtr > grandparent_vertices(HepMC3::GenVertexPtr O)
Return grandparent vertices.
std::vector< HepMC3::GenParticlePtr > grandchildren_particles(HepMC3::GenParticlePtr O)
Return grandchildren particles.
Definition of class GenParticle.
GenParticles_type< ConstGenVertexPtr > operator()(ConstGenVertexPtr input) const override
Operator.
GenParticles_type< ConstGenVertexPtr > _recursive(ConstGenVertexPtr input) const
recursive
static const Children CHILDREN
Children.
std::vector< hasId * > m_checkedObjects
Checked objects.
std::vector< HepMC3::GenParticlePtr > children_particles(HepMC3::GenVertexPtr O)
Return children particles.
std::vector< HepMC3::ConstGenVertexPtr > ancestor_vertices(HepMC3::ConstGenParticlePtr obj)
Return ancestor vertices.
Provides operator to find the parent particles of a Vertex or Particle.
forward declare the Relatives interface in which _parents and _children are wrapped ...
std::vector< HepMC3::GenVertexPtr > children_vertices(HepMC3::GenParticlePtr O)
Return children vertices.
static thread_local const Ancestors ANCESTORS
Ancestors.
Definition of class GenVertex.
GenVertex_type< GenObject_type > vertex(GenObject_type input) const
operator
GenParticles_type< GenObject_type > operator()(GenObject_type input) const
Operator.
GenParticles_type< GenObject_type > operator()(GenObject_type input) const
operator
Define a common interface that all Relatives objects will satisfy Relatives provides an operator to g...
constexpr idInterface(ID_type genObject)
idInterface
static thread_local const Descendants DESCENDANTS
Descendants.
GenParticles_type< GenObject_type > operator()(GenObject_type input) const
operator
GenParticles_type< ConstGenParticlePtr > _recursive(ConstGenParticlePtr input) const
recursive
std::vector< HepMC3::GenVertexPtr > parent_vertices(HepMC3::GenParticlePtr O)
Return parent vertices.
GenParticles_type< GenParticlePtr > _recursive(GenParticlePtr input) const
recursive
GenParticles_type< GenVertexPtr > operator()(GenVertexPtr input) const override
Operator.
forward declare the recursion wrapper
std::vector< HepMC3::GenParticlePtr > parent_particles(HepMC3::GenVertexPtr O)
Return parent particles.
GenVertex_type< GenObject_type > vertex(GenObject_type input) const
vertex
GenParticles_type< GenParticlePtr > operator()(GenParticlePtr input) const override
Operator.
GenParticles_type< GenVertexPtr > _recursive(GenVertexPtr input) const
recursive
std::vector< HepMC3::ConstGenVertexPtr > descendant_vertices(HepMC3::ConstGenParticlePtr obj)
Return descendant vertices.
Relation_type m_applyRelation
applyRelation
static const Parents PARENTS
Parents.
int id() const override
id
ID_type m_object
id of object
std::vector< HepMC3::ConstGenParticlePtr > descendant_particles(HepMC3::ConstGenVertexPtr obj)
Return descendant particles.
std::vector< HepMC3::GenParticlePtr > grandparent_particles(HepMC3::GenParticlePtr O)
Return grandparent particles.
virtual std::vector< GenParticlePtr > operator()(GenParticlePtr input) const =0
Operator.
virtual int id() const =0
id
GenParticles_type< ConstGenParticlePtr > operator()(ConstGenParticlePtr input) const override
Operator.
GenParticles_type< GenObject_type > _recursive(GenObject_type input) const
recursive
virtual ~hasId()
destructor
std::vector< HepMC3::ConstGenParticlePtr > ancestor_particles(HepMC3::ConstGenVertexPtr obj)
Return ancestor particles.