Geant4  10.01.p02
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 () const
 
G4int GetCurrentSourceIndex () const
 
G4double GetCurrentSourceIntensity () const
 
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 () const
 
void SetParticleCharge (G4double aCharge)
 
void SetParticlePolarization (G4ThreeVector aVal)
 
G4ThreeVector GetParticlePolarization () const
 
void SetParticleTime (G4double aTime)
 
G4double GetParticleTime () const
 
void SetNumberOfParticles (G4int i)
 
G4int GetNumberOfParticles () const
 
G4ThreeVector GetParticlePosition () const
 
G4ThreeVector GetParticleMomentumDirection () const
 
G4double GetParticleEnergy () const
 
- 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 normalised
 
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 78 of file G4GeneralParticleSource.cc.

References G4GeneralParticleSourceData::GetCurrentSource(), G4GeneralParticleSourceMessenger::GetInstance(), GPSData, G4GeneralParticleSourceData::Instance(), IntensityNormalization(), G4GeneralParticleSourceMessenger::SetParticleGun(), 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(), G4GeneralParticleSourceData::GetCurrentSource(), GPSData, IntensityNormalization(), G4GeneralParticleSourceData::Lock(), 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 166 of file G4GeneralParticleSource.cc.

References G4GeneralParticleSourceData::ClearSources(), GPSData, G4GeneralParticleSourceData::Normalised(), 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 172 of file G4GeneralParticleSource.cc.

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

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::GeneratePrimaryVertex ( G4Event evt)
virtual
G4SingleParticleSource* G4GeneralParticleSource::GetCurrentSource ( ) const
inline

Definition at line 193 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), and GPSData.

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4int G4GeneralParticleSource::GetCurrentSourceIndex ( ) const
inline

Definition at line 195 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSourceIdx(), and GPSData.

Referenced by GetCurrentSourceIntensity(), and G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4double G4GeneralParticleSource::GetCurrentSourceIntensity ( ) const
inline

Definition at line 197 of file G4GeneralParticleSource.hh.

References GetCurrentSourceIndex(), 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 ( ) const
inline

Definition at line 238 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetNumberOfParticles(), and GPSData.

+ 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.

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4ParticleDefinition* G4GeneralParticleSource::GetParticleDefinition ( ) const
inline

Definition at line 217 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetParticleDefinition(), and GPSData.

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 ( ) const
inline

Definition at line 244 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetParticleEnergy(), and GPSData.

Referenced by UltraPrimaryGeneratorAction::GeneratePrimaries().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4ThreeVector G4GeneralParticleSource::GetParticleMomentumDirection ( ) const
inline

Definition at line 242 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetParticleMomentumDirection(), and GPSData.

Referenced by WLSPrimaryGeneratorAction::SetOptPhotonPolar().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4ThreeVector G4GeneralParticleSource::GetParticlePolarization ( ) const
inline

Definition at line 226 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetParticlePolarization(), and GPSData.

+ Here is the call graph for this function:

G4ThreeVector G4GeneralParticleSource::GetParticlePosition ( ) const
inline

Definition at line 240 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetParticlePosition(), and GPSData.

+ Here is the call graph for this function:

G4double G4GeneralParticleSource::GetParticleTime ( ) const
inline

Definition at line 232 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), G4SingleParticleSource::GetParticleTime(), and GPSData.

+ Here is the call graph for this function:

void G4GeneralParticleSource::IntensityNormalization ( )
private

Definition at line 112 of file G4GeneralParticleSource.cc.

References GPSData, G4GeneralParticleSourceData::IntensityNormalise(), G4GeneralParticleSourceData::Normalised(), 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::SetCurrentSourceIntensity ( G4double  aV)

Definition at line 158 of file G4GeneralParticleSource.cc.

References GPSData, G4GeneralParticleSourceData::Lock(), G4GeneralParticleSourceData::Normalised(), 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 141 of file G4GeneralParticleSource.cc.

References FatalException, G4Exception(), 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 211 of file G4GeneralParticleSource.hh.

References 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 207 of file G4GeneralParticleSource.hh.

References GPSData, and G4GeneralParticleSourceData::SetMultipleVertex().

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4GeneralParticleSource::SetNumberOfParticles ( G4int  i)
inline

Definition at line 235 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), GPSData, and G4SingleParticleSource::SetNumberOfParticles().

+ Here is the call graph for this function:

void G4GeneralParticleSource::SetParticleCharge ( G4double  aCharge)
inline

Definition at line 220 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), GPSData, and G4SingleParticleSource::SetParticleCharge().

+ Here is the call graph for this function:

void G4GeneralParticleSource::SetParticleDefinition ( G4ParticleDefinition aParticleDefinition)
inline

Definition at line 214 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), GPSData, 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 224 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), GPSData, 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 230 of file G4GeneralParticleSource.hh.

References G4GeneralParticleSourceData::GetCurrentSource(), GPSData, 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 204 of file G4GeneralParticleSource.hh.

References GPSData, and G4GeneralParticleSourceData::SetVerbosityAllSources().

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

G4bool G4GeneralParticleSource::normalised
private
G4GeneralParticleSourceMessenger* G4GeneralParticleSource::theMessenger
private

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