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