*** HepMC_Version1.24/HepMC/GenEvent.h Mon Jul 14 22:34:57 2003 --- HepMC_Version1.24_Factor/HepMC/OLD/GenEvent.h Tue Oct 7 17:47:17 2003 *************** *** 20,50 **** // subject to some sort of selection criteria. Examples are given below // ( see HepMC::copy_if and std::copy ) ! namespace HepMC { ! // To create a list from an iterator, use: (i.e. for a list of particles); ! // #include ! // list thelist; ! // copy( evt->particles_begin(), evt->particles_end(), ! // back_inserter(thelist) ); ! // to create a list subject to a condition (predicate) use: ! // list thelist; ! // HepMC::copy_if( evt->particles_begin(), evt->particles_end(), ! // back_inserter(thelist), is_photon() ); ! // where is_photon() is a predicate like: ! // class is_photon { ! // public: ! // bool operator() ( const GenParticle* p ) { ! // if ( p && p->pdg_id() == 22 ) return 1; ! // return 0; ! // } ! // }; ! // which the user defines herself. ! template ! void copy_if( InputIterator first, InputIterator last, OutputIterator out, ! Predicate pred ) { ! for ( ; first != last; ++first ) { if ( pred(*first) ) out = *first; } ! } ! } // HepMC // Since a container of all vertices in the event is maintained, the time // required to loop over all vertices (or particles) is very fast -- and --- 20,26 ---- // subject to some sort of selection criteria. Examples are given below // ( see HepMC::copy_if and std::copy ) ! #include "HepMC/Utils.h" // Since a container of all vertices in the event is maintained, the time // required to loop over all vertices (or particles) is very fast -- and *************** *** 183,189 **** // not the reverse, which is consistent with STL, // see Musser, Derge, Saini 2ndEd. p. 69,70. class vertex_const_iterator : ! public std::forward_iterator{ // Iterates over all vertices in this event public: vertex_const_iterator( --- 159,165 ---- // not the reverse, which is consistent with STL, // see Musser, Derge, Saini 2ndEd. p. 69,70. class vertex_const_iterator : ! public std::iterator { // ANSI C++ FIX LESTER // Iterates over all vertices in this event public: vertex_const_iterator( *************** *** 218,224 **** m_vertex_barcodes.end() ); } class vertex_iterator : ! public std::forward_iterator{ // Iterates over all vertices in this event public: vertex_iterator( --- 194,200 ---- m_vertex_barcodes.end() ); } class vertex_iterator : ! public std::iterator { // ANSI C++ FIX LESTER // Iterates over all vertices in this event public: vertex_iterator( *************** *** 267,273 **** // } // class particle_const_iterator : ! public std::forward_iterator{ // Iterates over all vertices in this event public: particle_const_iterator( --- 243,249 ---- // } // class particle_const_iterator : ! public std::iterator { // ANSI C++ FIX LESTER // Iterates over all vertices in this event public: particle_const_iterator( *************** *** 302,308 **** m_particle_barcodes.end() ); } class particle_iterator : ! public std::forward_iterator{ // Iterates over all vertices in this event public: particle_iterator( const std::map::iterator& i ) --- 278,284 ---- m_particle_barcodes.end() ); } class particle_iterator : ! public std::iterator { // ANSI C++ FIX LESTER // Iterates over all vertices in this event public: particle_iterator( const std::map::iterator& i )