Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Event.hh,v 1.7 2003/09/09 20:09:17 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Event.hh,v 1.10 2004/06/11 14:11:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4Event_h
@@ -155,7 +155,11 @@ class G4Event
// Set and Get method of G4VUserEventInformation
};
extern G4Allocator<G4Event> anEventAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4Event> anEventAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4Event> anEventAllocator;
#endif
inline void* G4Event::operator new(size_t)
{
+9 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.hh,v 1.12 2003/09/09 20:09:17 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4EventManager.hh,v 1.14 2004/05/26 17:08:33 asaim Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -126,6 +126,7 @@ class G4EventManager
G4SDManager* sdManager;
G4PrimaryTransformer* transformer;
G4bool tracking;
G4bool abortRequested;
G4EvManMessenger* theMessenger;
@@ -146,6 +147,7 @@ class G4EventManager
public: // with description
inline void AbortCurrentEvent()
{
abortRequested = true;
trackContainer->clear();
if(tracking) trackManager->EventAborted();
}
@@ -173,6 +175,11 @@ class G4EventManager
void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
{ trackContainer->SetNumberOfAdditionalWaitingStacks(iAdd); }
inline G4StackManager* GetStackManager() const
{ return trackContainer; }
inline G4TrackingManager* GetTrackingManager() const
{ return trackManager; }
public: // with description
inline G4int GetVerboseLevel()
{ return verboseLevel; }
+119 -582
View File
@@ -22,647 +22,184 @@
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4GeneralParticleSource.hh
// MODULE: G4GeneralParticleSource.hh
//
// Version: 1.1
// Date: 18/10/00
// Author: C Ferguson, F Lei & P Truscott
// Organisation: University of Southampton / DERA
// Customer: ESA/ESTEC
// Version: 2.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
// Documentation avaialable at http://reat.space.qinetiq.com/gps
// These include:
// User Requirement Document (URD)
// Software Specification Documents (SSD)
// Software User Manual (SUM): on-line version available
// Technical Note (TN) on the physics and algorithms
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSource.hh,v 1.8 2003/10/13 09:21:27 flei Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
// CHANGE HISTORY
// --------------
//
// Version 2.0, 05/02/2004, Fan Lei, Created.
// based on version 1.1 in Geant4 v6.0
// - Mutilple particle source definition
// - Re-structured commands
// - Split the task into smaller classes
//
// - old commonds have been retained for backward compatibility, but will
// be removed in the future.
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// The General Particle Source is designed to extend the functionality of the
// G4ParticleGun class. It is designed to allow specification of input
// particles in terms of position, direction (or angular) and energy
// distributions. This class is derived from G4VPrimaryGenerator.
// The General Particle Source is designed to replace the G4ParticleGun class.
// It is designed to allow specification of mutiple particle sources, each with
// independent definitions of particle type, position, direction (or angular)
// and energy distributions.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4GeneralParticleSource ()
// Constructor: Initializes variables and instantiates the
// Messenger and Navigator classes
// G4GeneralParticleSource()
// Constructor: Initializes variables and instantiates the
// Messenger and generator classes
//
// ~G4GeneralParticleSource ()
// Destructor: deletes Messenger and prints out run information.
// ~G4GeneralParticleSourceMessenger()
// Destructor: deletes Messenger and others
//
// void GeneratePrimaryVertex(G4Event *evt)
// Generate the particles initial parameters.
// G4int GetNumberofSource()
// Return the number of particle gun defined
//
// void SetPosDisType(G4String)
// Allows user to choose Point, Plane, Surface or Volume source
// position distributions.
// void ListSource()
// List the particle guns defined
//
// void SetPosDisShape(G4String)
// Allows the user to choose the particular shape they wish for the
// position distribution. Choices are Square, Circle, Ellipse, Rectangle,
// Sphere, Ellipsoid, Cylinder, Parallelepiped.
// void SetCurrentSourceto(G4int)
// set the current gun to the specified one so its definition can be changed
//
// void SetCentreCoords(G4ThreeVector)
// Sets the co-ordinates of the centre of the position distribution.
//
// void SetPosRot1(G4ThreeVector)
// Used to specify the co-ordinate system for the position distribution
// along with SetPosRot2. SetPosRot1 sets the vector x' and need not be
// a unit vector.
//
// void SetPosRot2(G4ThreeVector)
// Used in connection with SetPosRot1. This sets a vector in the plane
// x'y'. By a series of cross products x', y', z' are generated. Again
// need not be a unit vector.
// void SetCurrentSourceIntensity(G4double)
// change the current particle gun strength
//
// G4SingleParticleSource* GetCurrentSource()
// return the pointer to current particle gun
//
// void SetHalfX(G4double)
// Sets the half length in x.
// G4int GetCurrentSourceIndex()
// return the index of the current particle gun
//
// void SetHalfY(G4double)
// Sets the half length in y.
// G4double GetCurrentSourceIntensity()
// return the strength of the current gun
//
// void SetHalfZ(G4double)
// Sets the half length in z.
// void ClearAll()
// remove all defined aprticle gun
//
// void SetRadius(G4double)
// Sets the radius where appropriate for source distribution shapes.
// void AddaSource (G4double)
// add a new particle gun with the specified strength
//
// void SetRadius0(G4double)
// Sets the inner radius where appropriate for source distribution shapes.
// void DeleteaSource(G4int);
// delete the specified particle gun
//
// void SetParAlpha(G4double)
// Sets the angle Alpha in the Parallelepiped shapes.
// void SetParticleDefinition ();
// G4ParticleDefinition * GetParticleDefinition ()
// Get/Set the particle definition of the primary track
//
// void SetParTheta(G4double)
// Sets the angle Theta in the Parallelepiped shapes.
// void SetParticleCharge(G4double aCharge)
// set the charge state of the primary track
//
// void SetParPhi(G4double)
// Sets the angle Phi in the Parallelepiped shapes.
// inline void SetParticlePolarization (G4ThreeVector aVal)
// inline G4ThreeVector GetParticlePolarization ()
// Set/Get the polarization state of the primary track
//
// void ConfineSourceToVolume(G4String)
// Used to confine the start positions to a particular volume.
// inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
// inline G4double GetParticleTime() { return particle_time; };
// Set/Get the Time.
//
// void GenerateRotationMatrices()
// This is used to calculate the cross products and determine the
// vectors x', y', z' for the position distribution.
// inline void SetNumberOfParticles(G4int i)
// inline G4int GetNumberOfParticles()
// set/get the number of particles to be generated in the primary track
//
// void GeneratePointSource()
// Generates a point source.
//
// void GeneratePointsInPlane()
// Generates starting positions confined to a plane source.
//
// void GeneratePointsOnSurface()
// Generates starting positions confined to the surface of a shape.
//
// void GeneratePointsInVolume()
// Generates starting positions within the volume of a shape.
//
// G4bool IsSourceConfined()
// Checks the source is confined to the requested volume.
//
// Angular Distribution Methods:
//
// void SetAngDistType(G4String)
// Used to set the type of angular distribution wanted. Arguments
// are iso, cos and user for isotropic, cosine-law and user-defined
// respectively.
//
// void DefineAngRefAxes(G4String, G4ThreeVector)
// DefineAngRefAxes is used in a similar way as SetPosRot to
// define vectors, one x' and one in the plane x'y', to create
// a rotated set of axes for the angular distribution.
//
// void SetMinTheta(G4double)
// Sets the minimum value for the angle theta.
//
// void SetMinPhi(G4double)
// Sets the minimum value for phi.
//
// void SetMaxTheta(G4double)
// Sets the maximum value for theta.
//
// void SetMaxPhi(G4double)
// Sets the maximum value for phi.
//
// void UserDefAngTheta(G4ThreeVector)
// This method allows the user to define a histogram in Theta.
//
// void UserDefAngPhi(G4ThreeVector)
// This method allows the user to define a histogram in phi.
//
// void GenerateIsotropicFlux()
// This method generates momentum vectors for particles according
// to an isotropic distribution.
//
// void GenerateCosineLawFlux()
// This method generates momentum vectors for particles according
// to a cosine-law distribution.
//
// void GenerateUserDefFlux()
// Controls generation of momentum vectors according to user-defined
// distributions.
//
// G4double GenerateUserDefTheta()
// Generates the theta angle according to a user-defined distribution.
//
// G4double GenerateUserDefPhi()
// Generates phi according to a user-defined distribution.
//
// void SetUserWRTSurface(G4bool)
// Allows user to have user-defined spectra either with respect to the
// co-ordinate system (default) or with respect to the surface normal.
//
// Energy Distribution methods:
//
// void SetEnergyDisType(G4String)
// Allows the user to choose the energy distribution type. The arguments
// are Mono (mono-energetic), Lin (linear), Pow (power-law), Exp
// (exponential), Brem (bremsstrahlung), BBody (black-body), Cdg
// (cosmic diffuse gamma-ray), User (user-defined), Arb (arbitrary
// point-wise), Epn (energy per nucleon).
//
// void SetEmin(G4double)
// Sets the minimum energy.
//
// void SetEmax(G4double)
// Sets the maximum energy.
//
// void SetMonoEnergy(G4double)
// Sets energy for mono-energetic distribution.
//
// void SetAlpha(G4double)
// Sets alpha for a power-law distribution.
//
// void SetTemp(G4double)
// Sets Temperature for a Brem or BBody distributions.
//
// void SetEzero(G4double)
// Sets Ezero for an exponential distribution.
//
// void SetGradient(G4double)
// Sets gradient for a linear distribution.
//
// void SetInterCept(G4double)
// Sets intercept for a linear distribution.
//
// void UserEnergyHisto(G4ThreeVector)
// Allows user to defined a histogram for the energy distribution.
//
// void ArbEnergyHisto(G4ThreeVector)
// Allows the user to define an Arbitrary set of points for the
// energy distribution.
//
// void EpnEnergyHisto(G4ThreeVector)
// Allows the user to define an Energy per nucleon histogram.
//
// void Calculate()
// Controls the calculation of Integral PDF for the Cdg and BBody
// distributions.
//
// void CalculateCdgSpectrum()
// Calculates the integral PDF for the Cdg distribution.
//
// void CalculateBbodySpectrum()
// Calculates the Integral PDF for the Bbody distribution.
//
// void InputEnergySpectra(G4bool)
// Allows the user to choose between momentum and energy histograms
// for user-defined histograms and arbitrary point-wise spectr.
// The default is true (energy).
//
// void InputDifferentialSpectra(G4bool)
// Allows the user to choose between integral and differential
// distributions when using the arbitrary point-wise option.
//
// void ArbInterpolate(G4String)
// ArbInterpolate allows the user to specify the type of function to
// interpolate the Arbitrary points spectrum with.
//
// void LinearInterpolation()
// Interpolates arbitrary points with a series of line segments.
//
// void LogInterpolation()
// Interpolates arbitrary points with a series of power-laws.
//
// void ExpInterpolation()
// Interpolates arbitrary points with a series of exponentials.
//
// void SplineInterpolation()
// Interpolates arbitrary points using cubic splines.
//
// void GenerateMonoEnergetic()
// Generates a mono-energetic source.
//
// void GenerateLinearEnergies()
// Generates particle energies according to a linear distribution.
//
// void GeneratePowEnergies()
// Generates particle energies according to a power-law distribution.
//
// void GenerateExpEnergies()
// Generates particle energies according to an exponential distribution.
//
// void GenerateBremEnergies()
// Generates particle energies according to a bremsstrahlung distribution.
//
// void GenerateBbodyEnergies()
// Generates particle energies according to a black-body distribution.
//
// void GenerateCdgEnergies()
// Generates particle energies according to a Cdg distribution.
//
// void GenUserHistEnergies()
// Generates particle energies according to a user-defined distribution.
//
// void GenEpnHistEnergies()
// Generates particle energies according to a energy per nucleon
// distribution.
//
// void GenArbPointEnergies()
// Generates particle energies according to an arbitrary point-wise
// spectrum.
//
// void ConvertEPNToEnergy()
// Converts energy per nucleon histograms to energy histograms.
//
// Biasing Methods:
//
// void SetXBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate x co-ordinates.
//
// void SetYBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate y co-ordinates.
//
// void SetZBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate z co-ordinates.
//
// void SetThetaBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of theta.
//
// void SetPhiBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of phi.
//
// void SetEnergyBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate the energies.
//
// G4double GenRandX()
// Generates the random number for x, with or without biasing.
//
// G4double GenRandY()
// Generates the random number for y, with or without biasing.
//
// G4double GenRandZ()
// Generates the random number for z, with or without biasing.
//
// G4double GenRandTheta()
// Generates the random number for theta, with or without biasing.
//
// G4double GenRandPhi()
// Generates the random number for phi, with or without biasing.
//
// G4double GenRandEnergy()
// Generates the random number for energy, with or without biasing.
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
// inline G4ThreeVector GetParticlePosition()
// inline G4ThreeVector GetParticleMomentumDirection()
// inline G4double GetParticleEnergy()
// get the position, direction, and energy of the current particle
//
///////////////////////////////////////////////////////////////////////////////
//
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 28 February 2000, C Ferguson, Created.
//
// Version 1.1, 18 October 2000, Modified to inherit from G4VPrimaryGenerator.
// New name at the request of M. Asai.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4GeneralParticleSource_h
#define G4GeneralParticleSource_h 1
#ifndef G4GeneralParticleSource_H
#define G4GeneralParticleSource_H 1
#include "G4VPrimaryGenerator.hh"
#include "G4Navigator.hh"
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
#include "G4DataInterpolation.hh"
#include "globals.hh"
#include <vector>
#include "G4Event.hh"
#include "G4SingleParticleSource.hh"
//
#include "G4GeneralParticleSourceMessenger.hh"
class G4GeneralParticleSource : public G4VPrimaryGenerator
class G4GeneralParticleSource
{
//
public:
G4GeneralParticleSource ();
~G4GeneralParticleSource ();
void GeneratePrimaryVertex(G4Event *evt);
// methods to create source position dist.
void SetPosDisType(G4String); // Point, Plane, Surface, Volume
inline G4String GetPosDisType()
{ return SourcePosType; }
void SetPosDisShape(G4String);
inline G4String GetPosDisShape()
{ return Shape; }
// SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere,
// Ellipsoid, Cylinder, Right (parallelepiped).
void SetCentreCoords(G4ThreeVector);
inline G4ThreeVector GetCentreCoords()
{ return CentreCoords; }
void SetPosRot1(G4ThreeVector);
void SetPosRot2(G4ThreeVector);
void SetHalfX(G4double);
inline G4double GetHalfX()
{ return halfx; }
void SetHalfY(G4double);
inline G4double GetHalfY()
{ return halfy; }
void SetHalfZ(G4double);
inline G4double GetHalfZ()
{ return halfz; }
void SetRadius(G4double);
inline G4double GetRadius()
{ return Radius; }
void SetRadius0(G4double);
void SetBeamSigmaInR(G4double);
void SetBeamSigmaInX(G4double);
void SetBeamSigmaInY(G4double);
void SetParAlpha(G4double);
void SetParTheta(G4double);
void SetParPhi(G4double);
void ConfineSourceToVolume(G4String);
void GenerateRotationMatrices();
// the following routines generate the source position
void GeneratePointSource();
void GeneratePointsInBeam();
void GeneratePointsInPlane();
void GeneratePointsOnSurface();
void GeneratePointsInVolume();
G4GeneralParticleSource();
~G4GeneralParticleSource();
G4bool IsSourceConfined();
void GeneratePrimaryVertex(G4Event*);
// Angular Distribution Methods
void SetAngDistType(G4String);
void DefineAngRefAxes(G4String, G4ThreeVector);
void SetMinTheta(G4double);
void SetMinPhi(G4double);
void SetMaxTheta(G4double);
void SetMaxPhi(G4double);
void SetBeamSigmaInAngR(G4double);
void SetBeamSigmaInAngX(G4double);
void SetBeamSigmaInAngY(G4double);
void UserDefAngTheta(G4ThreeVector);
void UserDefAngPhi(G4ThreeVector);
inline void SetParticleMomentumDirection
(G4ParticleMomentum aMomentumDirection)
{ particle_momentum_direction = aMomentumDirection.unit(); }
// These methods generate the momentum vectors for the particles.
void GenerateIsotropicFlux();
void GenerateCosineLawFlux();
void GenerateBeamFlux();
void GeneratePlanarFlux();
void GenerateUserDefFlux();
G4double GenerateUserDefTheta();
G4double GenerateUserDefPhi();
void SetUseUserAngAxis(G4bool);
void SetUserWRTSurface(G4bool);
// Energy Distribution methods
void SetEnergyDisType(G4String);
inline G4String GetEnergyDisType()
{return EnergyDisType;}
void SetEmin(G4double);
inline G4double GetEmin()
{return Emin;}
inline G4double GetArbEmin()
{return ArbEmin;}
void SetEmax(G4double);
inline G4double GetEmax()
{return Emax;}
inline G4double GetArbEmax()
{return ArbEmax;}
void SetMonoEnergy(G4double);
void SetAlpha(G4double);
void SetTemp(G4double);
void SetBeamSigmaInE(G4double);
void SetEzero(G4double);
void SetGradient(G4double);
void SetInterCept(G4double);
void UserEnergyHisto(G4ThreeVector);
void ArbEnergyHisto(G4ThreeVector);
void EpnEnergyHisto(G4ThreeVector);
void Calculate();
void CalculateCdgSpectrum();
void CalculateBbodySpectrum();
void InputEnergySpectra(G4bool);
void InputDifferentialSpectra(G4bool);
void ArbInterpolate(G4String);
inline G4String GetIntType()
{return IntType;}
void LinearInterpolation();
void LogInterpolation();
void ExpInterpolation();
void SplineInterpolation();
// The following methods generate energies according to the spectral
// parameters defined above.
void GenerateMonoEnergetic();
void GenerateLinearEnergies();
void GeneratePowEnergies();
void GenerateExpEnergies();
void GenerateGaussEnergies();
void GenerateBremEnergies();
void GenerateBbodyEnergies();
void GenerateCdgEnergies();
void GenUserHistEnergies();
void GenEpnHistEnergies();
void GenArbPointEnergies();
// converts energy per nucleon to energy.
void ConvertEPNToEnergy();
// Biasing Methods
void SetXBias(G4ThreeVector);
void SetYBias(G4ThreeVector);
void SetZBias(G4ThreeVector);
void SetThetaBias(G4ThreeVector);
void SetPhiBias(G4ThreeVector);
void SetEnergyBias(G4ThreeVector);
G4double GenRandX();
G4double GenRandY();
G4double GenRandZ();
G4double GenRandTheta();
G4double GenRandPhi();
G4double GenRandEnergy();
// method to re-set the histograms
void ReSetHist(G4String);
G4int GetNumberofSource() { return G4int(sourceVector.size()); };
void ListSource();
void SetCurrentSourceto(G4int) ;
void SetCurrentSourceIntensity(G4double);
G4SingleParticleSource* GetCurrentSource() {return currentSource;};
G4int GetCurrentSourceIndex() { return currentSourceIdx; };
G4double GetCurrentSourceIntensity() { return sourceIntensity[currentSourceIdx]; };
void ClearAll();
void AddaSource (G4double);
void DeleteaSource(G4int);
// Set the verbosity level.
void SetVerbosity(G4int);
inline void SetVerbosity(G4int i) {currentSource->SetVerbosity(i);} ;
// Set the particle species
void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition);
inline G4ParticleDefinition * GetParticleDefinition ()
{return particle_definition;}
inline void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
{currentSource->SetParticleDefinition(aParticleDefinition); } ;
// SR1.3 - allowing user to define an isotope by A,Z,energy.
// void SetNucleus(Nucleus theIon1); // Sets the isotope.
//inline Nucleus GetNucleus() {return theIon;} // Returns the isotope.
inline G4ParticleDefinition * GetParticleDefinition () { return currentSource->GetParticleDefinition();} ;
inline void SetParticleCharge(G4double aCharge)
{ particle_charge = aCharge; }
inline void SetParticleCharge(G4double aCharge) { currentSource->SetParticleCharge(aCharge); } ;
// Set polarization
inline void SetParticlePolarization (G4ThreeVector aVal)
{particle_polarization = aVal;}
inline G4ThreeVector GetParticlePolarization ()
{return particle_polarization;}
inline void SetParticlePolarization (G4ThreeVector aVal) {currentSource->SetParticlePolarization(aVal);};
inline G4ThreeVector GetParticlePolarization () {return currentSource->GetParticlePolarization();};
// Set Time.
inline void SetParticleTime(G4double aTime)
{ particle_time = aTime; }
inline G4double GetParticleTime()
{ return particle_time; }
inline void SetParticleTime(G4double aTime) { currentSource->SetParticleTime(aTime); };
inline G4double GetParticleTime() { return currentSource->GetParticleTime(); };
inline void SetNumberOfParticles(G4int i)
{ NumberOfParticlesToBeGenerated = i; }
inline G4int GetNumberOfParticles()
{ return NumberOfParticlesToBeGenerated; }
inline G4ThreeVector GetParticlePosition()
{ return particle_position;}
inline G4ThreeVector GetParticleMomentumDirection()
{ return particle_momentum_direction;}
inline G4double GetTheta()
{ return Theta;}
inline G4double GetPhi()
{ return Phi;}
inline G4double GetParticleEnergy()
{return particle_energy;}
inline void SetNumberOfParticles(G4int i) { currentSource->SetNumberOfParticles(i); };
//
inline G4int GetNumberOfParticles() { return currentSource->GetNumberOfParticles(); };
inline G4ThreeVector GetParticlePosition() { return currentSource->GetParticlePosition();};
inline G4ThreeVector GetParticleMomentumDirection() { return currentSource->GetParticleMomentumDirection();};
inline G4double GetParticleEnergy() {return currentSource->GetParticleEnergy();};
private:
// Position distribution Variables
G4String SourcePosType; //Point,Plane,Surface,Volume
G4String Shape; //Circle,Square,Rectangle etc..
G4double halfx, halfy, halfz; //half lengths
G4double Radius; //Radius for circles or spheres
G4double Radius0; // The inner radius of an annulus
G4double SR,SX,SY; // Standard deviation in raduial, x, y for beam type source
G4ThreeVector CentreCoords; // Coords of centre of input shape
G4ThreeVector Rotx, Roty, Rotz; // Unit vectors defining rotation matrix
G4double ParAlpha, ParTheta, ParPhi; //Angle for Right Parallellepipeds
G4bool Confine; //If true confines source distribution to VolName
G4String VolName;
G4ThreeVector SideRefVec1,SideRefVec2,SideRefVec3; //Side rotation matrices
// Angular distribution variables.
G4String AngDistType; // String to hold Ang dist type iso, cos, user
G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
G4double DR,DX,DY ; // Standard deviation for beam divergence
G4double Theta, Phi; // Store these for use with DEBUG
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data
G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram.
G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins
G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram.
G4String UserDistType; //String to hold user distributions
G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt
// surface normals or co-ordinate system
G4bool UserAngRef; // Set to true when user defines aaa new coordinates
// Energy Distribution variables
G4String EnergyDisType; // energy dis type Variable - Mono,Lin,Exp,etc
G4double MonoEnergy; //Mono-energteic energy
G4double SE ; // Standard deviation for Gaussion distrbution in energy
G4double Emin, Emax; // emin and emax
G4double alpha, Ezero, Temp; // alpha (pow), E0 (exp) and Temp (bbody,brem)
G4double grad, cept; // gradient and intercept for linear spectra
G4bool EnergySpec; // true - energy spectra, false - momentum spectra
G4bool DiffSpec; // true - differential spec, false integral spec
G4bool ApplyRig; // false no rigidity cutoff, true then apply one
G4double ERig; // energy of rigidity cutoff
G4PhysicsOrderedFreeVector UDefEnergyH; // energy hist data
G4PhysicsOrderedFreeVector IPDFEnergyH;
G4bool IPDFEnergyExist, IPDFArbExist, Epnflag;
G4PhysicsOrderedFreeVector ArbEnergyH; // Arb x,y histogram
G4PhysicsOrderedFreeVector IPDFArbEnergyH; // IPDF for Arb
G4PhysicsOrderedFreeVector EpnEnergyH;
G4double CDGhist[3]; // cumulative histo for cdg
G4double BBHist[10001], Bbody_x[10001];
G4String IntType; // Interpolation type
G4double Arb_grad[1024], Arb_cept[1024]; // grad and cept for 1024 segments
G4double Arb_alpha[1024], Arb_Const[1024]; // alpha and constants
G4double Arb_ezero[1024]; // ezero
G4double ArbEmin, ArbEmax; // Emin and Emax for the whole arb distribution
//use primarily for debug.
// Bias variables
G4bool XBias, IPDFXBias;
G4PhysicsOrderedFreeVector XBiasH;
G4PhysicsOrderedFreeVector IPDFXBiasH;
G4bool YBias, IPDFYBias;
G4PhysicsOrderedFreeVector YBiasH;
G4PhysicsOrderedFreeVector IPDFYBiasH;
G4bool ZBias, IPDFZBias;
G4PhysicsOrderedFreeVector ZBiasH;
G4PhysicsOrderedFreeVector IPDFZBiasH;
G4bool ThetaBias, IPDFThetaBias;
G4PhysicsOrderedFreeVector ThetaBiasH;
G4PhysicsOrderedFreeVector IPDFThetaBiasH;
G4bool PhiBias, IPDFPhiBias;
G4PhysicsOrderedFreeVector PhiBiasH;
G4PhysicsOrderedFreeVector IPDFPhiBiasH;
G4bool EnergyBias, IPDFEnergyBias;
G4PhysicsOrderedFreeVector EnergyBiasH;
G4PhysicsOrderedFreeVector IPDFEnergyBiasH;
G4double bweights[6], bweight; //record x,y,z,theta,phi,energy weights
// Other particle properties
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition * particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
// Verbosity
G4int verbosityLevel;
void IntensityNormalization();
private:
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
G4bool normalised;
G4int currentSourceIdx;
G4SingleParticleSource* currentSource;
std::vector <G4SingleParticleSource*> sourceVector;
std::vector <G4double> sourceIntensity;
std::vector <G4double>sourceProbability;
G4DataInterpolation *SplineInt; // holds Spline stuff
G4GeneralParticleSourceMessenger *theMessenger;
G4Navigator *gNavigator;
// Nucleus theIon;
G4GeneralParticleSourceMessenger* theMessenger;
};
#endif
@@ -24,23 +24,32 @@
//
// MODULE: G4GeneralParticleSourceMessenger.hh
//
// Version: 1.1
// Date: 19/10/00
// Author: C Ferguson, F Lei and P Truscott
// Organisation: University of Southampton / DERA
// Version: 2.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSourceMessenger.hh,v 1.8 2002/02/26 16:34:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
// CHANGE HISTORY
// --------------
//
// Version 2.0, 05/02/2004, Fan Lei, Created.
// After changes to version 1.1 as in Geant4 v6.0
// - Mutilple particle source definition
// - Re-structured commands
// - old commonds have been retained for backward compatibility, will be
// removed in the future.
//
///////////////////////////////////////////////////////////////////////////////
//
//
// Class Description:
//
// The function of the G4GeneralParticleSourceMessenger is to allow the user to
// enter commands either in interactive command line mode or through macros to
// control the G4GeneralParticleSource. The G4GeneralParticleSourceMessenger
// class is based on G4ParticleGunMessenger.
// control the G4GeneralParticleSource.
//
///////////////////////////////////////////////////////////////////////////////
//
@@ -53,32 +62,22 @@
// ~G4GeneralParticleSourceMessenger()
// Destructor: Deletes commands.
//
// void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
// To selecte the particle gun to be defined/modified.
// void SetNewValue(G4UIcommand *command, G4String newValues)
// Uses the appropriate methods in the G4GeneralParticleSource to carry out
// the user commands.
//
// G4String GetCurrentValue(G4UIcommand *command)
// Allows the user to retrieve the current values of parameters.
// Not implemented yet.
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 28 February 2000, C Ferguson, Created.
//
// Version 1.1, 19 October 2000, Modified to inherit from G4VPrimaryGenerator.
// New name at the request of M. Asai.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4GeneralParticleSourceMessenger_h
#define G4GeneralParticleSourceMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
//#include "UIcmdWithNucleusAndUnit.hh"
class G4ParticleTable;
class G4UIcommand;
@@ -93,14 +92,17 @@ class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWithoutParameter;
class G4SingleParticleSource;
class G4GeneralParticleSource;
class G4GeneralParticleSourceMessenger: public G4UImessenger
{
public:
G4GeneralParticleSourceMessenger(G4GeneralParticleSource *fPtclGun);
G4GeneralParticleSourceMessenger(G4GeneralParticleSource*);
~G4GeneralParticleSourceMessenger();
void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
// To selecte the particle gun to be defined/modified.
void SetNewValue(G4UIcommand *command, G4String newValues);
// Identifies the command which has been invoked by the user, extracts the
// parameters associated with that command (held in newValues), and uses
@@ -111,13 +113,42 @@ private:
void IonCommand(G4String newValues);
private:
G4GeneralParticleSource *fParticleGun;
G4GeneralParticleSource *fGPS;
G4SingleParticleSource *fParticleGun;
G4ParticleTable *particleTable;
G4String histtype;
private: //commands
G4UIdirectory *gpsDirectory;
// multiple source control commands
G4UIdirectory *sourceDirectory;
G4UIcmdWithADouble *addsourceCmd;
G4UIcmdWithoutParameter *listsourceCmd;
G4UIcmdWithoutParameter *clearsourceCmd;
G4UIcmdWithoutParameter *getsourceCmd;
G4UIcmdWithAnInteger *setsourceCmd;
G4UIcmdWithADouble *setintensityCmd;
G4UIcmdWithAnInteger *deletesourceCmd;
// positional commands
G4UIdirectory *positionDirectory;
G4UIcmdWithAString *typeCmd1;
G4UIcmdWithAString *shapeCmd1;
G4UIcmdWith3VectorAndUnit *centreCmd1;
G4UIcmdWith3Vector *posrot1Cmd1;
G4UIcmdWith3Vector *posrot2Cmd1;
G4UIcmdWithADoubleAndUnit *halfxCmd1;
G4UIcmdWithADoubleAndUnit *halfyCmd1;
G4UIcmdWithADoubleAndUnit *halfzCmd1;
G4UIcmdWithADoubleAndUnit *radiusCmd1;
G4UIcmdWithADoubleAndUnit *radius0Cmd1;
G4UIcmdWithADoubleAndUnit *possigmarCmd1;
G4UIcmdWithADoubleAndUnit *possigmaxCmd1;
G4UIcmdWithADoubleAndUnit *possigmayCmd1;
G4UIcmdWithADoubleAndUnit *paralpCmd1;
G4UIcmdWithADoubleAndUnit *partheCmd1;
G4UIcmdWithADoubleAndUnit *parphiCmd1;
G4UIcmdWithAString *confineCmd1;
//old ones, will be reomved soon
G4UIcmdWithAString *typeCmd;
G4UIcmdWithAString *shapeCmd;
G4UIcmdWith3VectorAndUnit *centreCmd;
@@ -135,7 +166,21 @@ private: //commands
G4UIcmdWithADoubleAndUnit *partheCmd;
G4UIcmdWithADoubleAndUnit *parphiCmd;
G4UIcmdWithAString *confineCmd;
// angular commands
G4UIdirectory *angularDirectory;
G4UIcmdWithAString *angtypeCmd1;
G4UIcmdWith3Vector *angrot1Cmd1;
G4UIcmdWith3Vector *angrot2Cmd1;
G4UIcmdWithADoubleAndUnit *minthetaCmd1;
G4UIcmdWithADoubleAndUnit *maxthetaCmd1;
G4UIcmdWithADoubleAndUnit *minphiCmd1;
G4UIcmdWithADoubleAndUnit *maxphiCmd1;
G4UIcmdWithADoubleAndUnit *angsigmarCmd1;
G4UIcmdWithADoubleAndUnit *angsigmaxCmd1;
G4UIcmdWithADoubleAndUnit *angsigmayCmd1;
G4UIcmdWithABool *useuserangaxisCmd1;
G4UIcmdWithABool *surfnormCmd1;
// old ones, will be removed soon
G4UIcmdWithAString *angtypeCmd;
G4UIcmdWith3Vector *angrot1Cmd;
G4UIcmdWith3Vector *angrot2Cmd;
@@ -148,7 +193,22 @@ private: //commands
G4UIcmdWithADoubleAndUnit *angsigmayCmd;
G4UIcmdWithABool *useuserangaxisCmd;
G4UIcmdWithABool *surfnormCmd;
// energy commands
G4UIdirectory *energyDirectory;
G4UIcmdWithAString *energytypeCmd1;
G4UIcmdWithADoubleAndUnit *eminCmd1;
G4UIcmdWithADoubleAndUnit *emaxCmd1;
G4UIcmdWithADoubleAndUnit *monoenergyCmd1;
G4UIcmdWithADoubleAndUnit *engsigmaCmd1;
G4UIcmdWithADouble *alphaCmd1;
G4UIcmdWithADouble *tempCmd1;
G4UIcmdWithADouble *ezeroCmd1;
G4UIcmdWithADouble *gradientCmd1;
G4UIcmdWithADouble *interceptCmd1;
G4UIcmdWithoutParameter *calculateCmd1;
G4UIcmdWithABool *energyspecCmd1;
G4UIcmdWithABool *diffspecCmd1;
// old ones, will be removed soon
G4UIcmdWithAString *energytypeCmd;
G4UIcmdWithADoubleAndUnit *eminCmd;
G4UIcmdWithADoubleAndUnit *emaxCmd;
@@ -162,24 +222,28 @@ private: //commands
G4UIcmdWithoutParameter *calculateCmd;
G4UIcmdWithABool *energyspecCmd;
G4UIcmdWithABool *diffspecCmd;
// histogram commands
G4UIdirectory *histDirectory;
G4UIcmdWith3Vector *histpointCmd;
G4UIcmdWithAString *histnameCmd;
G4UIcmdWithAString *arbintCmd;
G4UIcmdWithAString *resethistCmd;
// old ones, will be removed soon
G4UIcmdWith3Vector *histpointCmd1;
G4UIcmdWithAString *histnameCmd1;
G4UIcmdWithAString *arbintCmd1;
G4UIcmdWithAString *resethistCmd1;
//
G4UIcmdWithAnInteger *verbosityCmd;
// below are commands from G4ParticleGun
G4UIcommand *ionCmd;
G4UIcmdWithAString *particleCmd;
G4UIcmdWithADoubleAndUnit *timeCmd;
G4UIcmdWith3Vector *polCmd;
G4UIcmdWithAnInteger *numberCmd;
G4UIcmdWith3VectorAndUnit *positionCmd;
G4UIcmdWith3Vector *directionCmd;
G4UIcmdWithADoubleAndUnit *energyCmd;
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtParticle.hh,v 1.5 2001/07/13 15:01:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4HEPEvtParticle.hh,v 1.8 2004/06/11 14:11:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -75,7 +75,11 @@ class G4HEPEvtParticle
{ return JDAHEP2; }
};
extern G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
#endif
inline void * G4HEPEvtParticle::operator new(size_t)
{
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.hh,v 1.11 2003/09/12 21:51:32 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryParticle.hh,v 1.14 2004/06/11 14:11:16 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -188,7 +188,11 @@ class G4PrimaryParticle
}
};
extern G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
#endif
inline void * G4PrimaryParticle::operator new(size_t)
{
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.hh,v 1.8 2003/09/12 21:51:32 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryVertex.hh,v 1.11 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -139,7 +139,11 @@ class G4PrimaryVertex
{ return userInfo; }
};
extern G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
#endif
inline void * G4PrimaryVertex::operator new(size_t)
{
@@ -0,0 +1,223 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSAngDistribution.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// To generate the direction of a primary vertex according to the defined distribution
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSAngDistribution ()
// Constructor: Initializes variables
//
// ~G4SPSAngDistribution ()
// Destructor:
//
// void SetAngDistType(G4String)
// Used to set the type of angular distribution wanted. Arguments
// are iso, cos, beam and user for isotropic, cosine-law, beam and user-defined
// respectively.
//
// void DefineAngRefAxes(G4String, G4ThreeVector)
// DefineAngRefAxes is used in a similar way as SetPosRot to
// define vectors, one x' and one in the plane x'y', to create
// a rotated set of axes for the angular distribution.
//
// void SetMinTheta(G4double)
// Sets the minimum value for the angle theta.
//
// void SetMinPhi(G4double)
// Sets the minimum value for phi.
//
// void SetMaxTheta(G4double)
// Sets the maximum value for theta.
//
// void SetMaxPhi(G4double)
// Sets the maximum value for phi.
//
// void UserDefAngTheta(G4ThreeVector)
// This method allows the user to define a histogram in Theta.
//
// void UserDefAngPhi(G4ThreeVector)
// This method allows the user to define a histogram in phi.
//
// void GenerateIsotropicFlux()
// This method generates momentum vectors for particles according
// to an isotropic distribution.
//
// void GenerateCosineLawFlux()
// This method generates momentum vectors for particles according
// to a cosine-law distribution.
//
// void GenerateUserDefFlux()
// Controls generation of momentum vectors according to user-defined
// distributions.
//
// G4double GenerateUserDefTheta()
// Generates the theta angle according to a user-defined distribution.
//
// G4double GenerateUserDefPhi()
// Generates phi according to a user-defined distribution.
//
// void SetBeamSigmaInAngR(G4double);
// Sets the sigma for 1D beam
//
// void SetBeamSigmaInAngX(G4double);
// Sets the first sigma for 2D beam
//
// void SetBeamSigmaInAngY(G4double);
// Sets the second sigma for 2D beam
//
// void SetUserWRTSurface(G4bool)
// Allows user to have user-defined spectra either with respect to the
// co-ordinate system (default) or with respect to the surface normal.
//
// void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; };
// Sets the required position generator, required for determining the cosine-law distribution
//
// void SetBiasRndm (G4SPSRandomGenerator* a)
// Sets the biased random number generator
//
// G4ThreeVector GenerateOne();
// Generate one random direction
//
// void ReSetHist(G4String);
// Re-sets the histogram for user defined distribution
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SPSAngDistribution_h
#define G4SPSAngDistribution_h 1
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4DataInterpolation.hh"
#include "G4ParticleMomentum.hh"
#include "G4SPSPosDistribution.hh"
#include "G4SPSRandomGenerator.hh"
class G4SPSAngDistribution
{
public:
G4SPSAngDistribution ();
~G4SPSAngDistribution ();
// Angular Distribution Methods
void SetAngDistType(G4String);
void DefineAngRefAxes(G4String, G4ThreeVector);
void SetMinTheta(G4double);
void SetMinPhi(G4double);
void SetMaxTheta(G4double);
void SetMaxPhi(G4double);
void SetBeamSigmaInAngR(G4double);
void SetBeamSigmaInAngX(G4double);
void SetBeamSigmaInAngY(G4double);
void UserDefAngTheta(G4ThreeVector);
void UserDefAngPhi(G4ThreeVector);
inline void SetParticleMomentumDirection
(G4ParticleMomentum aMomentumDirection)
{ particle_momentum_direction = aMomentumDirection.unit(); }
void SetUseUserAngAxis(G4bool);
void SetUserWRTSurface(G4bool);
//
void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; };
void SetBiasRndm(G4SPSRandomGenerator* a) {angRndm = a;};
// method to re-set the histograms
void ReSetHist(G4String);
//
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
//
G4ParticleMomentum GenerateOne();
private:
// These methods generate the momentum vectors for the particles.
void GenerateIsotropicFlux();
void GenerateCosineLawFlux();
void GenerateBeamFlux();
void GeneratePlanarFlux();
void GenerateUserDefFlux();
G4double GenerateUserDefTheta();
G4double GenerateUserDefPhi();
private:
// Angular distribution variables.
G4String AngDistType; // String to hold Ang dist type iso, cos, user
G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
G4double DR,DX,DY ; // Standard deviations for beam divergence
G4double Theta, Phi; // Store these for use with DEBUG
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data
G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram.
G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins
G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram.
G4String UserDistType; //String to hold user distributions
G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt
// surface normals or co-ordinate system
G4bool UserAngRef; // Set to true when user defines a new coordinates
//
G4ParticleMomentum particle_momentum_direction;
//
G4SPSPosDistribution* posDist; // need it here for the cosine-law distri
G4SPSRandomGenerator* angRndm; // biased random generator
// Verbosity
G4int verbosityLevel;
//
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
};
#endif
@@ -0,0 +1,251 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSEneDistribution.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
//
// Class Description:
//
// To generate the energy of a primary vertex according to the defined distribution
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSEneDistribution ()
// Constructor: Initializes variables
//
// ~G4SPSEneDistribution ()
// Destructor:
//
// void SetEnergyDisType(G4String)
// Allows the user to choose the energy distribution type. The arguments
// are Mono (mono-energetic), Lin (linear), Pow (power-law), Exp
// (exponential), Gauss (gaussian), Brem (bremsstrahlung), BBody (black-body), Cdg
// (cosmic diffuse gamma-ray), User (user-defined), Arb (arbitrary
// point-wise), Epn (energy per nucleon).
//
// void SetEmin(G4double)
// Sets the minimum energy.
//
// void SetEmax(G4double)
// Sets the maximum energy.
//
// void SetMonoEnergy(G4double)
// Sets energy for mono-energetic distribution.
//
// void SetAlpha(G4double)
// Sets alpha for a power-law distribution.
//
// void SetTemp(G4double)
// Sets Temperature for a Brem or BBody distributions.
//
// void SetEzero(G4double)
// Sets Ezero for an exponential distribution.
//
// void SetGradient(G4double)
// Sets gradient for a linear distribution.
//
// void SetInterCept(G4double)
// Sets intercept for a linear distribution.
//
// void UserEnergyHisto(G4ThreeVector)
// Allows user to defined a histogram for the energy distribution.
//
// void ArbEnergyHisto(G4ThreeVector)
// Allows the user to define an Arbitrary set of points for the
// energy distribution.
//
// void EpnEnergyHisto(G4ThreeVector)
// Allows the user to define an Energy per nucleon histogram.
//
// void Calculate()
// Controls the calculation of Integral PDF for the Cdg and BBody
// distributions.
//
// void InputEnergySpectra(G4bool)
// Allows the user to choose between momentum and energy histograms
// for user-defined histograms and arbitrary point-wise spectr.
// The default is true (energy).
//
// void InputDifferentialSpectra(G4bool)
// Allows the user to choose between integral and differential
// distributions when using the arbitrary point-wise option.
//
// void ArbInterpolate(G4String)
// ArbInterpolate allows the user to specify the type of function to
// interpolate the Arbitrary points spectrum with.
//
// void SetBiasRndm (G4SPSRandomGenerator* a)
// Sets the biased random number generator
//
// G4double GenerateOne(G4ParticleDefinition*);
// Generate one random energy for the specified particle
//
// void ReSetHist(G4String);
// Re-sets the histogram for user defined distribution
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef G4SPSEneDistribution_h
#define G4SPSEneDistribution_h 1
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
#include "G4DataInterpolation.hh"
//
#include "G4SPSRandomGenerator.hh"
class G4SPSEneDistribution
{
public:
G4SPSEneDistribution ();
~G4SPSEneDistribution ();
void SetEnergyDisType(G4String);
inline G4String GetEnergyDisType() {return EnergyDisType;};
void SetEmin(G4double);
inline G4double GetEmin() {return Emin;} ;
inline G4double GetArbEmin() {return ArbEmin;} ;
void SetEmax(G4double);
inline G4double GetEmax() {return Emax;} ;
inline G4double GetArbEmax() {return ArbEmax;};
void SetMonoEnergy(G4double);
void SetAlpha(G4double);
void SetTemp(G4double);
void SetBeamSigmaInE(G4double);
void SetEzero(G4double);
void SetGradient(G4double);
void SetInterCept(G4double);
void UserEnergyHisto(G4ThreeVector);
void ArbEnergyHisto(G4ThreeVector);
void EpnEnergyHisto(G4ThreeVector);
void InputEnergySpectra(G4bool);
void InputDifferentialSpectra(G4bool);
void ArbInterpolate(G4String);
inline G4String GetIntType() {return IntType;};
void Calculate();
//
void SetBiasRndm(G4SPSRandomGenerator* a) {eneRndm = a; };
// method to re-set the histograms
void ReSetHist(G4String);
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
//x
G4double GenerateOne(G4ParticleDefinition*);
private:
void LinearInterpolation();
void LogInterpolation();
void ExpInterpolation();
void SplineInterpolation();
void CalculateCdgSpectrum();
void CalculateBbodySpectrum();
// The following methods generate energies according to the spectral
// parameters defined above.
void GenerateMonoEnergetic();
void GenerateLinearEnergies(G4bool);
void GeneratePowEnergies(G4bool);
void GenerateExpEnergies(G4bool );
void GenerateGaussEnergies();
void GenerateBremEnergies();
void GenerateBbodyEnergies();
void GenerateCdgEnergies();
void GenUserHistEnergies();
void GenEpnHistEnergies();
void GenArbPointEnergies();
// converts energy per nucleon to energy.
void ConvertEPNToEnergy();
private:
G4String EnergyDisType; // energy dis type Variable - Mono,Lin,Exp,etc
G4double MonoEnergy; //Mono-energteic energy
G4double SE ; // Standard deviation for Gaussion distrbution in energy
G4double Emin, Emax; // emin and emax
G4double alpha, Ezero, Temp; // alpha (pow), E0 (exp) and Temp (bbody,brem)
G4double grad, cept; // gradient and intercept for linear spectra
G4bool EnergySpec; // true - energy spectra, false - momentum spectra
G4bool DiffSpec; // true - differential spec, false integral spec
G4bool ApplyRig; // false no rigidity cutoff, true then apply one
G4double ERig; // energy of rigidity cutoff
G4PhysicsOrderedFreeVector UDefEnergyH; // energy hist data
G4PhysicsOrderedFreeVector IPDFEnergyH;
G4bool IPDFEnergyExist, IPDFArbExist, Epnflag;
G4PhysicsOrderedFreeVector ArbEnergyH; // Arb x,y histogram
G4PhysicsOrderedFreeVector IPDFArbEnergyH; // IPDF for Arb
G4PhysicsOrderedFreeVector EpnEnergyH;
G4double CDGhist[3]; // cumulative histo for cdg
G4double BBHist[10001], Bbody_x[10001];
G4String IntType; // Interpolation type
G4double Arb_grad[1024], Arb_cept[1024]; // grad and cept for 1024 segments
G4double Arb_alpha[1024], Arb_Const[1024]; // alpha and constants
G4double Arb_ezero[1024]; // ezero
G4double ArbEmin, ArbEmax; // Emin and Emax for the whole arb distribution used primarily for debug.
G4double particle_energy;
G4ParticleDefinition* particle_definition;
G4SPSRandomGenerator* eneRndm;
// Verbosity
G4int verbosityLevel;
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
G4DataInterpolation *SplineInt; // holds Spline stuff
};
#endif
@@ -0,0 +1,218 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSPosDistribution.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
//
// Class Description:
//
// To generate the position of a primary vertex according to the defined distribution
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSPosDistribution ()
// Constructor: Initializes variables and instantiates the Navigator class
//
// ~G4SPSPosDistribution ()
// Destructor:
//
// void SetPosDisType(G4String)
// Allows user to choose Point, Plane, Surface or Volume source
// position distributions.
//
// void SetPosDisShape(G4String)
// Allows the user to choose the particular shape they wish for the
// position distribution. Choices are Square, Circle, Ellipse, Rectangle,
// Sphere, Ellipsoid, Cylinder, Parallelepiped.
//
// void SetCentreCoords(G4ThreeVector)
// Sets the co-ordinates of the centre of the position distribution.
//
// void SetPosRot1(G4ThreeVector)
// Used to specify the co-ordinate system for the position distribution
// along with SetPosRot2. SetPosRot1 sets the vector x' and need not be
// a unit vector.
//
// void SetPosRot2(G4ThreeVector)
// Used in connection with SetPosRot1. This sets a vector in the plane
// x'y'. By a series of cross products x', y', z' are generated. Again
// need not be a unit vector.
//
// void SetHalfX(G4double)
// Sets the half length in x.
//
// void SetHalfY(G4double)
// Sets the half length in y.
//
// void SetHalfZ(G4double)
// Sets the half length in z.
//
// void SetRadius(G4double)
// Sets the radius where appropriate for source distribution shapes.
//
// void SetRadius0(G4double)
// Sets the inner radius where appropriate for source distribution shapes.
//
// void SetBeamSigmaInR(G4double);
// Sets the sigma for 1D beam
//
// void SetBeamSigmaInX(G4double);
// Sets the first sigma for 2D beam
//
// void SetBeamSigmaInY(G4double);
// Sets the second sigma for 2D beam
//
// void SetParAlpha(G4double)
// Sets the angle Alpha in the Parallelepiped shapes.
//
// void SetParTheta(G4double)
// Sets the angle Theta in the Parallelepiped shapes.
//
// void SetParPhi(G4double)
// Sets the angle Phi in the Parallelepiped shapes.
//
// void ConfineSourceToVolume(G4String)
// Used to confine the start positions to a particular volume.
//
// void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
// Sets the biased random number generator
//
// G4ThreeVector GenerateOne();
// Generate one random position
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SPSPosDistribution_h
#define G4SPSPosDistribution_h 1
#include "G4Navigator.hh"
#include "G4SPSRandomGenerator.hh"
class G4SPSPosDistribution
{
//
friend class G4SPSAngDistribution;
public:
G4SPSPosDistribution ();
~G4SPSPosDistribution ();
// methods to create source position dist.
void SetPosDisType(G4String); // Point, Plane, Surface, Volume
inline G4String GetPosDisType() { return SourcePosType; };
void SetPosDisShape(G4String);
inline G4String GetPosDisShape() { return Shape; };
// SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere,
// Ellipsoid, Cylinder, Right (parallelepiped).
void SetCentreCoords(G4ThreeVector);
inline G4ThreeVector GetCentreCoords() { return CentreCoords; } ;
void SetPosRot1(G4ThreeVector);
void SetPosRot2(G4ThreeVector);
void SetHalfX(G4double);
inline G4double GetHalfX() { return halfx; } ;
void SetHalfY(G4double);
inline G4double GetHalfY() { return halfy; } ;
void SetHalfZ(G4double);
inline G4double GetHalfZ() { return halfz; } ;
void SetRadius(G4double);
inline G4double GetRadius() { return Radius; };
void SetRadius0(G4double);
void SetBeamSigmaInR(G4double);
void SetBeamSigmaInX(G4double);
void SetBeamSigmaInY(G4double);
void SetParAlpha(G4double);
void SetParTheta(G4double);
void SetParPhi(G4double);
void ConfineSourceToVolume(G4String);
//
void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
//
G4ThreeVector GenerateOne();
private:
void GenerateRotationMatrices();
// the following routines generate the source position
void GeneratePointSource();
void GeneratePointsInBeam();
void GeneratePointsInPlane();
void GeneratePointsOnSurface();
void GeneratePointsInVolume();
G4bool IsSourceConfined();
private:
// Position distribution Variables
G4String SourcePosType; //Point,Plane,Surface,Volume
G4String Shape; //Circle,Square,Rectangle etc..
G4double halfx, halfy, halfz; //half lengths
G4double Radius; //Radius for circles or spheres
G4double Radius0; // The inner radius of an annulus
G4double SR,SX,SY; // Standard deviation in raduial, x, y for beam type source
G4ThreeVector CentreCoords; // Coords of centre of input shape
G4ThreeVector Rotx, Roty, Rotz; // Unit vectors defining rotation matrix
G4double ParAlpha, ParTheta, ParPhi; //Angle for Right Parallellepipeds
G4bool Confine; //If true confines source distribution to VolName
G4String VolName;
G4ThreeVector SideRefVec1,SideRefVec2,SideRefVec3; //Side rotation matrices
G4ThreeVector particle_position; // the final particle position to be returned
//
G4Navigator *gNavigator;
//
G4SPSRandomGenerator* posRndm; // biased random generator
// Verbosity
G4int verbosityLevel;
};
#endif
@@ -0,0 +1,187 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSRandomGenerator.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// Special random number generator used by G4GeneralParticleSource to allow
// biasing applied at the lowest level for all distributions.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSRandomGenerator ()
// Constructor: Initializes variables
//
// ~G4SPSRandomGenerator ()
// Destructor:
//
// void SetXBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate x co-ordinates.
//
// void SetYBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate y co-ordinates.
//
// void SetZBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate z co-ordinates.
//
// void SetThetaBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of theta.
//
// void SetPhiBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of phi.
//
// void SetEnergyBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate the energies.
//
// G4double GenRandX()
// Generates the random number for x, with or without biasing.
//
// G4double GenRandY()
// Generates the random number for y, with or without biasing.
//
// G4double GenRandZ()
// Generates the random number for z, with or without biasing.
//
// G4double GenRandTheta()
// Generates the random number for theta, with or without biasing.
//
// G4double GenRandPhi()
// Generates the random number for phi, with or without biasing.
//
// G4double GenRandEnergy()
// Generates the random number for energy, with or without biasing.
//
// inline G4double GetBiasWeight()
// Returns the weight change after biasing
//
// void ReSetHist(G4String);
// Re-sets the histogram for user defined distribution
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SPSRandomGenerator_h
#define G4SPSRandomGenerator_h 1
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4DataInterpolation.hh"
class G4SPSRandomGenerator
{
public:
G4SPSRandomGenerator ();
~G4SPSRandomGenerator ();
// static G4SPSRandomGenerator* getInstance ();
// Biasing Methods
void SetXBias(G4ThreeVector);
void SetYBias(G4ThreeVector);
void SetZBias(G4ThreeVector);
void SetThetaBias(G4ThreeVector);
void SetPhiBias(G4ThreeVector);
void SetEnergyBias(G4ThreeVector);
G4double GenRandX();
G4double GenRandY();
G4double GenRandZ();
G4double GenRandTheta();
G4double GenRandPhi();
G4double GenRandEnergy();
inline G4double GetBiasWeight()
{ return bweights[0]*bweights[1]*bweights[2]*bweights[3]*bweights[4]*bweights[5];};
// method to re-set the histograms
void ReSetHist(G4String);
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
private:
// static G4SPSRandomGenerator *instance;
G4bool XBias, IPDFXBias;
G4PhysicsOrderedFreeVector XBiasH;
G4PhysicsOrderedFreeVector IPDFXBiasH;
G4bool YBias, IPDFYBias;
G4PhysicsOrderedFreeVector YBiasH;
G4PhysicsOrderedFreeVector IPDFYBiasH;
G4bool ZBias, IPDFZBias;
G4PhysicsOrderedFreeVector ZBiasH;
G4PhysicsOrderedFreeVector IPDFZBiasH;
G4bool ThetaBias, IPDFThetaBias;
G4PhysicsOrderedFreeVector ThetaBiasH;
G4PhysicsOrderedFreeVector IPDFThetaBiasH;
G4bool PhiBias, IPDFPhiBias;
G4PhysicsOrderedFreeVector PhiBiasH;
G4PhysicsOrderedFreeVector IPDFPhiBiasH;
G4bool EnergyBias, IPDFEnergyBias;
G4PhysicsOrderedFreeVector EnergyBiasH;
G4PhysicsOrderedFreeVector IPDFEnergyBiasH;
G4double bweights[6]; //record x,y,z,theta,phi,energy weights
// Verbosity
G4int verbosityLevel;
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
};
#endif
@@ -0,0 +1,184 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SingleParticleSource.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// The Single Particle Source is designed to extend the functionality of the
// G4ParticleGun class. It is designed to allow specification of input
// particles in terms of position, direction (or angular) and energy
// distributions. It is used by the General Particle source class
// and it is derived from G4VPrimaryGenerator.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SingleParticleSource ()
// Constructor: Initializes variables and instantiates the
// Messenger and Navigator classes
//
// ~G4SingleParticleSource ()
// Destructor: deletes Messenger and prints out run information.
//
// void GeneratePrimaryVertex(G4Event *evt)
// Generate the particles initial parameters.
//
// G4SPSPosDistribution* GetPosDist()
// Return a pointer to the position distribution generator
//
// G4SPSAngDistribution* GetAngDist()
// Return a pointer to the angular distribution generator
//
// G4SPSEneDistribution* GetEneDist()
// Return a pointer to the energy distribution generator
//
// G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;};
// Return a pointer to the biased random number generator
//
// void SetVerbosity(G4int);
// Set the verbosity level.
//
// void SetParticleDefinition ();
// G4ParticleDefinition * GetParticleDefinition ()
// Get/Set the particle definition of the primary track
//
// void SetParticleCharge(G4double aCharge)
// set the charge state of the primary track
//
// inline void SetParticlePolarization (G4ThreeVector aVal)
// inline G4ThreeVector GetParticlePolarization ()
// Set/Get the polarization state of the primary track
//
// inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
// inline G4double GetParticleTime() { return particle_time; };
// Set/Get the Time.
//
// inline void SetNumberOfParticles(G4int i)
// inline G4int GetNumberOfParticles()
// set/get the number of particles to be generated in the primary track
//
// inline G4ThreeVector GetParticlePosition()
// inline G4ThreeVector GetParticleMomentumDirection()
// inline G4double GetParticleEnergy()
// get the position, direction, and energy of the current particle
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SingleParticleSource_h
#define G4SingleParticleSource_h 1
#include "G4VPrimaryGenerator.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
//
#include "G4SPSPosDistribution.hh"
#include "G4SPSAngDistribution.hh"
#include "G4SPSEneDistribution.hh"
#include "G4SPSRandomGenerator.hh"
class G4SingleParticleSource : public G4VPrimaryGenerator
{
public:
G4SingleParticleSource ();
~G4SingleParticleSource ();
void GeneratePrimaryVertex(G4Event *evt);
//
G4SPSPosDistribution* GetPosDist() {return posGenerator;};
G4SPSAngDistribution* GetAngDist() {return angGenerator;};
G4SPSEneDistribution* GetEneDist() {return eneGenerator;};
G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;};
// Set the verbosity level.
void SetVerbosity(G4int);
// Set the particle species
void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition);
inline G4ParticleDefinition * GetParticleDefinition () { return particle_definition;} ;
inline void SetParticleCharge(G4double aCharge) { particle_charge = aCharge; } ;
// Set polarization
inline void SetParticlePolarization (G4ThreeVector aVal) {particle_polarization = aVal;};
inline G4ThreeVector GetParticlePolarization () {return particle_polarization;};
// Set Time.
inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
inline G4double GetParticleTime() { return particle_time; };
inline void SetNumberOfParticles(G4int i) { NumberOfParticlesToBeGenerated = i; };
//
inline G4int GetNumberOfParticles() { return NumberOfParticlesToBeGenerated; };
inline G4ThreeVector GetParticlePosition() { return particle_position;};
inline G4ThreeVector GetParticleMomentumDirection() { return particle_momentum_direction;};
inline G4double GetParticleEnergy() {return particle_energy;};
private:
G4SPSPosDistribution* posGenerator;
G4SPSAngDistribution* angGenerator;
G4SPSEneDistribution* eneGenerator;
G4SPSRandomGenerator* biasRndm;
//
// Other particle properties
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition * particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
G4double particle_weight;
// Verbosity
G4int verbosityLevel;
};
#endif
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackedTrack.hh,v 1.6 2001/07/13 15:01:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4StackedTrack.hh,v 1.9 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// Last Modification : 02/Feb/96 M.Asai
@@ -83,7 +83,11 @@ class G4StackedTrack
{ nextStackedTrack = value; }
};
extern G4Allocator<G4StackedTrack> aStackedTrackAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4StackedTrack> aStackedTrackAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4StackedTrack> aStackedTrackAllocator;
#endif
inline void * G4StackedTrack::operator new(size_t)
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoryContainer.hh,v 1.11 2003/06/16 16:50:31 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4TrajectoryContainer.hh,v 1.14 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// G4TrajectoryContainer
@@ -73,8 +73,11 @@ class G4TrajectoryContainer
TrajectoryVector* vect;
};
extern G4Allocator<G4TrajectoryContainer> aTrajectoryContainerAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4TrajectoryContainer> aTrajectoryContainerAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4TrajectoryContainer> aTrajectoryContainerAllocator;
#endif
inline void* G4TrajectoryContainer::operator new(size_t)
{