hepmc - Blame information for rev 128

Subversion Repositories:
Rev:
Rev Author Line No. Line
17 garren 1 //////////////////////////////////////////////////////////////////////////
2 // testHepMC.cc.in
3 //
4 // garren@fnal.gov, March 2006
128 garren 5 // based on example_EventSelection
17 garren 6 // Apply an event selection to the events in testHepMC.input
7 // Events containing a photon of pT > 25 GeV pass the selection and are
8 // written to "testHepMC.out"
88 garren 9 // Add arbitrary PDF information to the good events
128 garren 10 // Also write events using IO_AsciiParticles
17 garren 11 //////////////////////////////////////////////////////////////////////////
12 //
13  
128 garren 14 #include "HepMC/IO_GenEvent.h"
35 garren 15 #include "HepMC/IO_AsciiParticles.h"
17 garren 16 #include "HepMC/GenEvent.h"
17  
88 garren 18 // define methods and classes used by this test
19 #include "IsGoodEvent.h"
85 garren 20  
17 garren 21 int main() {
22 // declare an input strategy to read the data produced with the
23 // example_MyPythia
128 garren 24 HepMC::IO_GenEvent ascii_in("@srcdir@/testIOGenEvent.input",std::ios::in);
25 // declare another IO_GenEvent for writing out the good events
26 HepMC::IO_GenEvent ascii_out("testHepMC.out",std::ios::out);
35 garren 27 // declare an IO_AsciiParticle for output
28 HepMC::IO_AsciiParticles particle_out("testHepMCParticle.out",std::ios::out);
17 garren 29 // declare an instance of the event selection predicate
30 IsGoodEvent is_good_event;
31 //........................................EVENT LOOP
32 int icount=0;
33 int num_good_events=0;
34 HepMC::GenEvent* evt = ascii_in.read_next_event();
35 while ( evt ) {
36 icount++;
37 if ( icount%50==1 ) std::cout << "Processing Event Number " << icount
38 << " its # " << evt->event_number()
39 << std::endl;
40 if ( is_good_event(evt) ) {
41 ascii_out << evt;
35 garren 42 particle_out << evt;
17 garren 43 ++num_good_events;
44 }
85 garren 45  
46 // clean up and get next event
17 garren 47 delete evt;
48 ascii_in >> evt;
49 }
50 //........................................PRINT RESULT
51 std::cout << num_good_events << " out of " << icount
52 << " processed events passed the cuts. Finished." << std::endl;
53 }