Fork me on GitHub

source: svn/trunk/Utilities/HepMC/src/SearchVector.cc@ 539

Last change on this file since 539 was 349, checked in by severine ovyn, 15 years ago

first test

File size: 871 bytes
RevLine 
[349]1//////////////////////////////////////////////////////////////////////////
2// Author: Lynn Garren
3// search vectors for a GenParicle* instance
4//////////////////////////////////////////////////////////////////////////
5
6#include "SearchVector.h"
7
8namespace HepMC {
9
10
11bool 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
18std::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
Note: See TracBrowser for help on using the repository browser.