Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSPrimaryGeneratorAction Class Reference

#include <TSPrimaryGeneratorAction.hh>

Inheritance diagram for TSPrimaryGeneratorAction:
Collaboration diagram for TSPrimaryGeneratorAction:

Public Member Functions

 TSPrimaryGeneratorAction ()
 
virtual ~TSPrimaryGeneratorAction ()
 
void GeneratePrimaries (G4Event *)
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Definition at line 50 of file TSPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

TSPrimaryGeneratorAction::TSPrimaryGeneratorAction ( )

Definition at line 54 of file TSPrimaryGeneratorAction.cc.

55 {
56  fGun = new G4ParticleGun(1);
57 
59  G4String particleName;
60  G4ParticleDefinition* particle
61  = particleTable->FindParticle(particleName="neutron");
62 
63  fGun->SetParticleDefinition(particle);
64  fGun->SetParticleEnergy(1.*MeV);
65 
66 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static constexpr double MeV
Definition: G4SIunits.hh:214
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

TSPrimaryGeneratorAction::~TSPrimaryGeneratorAction ( )
virtual

Definition at line 70 of file TSPrimaryGeneratorAction.cc.

71 {
72  delete fGun;
73 }

Member Function Documentation

void TSPrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 77 of file TSPrimaryGeneratorAction.cc.

78 {
79  static TSDetectorConstruction* detector
81 
82  G4ThreeVector dir(0.,0., 1.);
83  G4ThreeVector pos(detector->GetWorldDimensions().x()*(G4UniformRand()-0.5),
84  detector->GetWorldDimensions().y()*(G4UniformRand()-0.5),
85  -0.5*detector->GetWorldDimensions().z());
86 
87  dir /= dir.mag();
89  fGun->SetParticlePosition(pos);
90  fGun->GeneratePrimaryVertex(anEvent);
91 }
double x() const
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
static TSDetectorConstruction * Instance()
double z() const
const G4ThreeVector & GetWorldDimensions() const
void SetParticlePosition(G4ThreeVector aPosition)
#define G4UniformRand()
Definition: Randomize.hh:97
double y() const
static const G4double pos

Here is the call graph for this function:


The documentation for this class was generated from the following files: