Rev 76 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | garren | 1 | ////////////////////////////////////////////////////////////////////////// |
| 2 | // Matt.Dobbs@Cern.CH, December 1999 |
||
| 3 | // November 2000, updated to use Pythia 6.1 |
||
| 4 | // example of generating events with Pythia |
||
| 5 | // using HepMC/PythiaWrapper.h |
||
| 6 | // Events are read into the HepMC event record from the FORTRAN HEPEVT |
||
| 7 | // common block using the IO_HEPEVT strategy -- nothing is done with them. |
||
| 8 | // This program is just used to find the total time required to transfer |
||
| 9 | // from HEPEVT into the HepMC event record. |
||
| 10 | ////////////////////////////////////////////////////////////////////////// |
||
| 11 | // To Compile: go to the HepMC directory and type: |
||
| 12 | // gmake examples/example_MyPythiaOnlyTo HepMC.exe |
||
| 13 | // |
||
| 14 | // See comments in examples/example_MyPythia.cxx regarding the HEPEVT wrapper. |
||
| 15 | // |
||
| 16 | |||
| 17 | #include <iostream> |
||
| 18 | #include "HepMC/PythiaWrapper.h" |
||
| 19 | #include "HepMC/IO_HEPEVT.h" |
||
| 20 | #include "HepMC/GenEvent.h" |
||
| 21 | |||
| 22 | int main() { |
||
| 23 | // |
||
| 24 | //........................................HEPEVT |
||
| 25 | // Pythia 6.1 uses HEPEVT with 4000 entries and 8-byte floating point |
||
| 26 | // numbers. We need to explicitly pass this information to the |
||
| 27 | // HEPEVT_Wrapper. |
||
| 28 | // |
||
| 29 | HepMC::HEPEVT_Wrapper::set_max_number_entries(4000); |
||
| 30 | HepMC::HEPEVT_Wrapper::set_sizeof_real(8); |
||
| 31 | // |
||
| 32 | //........................................PYTHIA INITIALIZATIONS |
||
| 33 | // (Some platforms may require the initialization of pythia PYDATA block |
||
| 34 | // data as external - if you get pythia initialization errors try |
||
| 35 | // commenting in/out the below call to initpydata() ) |
||
| 36 | // initpydata(); |
||
| 37 | // |
||
| 38 | // Select W+gamma process (process number 20) |
||
| 39 | // (here we have to be careful of C/F77 differences: arrays in C |
||
| 40 | // start at 0, F77 at 1, so we need to subtract 1 from the process #) |
||
| 41 | pysubs.msel=0; |
||
| 42 | pysubs.msub[20-1] = 1; |
||
| 43 | // set random number seed (mandatory!) |
||
| 44 | pydatr.mrpy[0]=55122 ; |
||
| 45 | // Tell Pythia not to write multiple copies of particles in event record. |
||
| 46 | pypars.mstp[128-1] = 2; |
||
| 47 | // Example of setting a Pythia parameter: set the top mass |
||
| 48 | pydat2.pmas[1-1][6-1]= 175; |
||
| 49 | // |
||
| 50 | // Call pythia initialization |
||
| 51 | call_pyinit( "CMS", "p", "p", 14000. ); |
||
| 52 | // |
||
| 53 | //........................................HepMC INITIALIZATIONS |
||
| 54 | // |
||
| 55 | // Instantiate an IO strategy for reading from HEPEVT. |
||
| 56 | HepMC::IO_HEPEVT hepevtio; |
||
| 57 | // |
||
| 58 | //........................................EVENT LOOP |
||
| 59 | for ( int i = 1; i <= 100; i++ ) { |
||
| 60 | if ( i%50==1 ) std::cout << "Processing Event Number " |
||
| 61 | << i << std::endl; |
||
| 62 | call_pyevnt(); // generate one event with Pythia |
||
| 63 | // pythia pyhepc routine convert common PYJETS in common HEPEVT |
||
| 64 | call_pyhepc( 1 ); |
||
| 65 | HepMC::GenEvent* evt = hepevtio.read_next_event(); |
||
| 66 | // |
||
| 67 | //.......................USER WOULD PROCESS EVENT HERE |
||
| 68 | // |
||
| 69 | // we also need to delete the created event from memory |
||
| 70 | delete evt; |
||
| 71 | } |
||
| 72 | //........................................TERMINATION |
||
| 73 | // write out some information from Pythia to the screen |
||
| 74 | call_pystat( 1 ); |
||
| 75 | |||
| 76 | return 0; |
||
| 77 | } |
||
| 78 | |||
| 79 | |||
| 80 |