10 #ifndef HEPMC3_RELATIVES_H
11 #define HEPMC3_RELATIVES_H
22 class RelativesInterface;
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);