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

#include <RE02PrimaryGeneratorAction.hh>

Inheritance diagram for RE02PrimaryGeneratorAction:
Collaboration diagram for RE02PrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

User primary particle generator class

  • void GeneratePrimaries(G4Event*) an incident particle is proton with 150 MeV energy at the position (x,y,-100 cm) toward the (0,0,1) direction. The x and y positions are uniformly varied from -5 mm to 5 mm, respectively.

Definition at line 51 of file RE02PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

RE02PrimaryGeneratorAction::RE02PrimaryGeneratorAction ( )

Definition at line 45 of file RE02PrimaryGeneratorAction.cc.

47  fParticleGun(0)
48 {
49  G4int n_particle = 1;
50  fParticleGun = new G4ParticleGun(n_particle);
51 
52 // default particle
54  G4ParticleDefinition* particle = particleTable->FindParticle("proton");
55  fParticleGun->SetParticleDefinition(particle);
56  fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0,0.0,1.));
57  fParticleGun->SetParticleEnergy(150.0*MeV);
58 //
59 // default beam position
60  G4double position = -200./2.*cm;
61 //
62 // Initial beam spot size in sigma.; This is not a part of ParticleGun.
63  fSigmaPosition = 10.* mm;
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 //
67  fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm, 0.*cm, position));
68 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static constexpr double mm
Definition: G4SIunits.hh:115
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double cm
Definition: G4SIunits.hh:119
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

RE02PrimaryGeneratorAction::~RE02PrimaryGeneratorAction ( )

Definition at line 72 of file RE02PrimaryGeneratorAction.cc.

73 {
74  delete fParticleGun;
75 }

Member Function Documentation

void RE02PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 79 of file RE02PrimaryGeneratorAction.cc.

80 {
81 
82  G4ThreeVector position = fParticleGun->GetParticlePosition();
83  G4double dx = (G4UniformRand()-0.5)*fSigmaPosition;
84  G4double dy = (G4UniformRand()-0.5)*fSigmaPosition;
85  position.setX(dx);
86  position.setY(dy);
87  fParticleGun->SetParticlePosition(position);
88  fParticleGun->GeneratePrimaryVertex(anEvent);
89 }
G4ThreeVector GetParticlePosition()
void setY(double)
virtual void GeneratePrimaryVertex(G4Event *evt)
void setX(double)
void SetParticlePosition(G4ThreeVector aPosition)
#define G4UniformRand()
Definition: Randomize.hh:97
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: