SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
ParticleGunEventSource.cc
Go to the documentation of this file.
2 
3 // geant4
4 #include "G4ParticleGun.hh"
5 
6 namespace slic {
7 
9  EventSource("ParticleGunEventSource") {
10  m_generator = new G4ParticleGun();
11 }
12 
14  delete m_generator;
15 }
16 
18  m_generator->GeneratePrimaryVertex(evt);
19 }
20 
22  log() << LOG::okay << "Dumping ParticleGun Event info..." << LOG::done;
23 
24  G4ParticleDefinition* pdef = m_generator->GetParticleDefinition();
25 
26  log() << LOG::okay << "particle: " << pdef->GetParticleName() << LOG::done;
27  log() << LOG::okay << "time: " << m_generator->GetParticleTime() << LOG::done;
28  log() << LOG::okay << "pos: " << m_generator->GetParticlePosition() << LOG::done;
29  log() << LOG::okay << "mom: " << m_generator->GetParticleMomentumDirection() << LOG::done;
30  log() << LOG::okay << "E: " << m_generator->GetParticleEnergy() << LOG::done;
31  log() << LOG::okay << LOG::done;
32 }
33 
35  return m_generator;
36 }
37 }
The virtual base class for a physics event source such as a StdHep file.
Definition: EventSource.hh:19
LogStream & log()
Definition: Module.hh:99
virtual void generate(G4Event *event)
@ okay
Definition: LogStream.hh:33
@ done
Definition: LogStream.hh:26