Geant4  10.01.p01
G4GeneralParticleSource Class Reference

Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameters are concerned : Each thread has its own GPS since primary generation is a user action. More...

#include <G4GeneralParticleSource.hh>

+ Inheritance diagram for G4GeneralParticleSource:
+ Collaboration diagram for G4GeneralParticleSource:

Public Member Functions

 G4GeneralParticleSource ()
 
 ~G4GeneralParticleSource ()
 
void GeneratePrimaryVertex (G4Event *)
 
G4int GetNumberofSource ()
 
void ListSource ()
 
void SetCurrentSourceto (G4int)
 
void SetCurrentSourceIntensity (G4double)
 
G4SingleParticleSourceGetCurrentSource ()
 
G4int GetCurrentSourceIndex ()
 
G4double GetCurrentSourceIntensity ()
 
void ClearAll ()
 
void AddaSource (G4double)
 
void DeleteaSource (G4int)
 
void SetVerbosity (G4int i)
 
void SetMultipleVertex (G4bool av)
 
void SetFlatSampling (G4bool av)
 
void SetParticleDefinition (G4ParticleDefinition *aParticleDefinition)
 
G4ParticleDefinitionGetParticleDefinition ()
 
void SetParticleCharge (G4double aCharge)
 
void SetParticlePolarization (G4ThreeVector aVal)
 
G4ThreeVector GetParticlePolarization ()
 
void SetParticleTime (G4double aTime)
 
G4double GetParticleTime ()
 
void SetNumberOfParticles (G4int i)
 
G4int GetNumberOfParticles ()
 
G4ThreeVector GetParticlePosition ()
 
G4ThreeVector GetParticleMomentumDirection ()
 
G4double GetParticleEnergy ()
 
- Public Member Functions inherited from G4VPrimaryGenerator
 G4VPrimaryGenerator ()
 
virtual ~G4VPrimaryGenerator ()
 
G4ThreeVector GetParticlePosition ()
 
G4double GetParticleTime ()
 
void SetParticlePosition (G4ThreeVector aPosition)
 
void SetParticleTime (G4double aTime)
 

Private Member Functions

void IntensityNormalization ()
 

Private Attributes

G4bool multiple_vertex
 
G4bool flat_sampling
 
G4bool normalised
 
G4int currentSourceIdx
 
G4SingleParticleSourcecurrentSource
 
std::vector
< G4SingleParticleSource * > 
sourceVector
 
std::vector< G4doublesourceIntensity
 
std::vector< G4doublesourceProbability
 
G4GeneralParticleSourceMessengertheMessenger
 
G4GeneralParticleSourceDataGPSData
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VPrimaryGenerator
static G4bool CheckVertexInsideWorld (const G4ThreeVector &pos)
 
- Protected Attributes inherited from G4VPrimaryGenerator
G4ThreeVector particle_position
 
G4double particle_time
 

Detailed Description

Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameters are concerned : Each thread has its own GPS since primary generation is a user action.

However to save memory the underlying structures that provide the GPS functionalities ( the G4SPS*Distribution classes and the G4SPSRandomGenerator class) are shared among threads. This implies that modifying parameters of sources requires some attention: 1- Only one thread should change source parameters. 2- Changing of parameters can happen only between runs, when is guaranteed that no thread is accessing them 2- UI commands require that even if messenger is instantiated in a thread the commands are executed in the master (this is possible since V10.1) The simplest solution is to use UI commands to change GPS parameters and avoid C++ APIs. If this is inevitable a simple solution is to instantiate an instance of G4GeneralParticleSource explicitly in the master thread (for example in G4VUserActionInitialization::BuildForMaster() and set the defaults parameter there).

Definition at line 179 of file G4GeneralParticleSource.hh.

Constructor & Destructor Documentation

G4GeneralParticleSource::G4GeneralParticleSource ( )

Definition at line 77 of file G4GeneralParticleSource.cc.

