hepmc - Diff between revs 129 and 179
Subversion Repositories:
| Rev 129 | Rev 179 | |||
|---|---|---|---|---|
| Line 12... | Line 12... | |||
| 12 | #include "HepMC/IO_GenEvent.h" | 12 | #include "HepMC/IO_GenEvent.h" | |
| 13 | #include "HepMC/GenEvent.h" | 13 | #include "HepMC/GenEvent.h" | |
| 14 | 14 | |||
| 15 | //! example class | 15 | //! example class | |
| 16 | 16 | |||
| 17 | /// \class IsGoodEvent | - | ||
| - | 17 | /// \class IsEventGood | ||
| 18 | /// event selection predicate. returns true if the event contains | 18 | /// event selection predicate. returns true if the event contains | |
| 19 | /// a photon with pT > 50 GeV | 19 | /// a photon with pT > 50 GeV | |
| 20 | class IsGoodEvent { | - | ||
| - | 20 | class IsEventGood { | ||
| 21 | public: | 21 | public: | |
| 22 | /// check this event for goodness | 22 | /// check this event for goodness | |
| 23 | bool operator()( const HepMC::GenEvent* evt ) { | 23 | bool operator()( const HepMC::GenEvent* evt ) { | |
| 24 | for ( HepMC::GenEvent::particle_const_iterator p | 24 | for ( HepMC::GenEvent::particle_const_iterator p | |
| 25 | = evt->particles_begin(); p != evt->particles_end(); ++p ){ | 25 | = evt->particles_begin(); p != evt->particles_end(); ++p ){ | |
| Line 40... | Line 40... | |||
| 40 | { // begin scope of ascii_in and ascii_out | 40 | { // begin scope of ascii_in and ascii_out | |
| 41 | HepMC::IO_GenEvent ascii_in("example_MyPythia.dat",std::ios::in); | 41 | HepMC::IO_GenEvent ascii_in("example_MyPythia.dat",std::ios::in); | |
| 42 | // declare another IO_GenEvent for writing out the good events | 42 | // declare another IO_GenEvent for writing out the good events | |
| 43 | HepMC::IO_GenEvent ascii_out("example_EventSelection.dat",std::ios::out); | 43 | HepMC::IO_GenEvent ascii_out("example_EventSelection.dat",std::ios::out); | |
| 44 | // declare an instance of the event selection predicate | 44 | // declare an instance of the event selection predicate | |
| 45 | IsGoodEvent is_good_event; | - | ||
| - | 45 | IsEventGood is_good_event; | ||
| 46 | //........................................EVENT LOOP | 46 | //........................................EVENT LOOP | |
| 47 | int icount=0; | 47 | int icount=0; | |
| 48 | int num_good_events=0; | 48 | int num_good_events=0; | |
| 49 | HepMC::GenEvent* evt = ascii_in.read_next_event(); | 49 | HepMC::GenEvent* evt = ascii_in.read_next_event(); | |
| 50 | while ( evt ) { | 50 | while ( evt ) { | |
