Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FFPrimaryGeneratorAction Class Reference

#include <Doxymodules_hadronic.h>

Inheritance diagram for FFPrimaryGeneratorAction:
G4VUserPrimaryGeneratorAction

Public Member Functions

 FFPrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *event)
 
virtual ~FFPrimaryGeneratorAction ()
 

Private Member Functions

G4ThreeVector GetNeutronSourceCenter (void)
 

Private Attributes

G4long fEventNumber
 
G4VPhysicalVolumefH2OPhysical
 
G4VPhysicalVolumefNeutronPhysical
 
G4TubsfNeutronSolid
 
G4ParticleGun *const fParticleGun
 
G4VPhysicalVolumefTankPhysical
 

Detailed Description

Definition at line 119 of file Doxymodules_hadronic.h.

Constructor & Destructor Documentation

◆ FFPrimaryGeneratorAction()

FFPrimaryGeneratorAction::FFPrimaryGeneratorAction ( )

Definition at line 66 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{
78 fParticleGun->SetParticleDefinition(G4Neutron::Definition());
79 fParticleGun->SetParticleEnergy(4.5 * MeV);
80}

◆ ~FFPrimaryGeneratorAction()

FFPrimaryGeneratorAction::~FFPrimaryGeneratorAction ( )
virtual

Definition at line 198 of file FFPrimaryGeneratorAction.cc.

200{
201 delete fParticleGun;
202}

Member Function Documentation

◆ GeneratePrimaries()

void FFPrimaryGeneratorAction::GeneratePrimaries ( G4Event event)
virtual

Definition at line 83 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}
G4ThreeVector GetNeutronSourceCenter(void)

◆ GetNeutronSourceCenter()

G4ThreeVector FFPrimaryGeneratorAction::GetNeutronSourceCenter ( void  )
private

Definition at line 122 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",
140 EventMustBeAborted,
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 {
148 fNeutronPhysical = G4PhysicalVolumeStore::GetInstance()
149 ->GetVolume("NeutronSource");
150 }
151
152 if(fNeutronPhysical == NULL)
153 {
154 G4Exception("FFPrimaryGeneratorAction::GetNeutronSourceCenter(void)",
155 "Neutron source physical volume not found",
156 EventMustBeAborted,
157 "This run will be aborted");
158 }
159
160 // Get the position of the water within the tank
161 if(fH2OPhysical == NULL)
162 {
163 fH2OPhysical = G4PhysicalVolumeStore::GetInstance()
164 ->GetVolume("Tank_H2O");
165
166 if(fH2OPhysical == NULL)
167 {
168 G4Exception("FFPrimaryGeneratorAction::"
169 "GetNeutronSourceCenter(void)",
170 "Tank H2O physical volume not found",
171 EventMustBeAborted,
172 "This run will be aborted");
173 }
174 }
175
176 // Get the position of the tank within the world
177 if(fTankPhysical == NULL)
178 {
179 fTankPhysical = G4PhysicalVolumeStore::GetInstance()
180 ->GetVolume("Tank_Wall");
181
182 if(fTankPhysical == NULL)
183 {
184 G4Exception("FFPrimaryGeneratorAction::"
185 "GetNeutronSourceCenter(void)",
186 "Tank physical volume not found",
187 EventMustBeAborted,
188 "This run will be aborted");
189 }
190 }
191
192 return fNeutronPhysical->GetTranslation()
193 + fH2OPhysical->GetTranslation()
194 + fTankPhysical->GetTranslation();
195}

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:

Applications | User Support | Publications | Collaboration