]>
Commit | Line | Data |
---|---|---|
0ca57c2f | 1 | ////////////////////////////////////////////////////////////////////////// |
2 | // Author: Lynn Garren | |
3 | // search vectors for a GenParicle* instance | |
4 | ////////////////////////////////////////////////////////////////////////// | |
5 | ||
6 | #include "HepMC/SearchVector.h" | |
7 | ||
8 | namespace HepMC { | |
9 | ||
10 | ||
11 | bool not_in_vector( std::vector<GenParticle*>* v, GenParticle* p ) | |
12 | { | |
13 | if( already_in_vector(v,p) == v->end() ) return true; | |
14 | return false; | |
15 | } | |
16 | ||
17 | /// returns true if GenParticle is in the vector | |
18 | std::vector<HepMC::GenParticle*>::iterator already_in_vector( std::vector<GenParticle*>* v, GenParticle* p ) | |
19 | { | |
20 | // if the vectors are mostly large, the search should be coded differently | |
21 | std::vector<GenParticle*>::iterator it; | |
22 | for( it = v->begin(); it != v->end(); ++it ) { | |
23 | // bail as soon as we find a match | |
24 | if( (*it) == p ) return it; | |
25 | } | |
26 | return v->end(); | |
27 | } | |
28 | ||
29 | } // HepMC |