![]() |
HepMC Reference DocumentationHepMC |
00001 00002 // Author: Lynn Garren 00003 // search vectors for a GenParicle* instance 00005 00006 #include "HepMC/SearchVector.h" 00007 00008 namespace HepMC { 00009 00010 00011 bool not_in_vector( std::vector<GenParticle*>* v, GenParticle* p ) 00012 { 00013 if( already_in_vector(v,p) == v->end() ) return true; 00014 return false; 00015 } 00016 00018 std::vector<HepMC::GenParticle*>::iterator already_in_vector( std::vector<GenParticle*>* v, GenParticle* p ) 00019 { 00020 // if the vectors are mostly large, the search should be coded differently 00021 std::vector<GenParticle*>::iterator it; 00022 for( it = v->begin(); it != v->end(); ++it ) { 00023 // bail as soon as we find a match 00024 if( (*it) == p ) return it; 00025 } 00026 return v->end(); 00027 } 00028 00029 } // HepMC