11 #include "HepMC/Search/FindParticles.h" 12 #include "HepMC/Search/FilterList.h" 13 #include "HepMC/Search/Filter.h" 15 #include "HepMC/GenEvent.h" 16 #include "HepMC/GenVertex.h" 17 #include "HepMC/GenParticle.h" 27 if( filter_type == FIND_LAST )
m_results.clear();
31 if( filter_type == FIND_FIRST )
return;
40 case FIND_ALL_ANCESTORS:
41 if( !p->production_vertex() )
break;
45 case FIND_ALL_DESCENDANTS:
46 if( !p->end_vertex() )
break;
51 if( !p->production_vertex() )
break;
53 FOREACH(
const GenParticlePtr &p_in, p->production_vertex()->particles_in() ) {
61 if( !p->end_vertex() )
break;
63 FOREACH(
const GenParticlePtr &p_out, p->end_vertex()->particles_out() ) {
70 case FIND_PRODUCTION_SIBLINGS:
71 if( !p->end_vertex() )
break;
73 FOREACH(
const GenParticlePtr &p_in, p->end_vertex()->particles_in() ) {
87 case FIND_ALL_ANCESTORS:
90 case FIND_ALL_DESCENDANTS:
107 case FIND_PRODUCTION_SIBLINGS:
109 throw Exception(
"Invalid filter type provided for FindParticles(GenVertexPtr)");
119 for(
unsigned int i=0; i<
m_results.size(); ++i) {
123 if( first_null < 0 ) first_null = i;
126 if( first_null >= 0 ) {
133 if( first_null >= 0 )
m_results.resize( first_null );
137 if( filter_list.
filters().size() == 0 )
return true;
143 DEBUG( 10,
"Filter: passed" )
150 if( v_list->id() == v->id() )
return;
161 if( !p_in->production_vertex() )
continue;
169 if( v_list->id() == v->id() )
return;
179 if( !p_out->end_vertex() )
continue;
const std::vector< GenParticlePtr > & particles() const
Get list of particles (const)
List of filters for the search engine.
bool passed_all_filters(const GenParticlePtr &p, FilterList &filter_list)
Check if particle passed all filters.
Class used to define filters for search engine.
const vector< Filter > & filters()
Get list of filters.
Smart pointer for HepMC objects.
FindParticles(const GenEvent &evt, FilterEvent filter_type, FilterList filter_list=FilterList())
GenEvent-based constructor.
void narrow_down(FilterList filter_list)
Narrow down the results applying additional filters.
Stores event-related information.
vector< GenVertexPtr > m_checked_vertices
List of already checked vertices.
FilterType
List of methods of searching through all particles in the event.
bool passed_filter(const GenParticlePtr &p) const
Check if HepMC::GenParticle passed this filter.
void recursive_check_descendants(const GenVertexPtr &v, FilterList &filter_list)
Check if all descendants passed the filter.
void recursive_check_ancestors(const GenVertexPtr &v, FilterList &filter_list)
Check if all ancestors passed the filter.
Definition of template class SmartPointer.
vector< GenParticlePtr > m_results
List of results.
Relationship
List of methods of searching starting from a particle or vertex.