[807] | 1 | |
---|
| 2 | Examples for HepMC-Geant4 interface |
---|
| 3 | ----------------------------------- |
---|
| 4 | |
---|
| 5 | This directory contains examples for using HepMC as an interface with |
---|
| 6 | various Monte Carlo event generators, such as PYTHIA. |
---|
| 7 | It also include an example for demonstrating MC truth handling with HepMC. |
---|
| 8 | |
---|
| 9 | Requirements for external software packages |
---|
| 10 | ------------------------------------------- |
---|
| 11 | HepMC: |
---|
| 12 | tested version : 1.27.02 |
---|
| 13 | http://lcgapp.cern.ch/project/spi/extsoft/packages.php?pkg=HepMC |
---|
| 14 | http://cern.ch/mdobbs/HepMC/ |
---|
| 15 | |
---|
| 16 | Note: examples were tested only on Linux with gcc. |
---|
| 17 | |
---|
| 18 | PYTHIA |
---|
| 19 | Tested version 6.205 (CERNLIB 2005) |
---|
| 20 | URL: http://www.thep.lu.se/~torbjorn/Pythia.html |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | Examples HepMCEx01 and HepMCEx02 |
---|
| 24 | ================================ |
---|
| 25 | |
---|
| 26 | class HepMCG4Interface |
---|
| 27 | This class is derived from G4VPrimaryGenerator, and is a base class |
---|
| 28 | for primary generation via HepMC object. |
---|
| 29 | |
---|
| 30 | protected members |
---|
| 31 | + virtual HepMC::GenEvent* GenerateHepMCEvent() |
---|
| 32 | Implement this method in his/her own concrete class. |
---|
| 33 | An empty event will be created in default. |
---|
| 34 | |
---|
| 35 | + void HepMC2G4(const HepMC::GenEvent* hepmcevt, G4Event* g4event) |
---|
| 36 | service method for conversion from HepMC::GenEvent to G4Event |
---|
| 37 | |
---|
| 38 | + virtual G4bool CheckVertexInsideWorld(const G4ThreeVector& pos) const |
---|
| 39 | We have to take care for the position of primaries because |
---|
| 40 | primary vertices outside the world volume give rise to G4Exception. |
---|
| 41 | If the default implementation is not adequate, an alternative |
---|
| 42 | can be implemented in your own class. |
---|
| 43 | |
---|
| 44 | public members |
---|
| 45 | + virtual void GeneratePrimaryVertex(G4Event* anEvent) |
---|
| 46 | The default behavior is that a single HepMC event generated by |
---|
| 47 | GenerateHepMCEvent() will be converted to G4Event through HepMC2G4(). |
---|
| 48 | |
---|
| 49 | class HepMCG4AsciiReader / HepMCG4AsciiReaderMessenger |
---|
| 50 | (derived from HepMCG4Interface) |
---|
| 51 | This derived class is for reading primary information from |
---|
| 52 | an Ascii file generated by HepMC. |
---|
| 53 | |
---|
| 54 | class HepMCG4PythiaInterface / HepMCG4AsciiReaderMessenger |
---|
| 55 | (derived from HepMCG4Interface) |
---|
| 56 | This derived class is for directly calling PYTHIA functions. |
---|
| 57 | Users can set parameters, initialize, generate, and terminate |
---|
| 58 | by command line operation. |
---|
| 59 | |
---|
| 60 | Macros in examples |
---|
| 61 | ----------------- |
---|
| 62 | hepmc_pygen.in |
---|
| 63 | process PYTHIA events(H->4mu) generated at every event. |
---|
| 64 | |
---|
| 65 | hepmc_ascii.in |
---|
| 66 | read pregenerated events from HepMC Ascii file (data/example_MyPhyia.dat). |
---|
| 67 | |
---|
| 68 | How to compile |
---|
| 69 | -------------- |
---|
| 70 | To build HepMCEx01 and HepMCEx02 examples, the directory path where the |
---|
| 71 | HepMC package is installed must be provided through the variable HEPMC_DIR. |
---|
| 72 | PYTHIA 6.205 must be installed through CERNLIB 2005 and the bin path |
---|
| 73 | correctly added in PATH. |
---|
| 74 | |
---|
| 75 | Notes |
---|
| 76 | ----- |
---|
| 77 | We attached a sample HepMC Ascii data file, "data/example_MyPhyia.dat", |
---|
| 78 | which contains 10 PYTHIA events created by "data/example_MyPythia.cxx(cc)". |
---|
| 79 | |
---|
| 80 | Example MCTruth |
---|
| 81 | =============== |
---|
| 82 | |
---|
| 83 | Application demonstrating handling of Monte-Carlo truth information through |
---|
| 84 | the HepMC package. |
---|