10 #ifndef GGSGUNGENERATORACTION_H_
11 #define GGSGUNGENERATORACTION_H_
15 #include "G4RotationMatrix.hh"
16 #include "G4ThreeVector.hh"
136 _rndmMinPositionFlag = _rndmMaxPositionFlag =
false;
138 _SetRndmFromSurface(0);
152 _rndmMinPositionFlag =
true;
154 _SetRndmFromSurface(1);
168 _rndmMaxPositionFlag =
true;
170 _SetRndmFromSurface(1);
183 _rndmSphereCenter = val;
184 _SetRndmFromSurface(2);
199 _rndmSphereCapPosition = val;
200 _rndmSphereRadius = val.mag();
201 _rndmSphereCapAlpha = acos(val[2] / _rndmSphereRadius);
202 _rndmSphereCapBeta = atan2(val[1], val[0]);
203 _SetRndmFromSurface(2);
216 _rndmSphereCapExtRand = (1. - cos(val)) / 2.;
217 _SetRndmFromSurface(2);
230 _sinTheta = sin(val);
231 _cosTheta = cos(val);
232 _rndmMinThetaFlag = _rndmMaxThetaFlag =
false;
248 _minThetaRand = (1. - cos(val)) / 2.;
249 _maxCos2ThetaRand = cos(val);
250 _maxCos2ThetaRand *= _maxCos2ThetaRand;
251 _rndmMinThetaFlag =
true;
264 _maxThetaRand = (1. - cos(val)) / 2.;
265 _minCos2ThetaRand = cos(val);
266 _minCos2ThetaRand *= _minCos2ThetaRand;
267 _rndmMaxThetaFlag =
true;
283 _rndmMinPhiFlag = _rndmMaxPhiFlag =
false;
298 _rndmMinPhiFlag =
true;
312 _rndmMaxPhiFlag =
true;
387 void _SetRndmFromSurface(
int surfType);
406 G4RotationMatrix &_ComputeRotMatrix(
double cosAlpha,
double sinAlpha,
double cosBeta,
double sinBeta);
409 void _SetRndmDirFlag();
412 void _SetRndmPosFlag();
418 void _SetShootingDir() {
419 _direction[0] = -_sinTheta * _cosPhi;
420 _direction[1] = -_sinTheta * _sinPhi;
421 _direction[2] = -_cosTheta;
434 G4double _GenSpectrumPowerLaw(G4double Emin, G4double Emax, G4double gamma);
440 G4ParticleGun *_gunGenerator;
442 G4ThreeVector _shootAxis;
443 G4bool _acceptanceFlag;
444 G4bool _rndmMinPositionFlag;
445 G4bool _rndmMaxPositionFlag;
446 G4bool _rndmFromFlat;
447 G4bool _rndmFromSphere;
448 G4ThreeVector _rndmSphereCenter;
449 G4ThreeVector _rndmSphereCapPosition;
450 G4double _rndmSphereCapExtRand;
452 G4double _rndmSphereCapAlpha;
453 G4double _rndmSphereCapBeta;
454 G4RotationMatrix _rndmSphereCapRotMat;
455 G4double _rndmSphereRadius;
456 G4bool _rndmMinEnergyFlag;
457 G4bool _rndmMaxEnergyFlag;
458 G4bool _spectralIndexFlag;
459 G4bool _rndmMinThetaFlag;
460 G4bool _rndmMaxThetaFlag;
461 G4bool _rndmMinPhiFlag;
462 G4bool _rndmMaxPhiFlag;
466 G4ThreeVector _position;
467 G4ThreeVector _minPosition;
468 G4ThreeVector _maxPosition;
472 G4double _spectralIndex;
473 G4double _sinTheta, _cosTheta;
474 G4double _minThetaRand, _maxThetaRand;
475 G4double _minCos2ThetaRand, _maxCos2ThetaRand;
476 G4double _sinPhi, _cosPhi;
479 G4ThreeVector _direction;
void SetEnergy(G4double val)
Sets the particle's kinetic energy.
void SetMinTheta(G4double val)
Sets the minimum random value for theta.
void SetPosition(const G4ThreeVector &val)
Sets the particle's generation position.
GGSGunGeneratorAction()
Constructor.
void SetMinEnergy(G4double val)
Sets the particle's min kinetic energy.
void SetRndmMaxEnergyFlag(G4bool val)
Sets the max energy flag.
Base class for GGS generator actions.
void SetRndmMinEnergyFlag(G4bool val)
Sets the min energy flag.
void SetSpectralIndex(G4double val)
Sets the spectral index.
void SetSphereCenter(const G4ThreeVector &val)
Sets the center of the spherical surface.
void SetAcceptanceFlag(G4bool val)
Set the acceptance control.
void SetPhi(G4double val)
Sets the value for phi.
void SetMaxPhi(G4double val)
Sets the maximum value for phi.
Messenger class for gun generator action.
A single-particle generator.
Class for storing parameters.
void SetMaxTheta(G4double val)
Sets the maximum random value for theta.
void SetGunParticle(const G4String &particle)
Sets the particle to be used by G4ParticleGun.
void SetMinPosition(const G4ThreeVector &val)
Sets the particle's minimum generation position.
void SetTheta(G4double val)
Sets the value for theta.
GGSParameters GetParameters() const
Gets the generation parameters.
~GGSGunGeneratorAction()
Destructor.
void SetSphereCapPosition(const G4ThreeVector &val)
Sets the position of the spherical cap on the sphere.
void SetMaxPosition(const G4ThreeVector &val)
Sets the particle's maximum generation position.
void SetSphereCapExtension(G4double val)
Sets the extension of the spherical cap.
void GeneratePrimaries(G4Event *)
GeneratePrimaries.
void SetMaxEnergy(G4double val)
Sets the particle's max kinetic energy.
void SetSpectralIndexFlag(G4bool val)
Sets the spectral index geeration.
void SetMinPhi(G4double val)
Sets the minimum value for phi.