HepMC Reference Documentation

HepMC

example_MyPythiaOnlyToHepMC.cc

Go to the documentation of this file.
00001 
00002 // Matt.Dobbs@Cern.CH, December 1999
00003 // November 2000, updated to use Pythia 6.1
00004 // example of generating events with Pythia 
00005 // using HepMC/PythiaWrapper.h 
00006 // Events are read into the HepMC event record from the FORTRAN HEPEVT 
00007 // common block using the IO_HEPEVT strategy -- nothing is done with them.
00008 // This program is just used to find the total time required to transfer
00009 // from HEPEVT into the HepMC event record.
00011 // To Compile: go to the HepMC directory and type:
00012 // gmake examples/example_MyPythiaOnlyTo HepMC.exe
00013 //
00014 // See comments in examples/example_MyPythia.cxx regarding the HEPEVT wrapper.
00015 //
00016 
00017 #include <iostream>
00018 #include "HepMC/PythiaWrapper.h"
00019 #include "HepMC/IO_HEPEVT.h"
00020 #include "HepMC/GenEvent.h"
00021 #include "PythiaHelper.h"
00022 
00023 int main() {    
00024     //
00025     //........................................HEPEVT
00026     // Pythia 6.1 uses HEPEVT with 4000 entries and 8-byte floating point
00027     //  numbers. We need to explicitly pass this information to the 
00028     //  HEPEVT_Wrapper.
00029     //
00030     HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
00031     HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
00032     //  
00033     //........................................PYTHIA INITIALIZATIONS
00034     initPythia();
00035     //
00036     //........................................HepMC INITIALIZATIONS
00037     //
00038     // Instantiate an IO strategy for reading from HEPEVT.
00039     HepMC::IO_HEPEVT hepevtio;
00040     //
00041     //........................................EVENT LOOP
00042     for ( int i = 1; i <= 100; i++ ) {
00043         if ( i%50==1 ) std::cout << "Processing Event Number " 
00044                                  << i << std::endl;
00045         call_pyevnt();      // generate one event with Pythia
00046         // pythia pyhepc routine convert common PYJETS in common HEPEVT
00047         call_pyhepc( 1 );
00048         HepMC::GenEvent* evt = hepevtio.read_next_event();
00049         // define the units (Pythia uses GeV and mm)
00050         evt->use_units(HepMC::Units::GEV, HepMC::Units::MM);
00051         // set number of multi parton interactions
00052         evt->set_mpi( pypars.msti[31-1] );
00053         // set cross section information
00054         evt->set_cross_section( getPythiaCrossSection() );
00055         //
00056         //.......................USER WOULD PROCESS EVENT HERE
00057         //
00058         // we also need to delete the created event from memory
00059         delete evt;
00060     }
00061     //........................................TERMINATION
00062     // write out some information from Pythia to the screen
00063     call_pystat( 1 );    
00064 
00065     return 0;
00066 }
00067 
00068 
00069  

Generated on Thu Jan 7 13:10:15 2010 for HepMC by  doxygen 1.4.7