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

#include <F05PrimaryGeneratorAction.hh>

Inheritance diagram for F05PrimaryGeneratorAction:
Collaboration diagram for F05PrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

Definition at line 46 of file F05PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

F05PrimaryGeneratorAction::F05PrimaryGeneratorAction ( void  )

Definition at line 48 of file F05PrimaryGeneratorAction.cc.

49 {
50  G4int n_particle = 1;
51  fParticleGun = new G4ParticleGun(n_particle);
52 
54  G4ParticleDefinition* particle = particleTable->FindParticle("mu+");
55 
56  fParticleGun->SetParticleDefinition(particle);
57 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
int G4int
Definition: G4Types.hh:78
static G4ParticleTable * GetParticleTable()
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

F05PrimaryGeneratorAction::~F05PrimaryGeneratorAction ( )
virtual

Definition at line 61 of file F05PrimaryGeneratorAction.cc.

62 {
63  delete fParticleGun;
64 }

Member Function Documentation

void F05PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 68 of file F05PrimaryGeneratorAction.cc.

69 {
70  //this function is called at the begining of event
71  //
72 
73  G4double Pmu = 517.6*MeV;
74  G4double mu_mass = 105.658*MeV;
75  G4double Emu = std::sqrt(Pmu*Pmu + mu_mass*mu_mass);
76  G4double Kmu = Emu - mu_mass;
77 
78  G4double x0 = -6.99*m;
79  G4double y0 = 0.00*m;
80  G4double z0 = 0.00*m;
81 
82  fParticleGun->SetParticleEnergy(Kmu);
83  fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
84  fParticleGun->SetParticlePolarization(G4ThreeVector(0.,1.,0.));
85  fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
86 
87  fParticleGun->GeneratePrimaryVertex(anEvent);
88 }
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double m
Definition: G4SIunits.hh:129
void SetParticleEnergy(G4double aKineticEnergy)
static constexpr double MeV
Definition: G4SIunits.hh:214
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: