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

#include <FFPrimaryGeneratorAction.hh>

Inheritance diagram for FFPrimaryGeneratorAction:
Collaboration diagram for FFPrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

Definition at line 55 of file FFPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

FFPrimaryGeneratorAction::FFPrimaryGeneratorAction ( )

Definition at line 67 of file FFPrimaryGeneratorAction.cc.

69 #ifndef NDEBUG
70  fEventNumber(0),
71 #endif // NDEBUG
72  fH2OPhysical(NULL),
73  fNeutronPhysical(NULL),
74  fNeutronSolid(NULL),
75  fParticleGun(new G4ParticleGun(1)),
76  fTankPhysical(NULL)
77 {
79  fParticleGun->SetParticleEnergy(4.5 * MeV);
80 }
void SetParticleEnergy(G4double aKineticEnergy)
static G4Neutron * Definition()
Definition: G4Neutron.cc:54
static constexpr double MeV
Definition: G4SIunits.hh:214
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

FFPrimaryGeneratorAction::~FFPrimaryGeneratorAction ( )
virtual

Definition at line 199 of file FFPrimaryGeneratorAction.cc.

200 {
201  delete fParticleGun;
202 }

Member Function Documentation

void FFPrimaryGeneratorAction::GeneratePrimaries ( G4Event event)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 84 of file FFPrimaryGeneratorAction.cc.

85 {
86 #ifndef NDEBUG
87  G4cout << "Shooting event " << ++fEventNumber << G4endl;
88 #endif // NDEBUG
89  const G4ThreeVector sourceCenter = GetNeutronSourceCenter();
90 
91  // Sample the neutron source location
92  const G4double radius = fNeutronSolid->GetOuterRadius();
93  const G4double z = fNeutronSolid->GetZHalfLength() * 2;
94  G4ThreeVector randomLocation;
95  randomLocation.setRThetaPhi(radius * std::sqrt(G4UniformRand()),
96  G4UniformRand() * 180 * deg,
97  0);
98  randomLocation.setZ(z * (G4UniformRand() - 0.5));
99  G4ThreeVector location(randomLocation.x() + sourceCenter.x(),
100  randomLocation.y() + sourceCenter.y(),
101  randomLocation.z() + sourceCenter.z());
102 #ifndef NDEBUG
103  G4cout << "Emission Location: r: " << location << G4endl;
104 #endif // NDEBUG
105 
106  // Sample the neutron emission direction
107  G4ThreeVector direction;
108  direction.setRThetaPhi(1.0,
109  std::acos(G4UniformRand() * 2 - 1),
110  (G4UniformRand() * 2 - 1) * 180 * deg);
111 #ifndef NDEBUG
112  G4cout << "Emission Direction: r: " << direction << G4endl;
113 #endif // NDEBUG
114 
115  // Load the event
116  fParticleGun->SetParticlePosition(location);
117  fParticleGun->SetParticleMomentumDirection(direction);
118  fParticleGun->GeneratePrimaryVertex(event);
119 }
double x() const
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
double z() const
void setZ(double)
void SetParticlePosition(G4ThreeVector aPosition)
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
void setRThetaPhi(double r, double theta, double phi)
double y() const
G4double GetZHalfLength() const
tuple z
Definition: test.py:28
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static constexpr double deg
Definition: G4SIunits.hh:152
G4double GetOuterRadius() const

Here is the call graph for this function:


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