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

#include <ExN02PrimaryGeneratorAction.hh>

Inheritance diagram for ExN02PrimaryGeneratorAction:
Collaboration diagram for ExN02PrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

Definition at line 46 of file ExN02PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

ExN02PrimaryGeneratorAction::ExN02PrimaryGeneratorAction ( ExN02DetectorConstruction myDC)

Definition at line 46 of file ExN02PrimaryGeneratorAction.cc.

48 :myDetector(myDC)
49 {
50  G4int n_particle = 1;
51  particleGun = new G4ParticleGun(n_particle);
52 
53 // default particle
54 
56  G4ParticleDefinition* particle = particleTable->FindParticle("proton");
57 
58  particleGun->SetParticleDefinition(particle);
59  particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
60  particleGun->SetParticleEnergy(3.0*GeV);
61 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static constexpr double GeV
Definition: G4SIunits.hh:217
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

ExN02PrimaryGeneratorAction::~ExN02PrimaryGeneratorAction ( )

Definition at line 65 of file ExN02PrimaryGeneratorAction.cc.

66 {
67  delete particleGun;
68 }

Member Function Documentation

void ExN02PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 72 of file ExN02PrimaryGeneratorAction.cc.

73 {
74  G4double position = -0.5*(myDetector->GetWorldFullLength());
75  particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
76 
77  particleGun->GeneratePrimaryVertex(anEvent);
78 }
CLHEP::Hep3Vector G4ThreeVector
virtual void GeneratePrimaryVertex(G4Event *evt)
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double cm
Definition: G4SIunits.hh:119
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:


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