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;
383 void _SetRndmFromSurface(
int surfType);
409 G4RotationMatrix &_ChangeOfBasisMatrix(
double cosAlpha,
double sinAlpha,
double cosBeta,
double sinBeta);
412 void _SetRndmDirFlag();
415 void _SetRndmPosFlag();
421 void _SetShootingDir() {
422 _direction[0] = -_sinTheta * _cosPhi;
423 _direction[1] = -_sinTheta * _sinPhi;
424 _direction[2] = -_cosTheta;
437 G4double _GenSpectrumPowerLaw(G4double Emin, G4double Emax, G4double gamma);
443 G4ParticleGun *_gunGenerator;
445 G4ThreeVector _shootAxis;
446 G4bool _acceptanceFlag;
447 G4bool _rndmMinPositionFlag;
448 G4bool _rndmMaxPositionFlag;
449 G4bool _rndmFromFlat;
450 G4bool _rndmFromSphere;
451 G4ThreeVector _rndmSphereCenter;
452 G4ThreeVector _rndmSphereCapPosition;
453 G4double _rndmSphereCapExtRand;
455 G4double _rndmSphereCapAlpha;
456 G4double _rndmSphereCapBeta;
457 G4RotationMatrix _rndmSphereCapRotMat;
458 G4double _rndmSphereRadius;
459 G4bool _rndmMinEnergyFlag;
460 G4bool _rndmMaxEnergyFlag;
461 G4bool _spectralIndexFlag;
462 G4bool _rndmMinThetaFlag;
463 G4bool _rndmMaxThetaFlag;
464 G4bool _rndmMinPhiFlag;
465 G4bool _rndmMaxPhiFlag;
469 G4ThreeVector _position;
470 G4ThreeVector _minPosition;
471 G4ThreeVector _maxPosition;
475 G4double _spectralIndex;
476 G4double _sinTheta, _cosTheta;
477 G4double _minThetaRand, _maxThetaRand;
478 G4double _minCos2ThetaRand, _maxCos2ThetaRand;
479 G4double _sinPhi, _cosPhi;
482 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.