References currentSource, currentSourceIdx, G4GeneralParticleSourceData::GetCurrentSource(), G4GeneralParticleSourceMessenger::GetInstance(), G4GeneralParticleSourceData::GetSourceVectorSize(), GPSData, G4GeneralParticleSourceData::Instance(), IntensityNormalization(), and theMessenger.

+ Here is the call graph for this function:

G4GeneralParticleSource::~G4GeneralParticleSource ( )

Definition at line 97 of file G4GeneralParticleSource.cc.

References G4GeneralParticleSourceMessenger::Destroy(), and theMessenger.

+ Here is the call graph for this function:

Member Function Documentation

void G4GeneralParticleSource::AddaSource ( G4double  aV)

Definition at line 102 of file G4GeneralParticleSource.cc.

References G4GeneralParticleSourceData::AddASource(), currentSource, currentSourceIdx, G4GeneralParticleSourceData::GetCurrentSource(), G4GeneralParticleSourceData::GetSourceVectorSize(), GPSData, IntensityNormalization(), G4GeneralParticleSourceData::Lock(), normalised, G4GeneralParticleSourceMessenger::SetParticleGun(), theMessenger, and G4GeneralParticleSourceData::Unlock().

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::ClearAll ( )

Definition at line 153 of file G4GeneralParticleSource.cc.

References G4GeneralParticleSourceData::ClearSources(), currentSource, currentSourceIdx, GPSData, and normalised.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::DeleteaSource ( G4int  aV)

Definition at line 161 of file G4GeneralParticleSource.cc.

References G4GeneralParticleSourceData::DeleteASource(), G4cout, G4endl, G4GeneralParticleSourceData::GetIntensityVectorSize(), GPSData, and normalised.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4SingleParticleSource* G4GeneralParticleSource::GetCurrentSource ( )
inline

Definition at line 193 of file G4GeneralParticleSource.hh.

References currentSource.

Referenced by UltraPrimaryGeneratorAction::GeneratePrimaries(), and UltraActionInitializer::UltraActionInitializer().

+ Here is the caller graph for this function:

G4int G4GeneralParticleSource::GetCurrentSourceIndex ( )
inline

Definition at line 194 of file G4GeneralParticleSource.hh.

References currentSourceIdx.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the caller graph for this function:

G4double G4GeneralParticleSource::GetCurrentSourceIntensity ( )
inline

Definition at line 195 of file G4GeneralParticleSource.hh.

References currentSourceIdx, G4GeneralParticleSourceData::GetIntensity(), and GPSData.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4int G4GeneralParticleSource::GetNumberOfParticles ( )
inline

Definition at line 228 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetNumberOfParticles().

+ Here is the call graph for this function:

G4int G4GeneralParticleSource::GetNumberofSource ( )
inline

Definition at line 189 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetSourceVectorSize(), and GPSData.

+ Here is the call graph for this function:

G4ParticleDefinition* G4GeneralParticleSource::GetParticleDefinition ( )
inline

Definition at line 214 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetParticleDefinition().

Referenced by WLSPrimaryGeneratorAction::GeneratePrimaries(), UltraPrimaryGeneratorAction::GeneratePrimaries(), and WLSPrimaryGeneratorAction::SetOptPhotonPolar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4double G4GeneralParticleSource::GetParticleEnergy ( )
inline

Definition at line 231 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetParticleEnergy().

Referenced by UltraPrimaryGeneratorAction::GeneratePrimaries().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4ThreeVector G4GeneralParticleSource::GetParticleMomentumDirection ( )
inline

Definition at line 230 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetParticleMomentumDirection().

Referenced by WLSPrimaryGeneratorAction::SetOptPhotonPolar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4ThreeVector G4GeneralParticleSource::GetParticlePolarization ( )
inline

Definition at line 220 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetParticlePolarization().

+ Here is the call graph for this function:

G4ThreeVector G4GeneralParticleSource::GetParticlePosition ( )
inline

Definition at line 229 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetParticlePosition().

+ Here is the call graph for this function:

G4double G4GeneralParticleSource::GetParticleTime ( )
inline

Definition at line 224 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::GetParticleTime().

