Geant4  10.02.p03
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 ()
 

Private Member Functions

G4ThreeVector GetNeutronSourceCenter (void)
 

Private Attributes

G4long fEventNumber
 
G4VPhysicalVolumefH2OPhysical
 
G4VPhysicalVolumefNeutronPhysical
 
G4TubsfNeutronSolid
 
G4ParticleGun *const fParticleGun
 
G4VPhysicalVolumefTankPhysical
 

Detailed Description

Definition at line 55 of file FFPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

◆ FFPrimaryGeneratorAction()

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),
76  fTankPhysical(NULL)
77 {
80 }
static const double MeV
Definition: G4SIunits.hh:211
void SetParticleEnergy(G4double aKineticEnergy)
static G4Neutron * Definition()
Definition: G4Neutron.cc:54
G4VPhysicalVolume * fNeutronPhysical
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
Here is the call graph for this function:

◆ ~FFPrimaryGeneratorAction()

FFPrimaryGeneratorAction::~FFPrimaryGeneratorAction ( )
virtual

Definition at line 199 of file FFPrimaryGeneratorAction.cc.

200 {
201  delete fParticleGun;
202 }
Here is the caller graph for this function:

Member Function Documentation

◆ GeneratePrimaries()

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
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
119 }
G4ThreeVector GetNeutronSourceCenter(void)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
void setZ(double)
G4double GetZHalfLength() const
void SetParticlePosition(G4ThreeVector aPosition)
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
static const double deg
Definition: G4SIunits.hh:151
G4double GetOuterRadius() const
void setRThetaPhi(double r, double theta, double phi)
double x() const
double y() const
double z() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNeutronSourceCenter()

G4ThreeVector FFPrimaryGeneratorAction::GetNeutronSourceCenter ( void  )
private

Definition at line 123 of file FFPrimaryGeneratorAction.cc.

124 {
125  // Get the dimensions of the neutron source
126  if(fNeutronSolid == NULL)
127  {
128  G4LogicalVolume* temp
129  = G4LogicalVolumeStore::GetInstance()->GetVolume("NeutronSource");
130  if(temp != NULL)
131  {
132  fNeutronSolid = dynamic_cast< G4Tubs* >(temp->GetSolid());
133  }
134 
135  if(fNeutronSolid == NULL)
136  {
137  G4Exception("FFPrimaryGeneratorAction::"
138  "GeneratePrimaries(G4Event*)",
139  "Neutron source solid volume not found",
141  "This run will be aborted");
142  }
143  }
144 
145  // Get the position of the neutron source within the water
146  if(fNeutronPhysical == NULL)
147  {
149  ->GetVolume("NeutronSource");
150  }
151 
152  if(fNeutronPhysical == NULL)
153  {
154  G4Exception("FFPrimaryGeneratorAction::GetNeutronSourceCenter(void)",
155  "Neutron source physical volume not found",
157  "This run will be aborted");
158  }
159 
160  // Get the position of the water within the tank
161  if(fH2OPhysical == NULL)
162  {
164  ->GetVolume("Tank_H2O");
165 
166  if(fH2OPhysical == NULL)
167  {
168  G4Exception("FFPrimaryGeneratorAction::"
169  "GetNeutronSourceCenter(void)",
170  "Tank H2O physical volume not found",
172  "This run will be aborted");
173  }
174  }
175 
176  // Get the position of the tank within the world
177  if(fTankPhysical == NULL)
178  {
180  ->GetVolume("Tank_Wall");
181 
182  if(fTankPhysical == NULL)
183  {
184  G4Exception("FFPrimaryGeneratorAction::"
185  "GetNeutronSourceCenter(void)",
186  "Tank physical volume not found",
188  "This run will be aborted");
189  }
190  }
191 
195 }
Definition: G4Tubs.hh:85
static G4PhysicalVolumeStore * GetInstance()
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
static G4LogicalVolumeStore * GetInstance()
G4VPhysicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4ThreeVector & GetTranslation() const
G4VPhysicalVolume * fNeutronPhysical
G4VSolid * GetSolid() const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fEventNumber

G4long FFPrimaryGeneratorAction::fEventNumber
private

Definition at line 71 of file FFPrimaryGeneratorAction.hh.

◆ fH2OPhysical

G4VPhysicalVolume* FFPrimaryGeneratorAction::fH2OPhysical
private

Definition at line 73 of file FFPrimaryGeneratorAction.hh.

◆ fNeutronPhysical

G4VPhysicalVolume* FFPrimaryGeneratorAction::fNeutronPhysical
private

Definition at line 74 of file FFPrimaryGeneratorAction.hh.

◆ fNeutronSolid

G4Tubs* FFPrimaryGeneratorAction::fNeutronSolid
private

Definition at line 75 of file FFPrimaryGeneratorAction.hh.

◆ fParticleGun

G4ParticleGun* const FFPrimaryGeneratorAction::fParticleGun
private

Definition at line 76 of file FFPrimaryGeneratorAction.hh.

◆ fTankPhysical

G4VPhysicalVolume* FFPrimaryGeneratorAction::fTankPhysical
private

Definition at line 77 of file FFPrimaryGeneratorAction.hh.


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