6 #include "HepMC/Flow.h"
7 #include "HepMC/GenParticle.h"
8 #include "HepMC/GenVertex.h"
9 #include "HepMC/SearchVector.h"
14 : m_particle_owner(particle_owner)
18 m_particle_owner(inflow.m_particle_owner),
19 m_icode(inflow.m_icode)
30 std::swap( m_particle_owner, other.m_particle_owner );
31 m_icode.swap( other.m_icode );
35 ostr <<
"Flow(" << m_particle_owner <<
"): " << *
this << std::endl;
39 int num_indices )
const {
49 std::vector<GenParticle*> output;
50 for (
int i = code_index; i!=code_index+num_indices; ++i ) {
51 if (
icode(i)==code ) {
52 output.push_back(m_particle_owner);
61 int code_index,
int num_indices )
const
65 if ( !m_particle_owner )
return;
75 for (
int index = code_index; index!=code_index+num_indices;
77 if ( (*p)->flow(index)==code &&
not_in_vector(output,(*p)) ) {
78 output->push_back(*p);
79 (*p)->flow().connected_partners( output, code,
90 particles_begin( family );
92 particles_end( family ); ++p ) {
95 for (
int index = code_index; index!=code_index+num_indices;
97 if ( (*p)->flow(index)==code &&
not_in_vector(output,(*p)) ) {
98 output->push_back(*p);
99 (*p)->flow().connected_partners( output, code,
109 int code_index,
int num_indices )
const {
110 std::vector<GenParticle*> output;
111 std::vector<GenParticle*> visited_particles;
112 for (
int i = code_index; i!=code_index+num_indices; ++i ) {
113 if (
icode(i)==code ) {
114 visited_particles.push_back(m_particle_owner);
116 code_index, num_indices );
124 std::vector<HepMC::GenParticle*>*
126 int code,
int code_index,
127 int num_indices )
const
131 if ( !m_particle_owner )
return;
132 int count_partners = 0;
142 for (
int index = code_index; index!=code_index+num_indices;
144 if ( (*p)->flow(index)==code ) {
145 if ( *p!=m_particle_owner ) ++count_partners;
147 visited_particles->push_back(*p);
148 (*p)->flow().dangling_connected_partners( output,
149 visited_particles, code,
150 code_index, num_indices );
160 production_vertex()->
161 particles_begin( family );
163 particles_end( family );
167 for (
int index = code_index; index!=code_index+num_indices;
169 if ( (*p)->flow(index)==code ) {
170 if ( *p!=m_particle_owner ) ++count_partners;
172 visited_particles->push_back(*p);
173 (*p)->flow().dangling_connected_partners( output,
174 visited_particles, code,
175 code_index, num_indices );
182 if ( count_partners <= 1 ) output->push_back( m_particle_owner );
190 std::ostream& operator<<( std::ostream& ostr,
const Flow& f ) {
191 ostr << f.m_icode.size();
192 for ( std::map<int,int>::const_iterator i = f.m_icode.begin();
193 i != f.m_icode.end(); ++i ) {
194 ostr <<
" " << (*i).first <<
" " << (*i).second;
particle_iterator particles_begin(IteratorRange range=relatives)
begin particle range
void print(std::ostream &ostr=std::cout) const
print Flow information to ostr
std::vector< HepMC::GenParticle * > connected_partners(int code, int code_index=1, int num_indices=2) const
void swap(Flow &other)
swap
GenVertex * production_vertex() const
pointer to the production vertex
particle_iterator particles_end(IteratorRange)
end particle range
bool not_in_vector(std::vector< HepMC::GenParticle * > *, GenParticle *)
returns true if it cannot find GenParticle* in the vector
std::vector< HepMC::GenParticle * > dangling_connected_partners(int code, int code_index=1, int num_indices=2) const
GenVertex * end_vertex() const
pointer to the decay vertex
Flow(GenParticle *particle_owner=0)
default constructor
int icode(int code_index=1) const
flow code
The GenParticle class contains information about generated particles.