GGS(GenericGEANT4Simulation)Software
2.7.0
|
A single-particle generator. More...
#include <GGSGunGeneratorAction.h>
Public Member Functions | |
GGSGunGeneratorAction () | |
Constructor. | |
~GGSGunGeneratorAction () | |
Destructor. | |
void | GeneratePrimaries (G4Event *) |
GeneratePrimaries. More... | |
void | SetAcceptanceFlag (G4bool val) |
Set the acceptance control. More... | |
void | SetRndmMinEnergyFlag (G4bool val) |
Sets the min energy flag. More... | |
void | SetRndmMaxEnergyFlag (G4bool val) |
Sets the max energy flag. More... | |
void | SetSpectralIndexFlag (G4bool val) |
Sets the spectral index geeration. More... | |
void | SetEnergy (G4double val) |
Sets the particle's kinetic energy. More... | |
void | SetMinEnergy (G4double val) |
Sets the particle's min kinetic energy. More... | |
void | SetMaxEnergy (G4double val) |
Sets the particle's max kinetic energy. More... | |
void | SetSpectralIndex (G4double val) |
Sets the spectral index. More... | |
void | SetPosition (const G4ThreeVector &val) |
Sets the particle's generation position. More... | |
void | SetMinPosition (const G4ThreeVector &val) |
Sets the particle's minimum generation position. More... | |
void | SetMaxPosition (const G4ThreeVector &val) |
Sets the particle's maximum generation position. More... | |
void | SetSphereCenter (const G4ThreeVector &val) |
Sets the center of the spherical surface. More... | |
void | SetSphereCapPosition (const G4ThreeVector &val) |
Sets the position of the spherical cap on the sphere. More... | |
void | SetSphereCapExtension (G4double val) |
Sets the extension of the spherical cap. More... | |
void | SetTheta (G4double val) |
Sets the value for theta. More... | |
void | SetMinTheta (G4double val) |
Sets the minimum random value for theta. More... | |
void | SetMaxTheta (G4double val) |
Sets the maximum random value for theta. More... | |
void | SetPhi (G4double val) |
Sets the value for phi. More... | |
void | SetMinPhi (G4double val) |
Sets the minimum value for phi. More... | |
void | SetMaxPhi (G4double val) |
Sets the maximum value for phi. More... | |
void | SetGunParticle (const G4String &particle) |
Sets the particle to be used by G4ParticleGun. More... | |
GGSParameters | GetParameters () const |
Gets the generation parameters. More... | |
![]() | |
GGSGeneratorAction () | |
Constructor. | |
~GGSGeneratorAction () | |
Destructor. | |
unsigned int | GetNDiscarded () const |
Returns the number of discarded events for the current event generation. More... | |
Additional Inherited Members | |
![]() | |
unsigned long int | _nDiscarded |
A single-particle generator.
This is a wrapper for the G4ParticleGun generator, with some custom features.
Definition at line 26 of file GGSGunGeneratorAction.h.
void GGSGunGeneratorAction::GeneratePrimaries | ( | G4Event * | anEvent | ) |
GeneratePrimaries.
This class defines the parameters of the projectile primary particles It is called at the beginning of each event.
Definition at line 218 of file GGSGunGeneratorAction.cpp.
|
virtual |
Gets the generation parameters.
The parameters exported by the GGSGunGeneratorAction are:
General
Name | Type | Description | Exported -------------—| ------------—|-----------------------------------------------------—|-----------------------------------— generator | string | The name of the generator "gun" | Always acceptanceCheck | bool | Flag for acceptance check | Always
Generation position
Name | Type | Description | Exported |
---|---|---|---|
genPosition | string | Generation position: "point", "plane", "box", "sphere" | Always |
minPosition | vector<double> | Coordinates of the minimum generation point [cm] | When |
genPosition is "plane" or "box" maxPosition | vector<double> | Coordinates of the maximum generation point [cm] | When genPosition is "plane" or "box" sphereCenter | vector<double> | Center of the generation sphere cap [cm] | When genPosition is "sphere" sphereCapPosition | vector<double> | Position of the sphere cap w.r.t. the sphere center [cm] | When genPosition is "sphere" sphereExtension | double | Angular extension of the sphere [rad] | When genPosition is "sphere" position | vector<double> | Coordinates of the generation point [cm] | When genPosition is "point"
Generation direction
Name | Type | Description | Exported |
---|---|---|---|
genDirection | string | Generation direction: "fixed", "uniform", "isotropic" | Always |
minPhi | double | Minimum azimuth angle [rad] | When |
genDirection is "uniform" or "isotropic" maxPhi | double | Maximum azimuth angle [rad] | When |
genDirection is "uniform" or "isotropic" minTheta | double | Minimum polar angle [rad] | When |
genDirection is "uniform" or "isotropic" maxTheta | double | Maximum polar angle [rad] | When |
genDirection is "uniform" or "isotropic" phi | double | Azimuth angle [rad] | When minPhi and |
maxPhi are not exported theta | double | Polar angle [rad] | When minTheta and maxTheta are not |
exported
Notes: for generations from surfaces (i.e. genPosition == "point" or genPosition == "sphere") the polar and azimuth angles are always referred to the normal direction to the surface in the generation point.
Generation energy
Name | Type | Description | Exported |
---|---|---|---|
genSpectrum | string | Generation spectrum: "monochromatic", "flat", "powerLaw" | Always |
minEnergy | double | Minimum kinetic energy [GeV] | When |
genSpectrum is "flat" or "powerLaw" maxEnergy | double | Maximum kinetic energy [GeV] | When |
genSpectrum is "flat" or "powerLaw" spectralIndex | double | Spectral index | When genSpectrum is |
"powerLaw" energy | double | Kinetic energy [GeV] | When genSpectrum is "monochromatic"
Reimplemented from GGSGeneratorAction.
Definition at line 364 of file GGSGunGeneratorAction.cpp.
|
inline |
Set the acceptance control.
Acceptance must defined by the implementation of GGSVGeometryConstruction::IsInsideAcceptance in the current geometry. Events discarded by the acceptance check can be retrieved by means of the GetNDiscarded method defined in the mother class.
val | If true, acceptance check will be performed for random events. |
Definition at line 51 of file GGSGunGeneratorAction.h.
|
inline |
Sets the particle's kinetic energy.
This function is called by the messenger. Has effect only on gun generator.
val | The particle's energy. |
Definition at line 93 of file GGSGunGeneratorAction.h.
void GGSGunGeneratorAction::SetGunParticle | ( | const G4String & | particle | ) |
Sets the particle to be used by G4ParticleGun.
particle | The particle to shoot. A std::string value like "e+" or "proton". |
Definition at line 62 of file GGSGunGeneratorAction.cpp.
|
inline |
Sets the particle's max kinetic energy.
Sets the maximum value of randomized energy spectrum. This function is called by the messenger. Has effect only on gun generator.
val | The particle's max energy. |
Definition at line 113 of file GGSGunGeneratorAction.h.
|
inline |
Sets the maximum value for phi.
For isotropic generation, this sets the maximum random value for phi. This function is called by the messenger. Has effect only on gun generator.
val | The maximum random value for phi. |
Definition at line 310 of file GGSGunGeneratorAction.h.
|
inline |
Sets the particle's maximum generation position.
Random position generation is done inside a volume defined by specifying the "minimum" and "maximum" coordinates vectors. This function is called by the messenger. Has effect only on gun generator.
val | The particle's max position. |
Definition at line 166 of file GGSGunGeneratorAction.h.
|
inline |
Sets the maximum random value for theta.
For isotropic generation, this sets the maximum random value for theta. From the theta value passed as parameter it computes and store the lower limit of the uniform distribution from which a random number will be extracted and subsequently transformed into theta by means of an inverse CDF technique.
val | The maximum random value for theta. |
Definition at line 263 of file GGSGunGeneratorAction.h.
|
inline |
Sets the particle's min kinetic energy.
Sets the minimum value of randomized energy spectrum. This function is called by the messenger. Has effect only on gun generator.
val | The particle's min energy. |
Definition at line 103 of file GGSGunGeneratorAction.h.
|
inline |
Sets the minimum value for phi.
For isotropic generation, this sets the minimum random value for phi. This function is called by the messenger. Has effect only on gun generator.
val | The minimum random value for phi. |
Definition at line 296 of file GGSGunGeneratorAction.h.
|
inline |
Sets the particle's minimum generation position.
Random position generation is done inside a volume defined by specifying the "minimum" and "maximum" coordinates vectors. This function is called by the messenger. Has effect only on gun generator.
val | The particle's min position. |
Definition at line 150 of file GGSGunGeneratorAction.h.
|
inline |
Sets the minimum random value for theta.
For isotropic generation, this sets the minimum random value for theta. From the theta value passed as parameter it computes and store the lower limit of the uniform distribution from which a random number will be extracted and subsequently transformed into theta by means of an inverse CDF technique. This function is called by the messenger. Has effect only on gun generator.
val | The minimum random value for theta. |
Definition at line 247 of file GGSGunGeneratorAction.h.
|
inline |
Sets the value for phi.
Phi is the azimuth angle, defined as zero for particles traveling along the X axis towards negative direction. This function is called by the messenger. Has effect only on gun generator.
val | The value for phi. |
Definition at line 280 of file GGSGunGeneratorAction.h.
|
inline |
Sets the particle's generation position.
This function is called by the messenger. Has effect only on gun generator.
val | The particle's position. |
Definition at line 133 of file GGSGunGeneratorAction.h.
|
inline |
Sets the max energy flag.
If both min energy and max energy flags are set to true, energy will be randomized. This function is called by the messenger. Has effect only on gun generator.
val | The flag value. |
Definition at line 73 of file GGSGunGeneratorAction.h.
|
inline |
Sets the min energy flag.
If both min energy and max energy flags are set to true, energy will be randomized. This function is called by the messenger. Has effect only on gun generator.
val | The flag value. |
Definition at line 62 of file GGSGunGeneratorAction.h.
|
inline |
Sets the spectral index.
If spectral index flag is set, this method specifies the value of the index to generate a power law spectrum. This function is called by the messenger. Has effect only on gun generator.
val | The spectral index value. |
Definition at line 124 of file GGSGunGeneratorAction.h.
|
inline |
Sets the spectral index geeration.
If set to true, the eventually randomized energies will be extracted to generate a power law spectrum. This function is called by the messenger. Has effect only on gun generator.
val | The flag value. |
Definition at line 84 of file GGSGunGeneratorAction.h.
|
inline |
Sets the extension of the spherical cap.
The angular width of the spherical cap is set by this method. By "angular width" we mean the angle between the cap position std::vector (set by SetSphereCapPosition) and the position std::vector of a point on the cap's border (both the vectors are relative to the sphere center).
val | The angular extension of the spherical cap. |
Definition at line 215 of file GGSGunGeneratorAction.h.
|
inline |
Sets the position of the spherical cap on the sphere.
The position of the spherical cap from which the particles will be randomly generated can be set by means of this method. The position std::vector is relative to the sphere center and not to the absolute frame. The width of the cap can be set using SetSphereCapExtension. The modulus of the specified position std::vector of the spherical cap will be used as the sphere radius.
val |
Definition at line 198 of file GGSGunGeneratorAction.h.
|
inline |
Sets the center of the spherical surface.
This method sets the center of the sphere from which particles will be randomly generated. Actually, the generation is not done on the whole sphere but on a cap.
val | The center of the sphere. |
Definition at line 182 of file GGSGunGeneratorAction.h.
|
inline |
Sets the value for theta.
Theta is the altitude angle, defined as zero for particles traveling along the Z axis towards negative direction. This function is called by the messenger. Has effect only on gun generator.
val | The value for theta. |
Definition at line 229 of file GGSGunGeneratorAction.h.