+ Here is the call graph for this function:

void G4GeneralParticleSource::IntensityNormalization ( )
private

Definition at line 114 of file G4GeneralParticleSource.cc.

References GPSData, G4GeneralParticleSourceData::IntensityNormalise(), and normalised.

Referenced by AddaSource(), G4GeneralParticleSource(), and GeneratePrimaryVertex().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::ListSource ( )

Definition at line 120 of file G4GeneralParticleSource.cc.

References G4cout, G4endl, G4GeneralParticleSourceData::GetIntensity(), G4GeneralParticleSourceData::GetIntensityVectorSize(), and GPSData.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetCurrentSourceIntensity ( G4double  aV)

Definition at line 145 of file G4GeneralParticleSource.cc.

References GPSData, G4GeneralParticleSourceData::Lock(), normalised, G4GeneralParticleSourceData::SetCurrentSourceIntensity(), and G4GeneralParticleSourceData::Unlock().

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetCurrentSourceto ( G4int  aV)

Definition at line 129 of file G4GeneralParticleSource.cc.

References currentSource, currentSourceIdx, G4cout, G4endl, G4GeneralParticleSourceData::GetCurrentSource(), G4GeneralParticleSourceData::GetIntensityVectorSize(), GPSData, G4GeneralParticleSourceMessenger::SetParticleGun(), and theMessenger.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetFlatSampling ( G4bool  av)
inline

Definition at line 208 of file G4GeneralParticleSource.hh.

References flat_sampling, GPSData, normalised, and G4GeneralParticleSourceData::SetFlatSampling().

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetMultipleVertex ( G4bool  av)
inline

Definition at line 204 of file G4GeneralParticleSource.hh.

References multiple_vertex.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetNumberOfParticles ( G4int  i)
inline

Definition at line 226 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::SetNumberOfParticles().

+ Here is the call graph for this function:

void G4GeneralParticleSource::SetParticleCharge ( G4double  aCharge)
inline

Definition at line 216 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::SetParticleCharge().

+ Here is the call graph for this function:

void G4GeneralParticleSource::SetParticleDefinition ( G4ParticleDefinition aParticleDefinition)
inline

Definition at line 211 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::SetParticleDefinition().

Referenced by GammaKnifeActionInitialization::GammaKnifeActionInitialization(), and UltraActionInitializer::UltraActionInitializer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetParticlePolarization ( G4ThreeVector  aVal)
inline

Definition at line 219 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::SetParticlePolarization().

Referenced by WLSPrimaryGeneratorAction::SetOptPhotonPolar(), and UltraActionInitializer::UltraActionInitializer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetParticleTime ( G4double  aTime)
inline

Definition at line 223 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::SetParticleTime().

Referenced by WLSPrimaryGeneratorAction::SetOptPhotonTime().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetVerbosity ( G4int  i)
inline

Definition at line 201 of file G4GeneralParticleSource.hh.

References currentSource, and G4SingleParticleSource::SetVerbosity().

+ Here is the call graph for this function:

Member Data Documentation

G4int G4GeneralParticleSource::currentSourceIdx
private
G4bool G4GeneralParticleSource::flat_sampling
private

Definition at line 239 of file G4GeneralParticleSource.hh.

Referenced by GeneratePrimaryVertex(), and SetFlatSampling().

G4bool G4GeneralParticleSource::multiple_vertex
private

Definition at line 238 of file G4GeneralParticleSource.hh.

Referenced by GeneratePrimaryVertex(), and SetMultipleVertex().

std::vector<G4double> G4GeneralParticleSource::sourceIntensity
private

Definition at line 244 of file G4GeneralParticleSource.hh.

std::vector<G4double> G4GeneralParticleSource::sourceProbability
private

Definition at line 245 of file G4GeneralParticleSource.hh.

std::vector<G4SingleParticleSource*> G4GeneralParticleSource::sourceVector
private

Definition at line 243 of file G4GeneralParticleSource.hh.

G4GeneralParticleSourceMessenger* G4GeneralParticleSource::theMessenger
private

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