10 #ifndef GGSGUNGENERATORACTION_H_
11 #define GGSGUNGENERATORACTION_H_
16 #include "G4ThreeVector.hh"
17 #include "G4RotationMatrix.hh"
53 _acceptanceFlag = val;
66 _rndmMinEnergyFlag = val;
79 _rndmMaxEnergyFlag = val;
92 _spectralIndexFlag = val;
140 _spectralIndex = val;
153 _rndmMinPositionFlag = _rndmMaxPositionFlag =
false;
155 _SetRndmFromSurface(0);
169 _rndmMinPositionFlag =
true;
171 _SetRndmFromSurface(1);
185 _rndmMaxPositionFlag =
true;
187 _SetRndmFromSurface(1);
200 _rndmSphereCenter = val;
201 _SetRndmFromSurface(2);
216 _rndmSphereRadius = val.mag();
217 _rndmSphereCapAlpha = acos(val[2] / _rndmSphereRadius);
218 _rndmSphereCapBeta = atan2(val[1], val[0]);
219 _SetRndmFromSurface(2);
232 _rndmSphereCapExtRand = (1. - cos(val)) / 2.;
233 _SetRndmFromSurface(2);
246 _sinTheta = sin(val);
247 _cosTheta = cos(val);
248 _rndmMinThetaFlag = _rndmMaxThetaFlag =
false;
265 _minThetaRand = (1. - cos(val)) / 2.;
266 _maxCos2ThetaRand = cos(val);
267 _maxCos2ThetaRand *= _maxCos2ThetaRand;
268 _rndmMinThetaFlag =
true;
281 _maxThetaRand = (1. - cos(val)) / 2.;
282 _minCos2ThetaRand = cos(val);
283 _minCos2ThetaRand *= _minCos2ThetaRand;
284 _rndmMaxThetaFlag =
true;
300 _rndmMinPhiFlag = _rndmMaxPhiFlag =
false;
315 _rndmMinPhiFlag =
true;
329 _rndmMaxPhiFlag =
true;
351 void _SetRndmFromSurface(
int surfType);
370 G4RotationMatrix& _ComputeRotMatrix(
double cosAlpha,
double sinAlpha,
double cosBeta,
double sinBeta);
373 void _SetRndmDirFlag();
376 void _SetRndmPosFlag();
382 void _SetShootingDir() {
383 _direction[0] = -_sinTheta * _cosPhi;
384 _direction[1] = -_sinTheta * _sinPhi;
385 _direction[2] = -_cosTheta;
398 G4double _GenSpectrumPowerLaw(G4double Emin, G4double Emax, G4double gamma);
404 G4ParticleGun *_gunGenerator;
406 G4ThreeVector _shootAxis;
407 G4bool _acceptanceFlag;
408 G4bool _rndmMinPositionFlag;
409 G4bool _rndmMaxPositionFlag;
410 G4bool _rndmFromFlat;
411 G4bool _rndmFromSphere;
412 G4ThreeVector _rndmSphereCenter;
413 G4double _rndmSphereCapExtRand;
414 G4double _rndmSphereCapAlpha;
415 G4double _rndmSphereCapBeta;
416 G4RotationMatrix _rndmSphereCapRotMat;
417 G4double _rndmSphereRadius;
418 G4bool _rndmMinEnergyFlag;
419 G4bool _rndmMaxEnergyFlag;
420 G4bool _spectralIndexFlag;
421 G4bool _rndmMinThetaFlag;
422 G4bool _rndmMaxThetaFlag;
423 G4bool _rndmMinPhiFlag;
424 G4bool _rndmMaxPhiFlag;
428 G4ThreeVector _position;
429 G4ThreeVector _minPosition;
430 G4ThreeVector _maxPosition;
434 G4double _spectralIndex;
435 G4double _sinTheta, _cosTheta;
436 G4double _minThetaRand, _maxThetaRand;
437 G4double _minCos2ThetaRand, _maxCos2ThetaRand;
438 G4double _sinPhi, _cosPhi;
441 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.
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.
~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.