SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
GPSEventSource.cc
Go to the documentation of this file.
1 #include "GPSEventSource.hh"
2 
3 // geant4
4 #include "G4MuonMinus.hh"
5 #include "G4SystemOfUnits.hh"
6 
7 namespace slic {
9  EventSource("GPSEventSource") {
10  m_generator = new G4GeneralParticleSource();
11 
13 }
14 
16  delete m_generator;
17 }
18 
20  m_generator->GetCurrentSource()->SetParticleDefinition(G4MuonMinus::MuonMinusDefinition());
21 
22  m_generator->GetCurrentSource()->GetEneDist()->SetEnergyDisType("Mono");
23  m_generator->GetCurrentSource()->GetEneDist()->SetMonoEnergy(5 * GeV);
24 
25  m_generator->GetCurrentSource()->GetPosDist()->SetPosDisType("Point");
26  m_generator->GetCurrentSource()->GetPosDist()->SetCentreCoords(G4ThreeVector(0, 0, 0));
27 
28  m_generator->GetCurrentSource()->GetAngDist()->SetAngDistType("planar");
29  m_generator->GetCurrentSource()->GetAngDist()->SetParticleMomentumDirection(G4ThreeVector(0, 1, 0));
30 }
31 
32 void GPSEventSource::generate(G4Event* evt) {
33  m_generator->GeneratePrimaryVertex(evt);
34 }
35 
38  log() << LOG::okay << "Dumping GPS Event info..." << LOG::done;
39 
40  G4ParticleDefinition* pdef = m_generator->GetParticleDefinition();
41 
42  log() << LOG::okay << "particle: " << pdef->GetParticleName() << LOG::done;
43  log() << LOG::okay << "time: " << m_generator->GetParticleTime() << LOG::done;
44  log() << LOG::okay << "nparts: " << m_generator->GetNumberOfParticles() << LOG::done;
45  log() << LOG::okay << "pos: " << m_generator->GetParticlePosition() << LOG::done;
46  log() << LOG::okay << "mom: " << m_generator->GetParticleMomentumDirection() << LOG::done;
47  log() << LOG::okay << "E: " << m_generator->GetParticleEnergy() << LOG::done;
48  log() << LOG::okay << LOG::done;
49 }
50 
51 G4GeneralParticleSource* GPSEventSource::getGPS() {
52  return m_generator;
53 }
54 } // namespace slic
The virtual base class for a physics event source such as a StdHep file.
Definition: EventSource.hh:19
G4GeneralParticleSource * getGPS()
G4GeneralParticleSource * m_generator
void generate(G4Event *event)
LogStream & log()
Definition: Module.hh:99
@ okay
Definition: LogStream.hh:33
@ done
Definition: LogStream.hh:26