hepmc - Blame information for rev 266

Subversion Repositories:
Rev:
Rev Author Line No. Line
234 garren 1 //////////////////////////////////////////////////////////////////////////
2 // testPythiaCopies.cc
3 //
4 // garren@fnal.gov, January 2008
5 // Multiple events in memory at the same time
6 //////////////////////////////////////////////////////////////////////////
7  
8 #include <fstream>
9 #include <iostream>
10 #include "HepMC/PythiaWrapper.h"
11 #include "HepMC/IO_HEPEVT.h"
12 #include "HepMC/GenEvent.h"
13 #include "HepMC/CompareGenEvent.h"
14 #include "PythiaHelper.h"
15  
16 int main() {    
17     //
18     //........................................HEPEVT
19     // Pythia 6.1 uses HEPEVT with 4000 entries and 8-byte floating point
20     //  numbers. We need to explicitly pass this information to the
21     //  HEPEVT_Wrapper.
22     //
23     HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
24     HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
25     // 
26     //........................................PYTHIA INITIALIZATIONS
27     initPythia();
28     //
29     //........................................HepMC INITIALIZATIONS
30     //
31     // Instantiate an IO strategy for reading from HEPEVT.
32     HepMC::IO_HEPEVT hepevtio;
33     //
34     // open some output files
35     std::ofstream out1( "testPythiaOriginals.dat" );
36     std::ofstream out2( "testPythiaCopies1.dat" );
37     std::ofstream out3( "testPythiaCopies2.dat" );
38     //
39     //........................................EVENT LOOP
266 garren 40     for ( int i = 1; i <= 50; i++ ) {
234 garren 41         if ( i%50==1 ) std::cout << "Processing Event Number "
42                                  << i << std::endl;
43         call_pyevnt();      // generate one event with Pythia
44         // pythia pyhepc routine convert common PYJETS in common HEPEVT
45         call_pyhepc( 1 );
46         HepMC::GenEvent* evt = hepevtio.read_next_event();
47         // set number of multi parton interactions
48         evt->set_mpi( pypars.msti[31-1] );
49         //
50         //.......................make some copies
51         evt->print(out1);
52         HepMC::GenEvent ec = (*evt);
53         ec.print(out2);
54         HepMC::GenEvent* evt4 = new HepMC::GenEvent(*evt);
55         evt4->print(out3);
56         if( !compareGenEvent(evt,evt4) ) {
57            std::cerr << "testPythiaCopies: GenEvent comparison fails at event "
58                      << evt->event_number() << std::endl;
59            return -1;
60         }
61         //
62         // now delete the created events from memory
63         delete evt;
64         delete evt4;
65     }
66     //........................................TERMINATION
67     // write out some information from Pythia to the screen
68     call_pystat( 1 );    
69     std::cout << "testPythiaCopies: event comparison is successful" << std::endl;
70  
71     return 0;
72 }
73  
74  
75