HepMC Reference Documentation

HepMC

example_MyHerwig.cc

Go to the documentation of this file.
00001 
00002 // Matt.Dobbs@Cern.CH, October 2002
00003 // example of generating events with Herwig using HepMC/HerwigWrapper.h 
00004 // Events are read into the HepMC event record from the FORTRAN HEPEVT 
00005 // common block using the IO_HERWIG strategy.
00016 
00017 #include <iostream>
00018 #include "HepMC/HerwigWrapper.h"
00019 #include "HepMC/IO_HERWIG.h"
00020 #include "HepMC/GenEvent.h"
00021 #include "HepMC/HEPEVT_Wrapper.h"
00022 
00023 int main() { 
00024     //
00025     //........................................HEPEVT
00026     // Herwig 6.4 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     //.......................................INITIALIZATIONS
00034 
00035     hwproc.PBEAM1 = 7000.; // energy of beam1
00036     hwproc.PBEAM2 = 7000.; // energy of beam2
00037     // 1610 = gg->H--> WW, 1706 = qq-->ttbar, 2510 = ttH -> ttWW
00038     hwproc.IPROC = 1706; // qq -> ttbar production 
00039     hwproc.MAXEV = 100; // number of events
00040     // tell it what the beam particles are:
00041     for ( unsigned int i = 0; i < 8; ++i ) {
00042         hwbmch.PART1[i] = (i < 1) ? 'P' : ' ';
00043         hwbmch.PART2[i] = (i < 1) ? 'P' : ' ';
00044     }
00045     hwigin();    // INITIALISE OTHER COMMON BLOCKS
00046     hwevnt.MAXPR = 1; // number of events to print
00047     hwuinc(); // compute parameter-dependent constants
00048     hweini(); // initialise elementary process
00049 
00050     //........................................HepMC INITIALIZATIONS
00051     //
00052     // Instantiate an IO strategy for reading from HEPEVT.
00053     HepMC::IO_HERWIG hepevtio;
00054     //
00055     //........................................EVENT LOOP
00056     for ( int i = 1; i <= hwproc.MAXEV; i++ ) {
00057         if ( i%50==1 ) std::cout << "Processing Event Number " 
00058                                  << i << std::endl;
00059         // initialise event
00060         hwuine();
00061         // generate hard subprocess
00062         hwepro();
00063         // generate parton cascades
00064         hwbgen();
00065         // do heavy object decays
00066         hwdhob();
00067         // do cluster formation
00068         hwcfor();
00069         // do cluster decays
00070         hwcdec();
00071         // do unstable particle decays
00072         hwdhad();
00073         // do heavy flavour hadron decays
00074         hwdhvy();
00075         // add soft underlying event if needed
00076         hwmevt();
00077         // finish event
00078         hwufne();
00079         HepMC::GenEvent* evt = hepevtio.read_next_event();
00080         // add some information to the event
00081         evt->set_event_number(i);
00082         evt->set_signal_process_id(20);
00083         if (i<=hwevnt.MAXPR) {
00084             std::cout << "\n\n This is the FIXED version of HEPEVT as "
00085                       << "coded in IO_HERWIG " << std::endl;
00086             HepMC::HEPEVT_Wrapper::print_hepevt();
00087             evt->print();
00088         }
00089 
00090         // we also need to delete the created event from memory
00091         delete evt;
00092     }
00093     //........................................TERMINATION
00094     hwefin();
00095 
00096     return 0;
00097 }

Generated on Wed Mar 12 13:08:08 2008 for HepMC by  doxygen 1.5.1-3