SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
StdHepGenerator.cc
Go to the documentation of this file.
1 #include "StdHepGenerator.hh"
2 
3 // SLIC
4 #include "MCParticleManager.hh"
5 
6 // LCIO
7 #include "IMPL/MCParticleImpl.h"
8 
9 // Geant4
10 #include "G4SystemOfUnits.hh"
11 
12 using EVENT::MCParticle;
13 using EVENT::LCCollection;
14 using IMPL::MCParticleImpl;
15 
16 namespace slic {
17 
18 StdHepGenerator::StdHepGenerator(G4String eventFile) :
19  _particles(0) {
20  _reader = new LCStdHepRdrNew(eventFile.data());
21 }
22 
24  delete _reader;
25 }
26 
28  /* Read in the next StdHep event which is converted to an MCParticle collection. */
29  _particles = _reader->readEvent();
30 }
31 
32 void StdHepGenerator::generateEvent(G4Event* event) {
33  /*
34  * Use the MCParticleManager utility method to create the Geant4 event using the current
35  * collection of MCParticles.
36  */
37  MCParticleManager::instance()->generateEvent(_particles, event);
38 }
39 
41  return _particles;
42 }
43 
44 } /* namespace slic */
static MCParticleManager * instance()
StdHepGenerator(G4String eventFile)
LCCollectionVec * getCurrentParticleCollection()
LCCollectionVec * _particles
LCStdHepRdrNew * _reader
void generateEvent(G4Event *event)